From 265879cacf219366ebb2f6dd4865b9bb49cc075b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 13 Jan 2016 12:30:07 -0800 Subject: [PATCH] request admin elevation for uninstaller as well --- cmake/templates/NSIS.template.in | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 95b6675113..1ca9faf57f 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -31,10 +31,14 @@ ;-------------------------------- ;General + ; Require administrator access + RequestExecutionLevel admin + !ifdef INNER !echo "Inner invocation" ; just to see what's going on OutFile "$%TEMP%\tempinstaller.exe" ; not really important where this is SetCompress off ; for speed + !else !echo "Outer invocation" @@ -42,7 +46,7 @@ ; it is invoked, will just write the uninstaller to some location, and then exit. ; Be sure to substitute the name of this script here. - !system "set __COMPAT_LAYER=RunAsInvoker && $\"${NSISDIR}\makensis$\" /DINNER project.nsi" = 0 + !system "$\"${NSISDIR}\makensis$\" /DINNER project.nsi" = 0 ; Require administrator access RequestExecutionLevel admin @@ -52,6 +56,12 @@ !system "$%TEMP%\tempinstaller.exe" = 2 + ; The Inner invocation has written an uninstaller binary for us. + ; We need to sign it if it's a production or PR build. + !if @PRODUCTION_BUILD@ == 1 + !system '"@SIGNTOOL_EXECUTABLE@" sign /f %HF_PFX_FILE% /p %HF_PFX_PASSPHRASE% /tr http://tsa.starfieldtech.com /td SHA256 $%TEMP%\uninstaller.exe' = 0 + !endif + ; Good. Now we can carry on writing the real installer. ;Name and file @@ -1096,12 +1106,6 @@ Function .onInit WriteUninstaller "$%TEMP%\uninstaller.exe" - ; We've written the uninstaller binary. - ; We need to sign it if it's a production or PR build. - !if @PRODUCTION_BUILD@ == 1 - !system '"@SIGNTOOL_EXECUTABLE@" sign /f %HF_PFX_FILE% /p %HF_PFX_PASSPHRASE% /tr http://tsa.starfieldtech.com /td SHA256 $%TEMP%\uninstaller.exe' = 0 - !endif - ; just bail out quickly when running the "inner" installer Quit !endif