freerdp: UWP porting
This commit is contained in:
parent
2201ac5266
commit
4d629a7999
@ -41,6 +41,12 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
# Include our extra modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
|
||||
|
||||
if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES "10.0"))
|
||||
set(UWP 1)
|
||||
add_definitions("-D_UWP")
|
||||
set(CMAKE_WINDOWS_VERSION "WIN10")
|
||||
endif()
|
||||
|
||||
# Check for cmake compatibility (enable/disable features)
|
||||
include(CheckCmakeCompat)
|
||||
|
||||
@ -323,6 +329,7 @@ if(WIN32)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNICODE -D_UNICODE")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WINSOCK_DEPRECATED_NO_WARNINGS")
|
||||
|
||||
set(CMAKE_USE_RELATIVE_PATH ON)
|
||||
if (${CMAKE_GENERATOR} MATCHES "NMake Makefile*")
|
||||
@ -354,6 +361,9 @@ if(WIN32)
|
||||
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN8")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0602 -D_WIN32_WINNT=0x0602")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0602 -D_WIN32_WINNT=0x0602")
|
||||
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN10")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00")
|
||||
endif()
|
||||
|
||||
if (FREERDP_EXTERNAL_SSL_PATH)
|
||||
|
@ -222,7 +222,7 @@ static DIR *opendir(const char *dirname)
|
||||
* allows rewinddir() to function correctly when the current working
|
||||
* directory is changed between opendir() and rewinddir().
|
||||
*/
|
||||
if (GetFullPathNameA (dirname, MAX_PATH, dirp->patt, NULL)) {
|
||||
if (GetFullPathNameA(dirname, MAX_PATH, dirp->patt, NULL)) {
|
||||
char *p;
|
||||
|
||||
/* append the search pattern "\\*\0" to the directory name */
|
||||
@ -234,7 +234,7 @@ static DIR *opendir(const char *dirname)
|
||||
*p = '\0';
|
||||
|
||||
/* open directory stream and retrieve the first entry */
|
||||
dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data);
|
||||
dirp->search_handle = FindFirstFileA(dirp->patt, &dirp->find_data);
|
||||
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
|
||||
/* a directory entry is now waiting in memory */
|
||||
dirp->cached = 1;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/path.h>
|
||||
#include <winpr/file.h>
|
||||
#include <winpr/stream.h>
|
||||
|
||||
|
@ -38,10 +38,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/path.h>
|
||||
#include <winpr/string.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/thread.h>
|
||||
#include <winpr/stream.h>
|
||||
#include <winpr/environment.h>
|
||||
#include <winpr/interlocked.h>
|
||||
#include <winpr/collections.h>
|
||||
|
||||
@ -936,7 +938,9 @@ UINT DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
/* Special case: path[0] == '%' -> user home dir */
|
||||
if (strcmp(drive->Path, "%") == 0)
|
||||
{
|
||||
sprintf_s(buf, sizeof(buf), "%s\\", getenv("USERPROFILE"));
|
||||
GetEnvironmentVariableA("USERPROFILE", buf, sizeof(buf));
|
||||
PathCchAddBackslashA(buf, sizeof(buf));
|
||||
|
||||
free(drive->Path);
|
||||
drive->Path = _strdup(buf);
|
||||
if (!drive->Path)
|
||||
|
@ -30,7 +30,7 @@ if(WITH_CUPS)
|
||||
add_definitions(-DWITH_CUPS)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(WIN32 AND NOT UWP)
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS}
|
||||
printer_win.c
|
||||
printer_win.h)
|
||||
|
@ -110,7 +110,24 @@ static UINT rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr, UINT32 cou
|
||||
return rdpdr_send(rdpdr, s);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _UWP
|
||||
|
||||
void first_hotplug(rdpdrPlugin *rdpdr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void* drive_hotplug_thread_func(void* arg)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
|
||||
{
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
#elif _WIN32
|
||||
|
||||
BOOL check_path(char* path)
|
||||
{
|
||||
|
@ -20,8 +20,8 @@
|
||||
add_subdirectory(common)
|
||||
|
||||
if(FREERDP_VENDOR AND WITH_CLIENT)
|
||||
if(WIN32)
|
||||
add_subdirectory(Windows)
|
||||
if(WIN32 AND NOT UWP)
|
||||
add_subdirectory(Windows)
|
||||
else()
|
||||
if(WITH_SAMPLE)
|
||||
add_subdirectory(Sample)
|
||||
|
@ -44,10 +44,12 @@ endif()
|
||||
if(NOT WIN32)
|
||||
option(WITH_VALGRIND_MEMCHECK "Compile with valgrind helpers." OFF)
|
||||
else()
|
||||
option(WITH_MEDIA_FOUNDATION "Enable H264 media foundation decoder." ON)
|
||||
if(NOT UWP)
|
||||
option(WITH_MEDIA_FOUNDATION "Enable H264 media foundation decoder." ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
if(WIN32 AND NOT UWP)
|
||||
option(WITH_NATIVE_SSPI "Use native SSPI modules" ON)
|
||||
option(WITH_WINMM "Use Windows Multimedia" ON)
|
||||
option(WITH_WIN8 "Use Windows 8 libraries" OFF)
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/library.h>
|
||||
#include <winpr/bitstream.h>
|
||||
|
||||
#include <freerdp/primitives.h>
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/environment.h>
|
||||
|
||||
#include "liblocale.h"
|
||||
|
||||
@ -633,19 +634,28 @@ static const LOCALE_KEYBOARD_LAYOUTS LOCALE_KEYBOARD_LAYOUTS_TABLE[] =
|
||||
BOOL freerdp_get_system_language_and_country_codes(char* language, char* country)
|
||||
{
|
||||
int dot;
|
||||
DWORD nSize;
|
||||
int underscore;
|
||||
char* env_lang;
|
||||
char* env_lang = NULL;
|
||||
|
||||
/* LANG = <language>_<country>.<encoding> */
|
||||
env_lang = getenv("LANG"); /* Get locale from environment variable LANG */
|
||||
nSize = GetEnvironmentVariableA("LANG", NULL, 0);
|
||||
|
||||
if (env_lang == NULL)
|
||||
if (!nSize)
|
||||
return FALSE; /* LANG environment variable was not set */
|
||||
|
||||
env_lang = (char*) malloc(nSize);
|
||||
|
||||
if (!env_lang)
|
||||
return FALSE;
|
||||
|
||||
GetEnvironmentVariableA("LANG", env_lang, nSize); /* Get locale from environment variable LANG */
|
||||
|
||||
underscore = strcspn(env_lang, "_");
|
||||
|
||||
if (underscore > 3)
|
||||
{
|
||||
free(env_lang);
|
||||
return FALSE; /* The language name should not be more than 3 letters long */
|
||||
}
|
||||
else
|
||||
@ -665,9 +675,11 @@ BOOL freerdp_get_system_language_and_country_codes(char* language, char* country
|
||||
}
|
||||
else
|
||||
{
|
||||
free(env_lang);
|
||||
return FALSE; /* Invalid locale */
|
||||
}
|
||||
|
||||
free(env_lang);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef WINPR_DSPARSE_H
|
||||
#define WINPR_DSPARSE_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <winpr/windows.h>
|
||||
#include <winpr/rpc.h>
|
||||
|
@ -350,6 +350,27 @@ typedef struct _HANDLE_CREATOR
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _UWP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
WINPR_API HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define FindFirstFile FindFirstFileW
|
||||
#else
|
||||
#define FindFirstFile FindFirstFileA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define WILDCARD_STAR 0x00000001
|
||||
#define WILDCARD_QM 0x00000002
|
||||
#define WILDCARD_DOS 0x00000100
|
||||
|
@ -187,6 +187,37 @@ WINPR_API VOID _IoDeleteDeviceEx(PDEVICE_OBJECT_EX DeviceObject);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _UWP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API BOOL GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait);
|
||||
|
||||
WINPR_API BOOL DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
|
||||
|
||||
WINPR_API HANDLE CreateIoCompletionPort(HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads);
|
||||
|
||||
WINPR_API BOOL GetQueuedCompletionStatus(HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred,
|
||||
PULONG_PTR lpCompletionKey, LPOVERLAPPED* lpOverlapped, DWORD dwMilliseconds);
|
||||
|
||||
WINPR_API BOOL GetQueuedCompletionStatusEx(HANDLE CompletionPort, LPOVERLAPPED_ENTRY lpCompletionPortEntries,
|
||||
ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds, BOOL fAlertable);
|
||||
|
||||
WINPR_API BOOL PostQueuedCompletionStatus(HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped);
|
||||
|
||||
WINPR_API BOOL CancelIo(HANDLE hFile);
|
||||
|
||||
WINPR_API BOOL CancelSynchronousIo(HANDLE hThread);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Extended API
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@
|
||||
|
||||
/* Defined in wincred.h, do not redefine */
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <wincred.h>
|
||||
|
||||
@ -1421,7 +1421,11 @@ typedef struct _IO_STATUS_BLOCK
|
||||
{
|
||||
union
|
||||
{
|
||||
#ifdef _WIN32
|
||||
NTSTATUS Status;
|
||||
#else
|
||||
NTSTATUS status;
|
||||
#endif
|
||||
PVOID Pointer;
|
||||
};
|
||||
ULONG_PTR Information;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <winreg.h>
|
||||
|
||||
@ -39,6 +39,8 @@ extern "C" {
|
||||
#include <winpr/io.h>
|
||||
#include <winpr/error.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#define OWNER_SECURITY_INFORMATION 0x00000001
|
||||
#define GROUP_SECURITY_INFORMATION 0x00000002
|
||||
#define DACL_SECURITY_INFORMATION 0x00000004
|
||||
@ -105,6 +107,8 @@ extern "C" {
|
||||
typedef HANDLE HKEY;
|
||||
typedef HANDLE* PHKEY;
|
||||
|
||||
#endif
|
||||
|
||||
typedef ACCESS_MASK REGSAM;
|
||||
|
||||
#define HKEY_CLASSES_ROOT ((HKEY) (LONG_PTR) (LONG) 0x80000000)
|
||||
|
@ -34,7 +34,7 @@ typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_SERIALIZE;
|
||||
typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE;
|
||||
typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_SERIALIZE;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <rpc.h>
|
||||
|
||||
@ -72,8 +72,10 @@ typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_SERIALIZE;
|
||||
|
||||
typedef long RPC_STATUS;
|
||||
|
||||
#ifndef _WIN32
|
||||
typedef CHAR* RPC_CSTR;
|
||||
typedef WCHAR* RPC_WSTR;
|
||||
#endif
|
||||
|
||||
typedef void* I_RPC_HANDLE;
|
||||
typedef I_RPC_HANDLE RPC_BINDING_HANDLE;
|
||||
@ -197,6 +199,8 @@ typedef struct
|
||||
RPC_IF_ID *IfId[1];
|
||||
} RPC_IF_ID_VECTOR;
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
typedef void *RPC_AUTH_IDENTITY_HANDLE;
|
||||
typedef void *RPC_AUTHZ_HANDLE;
|
||||
|
||||
@ -371,6 +375,8 @@ typedef void (*RPC_HTTP_PROXY_FREE_STRING)(unsigned short* String);
|
||||
#define RPC_C_AUTHZ_DCE 2
|
||||
#define RPC_C_AUTHZ_DEFAULT 0xFFFFFFFF
|
||||
|
||||
#endif
|
||||
|
||||
typedef void (*RPC_AUTH_KEY_RETRIEVAL_FN)(void* Arg, unsigned short* ServerPrincName, unsigned long KeyVer, void** Key, RPC_STATUS* pStatus);
|
||||
|
||||
#define DCE_C_ERROR_STRING_LEN 256
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <winpr/sspi.h>
|
||||
#include <winpr/crypto.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <schannel.h>
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#ifndef SEC_ENTRY
|
||||
#define SEC_ENTRY
|
||||
@ -55,7 +55,10 @@ typedef struct _SECURITY_INTEGER SECURITY_INTEGER;
|
||||
typedef SECURITY_INTEGER TimeStamp;
|
||||
typedef SECURITY_INTEGER* PTimeStamp;
|
||||
|
||||
typedef UINT32 SECURITY_STATUS;
|
||||
#ifndef __SECSTATUS_DEFINED__
|
||||
typedef LONG SECURITY_STATUS;
|
||||
#define __SECSTATUS_DEFINED__
|
||||
#endif
|
||||
|
||||
struct _SecPkgInfoA
|
||||
{
|
||||
@ -252,7 +255,7 @@ typedef SecPkgInfoW* PSecPkgInfoW;
|
||||
#define SECPKG_ATTR_NEGO_STATUS 32
|
||||
#define SECPKG_ATTR_CONTEXT_DELETED 33
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
struct _SecPkgContext_AccessToken
|
||||
{
|
||||
@ -579,7 +582,10 @@ typedef SecPkgCredentials_NamesW* PSecPkgCredentials_NamesW;
|
||||
#define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1
|
||||
#define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#ifndef _AUTH_IDENTITY_DEFINED
|
||||
#define _AUTH_IDENTITY_DEFINED
|
||||
|
||||
typedef struct _SEC_WINNT_AUTH_IDENTITY_W
|
||||
{
|
||||
@ -615,6 +621,8 @@ struct _SEC_WINNT_AUTH_IDENTITY
|
||||
};
|
||||
typedef struct _SEC_WINNT_AUTH_IDENTITY SEC_WINNT_AUTH_IDENTITY;
|
||||
|
||||
#endif /* _AUTH_IDENTITY_DEFINED */
|
||||
|
||||
struct _SecHandle
|
||||
{
|
||||
ULONG_PTR dwLower;
|
||||
@ -665,7 +673,7 @@ typedef CtxtHandle* PCtxtHandle;
|
||||
#define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
|
||||
#define SECBUFFER_RESERVED 0x60000000
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
struct _SecBuffer
|
||||
{
|
||||
|
@ -94,8 +94,6 @@ typedef struct _SYSTEM_INFO
|
||||
WORD wProcessorRevision;
|
||||
} SYSTEM_INFO, *LPSYSTEM_INFO;
|
||||
|
||||
#define MAX_COMPUTERNAME_LENGTH 31
|
||||
|
||||
WINPR_API void GetSystemInfo(LPSYSTEM_INFO lpSystemInfo);
|
||||
WINPR_API void GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo);
|
||||
|
||||
@ -185,15 +183,6 @@ typedef struct _OSVERSIONINFOEXW
|
||||
#define VER_NT_SERVER 0x0000003
|
||||
#define VER_NT_WORKSTATION 0x0000001
|
||||
|
||||
WINPR_API BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
|
||||
WINPR_API BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define GetVersionEx GetVersionExW
|
||||
#else
|
||||
#define GetVersionEx GetVersionExA
|
||||
#endif
|
||||
|
||||
WINPR_API void GetSystemTime(LPSYSTEMTIME lpSystemTime);
|
||||
WINPR_API BOOL SetSystemTime(CONST SYSTEMTIME* lpSystemTime);
|
||||
WINPR_API VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
|
||||
@ -269,6 +258,19 @@ WINPR_API BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature);
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
WINPR_API BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
|
||||
WINPR_API BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define GetVersionEx GetVersionExW
|
||||
#else
|
||||
#define GetVersionEx GetVersionExA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
WINPR_API DWORD GetTickCount(void);
|
||||
|
||||
typedef enum _COMPUTER_NAME_FORMAT
|
||||
@ -284,6 +286,8 @@ typedef enum _COMPUTER_NAME_FORMAT
|
||||
ComputerNameMax
|
||||
} COMPUTER_NAME_FORMAT;
|
||||
|
||||
#define MAX_COMPUTERNAME_LENGTH 31
|
||||
|
||||
WINPR_API BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD lpnSize);
|
||||
WINPR_API BOOL GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD lpnSize);
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/winsock.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <winhttp.h>
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <pchannel.h>
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
* DsUnquoteRdnValueW
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
DWORD DsCrackSpnW(LPCWSTR pszSpn, DWORD* pcServiceClass, LPWSTR ServiceClass, DWORD* pcServiceName,
|
||||
LPWSTR ServiceName, DWORD* pcInstanceName, LPWSTR InstanceName, USHORT* pInstancePort)
|
||||
@ -73,8 +73,8 @@ DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName,
|
||||
if ((*pcSpnLength != 0) && (pszSpn == NULL))
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
ServiceClassLength = strlen(ServiceClass);
|
||||
ServiceNameLength = strlen(ServiceName);
|
||||
ServiceClassLength = (DWORD) strlen(ServiceClass);
|
||||
ServiceNameLength = (DWORD) strlen(ServiceName);
|
||||
|
||||
SpnLength = ServiceClassLength + 1 + ServiceNameLength + 1;
|
||||
|
||||
|
@ -702,6 +702,20 @@ BOOL SetStdHandleEx(DWORD dwStdHandle, HANDLE hNewHandle, HANDLE* phOldHandle)
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _UWP
|
||||
|
||||
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
return FindFirstFileExA(lpFileName, FindExInfoStandard, lpFindFileData, FindExSearchNameMatch, NULL, 0);
|
||||
}
|
||||
|
||||
HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData)
|
||||
{
|
||||
return FindFirstFileExW(lpFileName, FindExInfoStandard, lpFindFileData, FindExSearchNameMatch, NULL, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Extended API */
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -169,3 +169,50 @@ BOOL CancelSynchronousIo(HANDLE hThread)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _UWP
|
||||
|
||||
BOOL GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait)
|
||||
{
|
||||
return GetOverlappedResultEx(hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait ? INFINITE : 0, TRUE);
|
||||
}
|
||||
|
||||
BOOL DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HANDLE CreateIoCompletionPort(HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL GetQueuedCompletionStatus(HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred,
|
||||
PULONG_PTR lpCompletionKey, LPOVERLAPPED* lpOverlapped, DWORD dwMilliseconds)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetQueuedCompletionStatusEx(HANDLE CompletionPort, LPOVERLAPPED_ENTRY lpCompletionPortEntries,
|
||||
ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds, BOOL fAlertable)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL PostQueuedCompletionStatus(HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CancelIo(HANDLE hFile)
|
||||
{
|
||||
return CancelIoEx(hFile, NULL);
|
||||
}
|
||||
|
||||
BOOL CancelSynchronousIo(HANDLE hThread)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -29,7 +29,7 @@
|
||||
* Functions: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724875/
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -224,7 +224,7 @@ LONG RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesire
|
||||
{
|
||||
if (_stricmp(pKey->subname, lpSubKey) == 0)
|
||||
{
|
||||
*phkResult = pKey;
|
||||
*phkResult = (HKEY) pKey;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ LONG RegQueryValueExA(HKEY hKey, LPCSTR lpValueName,
|
||||
int length;
|
||||
char* pData = (char*) lpData;
|
||||
|
||||
length = strlen(pValue->data.string);
|
||||
length = (int) strlen(pValue->data.string);
|
||||
|
||||
if (pData != NULL)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <winpr/rpc.h>
|
||||
#include <winpr/crypto.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("rpc")
|
||||
|
@ -81,7 +81,7 @@ int ntlm_SetContextServicePrincipalNameW(NTLM_CONTEXT* context, LPWSTR ServicePr
|
||||
return 1;
|
||||
}
|
||||
|
||||
context->ServicePrincipalName.Length = _wcslen(ServicePrincipalName) * 2;
|
||||
context->ServicePrincipalName.Length = (USHORT) (_wcslen(ServicePrincipalName) * 2);
|
||||
context->ServicePrincipalName.Buffer = (PWSTR) malloc(context->ServicePrincipalName.Length + 2);
|
||||
|
||||
if (!context->ServicePrincipalName.Buffer)
|
||||
|
@ -174,44 +174,6 @@ void GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo)
|
||||
GetSystemInfo(lpSystemInfo);
|
||||
}
|
||||
|
||||
/* OSVERSIONINFOEX Structure:
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/ms724833
|
||||
*/
|
||||
|
||||
BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation)
|
||||
{
|
||||
/* Windows 7 SP1 Version Info */
|
||||
if ((lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOA)) ||
|
||||
(lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA)))
|
||||
{
|
||||
lpVersionInformation->dwMajorVersion = 6;
|
||||
lpVersionInformation->dwMinorVersion = 1;
|
||||
lpVersionInformation->dwBuildNumber = 7601;
|
||||
lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
||||
ZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
|
||||
|
||||
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA))
|
||||
{
|
||||
LPOSVERSIONINFOEXA lpVersionInformationEx = (LPOSVERSIONINFOEXA) lpVersionInformation;
|
||||
lpVersionInformationEx->wServicePackMajor = 1;
|
||||
lpVersionInformationEx->wServicePackMinor = 0;
|
||||
lpVersionInformationEx->wSuiteMask = 0;
|
||||
lpVersionInformationEx->wProductType = VER_NT_WORKSTATION;
|
||||
lpVersionInformationEx->wReserved = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation)
|
||||
{
|
||||
WLog_ERR(TAG, "GetVersionExW unimplemented");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void GetSystemTime(LPSYSTEMTIME lpSystemTime)
|
||||
{
|
||||
time_t ct = 0;
|
||||
@ -314,6 +276,73 @@ DWORD GetTickCount(void)
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
/* OSVERSIONINFOEX Structure:
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/ms724833
|
||||
*/
|
||||
|
||||
BOOL GetVersionExA(LPOSVERSIONINFOA lpVersionInformation)
|
||||
{
|
||||
#ifdef _UWP
|
||||
/* Windows 10 Version Info */
|
||||
if ((lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOA)) ||
|
||||
(lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA)))
|
||||
{
|
||||
lpVersionInformation->dwMajorVersion = 10;
|
||||
lpVersionInformation->dwMinorVersion = 0;
|
||||
lpVersionInformation->dwBuildNumber = 0;
|
||||
lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
||||
ZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
|
||||
|
||||
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA))
|
||||
{
|
||||
LPOSVERSIONINFOEXA lpVersionInformationEx = (LPOSVERSIONINFOEXA)lpVersionInformation;
|
||||
lpVersionInformationEx->wServicePackMajor = 0;
|
||||
lpVersionInformationEx->wServicePackMinor = 0;
|
||||
lpVersionInformationEx->wSuiteMask = 0;
|
||||
lpVersionInformationEx->wProductType = VER_NT_WORKSTATION;
|
||||
lpVersionInformationEx->wReserved = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
/* Windows 7 SP1 Version Info */
|
||||
if ((lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOA)) ||
|
||||
(lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA)))
|
||||
{
|
||||
lpVersionInformation->dwMajorVersion = 6;
|
||||
lpVersionInformation->dwMinorVersion = 1;
|
||||
lpVersionInformation->dwBuildNumber = 7601;
|
||||
lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
||||
ZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
|
||||
|
||||
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA))
|
||||
{
|
||||
LPOSVERSIONINFOEXA lpVersionInformationEx = (LPOSVERSIONINFOEXA)lpVersionInformation;
|
||||
lpVersionInformationEx->wServicePackMajor = 1;
|
||||
lpVersionInformationEx->wServicePackMinor = 0;
|
||||
lpVersionInformationEx->wSuiteMask = 0;
|
||||
lpVersionInformationEx->wProductType = VER_NT_WORKSTATION;
|
||||
lpVersionInformationEx->wReserved = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation)
|
||||
{
|
||||
ZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
|
||||
return GetVersionExA((LPOSVERSIONINFOA) lpVersionInformation);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
BOOL GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
|
||||
{
|
||||
char* dot;
|
||||
|
@ -660,7 +660,7 @@ BOOL WINAPI Win32_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLAS
|
||||
else if (WtsVirtualClass == WTSVirtualFileHandle)
|
||||
{
|
||||
*pBytesReturned = sizeof(HANDLE);
|
||||
*ppBuffer = LocalAlloc(LMEM_ZEROINIT, *pBytesReturned);
|
||||
*ppBuffer = calloc(1, *pBytesReturned);
|
||||
|
||||
if (*ppBuffer == NULL)
|
||||
{
|
||||
@ -673,7 +673,7 @@ BOOL WINAPI Win32_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLAS
|
||||
else if (WtsVirtualClass == WTSVirtualEventHandle)
|
||||
{
|
||||
*pBytesReturned = sizeof(HANDLE);
|
||||
*ppBuffer = LocalAlloc(LMEM_ZEROINIT, *pBytesReturned);
|
||||
*ppBuffer = calloc(1, *pBytesReturned);
|
||||
|
||||
if (*ppBuffer == NULL)
|
||||
{
|
||||
@ -697,7 +697,7 @@ BOOL WINAPI Win32_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLAS
|
||||
|
||||
VOID WINAPI Win32_WTSFreeMemory(PVOID pMemory)
|
||||
{
|
||||
LocalFree(pMemory);
|
||||
free(pMemory);
|
||||
}
|
||||
|
||||
BOOL WINAPI Win32_WTSFreeMemoryExW(WTS_TYPE_CLASS WTSTypeClass, PVOID pMemory, ULONG NumberOfEntries)
|
||||
|
Loading…
Reference in New Issue
Block a user