aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/api.c2
-rw-r--r--api/api.h6
-rw-r--r--api/devmgmt.c20
-rw-r--r--api/pch.h1
4 files changed, 26 insertions, 3 deletions
diff --git a/api/api.c b/api/api.c
index 5816b4c..34b3536 100644
--- a/api/api.c
+++ b/api/api.c
@@ -58,9 +58,11 @@ DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved)
ResourceModule = hinstDLL;
NamespaceInit();
NciInit();
+ DevmgmtInit();
break;
case DLL_PROCESS_DETACH:
+ DevmgmtCleanup();
NciCleanup();
NamespaceCleanup();
break;
diff --git a/api/api.h b/api/api.h
index 9524706..d304193 100644
--- a/api/api.h
+++ b/api/api.h
@@ -126,3 +126,9 @@ typedef BOOL(CALLBACK *WINTUN_ENUMPROC)(_In_ const WINTUN_ADAPTER *Adapter, _In_
WINTUN_STATUS WINAPI
WintunEnumAdapters(_In_z_count_c_(MAX_POOL) const WCHAR *Pool, _In_ WINTUN_ENUMPROC Func, _In_ LPARAM Param);
+
+void
+DevmgmtInit();
+
+void
+DevmgmtCleanup();
diff --git a/api/devmgmt.c b/api/devmgmt.c
index 0022d56..39cc2f7 100644
--- a/api/devmgmt.c
+++ b/api/devmgmt.c
@@ -15,6 +15,8 @@ const static GUID ADAPTER_NET_GUID = { 0xcac88484L,
0x4c03,
{ 0x82, 0xe6, 0x71, 0xa8, 0x7a, 0xba, 0xc3, 0x61 } };
+static _locale_t Locale;
+
/**
* Retrieves a specified Plug and Play device property.
*
@@ -385,14 +387,14 @@ IsPoolMember(
goto cleanupDeviceDesc;
WCHAR PoolDeviceTypeName[MAX_POOL_DEVICE_TYPE];
GetPoolDeviceTypeName(Pool, PoolDeviceTypeName);
- if (!_wcsicmp(FriendlyName, PoolDeviceTypeName) || !_wcsicmp(DeviceDesc, PoolDeviceTypeName))
+ if (!_wcsicmp_l(FriendlyName, PoolDeviceTypeName, Locale) || !_wcsicmp_l(DeviceDesc, PoolDeviceTypeName, Locale))
{
*IsMember = TRUE;
goto cleanupFriendlyName;
}
RemoveNumberedSuffix(FriendlyName, FriendlyName);
RemoveNumberedSuffix(DeviceDesc, DeviceDesc);
- if (!_wcsicmp(FriendlyName, PoolDeviceTypeName) || !_wcsicmp(DeviceDesc, PoolDeviceTypeName))
+ if (!_wcsicmp_l(FriendlyName, PoolDeviceTypeName, Locale) || !_wcsicmp_l(DeviceDesc, PoolDeviceTypeName, Locale))
{
*IsMember = TRUE;
goto cleanupFriendlyName;
@@ -608,7 +610,7 @@ WintunGetAdapter(
continue;
Name2[_countof(Name2) - 1] = 0;
RemoveNumberedSuffix(Name2, Name3);
- if (_wcsicmp(Name, Name2) && _wcsicmp(Name, Name3))
+ if (_wcsicmp_l(Name, Name2, Locale) && _wcsicmp_l(Name, Name3, Locale))
continue;
/* Check the Hardware ID to make sure it's a real Wintun device. This avoids doing slow operations on non-Wintun
@@ -1223,3 +1225,15 @@ cleanupMutex:
ReleaseNameMutex(Mutex);
return Result;
}
+
+void
+DevmgmtInit()
+{
+ Locale = _wcreate_locale(LC_ALL, L"");
+}
+
+void
+DevmgmtCleanup()
+{
+ _free_locale(Locale);
+}
diff --git a/api/pch.h b/api/pch.h
index 5767deb..1e0b311 100644
--- a/api/pch.h
+++ b/api/pch.h
@@ -10,6 +10,7 @@
#include <bcrypt.h>
#include <cfgmgr32.h>
#include <iphlpapi.h>
+#include <locale.h>
#include <objbase.h>
#include <sddl.h>
#include <SetupAPI.h>