Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Molkentin <danimo@owncloud.com>2015-06-05 09:43:16 +0300
committerDaniel Molkentin <danimo@owncloud.com>2015-07-17 15:43:18 +0300
commitb9edc6498279a4d4773fd2e84e604cdac8dd5854 (patch)
tree66c2d819413c08d997a37a698c45561e846519da /cmake/modules/NSIS.template.in
parentd00aa3da84ad2ac24c97995bfad1000f0109b050 (diff)
NSIS: Fix NSIS error handling
Diffstat (limited to 'cmake/modules/NSIS.template.in')
-rw-r--r--cmake/modules/NSIS.template.in78
1 files changed, 40 insertions, 38 deletions
diff --git a/cmake/modules/NSIS.template.in b/cmake/modules/NSIS.template.in
index 260f6d6e2..9da966286 100644
--- a/cmake/modules/NSIS.template.in
+++ b/cmake/modules/NSIS.template.in
@@ -719,25 +719,26 @@ Function .onInit
${MementoSectionRestore}
- UAC_Elevate:
- !insertmacro UAC_RunElevated
- StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
- StrCmp 0 $0 0 UAC_Err ; Error?
- StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
- Quit
-
- UAC_Err:
- MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
- Abort
-
- UAC_ElevationAborted:
- Abort
-
- UAC_Success:
- StrCmp 1 $3 +4 ;Admin?
- StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
- MessageBox MB_ICONSTOP $UAC_INSTALLER_REQUIRE_ADMIN
- goto UAC_Elevate
+ UAC_TryAgain:
+ ${Switch} $0
+ ${Case} 0
+ ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
+ ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
+ ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
+ MessageBox mb_YesNo|mb_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND $UAC_INSTALLER_REQUIRE_ADMIN /SD IDNO IDYES UAC_TryAgain IDNO 0
+ ${EndIf}
+ ;fall-through and die
+ ${Case} 1223
+ MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_INSTALLER_REQUIRE_ADMIN
+ Quit
+ ${Case} 1062
+ MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_ERROR_LOGON_SERVICE
+ Quit
+ ${Default}
+ MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
+ Abort
+ Quit
+ ${EndSwitch}
;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${APPLICATION_SHORTNAME}Installer") i .r1 ?e'
@@ -782,25 +783,26 @@ FunctionEnd
Function un.onInit
Call un.SetLang
- UAC_Elevate:
- !insertmacro UAC_RunElevated
- StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
- StrCmp 0 $0 0 UAC_Err ; Error?
- StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
- Quit
-
- UAC_Err:
- MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
- Abort
-
- UAC_ElevationAborted:
- Abort
-
- UAC_Success:
- StrCmp 1 $3 +4 ;Admin?
- StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
- MessageBox MB_ICONSTOP $UAC_UNINSTALLER_REQUIRE_ADMIN
- goto UAC_Elevate
+ UAC_TryAgain:
+ ${Switch} $0
+ ${Case} 0
+ ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
+ ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
+ ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
+ MessageBox mb_YesNo|mb_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND $UAC_UNINSTALLER_REQUIRE_ADMIN /SD IDNO IDYES UAC_TryAgain IDNO 0
+ ${EndIf}
+ ;fall-through and die
+ ${Case} 1223
+ MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_UNINSTALLER_REQUIRE_ADMIN
+ Quit
+ ${Case} 1062
+ MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_ERROR_LOGON_SERVICE
+ Quit
+ ${Default}
+ MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
+ Abort
+ Quit
+ ${EndSwitch}
;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${APPLICATION_SHORTNAME}Uninstaller") i .r1 ?e'