CppCheck saves application paths in the registry as a REG_MULTI_SZ, which is saved to the .reg file in hex.
Example line from CppCheck.reg file (saved from launcher): "Application paths"=hex(7):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,\ 00,61,00,6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,\ 36,00,29,00,5c,00,4e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,5c,\ 00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,2e,00,65,00,78,00,\ 65,00,22,00,00,00,00,00
NSIS isn't a language I use often, so I'm wondering if anyone's able to help me write some custom code to save this as an array of strings, traverse through the strings and update path letters and so on, then save back to hex to the .reg file.
I tested some things from the registry plugin, but I'm obviously doing it wrong because even the basic parts aren't working for me. >.>
${SegmentFile} ${SegmentPrePrimary} ${registry::Read} "HKEY_CURRENT_USER\Software\Cppcheck\Cppcheck-GUI" "Application paths" $0 $1 ${registry::Write} "HKEY_CURRENT_USER\Software\Cppcheck\Cppcheck-GUI" "Application paths" "Test" $1 $2 !macroend
I'm interested in the results of this as well, as I'm having issues doing the same thing with kchmviewer.
Here's my custom.nsh: http://pastebin.com/faJGSt3w
It includes message boxes for debugging.
[EDIT]
I found this: http://nsis.sourceforge.net/REG_MULTI_SZ_Reader
but can't figure it out.
My FreeMat Portable launcher adjusts paths stored as REG_MULTI_SZ and *.reg file in hex. Be warned, it's custom and not PAL. 8)
Hi Bart.S,
Is this the portion of your launcher that does it? http://pastebin.com/uJdaTs3F
If so, it should be pretty simple to implement as custom code with PAL.
that's why it's called AdjustKeys.
Thanks, I just wanted to make sure I was looking at the right thing. It's not working quite right for me yet, but that's because I'm trying to use a PAL variable for changing the drive letters, rather than duplicating code. Hopefully I can figure out how to do it soon. fun times
scriptdaemon: I've pushed the changes I'm using to my repo for kchmviewer if you want to copy/paste.
I'll take a look at it later when I get home.
EDIT: Rather odd, but when it saves to the registry, it puts a space between every character.
That's the same issue I'm having.
I can't really see anything obvious, so I'll stick in a few messageboxes after I go shopping to debug (if you don't figure it out already by then).
I've updated my custom.nsh with some WordReplace error debugging, and this is what I've found so far:
As it stands right now, I get an error level of 1, or "word to replace not found".
Obviously, I need to adjust my WordReplace syntax. I'm just not sure what the issue is at the moment. I'll look into it some more.
Just a bit on code style: http://pastebin.com/rbDBde6Y
I am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1
Thanks for the heads-up. I was the using the code shown on the NSIS wiki page for WordReplace.
I added some more message boxes to the code, and cleaned up read/writing a bit, and have determined that the issue lies with $Registry::Read
adding a space in between characters in the string. On a second run, it adds another space in between characters.Just noticed this was pointed out above. Still not sure what is causing it, other than that it IS a $Registry::Read error.I am determining this based on the $R0 message boxes.
[EDIT] OOPS, forgot to link to my updated one: http://pastebin.com/GRzySE2D
Yes:
The addition of something between each character of the string being read is caused by some error in
{$Registry::Read}
No:
Those "space"s are actually hex
0x00
's, which the Registry (and apparently NSIS) treats as new lines ($\n
in NSIS)More:
Custom.nsh
apparently doesn't handle Environment Variables in the%VAR%
format, so you need to read them to NSIS style Variables ($VAR
format) before they'll do what you want.Custom.nsh
for CppCheck Portable today which I think works (it only changes theDrive
letter, ScriptDaemon's updates thePackagePartialDir
too, but [in my quick test setup at least] that wasn't doing anything, so I dropped it), and I'd like to have you guys look at it (if it works for you, you can have it).Custom.nsh
for CppCheck Portable I moved the work into a macro, and used that macro thrice so as to update "Check path
", and "Global include paths
" as well.Custom.nsh
for CppCheck Portable I Added some "DebugMsg
"s but I couldn't get PAL to do anything with them, maybe someone could help me with that?Custom.nsh
for Lazarus Portable as the basis for some of mine for CppCheck Portable, so I've added him (and me) to theCode courtesy of…
section, I hope that's all OK.(Maybe I'll grab it from your BitBucket repository and see what I can do with it, but that'll have to wait a day or two [or more])
Custom.nsh
for CppCheck Portable, Hopefully it helps you guys, and if it works for you, you can have it.Edit: Changed my line regarding new line characters to reflect what Mark Sikkema brought out, as well as what I had discovered on my own; though I didn't check whether the new plugin makes a difference.
~3D1T0R
maybe a NSIS Unicode / registry plugin issue.
What version of NSIS do you use? The latest on PA.c? Because that's what I use.
The latest not portable NSIS (ANSI).
it's not adding a space, but it's adding a 0x00 between the characters. Some ansi to unicode mix-up.
If you try the new official Registry plug-in v4.1 from Instructor, all is fine. (the one dll is made both for ansi and unicode nsis, as I understand)
http://nsis.sourceforge.net/Registry_plug-in
reminder: with the official plug-in you will run into troubles with ${registry::restore} on Wine !
Formerly Gringoloco
Windows XP Pro sp3 x32
Formerly Gringoloco
Windows XP Pro sp3 x32