cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Roman_V_
Level 2

Can't work with REGDB_STRING_MULTI in IS 2011

Hello!

Since upgrade from 2009 to 2011 I've got trouble with writing multistring values to registry. Before RegDBSetKeyValueEx string svValues looks great, with nulls at their places (I checked it by printing every byte). But RegDBSetKeyValueEx function writes bad data in registry.

Please check my example below

Registry before
[PHP]
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\\Software\\Example]
"RootDevice"=hex(7):7b,00,46,00,39,00,44,00,35,00,31,00,42,00,34,00,39,00,2d,\
00,39,00,32,00,34,00,37,00,2d,00,34,00,31,00,45,00,32,00,2d,00,41,00,35,00,\
37,00,37,00,2d,00,35,00,32,00,45,00,33,00,35,00,44,00,46,00,45,00,45,00,32,\
00,38,00,31,00,7d,00,00,00,7b,00,44,00,34,00,46,00,32,00,41,00,37,00,39,00,\
39,00,2d,00,35,00,41,00,46,00,39,00,2d,00,34,00,41,00,44,00,34,00,2d,00,39,\
00,44,00,36,00,38,00,2d,00,38,00,31,00,31,00,34,00,45,00,39,00,46,00,44,00,\
36,00,45,00,45,00,35,00,7d,00,00,00,7b,00,43,00,43,00,41,00,33,00,38,00,35,\
00,31,00,46,00,2d,00,34,00,34,00,45,00,46,00,2d,00,34,00,43,00,35,00,44,00,\
2d,00,42,00,39,00,33,00,37,00,2d,00,39,00,45,00,41,00,43,00,37,00,45,00,41,\
00,41,00,38,00,32,00,35,00,46,00,7d,00,00,00,00,00
[/PHP]

InstallScript
[PHP]
STRING svValues, svVal;
NUMBER nvType, nvSize, lRes;
LIST listVals;

begin

szKey = "Software\\Example";
szName = "RootDevice";
szRemoveValue = "{D4F2A799-5AF9-4AD4-9D68-8114E9FD6EE5}";


RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

if RegDBGetKeyValueEx ( szKey, szName, nvType, svValues, nvSize) < 0 then
return FALSE;
endif;

listVals = ListCreate(STRINGLIST);
StrGetTokens(listVals,svValues,"");

lRes = ListGetFirstString(listVals, svVal);
while (lRes != END_OF_LIST)
if svVal = szRemoveValue then
ListDeleteString(listVals);
endif;

lRes = ListGetNextString (listVals, svVal);



endwhile;

svValues = "";
//write new values
StrPutTokens(listVals,svValues,"",TRUE);

RegDBSetKeyValueEx ( szKey, szName, nvType, svValues, SizeOf(svValues));


end;
[/PHP]

Registry after
[PHP]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Example]
"RootDevice"=hex(7):7b,00,46,00,39,00,44,00,35,00,31,00,42,00,34,00,39,00,2d,\
00,39,00,32,00,34,00,37,00,2d,00,34,00,31,00,45,00,32,00,2d,00,41,00,35,00,\
37,00,37,00,2d,00,35,00,32,00,45,00,33,00,35,00,44,00,46,00,45,00,45,00,32,\
00,38,00,31,00,7d,00,00,00,79,00,3d,00,25,00,6c,00,64,00,09,00,52,00,65,00,\
73,00,6f,00,6c,00,76,00,65,00,45,00,6d,00,62,00,65,00,64,00,64,00,65,00,64,\
00,3d,00,25,00,6c,00,64,00,00,00,36,00,37,00,43,00,41,00,36,00,45,00,41,00,\
41,00,39,00,42,00,34,00,7d,00,5c,00,44,00,00,00[/PHP]

You will see that new registry value is incorrect and contains strange things like "y=%ld ResolveEmbedded=%ld".

Thanks in advance
Labels (1)
0 Kudos
(2) Replies
Roman_V_
Level 2

I've found a hotfix and it seems to work fine!
0 Kudos
enanrum
Level 9

Can you elaborate on the HotFix! Was the HotFix from InstallShield? Which one?
0 Kudos