mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
taptun: fix adapter detection on windows for newer versions of taptun driver
This commit is contained in:
parent
4bc6a8d0e6
commit
5b567d4a37
2 changed files with 20 additions and 8 deletions
7
3rdparty/tap-windows6/tap-windows.h
vendored
7
3rdparty/tap-windows6/tap-windows.h
vendored
|
@ -51,6 +51,13 @@
|
||||||
/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
|
/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
|
||||||
#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
|
#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
|
||||||
|
|
||||||
|
/* Control whether 802.1Q headers are added for priority */
|
||||||
|
#define TAP_WIN_IOCTL_PRIORITY_BEHAVIOR TAP_WIN_CONTROL_CODE (11, METHOD_BUFFERED)
|
||||||
|
#define TAP_PRIORITY_BEHAVIOR_NOPRIORITY 0
|
||||||
|
#define TAP_PRIORITY_BEHAVIOR_ENABLED 1
|
||||||
|
#define TAP_PRIORITY_BEHAVIOR_ADDALWAYS 2
|
||||||
|
#define TAP_PRIORITY_BEHAVIOR_MAX 2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* =================
|
* =================
|
||||||
* Registry keys
|
* Registry keys
|
||||||
|
|
|
@ -293,16 +293,21 @@ static std::vector<std::wstring> get_tap_adapters()
|
||||||
|
|
||||||
// check if the ComponentId value indicates a TAP-Windows adapter
|
// check if the ComponentId value indicates a TAP-Windows adapter
|
||||||
if (RegQueryValueExW(unit_key, L"ComponentId", NULL, &data_type, LPBYTE(component_id), &component_id_len) == ERROR_SUCCESS
|
if (RegQueryValueExW(unit_key, L"ComponentId", NULL, &data_type, LPBYTE(component_id), &component_id_len) == ERROR_SUCCESS
|
||||||
&& data_type == REG_SZ
|
&& data_type == REG_SZ)
|
||||||
&& safe_string(component_id, component_id_len) == L"" PRODUCT_TAP_WIN_COMPONENT_ID)
|
|
||||||
{
|
{
|
||||||
WCHAR net_cfg_instance_id[MAX_PATH];
|
std::wstring const value(safe_string(component_id, component_id_len));
|
||||||
DWORD net_cfg_instance_id_len = sizeof(net_cfg_instance_id);
|
|
||||||
|
|
||||||
// add the adapter to the result
|
// some older versions may not set the "root\" prefix
|
||||||
if (RegQueryValueExW(unit_key, L"NetCfgInstanceId", NULL, &data_type, LPBYTE(net_cfg_instance_id), &net_cfg_instance_id_len) == ERROR_SUCCESS
|
if (value == L"root\\" PRODUCT_TAP_WIN_COMPONENT_ID || value == L"" PRODUCT_TAP_WIN_COMPONENT_ID)
|
||||||
&& data_type == REG_SZ)
|
{
|
||||||
result.push_back(safe_string(net_cfg_instance_id, net_cfg_instance_id_len));
|
WCHAR net_cfg_instance_id[MAX_PATH];
|
||||||
|
DWORD net_cfg_instance_id_len = sizeof(net_cfg_instance_id);
|
||||||
|
|
||||||
|
// add the adapter to the result
|
||||||
|
if (RegQueryValueExW(unit_key, L"NetCfgInstanceId", NULL, &data_type, LPBYTE(net_cfg_instance_id), &net_cfg_instance_id_len) == ERROR_SUCCESS
|
||||||
|
&& data_type == REG_SZ)
|
||||||
|
result.push_back(safe_string(net_cfg_instance_id, net_cfg_instance_id_len));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(unit_key);
|
RegCloseKey(unit_key);
|
||||||
|
|
Loading…
Reference in a new issue