Call MULTIUSER_INIT_QUIT if command line is incompatible (Bug #1253)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7263 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2021-02-16 15:57:28 +00:00
parent ee4c9b6e33
commit 11824508c7
2 changed files with 55 additions and 58 deletions

View file

@ -9,7 +9,7 @@ Copyright 2008-2021 Joost Verburg
*/
!ifndef MULTIUSER_INCLUDED
!define MULTIUSER_INCLUDED 20200319
!define MULTIUSER_INCLUDED 20210216
!verbose push 3
;Standard NSIS header files
@ -36,15 +36,11 @@ Var MultiUser.InstallMode
!ifdef MULTIUSER_INSTALLMODE_COMMANDLINE
!include StrFunc.nsh
!ifndef StrStr_INCLUDED
${StrStr}
!endif
${Using:StrFunc} StrStr
!ifndef MULTIUSER_NOUNINSTALL
!ifndef UnStrStr_INCLUDED
${UnStrStr}
!endif
${Using:StrFunc} UnStrStr
!endif
Var MultiUser.Parameters
Var MultiUser.Result
!endif
@ -88,9 +84,9 @@ Install modes
;Install mode initialization - per-machine
${ifnot} ${IsNT}
${orif} $MultiUser.Privileges == "Admin"
${orif} $MultiUser.Privileges == "Power"
${orif} $MultiUser.Privileges == "Admin"
${orif} $MultiUser.Privileges == "Power"
StrCpy $MultiUser.InstallMode AllUsers
SetShellVarContext all
@ -107,19 +103,19 @@ Install modes
!endif
!ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME
ReadRegStr $MultiUser.InstDir HKLM "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}"
${if} $MultiUser.InstDir != ""
StrCpy $INSTDIR $MultiUser.InstDir
${endif}
!endif
!ifdef MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION
Call "${MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION}"
!endif
${endif}
!macroend
@ -134,9 +130,9 @@ Install modes
StrCpy $MultiUser.InstallMode CurrentUser
SetShellVarContext current
!if "${UNINSTALLER_PREFIX}" != UN
;Set default installation location for installer
;Set default installation location for installer
!ifdef MULTIUSER_INSTALLMODE_INSTDIR
!if ${MULTIUSER_MINWIN} < 0x490
${if} ${AtLeastWin2000}
@ -152,7 +148,7 @@ Install modes
!endif
!endif
!endif
!ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME
ReadRegStr $MultiUser.InstDir HKCU "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}"
${if} $MultiUser.InstDir != ""
@ -230,24 +226,24 @@ Installer/uninstaller initialization
UserInfo::GetAccountType
Pop $MultiUser.Privileges
!if ${MULTIUSER_MINWIN} < 0x500
${if} ${IsNT}
!endif
;Check privileges
!if "${MULTIUSER_EXECUTIONLEVEL}" == Admin
${if} $MultiUser.Privileges != "Admin"
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ADMINREQUIRED}"
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
${endif}
!else if "${MULTIUSER_EXECUTIONLEVEL}" == Power
${if} $MultiUser.Privileges != "Power"
${andif} $MultiUser.Privileges != "Admin"
${andif} $MultiUser.Privileges != "Admin"
${if} ${AtMostWinXP}
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_POWERREQUIRED}"
${else}
@ -255,15 +251,15 @@ Installer/uninstaller initialization
${endif}
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
${endif}
!endif
!ifdef MULTIUSER_EXECUTIONLEVEL_ALLUSERS
;Default to per-machine installation if possible
${if} $MultiUser.Privileges == "Admin"
${orif} $MultiUser.Privileges == "Power"
${orif} $MultiUser.Privileges == "Power"
!ifndef MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
!else
@ -297,41 +293,42 @@ Installer/uninstaller initialization
${else}
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
${endif}
!else
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
!endif
!endif
!ifdef MULTIUSER_INSTALLMODE_COMMANDLINE
;Check for install mode setting on command line
${${UNINSTALLER_FUNCPREFIX}GetParameters} $MultiUser.Parameters
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/CurrentUser"
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/CurrentUser"
${if} $MultiUser.Result != ""
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
${endif}
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/AllUsers"
${endif}
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/AllUsers"
${if} $MultiUser.Result != ""
${if} $MultiUser.Privileges == "Admin"
${orif} $MultiUser.Privileges == "Power"
${orif} $MultiUser.Privileges == "Power"
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
${else}
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE}"
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
${endif}
${endif}
!endif
!if ${MULTIUSER_MINWIN} < 0x500
${else}
;Not running Windows NT, per-user installation not supported
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
@ -347,14 +344,14 @@ Installer/uninstaller initialization
!else
!insertmacro MULTIUSER_INIT_CHECKS "" ""
!endif
!verbose pop
!verbose pop
!macroend
!ifndef MULTIUSER_NOUNINSTALL
!macro MULTIUSER_UNINIT
!verbose push 3
!insertmacro MULTIUSER_INIT_CHECKS Un un.
!verbose pop
!verbose pop
!macroend
!endif
@ -379,9 +376,9 @@ Mode selection page
!ifndef MULTIUSER_INSTALLMODEPAGE_INTERFACE
!define MULTIUSER_INSTALLMODEPAGE_INTERFACE
Var MultiUser.InstallModePage
Var MultiUser.InstallModePage.Text
Var MultiUser.InstallModePage.AllUsers
Var MultiUser.InstallModePage.CurrentUser
@ -396,7 +393,7 @@ Mode selection page
!define /IfNDef MULTIUSER_INSTALLMODEPAGE_TEXT_TOP "$(MULTIUSER_INNERTEXT_INSTALLMODE_TOP)"
!define /IfNDef MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS "$(MULTIUSER_INNERTEXT_INSTALLMODE_ALLUSERS)"
!define /IfNDef MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER "$(MULTIUSER_INNERTEXT_INSTALLMODE_CURRENTUSER)"
!define /IfNDef MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER "$(MULTIUSER_INNERTEXT_INSTALLMODE_CURRENTUSER)"
PageEx custom
@ -418,7 +415,7 @@ Mode selection page
!macro MULTIUSER_PAGE_INSTALLMODE
!verbose push 3
!ifndef MULTIUSER_EXECUTIONLEVEL_ALLUSERS
!error "A mixed-mode installation requires MULTIUSER_EXECUTIONLEVEL to be set to Admin, Power or Highest."
!endif
@ -427,7 +424,7 @@ Mode selection page
!insertmacro MUI_PAGE_INIT
!endif
!insertmacro MULTIUSER_PAGEDECLARATION_INSTALLMODE "" ${__COUNTER__}
!verbose pop
!macroend
@ -445,7 +442,7 @@ Mode selection page
!endif
${if} $MultiUser.Privileges != "Power"
${andif} $MultiUser.Privileges != "Admin"
${andif} $MultiUser.Privileges != "Admin"
Abort
${endif}
@ -482,22 +479,22 @@ Mode selection page
${else}
SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0
${endif}
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM SHOW
nsDialogs::Show
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM DESTROYED
FunctionEnd
Function "${LEAVE}"
SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $0
${if} $0 = ${BST_CHECKED}
Call MultiUser.InstallMode.AllUsers
${else}
Call MultiUser.InstallMode.CurrentUser
${endif}
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM LEAVE
FunctionEnd