PDA

View Full Version : Install script unable to read BINARY reg entries?



Alturis
02-13-2002, 02:09 PM
I have so far been unable to fetch a binary value from the registery.

The value that i am fetching starts with a 00... and since install script only allows you to fetch values as strings.. im wondering if its just returning an empty string?

Shouldnt it be returning like a hex formatted string?

msiemsen
02-13-2002, 11:48 PM
No. You get a binary string back. Use the STRING [] to access it.

Something like this:


// you may want to size the value explicitly
STRING szKey, szName, svValue[10];
NUMBER i, j, nvType, nvSize;

// create a binary entry 00 01 02 03 04
szKey = "Software\\TestKey";
szName = "TestVal";
for i = 0 to 4
svValue[i] = i;
endfor;
nvType = REGDB_BINARY;
nvSize = 5;
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
RegDBSetKeyValueEx (szKey, szName, nvType, svValue, nvSize);

// clear variables
for i = 0 to 4
svValue[i] = 0;
endfor;
nvType = 0;
nvSize = 0;

// read binary entry back
RegDBGetKeyValueEx (szKey, szName, nvType, svValue, nvSize);

// check it is 00 01 02 03 04
if (nvType != REGDB_BINARY) then
MessageBox ("oops, bad type", SEVERE);
elseif (nvSize != 5) then
MessageBox ("oops, bad size", SEVERE);
else
for i = 0 to 4
j = svValue[i];
if (j != i) then
MessageBox ("oops bad value", SEVERE);
abort;
endif;
endfor;
endif;