Files
ucvl-zonghengjia-open-source/windows/installer/GuardianGate.nsh
2026-10-11 23:23:20 +00:00

53 lines
1.3 KiB
NSIS

; Optional independent-guardian handoff. Shared by the production NSIS script
; and fixture compilation. The control directory is NOT the baseline job.
!include "StrFunc.nsh"
${StrStr}
${StrCase}
Var GuardianControlled
Var GuardianControl
Var GuardianNonce
Var GuardianInstallerPid
!macro InitGuardianGate
StrCpy $GuardianControlled "0"
${StrCase} $1 $0 "U"
${StrStr} $1 $1 "/GUARDIAN"
${If} $1 != ""
StrCpy $GuardianControlled "1"
SetSilent silent
ClearErrors
${GetOptions} $0 "/GUARDIAN=" $GuardianControl
${If} ${Errors}
SetErrorLevel 70
Quit
${EndIf}
ClearErrors
${GetOptions} $0 "/GUARDIANNONCE=" $GuardianNonce
${If} ${Errors}
${OrIf} $GuardianControl == ""
${OrIf} $GuardianNonce == ""
SetErrorLevel 70
Quit
${EndIf}
System::Call 'kernel32::GetCurrentProcessId() i .r1'
StrCpy $GuardianInstallerPid $1
${EndIf}
!macroend
!macro RunGuardianPhase ARGUMENT
StrCpy $0 70
ClearErrors
ExecWait '"$PLUGINSDIR\payload\VPNPlus.exe" ${ARGUMENT} "$INSTDIR" "$GuardianControl" "$GuardianNonce" "$GuardianInstallerPid"' $0
${If} ${Errors}
StrCpy $0 70
${EndIf}
!macroend
Function GuardianExitOnFailure
${If} $GuardianControlled == "1"
${AndIf} $0 != 0
SetErrorLevel $0
Quit
${EndIf}
FunctionEnd