CPack: Fix NSIS handling of privileged users (#12923)
When using the NSIS generator from CPack the file NSIS.template.in is used to generate a project.nsi file for NSIS to process. The file consists code in the NSIS scripting language. Among other functions there is an onInit function the initializes the installer. The function (tries to) recognise admin and power users but fails since NSIS scripting language relative includes the jump from the current command so +3 means "run the third command after this one", so a failed check for admin completely skips the check for a power user and goes directly to "done:". User permission lookup was added in initial NSIS support by commita11b9a4c
(Merge from CPack branch, 2006-01-01). Later commitb1b052fd
(Several changes to for NSIS, 2006-03-01) added a line inside a block that should be skipped by a jump without updating the jump length. Update the jump length to correct the behavior.
This commit is contained in:
parent
ba4a9f726d
commit
c4a0bcea77
|
@ -922,12 +922,12 @@ Function .onInit
|
||||||
Pop $0
|
Pop $0
|
||||||
UserInfo::GetAccountType
|
UserInfo::GetAccountType
|
||||||
Pop $1
|
Pop $1
|
||||||
StrCmp $1 "Admin" 0 +3
|
StrCmp $1 "Admin" 0 +4
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
;MessageBox MB_OK 'User "$0" is in the Admin group'
|
;MessageBox MB_OK 'User "$0" is in the Admin group'
|
||||||
StrCpy $SV_ALLUSERS "AllUsers"
|
StrCpy $SV_ALLUSERS "AllUsers"
|
||||||
Goto done
|
Goto done
|
||||||
StrCmp $1 "Power" 0 +3
|
StrCmp $1 "Power" 0 +4
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
;MessageBox MB_OK 'User "$0" is in the Power Users group'
|
;MessageBox MB_OK 'User "$0" is in the Power Users group'
|
||||||
StrCpy $SV_ALLUSERS "AllUsers"
|
StrCpy $SV_ALLUSERS "AllUsers"
|
||||||
|
|
Loading…
Reference in New Issue