views:

29

answers:

2

I have developed a 32 bit application (build for x86) which will later be deployed in 64 bit machine. I have set some configuration in registry so when application starts in 32 bit machine there is no problem reading its value but when deployed in 64 bit machine I can not read value properly as the path of the Registry is changed. To make things clear, in 32 bit machine I have registry as following

[HKEY_LOCAL_MACHINE\SOFTWARE\MyApplication\InstallationPath] "folder"="C:\Program Files\MyApplication"

But When I look at 64 bit machine, this is shifted to

[HKEY_LOCAL_MACHINE\SOFTWARE*Wow6432Node*\MyApplication\InstallationPath] "folder"="C:\Program Files\MyApplication"

Inside my application I have to query the value of installation path the obvious thing I have done is Query the value with the Hard coded string "HKLM\SOFTWARE\MyApplication\InstallationPath", but which is not valid for x64 bit machine, Please write your thoughts how to overcome this problem.

A: 

You shouldn't have to do anything special in your code. 32-bit applications transparently access the portion of the registry under Wow6432Node.

To convince yourself of this launch the 32-bit build of regedit.exe (available under Windows\SysWOW64) and take look around the registry

Alexandre Jasmin
A: 

I don't really understand your problem: the Wow6432Node is transparent from the caller's point of view.

That means the registry key HKEY_LOCAL_MACHINE\SOFTWARE\MyApplication\InstallationPath will be automatically mapped to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyApplication\InstallationPath when accessed from a 32-bit application running on a 64-bit machine.

So your code should work out of the box.

Frédéric Hamidi