REG MULTI SZ Editor
From NSIS Wiki
Jump to navigationJump to search
Author: KiCHiK (talk, contrib) |
This header file makes it easier to edit, replace or add single strings in a REG_MULTI_SZ value without any size limitations or the need to operate on all of the strings at once.
Download
RegMultiSzEditor.zip (22 KB)
Advantages
- Doesn't require any plugins
- Supports values longer than 1024 characters
- Supports strings longer than 1024 characters as part of an even longer value
- Provides editing functionality per string
- Shared code for both Unicode and ANSI installers
- Has unit tests
Caveats
- Not very fast
Examples
Append
!include RegMultiSzEditor.nsh Function keep ${EditRegMultiSZ_Keep} FunctionEnd Function append ${EditRegMultiSZ_Add} "something that goes last" FunctionEnd Section test !insertmacro EditRegMultiSZ ${HKEY_LOCAL_MACHINE} Software\NSIS\test multi "" keep append SectionEnd
Prepend
!include RegMultiSzEditor.nsh Function prepend ${EditRegMultiSZ_Add} "something that goes first" FunctionEnd Function keep ${EditRegMultiSZ_Keep} FunctionEnd Section test !insertmacro EditRegMultiSZ ${HKEY_LOCAL_MACHINE} Software\NSIS\test multi prepend keep "" SectionEnd
Replace
!include LogicLib.nsh !include RegMultiSzEditor.nsh Function replace ${If} $rSTR == "something to replace" ${EditRegMultiSZ_Add} "replacement" ${Else} ${EditRegMultiSZ_Keep} ${EndIf} FunctionEnd Section test !insertmacro EditRegMultiSZ ${HKEY_LOCAL_MACHINE} Software\NSIS\test multi "" replace "" SectionEnd