Skip to content
⌘ NSIS Forum Archive

Struggling w/ WriteRegStr & GUID entry

7 posts

zewari#

Struggling w/ WriteRegStr & GUID entry

Hey folks, new to NSIS here.... I've been banging my head against the wall trying to figure out why this isn't working. I have a variable defined for my GUID:

Var /GLOBAL CLSID
StrCpy $CLSID "\{1368ABFA-B1AB-49DB-9CB8-2C231D54B1BF\}"
Writing the variable into a registry value data works great:

WriteRegStr HKCR "Something.Otherthing\CLSID" "" "$CLSID"
Writing the variable as a registry key doesn't work at all:

WriteRegStr HKCR "CLSID\$CLSID" "" "GPLASCustomTools.LASCustomToolsFunctionFactory"
Is it the curly brackets? I've tried using escape characters but it doesn't help. What am I missing?🧟
Anders#
Are you running as administrator (elevated with UAC)?

The only thing you have to escape in NSIS is $.

You current code also ends up with \\ because CLSID\$CLSID will expand to CLSID\\{1368ABFA-B1AB-49DB-9CB8-2C231D54B1BF\}.

To really debug this problem you can use Process Monitor...
jpderuiter#
Why do you use the backslash in the CLSID?
No need for escape characters or something (backslash alone isn't an escape character anyway...)
zewari#
Oh, those extra back slashes were from my frustrated attempts at finding a solution. I am running as an admin and have them removed at the moment, but no luck. I have no problem creating those keys from a batch file, just can't seem to do it through NSIS. Am I overlooking something? Does \{ mean something in this scripting language?
Anders#
Var /GLOBAL CLSID
StrCpy $CLSID "{4D85F58F-51C6-4daf-9334-148CA24C4F36}"
WriteRegStr HKCU "Software\Classes\CLSID\$CLSID" "" "GPLASCustomTools.LASCustomToolsFunctionFactory"
Works fine for me (Note that I used HKCU so I did not have to elevate and the key is actually written under Software\Classes\Wow6432Node\CLSID\{4662daa3-d393-11d0-9a56-00c04fb68bf7} on a 64 bit system)
zewari#
Ah ok... I see it under the Wow6432node hive. SetRegView 64 gave me the desired outcome... I wonder why some of it was writing to the expected location and the rest of it wasn't. Anyway thanks for your tip!
Anders#
Some things under HKCR is reflected in both views and others only exist where you write them. This is of course related to compatibility and has changed from XPx64 to Vista and Vista to 7. See MSDN for more information...