More robust uninstall handling on the "Already Installed" page in the installer

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6374 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-06-08 01:53:18 +00:00
parent 9ebabcd509
commit 4a221a8995

View file

@ -953,11 +953,10 @@ Function PageLeaveReinstall
${NSD_GetState} $R2 $R1
StrCmp $R0 "1" 0 +2
StrCmp $R0 "1" 0 +2 ; Existing install is not the same version?
StrCmp $R1 "1" reinst_uninstall reinst_done
StrCmp $R0 "2" 0 reinst_done
StrCmp $R1 "1" reinst_done reinst_uninstall
StrCmp $R1 "1" reinst_done ; Same version, skip to add/reinstall components?
reinst_uninstall:
ReadRegStr $R1 HKLM "${MEMENTO_REGISTRY_KEY}" "UninstallString"
@ -966,25 +965,27 @@ Function PageLeaveReinstall
HideWindow
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
ExecWait '$R1 _?=$INSTDIR' $0
BringToFront
IfErrors no_remove_uninstaller
IfFileExists "$INSTDIR\Bin\makensis.exe" no_remove_uninstaller
${IfThen} ${Errors} ${|} StrCpy $0 2 ${|} ; ExecWait failed, set fake exit code
Delete $R1
RMDir $INSTDIR
StrCpy $R1 ""
no_remove_uninstaller:
StrCmp "" $R1 0 +3
${If} $0 <> 0
${OrIf} ${FileExists} "$INSTDIR\Bin\makensis.exe"
${If} $0 = 1 ; User aborted uninstaller?
StrCmp $R0 "2" 0 +2 ; Is the existing install the same version?
Quit ; ...yes, already installed, we are done
Abort
${EndIf}
MessageBox MB_ICONEXCLAMATION "Unable to uninstall!"
Abort
StrCmp $R0 "2" 0 +2
Quit
${Else}
StrCpy $0 $R1 1
${IfThen} $0 == '"' ${|} StrCpy $R1 $R1 -1 1 ${|} ; Strip quotes from UninstallString
Delete $R1
RMDir $INSTDIR
${EndIf}
reinst_done: