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

RegDBGetKeyValueEx issue

Hi All.
I have this script in my InstallScript, it used to work untill i upgraded to InstallShield Spring 2012) and now RegDBGetKeyValueEx function does not return me anything. I added the
Software\\Test\\Mytest key under HKEY_LOCAL_MACHINE and to TestString asssigned value "1111" in the registry.
Here is my script.


function QueryRegistry(hInstall)
NUMBER nvType,nResult,nvSize;
STRING svValue;
begin
//nType = REGDB_STRING;

nResult = RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );


nResult = RegDBGetKeyValueEx( "Software\\Test\\Mytest", "TestString", nvType, svValue, nvSize );
MessageBox(svValue, INFORMATION);
// if a string (REGDB_STRING) value was found (nResult = 0),
// set the value into an Installer property.

if ((nResult = 0) && (nvType = REGDB_STRING)) then
MsiSetProperty(hInstall, @REG_TEST_PROPERTY, svValue);
endif;

end;

Appreciate any help.
Labels (1)
0 Kudos

(5) Replies
RobertDickau
Flexera Alumni

What is the nResult return value from RegDBGetKeyValueEx? If it's a large negative number, you can pass it to FormatMessage to get a system message string.
0 Kudos
Not applicable

You might want to try giving svValue a fixed size and then initialising nvSize before calling the function. Something like this perhaps:

svValue[MAX_STRING_SIZE]; // set MAX_STRING_SIZE to something suitable
nvSize = SizeOf( svValue ) - 1;

A lot of functions calls like this now require the size to be set correctly.
0 Kudos
rivin12
Level 3

Hello guys, thank you for reply.
When calling the function RegDBGetKeyValueEx() i am getting error code -2147024894.
Please help.
0 Kudos
RobertDickau
Flexera Alumni

Given a large negative number return value, you can pass it to FormatMessage to get a system message string.
0 Kudos
Not applicable

Thats 0x80070002 in 'real' money, though not sure what it means in your context though.
0 Kudos