From 7f99bebc722d91b48c3aefd42aa54bc044428005 Mon Sep 17 00:00:00 2001 From: Elia Zammuto Date: Sat, 16 Sep 2023 15:42:38 +0200 Subject: [PATCH] UWP Changes (#85) --- src/Platform.h | 7 +++++++ src/PlatformSockets.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Platform.h b/src/Platform.h index 5978fa2..a169a7c 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -55,6 +55,13 @@ // Windows doesn't have strtok_r() but it has the same // function named strtok_s(). #define strtok_r strtok_s + +# if defined(WINAPI_FAMILY) && WINAPI_FAMILY==WINAPI_FAMILY_APP +# define LC_UWP +# else +# define LC_WINDOWS_DESKTOP +#endif + #endif #include diff --git a/src/PlatformSockets.c b/src/PlatformSockets.c index af71fb0..c87e91b 100644 --- a/src/PlatformSockets.c +++ b/src/PlatformSockets.c @@ -21,11 +21,13 @@ static HMODULE WlanApiLibraryHandle; static HANDLE WlanHandle; +#if defined(LC_WINDOWS_DESKTOP) DWORD (WINAPI *pfnWlanOpenHandle)(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, PHANDLE phClientHandle); DWORD (WINAPI *pfnWlanCloseHandle)(HANDLE hClientHandle, PVOID pReserved); DWORD (WINAPI *pfnWlanEnumInterfaces)(HANDLE hClientHandle, PVOID pReserved, PWLAN_INTERFACE_INFO_LIST *ppInterfaceList); VOID (WINAPI *pfnWlanFreeMemory)(PVOID pMemory); DWORD (WINAPI *pfnWlanSetInterface)(HANDLE hClientHandle, CONST GUID *pInterfaceGuid, WLAN_INTF_OPCODE OpCode, DWORD dwDataSize, CONST PVOID pData, PVOID pReserved); +#endif #ifndef WLAN_API_MAKE_VERSION #define WLAN_API_MAKE_VERSION(_major, _minor) (((DWORD)(_minor)) << 16 | (_major)) @@ -618,7 +620,7 @@ bool isPrivateNetworkAddress(struct sockaddr_storage* address) { // Enable platform-specific low latency options (best-effort) void enterLowLatencyMode(void) { -#if defined(LC_WINDOWS) +#if defined(LC_WINDOWS_DESKTOP) DWORD negotiatedVersion; PWLAN_INTERFACE_INFO_LIST wlanInterfaceList; DWORD i; @@ -692,7 +694,7 @@ void enterLowLatencyMode(void) { } void exitLowLatencyMode(void) { -#if defined(LC_WINDOWS) +#if defined(LC_WINDOWS_DESKTOP) // Closing our WLAN client handle will undo our optimizations if (WlanHandle != NULL) { pfnWlanCloseHandle(WlanHandle, NULL);