summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-01-31 13:11:42 +0100
committerDavid Lönnhager <david.l@mullvad.net>2020-02-03 09:13:29 +0100
commite16413a0bca49930051998b24bfb224fc59a0422 (patch)
tree7db75bb4e356626511c483f83698f5d7299a2dda
parent0b1204a5ead8ed3aa78f7528276a4c5a89ffc3bc (diff)
downloadmullvadvpn-e16413a0bca49930051998b24bfb224fc59a0422.tar.xz
mullvadvpn-e16413a0bca49930051998b24bfb224fc59a0422.zip
Use driverlogic process in installer
-rw-r--r--dist-assets/windows/installer.nsh28
-rw-r--r--windows/driverlogic/src/driverlogic.cpp10
2 files changed, 20 insertions, 18 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh
index 41962c2048..d25ec9c58c 100644
--- a/dist-assets/windows/installer.nsh
+++ b/dist-assets/windows/installer.nsh
@@ -24,10 +24,11 @@
!define MULLVAD_GENERAL_ERROR 0
!define MULLVAD_SUCCESS 1
-# Return codes from driverlogic::RemoveMullvadTap
-!define RMT_GENERAL_ERROR 0
-!define RMT_NO_REMAINING_ADAPTERS 1
-!define RMT_SOME_REMAINING_ADAPTERS 2
+# Return codes from driverlogic
+!define DL_GENERAL_ERROR 0
+!define DL_GENERAL_SUCCESS 1
+!define DL_DELETE_NO_ADAPTERS_REMAIN 2
+!define DL_DELETE_SOME_ADAPTERS_REMAIN 3
# Return codes from tapinstall
!define DEVCON_EXIT_OK 0
@@ -74,6 +75,7 @@
SetOutPath "$TEMP\driver"
+ File "${BUILD_RESOURCES_DIR}\..\windows\driverlogic\bin\x64-Release\driverlogic.exe"
File "${BUILD_RESOURCES_DIR}\binaries\x86_64-pc-windows-msvc\driver\*"
${If} ${AtLeastWin10}
@@ -192,19 +194,19 @@
log::Log "RemoveVanillaTap()"
- driverlogic::RemoveVanillaMullvadTap
+ nsExec::ExecToStack '"$TEMP\driver\driverlogic.exe" remove-vanilla-tap'
Pop $0
Pop $1
- ${If} $0 == ${RMT_GENERAL_ERROR}
+ ${If} $0 == ${DL_GENERAL_ERROR}
StrCpy $R0 "Failed to remove vanilla TAP adapter: $1"
log::Log $R0
Goto RemoveVanillaTap_return
${EndIf}
- ${If} $0 == ${RMT_NO_REMAINING_ADAPTERS}
+ ${If} $0 == ${DL_DELETE_NO_ADAPTERS_REMAIN}
log::Log "Removing vanilla TAP adapter driver since it is no longer in use"
nsExec::ExecToStack '"$TEMP\driver\tapinstall.exe" remove ${DEPRECATED_TAP_HARDWARE_ID}'
@@ -273,8 +275,8 @@
${EndIf}
log::Log "Creating new virtual adapter"
- nsExec::ExecToStack '"$TEMP\driver\tapinstall.exe" install "$TEMP\driver\OemVista.inf" ${TAP_HARDWARE_ID}'
-
+ nsExec::ExecToStack '"$TEMP\driver\driverlogic.exe" install "$TEMP\driver\OemVista.inf"'
+
Pop $0
Pop $1
@@ -285,13 +287,13 @@
Goto InstallDriver_return
${EndIf}
- log::Log "Calling on plugin to identify recently added adapter"
- driverlogic::IdentifyNewAdapter
-
+ log::Log "Identifying recently added adapter"
+ nsExec::ExecToStack '"$TEMP\driver\driverlogic.exe" find-tap'
+
Pop $0
Pop $1
- ${If} $0 != ${MULLVAD_SUCCESS}
+ ${If} $0 != ${DL_GENERAL_SUCCESS}
StrCpy $R0 "Failed to identify new adapter: $1"
log::Log $R0
Goto InstallDriver_return
diff --git a/windows/driverlogic/src/driverlogic.cpp b/windows/driverlogic/src/driverlogic.cpp
index 9805954079..16704b6c2b 100644
--- a/windows/driverlogic/src/driverlogic.cpp
+++ b/windows/driverlogic/src/driverlogic.cpp
@@ -62,7 +62,7 @@ void LogAdapters(const std::wstring &description, const std::set<NetworkAdapter>
<< L" Guid: " << adapter.guid << L'\n'
<< L" Name: " << adapter.name << L'\n'
<< L" Alias: " << adapter.alias << L'\n'
- << L" Alias: " << adapter.deviceInstanceId
+ << L" Device instance ID: " << adapter.deviceInstanceId
<< std::endl;
}
}
@@ -333,7 +333,7 @@ std::set<NetworkAdapter> GetTapAdapters(const std::wstring &tapHardwareId)
//
std::cerr << "Skipping TAP adapter due to exception caught while iterating: "
- << e.what();
+ << e.what() << std::endl;
}
}
@@ -442,7 +442,7 @@ ATTEMPT_UPDATE:
//
std::wcout << L"TAP driver update complete. Reboot required: "
- << rebootRequired << std::endl;
+ << rebootRequired;
}
std::optional<NetworkAdapter> FindMullvadAdapter(const std::set<NetworkAdapter> &tapAdapters)
@@ -680,12 +680,12 @@ int wmain(int argc, const wchar_t * argv[], const wchar_t * [])
}
catch (const std::exception &e)
{
- std::cerr << e.what() << std::endl;
+ std::cerr << e.what();
return GENERAL_ERROR;
}
catch (...)
{
- std::wcerr << L"Unhandled exception." << std::endl;
+ std::wcerr << L"Unhandled exception.";
return GENERAL_ERROR;
}
return GENERAL_SUCCESS;