Old 7th June 2019, 18:14   #1
Lee Powell
Junior Member
 
Join Date: Jun 2019
Posts: 2
Workaround for impractical WriteRegMultiStr syntax

Found a MakeNSISW-compatible syntax example for WriteRegMultiStr in this closed support ticket:

https://sourceforge.net/p/nsis/patches/219/

AFAICT, all other Nullsoft sources of documentation of WriteRegMultiStr specify syntax that generates compile errors in MakeNSISW.

The idiosyncratic hex format required by WriteRegMultiStr works when specified as a literal text parameter or in a compile-time !define string. What DOES NOT WORK is passing the required hex string in any type of string variable. This means that in order to use WriteRegMultiStr in an NSI script, you must not only type the literal text explicitly into the source code, you have to hand-encode it in this unreadable hex format. That makes it impossible to pass the text to the script as either a command line parameter or in a text file.

Is there any practical workaround available in NSIS to write programmable text fields into multi-string Registry keys?
Lee Powell is offline   Reply With Quote
Old 7th June 2019, 19:23   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,103
https://nsis.sourceforge.io/Registry_plug-in or https://stackoverflow.com/a/41388709...values-in-nsis

REG_MULTI_SZ is really a set of strings separated by \0 characters and NSIS scripts do not currently support dealing with those in any sort of fashion.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 7th June 2019, 20:14   #3
Lee Powell
Junior Member
 
Join Date: Jun 2019
Posts: 2
Thanks for the reply, but compile-time macro manipulation of the hex string specified to WriteRegMultiStr doesn't address my question. My problem is that WriteRegMultiStr requires a hex string specified as a literal string declared at compile-time. What I need is a workaround that will enable me to write text strings specified at install-time into REG_MULTI_SZ registry fields.

Also, the hex format required by WriteRegMultiStr does not contain any \0 characters, only ASCII-encoded hex digits. Why does WriteRegMultiStr accept a literal string of hex digits, but rejects a string variable that contains that string of hex digits?
Lee Powell is offline   Reply With Quote
Old 7th June 2019, 21:28   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,103
I linked to two different workarounds that can be used at run time. Everything else is pointless to talk about because I know you want to do WriteRegMultiStr HKCU "Foo\Bar" "Baz" $MyData but NSIS does not support that at this time.

The hex format currently required by WriteRegMultiStr does contain \0 because \0 is 00 in hex. \0 is also used to terminate normal strings in variables which is why this is hard. You can either sacrifice some other character and use that as the separator (The Registry plug-in does that) or you can build the multi-str in parts and the other link does that.

The compiler supports a literal string of hex codes because the compiler transforms those to bytes and the installer just writes those bytes directly into the registry.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
writeregmultistr

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