winpr: fix UWP portability

This commit is contained in:
Marc-André Moreau 2016-12-02 13:18:55 -05:00
parent f910bbe7b4
commit 53a61f512c
3 changed files with 22 additions and 1 deletions

View File

@ -199,6 +199,13 @@ BOOL CancelSynchronousIo(HANDLE hThread)
#ifdef _UWP
#include <winpr/crt.h>
#include <winpr/wlog.h>
#include "../log.h"
#define TAG WINPR_TAG("io")
BOOL GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait)
{
return GetOverlappedResultEx(hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait ? INFINITE : 0, TRUE);

View File

@ -450,7 +450,9 @@ char* GetCombinedPath(const char* basePath, const char* subPath)
BOOL PathMakePathA(LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes)
{
#ifdef _WIN32
#if defined(_UWP)
return FALSE;
#elif defined(_WIN32)
return (SHCreateDirectoryExA(NULL, path, lpAttributes) == ERROR_SUCCESS);
#else
const char delim = PathGetSeparatorA(PATH_STYLE_NATIVE);

View File

@ -89,17 +89,29 @@ BOOL WINAPI Win32_WTSVirtualChannelClose(HANDLE hChannel);
static void *_wts_malloc(size_t size)
{
#ifdef _UWP
return malloc(size);
#else
return (PVOID)LocalAlloc(LMEM_FIXED, size);
#endif
}
static void *_wts_calloc(size_t nmemb, size_t size)
{
#ifdef _UWP
return calloc(nmemb, size);
#else
return (PVOID)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, nmemb * size);
#endif
}
static void _wts_free(void* ptr)
{
#ifdef _UWP
free(ptr);
#else
LocalFree((HLOCAL)ptr);
#endif
}
BOOL Win32_WTSVirtualChannelReadAsync(WTSAPI_CHANNEL* pChannel)