cancel
Showing results for 
Search instead for 
Did you mean: 
rivin12
Pilgrim

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
Pilgrim

Re: RegDBGetKeyValueEx issue

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

Re: RegDBGetKeyValueEx issue

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
Pilgrim

Re: RegDBGetKeyValueEx issue

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

Re: RegDBGetKeyValueEx issue

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

Re: RegDBGetKeyValueEx issue

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