PDA

View Full Version : RegDBGetKeyValueEx issue



rivin12
10-12-2012, 12:24 PM
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.

RobertDickau
10-12-2012, 12:59 PM
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.

Hysteresis
10-13-2012, 04:59 AM
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.

rivin12
10-17-2012, 07:31 AM
Hello guys, thank you for reply.
When calling the function RegDBGetKeyValueEx() i am getting error code -2147024894.
Please help.

RobertDickau
10-17-2012, 09:13 AM
Given a large negative number return value, you can pass it to FormatMessage to get a system message string.

Hysteresis
10-17-2012, 09:21 AM
Thats 0x80070002 in 'real' money, though not sure what it means in your context though.