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:
parent
ee4c9b6e33
commit
11824508c7
2 changed files with 55 additions and 58 deletions
|
@ -9,7 +9,7 @@ Copyright 2008-2021 Joost Verburg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
!ifndef MULTIUSER_INCLUDED
|
!ifndef MULTIUSER_INCLUDED
|
||||||
!define MULTIUSER_INCLUDED 20200319
|
!define MULTIUSER_INCLUDED 20210216
|
||||||
!verbose push 3
|
!verbose push 3
|
||||||
|
|
||||||
;Standard NSIS header files
|
;Standard NSIS header files
|
||||||
|
@ -36,15 +36,11 @@ Var MultiUser.InstallMode
|
||||||
|
|
||||||
!ifdef MULTIUSER_INSTALLMODE_COMMANDLINE
|
!ifdef MULTIUSER_INSTALLMODE_COMMANDLINE
|
||||||
!include StrFunc.nsh
|
!include StrFunc.nsh
|
||||||
!ifndef StrStr_INCLUDED
|
${Using:StrFunc} StrStr
|
||||||
${StrStr}
|
|
||||||
!endif
|
|
||||||
!ifndef MULTIUSER_NOUNINSTALL
|
!ifndef MULTIUSER_NOUNINSTALL
|
||||||
!ifndef UnStrStr_INCLUDED
|
${Using:StrFunc} UnStrStr
|
||||||
${UnStrStr}
|
|
||||||
!endif
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
Var MultiUser.Parameters
|
Var MultiUser.Parameters
|
||||||
Var MultiUser.Result
|
Var MultiUser.Result
|
||||||
!endif
|
!endif
|
||||||
|
@ -88,9 +84,9 @@ Install modes
|
||||||
;Install mode initialization - per-machine
|
;Install mode initialization - per-machine
|
||||||
|
|
||||||
${ifnot} ${IsNT}
|
${ifnot} ${IsNT}
|
||||||
${orif} $MultiUser.Privileges == "Admin"
|
${orif} $MultiUser.Privileges == "Admin"
|
||||||
${orif} $MultiUser.Privileges == "Power"
|
${orif} $MultiUser.Privileges == "Power"
|
||||||
|
|
||||||
StrCpy $MultiUser.InstallMode AllUsers
|
StrCpy $MultiUser.InstallMode AllUsers
|
||||||
|
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
|
@ -107,19 +103,19 @@ Install modes
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME
|
!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}"
|
ReadRegStr $MultiUser.InstDir HKLM "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}"
|
||||||
|
|
||||||
${if} $MultiUser.InstDir != ""
|
${if} $MultiUser.InstDir != ""
|
||||||
StrCpy $INSTDIR $MultiUser.InstDir
|
StrCpy $INSTDIR $MultiUser.InstDir
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION
|
!ifdef MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION
|
||||||
Call "${MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION}"
|
Call "${MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION}"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
@ -134,9 +130,9 @@ Install modes
|
||||||
|
|
||||||
StrCpy $MultiUser.InstallMode CurrentUser
|
StrCpy $MultiUser.InstallMode CurrentUser
|
||||||
SetShellVarContext current
|
SetShellVarContext current
|
||||||
|
|
||||||
!if "${UNINSTALLER_PREFIX}" != UN
|
!if "${UNINSTALLER_PREFIX}" != UN
|
||||||
;Set default installation location for installer
|
;Set default installation location for installer
|
||||||
!ifdef MULTIUSER_INSTALLMODE_INSTDIR
|
!ifdef MULTIUSER_INSTALLMODE_INSTDIR
|
||||||
!if ${MULTIUSER_MINWIN} < 0x490
|
!if ${MULTIUSER_MINWIN} < 0x490
|
||||||
${if} ${AtLeastWin2000}
|
${if} ${AtLeastWin2000}
|
||||||
|
@ -152,7 +148,7 @@ Install modes
|
||||||
!endif
|
!endif
|
||||||
!endif
|
!endif
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME
|
!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}"
|
ReadRegStr $MultiUser.InstDir HKCU "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}"
|
||||||
${if} $MultiUser.InstDir != ""
|
${if} $MultiUser.InstDir != ""
|
||||||
|
@ -230,24 +226,24 @@ Installer/uninstaller initialization
|
||||||
|
|
||||||
UserInfo::GetAccountType
|
UserInfo::GetAccountType
|
||||||
Pop $MultiUser.Privileges
|
Pop $MultiUser.Privileges
|
||||||
|
|
||||||
!if ${MULTIUSER_MINWIN} < 0x500
|
!if ${MULTIUSER_MINWIN} < 0x500
|
||||||
${if} ${IsNT}
|
${if} ${IsNT}
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
;Check privileges
|
;Check privileges
|
||||||
|
|
||||||
!if "${MULTIUSER_EXECUTIONLEVEL}" == Admin
|
!if "${MULTIUSER_EXECUTIONLEVEL}" == Admin
|
||||||
|
|
||||||
${if} $MultiUser.Privileges != "Admin"
|
${if} $MultiUser.Privileges != "Admin"
|
||||||
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ADMINREQUIRED}"
|
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ADMINREQUIRED}"
|
||||||
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
|
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!else if "${MULTIUSER_EXECUTIONLEVEL}" == Power
|
!else if "${MULTIUSER_EXECUTIONLEVEL}" == Power
|
||||||
|
|
||||||
${if} $MultiUser.Privileges != "Power"
|
${if} $MultiUser.Privileges != "Power"
|
||||||
${andif} $MultiUser.Privileges != "Admin"
|
${andif} $MultiUser.Privileges != "Admin"
|
||||||
${if} ${AtMostWinXP}
|
${if} ${AtMostWinXP}
|
||||||
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_POWERREQUIRED}"
|
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_POWERREQUIRED}"
|
||||||
${else}
|
${else}
|
||||||
|
@ -255,15 +251,15 @@ Installer/uninstaller initialization
|
||||||
${endif}
|
${endif}
|
||||||
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
|
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef MULTIUSER_EXECUTIONLEVEL_ALLUSERS
|
!ifdef MULTIUSER_EXECUTIONLEVEL_ALLUSERS
|
||||||
|
|
||||||
;Default to per-machine installation if possible
|
;Default to per-machine installation if possible
|
||||||
|
|
||||||
${if} $MultiUser.Privileges == "Admin"
|
${if} $MultiUser.Privileges == "Admin"
|
||||||
${orif} $MultiUser.Privileges == "Power"
|
${orif} $MultiUser.Privileges == "Power"
|
||||||
!ifndef MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
|
!ifndef MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
|
||||||
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
|
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
|
||||||
!else
|
!else
|
||||||
|
@ -297,41 +293,42 @@ Installer/uninstaller initialization
|
||||||
${else}
|
${else}
|
||||||
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
|
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!else
|
!else
|
||||||
|
|
||||||
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
|
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef MULTIUSER_INSTALLMODE_COMMANDLINE
|
!ifdef MULTIUSER_INSTALLMODE_COMMANDLINE
|
||||||
|
|
||||||
;Check for install mode setting on command line
|
;Check for install mode setting on command line
|
||||||
|
|
||||||
${${UNINSTALLER_FUNCPREFIX}GetParameters} $MultiUser.Parameters
|
${${UNINSTALLER_FUNCPREFIX}GetParameters} $MultiUser.Parameters
|
||||||
|
|
||||||
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/CurrentUser"
|
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/CurrentUser"
|
||||||
|
|
||||||
${if} $MultiUser.Result != ""
|
${if} $MultiUser.Result != ""
|
||||||
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
|
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/AllUsers"
|
${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/AllUsers"
|
||||||
|
|
||||||
${if} $MultiUser.Result != ""
|
${if} $MultiUser.Result != ""
|
||||||
${if} $MultiUser.Privileges == "Admin"
|
${if} $MultiUser.Privileges == "Admin"
|
||||||
${orif} $MultiUser.Privileges == "Power"
|
${orif} $MultiUser.Privileges == "Power"
|
||||||
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
|
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
|
||||||
${else}
|
${else}
|
||||||
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE}"
|
MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE}"
|
||||||
|
!insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}"
|
||||||
${endif}
|
${endif}
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!if ${MULTIUSER_MINWIN} < 0x500
|
!if ${MULTIUSER_MINWIN} < 0x500
|
||||||
${else}
|
${else}
|
||||||
|
|
||||||
;Not running Windows NT, per-user installation not supported
|
;Not running Windows NT, per-user installation not supported
|
||||||
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
|
Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers
|
||||||
|
|
||||||
|
@ -347,14 +344,14 @@ Installer/uninstaller initialization
|
||||||
!else
|
!else
|
||||||
!insertmacro MULTIUSER_INIT_CHECKS "" ""
|
!insertmacro MULTIUSER_INIT_CHECKS "" ""
|
||||||
!endif
|
!endif
|
||||||
!verbose pop
|
!verbose pop
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
!ifndef MULTIUSER_NOUNINSTALL
|
!ifndef MULTIUSER_NOUNINSTALL
|
||||||
!macro MULTIUSER_UNINIT
|
!macro MULTIUSER_UNINIT
|
||||||
!verbose push 3
|
!verbose push 3
|
||||||
!insertmacro MULTIUSER_INIT_CHECKS Un un.
|
!insertmacro MULTIUSER_INIT_CHECKS Un un.
|
||||||
!verbose pop
|
!verbose pop
|
||||||
!macroend
|
!macroend
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
@ -379,9 +376,9 @@ Mode selection page
|
||||||
!ifndef MULTIUSER_INSTALLMODEPAGE_INTERFACE
|
!ifndef MULTIUSER_INSTALLMODEPAGE_INTERFACE
|
||||||
!define MULTIUSER_INSTALLMODEPAGE_INTERFACE
|
!define MULTIUSER_INSTALLMODEPAGE_INTERFACE
|
||||||
Var MultiUser.InstallModePage
|
Var MultiUser.InstallModePage
|
||||||
|
|
||||||
Var MultiUser.InstallModePage.Text
|
Var MultiUser.InstallModePage.Text
|
||||||
|
|
||||||
Var MultiUser.InstallModePage.AllUsers
|
Var MultiUser.InstallModePage.AllUsers
|
||||||
Var MultiUser.InstallModePage.CurrentUser
|
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_TOP "$(MULTIUSER_INNERTEXT_INSTALLMODE_TOP)"
|
||||||
!define /IfNDef MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS "$(MULTIUSER_INNERTEXT_INSTALLMODE_ALLUSERS)"
|
!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
|
PageEx custom
|
||||||
|
|
||||||
|
@ -418,7 +415,7 @@ Mode selection page
|
||||||
!macro MULTIUSER_PAGE_INSTALLMODE
|
!macro MULTIUSER_PAGE_INSTALLMODE
|
||||||
|
|
||||||
!verbose push 3
|
!verbose push 3
|
||||||
|
|
||||||
!ifndef MULTIUSER_EXECUTIONLEVEL_ALLUSERS
|
!ifndef MULTIUSER_EXECUTIONLEVEL_ALLUSERS
|
||||||
!error "A mixed-mode installation requires MULTIUSER_EXECUTIONLEVEL to be set to Admin, Power or Highest."
|
!error "A mixed-mode installation requires MULTIUSER_EXECUTIONLEVEL to be set to Admin, Power or Highest."
|
||||||
!endif
|
!endif
|
||||||
|
@ -427,7 +424,7 @@ Mode selection page
|
||||||
!insertmacro MUI_PAGE_INIT
|
!insertmacro MUI_PAGE_INIT
|
||||||
!endif
|
!endif
|
||||||
!insertmacro MULTIUSER_PAGEDECLARATION_INSTALLMODE "" ${__COUNTER__}
|
!insertmacro MULTIUSER_PAGEDECLARATION_INSTALLMODE "" ${__COUNTER__}
|
||||||
|
|
||||||
!verbose pop
|
!verbose pop
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
@ -445,7 +442,7 @@ Mode selection page
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
${if} $MultiUser.Privileges != "Power"
|
${if} $MultiUser.Privileges != "Power"
|
||||||
${andif} $MultiUser.Privileges != "Admin"
|
${andif} $MultiUser.Privileges != "Admin"
|
||||||
Abort
|
Abort
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
|
@ -482,22 +479,22 @@ Mode selection page
|
||||||
${else}
|
${else}
|
||||||
SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0
|
SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM SHOW
|
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM SHOW
|
||||||
nsDialogs::Show
|
nsDialogs::Show
|
||||||
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM DESTROYED
|
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM DESTROYED
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function "${LEAVE}"
|
Function "${LEAVE}"
|
||||||
SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $0
|
SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $0
|
||||||
|
|
||||||
${if} $0 = ${BST_CHECKED}
|
${if} $0 = ${BST_CHECKED}
|
||||||
Call MultiUser.InstallMode.AllUsers
|
Call MultiUser.InstallMode.AllUsers
|
||||||
${else}
|
${else}
|
||||||
Call MultiUser.InstallMode.CurrentUser
|
Call MultiUser.InstallMode.CurrentUser
|
||||||
${endif}
|
${endif}
|
||||||
|
|
||||||
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM LEAVE
|
!insertmacro MULTIUSER_PAGE_FUNCTION_CUSTOM LEAVE
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
<p>
|
<p>
|
||||||
Insert the MULTIUSER_INIT and MULTIUSER_UNINT macros in the .onInit and un.onInit
|
Insert the MULTIUSER_INIT and MULTIUSER_UNINT macros in the .onInit and un.onInit
|
||||||
function to verify these privileges. If no uninstaller is created in the script,
|
function to verify these privileges. If no uninstaller is created in the script,
|
||||||
set MULTIUSER_NOUNINSTALL.</p>
|
define MULTIUSER_NOUNINSTALL.</p>
|
||||||
<code>
|
<code>
|
||||||
<pre>!define MULTIUSER_EXECUTIONLEVEL Highest
|
<pre>!define MULTIUSER_EXECUTIONLEVEL Highest
|
||||||
;!define MULTIUSER_NOUNINSTALL ;Uncomment if no uninstaller is created
|
;!define MULTIUSER_NOUNINSTALL ;Uncomment if no uninstaller is created
|
||||||
|
@ -214,7 +214,7 @@ FunctionEnd</pre>
|
||||||
if Administrator or Power User rights are available (this is always the case if
|
if Administrator or Power User rights are available (this is always the case if
|
||||||
the execution level is set to Admin or Power, if Highest is set it depends on the
|
the execution level is set to Admin or Power, if Highest is set it depends on the
|
||||||
user account). For the Standard execution level the installation will always be
|
user account). For the Standard execution level the installation will always be
|
||||||
for a single user. On Windows 95/98/Me installation for a single user is not possible.</p>
|
for a single user. On Windows 95/98/Me installation for a single user is not possible, a per-machine installation will be performed.</p>
|
||||||
<p>
|
<p>
|
||||||
The following settings are available to change the default installation mode:
|
The following settings are available to change the default installation mode:
|
||||||
<table>
|
<table>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue