Old 20th March 2014, 22:45   #1
zewari
Junior Member
 
Join Date: Mar 2014
Posts: 17
Question 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:

code:
Var /GLOBAL CLSID
StrCpy $CLSID "\{1368ABFA-B1AB-49DB-9CB8-2C231D54B1BF\}"



Writing the variable into a registry value data works great:

code:
WriteRegStr HKCR "Something.Otherthing\CLSID" "" "$CLSID"


Writing the variable as a registry key doesn't work at all:

code:
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?
zewari is offline   Reply With Quote
Old 20th March 2014, 22:58   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
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...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 20th March 2014, 23:08   #3
zewari
Junior Member
 
Join Date: Mar 2014
Posts: 17
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?
zewari is offline   Reply With Quote
Old 20th March 2014, 23:05   #4
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Why do you use the backslash in the CLSID?
No need for escape characters or something (backslash alone isn't an escape character anyway...)
jpderuiter is offline   Reply With Quote
Old 20th March 2014, 23:34   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Quote:
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)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 20th March 2014, 23:54   #6
zewari
Junior Member
 
Join Date: Mar 2014
Posts: 17
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!
zewari is offline   Reply With Quote
Old 21st March 2014, 01:09   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
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...

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

Tags
writeregstr

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