Delete leftover reg key after elevation

This commit is contained in:
bitraid 2019-01-17 19:44:37 +02:00
parent 756bd21111
commit 052d07d371
No known key found for this signature in database
GPG Key ID: 140D99CA504654D3
1 changed files with 12 additions and 3 deletions

View File

@ -128,8 +128,7 @@ var KeepReg
; Remove the quotes from path in $R0 ; Remove the quotes from path in $R0
System::Call 'Shlwapi::PathUnquoteSpaces(t r10r10)' System::Call 'Shlwapi::PathUnquoteSpaces(t r10r10)'
IfFileExists $R0 +3 0 IfFileExists $R0 +3 0
; Delete the registry key if the uninstaller is missing. ; Return 0 if the uninstaller is missing.
DeleteRegKey HKLM "${REG_UN}\${PRODUCT_NAME}"
StrCpy $R0 "" StrCpy $R0 ""
${endif} ${endif}
${endif} ${endif}
@ -262,9 +261,19 @@ Section "Core Files (required)" SectionCoreFiles
${endif} ${endif}
${endif} ${endif}
; Remove the old uninstaller if it's leftover ; Remove any leftovers from the old NSIS installer
IfFileExists "$INSTDIR\uninst.exe" 0 +2 IfFileExists "$INSTDIR\uninst.exe" 0 +2
Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\uninst.exe"
${if} $MultiUser.InstallMode == "AllUsers"
SetRegView 32 ; The old NSIS installer writes to 32-bit registry space
ReadRegStr $R0 HKLM "${REG_UN}\${PRODUCT_NAME}" "QuietUninstallString"
${if} $R0 != ""
DeleteRegKey HKLM "${REG_UN}\${PRODUCT_NAME}"
${endif}
${if} ${RunningX64}
SetRegView 64
${endif}
${endif}
SetOutPath $INSTDIR SetOutPath $INSTDIR
; Write uninstaller and registry uninstall info as the first step, ; Write uninstaller and registry uninstall info as the first step,