From b61c07a20564b16df9c004af97f6e69a35a12e77 Mon Sep 17 00:00:00 2001 From: ctrlaltca Date: Thu, 12 Jul 2018 23:58:56 +0200 Subject: [PATCH] Check for both 32 and 64bit cockatrice when uninstalling (#3323) --- cmake/NSIS.template.in | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 15002032..7d0acac3 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -154,17 +154,39 @@ FunctionEnd Function componentsPagePre ${If} $PortableMode = 0 SetShellVarContext all - ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" - StrCmp $R0 "" done - MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst + # uninstall 32bit version + SetRegView 32 + + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" + StrCmp $R0 "" done32 + + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst32 Abort - uninst: + uninst32: ClearErrors ExecWait "$R0" - done: + done32: + + # uninstall 64bit version + ${If} ${NSIS_IS_64_BIT} == 1 + SetRegView 64 + + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" + StrCmp $R0 "" done64 + + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst64 + Abort + + uninst64: + ClearErrors + ExecWait "$R0" + + done64: + ${EndIf} + ${Else} Abort ${EndIf}