51 lines
1.3 KiB
NSIS
51 lines
1.3 KiB
NSIS
|
|
Unicode True
|
||
|
|
RequestExecutionLevel user
|
||
|
|
SilentInstall silent
|
||
|
|
!include "LogicLib.nsh"
|
||
|
|
!include "RegistryCleanup.nsh"
|
||
|
|
!ifndef ACCEPTANCE_SCOPE
|
||
|
|
!error "Unique acceptance scope required"
|
||
|
|
!endif
|
||
|
|
!ifndef ACCEPTANCE_OUTPUT
|
||
|
|
!error "Acceptance output path required"
|
||
|
|
!endif
|
||
|
|
OutFile "${ACCEPTANCE_OUTPUT}"
|
||
|
|
!define FIXTURE "Software\UCVL\InstallerAcceptance\${ACCEPTANCE_SCOPE}"
|
||
|
|
Section
|
||
|
|
WriteRegStr HKCU "${FIXTURE}\sentinel" "value" "keep"
|
||
|
|
WriteRegStr HKCU "${FIXTURE}\removed\nested" "value" "fixture"
|
||
|
|
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}\removed"
|
||
|
|
${If} $0 != 0
|
||
|
|
SetErrorLevel 21
|
||
|
|
Quit
|
||
|
|
${EndIf}
|
||
|
|
ClearErrors
|
||
|
|
ReadRegStr $2 HKCU "${FIXTURE}\removed\nested" "value"
|
||
|
|
${IfNot} ${Errors}
|
||
|
|
SetErrorLevel 22
|
||
|
|
Quit
|
||
|
|
${EndIf}
|
||
|
|
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}\removed"
|
||
|
|
${If} $0 != 0
|
||
|
|
SetErrorLevel 23
|
||
|
|
Quit
|
||
|
|
${EndIf}
|
||
|
|
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}\missing-parent\missing-key"
|
||
|
|
${If} $0 != 0
|
||
|
|
SetErrorLevel 24
|
||
|
|
Quit
|
||
|
|
${EndIf}
|
||
|
|
ReadRegStr $2 HKCU "${FIXTURE}\sentinel" "value"
|
||
|
|
${If} $2 != "keep"
|
||
|
|
SetErrorLevel 25
|
||
|
|
Quit
|
||
|
|
${EndIf}
|
||
|
|
; Only this run's generated GUID subtree is removed, never the parent.
|
||
|
|
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}"
|
||
|
|
${If} $0 != 0
|
||
|
|
SetErrorLevel 26
|
||
|
|
Quit
|
||
|
|
${EndIf}
|
||
|
|
SetErrorLevel 0
|
||
|
|
SectionEnd
|