Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Support for UWP #85

Closed
wants to merge 11 commits into from
7 changes: 7 additions & 0 deletions src/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdio.h>
Expand Down
6 changes: 4 additions & 2 deletions src/PlatformSockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Loading