DEV9: Clang format tap-win32

This commit is contained in:
TheLastRar 2021-09-26 16:38:49 +01:00 committed by refractionpcsx2
parent 26ea5bcfed
commit 39328c5c66
1 changed files with 23 additions and 23 deletions

View File

@ -106,13 +106,13 @@ bool IsTAPDevice(const TCHAR* guid)
{ {
len = sizeof(component_id); len = sizeof(component_id);
status = RegQueryValueEx(unit_key.get(), component_id_string, nullptr, &data_type, status = RegQueryValueEx(unit_key.get(), component_id_string, nullptr, &data_type,
(LPBYTE)component_id, &len); (LPBYTE)component_id, &len);
if (!(status != ERROR_SUCCESS || data_type != REG_SZ)) if (!(status != ERROR_SUCCESS || data_type != REG_SZ))
{ {
len = sizeof(net_cfg_instance_id); len = sizeof(net_cfg_instance_id);
status = RegQueryValueEx(unit_key.get(), net_cfg_instance_id_string, nullptr, &data_type, status = RegQueryValueEx(unit_key.get(), net_cfg_instance_id_string, nullptr, &data_type,
(LPBYTE)net_cfg_instance_id, &len); (LPBYTE)net_cfg_instance_id, &len);
if (status == ERROR_SUCCESS && data_type == REG_SZ) if (status == ERROR_SUCCESS && data_type == REG_SZ)
{ {
@ -138,13 +138,13 @@ std::vector<AdapterEntry> TAPAdapter::GetAdapters()
wil::unique_hkey control_net_key; wil::unique_hkey control_net_key;
LSTATUS status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ | KEY_QUERY_VALUE, LSTATUS status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS_KEY, 0, KEY_READ | KEY_QUERY_VALUE,
control_net_key.put()); control_net_key.put());
if (status != ERROR_SUCCESS) if (status != ERROR_SUCCESS)
return tap_nic; return tap_nic;
status = RegQueryInfoKey(control_net_key.get(), nullptr, nullptr, nullptr, &cSubKeys, nullptr, nullptr, status = RegQueryInfoKey(control_net_key.get(), nullptr, nullptr, nullptr, &cSubKeys, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr); nullptr, nullptr, nullptr, nullptr, nullptr);
if (status != ERROR_SUCCESS) if (status != ERROR_SUCCESS)
return tap_nic; return tap_nic;
@ -164,7 +164,7 @@ std::vector<AdapterEntry> TAPAdapter::GetAdapters()
continue; continue;
_stprintf_s(connection_string, _T("%s\\%s\\Connection"), _stprintf_s(connection_string, _T("%s\\%s\\Connection"),
NETWORK_CONNECTIONS_KEY, enum_name); NETWORK_CONNECTIONS_KEY, enum_name);
wil::unique_hkey connection_key; wil::unique_hkey connection_key;
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, connection_string, 0, KEY_READ, connection_key.put()); status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, connection_string, 0, KEY_READ, connection_key.put());
@ -173,7 +173,7 @@ std::vector<AdapterEntry> TAPAdapter::GetAdapters()
{ {
len = sizeof(name_data); len = sizeof(name_data);
status = RegQueryValueEx(connection_key.get(), name_string, nullptr, &name_type, (LPBYTE)name_data, status = RegQueryValueEx(connection_key.get(), name_string, nullptr, &name_type, (LPBYTE)name_data,
&len); &len);
if (status != ERROR_SUCCESS || name_type != REG_SZ) if (status != ERROR_SUCCESS || name_type != REG_SZ)
{ {
@ -201,8 +201,8 @@ static int TAPGetMACAddress(HANDLE handle, u8* addr)
DWORD len = 0; DWORD len = 0;
return DeviceIoControl(handle, TAP_IOCTL_GET_MAC, return DeviceIoControl(handle, TAP_IOCTL_GET_MAC,
addr, 6, addr, 6,
addr, 6, &len, NULL); addr, 6, &len, NULL);
} }
//Set the connection status //Set the connection status
@ -211,8 +211,8 @@ static int TAPSetStatus(HANDLE handle, int status)
DWORD len = 0; DWORD len = 0;
return DeviceIoControl(handle, TAP_IOCTL_SET_MEDIA_STATUS, return DeviceIoControl(handle, TAP_IOCTL_SET_MEDIA_STATUS,
&status, sizeof(status), &status, sizeof(status),
&status, sizeof(status), &len, NULL); &status, sizeof(status), &len, NULL);
} }
//Open the TAP adapter and set the connection to enabled :) //Open the TAP adapter and set the connection to enabled :)
HANDLE TAPOpen(const char* device_guid) HANDLE TAPOpen(const char* device_guid)
@ -228,9 +228,9 @@ HANDLE TAPOpen(const char* device_guid)
LONG version_len; LONG version_len;
sprintf_s(device_path, "%s%s%s", sprintf_s(device_path, "%s%s%s",
USERMODEDEVICEDIR, USERMODEDEVICEDIR,
device_guid, device_guid,
TAPSUFFIX); TAPSUFFIX);
wil::unique_hfile handle(CreateFileA( wil::unique_hfile handle(CreateFileA(
device_path, device_path,
@ -247,8 +247,8 @@ HANDLE TAPOpen(const char* device_guid)
} }
BOOL bret = DeviceIoControl(handle.get(), TAP_IOCTL_GET_VERSION, BOOL bret = DeviceIoControl(handle.get(), TAP_IOCTL_GET_VERSION,
&version, sizeof(version), &version, sizeof(version),
&version, sizeof(version), (LPDWORD)&version_len, NULL); &version, sizeof(version), (LPDWORD)&version_len, NULL);
if (bret == FALSE) if (bret == FALSE)
{ {
@ -584,10 +584,10 @@ bool TAPAdapter::recv(NetPacket* pkt)
{ {
DWORD read_size; DWORD read_size;
BOOL result = ReadFile(htap, BOOL result = ReadFile(htap,
pkt->buffer, pkt->buffer,
sizeof(pkt->buffer), sizeof(pkt->buffer),
&read_size, &read_size,
&read); &read);
if (!result) if (!result)
{ {
@ -621,10 +621,10 @@ bool TAPAdapter::send(NetPacket* pkt)
DWORD writen; DWORD writen;
BOOL result = WriteFile(htap, BOOL result = WriteFile(htap,
pkt->buffer, pkt->buffer,
pkt->size, pkt->size,
&writen, &writen,
&write); &write);
if (!result) if (!result)
{ {