cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JimmiLee
Level 6

RegDBGetKeyValueEx returning Error even though key exists!!!

Ok, first of all, this is a 64bit project (though I'm creating a 32bit version as well) that I'm trying to get to run on Server 2003 and 2008.

I need to retrieve the installation directory of Microsoft Dynamics CRM 4.0, both for later installation procedures, but also to determine if it is installed or not. However, RegDBGetKeyValueEx keeps returning an error, even though the key exists in the registry!

My code snippet:
**************************************
#define REGISTRY_FOLDER "SOFTWARE\\Microsoft\\MSCRM"
#define REGISTRY_ENTRY "CRM_Server_InstallDir"

function SetPathFromRegistry(hMSI)
STRING strRegistryValue, strTemp, CrmID, szTemp;
NUMBER nvSize, nValueType, nResult;

begin
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
if(RegDBGetKeyValueEx ( REGISTRY_FOLDER, REGISTRY_ENTRY, nValueType, strRegistryValue, nvSize) < 0) then
MessageBox ("MS CRM 4.0 is not installed on this Server! Aborting Installation...", SEVERE);
abort;
else
// Assign the path (with extra sub path) to the global CRMINSTALLDIR
strRegistryValue = strRegistryValue + "\\CRMWeb\\bin";
MsiSetProperty(ISMSI_HANDLE, "CRMINSTALLDIR", strRegistryValue);
endif;

end;
*************************************

RegDBGetKeyValueEx keeps returning a very high negative number (minus 2xxxxxxxx something).
I tried using this code as well, courtesy of this community, to see what this would return:
*************************************
function CheckRequirements()
NUMBER nReturn;
NUMBER nControl;
STRING svRegKey;

begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
svRegKey = "SOFTWARE\\Microsoft\\MSCRM";
if (RegDBKeyExist(svRegKey) < 0) then
MessageBox(svRegKey + "\n\n Does Not Exist",SEVERE);
else
SprintfBox(INFORMATION,"Key Exists","%s",svRegKey);
endif;

end;
*************************************

But I get exact same issue, that the key doesn't exist!

What am I doing wrong???

Thanx . . .



Edit: The oddest thing is, I just tried to test a 32bit version and it seemed to work! So tomorrow I will go through the 32bit project and see if there are any differences or possibly just test it and convert it to 64bit...
Labels (1)
0 Kudos
(2) Replies
Shuttledude
Level 7

I researched your problem and found the following information from the link provided below. I'm not certain this pertains to your problem, but I'm hopeful it will help.

If you need to search the 64-bit areas of the registry (as opposed to the 32-bit WOW64 areas), you'll need to use something like REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY before your registry read. Don't forget to reset REGDB_OPTIONS as appropriate.


http://community.installshield.com/showthread.php?t=187742
0 Kudos
JimmiLee
Level 6

Am trying this out later today . . .

***************

Edit:
Works like a charm - once again, many thanx 🙂
0 Kudos