tags:

views:

238

answers:

2

I want to write application settings in the registry, that are shared by x86 and x64 applications running on Windows 7 x64.

The best practice is to save them in HKEY_LOCAL_MACHINE\Software\Company\Product, but that gets redirected when in WOW64.

Can I write them in HKEY_LOCAL_MACHINE\System.. instead? Or System is reserved for other thigns?

+1  A: 

When in x64 mode, you can still access the values of the WOW64 mode. The WOW64 HKEY_LOCAL_MACHINE\Software\Company\Product will be under HKEY_LOCAL_MACHINE\Software\Wow6432Node\Company\Product.

Edit:

Reflection can also be disabled for certain keys, as it is described here: http://msdn.microsoft.com/en-us/library/ms724072%28VS.85%29.aspx

treaschf
But I don't want to hardcode Wow6432 in my program (I've read that's not recommended). It'd be better to disable redirection for my key.. can I do that?
Nestor
I think what can be disabled is reflection, but not redirection... am I right?
Nestor
You are right. :)
treaschf
Using XML files can be a better approach.
Lex Li
A: 

You can use the SetRegView option as described in the manual: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.7.6

Function .onInit SetRegView 64 ReadRegStr $INSTDIR HKLM Software\NSIS "" SetRegView 32 FunctionEnd

Rogier