diff options
| -rw-r--r-- | dist-assets/windows/installer.nsh | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh index c1dac59bf8..402802e1dc 100644 --- a/dist-assets/windows/installer.nsh +++ b/dist-assets/windows/installer.nsh @@ -911,29 +911,32 @@ # The default behavior may cause the daemon to disconnect. # !macro customCheckAppRunning + push $R0 + push $R1 # This must be done here for compatibility with <= 2021.2, # since those versions do not kill the GUI in the uninstaller. - # This is fine as long as /f is used. - - ${KillGui} - -!macroend - -# -# KillGui -# -# Kill "Mullvad VPN.exe" if it is running. Killing without /f may cause the daemon to disconnect. -# -!macro KillGui + Var /GLOBAL OldVersion + ReadRegStr $OldVersion HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APP_GUID}" "DisplayVersion" + StrCpy $R0 $OldVersion 4 # Major version + StrCpy $R1 $OldVersion 1 5 # Minor version + ${If} $R0 > 2021 + Goto customCheckAppRunning_skip_kill + ${OrIf} $R0 == 2021 + ${If} $R1 > 2 + Goto customCheckAppRunning_skip_kill + ${EndIf} + ${EndIf} + # Killing without /f will likely cause the daemon to disconnect. nsExec::Exec `taskkill /f /t /im "${APP_EXECUTABLE_FILENAME}"` $R0 - Sleep 500 -!macroend + customCheckAppRunning_skip_kill: + pop $R1 + pop $R0 -!define KillGui '!insertmacro "KillGui"' +!macroend # # customInstall @@ -1231,6 +1234,10 @@ Pop $FullUninstall + nsExec::Exec '"$INSTDIR\Mullvad VPN.exe" --quit-without-disconnect' $0 + Sleep 500 + nsExec::Exec `taskkill /f /t /im "${APP_EXECUTABLE_FILENAME}"` $0 + ${If} $FullUninstall == 0 # Save the target tunnel state if we're upgrading nsExec::ExecToStack '"$TEMP\mullvad-setup.exe" prepare-restart' @@ -1251,8 +1258,6 @@ Goto customRemoveFiles_abort ${EndIf} - ${KillGui} - # Remove application files log::Log "Deleting $INSTDIR" RMDir /r $INSTDIR |
