Archive: How to write empty value for REG_MULTI_SZ in registry


How to write empty value for REG_MULTI_SZ in registry
It seems there is a little issue with writing empty value for REG_MULTI_SZ.

Here is the code:

${registry::Write} "HKEY_LOCAL_MACHINE\SOFTWARE\test" "CommandLine" "" "REG_MULTI_SZ" $R0


The result is:
[HKEY_LOCAL_MACHINE\SOFTWARE\test]
"CommandLine"=hex(7):00,00,00,00


But this is not empty string - but string with one string separator.

The real "empty" result must be:
[HKEY_LOCAL_MACHINE\SOFTWARE\test]
"CommandLine"=hex(7):00,00


This is the value afte creation of empty REG_MULTI_SZ in regedit.

And if I use this code:
${registry::Write} "HKEY_LOCAL_MACHINE\SOFTWARE\test" "CommandLine" "$\n" "REG_MULTI_SZ" $R0

the result is
"CommandLine"=hex(7):00,00,00,00,00,00


So - it seems that registry::Write is always adds extra \0 to the value, and this is new string for REG_MULTI_SZ. How I can avoid this from nsis script?

You will have to call the Reg* APIs directly using the System plug-in.

Stu