tags:

views:

2011

answers:

2

Hi all,

I have come code that reads the registry and looks for a value in HKEY_LOCAL_MACHINE\Software\App\ but when running on 64bit versions of Windows the value is under HKEY_LOCAL_MACHINE\Software\Wow6432Node\App. How should I best approach this? Do I need a 64bit installer or should I rewrite my code to detect both places?

Thanks

A: 

Here's a Microsoft article on Registry Reflection which might help.

jdigital
And this is the article on controlling which you get: http://msdn.microsoft.com/en-us/library/aa384129(VS.85).aspx
Ben Voigt
+2  A: 

If you mark you C# program as x86 (and not Any CPU) then it will see HKEY_LOCAL_MACHINE\Software\Wow6432Node\App as HKEY_LOCAL_MACHINE\Software\App.

A .NET program for Any CPU will run as a 64 bit process if 64 bit .NET is installed. The 32 bit registry is under the Wow6432Node for 64 bit programs.

Arve
Great, this solved my problems. Thanks!
MK_Dev