diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-05-18 16:13:57 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-05-18 16:13:57 +0200 |
| commit | 0211a43e2f9e1b7beccaefd9a2a09672f1877fd8 (patch) | |
| tree | 02257be2e0378a3ad9887a4074ed358b2041a068 | |
| parent | ddb40d6479ad88a58ea3856e24e6038286dc7382 (diff) | |
| parent | b66f9ae5f7c77e945aeab77ce03d354c0cc3b298 (diff) | |
| download | mullvadvpn-0211a43e2f9e1b7beccaefd9a2a09672f1877fd8.tar.xz mullvadvpn-0211a43e2f9e1b7beccaefd9a2a09672f1877fd8.zip | |
Merge branch 'win-remove-temp-setup-files'
| -rw-r--r-- | CHANGELOG.md | 6 | ||||
| -rw-r--r-- | dist-assets/windows/installer.nsh | 41 | ||||
| -rw-r--r-- | windows/nsis-plugins/src/log/log.cpp | 9 |
3 files changed, 55 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aa2f634f9..b33f678cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ Line wrap the file at 100 chars. Th ## [Unreleased] -### Android +### Changed #### Android - Lowered default MTU to 1280 on Android. @@ -31,6 +31,10 @@ Line wrap the file at 100 chars. Th #### Android - Remove WireGuard view as it's no longer needed with the new way of managing devices. +### Fixed +#### Windows +- Be more scrupulous about removing temporary files used by the installer and uninstaller. + ### Security #### Android - Prevent location request responses from being received outside the tunnel when in the connected diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh index b04fadfb2d..cb4ea8a417 100644 --- a/dist-assets/windows/installer.nsh +++ b/dist-assets/windows/installer.nsh @@ -54,6 +54,42 @@ !define PERSISTENT_BLOCK_OUTBOUND_IPV4_FILTER_GUID "{79860c64-9a5e-48a3-b5f3-d64b41659aa5}" # +# CleanupTempFiles +# +# Clean up files used temporarily by the installer. +# +!macro CleanupTempFiles + + Push $0 + + log::SetLogTarget ${LOG_VOID} + + # Horrendous hack for unpinning log.dll. Since we do not know the reference count + # it is safest to unload it from here. + CleanupTempFiles_free_logger: + System::Call "KERNEL32::GetModuleHandle(t $\"$PLUGINSDIR\log.dll$\")p.r0" + ${If} $0 P<> 0 + System::Call "KERNEL32::FreeLibrary(pr0)" + Goto CleanupTempFiles_free_logger + ${EndIf} + + # The working directory cannot be deleted, so make sure it's set to $TEMP. + SetOutPath "$TEMP" + + RMDir /r "$TEMP\mullvad-split-tunnel" + Delete "$TEMP\wintun.dll" + Delete "$TEMP\mullvad-wireguard.dll" + Delete "$TEMP\driverlogic.exe" + Delete "$TEMP\mullvad-setup.exe" + Delete "$TEMP\winfw.dll" + + Pop $0 + +!macroend + +!define CleanupTempFiles '!insertmacro "CleanupTempFiles"' + +# # ExtractWireGuard # # Extract Wintun and WireGuardNT installer into $TEMP @@ -902,6 +938,8 @@ customInstall_skip_abort: + ${CleanupTempFiles} + Pop $R0 !macroend @@ -1161,6 +1199,7 @@ ${EndIf} log::Log "Aborting uninstaller" + SetErrorLevel 1 Abort @@ -1196,6 +1235,8 @@ Delete "$LOCALAPPDATA\Mullvad VPN\uninstall.log" ${EndIf} + ${CleanupTempFiles} + Pop $R0 Pop $1 Pop $0 diff --git a/windows/nsis-plugins/src/log/log.cpp b/windows/nsis-plugins/src/log/log.cpp index a491dc9b2d..6940240137 100644 --- a/windows/nsis-plugins/src/log/log.cpp +++ b/windows/nsis-plugins/src/log/log.cpp @@ -19,6 +19,8 @@ Logger *g_logger = nullptr; namespace { +bool g_pinned = false; + std::wstring PopString() { // @@ -45,6 +47,11 @@ EXTERN_C IMAGE_DOS_HEADER __ImageBase; void PinDll() { + if (g_pinned) + { + return; + } + // // Apparently NSIS loads and unloads the plugin module for EVERY call it makes to the plugin. // This makes it kind of difficult to maintain state. @@ -68,6 +75,8 @@ void PinDll() { LoadLibraryW(self); } + + g_pinned = true; } std::vector<std::wstring> BlockToRows(const std::wstring &textBlock) |
