summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2019-12-18 09:56:41 +0100
committerDavid Lönnhager <david.l@mullvad.net>2020-01-02 09:58:00 +0100
commitfa5443e9235016b462aadf258ccabe87fb58ffa0 (patch)
tree8535796067ab97d35c8d0a7fd3ae950a483948f0
parentec58b082eb71afc6cbf9a4b895c38496cbe8b17c (diff)
downloadmullvadvpn-fa5443e9235016b462aadf258ccabe87fb58ffa0.tar.xz
mullvadvpn-fa5443e9235016b462aadf258ccabe87fb58ffa0.zip
Skip TAP adapters whose names or attributes cannot be read instead of failing
-rw-r--r--windows/nsis-plugins/src/driverlogic/context.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/windows/nsis-plugins/src/driverlogic/context.cpp b/windows/nsis-plugins/src/driverlogic/context.cpp
index e65900582c..2fe33e22cd 100644
--- a/windows/nsis-plugins/src/driverlogic/context.cpp
+++ b/windows/nsis-plugins/src/driverlogic/context.cpp
@@ -274,15 +274,28 @@ std::set<Context::NetworkAdapter> GetTapAdapters()
// Construct NetworkAdapter
//
- const std::wstring guid = GetNetCfgInstanceId(devInfo, devInfoData);
- GUID guidObj = common::Guid::FromString(guid);
+ try
+ {
+ const std::wstring guid = GetNetCfgInstanceId(devInfo, devInfoData);
+ GUID guidObj = common::Guid::FromString(guid);
- adapters.emplace(Context::NetworkAdapter(
- guid,
- GetDeviceStringProperty(devInfo, &devInfoData, &DEVPKEY_Device_DriverDesc),
- nci.getConnectionName(guidObj),
- GetDeviceInstanceId(devInfo, &devInfoData)
- ));
+ adapters.emplace(Context::NetworkAdapter(
+ guid,
+ GetDeviceStringProperty(devInfo, &devInfoData, &DEVPKEY_Device_DriverDesc),
+ nci.getConnectionName(guidObj),
+ GetDeviceInstanceId(devInfo, &devInfoData)
+ ));
+ }
+ catch (const std::exception &e)
+ {
+ //
+ // Log exception and skip this adapter
+ //
+
+ std::string msg = "Skipping TAP adapter due to exception caught while iterating: ";
+ msg.append(e.what());
+ PluginLog(std::wstring(msg.begin(), msg.end()));
+ }
}
return adapters;