This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Different return values for RegDBKeyExist on 64-bit machines
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 26, 2010
04:53 AM
Different return values for RegDBKeyExist on 64-bit machines
Hi,
I am having issues with RegDBKeyExist function on a 64-bit OS.
I have the following scenario:
Installed a 32-bit application ABC on 64-bit machine. So the registry looks like
HKLM\SOFTWARE\Wow6432Node\ABC.
I want to check existence of ABC on 64-bit machine and i execute RegDBKeyExist (HKLM\SOFTWARE\Wow6432Node\ABC).
Prior to this i am also setting
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
On,
1. Windows Server SP2 machine it returns value < 0,
2. Windows Server 2008 R2 machine it returns 1.
Has anybody encountered similar kind of issue?
Is this due to the windows operating system or due to IS2010?
Any update/information would be helpful.
Thank You
Rohit
I am having issues with RegDBKeyExist function on a 64-bit OS.
I have the following scenario:
Installed a 32-bit application ABC on 64-bit machine. So the registry looks like
HKLM\SOFTWARE\Wow6432Node\ABC.
I want to check existence of ABC on 64-bit machine and i execute RegDBKeyExist (HKLM\SOFTWARE\Wow6432Node\ABC).
Prior to this i am also setting
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
On,
1. Windows Server SP2 machine it returns value < 0,
2. Windows Server 2008 R2 machine it returns 1.
Has anybody encountered similar kind of issue?
Is this due to the windows operating system or due to IS2010?
Any update/information would be helpful.
Thank You
Rohit
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 27, 2010
06:57 PM
This is an issue with the registry support on the operating system. RegDBKeyExist calls the RegOpenKeyEx API and verifies the return value was ERROR_SUCCESS. If it was, 1 is returned by RegDBKeyExist, otherwise, -1 is returned.
Using the following code in a test C++ project:
yields the following output on a Windows 2008 machine even when the key exists:
A result value of 2 is ERROR_FILE_NOT_FOUND, indicating the key was not found.
The same code returns 0 (ERROR_SUCCESS) on Windows 7 and 2008 R2, indicating a change in the operating system registry support.
Since this code is checking for a 32-bit key, it is recommended that 64-bit registry access not be enabled when checking for such a key.
Using the following code in a test C++ project:
HKEY hKey;
UINT uiRes;
uiRes = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Wow6432Node\\Test"), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS | KEY_WOW64_64KEY, &hKey);
printf("Opening Software\\Wow6432Node\\Test, WOW64_64KEY, result %d\n", uiRes);
yields the following output on a Windows 2008 machine even when the key exists:
Opening Software\Wow6432Node\Test, WOW64_64KEY, result 2
A result value of 2 is ERROR_FILE_NOT_FOUND, indicating the key was not found.
The same code returns 0 (ERROR_SUCCESS) on Windows 7 and 2008 R2, indicating a change in the operating system registry support.
Since this code is checking for a 32-bit key, it is recommended that 64-bit registry access not be enabled when checking for such a key.