From c4a0bcea775981dea86d527f66161c98f5e05e95 Mon Sep 17 00:00:00 2001 From: Mattias Helsing Date: Wed, 1 Feb 2012 08:15:44 -0500 Subject: [PATCH] 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 commit a11b9a4c (Merge from CPack branch, 2006-01-01). Later commit b1b052fd (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. --- Modules/NSIS.template.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 6259a5bdf..819cc5cc0 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -922,12 +922,12 @@ Function .onInit Pop $0 UserInfo::GetAccountType Pop $1 - StrCmp $1 "Admin" 0 +3 + StrCmp $1 "Admin" 0 +4 SetShellVarContext all ;MessageBox MB_OK 'User "$0" is in the Admin group' StrCpy $SV_ALLUSERS "AllUsers" Goto done - StrCmp $1 "Power" 0 +3 + StrCmp $1 "Power" 0 +4 SetShellVarContext all ;MessageBox MB_OK 'User "$0" is in the Power Users group' StrCpy $SV_ALLUSERS "AllUsers"