diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-08-10 17:19:28 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-08-15 11:32:37 +0200 |
| commit | 41a962e7d0cd4cde45a193dbc93e6bd65bbd20e3 (patch) | |
| tree | c999ec9124b57af92ca13224578e9d0de21d1ac6 | |
| parent | e911f56bc3eace19fc603ecd692b360661991fbb (diff) | |
| download | mullvadvpn-41a962e7d0cd4cde45a193dbc93e6bd65bbd20e3.tar.xz mullvadvpn-41a962e7d0cd4cde45a193dbc93e6bd65bbd20e3.zip | |
Update installer and driverlogic to use updated Wintun API
| -rw-r--r-- | dist-assets/windows/installer.nsh | 7 | ||||
| -rw-r--r-- | windows/driverlogic/src/driverlogic.cpp | 17 | ||||
| -rw-r--r-- | windows/driverlogic/src/wintun.h | 10 |
3 files changed, 11 insertions, 23 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh index cb4ea8a417..b699982ad0 100644 --- a/dist-assets/windows/installer.nsh +++ b/dist-assets/windows/installer.nsh @@ -12,8 +12,6 @@ # Do not compare variables using the <> operator - broken # -!define WINTUN_POOL "Mullvad" - # "sc" exit code !define SERVICE_STARTED 0 !define SERVICE_START_PENDING 2 @@ -148,13 +146,12 @@ log::Log "RemoveWintun()" - nsExec::ExecToStack '"$TEMP\driverlogic.exe" wintun-delete-pool-driver ${WINTUN_POOL}' + nsExec::ExecToStack '"$TEMP\driverlogic.exe" wintun-delete-driver' Pop $0 Pop $1 ${If} $0 != ${DL_GENERAL_SUCCESS} - IntFmt $0 "0x%X" $0 - StrCpy $R0 "Failed to remove Wintun pool: error $0" + StrCpy $R0 "Failed to remove Wintun driver. It may be in use." log::LogWithDetails $R0 $1 Goto RemoveWintun_return_only ${EndIf} diff --git a/windows/driverlogic/src/driverlogic.cpp b/windows/driverlogic/src/driverlogic.cpp index aba746d3e3..2fdcc3046c 100644 --- a/windows/driverlogic/src/driverlogic.cpp +++ b/windows/driverlogic/src/driverlogic.cpp @@ -228,26 +228,23 @@ ReturnCode CommandSplitTunnelForceInstall(const std::vector<std::wstring> &args) return CommandSplitTunnelNewInstall(args); } -ReturnCode CommandWintunDeletePool(const std::vector<std::wstring> &args) +ReturnCode CommandWintunDeleteDriver(const std::vector<std::wstring> &args) { ArgumentContext argsContext(args); - argsContext.ensureExactArgumentCount(1); - - const auto poolName = argsContext.next(); + argsContext.ensureExactArgumentCount(0); WintunDll wintun; - BOOL rebootRequired; - - if (FALSE == wintun.deletePoolDriver(poolName.c_str(), &rebootRequired)) + if (FALSE == wintun.deleteDriver()) { - throw std::runtime_error("Failed to delete wintun pool"); + // NOTE: This is expected if there are other adapters in use. + throw std::runtime_error("Failed to delete wintun driver"); } std::wstringstream ss; - ss << L"Successfully deleted wintun pool. Reboot required: " << rebootRequired; + ss << L"Deleted Wintun driver"; Log(ss.str()); @@ -343,7 +340,7 @@ int wmain(int argc, const wchar_t *argv[]) { L"st-new-install", CommandSplitTunnelNewInstall }, { L"st-force-install", CommandSplitTunnelForceInstall }, { L"st-remove", CommandSplitTunnelRemove }, - { L"wintun-delete-pool-driver", CommandWintunDeletePool }, + { L"wintun-delete-driver", CommandWintunDeleteDriver }, { L"wintun-delete-abandoned-device", CommandWintunDeleteAbandonedDevice }, { L"wg-nt-cleanup", CommandWireGuardNtCleanup } }; diff --git a/windows/driverlogic/src/wintun.h b/windows/driverlogic/src/wintun.h index 3d81be97e3..22444fcd94 100644 --- a/windows/driverlogic/src/wintun.h +++ b/windows/driverlogic/src/wintun.h @@ -20,10 +20,7 @@ public: try { - createAdapter = getProcAddressOrThrow<WINTUN_CREATE_ADAPTER_FUNC>("WintunCreateAdapter"); - openAdapter = getProcAddressOrThrow<WINTUN_OPEN_ADAPTER_FUNC>("WintunOpenAdapter"); - freeAdapter = getProcAddressOrThrow<WINTUN_FREE_ADAPTER_FUNC>("WintunFreeAdapter"); - deletePoolDriver = getProcAddressOrThrow<WINTUN_DELETE_POOL_DRIVER_FUNC>("WintunDeletePoolDriver"); + deleteDriver = getProcAddressOrThrow<WINTUN_DELETE_DRIVER_FUNC*>("WintunDeleteDriver"); } catch (...) { @@ -40,10 +37,7 @@ public: } } - WINTUN_CREATE_ADAPTER_FUNC createAdapter; - WINTUN_OPEN_ADAPTER_FUNC openAdapter; - WINTUN_FREE_ADAPTER_FUNC freeAdapter; - WINTUN_DELETE_POOL_DRIVER_FUNC deletePoolDriver; + WINTUN_DELETE_DRIVER_FUNC *deleteDriver; private: |
