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

Writing Binary Registry

Hi All!

I have a problem which I hope somebody know the answer....

I would like to write in the Registry of Windows a Binary Registry filled in with a decimal number converted to hexadecimal (for example, if I have in my program the number “1680”, in the Registry I will write “90 06 00 00” –because it is BIG ENDIAN).

My problem is that in InstallShield you can only use “Strings” to write in the Registry, although this is Binary, and then the function translate to ASCII code the number of the string. For example, if I have “1680” in the string, it writes “31 36 38 30”, even if I pass the number in binary “00000...11100....” It just will write the ASCII code of “0” and “1” all the times.

My question is: Is there any way to do with InstallShield what I need to do? (write binary numbers in the registry, not their ASCII codes)

Thank you very much in advance.
Labels (1)
0 Kudos
(2) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Per the "Registry Table (Windows Installer)" documentation, it sounds like you want to write your value as a string prefixed with #x - e.g. #x90060000. See http://msdn2.microsoft.com/en-us/library/aa371168(VS.85).aspx for details.
0 Kudos
oscarzt
Level 3

Thank you,

Do not worry, I finally could do it like this:

svHex[0] = 0x90;
svHex[1] = 0x06;
svHex[2] = 0x00;
svHex[3] = 0x00;

being svHex the String to use in RegDBSetKeyValueEx (szKey, "X Offset", REGDB_BINARY, svHex, 4)

if you want 0x90 etc...to be variables, you have to do:

sResult = "0x";
...
... (conditions)

sResult = sResult + "A"; (for example)
sResult = sResult + "9"; (for example)
...

StrToNumHex (nHex, sResult);
svHex[iCount] = nHex;

I tell that just in case it is useful for somebody 😉
0 Kudos