summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-02-24 15:59:20 +0100
committerDavid Lönnhager <david.l@mullvad.net>2021-02-26 12:52:22 +0100
commit44b86e6c1f485bae6ecc4986813f86c230302a97 (patch)
tree63b8e835bb8818b8f28a898c53c1a912ea605c96
parent213d53618952114e316f3e8c5bd17da4dded84e2 (diff)
downloadmullvadvpn-44b86e6c1f485bae6ecc4986813f86c230302a97.tar.xz
mullvadvpn-44b86e6c1f485bae6ecc4986813f86c230302a97.zip
Remove network adapter with conflicting GUID in the installer
-rw-r--r--dist-assets/windows/installer.nsh42
1 files changed, 42 insertions, 0 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh
index 34c5c21fa4..3367c2425c 100644
--- a/dist-assets/windows/installer.nsh
+++ b/dist-assets/windows/installer.nsh
@@ -51,6 +51,7 @@
!define BLOCK_OUTBOUND_IPV4_FILTER_GUID "{a81c5411-0fd0-43a9-a9be-313f299de64f}"
!define PERSISTENT_BLOCK_OUTBOUND_IPV4_FILTER_GUID "{79860c64-9a5e-48a3-b5f3-d64b41659aa5}"
+!define WINTUN_ADAPTER_GUID "{AFE43773-E1F8-4EBB-8536-576AB86AFE9A}"
#
# ExtractWintun
@@ -194,6 +195,43 @@
!define RemoveWintun '!insertmacro "RemoveWintun"'
#
+# RemoveAbandonedWintunAdapter
+#
+# Removes old Wintun interface, even if it belongs to a different pool.
+#
+!macro RemoveAbandonedWintunAdapter
+ Push $0
+ Push $1
+
+ log::Log "RemoveAbandonedWintunAdapter()"
+
+ nsExec::ExecToStack '"$TEMP\driverlogic.exe" remove-device-by-guid ${WINTUN_ADAPTER_GUID}'
+ Pop $0
+ Pop $1
+
+ ${If} $0 != ${DL_GENERAL_SUCCESS}
+ ${AndIf} $0 != ${DL_ADAPTER_NOT_FOUND}
+ IntFmt $0 "0x%X" $0
+ StrCpy $R0 "Failed to remove network adapter: error $0"
+ log::LogWithDetails $R0 $1
+ Goto RemoveAbandonedWintunAdapter_return_only
+ ${EndIf}
+
+ log::Log "RemoveAbandonedWintunAdapter() completed successfully"
+
+ Push 0
+ Pop $R0
+
+ RemoveAbandonedWintunAdapter_return_only:
+
+ Pop $1
+ Pop $0
+
+!macroend
+
+!define RemoveAbandonedWintunAdapter '!insertmacro "RemoveAbandonedWintunAdapter"'
+
+#
# InstallService
#
# Register the service with Windows and start it
@@ -679,6 +717,10 @@
${RemoveRelayCache}
${RemoveApiAddressCache}
+ SetOutPath "$TEMP"
+ File "${BUILD_RESOURCES_DIR}\..\windows\driverlogic\bin\x64-Release\driverlogic.exe"
+ ${RemoveAbandonedWintunAdapter}
+
${If} ${AtMostWin7}
${InstallWin7Hotfix}
${If} $R0 != 0