What is an effective way to grant permissions to a registry key using an NSIS installer?

笑着哭i 提交于 2019-12-05 17:40:18

When using a SID with the plugin the syntax is (S-1-....):

WriteRegStr HKCU "Software\test" hello world
AccessControl::GrantOnRegKey HKCU "Software\test" "(S-1-1-0)" "FullAccess" ; Everyone

You can find a list of SIDs here.

You can use AccessControl::NameToSid to transform a name to its SID but doing this can have localization issues on non-English systems:

AccessControl::NameToSid "BUILTIN\USERS"
Pop $0
StrCmp $0 "error" +2
AccessControl::GrantOnRegKey HKCU "Software\test" "($0)" "FullAccess"

When changing the owner you can also use the Machine\Username syntax.

Aliases like (BU) only work in the unicode version and also depend on the Windows version so it is better to just stick with SIDs.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!