use a callback to elevate earlier in the process

This commit is contained in:
idk
2022-05-18 11:46:06 -04:00
parent ea8788e1c8
commit 451e5d0494

View File

@ -130,6 +130,7 @@ RequestExecutionLevel user
PageEx license
licensetext "${LICENSE_TITLE}"
licensedata "licenses\LICENSE.index"
PageCallbacks elevatorCallback
PageExEnd
PageEx directory
dirtext "${FIREFOX_MESSAGE}"
@ -342,20 +343,24 @@ ${If} ${Silent}
CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall-${APPNAME}.lnk" "$INSTDIR\uninstall-i2pbrowser.exe"
FunctionEnd
# start default section
Section Install
Function elevatorCallback
${GetOptions} $CMDLINE "/p" $PARENTOPTIONS
${If} "${PARENTOPTIONS}" != ""
StrCpy $PARENTOPTIONS "-ArgumentList '${PARENTOPTIONS}'"
${EndIf}
${If} ${FileExists} "${I2PINSTEXE64}\i2p.exe"
ExecShell open "powershell -Command Start-Process .\$EXEFILE -Wait -Verb RunAs $PARENTOPTIONS"
Quit
${ElseIf} ${FileExists} "${I2PINSTEXE32}\i2p.exe"
ExecShell open "powershell -Command Start-Process .\$EXEFILE -Wait -Verb RunAs $PARENTOPTIONS"
${Else}
Call installerFunction
Quit
${EndIf}
FunctionEnd
# start default section
Section Install
Call installerFunction
SectionEnd
# uninstaller section start