Use CheckRunning to close SMXConfig before uninstalls too.

master
Glenn Maynard 5 years ago
parent 5508c42b10
commit 7c6b64c13e
  1. 17
      smx-config/installer/SMX.nsi

@ -72,9 +72,11 @@ Function InstallMSVCRuntime
FunctionEnd FunctionEnd
# Global variables and lots of gotos. That's all NSIS can do. I feel like I'm 8 again, writing in BASIC. # Global variables and lots of gotos. That's all NSIS can do. I feel like I'm 8 again, writing in BASIC.
Function CheckRunning # Also, we need to use some macro nastiness to convince NSIS to include this in both the installer and uninstaller.
Var /Global "ShutdownRetries"
!macro myfunc un
Function ${un}CheckRunning
# Reset ShutdownRetries. # Reset ShutdownRetries.
Var /Global "ShutdownRetries"
StrCpy $ShutdownRetries "0" StrCpy $ShutdownRetries "0"
retry: retry:
@ -113,13 +115,17 @@ failed_to_shut_down:
CantShutdownAutomatically: CantShutdownAutomatically:
# SMXConfig is running, but it's an older version that doesn't have a shutdown signal. Ask the # SMXConfig is running, but it's an older version that doesn't have a shutdown signal. Ask the
# user to shut it down. Retry will restart and check if it's not running. # user to shut it down. Retry will restart and check if it's not running.
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Please close SMXConfig before updating." /SD IDCANCEL IDRETRY retry IDCANCEL cancel MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Please close SMXConfig." /SD IDCANCEL IDRETRY retry IDCANCEL cancel
Quit Quit
cancel: cancel:
Quit Quit
done: done:
FunctionEnd FunctionEnd
!macroend
!insertmacro myfunc ""
!insertmacro myfunc "un."
Page custom CheckRunning Page custom CheckRunning
Page directory Page directory
@ -146,7 +152,12 @@ Section
"UninstallString" "$\"$INSTDIR\uninstall.exe$\"" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
SectionEnd SectionEnd
#Section "un.CheckRunning"
#SectionEnd
Section "Uninstall" Section "Uninstall"
# Make sure SMXConfig isn't running.
Call un.CheckRunning
Delete $INSTDIR\SMX.dll Delete $INSTDIR\SMX.dll
Delete $INSTDIR\SMXConfig.exe Delete $INSTDIR\SMXConfig.exe
Delete $INSTDIR\uninstall.exe Delete $INSTDIR\uninstall.exe

Loading…
Cancel
Save