Old 9th July 2010, 03:25   #1
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Question .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:
code:
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.
nsnb is offline   Reply With Quote
Old 9th July 2010, 04:51   #2
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Shanghai, China
Posts: 207
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.
jiake is offline   Reply With Quote
Old 9th July 2010, 19:49   #3
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Lightbulb

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

Quote:
Originally Posted by jiake View Post
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.

Quote:
Originally Posted by jiake View Post
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).
nsnb is offline   Reply With Quote
Old 9th July 2010, 20:10   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 9th July 2010, 21:17   #5
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Lightbulb

Quote:
Originally Posted by Afrow UK View Post
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.
nsnb is offline   Reply With Quote
Old 10th July 2010, 10:06   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
.reg, hex(2), writeregbin, writeregexpandstr

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump