api: use C locale for adapter and pool name case-insensitive comparing
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
e630c3bec1
commit
f389fd5629
@ -21,7 +21,6 @@
|
||||
# error Unsupported architecture
|
||||
#endif
|
||||
|
||||
static _locale_t Locale;
|
||||
static USHORT NativeMachine = IMAGE_FILE_PROCESS;
|
||||
|
||||
WINTUN_STATUS
|
||||
@ -330,8 +329,6 @@ AdapterDeleteAllOurs(void)
|
||||
void
|
||||
AdapterInit(void)
|
||||
{
|
||||
Locale = _wcreate_locale(LC_ALL, L"");
|
||||
|
||||
#if defined(_M_IX86) || defined(_M_ARM)
|
||||
typedef BOOL(WINAPI * IsWow64Process2_t)(
|
||||
_In_ HANDLE hProcess, _Out_ USHORT * pProcessMachine, _Out_opt_ USHORT * pNativeMachine);
|
||||
@ -349,12 +346,6 @@ AdapterInit(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AdapterCleanup(void)
|
||||
{
|
||||
_free_locale(Locale);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
CheckReboot(_In_ HDEVINFO DevInfo, _In_ SP_DEVINFO_DATA *DevInfoData)
|
||||
{
|
||||
@ -481,14 +472,14 @@ IsPoolMember(
|
||||
}
|
||||
WCHAR PoolDeviceTypeName[MAX_POOL_DEVICE_TYPE];
|
||||
GetPoolDeviceTypeName(Pool, PoolDeviceTypeName);
|
||||
if (!_wcsicmp_l(FriendlyName, PoolDeviceTypeName, Locale) || !_wcsicmp_l(DeviceDesc, PoolDeviceTypeName, Locale))
|
||||
if (!_wcsicmp(FriendlyName, PoolDeviceTypeName) || !_wcsicmp(DeviceDesc, PoolDeviceTypeName))
|
||||
{
|
||||
*IsMember = TRUE;
|
||||
goto cleanupFriendlyName;
|
||||
}
|
||||
RemoveNumberedSuffix(FriendlyName, FriendlyName);
|
||||
RemoveNumberedSuffix(DeviceDesc, DeviceDesc);
|
||||
if (!_wcsicmp_l(FriendlyName, PoolDeviceTypeName, Locale) || !_wcsicmp_l(DeviceDesc, PoolDeviceTypeName, Locale))
|
||||
if (!_wcsicmp(FriendlyName, PoolDeviceTypeName) || !_wcsicmp(DeviceDesc, PoolDeviceTypeName))
|
||||
{
|
||||
*IsMember = TRUE;
|
||||
goto cleanupFriendlyName;
|
||||
@ -630,10 +621,10 @@ WintunGetAdapter(
|
||||
if (NciGetConnectionName(&CfgInstanceID, Name2, sizeof(Name2), NULL) != ERROR_SUCCESS)
|
||||
continue;
|
||||
Name2[_countof(Name2) - 1] = 0;
|
||||
if (_wcsicmp_l(Name, Name2, Locale))
|
||||
if (_wcsicmp(Name, Name2))
|
||||
{
|
||||
RemoveNumberedSuffix(Name2, Name2);
|
||||
if (_wcsicmp_l(Name, Name2, Locale))
|
||||
if (_wcsicmp(Name, Name2))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,6 @@ AdapterDeleteAllOurs(void);
|
||||
void
|
||||
AdapterInit(void);
|
||||
|
||||
void
|
||||
AdapterCleanup(void);
|
||||
|
||||
/**
|
||||
* Wintun adapter descriptor.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user