As title really. Looking in regedit the key-value exists, but the Wow6432 key (HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion) doesn't have this key. This means a 32-bit app doesn't work on my 64-bit Windows version... which seems wrong, shouldn't the 32-bit app run without modifications? Or is this one case 32-bit apps have to be tweaked to work on 64bit Windows?
Asked
Active
Viewed 1.6k times
2
-
32-bit applications should run perfectly fine on 64-bit OS. You said that the key-value exists. If it's not in Wow6432, where it is ? – Adrian Fâciu Sep 07 '10 at 07:24
-
1@Adrian.. on 64-bit Windows, this value only exists in the 64-bit registry. – Gerald Sep 07 '10 at 08:01
1 Answers
7
Applications really shouldn't access this registry value directly. The best way to get this value is to use WMI to get the SerialNumber property of the Win32_OperatingSystem class. This works fine from a 32-bit application running on Win64.
An alternative would be to use the KEY_WOW64_64KEY flag when opening the registry key (does not work on Windows 2000.)

Gerald
- 23,011
- 10
- 73
- 102
-
We're getting a bunch of registry values... in fact we don't necessarily know exactly what they are at coding time. It's just a few don't work. Is there a way I can pass flags to open the registry key, that will work on both 32 and 64-bit... don't really want to write different code for both if the Windows API can do this for me. – Mr. Boy Sep 07 '10 at 08:53
-
The KEY_WOW64_64KEY flag will work on both 32 and 64-bit. On 32-bit Windows it will just be ignored (except on Windows 2000 where it will probably crash), and on 64-bit Windows it will always read the values from the 64-bit registry. – Gerald Sep 07 '10 at 09:13