Archive: How do I set permissions on a registry key?


How do I set permissions on a registry key?
I have been trying the following snippet from the wiki, but it only returns the error message, "Root key name missing", as if the accesscontrol plugin isn't getting my parameters, can anyone help?

Push $0 ; save
Push "Marker"
; Set registry ACL's to let "everyone (S-1-1-0)" access the registry settings
AccessControl::GrantOnRegKey HKLM "${PRODUCT_DIR_REGKEY}" "everyone" "FullAccess"
Pop $0 ; get "Marker" or error msg
StrCmp $0 "Marker" Continue
MessageBox MB_OK|MB_ICONSTOP "Error setting access control for registry: $0"
Pop $0 ; pop "Marker"
Continue:
Pop $0 ; restore


IIRC, AccessControl uses HKLM\foo\bar style paths


After expanding my variable, my AccessControl line looks like this:

AccessControl::GrantOnRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\DerbyAv.exe" "everyone" "FullAccess"

According to all the examples and the code that ships with the package, the HKLM should be separate, I did try them together though, and no luck.


Hello, there was a bug.
http://nsis.sourceforge.net/File:AccessControl.zip

Stu


Thanks Stu, I also found the one liner on my end this afternoon, it's good to know someone is maintaining this.

David