cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mayuppe953
Level 3

RegDBGetKeyValueEx does not work on Win Vista 64bit but works on Win 7 64bit

Hello, I have InstallScript project to search for a registry key for 32bit application that can be installed on 64bit OS.

Registry key location is exactly the same on Win Vista 64bit and Win 7 64bit, but below script works correctly on Win 7 64bit only. It returns TRUE (= registry key not found, though it is there) on Win Vista 64bit.

Does RegDBGetKeyValueEx work differently on Win Vista and Win 7? or am I missing something here...?

** below script works correctly for both Win Vista and 7 32bit.


[SIZE="1"]--------------------------------------------------------------------------
Exported Registry information is identical for both 7 and Vista:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MATLAB\MCRPathDir]
"MCRPathDir"="C:\\Program Files (x86)\\MATLAB\\MATLAB Compiler Runtime\\v710\\runtime\\win32"
--------------------------------------------------------------------------
Registry key is located at:
#define MATLAB_CR_KEY_64 "SOFTWARE\\Wow6432Node\\MATLAB\\MCRPathDir"
--------------------------------------------------------------------------
function BOOL MATLABneeded()
NUMBER nvType, nvSize, nResult, nvSPnumber;
STRING svValue;
begin
if (SYSINFO.bIsWow64 != 0) then
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
endif;
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if (SYSINFO.bIsWow64 != 0) then //system is 64bit
MessageBox("DEBUG: 64bit OS, and the key I'm looking for is: " + MATLAB_CR_KEY_64, INFORMATION);
if (RegDBGetKeyValueEx(MATLAB_CR_KEY_64, "MCRPathDir", nvType, svValue, nvSize) != 0) then
MessageBox("DEBUG: This is 64-bit OS, MATLAB is not installed!", SEVERE);
return TRUE;
endif;
else
MessageBox("DEBUG: 32bit OS, and the key I'm looking for is: " + MATLAB_CR_KEY_32, INFORMATION);
if (RegDBGetKeyValueEx(MATLAB_CR_KEY_32, "MCRPathDir", nvType, svValue, nvSize) != 0) then
MessageBox("DEBUG: This is 32-bit OS, MATLAB is not installed!.", SEVERE);
return TRUE;
endif;
return FALSE;
endif;
if (SYSINFO.bIsWow64 != 0) then
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;
endif;
end;[/SIZE]--------------------------------------------------------------------------
Labels (1)
0 Kudos
(1) Reply
Shark75
Level 4

I have the same issue on Vista 64 (to be precise it's Windows 2008 64-bit). I try to use RegDBGetKeyValueEx and on all OSs it reads the entry correctly, but not on this OS.

My project is InstallScript (not MSI) and I have tried turning UAC off and running the setup.exe as Administrator, but still have the same results.

In the particular example I'm detecting whether the user has the IIS 6 Metabase compatibility option installed or not.


RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

// Check whether the Metabase registry key exists.
if (RegDBGetKeyValueEx("SOFTWARE\\Microsoft\\InetStp\\Components", "Metabase", nvType, svValue, nvSize) < 0) then
// Display error to the user.
MessageBox("Error: Setup has detected that the IIS 6 Metabase Compatibility component is not installed.\n\nSetup is unable to continue.", SEVERE);
// Fail the requirement.
bvResult = FALSE;

endif;


Did you find out why this was not working for you?
0 Kudos