Re: [WiX-users] Accessing Regsitry Values from an Immediate CustomAction

2012-04-30 Thread Peter Shirtcliffe
It can be immediate if you schedule it after InstallFinalize.

-Original Message-
From: Liam Flanagan [mailto:l...@dyalog.com] 
Sent: Monday, April 30, 2012 9:04 AM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Accessing Regsitry Values from an Immediate CustomAction

Hello,

I have a wix based installer that writes some registry values using the
standard wix registry element a bit like:
 RegistryValue Action=write Type=string Root=HKMU 
 Key=Software\Company\Key Name=KeyName Value=1/
Is it possible for me to be able to read these values from a *immediate*
custom action? If so when do I need to schedule it?

I've currently got an immediate custom action that is scheduled *after
WriteRegistryValues* but it doesn't seem to be able to read the written
entries: RegOpenKeyEx returns ERROR_FILE_NOT_FOUND when trying to open the
relevant key with read access. Custom action xml is:
 CustomAction Id=MyCustomAction Impersonate=yes Return=ignore 
 Execute=immediate BinaryKey=MyCustomActionDll 
 DllEntry=MyCustomAction /
and the sequencing is:
 InstallExecuteSequence
 Custom Action=MyCustomAction After=WriteRegistryValuesNOT 
 Installed/Custom /InstallExecuteSequence

*Other Notes*

  * In the example ALLUSERS is 1 so the registry values will end up in
the HKEY_LOCAL_MACHINE key.
  * As a result of the above the installation is given elevated privileges.
  * I've got the custom action's impersonate value set to yes as there
are various pieces of user information I want to access from the CA.
AFAIK this shouldn't be an issue as long as I only want to *read*
keys from HKEY_LOCAL_MACHINE, which is the case. Any modification
happens in the HKEY_CURRENT_USER key.

*Environment*

  * Compiled using Wix v3.5
  * Installing on a Windows 7 Enterprise (SP1) machine

--
Liam
-
-
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will
include endpoint security, mobile security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
SDL PLC confidential, all rights reserved.
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] Accessing Regsitry Values from an Immediate CustomAction

2012-04-30 Thread Liam Flanagan
Peter,

That worked perfectly =)

I thought I'd tried this at some point whilst debugging but clearly I 
was mistaken...

Thanks,

Liam

On 30/04/2012 11:53, Peter Shirtcliffe wrote:
 It can be immediate if you schedule it after InstallFinalize.

 -Original Message-
 From: Liam Flanagan [mailto:l...@dyalog.com]
 Sent: Monday, April 30, 2012 9:04 AM
 To: General discussion for Windows Installer XML toolset.
 Subject: [WiX-users] Accessing Regsitry Values from an Immediate CustomAction

 Hello,

 I have a wix based installer that writes some registry values using the
 standard wix registry element a bit like:
 RegistryValue Action=write Type=string Root=HKMU
 Key=Software\Company\Key Name=KeyName Value=1/
 Is it possible for me to be able to read these values from a *immediate*
 custom action? If so when do I need to schedule it?

 I've currently got an immediate custom action that is scheduled *after
 WriteRegistryValues* but it doesn't seem to be able to read the written
 entries: RegOpenKeyEx returns ERROR_FILE_NOT_FOUND when trying to open the
 relevant key with read access. Custom action xml is:
 CustomAction Id=MyCustomAction Impersonate=yes Return=ignore
 Execute=immediate BinaryKey=MyCustomActionDll
 DllEntry=MyCustomAction /
 and the sequencing is:
 InstallExecuteSequence
 Custom Action=MyCustomAction After=WriteRegistryValuesNOT
 Installed/Custom  /InstallExecuteSequence
 *Other Notes*

* In the example ALLUSERS is 1 so the registry values will end up in
  the HKEY_LOCAL_MACHINE key.
* As a result of the above the installation is given elevated privileges.
* I've got the custom action's impersonate value set to yes as there
  are various pieces of user information I want to access from the CA.
  AFAIK this shouldn't be an issue as long as I only want to *read*
  keys from HKEY_LOCAL_MACHINE, which is the case. Any modification
  happens in the HKEY_CURRENT_USER key.

 *Environment*

* Compiled using Wix v3.5
* Installing on a Windows 7 Enterprise (SP1) machine

 --
 Liam
 -
 -
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and threat
 landscape has changed and how IT managers can respond. Discussions will
 include endpoint security, mobile security and the latest in malware threats.
 http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 WiX-users mailing list
 WiX-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wix-users
 SDL PLC confidential, all rights reserved.
 If you are not the intended recipient of this mail SDL requests and requires 
 that you delete it without acting upon or copying any of its contents, and we 
 further request that you advise us.
 SDL PLC is a public limited company registered in England and Wales.  
 Registered number: 02675207.
 Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 
 7DY, UK.


 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 WiX-users mailing list
 WiX-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wix-users

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users