I am finding a strange behavior with a .NET module accessing the Windows Registry using the RegistryKey class.
For example, I have written a .NET module, testcom.dll, which access the registry. This testcom.dll file is used both by a native 32-bit application and a 64-bit application. My requirement is to get the value of a regkey (path being HKEY_LOCAL_MACHINE\SOFTWARE\Test\MyParameters
and the key name is Age
). This "Age" key will be in 32-bit registry on 32-bit machines and 64-bit registry (not WOW64) on 64-bit machines.
On a 64-bit machine, when a 32-bit application is using testcom.dll, the key "Age" is searched in the WOW64 registry. When a 64-bit application is using testcom.dll, the key "Age" is searched in the 64-bit registry.
My requirement is to read the key in the 64-bit registry on 64-bit machines whatever the application uses the testcom.dll file. How can I do this?