Reading XP-64bit registry entries from Win32 app

P

Phil Tomson

I've got a Win32 app that needs to determine if certain software
packages are installed or not. We do this by looking in the registry
under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Now we need to start to support WinXP-64bit. Turns out that on
WinXP-64bit the registry is split into 32bit and 64bit sections.
Also turns out that some of the packages we need to detect are in the
64bit section of the registry so our Win32 app doesn't end up seeing
them.

Is there any way for a Win32 app to read information from the 64bit
portion of the registry? I really don't want to start having to
create a 64bit version of the app as well.

Also, for extra bonus points: is there any way for a program/script to
determine if it's running on 32bit or 64bit WinXP?

Phil
 
P

Phil Tomson

I've got a Win32 app that needs to determine if certain software
packages are installed or not. We do this by looking in the registry
under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Now we need to start to support WinXP-64bit. Turns out that on
WinXP-64bit the registry is split into 32bit and 64bit sections.
Also turns out that some of the packages we need to detect are in the
64bit section of the registry so our Win32 app doesn't end up seeing
them.

Is there any way for a Win32 app to read information from the 64bit
portion of the registry? I really don't want to start having to
create a 64bit version of the app as well.

Also, for extra bonus points: is there any way for a program/script to
determine if it's running on 32bit or 64bit WinXP?

FYI, in case you run into this:

Turns out you need to OR another (new) registry access right called
KEY_WOW64_64KEY (= 0x0100L ) and then the Win32 app can read 64bit
registry items. Now it seems to be working fine.

See:

http://msdn.microsoft.com/library/d...umerating_32-bit_and_64-bit_registry_data.asp

And:
http://msdn.microsoft.com/library/d...umerating_32-bit_and_64-bit_registry_data.asp

http://msdn.microsoft.com/library/d...e/registry_key_security_and_access_rights.asp

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top