diff options
| author | David Lönnhager <david.l@mullvad.net> | 2019-12-18 09:56:41 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2020-01-02 09:58:00 +0100 |
| commit | fa5443e9235016b462aadf258ccabe87fb58ffa0 (patch) | |
| tree | 8535796067ab97d35c8d0a7fd3ae950a483948f0 /windows/nsis-plugins/src | |
| parent | ec58b082eb71afc6cbf9a4b895c38496cbe8b17c (diff) | |
| download | mullvadvpn-fa5443e9235016b462aadf258ccabe87fb58ffa0.tar.xz mullvadvpn-fa5443e9235016b462aadf258ccabe87fb58ffa0.zip | |
Skip TAP adapters whose names or attributes cannot be read instead of failing
Diffstat (limited to 'windows/nsis-plugins/src')
| -rw-r--r-- | windows/nsis-plugins/src/driverlogic/context.cpp | 29 |
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; |
