Archive: .reg's hex(2) ==> WriteRegBin or WriteRegExpandStr ?


.reg's hex(2) ==> WriteRegBin or WriteRegExpandStr ?
This Microsoft article describes the syntax of .reg files:

http://support.microsoft.com/kb/310516


In there you can find the following table:

Data Type               DataType in .reg 
REG_BINARY hexadecimal
REG_DWORD dword
REG_EXPAND_SZ hexadecimal(2)
REG_MULTI_SZ hexadecimal(7)


Which suggests that a hex(2) value in a .reg file should be "translated" to a WriteRegExpandStr in NSIS. Do I understand correctly?

If so, how would one write a value of "hex(2):25,00,53,00,79,00,73,00,74,00,65,00" in a WriteRegExpandStr line?

Thanks.

To write an expand string, write what you see in registry editor but not the .reg file. This was clearly expressed in NSIS manual.
WriteRegExpandStr HKCU Environment TEMP '%USERPROFILE%\Local Settings\Temp'

To write a binary string, like this: "Config"=hex:01,23,45,67,89,ab,cd,ef
Using: WriteRegBin HKCU 'Sofeware\MyProgram' Config 0123456789abcdef

To read a multi-string, see http://nsis.sourceforge.net/REG_MULTI_SZ_Reader, or use the Registry plug-in to read and write all kinds of registry value.


Thank you very much. Your reply was very informative and helpful (hopefully to others down the road, too).

Originally posted by jiake
To write an expand string, write what you see in registry editor but not the .reg file.
This is exactly the piece of information that I needed.

Originally posted by jiake
This was clearly expressed in NSIS manual.
Of course I searched the NSIS manual before I posted this question, but even after your answer I am still unable to find any reference to "write what you see in registry editor but not the .reg file". Which version are you using? (mine is v2.45).

jiake was not referring to the quote "write what you see in registry editor but not the .reg file" but to the example WriteRegExpandStr usage.

Stu


Originally posted by Afrow UK
jiake was not referring to the quote "write what you see in registry editor but not the .reg file" but to the example WriteRegExpandStr usage.
:) I wasn't referring to the quote literally either. The example WriteRegExpandStr usage in the documentation is very clear but the distinction between the .reg file syntax vs. the NSIS syntax is simply not there.

How about the fact that the example has the string being written in plain text (and without double backstrokes - which is another mistake people make)? Or am I missing something?

Stu