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?
views:
106answers:
1
+3
A:
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
2010-09-07 07:46:22
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.
John
2010-09-07 08:53:58
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
2010-09-07 09:13:40
@Gerald thanks for clarifying. Win2000 is not a problem for us :)
John
2010-09-07 09:56:38