mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #3260 from awakecoding/master
Universal Windows Platform (UWP) Port
This commit is contained in:
commit
171198bd7d
|
@ -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)
|
||||
|
||||
|
@ -335,6 +341,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*")
|
||||
|
@ -358,14 +365,17 @@ if(WIN32)
|
|||
endif()
|
||||
|
||||
if(CMAKE_WINDOWS_VERSION STREQUAL "WINXP")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0501 -DWIN32_WINNT=0x0501")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0501 -DWIN32_WINNT=0x0501")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0501 -D_WIN32_WINNT=0x0501")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0501 -D_WIN32_WINNT=0x0501")
|
||||
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN7")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0601 -DWIN32_WINNT=0x0601")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0601 -DWIN32_WINNT=0x0601")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0601 -D_WIN32_WINNT=0x0601")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0601 -D_WIN32_WINNT=0x0601")
|
||||
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN8")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0602 -DWIN32_WINNT=0x0602")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0602 -DWIN32_WINNT=0x0602")
|
||||
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)
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
#include <winpr/debug.h>
|
||||
#include <winpr/cmdline.h>
|
||||
|
||||
#define __COREFOUNDATION_CFPLUGINCOM__ 1
|
||||
#define IUNKNOWN_C_GUTS void *_reserved; void* QueryInterface; void* AddRef; void* Release
|
||||
|
||||
#include <CoreAudio/CoreAudioTypes.h>
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
#include "printer_main.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
#include "printer_win.h"
|
||||
#endif
|
||||
|
||||
|
@ -476,7 +476,7 @@ UINT DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
|||
driver = printer_cups_get_driver();
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
driver = printer_win_get_driver();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
#include <freerdp/types.h>
|
||||
#include <freerdp/codec/dsp.h>
|
||||
|
||||
#define __COREFOUNDATION_CFPLUGINCOM__ 1
|
||||
#define IUNKNOWN_C_GUTS void *_reserved; void* QueryInterface; void* AddRef; void* Release
|
||||
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
#include <AudioToolbox/AudioQueue.h>
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1275,6 +1275,7 @@ BOOL mac_end_paint(rdpContext* context)
|
|||
|
||||
BOOL mac_desktop_resize(rdpContext* context)
|
||||
{
|
||||
ResizeWindowEventArgs e;
|
||||
mfContext* mfc = (mfContext*) context;
|
||||
MRDPView* view = (MRDPView*) mfc->view;
|
||||
rdpSettings* settings = context->settings;
|
||||
|
@ -1296,8 +1297,21 @@ BOOL mac_desktop_resize(rdpContext* context)
|
|||
return FALSE;
|
||||
|
||||
view->bitmap_context = mac_create_bitmap_context(context);
|
||||
|
||||
if (!view->bitmap_context)
|
||||
return FALSE;
|
||||
|
||||
mfc->client_width = mfc->width;
|
||||
mfc->client_height = mfc->height;
|
||||
|
||||
[view setFrameSize:NSMakeSize(mfc->width, mfc->height)];
|
||||
|
||||
EventArgsInit(&e, "mfreerdp");
|
||||
e.width = settings->DesktopWidth;
|
||||
e.height = settings->DesktopHeight;
|
||||
|
||||
PubSub_OnResizeWindow(context->pubSub, context, &e);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,10 @@
|
|||
#import <freerdp/client/cmdline.h>
|
||||
|
||||
static AppDelegate* _singleDelegate = nil;
|
||||
void AppDelegate_EmbedWindowEventHandler(void* context, EmbedWindowEventArgs* e);
|
||||
void AppDelegate_ConnectionResultEventHandler(void* context, ConnectionResultEventArgs* e);
|
||||
void AppDelegate_ErrorInfoEventHandler(void* ctx, ErrorInfoEventArgs* e);
|
||||
void AppDelegate_EmbedWindowEventHandler(void* context, EmbedWindowEventArgs* e);
|
||||
void AppDelegate_ResizeWindowEventHandler(void* context, ResizeWindowEventArgs* e);
|
||||
void mac_set_view_size(rdpContext* context, MRDPView* view);
|
||||
|
||||
@implementation AppDelegate
|
||||
|
@ -65,6 +66,7 @@ void mac_set_view_size(rdpContext* context, MRDPView* view);
|
|||
PubSub_SubscribeConnectionResult(context->pubSub, AppDelegate_ConnectionResultEventHandler);
|
||||
PubSub_SubscribeErrorInfo(context->pubSub, AppDelegate_ErrorInfoEventHandler);
|
||||
PubSub_SubscribeEmbedWindow(context->pubSub, AppDelegate_EmbedWindowEventHandler);
|
||||
PubSub_SubscribeResizeWindow(context->pubSub, AppDelegate_ResizeWindowEventHandler);
|
||||
|
||||
freerdp_client_start(context);
|
||||
|
||||
|
@ -205,24 +207,6 @@ void mac_set_view_size(rdpContext* context, MRDPView* view);
|
|||
|
||||
@end
|
||||
|
||||
void AppDelegate_EmbedWindowEventHandler(void* ctx, EmbedWindowEventArgs* e)
|
||||
{
|
||||
rdpContext* context = (rdpContext*) ctx;
|
||||
|
||||
if (_singleDelegate)
|
||||
{
|
||||
mfContext* mfc = (mfContext*) context;
|
||||
_singleDelegate->mrdpView = mfc->view;
|
||||
|
||||
if (_singleDelegate->window)
|
||||
{
|
||||
[[_singleDelegate->window contentView] addSubview:mfc->view];
|
||||
}
|
||||
|
||||
mac_set_view_size(context, mfc->view);
|
||||
}
|
||||
}
|
||||
|
||||
/** *********************************************************************
|
||||
* On connection error, display message and quit application
|
||||
***********************************************************************/
|
||||
|
@ -266,6 +250,37 @@ void AppDelegate_ErrorInfoEventHandler(void* ctx, ErrorInfoEventArgs* e)
|
|||
}
|
||||
}
|
||||
|
||||
void AppDelegate_EmbedWindowEventHandler(void* ctx, EmbedWindowEventArgs* e)
|
||||
{
|
||||
rdpContext* context = (rdpContext*) ctx;
|
||||
|
||||
if (_singleDelegate)
|
||||
{
|
||||
mfContext* mfc = (mfContext*) context;
|
||||
_singleDelegate->mrdpView = mfc->view;
|
||||
|
||||
if (_singleDelegate->window)
|
||||
{
|
||||
[[_singleDelegate->window contentView] addSubview:mfc->view];
|
||||
}
|
||||
|
||||
mac_set_view_size(context, mfc->view);
|
||||
}
|
||||
}
|
||||
|
||||
void AppDelegate_ResizeWindowEventHandler(void* ctx, ResizeWindowEventArgs* e)
|
||||
{
|
||||
rdpContext* context = (rdpContext*) ctx;
|
||||
|
||||
fprintf(stderr, "ResizeWindowEventHandler: %d %d\n", e->width, e->height);
|
||||
|
||||
if (_singleDelegate)
|
||||
{
|
||||
mfContext* mfc = (mfContext*) context;
|
||||
mac_set_view_size(context, mfc->view);
|
||||
}
|
||||
}
|
||||
|
||||
void mac_set_view_size(rdpContext* context, MRDPView* view)
|
||||
{
|
||||
// set client area to specified dimensions
|
||||
|
|
|
@ -53,6 +53,10 @@
|
|||
#define DEBUG_CLIPRDR(fmt, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
typedef BOOL (WINAPI * fnAddClipboardFormatListener)(HWND hwnd);
|
||||
typedef BOOL (WINAPI * fnRemoveClipboardFormatListener)(HWND hwnd);
|
||||
typedef BOOL (WINAPI * fnGetUpdatedClipboardFormats)(PUINT lpuiFormats, UINT cFormats, PUINT pcFormatsOut);
|
||||
|
||||
struct format_mapping
|
||||
{
|
||||
UINT32 remote_format_id;
|
||||
|
@ -128,12 +132,16 @@ struct wf_clipboard
|
|||
size_t file_array_size;
|
||||
WCHAR** file_names;
|
||||
FILEDESCRIPTORW** fileDescriptor;
|
||||
|
||||
BOOL legacyApi;
|
||||
HMODULE hUser32;
|
||||
HWND hWndNextViewer;
|
||||
fnAddClipboardFormatListener AddClipboardFormatListener;
|
||||
fnRemoveClipboardFormatListener RemoveClipboardFormatListener;
|
||||
fnGetUpdatedClipboardFormats GetUpdatedClipboardFormats;
|
||||
};
|
||||
typedef struct wf_clipboard wfClipboard;
|
||||
|
||||
extern BOOL WINAPI AddClipboardFormatListener(_In_ HWND hwnd);
|
||||
extern BOOL WINAPI RemoveClipboardFormatListener(_In_ HWND hwnd);
|
||||
|
||||
#define WM_CLIPRDR_MESSAGE (WM_USER + 156)
|
||||
#define OLE_SETCLIPBOARD 1
|
||||
|
||||
|
@ -144,8 +152,8 @@ static UINT cliprdr_send_data_request(wfClipboard* clipboard, UINT32 format);
|
|||
static UINT cliprdr_send_lock(wfClipboard* clipboard);
|
||||
static UINT cliprdr_send_unlock(wfClipboard* clipboard);
|
||||
static UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, void* streamid,
|
||||
int index, int flag, DWORD positionhigh,
|
||||
DWORD positionlow, ULONG request);
|
||||
int index, int flag, DWORD positionhigh,
|
||||
DWORD positionlow, ULONG request);
|
||||
|
||||
static void CliprdrDataObject_Delete(CliprdrDataObject* instance);
|
||||
|
||||
|
@ -1179,6 +1187,39 @@ static UINT cliprdr_send_tempdir(wfClipboard* clipboard)
|
|||
return clipboard->context->TempDirectory(clipboard->context, &tempDirectory);
|
||||
}
|
||||
|
||||
BOOL cliprdr_GetUpdatedClipboardFormats(wfClipboard* clipboard, PUINT lpuiFormats, UINT cFormats, PUINT pcFormatsOut)
|
||||
{
|
||||
UINT index = 0;
|
||||
UINT format = 0;
|
||||
BOOL clipboardOpen = FALSE;
|
||||
|
||||
if (!clipboard->legacyApi)
|
||||
return clipboard->GetUpdatedClipboardFormats(lpuiFormats, cFormats, pcFormatsOut);
|
||||
|
||||
clipboardOpen = OpenClipboard(clipboard->hwnd);
|
||||
|
||||
if (!clipboardOpen)
|
||||
return FALSE;
|
||||
|
||||
while (index < cFormats)
|
||||
{
|
||||
format = EnumClipboardFormats(format);
|
||||
|
||||
if (!format)
|
||||
break;
|
||||
|
||||
lpuiFormats[index] = format;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
*pcFormatsOut = index;
|
||||
|
||||
CloseClipboard();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static UINT cliprdr_send_format_list(wfClipboard* clipboard)
|
||||
{
|
||||
UINT rc;
|
||||
|
@ -1300,9 +1341,7 @@ static UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void
|
|||
return rc;
|
||||
}
|
||||
|
||||
static UINT cliprdr_send_response_filecontents(wfClipboard* clipboard,
|
||||
UINT32 streamId, UINT32 size,
|
||||
BYTE* data)
|
||||
static UINT cliprdr_send_response_filecontents(wfClipboard* clipboard, UINT32 streamId, UINT32 size, BYTE* data)
|
||||
{
|
||||
CLIPRDR_FILE_CONTENTS_RESPONSE fileContentsResponse;
|
||||
|
||||
|
@ -1327,15 +1366,25 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
|||
case WM_CREATE:
|
||||
DEBUG_CLIPRDR("info: WM_CREATE");
|
||||
clipboard = (wfClipboard*)((CREATESTRUCT*) lParam)->lpCreateParams;
|
||||
if (!AddClipboardFormatListener(hWnd)) {
|
||||
DEBUG_CLIPRDR("error: AddClipboardFormatListener failed with %#x.", GetLastError());
|
||||
}
|
||||
|
||||
clipboard->hwnd = hWnd;
|
||||
|
||||
if (!clipboard->legacyApi)
|
||||
clipboard->AddClipboardFormatListener(hWnd);
|
||||
else
|
||||
clipboard->hWndNextViewer = SetClipboardViewer(hWnd);
|
||||
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
DEBUG_CLIPRDR("info: WM_CLOSE");
|
||||
RemoveClipboardFormatListener(hWnd);
|
||||
if (!clipboard->legacyApi)
|
||||
clipboard->RemoveClipboardFormatListener(hWnd);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (clipboard->legacyApi)
|
||||
ChangeClipboardChain(hWnd, clipboard->hWndNextViewer);
|
||||
break;
|
||||
|
||||
case WM_CLIPBOARDUPDATE:
|
||||
|
@ -1389,6 +1438,33 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
|||
/* Note: GlobalFree() is not needed when success */
|
||||
break;
|
||||
|
||||
|
||||
case WM_DRAWCLIPBOARD:
|
||||
if (clipboard->legacyApi)
|
||||
{
|
||||
if ((GetClipboardOwner() != clipboard->hwnd) &&
|
||||
(S_FALSE == OleIsCurrentClipboard(clipboard->data_obj)))
|
||||
{
|
||||
cliprdr_send_format_list(clipboard);
|
||||
}
|
||||
|
||||
SendMessage(clipboard->hWndNextViewer, Msg, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CHANGECBCHAIN:
|
||||
if (clipboard->legacyApi)
|
||||
{
|
||||
HWND hWndCurrViewer = (HWND) wParam;
|
||||
HWND hWndNextViewer = (HWND) lParam;
|
||||
|
||||
if (hWndCurrViewer == clipboard->hWndNextViewer)
|
||||
clipboard->hWndNextViewer = hWndNextViewer;
|
||||
else if (clipboard->hWndNextViewer)
|
||||
SendMessage(clipboard->hWndNextViewer, Msg, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLIPRDR_MESSAGE:
|
||||
DEBUG_CLIPRDR("info: WM_CLIPRDR_MESSAGE");
|
||||
switch (wParam)
|
||||
|
@ -1443,10 +1519,8 @@ static int create_cliprdr_window(wfClipboard* clipboard)
|
|||
|
||||
RegisterClassEx(&wnd_cls);
|
||||
|
||||
clipboard->hwnd = CreateWindowEx(WS_EX_LEFT,
|
||||
_T("ClipboardHiddenMessageProcessor"),
|
||||
_T("rdpclip"),
|
||||
0, 0, 0, 0, 0, HWND_MESSAGE, NULL, GetModuleHandle(NULL), clipboard);
|
||||
clipboard->hwnd = CreateWindowEx(WS_EX_LEFT, _T("ClipboardHiddenMessageProcessor"),
|
||||
_T("rdpclip"), 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, GetModuleHandle(NULL), clipboard);
|
||||
|
||||
if (!clipboard->hwnd)
|
||||
{
|
||||
|
@ -2391,6 +2465,18 @@ BOOL wf_cliprdr_init(wfContext* wfc, CliprdrClientContext* cliprdr)
|
|||
clipboard->map_capacity = 32;
|
||||
clipboard->map_size = 0;
|
||||
|
||||
clipboard->hUser32 = LoadLibraryA("user32.dll");
|
||||
|
||||
if (clipboard->hUser32)
|
||||
{
|
||||
clipboard->AddClipboardFormatListener = (fnAddClipboardFormatListener) GetProcAddress(clipboard->hUser32, "AddClipboardFormatListener");
|
||||
clipboard->RemoveClipboardFormatListener = (fnRemoveClipboardFormatListener) GetProcAddress(clipboard->hUser32, "RemoveClipboardFormatListener");
|
||||
clipboard->GetUpdatedClipboardFormats = (fnGetUpdatedClipboardFormats) GetProcAddress(clipboard->hUser32, "GetUpdatedClipboardFormats");
|
||||
}
|
||||
|
||||
if (!(clipboard->hUser32 && clipboard->AddClipboardFormatListener && clipboard->RemoveClipboardFormatListener && clipboard->GetUpdatedClipboardFormats))
|
||||
clipboard->legacyApi = TRUE;
|
||||
|
||||
if (!(clipboard->format_mappings = (formatMapping*) calloc(1, sizeof(formatMapping) * clipboard->map_capacity)))
|
||||
goto error;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -286,8 +286,8 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
|||
UINT32 vBarHeight;
|
||||
UINT32 vBarPixelCount;
|
||||
UINT32 vBarShortPixelCount;
|
||||
CLEAR_VBAR_ENTRY* vBarEntry;
|
||||
CLEAR_VBAR_ENTRY* vBarShortEntry;
|
||||
CLEAR_VBAR_ENTRY* vBarEntry = NULL;
|
||||
CLEAR_VBAR_ENTRY* vBarShortEntry = NULL;
|
||||
|
||||
if ((bandsByteCount - suboffset) < 11)
|
||||
return -1021;
|
||||
|
|
|
@ -1469,6 +1469,9 @@ int freerdp_image_copy_from_pointer_data(BYTE* pDstData, UINT32 DstFormat,
|
|||
int dstBitsPerPixel;
|
||||
int dstBytesPerPixel;
|
||||
|
||||
xorBits = xorMask;
|
||||
andBits = andMask;
|
||||
|
||||
dstBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(DstFormat);
|
||||
dstBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(DstFormat) / 8);
|
||||
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/library.h>
|
||||
#include <winpr/bitstream.h>
|
||||
|
||||
#include <freerdp/primitives.h>
|
||||
|
|
|
@ -938,7 +938,7 @@ INT16 progressive_rfx_srl_read(RFX_PROGRESSIVE_UPGRADE_STATE* state, UINT32 numB
|
|||
mag++;
|
||||
}
|
||||
|
||||
return sign ? -mag : mag;
|
||||
return sign ? -1 * mag : mag;
|
||||
}
|
||||
|
||||
int progressive_rfx_upgrade_state_finish(RFX_PROGRESSIVE_UPGRADE_STATE* state)
|
||||
|
|
|
@ -126,6 +126,7 @@ BOOL freerdp_connect(freerdp* instance)
|
|||
if (!freerdp_get_last_error(rdp->context))
|
||||
freerdp_set_last_error(instance->context, FREERDP_ERROR_POST_CONNECT_FAILED);
|
||||
|
||||
status = FALSE;
|
||||
goto freerdp_connect_finally;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ static int certificate_data_match_legacy(rdpCertificateStore* certificate_store,
|
|||
char* data;
|
||||
char* mdata;
|
||||
char* pline;
|
||||
char* hostname;
|
||||
char* hostname = NULL;
|
||||
DWORD lowSize, highSize;
|
||||
UINT64 size;
|
||||
size_t length;
|
||||
|
@ -129,8 +129,10 @@ static int certificate_data_match_legacy(rdpCertificateStore* certificate_store,
|
|||
|
||||
/* Assure POSIX style paths, CreateFile expects either '/' or '\\' */
|
||||
PathCchConvertStyleA(certificate_store->legacy_file, strlen(certificate_store->legacy_file), PATH_STYLE_UNIX);
|
||||
|
||||
fp = CreateFileA(certificate_store->legacy_file, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (fp == INVALID_HANDLE_VALUE)
|
||||
return match;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ void rdtk_nine_patch_free(rdtkNinePatch* ninePatch)
|
|||
int rdtk_nine_patch_engine_init(rdtkEngine* engine)
|
||||
{
|
||||
int status;
|
||||
wImage* image;
|
||||
wImage* image = NULL;
|
||||
rdtkNinePatch* ninePatch;
|
||||
|
||||
if (!engine->button9patch)
|
||||
|
|
|
@ -156,7 +156,7 @@ add_subdirectory(include)
|
|||
|
||||
add_subdirectory(libwinpr)
|
||||
|
||||
if(NOT ANDROID AND NOT IOS)
|
||||
if(NOT ANDROID AND NOT IOS AND NOT UWP)
|
||||
add_subdirectory(tools)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -138,13 +138,13 @@ extern "C" {
|
|||
#define BitStream_GetRemainingLength(_bs) \
|
||||
(_bs->length - _bs->position)
|
||||
|
||||
WINPR_API void BitDump(const char* tag, int level, const BYTE* buffer, UINT32 length, UINT32 flags);
|
||||
WINPR_API UINT32 ReverseBits32(UINT32 bits, UINT32 nbits);
|
||||
WINPR_API void BitDump(const char* tag, UINT32 level, const BYTE* buffer, UINT32 length, UINT32 flags);
|
||||
WINPR_API UINT32 ReverseBits32(UINT32 bits, UINT32 nbits);
|
||||
|
||||
WINPR_API void BitStream_Attach(wBitStream* bs, const BYTE* buffer, UINT32 capacity);
|
||||
WINPR_API void BitStream_Attach(wBitStream* bs, const BYTE* buffer, UINT32 capacity);
|
||||
|
||||
WINPR_API wBitStream* BitStream_New();
|
||||
WINPR_API void BitStream_Free(wBitStream* bs);
|
||||
WINPR_API wBitStream* BitStream_New();
|
||||
WINPR_API void BitStream_Free(wBitStream* bs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -46,6 +46,32 @@ WINPR_API LPWSTR GetCommandLineW(VOID);
|
|||
WINPR_API BOOL NeedCurrentDirectoryForExePathA(LPCSTR ExeName);
|
||||
WINPR_API BOOL NeedCurrentDirectoryForExePathW(LPCWSTR ExeName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define GetCurrentDirectory GetCurrentDirectoryW
|
||||
#define SetCurrentDirectory SetCurrentDirectoryW
|
||||
#define SearchPath SearchPathW
|
||||
#define GetCommandLine GetCommandLineW
|
||||
#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW
|
||||
#else
|
||||
#define GetCurrentDirectory GetCurrentDirectoryA
|
||||
#define SetCurrentDirectory SetCurrentDirectoryA
|
||||
#define SearchPath SearchPathA
|
||||
#define GetCommandLine GetCommandLineA
|
||||
#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
|
||||
WINPR_API DWORD GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize);
|
||||
|
||||
|
@ -74,11 +100,6 @@ WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
|
|||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define GetCurrentDirectory GetCurrentDirectoryW
|
||||
#define SetCurrentDirectory SetCurrentDirectoryW
|
||||
#define SearchPath SearchPathW
|
||||
#define GetCommandLine GetCommandLineW
|
||||
#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW
|
||||
#define GetEnvironmentVariable GetEnvironmentVariableW
|
||||
#define SetEnvironmentVariable SetEnvironmentVariableW
|
||||
#define GetEnvironmentStrings GetEnvironmentStringsW
|
||||
|
@ -86,11 +107,6 @@ WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
|
|||
#define ExpandEnvironmentStrings ExpandEnvironmentStringsW
|
||||
#define FreeEnvironmentStrings FreeEnvironmentStringsW
|
||||
#else
|
||||
#define GetCurrentDirectory GetCurrentDirectoryA
|
||||
#define SetCurrentDirectory SetCurrentDirectoryA
|
||||
#define SearchPath SearchPathA
|
||||
#define GetCommandLine GetCommandLineA
|
||||
#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA
|
||||
#define GetEnvironmentVariable GetEnvironmentVariableA
|
||||
#define SetEnvironmentVariable SetEnvironmentVariableA
|
||||
#define GetEnvironmentStringsA GetEnvironmentStrings
|
||||
|
|
|
@ -350,6 +350,62 @@ typedef struct _HANDLE_CREATOR
|
|||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _UWP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
||||
|
||||
WINPR_API HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
||||
|
||||
WINPR_API DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
|
||||
|
||||
WINPR_API DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove,
|
||||
PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
|
||||
|
||||
WINPR_API HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
WINPR_API HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
|
||||
|
||||
WINPR_API DWORD GetFullPathNameA(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart);
|
||||
|
||||
WINPR_API BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
|
||||
LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);
|
||||
|
||||
WINPR_API BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
|
||||
LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);
|
||||
|
||||
WINPR_API DWORD GetLogicalDriveStringsA(DWORD nBufferLength, LPSTR lpBuffer);
|
||||
|
||||
WINPR_API DWORD GetLogicalDriveStringsW(DWORD nBufferLength, LPWSTR lpBuffer);
|
||||
|
||||
WINPR_API BOOL PathIsDirectoryEmptyA(LPCSTR pszPath);
|
||||
|
||||
WINPR_API UINT GetACP(void);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define CreateFile CreateFileW
|
||||
#define FindFirstFile FindFirstFileW
|
||||
#else
|
||||
#define CreateFile CreateFileA
|
||||
#define FindFirstFile FindFirstFileA
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
|
|
@ -45,6 +45,7 @@ struct _wIniFile
|
|||
char* line;
|
||||
char* nextLine;
|
||||
int lineLength;
|
||||
char* tokctx;
|
||||
char* buffer;
|
||||
char* filename;
|
||||
BOOL readOnly;
|
||||
|
|
|
@ -158,7 +158,7 @@ WINPR_API PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination, P
|
|||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#if (!defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0502)))
|
||||
#if (!defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0502) && !defined(InterlockedCompareExchange64)))
|
||||
#define WINPR_INTERLOCKED_COMPARE_EXCHANGE64 1
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <winpr/winpr.h>
|
||||
#include <winpr/wtypes.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
typedef HANDLE DLL_DIRECTORY_COOKIE;
|
||||
|
||||
|
@ -46,24 +46,32 @@ WINPR_API HMODULE LoadLibraryW(LPCWSTR lpLibFileName);
|
|||
WINPR_API HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
|
||||
WINPR_API HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define LoadLibrary LoadLibraryW
|
||||
#define LoadLibraryEx LoadLibraryExW
|
||||
#else
|
||||
#define LoadLibrary LoadLibraryA
|
||||
#define LoadLibraryEx LoadLibraryExA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API HMODULE GetModuleHandleA(LPCSTR lpModuleName);
|
||||
WINPR_API HMODULE GetModuleHandleW(LPCWSTR lpModuleName);
|
||||
|
||||
WINPR_API DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
|
||||
WINPR_API DWORD GetModuleFileNameW(HMODULE hModule, LPWSTR lpFilename, DWORD nSize);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define LoadLibrary LoadLibraryW
|
||||
#define LoadLibraryEx LoadLibraryExW
|
||||
#define GetModuleHandle GetModuleHandleW
|
||||
#define GetModuleFileName GetModuleFileNameW
|
||||
#else
|
||||
#define LoadLibrary LoadLibraryA
|
||||
#define LoadLibraryEx LoadLibraryExA
|
||||
#define GetModuleHandle GetModuleHandleA
|
||||
#define GetModuleFileName GetModuleFileNameA
|
||||
#endif
|
||||
|
||||
WINPR_API FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
|
||||
|
||||
WINPR_API BOOL FreeLibrary(HMODULE hLibModule);
|
||||
|
@ -72,6 +80,14 @@ WINPR_API BOOL FreeLibrary(HMODULE hLibModule);
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define GetModuleHandle GetModuleHandleW
|
||||
#define GetModuleFileName GetModuleFileNameW
|
||||
#else
|
||||
#define GetModuleHandle GetModuleHandleA
|
||||
#define GetModuleFileName GetModuleFileNameA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* WINPR_LIBRARY_H */
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
/* Defined in wincred.h, do not redefine */
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
|
||||
#include <wincred.h>
|
||||
|
||||
|
@ -122,21 +122,6 @@
|
|||
#define FACILITY_ACPI_ERROR_CODE 0x14
|
||||
#define FACILITY_SXS_ERROR_CODE 0x15
|
||||
|
||||
//#define DBG_EXCEPTION_HANDLED ((NTSTATUS)0x00010001)
|
||||
//#define DBG_CONTINUE ((NTSTATUS)0x00010002)
|
||||
#define DBG_REPLY_LATER ((NTSTATUS)0x40010001)
|
||||
#define DBG_UNABLE_TO_PROVIDE_HANDLE ((NTSTATUS)0x40010002)
|
||||
//#define DBG_TERMINATE_THREAD ((NTSTATUS)0x40010003)
|
||||
//#define DBG_TERMINATE_PROCESS ((NTSTATUS)0x40010004)
|
||||
//#define DBG_CONTROL_C ((NTSTATUS)0x40010005)
|
||||
//#define DBG_PRINTEXCEPTION_C ((NTSTATUS)0x40010006)
|
||||
//#define DBG_RIPEXCEPTION ((NTSTATUS)0x40010007)
|
||||
//#define DBG_CONTROL_BREAK ((NTSTATUS)0x40010008)
|
||||
//#define DBG_COMMAND_EXCEPTION ((NTSTATUS)0x40010009)
|
||||
//#define DBG_EXCEPTION_NOT_HANDLED ((NTSTATUS)0x80010001)
|
||||
#define DBG_NO_STATE_CHANGE ((NTSTATUS)0xC0010001)
|
||||
#define DBG_APP_NOT_IDLE ((NTSTATUS)0xC0010002)
|
||||
|
||||
/**
|
||||
* NTSTATUS codes
|
||||
*/
|
||||
|
@ -1345,7 +1330,7 @@ typedef enum _FILE_INFORMATION_CLASS
|
|||
FileShortNameInformation
|
||||
} FILE_INFORMATION_CLASS;
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#define FILE_SUPERSEDE 0x00000000
|
||||
#define FILE_OPEN 0x00000001
|
||||
|
@ -1444,7 +1429,11 @@ typedef struct _IO_STATUS_BLOCK
|
|||
{
|
||||
union
|
||||
{
|
||||
#ifdef _WIN32
|
||||
NTSTATUS Status;
|
||||
#else
|
||||
NTSTATUS status;
|
||||
#endif
|
||||
PVOID Pointer;
|
||||
};
|
||||
ULONG_PTR Information;
|
||||
|
@ -1452,6 +1441,10 @@ typedef struct _IO_STATUS_BLOCK
|
|||
|
||||
typedef VOID (*PIO_APC_ROUTINE)(PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved);
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32)
|
||||
|
||||
typedef struct _PEB PEB;
|
||||
typedef struct _PEB* PPEB;
|
||||
|
||||
|
|
|
@ -287,23 +287,25 @@ WINPR_API char* GetCombinedPath(const char* basePath, const char* subPath);
|
|||
|
||||
WINPR_API BOOL PathMakePathA(LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes);
|
||||
|
||||
#ifndef WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
WINPR_API BOOL PathFileExistsA(LPCSTR pszPath);
|
||||
WINPR_API BOOL PathFileExistsW(LPCWSTR pszPath);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define PathFileExists PathFileExistsW
|
||||
#else
|
||||
#define PathFileExists PathFileExistsA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <Shlwapi.h>
|
||||
#else
|
||||
#ifdef UNICODE
|
||||
#define PathFileExists PathFileExistsW
|
||||
#else
|
||||
#define PathFileExists PathFileExistsA
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* WINPR_PATH_H */
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API void winpr_HexDump(const char* tag, int lvl, const BYTE* data, int length);
|
||||
WINPR_API void winpr_CArrayDump(const char* tag, int lvl, const BYTE* data, int length, int width);
|
||||
WINPR_API void winpr_HexDump(const char* tag, UINT32 lvl, const BYTE* data, int length);
|
||||
WINPR_API void winpr_CArrayDump(const char* tag, UINT32 lvl, const BYTE* data, int length, int width);
|
||||
|
||||
WINPR_API char* winpr_BinToHexString(const BYTE* data, int length, BOOL space);
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -62,6 +62,16 @@ WINPR_API WCHAR* _wcschr(const WCHAR* str, WCHAR c);
|
|||
WINPR_API char* strtok_s(char* strToken, const char* strDelimit, char** context);
|
||||
WINPR_API WCHAR* wcstok_s(WCHAR* strToken, const WCHAR* strDelimit, WCHAR** context);
|
||||
|
||||
#else
|
||||
|
||||
#define _wcscmp wcscmp
|
||||
#define _wcslen wcslen
|
||||
#define _wcschr wcschr
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
WINPR_API LPSTR CharUpperA(LPSTR lpsz);
|
||||
WINPR_API LPWSTR CharUpperW(LPWSTR lpsz);
|
||||
|
||||
|
@ -152,6 +162,10 @@ WINPR_API int lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2);
|
|||
#define lstrcmp lstrcmpA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#define sprintf_s snprintf
|
||||
#define _snprintf snprintf
|
||||
#define _scprintf(_fmt, ...) snprintf(NULL, 0, _fmt, ## __VA_ARGS__)
|
||||
|
@ -166,12 +180,6 @@ WINPR_API int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiBy
|
|||
WINPR_API int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar,
|
||||
LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
|
||||
|
||||
#else
|
||||
|
||||
#define _wcscmp wcscmp
|
||||
#define _wcslen wcslen
|
||||
#define _wcschr wcschr
|
||||
|
||||
#endif
|
||||
|
||||
/* Extended API */
|
||||
|
|
|
@ -276,28 +276,49 @@ WINPR_API BOOL DeleteTimerQueueTimer(HANDLE TimerQueue, HANDLE Timer, HANDLE Com
|
|||
|
||||
#endif
|
||||
|
||||
#if (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
|
||||
#if (defined(_WIN32) && defined(_SYNCHAPI_H_) && (_WIN32_WINNT < 0x0600))
|
||||
#define WINPR_INITIALIZE_CRITICAL_SECTION_EX 1
|
||||
#elif (defined(_WIN32) && (_WIN32_WINNT < 0x0403))
|
||||
#define WINPR_INITIALIZE_CRITICAL_SECTION_EX 1
|
||||
#endif
|
||||
|
||||
#ifdef WINPR_INITIALIZE_CRITICAL_SECTION_EX
|
||||
|
||||
WINPR_API BOOL InitializeCriticalSectionEx(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _RTL_RUN_ONCE_DEF
|
||||
#define _RTL_RUN_ONCE_DEF
|
||||
|
||||
#define RTL_RUN_ONCE_INIT { 0 }
|
||||
|
||||
#define RTL_RUN_ONCE_CHECK_ONLY 0x00000001
|
||||
#define RTL_RUN_ONCE_ASYNC 0x00000002
|
||||
#define RTL_RUN_ONCE_INIT_FAILED 0x00000004
|
||||
|
||||
#define RTL_RUN_ONCE_CTX_RESERVED_BITS 2
|
||||
|
||||
typedef struct _RTL_RUN_ONCE
|
||||
{
|
||||
PVOID Ptr;
|
||||
} RTL_RUN_ONCE, *PRTL_RUN_ONCE;
|
||||
|
||||
typedef ULONG CALLBACK RTL_RUN_ONCE_INIT_FN (PRTL_RUN_ONCE RunOnce, PVOID Parameter, PVOID* Context);
|
||||
typedef RTL_RUN_ONCE_INIT_FN *PRTL_RUN_ONCE_INIT_FN;
|
||||
|
||||
#endif
|
||||
|
||||
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
|
||||
|
||||
/* One-Time Initialization */
|
||||
|
||||
typedef struct _RTL_RUN_ONCE
|
||||
{
|
||||
PVOID Ptr;
|
||||
} RTL_RUN_ONCE, *PRTL_RUN_ONCE;
|
||||
|
||||
#define RTL_RUN_ONCE_INIT { 0 }
|
||||
#define INIT_ONCE_STATIC_INIT RTL_RUN_ONCE_INIT
|
||||
|
||||
typedef RTL_RUN_ONCE INIT_ONCE;
|
||||
typedef PRTL_RUN_ONCE PINIT_ONCE;
|
||||
typedef PRTL_RUN_ONCE LPINIT_ONCE;
|
||||
typedef BOOL CALLBACK (*PINIT_ONCE_FN) (PINIT_ONCE InitOnce, PVOID Parameter, PVOID* Context);
|
||||
typedef BOOL (CALLBACK * PINIT_ONCE_FN)(PINIT_ONCE InitOnce, PVOID Parameter, PVOID* Context);
|
||||
|
||||
WINPR_API BOOL InitOnceBeginInitialize(LPINIT_ONCE lpInitOnce, DWORD dwFlags, PBOOL fPending, LPVOID* lpContext);
|
||||
WINPR_API BOOL InitOnceComplete(LPINIT_ONCE lpInitOnce, DWORD dwFlags, LPVOID lpContext);
|
||||
|
@ -308,7 +329,11 @@ WINPR_API VOID InitOnceInitialize(PINIT_ONCE InitOnce);
|
|||
|
||||
/* Synchronization Barrier */
|
||||
|
||||
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602))
|
||||
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602) && !defined(_SYNCHAPI_H_))
|
||||
#define WINPR_SYNCHRONIZATION_BARRIER 1
|
||||
#endif
|
||||
|
||||
#ifdef WINPR_SYNCHRONIZATION_BARRIER
|
||||
|
||||
typedef struct _RTL_BARRIER
|
||||
{
|
||||
|
@ -332,6 +357,7 @@ WINPR_API BOOL WINAPI EnterSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBa
|
|||
WINPR_API BOOL WINAPI DeleteSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarrier);
|
||||
|
||||
#endif
|
||||
|
||||
/* Extended API */
|
||||
|
||||
WINPR_API VOID USleep(DWORD dwMicroseconds);
|
||||
|
|
|
@ -94,33 +94,9 @@ 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);
|
||||
|
||||
typedef enum _COMPUTER_NAME_FORMAT
|
||||
{
|
||||
ComputerNameNetBIOS,
|
||||
ComputerNameDnsHostname,
|
||||
ComputerNameDnsDomain,
|
||||
ComputerNameDnsFullyQualified,
|
||||
ComputerNamePhysicalNetBIOS,
|
||||
ComputerNamePhysicalDnsHostname,
|
||||
ComputerNamePhysicalDnsDomain,
|
||||
ComputerNamePhysicalDnsFullyQualified,
|
||||
ComputerNameMax
|
||||
} COMPUTER_NAME_FORMAT;
|
||||
|
||||
WINPR_API BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD lpnSize);
|
||||
WINPR_API BOOL GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD lpnSize);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define GetComputerNameEx GetComputerNameExW
|
||||
#else
|
||||
#define GetComputerNameEx GetComputerNameExA
|
||||
#endif
|
||||
|
||||
typedef struct _OSVERSIONINFOA
|
||||
{
|
||||
DWORD dwOSVersionInfoSize;
|
||||
|
@ -207,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);
|
||||
|
@ -224,8 +191,6 @@ WINPR_API BOOL SetLocalTime(CONST SYSTEMTIME* lpSystemTime);
|
|||
WINPR_API VOID GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);
|
||||
WINPR_API BOOL GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled);
|
||||
|
||||
WINPR_API DWORD GetTickCount(void);
|
||||
|
||||
WINPR_API BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature);
|
||||
|
||||
#define PF_FLOATING_POINT_PRECISION_ERRATA 0
|
||||
|
@ -291,6 +256,49 @@ WINPR_API BOOL IsProcessorFeaturePresent(DWORD ProcessorFeature);
|
|||
|
||||
#endif
|
||||
|
||||
#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
|
||||
{
|
||||
ComputerNameNetBIOS,
|
||||
ComputerNameDnsHostname,
|
||||
ComputerNameDnsDomain,
|
||||
ComputerNameDnsFullyQualified,
|
||||
ComputerNamePhysicalNetBIOS,
|
||||
ComputerNamePhysicalDnsHostname,
|
||||
ComputerNamePhysicalDnsDomain,
|
||||
ComputerNamePhysicalDnsFullyQualified,
|
||||
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);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define GetComputerNameEx GetComputerNameExW
|
||||
#else
|
||||
#define GetComputerNameEx GetComputerNameExA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
|
||||
|
||||
WINPR_API ULONGLONG GetTickCount64(void);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/platform.h>
|
||||
|
||||
/**
|
||||
* Standard Clipboard Formats
|
||||
|
@ -103,7 +104,7 @@
|
|||
* Bitmap Definitions
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
|
@ -166,15 +167,6 @@ typedef RGBQUAD FAR* LPRGBQUAD;
|
|||
#define PROFILE_LINKED 'LINK'
|
||||
#define PROFILE_EMBEDDED 'MBED'
|
||||
|
||||
typedef struct tagBITMAPCOREHEADER
|
||||
{
|
||||
DWORD bcSize;
|
||||
WORD bcWidth;
|
||||
WORD bcHeight;
|
||||
WORD bcPlanes;
|
||||
WORD bcBitCount;
|
||||
} BITMAPCOREHEADER, FAR *LPBITMAPCOREHEADER, *PBITMAPCOREHEADER;
|
||||
|
||||
typedef struct tagBITMAPINFOHEADER
|
||||
{
|
||||
DWORD biSize;
|
||||
|
@ -190,6 +182,39 @@ typedef struct tagBITMAPINFOHEADER
|
|||
DWORD biClrImportant;
|
||||
} BITMAPINFOHEADER, FAR *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER;
|
||||
|
||||
typedef struct tagBITMAPINFO
|
||||
{
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[1];
|
||||
} BITMAPINFO, FAR *LPBITMAPINFO, *PBITMAPINFO;
|
||||
|
||||
typedef enum _ORIENTATION_PREFERENCE
|
||||
{
|
||||
ORIENTATION_PREFERENCE_NONE = 0x0,
|
||||
ORIENTATION_PREFERENCE_LANDSCAPE = 0x1,
|
||||
|
||||
ORIENTATION_PREFERENCE_PORTRAIT = 0x2,
|
||||
ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED = 0x4,
|
||||
ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED = 0x8
|
||||
} ORIENTATION_PREFERENCE;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct tagBITMAPCOREHEADER
|
||||
{
|
||||
DWORD bcSize;
|
||||
WORD bcWidth;
|
||||
WORD bcHeight;
|
||||
WORD bcPlanes;
|
||||
WORD bcBitCount;
|
||||
} BITMAPCOREHEADER, FAR *LPBITMAPCOREHEADER, *PBITMAPCOREHEADER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD bV4Size;
|
||||
|
@ -242,12 +267,6 @@ typedef struct
|
|||
DWORD bV5Reserved;
|
||||
} BITMAPV5HEADER, FAR *LPBITMAPV5HEADER, *PBITMAPV5HEADER;
|
||||
|
||||
typedef struct tagBITMAPINFO
|
||||
{
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[1];
|
||||
} BITMAPINFO, FAR *LPBITMAPINFO, *PBITMAPINFO;
|
||||
|
||||
typedef struct tagBITMAPCOREINFO
|
||||
{
|
||||
BITMAPCOREHEADER bmciHeader;
|
||||
|
@ -263,16 +282,6 @@ typedef struct tagBITMAPFILEHEADER
|
|||
DWORD bfOffBits;
|
||||
} BITMAPFILEHEADER, FAR *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
|
||||
|
||||
typedef enum _ORIENTATION_PREFERENCE
|
||||
{
|
||||
ORIENTATION_PREFERENCE_NONE = 0x0,
|
||||
ORIENTATION_PREFERENCE_LANDSCAPE = 0x1,
|
||||
|
||||
ORIENTATION_PREFERENCE_PORTRAIT = 0x2,
|
||||
ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED = 0x4,
|
||||
ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED = 0x8
|
||||
} ORIENTATION_PREFERENCE;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -17,4 +17,3 @@
|
|||
|
||||
winpr_module_add(bcrypt.c)
|
||||
|
||||
winpr_include_directory_add(${OPENSSL_INCLUDE_DIR})
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#endif
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/user.h>
|
||||
|
||||
#include "clipboard.h"
|
||||
|
||||
|
|
|
@ -29,13 +29,11 @@
|
|||
|
||||
/* String Manipulation (CRT): http://msdn.microsoft.com/en-us/library/f0151s4x.aspx */
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include "casing.c"
|
||||
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("crt")
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
char* _strdup(const char* strSource)
|
||||
{
|
||||
char* strDestination;
|
||||
|
@ -154,10 +152,16 @@ WCHAR* wcstok_s(WCHAR* strToken, const WCHAR* strDelimit, WCHAR** context)
|
|||
return nextToken;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
/* Windows API Sets - api-ms-win-core-string-l2-1-0.dll
|
||||
* http://msdn.microsoft.com/en-us/library/hh802935/
|
||||
*/
|
||||
|
||||
#include "casing.c"
|
||||
|
||||
LPSTR CharUpperA(LPSTR lpsz)
|
||||
{
|
||||
int i;
|
||||
|
@ -166,7 +170,7 @@ LPSTR CharUpperA(LPSTR lpsz)
|
|||
if (!lpsz)
|
||||
return NULL;
|
||||
|
||||
length = strlen(lpsz);
|
||||
length = (int) strlen(lpsz);
|
||||
|
||||
if (length < 1)
|
||||
return (LPSTR) NULL;
|
||||
|
@ -199,7 +203,7 @@ LPWSTR CharUpperW(LPWSTR lpsz)
|
|||
|
||||
DWORD CharUpperBuffA(LPSTR lpsz, DWORD cchLength)
|
||||
{
|
||||
int i;
|
||||
DWORD i;
|
||||
|
||||
if (cchLength < 1)
|
||||
return 0;
|
||||
|
@ -233,7 +237,7 @@ LPSTR CharLowerA(LPSTR lpsz)
|
|||
if (!lpsz)
|
||||
return (LPSTR) NULL;
|
||||
|
||||
length = strlen(lpsz);
|
||||
length = (int) strlen(lpsz);
|
||||
|
||||
if (length < 1)
|
||||
return (LPSTR) NULL;
|
||||
|
@ -266,7 +270,7 @@ LPWSTR CharLowerW(LPWSTR lpsz)
|
|||
|
||||
DWORD CharLowerBuffA(LPSTR lpsz, DWORD cchLength)
|
||||
{
|
||||
int i;
|
||||
DWORD i;
|
||||
|
||||
if (cchLength < 1)
|
||||
return 0;
|
||||
|
@ -351,7 +355,7 @@ BOOL IsCharLowerW(WCHAR ch)
|
|||
|
||||
int lstrlenA(LPCSTR lpString)
|
||||
{
|
||||
return strlen(lpString);
|
||||
return (int) strlen(lpString);
|
||||
}
|
||||
|
||||
int lstrlenW(LPCWSTR lpString)
|
||||
|
@ -366,7 +370,7 @@ int lstrlenW(LPCWSTR lpString)
|
|||
while (*p)
|
||||
p++;
|
||||
|
||||
return p - lpString;
|
||||
return (int) (p - lpString);
|
||||
}
|
||||
|
||||
int lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
|
||||
|
@ -410,7 +414,7 @@ int ConvertLineEndingToLF(char* str, int size)
|
|||
}
|
||||
}
|
||||
|
||||
status = pOutput - str;
|
||||
status = (int) (pOutput - str);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -459,7 +463,7 @@ char* ConvertLineEndingToCRLF(const char* str, int* size)
|
|||
pInput++;
|
||||
}
|
||||
|
||||
*size = pOutput - newStr;
|
||||
*size = (int) (pOutput - newStr);
|
||||
|
||||
return newStr;
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ int ConvertToUnicode(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
|
|||
return 0;
|
||||
|
||||
if (cbMultiByte == -1)
|
||||
cbMultiByte = strlen(lpMultiByteStr) + 1;
|
||||
cbMultiByte = (int) (strlen(lpMultiByteStr) + 1);
|
||||
|
||||
if (cchWideChar == 0)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ int ConvertFromUnicode(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int
|
|||
return 0;
|
||||
|
||||
if (cchWideChar == -1)
|
||||
cchWideChar = _wcslen(lpWideCharStr) + 1;
|
||||
cchWideChar = (int) (_wcslen(lpWideCharStr) + 1);
|
||||
|
||||
if (cbMultiByte == 0)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,16 @@ winpr_module_add(
|
|||
crypto.c
|
||||
crypto.h)
|
||||
|
||||
if(OPENSSL_FOUND)
|
||||
winpr_include_directory_add(${OPENSSL_INCLUDE_DIR})
|
||||
winpr_library_add(${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(MBEDTLS_FOUND)
|
||||
winpr_include_directory_add(${MBEDTLS_INCLUDE_DIR})
|
||||
winpr_library_add(${MBEDTLS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
winpr_library_add(crypt32)
|
||||
endif()
|
||||
|
|
|
@ -58,7 +58,7 @@ WINPR_RC4_CTX* winpr_RC4_New(const BYTE* key, size_t keylen)
|
|||
RC4_set_key((RC4_KEY*) ctx, keylen, key);
|
||||
#elif defined(WITH_MBEDTLS) && defined(MBEDTLS_ARC4_C)
|
||||
mbedtls_arc4_init((mbedtls_arc4_context*) ctx);
|
||||
mbedtls_arc4_setup((mbedtls_arc4_context*) ctx, key, keylen);
|
||||
mbedtls_arc4_setup((mbedtls_arc4_context*) ctx, key, (unsigned int) keylen);
|
||||
#endif
|
||||
return ctx;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -131,8 +131,13 @@ BOOL NeedCurrentDirectoryForExePathW(LPCWSTR ExeName)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize)
|
||||
{
|
||||
#if !defined(_UWP)
|
||||
int length;
|
||||
char* env = NULL;
|
||||
|
||||
|
@ -152,15 +157,21 @@ DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize)
|
|||
CopyMemory(lpBuffer, env, length + 1);
|
||||
|
||||
return length;
|
||||
#else
|
||||
SetLastError(ERROR_ENVVAR_NOT_FOUND);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
DWORD GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize)
|
||||
{
|
||||
SetLastError(ERROR_ENVVAR_NOT_FOUND);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue)
|
||||
{
|
||||
#if !defined(_UWP)
|
||||
if (!lpName)
|
||||
return FALSE;
|
||||
|
||||
|
@ -176,11 +187,14 @@ BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue)
|
|||
}
|
||||
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue)
|
||||
{
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,8 +215,9 @@ BOOL SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue)
|
|||
|
||||
extern char** environ;
|
||||
|
||||
LPCH GetEnvironmentStrings(VOID)
|
||||
LPCH GetEnvironmentStringsA(VOID)
|
||||
{
|
||||
#if !defined(_UWP)
|
||||
char* p;
|
||||
int offset;
|
||||
int length;
|
||||
|
@ -220,9 +235,9 @@ LPCH GetEnvironmentStrings(VOID)
|
|||
|
||||
while (*envp)
|
||||
{
|
||||
length = strlen(*envp);
|
||||
length = (int) strlen(*envp);
|
||||
|
||||
while ((offset + length + 8) > cchEnvironmentBlock)
|
||||
while ((offset + length + 8) > (int) cchEnvironmentBlock)
|
||||
{
|
||||
DWORD new_size;
|
||||
LPCH new_blk;
|
||||
|
@ -251,6 +266,9 @@ LPCH GetEnvironmentStrings(VOID)
|
|||
lpszEnvironmentBlock[offset] = '\0';
|
||||
|
||||
return lpszEnvironmentBlock;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
LPWCH GetEnvironmentStringsW(VOID)
|
||||
|
@ -320,7 +338,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
|
||||
while (*cp && *(cp + 1))
|
||||
{
|
||||
length = strlen(cp);
|
||||
length = (int) strlen(cp);
|
||||
|
||||
if (mergeStringLength == mergeArraySize)
|
||||
{
|
||||
|
@ -331,7 +349,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
|
||||
if (!new_str)
|
||||
{
|
||||
free(mergeStrings);
|
||||
free((void*) mergeStrings);
|
||||
return NULL;
|
||||
}
|
||||
mergeStrings = new_str;
|
||||
|
@ -349,7 +367,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
|
||||
if (!lpszEnvironmentBlock)
|
||||
{
|
||||
free (mergeStrings);
|
||||
free((void*) mergeStrings);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -358,9 +376,9 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
while ((original != NULL) && (*envp && *(envp+1)))
|
||||
{
|
||||
ULONG old_offset = offset;
|
||||
length = strlen(envp);
|
||||
length = (int) strlen(envp);
|
||||
|
||||
while ((offset + length + 8) > cchEnvironmentBlock)
|
||||
while ((offset + length + 8) > (int) cchEnvironmentBlock)
|
||||
{
|
||||
LPCH tmp;
|
||||
cchEnvironmentBlock *= 2;
|
||||
|
@ -368,8 +386,8 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
|
||||
if (!tmp)
|
||||
{
|
||||
free (lpszEnvironmentBlock);
|
||||
free (mergeStrings);
|
||||
free((void*) lpszEnvironmentBlock);
|
||||
free((void*) mergeStrings);
|
||||
return NULL;
|
||||
}
|
||||
lpszEnvironmentBlock = tmp;
|
||||
|
@ -384,7 +402,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
if (!mergeStrings[run])
|
||||
continue;
|
||||
|
||||
mergeLength = strlen(mergeStrings[run]);
|
||||
mergeLength = (int) strlen(mergeStrings[run]);
|
||||
foundEquals = strstr(mergeStrings[run], "=");
|
||||
|
||||
if (!foundEquals)
|
||||
|
@ -400,7 +418,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
}
|
||||
else
|
||||
{
|
||||
while ((offset + mergeLength + 8) > cchEnvironmentBlock)
|
||||
while ((offset + mergeLength + 8) > (int) cchEnvironmentBlock)
|
||||
{
|
||||
LPCH tmp;
|
||||
cchEnvironmentBlock *= 2;
|
||||
|
@ -408,8 +426,8 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
|
||||
if (!tmp)
|
||||
{
|
||||
free(lpszEnvironmentBlock);
|
||||
free (mergeStrings);
|
||||
free((void*) lpszEnvironmentBlock);
|
||||
free((void*) mergeStrings);
|
||||
return NULL;
|
||||
}
|
||||
lpszEnvironmentBlock = tmp;
|
||||
|
@ -441,9 +459,9 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
if (!mergeStrings[run])
|
||||
continue;
|
||||
|
||||
mergeLength = strlen(mergeStrings[run]);
|
||||
mergeLength = (int) strlen(mergeStrings[run]);
|
||||
|
||||
while ((offset + mergeLength + 8) > cchEnvironmentBlock)
|
||||
while ((offset + mergeLength + 8) > (int) cchEnvironmentBlock)
|
||||
{
|
||||
LPCH tmp;
|
||||
cchEnvironmentBlock *= 2;
|
||||
|
@ -451,8 +469,8 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||
|
||||
if (!tmp)
|
||||
{
|
||||
free(lpszEnvironmentBlock);
|
||||
free (mergeStrings);
|
||||
free((void*) lpszEnvironmentBlock);
|
||||
free((void*) mergeStrings);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -485,14 +503,14 @@ DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer,
|
|||
if (!lpName || NULL == envBlock)
|
||||
return 0;
|
||||
|
||||
lpNameLength = strlen(lpName);
|
||||
lpNameLength = (int) strlen(lpName);
|
||||
|
||||
if (lpNameLength < 1)
|
||||
return 0;
|
||||
|
||||
while (*penvb && *(penvb + 1))
|
||||
{
|
||||
fLength = strlen(penvb);
|
||||
fLength = (int) strlen(penvb);
|
||||
foundEquals = strstr(penvb,"=");
|
||||
|
||||
if (!foundEquals)
|
||||
|
@ -501,7 +519,7 @@ DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer,
|
|||
return 0;
|
||||
}
|
||||
|
||||
nLength = foundEquals - penvb;
|
||||
nLength = (int) (foundEquals - penvb);
|
||||
|
||||
if (nLength != lpNameLength)
|
||||
{
|
||||
|
@ -521,9 +539,9 @@ DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer,
|
|||
if (!env)
|
||||
return 0;
|
||||
|
||||
vLength = strlen(env);
|
||||
vLength = (int) strlen(env);
|
||||
|
||||
if ((vLength + 1 > nSize) || (!lpBuffer))
|
||||
if ((vLength + 1 > (int) nSize) || (!lpBuffer))
|
||||
return vLength + 1;
|
||||
|
||||
CopyMemory(lpBuffer, env, vLength + 1);
|
||||
|
@ -542,7 +560,7 @@ BOOL SetEnvironmentVariableEBA(LPSTR* envBlock, LPCSTR lpName, LPCSTR lpValue)
|
|||
|
||||
if (lpValue)
|
||||
{
|
||||
length = strlen(lpName) + strlen(lpValue) + 2; /* +2 because of = and \0 */
|
||||
length = (int) (strlen(lpName) + strlen(lpValue) + 2); /* +2 because of = and \0 */
|
||||
envstr = (char*) malloc(length + 1); /* +1 because of closing \0 */
|
||||
|
||||
if (!envstr)
|
||||
|
@ -552,7 +570,7 @@ BOOL SetEnvironmentVariableEBA(LPSTR* envBlock, LPCSTR lpName, LPCSTR lpValue)
|
|||
}
|
||||
else
|
||||
{
|
||||
length = strlen(lpName) + 2; /* +2 because of = and \0 */
|
||||
length = (int) strlen(lpName) + 2; /* +2 because of = and \0 */
|
||||
envstr = (char*) malloc(length + 1); /* +1 because of closing \0 */
|
||||
|
||||
if (!envstr)
|
||||
|
@ -589,7 +607,7 @@ char** EnvironmentBlockToEnvpA(LPCH lpszEnvironmentBlock)
|
|||
|
||||
while (p[0] && p[1])
|
||||
{
|
||||
length = strlen(p);
|
||||
length = (int) strlen(p);
|
||||
p += (length + 1);
|
||||
count++;
|
||||
}
|
||||
|
@ -604,7 +622,7 @@ char** EnvironmentBlockToEnvpA(LPCH lpszEnvironmentBlock)
|
|||
|
||||
while (p[0] && p[1])
|
||||
{
|
||||
length = strlen(p);
|
||||
length = (int) strlen(p);
|
||||
envp[index] = _strdup(p);
|
||||
if (!envp[index])
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/file.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -702,8 +703,239 @@ BOOL SetStdHandleEx(DWORD dwStdHandle, HANDLE hNewHandle, HANDLE* phOldHandle)
|
|||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _UWP
|
||||
|
||||
HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
||||
{
|
||||
HANDLE hFile;
|
||||
CREATEFILE2_EXTENDED_PARAMETERS params;
|
||||
|
||||
ZeroMemory(¶ms, sizeof(CREATEFILE2_EXTENDED_PARAMETERS));
|
||||
|
||||
params.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
|
||||
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_BACKUP_SEMANTICS) params.dwFileFlags |= FILE_FLAG_BACKUP_SEMANTICS;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_DELETE_ON_CLOSE) params.dwFileFlags |= FILE_FLAG_DELETE_ON_CLOSE;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_NO_BUFFERING) params.dwFileFlags |= FILE_FLAG_NO_BUFFERING;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_OPEN_NO_RECALL) params.dwFileFlags |= FILE_FLAG_OPEN_NO_RECALL;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_OPEN_REPARSE_POINT) params.dwFileFlags |= FILE_FLAG_OPEN_REPARSE_POINT;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_OPEN_REQUIRING_OPLOCK) params.dwFileFlags |= FILE_FLAG_OPEN_REQUIRING_OPLOCK;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED) params.dwFileFlags |= FILE_FLAG_OVERLAPPED;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_POSIX_SEMANTICS) params.dwFileFlags |= FILE_FLAG_POSIX_SEMANTICS;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_RANDOM_ACCESS) params.dwFileFlags |= FILE_FLAG_RANDOM_ACCESS;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_SESSION_AWARE) params.dwFileFlags |= FILE_FLAG_SESSION_AWARE;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_SEQUENTIAL_SCAN) params.dwFileFlags |= FILE_FLAG_SEQUENTIAL_SCAN;
|
||||
if (dwFlagsAndAttributes & FILE_FLAG_WRITE_THROUGH) params.dwFileFlags |= FILE_FLAG_WRITE_THROUGH;
|
||||
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_ARCHIVE) params.dwFileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_COMPRESSED) params.dwFileAttributes |= FILE_ATTRIBUTE_COMPRESSED;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_DEVICE) params.dwFileAttributes |= FILE_ATTRIBUTE_DEVICE;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_DIRECTORY) params.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_ENCRYPTED) params.dwFileAttributes |= FILE_ATTRIBUTE_ENCRYPTED;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_HIDDEN) params.dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_INTEGRITY_STREAM) params.dwFileAttributes |= FILE_ATTRIBUTE_INTEGRITY_STREAM;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_NORMAL) params.dwFileAttributes |= FILE_ATTRIBUTE_NORMAL;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) params.dwFileAttributes |= FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_NO_SCRUB_DATA) params.dwFileAttributes |= FILE_ATTRIBUTE_NO_SCRUB_DATA;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_OFFLINE) params.dwFileAttributes |= FILE_ATTRIBUTE_OFFLINE;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_READONLY) params.dwFileAttributes |= FILE_ATTRIBUTE_READONLY;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_REPARSE_POINT) params.dwFileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_SPARSE_FILE) params.dwFileAttributes |= FILE_ATTRIBUTE_SPARSE_FILE;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_SYSTEM) params.dwFileAttributes |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_TEMPORARY) params.dwFileAttributes |= FILE_ATTRIBUTE_TEMPORARY;
|
||||
if (dwFlagsAndAttributes & FILE_ATTRIBUTE_VIRTUAL) params.dwFileAttributes |= FILE_ATTRIBUTE_VIRTUAL;
|
||||
|
||||
if (dwFlagsAndAttributes & SECURITY_ANONYMOUS) params.dwSecurityQosFlags |= SECURITY_ANONYMOUS;
|
||||
if (dwFlagsAndAttributes & SECURITY_CONTEXT_TRACKING) params.dwSecurityQosFlags |= SECURITY_CONTEXT_TRACKING;
|
||||
if (dwFlagsAndAttributes & SECURITY_DELEGATION) params.dwSecurityQosFlags |= SECURITY_DELEGATION;
|
||||
if (dwFlagsAndAttributes & SECURITY_EFFECTIVE_ONLY) params.dwSecurityQosFlags |= SECURITY_EFFECTIVE_ONLY;
|
||||
if (dwFlagsAndAttributes & SECURITY_IDENTIFICATION) params.dwSecurityQosFlags |= SECURITY_IDENTIFICATION;
|
||||
if (dwFlagsAndAttributes & SECURITY_IMPERSONATION) params.dwSecurityQosFlags |= SECURITY_IMPERSONATION;
|
||||
|
||||
params.lpSecurityAttributes = lpSecurityAttributes;
|
||||
params.hTemplateFile = hTemplateFile;
|
||||
|
||||
hFile = CreateFile2(lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, ¶ms);
|
||||
|
||||
return hFile;
|
||||
}
|
||||
|
||||
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
||||
{
|
||||
HANDLE hFile;
|
||||
WCHAR* lpFileNameW = NULL;
|
||||
|
||||
ConvertToUnicode(CP_UTF8, 0, lpFileName, -1, &lpFileNameW, 0);
|
||||
|
||||
if (!lpFileNameW)
|
||||
return NULL;
|
||||
|
||||
hFile = CreateFileW(lpFileNameW, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
|
||||
dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
|
||||
|
||||
free(lpFileNameW);
|
||||
|
||||
return hFile;
|
||||
}
|
||||
|
||||
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
|
||||
{
|
||||
BOOL status;
|
||||
LARGE_INTEGER fileSize = { 0, 0 };
|
||||
|
||||
if (!lpFileSizeHigh)
|
||||
return INVALID_FILE_SIZE;
|
||||
|
||||
status = GetFileSizeEx(hFile, &fileSize);
|
||||
|
||||
if (!status)
|
||||
return INVALID_FILE_SIZE;
|
||||
|
||||
*lpFileSizeHigh = fileSize.HighPart;
|
||||
|
||||
return fileSize.LowPart;
|
||||
}
|
||||
|
||||
DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove,
|
||||
PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
|
||||
{
|
||||
BOOL status;
|
||||
LARGE_INTEGER liDistanceToMove = { 0, 0 };
|
||||
LARGE_INTEGER liNewFilePointer = { 0, 0 };
|
||||
|
||||
liDistanceToMove.LowPart = lDistanceToMove;
|
||||
|
||||
status = SetFilePointerEx(hFile, liDistanceToMove, &liNewFilePointer, dwMoveMethod);
|
||||
|
||||
if (!status)
|
||||
return INVALID_SET_FILE_POINTER;
|
||||
|
||||
if (lpDistanceToMoveHigh)
|
||||
*lpDistanceToMoveHigh = liNewFilePointer.HighPart;
|
||||
|
||||
return liNewFilePointer.LowPart;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
DWORD GetFullPathNameA(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart)
|
||||
{
|
||||
DWORD dwStatus;
|
||||
WCHAR* lpFileNameW = NULL;
|
||||
WCHAR* lpBufferW = NULL;
|
||||
WCHAR* lpFilePartW = NULL;
|
||||
DWORD nBufferLengthW = nBufferLength * 2;
|
||||
|
||||
if (!lpFileName || (nBufferLength < 1))
|
||||
return 0;
|
||||
|
||||
ConvertToUnicode(CP_UTF8, 0, lpFileName, -1, &lpFileNameW, 0);
|
||||
|
||||
if (!lpFileNameW)
|
||||
return 0;
|
||||
|
||||
lpBufferW = (WCHAR*) malloc(nBufferLengthW);
|
||||
|
||||
if (!lpBufferW)
|
||||
return 0;
|
||||
|
||||
dwStatus = GetFullPathNameW(lpFileNameW, nBufferLengthW, lpBufferW, &lpFilePartW);
|
||||
|
||||
ConvertFromUnicode(CP_UTF8, 0, lpBufferW, nBufferLengthW, &lpBuffer, nBufferLength, NULL, NULL);
|
||||
|
||||
if (lpFilePart)
|
||||
lpFilePart = lpBuffer + (lpFilePartW - lpBufferW);
|
||||
|
||||
free(lpFileNameW);
|
||||
free(lpBufferW);
|
||||
|
||||
return dwStatus * 2;
|
||||
}
|
||||
|
||||
BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
|
||||
LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
|
||||
{
|
||||
BOOL status;
|
||||
ULARGE_INTEGER FreeBytesAvailableToCaller = { 0, 0 };
|
||||
ULARGE_INTEGER TotalNumberOfBytes = { 0, 0 };
|
||||
ULARGE_INTEGER TotalNumberOfFreeBytes = { 0, 0 };
|
||||
|
||||
status = GetDiskFreeSpaceExA(lpRootPathName, &FreeBytesAvailableToCaller,
|
||||
&TotalNumberOfBytes, &TotalNumberOfFreeBytes);
|
||||
|
||||
if (!status)
|
||||
return FALSE;
|
||||
|
||||
*lpBytesPerSector = 1;
|
||||
*lpSectorsPerCluster = TotalNumberOfBytes.LowPart;
|
||||
*lpNumberOfFreeClusters = FreeBytesAvailableToCaller.LowPart;
|
||||
*lpTotalNumberOfClusters = TotalNumberOfFreeBytes.LowPart;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
|
||||
LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
|
||||
{
|
||||
BOOL status;
|
||||
ULARGE_INTEGER FreeBytesAvailableToCaller = { 0, 0 };
|
||||
ULARGE_INTEGER TotalNumberOfBytes = { 0, 0 };
|
||||
ULARGE_INTEGER TotalNumberOfFreeBytes = { 0, 0 };
|
||||
|
||||
status = GetDiskFreeSpaceExW(lpRootPathName, &FreeBytesAvailableToCaller,
|
||||
&TotalNumberOfBytes, &TotalNumberOfFreeBytes);
|
||||
|
||||
if (!status)
|
||||
return FALSE;
|
||||
|
||||
*lpBytesPerSector = 1;
|
||||
*lpSectorsPerCluster = TotalNumberOfBytes.LowPart;
|
||||
*lpNumberOfFreeClusters = FreeBytesAvailableToCaller.LowPart;
|
||||
*lpTotalNumberOfClusters = TotalNumberOfFreeBytes.LowPart;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD GetLogicalDriveStringsA(DWORD nBufferLength, LPSTR lpBuffer)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FUNCTION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD GetLogicalDriveStringsW(DWORD nBufferLength, LPWSTR lpBuffer)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FUNCTION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL PathIsDirectoryEmptyA(LPCSTR pszPath)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
UINT GetACP(void)
|
||||
{
|
||||
return CP_UTF8;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Extended API */
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
HANDLE GetFileHandleForFileDescriptor(int fd)
|
||||
{
|
||||
#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
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
* SizeofResource
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
@ -77,6 +79,8 @@
|
|||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
DLL_DIRECTORY_COOKIE AddDllDirectory(PCWSTR NewDirectory)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -94,7 +98,27 @@ BOOL SetDefaultDllDirectories(DWORD DirectoryFlags)
|
|||
|
||||
HMODULE LoadLibraryA(LPCSTR lpLibFileName)
|
||||
{
|
||||
#if defined(_UWP)
|
||||
int status;
|
||||
HMODULE hModule = NULL;
|
||||
WCHAR* filenameW = NULL;
|
||||
|
||||
if (!lpLibFileName)
|
||||
return NULL;
|
||||
|
||||
status = ConvertToUnicode(CP_UTF8, 0, lpLibFileName, -1, &filenameW, 0);
|
||||
|
||||
if (status < 1)
|
||||
return NULL;
|
||||
|
||||
hModule = LoadPackagedLibrary(filenameW, 0);
|
||||
|
||||
free(filenameW);
|
||||
|
||||
return hModule;
|
||||
#else
|
||||
HMODULE library;
|
||||
|
||||
library = dlopen(lpLibFileName, RTLD_LOCAL | RTLD_LAZY);
|
||||
|
||||
if (!library)
|
||||
|
@ -104,16 +128,23 @@ HMODULE LoadLibraryA(LPCSTR lpLibFileName)
|
|||
}
|
||||
|
||||
return library;
|
||||
#endif
|
||||
}
|
||||
|
||||
HMODULE LoadLibraryW(LPCWSTR lpLibFileName)
|
||||
{
|
||||
#if defined(_UWP)
|
||||
return LoadPackagedLibrary(lpLibFileName, 0);
|
||||
#else
|
||||
return (HMODULE) NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
|
||||
{
|
||||
#if !defined(_UWP)
|
||||
HMODULE library;
|
||||
|
||||
library = dlopen(lpLibFileName, RTLD_LOCAL | RTLD_LAZY);
|
||||
|
||||
if (!library)
|
||||
|
@ -123,6 +154,9 @@ HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
|
|||
}
|
||||
|
||||
return library;
|
||||
#else
|
||||
return (HMODULE)NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
|
||||
|
@ -130,6 +164,10 @@ HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
|
|||
return (HMODULE) NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
|
||||
{
|
||||
FARPROC proc;
|
||||
|
|
|
@ -42,7 +42,7 @@ VOID _InitializeObjectAttributes(POBJECT_ATTRIBUTES InitializedAttributes,
|
|||
PUNICODE_STRING ObjectName, ULONG Attributes, HANDLE RootDirectory,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(_UWP)
|
||||
InitializeObjectAttributes(InitializedAttributes, ObjectName,
|
||||
Attributes, RootDirectory, SecurityDescriptor);
|
||||
#else
|
||||
|
|
|
@ -142,13 +142,12 @@ static char* GetPath_XDG_CONFIG_HOME(void)
|
|||
{
|
||||
char* path = NULL;
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(_UWP)
|
||||
path = calloc(MAX_PATH, sizeof(char));
|
||||
if (!path)
|
||||
return NULL;
|
||||
|
||||
if (FAILED(SHGetFolderPathA(0, CSIDL_APPDATA, NULL,
|
||||
SHGFP_TYPE_CURRENT, path)))
|
||||
if (FAILED(SHGetFolderPathA(0, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path)))
|
||||
{
|
||||
free(path);
|
||||
return NULL;
|
||||
|
@ -240,13 +239,13 @@ static char* GetPath_XDG_CACHE_HOME(void)
|
|||
char* GetPath_XDG_RUNTIME_DIR(void)
|
||||
{
|
||||
char* path = NULL;
|
||||
#if defined(WIN32)
|
||||
|
||||
#if defined(WIN32) && !defined(_UWP)
|
||||
path = calloc(MAX_PATH, sizeof(char));
|
||||
if (!path)
|
||||
return NULL;
|
||||
|
||||
if (FAILED(SHGetFolderPathA(0, CSIDL_LOCAL_APPDATA, NULL,
|
||||
SHGFP_TYPE_CURRENT, path)))
|
||||
if (FAILED(SHGetFolderPathA(0, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path)))
|
||||
{
|
||||
free(path);
|
||||
return NULL;
|
||||
|
@ -389,9 +388,9 @@ char* GetCombinedPath(const char* basePath, const char* subPath)
|
|||
int subPathLength = 0;
|
||||
|
||||
if (basePath)
|
||||
basePathLength = strlen(basePath);
|
||||
basePathLength = (int) strlen(basePath);
|
||||
if (subPath)
|
||||
subPathLength = strlen(subPath);
|
||||
subPathLength = (int) strlen(subPath);
|
||||
|
||||
length = basePathLength + subPathLength + 1;
|
||||
path = (char*) malloc(length + 1);
|
||||
|
@ -481,7 +480,8 @@ BOOL PathMakePathA(LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes)
|
|||
return PathFileExistsA(path);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#if !defined(_WIN32) || defined(_UWP)
|
||||
|
||||
BOOL PathFileExistsA(LPCSTR pszPath)
|
||||
{
|
||||
struct stat stat_info;
|
||||
|
@ -496,4 +496,11 @@ BOOL PathFileExistsW(LPCWSTR pszPath)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma comment(lib, "shlwapi.lib")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/pool.h>
|
||||
#include <winpr/library.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/pool.h>
|
||||
#include <winpr/library.h>
|
||||
|
||||
#include "pool.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/pool.h>
|
||||
#include <winpr/library.h>
|
||||
|
||||
#include "pool.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/pool.h>
|
||||
#include <winpr/library.h>
|
||||
|
||||
#include "pool.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/pool.h>
|
||||
#include <winpr/library.h>
|
||||
|
||||
#include "pool.h"
|
||||
|
||||
|
@ -205,9 +206,9 @@ PTP_POOL CreateThreadpool(PVOID reserved)
|
|||
free(pool);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return pool;
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID CloseThreadpool(PTP_POOL ptpp)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/pool.h>
|
||||
#include <winpr/library.h>
|
||||
|
||||
#include "pool.h"
|
||||
#include "../log.h"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602))
|
||||
#ifdef WINPR_SYNCHRONIZATION_BARRIER
|
||||
|
||||
#include <winpr/library.h>
|
||||
#include <winpr/interlocked.h>
|
||||
|
|
|
@ -248,7 +248,7 @@ VOID DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
|||
|
||||
#endif
|
||||
|
||||
#if (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
|
||||
#ifdef WINPR_INITIALIZE_CRITICAL_SECTION_EX
|
||||
|
||||
typedef BOOL (WINAPI* PINITIALIZE_CRITICAL_SECTION_EX_FN)(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("sysinfo")
|
||||
|
||||
/**
|
||||
* api-ms-win-core-sysinfo-l1-1-1.dll:
|
||||
*
|
||||
|
@ -69,9 +72,6 @@ defined(__OpenBSD__) || defined(__DragonFly__)
|
|||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("sysinfo")
|
||||
|
||||
static DWORD GetProcessorArchitecture()
|
||||
{
|
||||
DWORD cpuArch = PROCESSOR_ARCHITECTURE_UNKNOWN;
|
||||
|
@ -174,121 +174,6 @@ void GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo)
|
|||
GetSystemInfo(lpSystemInfo);
|
||||
}
|
||||
|
||||
BOOL GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
|
||||
{
|
||||
char* dot;
|
||||
int length;
|
||||
char hostname[256];
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1)
|
||||
return FALSE;
|
||||
length = strlen(hostname);
|
||||
dot = strchr(hostname, '.');
|
||||
|
||||
if (dot)
|
||||
length = dot - hostname;
|
||||
|
||||
if (*lpnSize <= length)
|
||||
{
|
||||
SetLastError(ERROR_BUFFER_OVERFLOW);
|
||||
*lpnSize = length + 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpBuffer)
|
||||
return FALSE;
|
||||
|
||||
CopyMemory(lpBuffer, hostname, length);
|
||||
lpBuffer[length] = '\0';
|
||||
*lpnSize = length;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD lpnSize)
|
||||
{
|
||||
int length;
|
||||
char hostname[256];
|
||||
|
||||
if ((NameType == ComputerNameNetBIOS) || (NameType == ComputerNamePhysicalNetBIOS))
|
||||
return GetComputerNameA(lpBuffer, lpnSize);
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1)
|
||||
return FALSE;
|
||||
length = strlen(hostname);
|
||||
|
||||
switch (NameType)
|
||||
{
|
||||
case ComputerNameDnsHostname:
|
||||
case ComputerNameDnsDomain:
|
||||
case ComputerNameDnsFullyQualified:
|
||||
case ComputerNamePhysicalDnsHostname:
|
||||
case ComputerNamePhysicalDnsDomain:
|
||||
case ComputerNamePhysicalDnsFullyQualified:
|
||||
if (*lpnSize <= length)
|
||||
{
|
||||
*lpnSize = length + 1;
|
||||
SetLastError(ERROR_MORE_DATA);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpBuffer)
|
||||
return FALSE;
|
||||
|
||||
CopyMemory(lpBuffer, hostname, length);
|
||||
lpBuffer[length] = '\0';
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
|
||||
{
|
||||
WLog_ERR(TAG, "GetComputerNameExW unimplemented");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
@ -389,6 +274,166 @@ DWORD GetTickCount(void)
|
|||
}
|
||||
#endif // _WIN32
|
||||
|
||||
#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;
|
||||
int length;
|
||||
char hostname[256];
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1)
|
||||
return FALSE;
|
||||
|
||||
length = (int) strlen(hostname);
|
||||
dot = strchr(hostname, '.');
|
||||
|
||||
if (dot)
|
||||
length = (int) (dot - hostname);
|
||||
|
||||
if (*lpnSize <= (DWORD) length)
|
||||
{
|
||||
SetLastError(ERROR_BUFFER_OVERFLOW);
|
||||
*lpnSize = length + 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpBuffer)
|
||||
return FALSE;
|
||||
|
||||
CopyMemory(lpBuffer, hostname, length);
|
||||
lpBuffer[length] = '\0';
|
||||
*lpnSize = length;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD lpnSize)
|
||||
{
|
||||
int length;
|
||||
char hostname[256];
|
||||
|
||||
if ((NameType == ComputerNameNetBIOS) || (NameType == ComputerNamePhysicalNetBIOS))
|
||||
return GetComputerNameA(lpBuffer, lpnSize);
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1)
|
||||
return FALSE;
|
||||
|
||||
length = (int) strlen(hostname);
|
||||
|
||||
switch (NameType)
|
||||
{
|
||||
case ComputerNameDnsHostname:
|
||||
case ComputerNameDnsDomain:
|
||||
case ComputerNameDnsFullyQualified:
|
||||
case ComputerNamePhysicalDnsHostname:
|
||||
case ComputerNamePhysicalDnsDomain:
|
||||
case ComputerNamePhysicalDnsFullyQualified:
|
||||
if (*lpnSize <= (DWORD) length)
|
||||
{
|
||||
*lpnSize = length + 1;
|
||||
SetLastError(ERROR_MORE_DATA);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!lpBuffer)
|
||||
return FALSE;
|
||||
|
||||
CopyMemory(lpBuffer, hostname, length);
|
||||
lpBuffer[length] = '\0';
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
|
||||
{
|
||||
WLog_ERR(TAG, "GetComputerNameExW unimplemented");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_UWP)
|
||||
|
||||
DWORD GetTickCount(void)
|
||||
{
|
||||
return (DWORD) GetTickCount64();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
|
||||
|
||||
ULONGLONG GetTickCount64(void)
|
||||
|
|
|
@ -113,7 +113,7 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
|
|||
pArgs = NULL;
|
||||
numArgs = 0;
|
||||
lpEscapedCmdLine = NULL;
|
||||
cmdLineLength = strlen(lpCmdLine);
|
||||
cmdLineLength = (int) strlen(lpCmdLine);
|
||||
lpEscapedChars = (BOOL*) calloc(1, (cmdLineLength + 1) * sizeof(BOOL));
|
||||
if (!lpEscapedChars)
|
||||
return NULL;
|
||||
|
@ -138,7 +138,7 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
|
|||
|
||||
if (!pBeg)
|
||||
{
|
||||
length = strlen(p);
|
||||
length = (int) strlen(p);
|
||||
CopyMemory(pOutput, p, length);
|
||||
pOutput += length;
|
||||
p += length;
|
||||
|
@ -158,8 +158,8 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
|
|||
pBeg--;
|
||||
}
|
||||
|
||||
n = (pEnd - pBeg) - 1;
|
||||
length = (pBeg - pLastEnd);
|
||||
n = (int) ((pEnd - pBeg) - 1);
|
||||
length = (int) (pBeg - pLastEnd);
|
||||
CopyMemory(pOutput, p, length);
|
||||
pOutput += length;
|
||||
p += length;
|
||||
|
@ -178,7 +178,7 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
|
|||
|
||||
*pOutput++ = '\0';
|
||||
lpCmdLine = (LPCSTR) lpEscapedCmdLine;
|
||||
cmdLineLength = strlen(lpCmdLine);
|
||||
cmdLineLength = (int) strlen(lpCmdLine);
|
||||
}
|
||||
|
||||
maxNumArgs = 2;
|
||||
|
@ -217,7 +217,7 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
|
|||
if (*p != '"')
|
||||
{
|
||||
/* no whitespace escaped with double quotes */
|
||||
length = p - pBeg;
|
||||
length = (int) (p - pBeg);
|
||||
CopyMemory(pOutput, pBeg, length);
|
||||
pOutput[length] = '\0';
|
||||
pArgs[numArgs++] = pOutput;
|
||||
|
|
|
@ -115,7 +115,7 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
|
|||
sigil_index = 0;
|
||||
sigil_length = 0;
|
||||
sigil = (char*) &argv[i][sigil_index];
|
||||
length = strlen(argv[i]);
|
||||
length = (int) strlen(argv[i]);
|
||||
|
||||
if ((sigil[0] == '/') && (flags & COMMAND_LINE_SIGIL_SLASH))
|
||||
{
|
||||
|
@ -198,9 +198,9 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
|
|||
if (separator)
|
||||
{
|
||||
separator_length = 1;
|
||||
separator_index = (separator - argv[i]);
|
||||
separator_index = (int) (separator - argv[i]);
|
||||
|
||||
keyword_length = (separator - keyword);
|
||||
keyword_length = (int) (separator - keyword);
|
||||
|
||||
value_index = separator_index + separator_length;
|
||||
value = (char*) &argv[i][value_index];
|
||||
|
@ -278,7 +278,7 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
|
|||
{
|
||||
i++;
|
||||
value_index = 0;
|
||||
length = strlen(argv[i]);
|
||||
length = (int) strlen(argv[i]);
|
||||
|
||||
value = (char*) &argv[i][value_index];
|
||||
value_length = (length - value_index);
|
||||
|
|
|
@ -207,7 +207,7 @@ void ArrayList_Clear(wArrayList *arrayList)
|
|||
|
||||
BOOL ArrayList_Contains(wArrayList *arrayList, void *obj)
|
||||
{
|
||||
DWORD index;
|
||||
int index;
|
||||
BOOL rc = FALSE;
|
||||
|
||||
if (arrayList->synchronized)
|
||||
|
|
|
@ -260,7 +260,7 @@ int BipBuffer_Write(wBipBuffer* bb, BYTE* data, size_t size)
|
|||
|
||||
CopyMemory(block, &data[status], writeSize);
|
||||
BipBuffer_WriteCommit(bb, writeSize);
|
||||
status += writeSize;
|
||||
status += (int) writeSize;
|
||||
|
||||
if ((status == size) || (writeSize < blockSize))
|
||||
return status;
|
||||
|
@ -277,7 +277,7 @@ int BipBuffer_Write(wBipBuffer* bb, BYTE* data, size_t size)
|
|||
|
||||
CopyMemory(block, &data[status], writeSize);
|
||||
BipBuffer_WriteCommit(bb, writeSize);
|
||||
status += writeSize;
|
||||
status += (int) writeSize;
|
||||
|
||||
if ((status == size) || (writeSize < blockSize))
|
||||
return status;
|
||||
|
@ -370,7 +370,7 @@ int BipBuffer_Read(wBipBuffer* bb, BYTE* data, size_t size)
|
|||
|
||||
CopyMemory(&data[status], block, readSize);
|
||||
BipBuffer_ReadCommit(bb, readSize);
|
||||
status += readSize;
|
||||
status += (int) readSize;
|
||||
|
||||
if ((status == size) || (readSize < blockSize))
|
||||
return status;
|
||||
|
@ -387,7 +387,7 @@ int BipBuffer_Read(wBipBuffer* bb, BYTE* data, size_t size)
|
|||
|
||||
CopyMemory(&data[status], block, readSize);
|
||||
BipBuffer_ReadCommit(bb, readSize);
|
||||
status += readSize;
|
||||
status += (int) readSize;
|
||||
|
||||
if ((status == size) || (readSize < blockSize))
|
||||
return status;
|
||||
|
|
|
@ -161,7 +161,7 @@ const char* BYTE_BIT_STRINGS_MSB[256] =
|
|||
"00111111", "10111111", "01111111", "11111111"
|
||||
};
|
||||
|
||||
void BitDump(const char* tag, int level, const BYTE* buffer, UINT32 length, UINT32 flags)
|
||||
void BitDump(const char* tag, UINT32 level, const BYTE* buffer, UINT32 length, UINT32 flags)
|
||||
{
|
||||
DWORD i;
|
||||
int nbits;
|
||||
|
|
|
@ -187,6 +187,44 @@ fail:
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && (NTDDI_VERSION <= NTDDI_WINXP)
|
||||
|
||||
typedef USHORT (WINAPI * PRTL_CAPTURE_STACK_BACK_TRACE_FN)(ULONG FramesToSkip, ULONG FramesToCapture, PVOID* BackTrace, PULONG BackTraceHash);
|
||||
|
||||
static HMODULE g_NTDLL_Library = NULL;
|
||||
static BOOL g_RtlCaptureStackBackTrace_Detected = FALSE;
|
||||
static BOOL g_RtlCaptureStackBackTrace_Available = FALSE;
|
||||
static PRTL_CAPTURE_STACK_BACK_TRACE_FN g_pRtlCaptureStackBackTrace = NULL;
|
||||
|
||||
USHORT RtlCaptureStackBackTrace(ULONG FramesToSkip, ULONG FramesToCapture, PVOID* BackTrace, PULONG BackTraceHash)
|
||||
{
|
||||
if (!g_RtlCaptureStackBackTrace_Detected)
|
||||
{
|
||||
g_NTDLL_Library = LoadLibraryA("kernel32.dll");
|
||||
|
||||
if (g_NTDLL_Library)
|
||||
{
|
||||
g_pRtlCaptureStackBackTrace = (PRTL_CAPTURE_STACK_BACK_TRACE_FN) GetProcAddress(g_NTDLL_Library, "RtlCaptureStackBackTrace");
|
||||
g_RtlCaptureStackBackTrace_Available = (g_pRtlCaptureStackBackTrace) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_RtlCaptureStackBackTrace_Available = FALSE;
|
||||
}
|
||||
|
||||
g_RtlCaptureStackBackTrace_Detected = TRUE;
|
||||
}
|
||||
|
||||
if (g_RtlCaptureStackBackTrace_Available)
|
||||
{
|
||||
return (*g_pRtlCaptureStackBackTrace)(FramesToSkip, FramesToCapture, BackTrace, BackTraceHash);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void winpr_backtrace_free(void* buffer)
|
||||
{
|
||||
if (!buffer)
|
||||
|
@ -255,7 +293,7 @@ void* winpr_backtrace(DWORD size)
|
|||
data->max = size;
|
||||
data->used = fkt->unwind_backtrace(data->buffer, 0, size);
|
||||
return data;
|
||||
#elif defined(_WIN32) || defined(_WIN64)
|
||||
#elif (defined(_WIN32) || defined(_WIN64)) && !defined(_UWP)
|
||||
HANDLE process = GetCurrentProcess();
|
||||
t_win_stack* data = calloc(1, sizeof(t_win_stack));
|
||||
|
||||
|
@ -272,7 +310,7 @@ void* winpr_backtrace(DWORD size)
|
|||
}
|
||||
|
||||
SymInitialize(process, NULL, TRUE);
|
||||
data->used = CaptureStackBackTrace(2, size, data->stack, NULL);
|
||||
data->used = RtlCaptureStackBackTrace(2, size, data->stack, NULL);
|
||||
|
||||
return data;
|
||||
#else
|
||||
|
@ -352,7 +390,7 @@ char** winpr_backtrace_symbols(void* buffer, size_t* used)
|
|||
|
||||
return (char**) lines;
|
||||
}
|
||||
#elif defined(_WIN32) || defined(_WIN64)
|
||||
#elif (defined(_WIN32) || defined(_WIN64)) && !defined(_UWP)
|
||||
{
|
||||
size_t i;
|
||||
size_t line_len = 1024;
|
||||
|
@ -471,15 +509,27 @@ void winpr_log_backtrace(const char* tag, DWORD level, DWORD size)
|
|||
winpr_backtrace_free(stack);
|
||||
}
|
||||
|
||||
char* winpr_strerror(DWORD dw, char* dmsg, size_t size) {
|
||||
char* winpr_strerror(DWORD dw, char* dmsg, size_t size)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
LPTSTR msg = NULL;
|
||||
DWORD rc;
|
||||
DWORD nSize = 0;
|
||||
DWORD dwFlags = 0;
|
||||
LPTSTR msg = NULL;
|
||||
BOOL alloc = FALSE;
|
||||
|
||||
dwFlags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
|
||||
|
||||
#ifdef FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||
alloc = TRUE;
|
||||
dwFlags |= FORMAT_MESSAGE_ALLOCATE_BUFFER;
|
||||
#else
|
||||
nSize = (DWORD) (size * 2);
|
||||
msg = (LPTSTR) calloc(nSize, sizeof(TCHAR));
|
||||
#endif
|
||||
|
||||
rc = FormatMessage(dwFlags, NULL, dw, 0, alloc ? (LPTSTR) &msg : msg, nSize, NULL);
|
||||
|
||||
rc = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, dw, 0, (LPTSTR)&msg, 0, NULL);
|
||||
if (rc) {
|
||||
#if defined(UNICODE)
|
||||
WideCharToMultiByte(CP_ACP, 0, msg, rc, dmsg, size - 1, NULL, NULL);
|
||||
|
@ -487,7 +537,12 @@ char* winpr_strerror(DWORD dw, char* dmsg, size_t size) {
|
|||
memcpy(dmsg, msg, min(rc, size - 1));
|
||||
#endif /* defined(UNICODE) */
|
||||
dmsg[min(rc, size - 1)] = 0;
|
||||
|
||||
#ifdef FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||
LocalFree(msg);
|
||||
#else
|
||||
free(msg);
|
||||
#endif
|
||||
} else {
|
||||
_snprintf(dmsg, size, "FAILURE: %08X", GetLastError());
|
||||
}
|
||||
|
|
|
@ -29,6 +29,30 @@
|
|||
|
||||
#include <winpr/ini.h>
|
||||
|
||||
BOOL IniFile_Load_NextLine(wIniFile* ini, char* str)
|
||||
{
|
||||
int length = 0;
|
||||
|
||||
ini->nextLine = strtok_s(str, "\n", &ini->tokctx);
|
||||
|
||||
if (ini->nextLine)
|
||||
length = (int) strlen(ini->nextLine);
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
if (ini->nextLine[length - 1] == '\r')
|
||||
{
|
||||
ini->nextLine[length - 1] = '\0';
|
||||
length--;
|
||||
}
|
||||
|
||||
if (length < 1)
|
||||
ini->nextLine = NULL;
|
||||
}
|
||||
|
||||
return (ini->nextLine) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
int IniFile_Load_String(wIniFile* ini, const char* iniString)
|
||||
{
|
||||
long int fileSize;
|
||||
|
@ -37,7 +61,7 @@ int IniFile_Load_String(wIniFile* ini, const char* iniString)
|
|||
ini->nextLine = NULL;
|
||||
ini->buffer = NULL;
|
||||
|
||||
fileSize = strlen(iniString);
|
||||
fileSize = (long int) strlen(iniString);
|
||||
|
||||
if (fileSize < 1)
|
||||
return -1;
|
||||
|
@ -52,7 +76,7 @@ int IniFile_Load_String(wIniFile* ini, const char* iniString)
|
|||
ini->buffer[fileSize] = '\n';
|
||||
ini->buffer[fileSize + 1] = '\0';
|
||||
|
||||
ini->nextLine = strtok(ini->buffer, "\n");
|
||||
IniFile_Load_NextLine(ini, ini->buffer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -60,9 +84,9 @@ int IniFile_Load_String(wIniFile* ini, const char* iniString)
|
|||
int IniFile_Open_File(wIniFile* ini, const char* filename)
|
||||
{
|
||||
if (ini->readOnly)
|
||||
ini->fp = fopen(filename, "r");
|
||||
ini->fp = fopen(filename, "rb");
|
||||
else
|
||||
ini->fp = fopen(filename, "w+");
|
||||
ini->fp = fopen(filename, "w+b");
|
||||
|
||||
if (!ini->fp)
|
||||
return -1;
|
||||
|
@ -79,9 +103,12 @@ int IniFile_Load_File(wIniFile* ini, const char* filename)
|
|||
|
||||
if (fseek(ini->fp, 0, SEEK_END) < 0)
|
||||
goto out_file;
|
||||
|
||||
fileSize = ftell(ini->fp);
|
||||
|
||||
if (fileSize < 0)
|
||||
goto out_file;
|
||||
|
||||
if (fseek(ini->fp, 0, SEEK_SET) < 0)
|
||||
goto out_file;
|
||||
|
||||
|
@ -106,7 +133,7 @@ int IniFile_Load_File(wIniFile* ini, const char* filename)
|
|||
ini->buffer[fileSize] = '\n';
|
||||
ini->buffer[fileSize + 1] = '\0';
|
||||
|
||||
ini->nextLine = strtok(ini->buffer, "\n");
|
||||
IniFile_Load_NextLine(ini, ini->buffer);
|
||||
|
||||
return 1;
|
||||
|
||||
|
@ -145,8 +172,9 @@ char* IniFile_Load_GetNextLine(wIniFile* ini)
|
|||
return NULL;
|
||||
|
||||
ini->line = ini->nextLine;
|
||||
ini->nextLine = strtok(NULL, "\n");
|
||||
ini->lineLength = strlen(ini->line);
|
||||
ini->lineLength = (int) strlen(ini->line);
|
||||
|
||||
IniFile_Load_NextLine(ini, NULL);
|
||||
|
||||
return ini->line;
|
||||
}
|
||||
|
@ -159,6 +187,7 @@ wIniFileKey* IniFile_Key_New(const char* name, const char* value)
|
|||
{
|
||||
key->name = _strdup(name);
|
||||
key->value = _strdup(value);
|
||||
|
||||
if (!key->name || !key->value)
|
||||
{
|
||||
free(key->name);
|
||||
|
@ -189,6 +218,7 @@ wIniFileSection* IniFile_Section_New(const char* name)
|
|||
return NULL;
|
||||
|
||||
section->name = _strdup(name);
|
||||
|
||||
if (!section->name)
|
||||
{
|
||||
free(section);
|
||||
|
@ -198,6 +228,7 @@ wIniFileSection* IniFile_Section_New(const char* name)
|
|||
section->nKeys = 0;
|
||||
section->cKeys = 64;
|
||||
section->keys = (wIniFileKey**) malloc(sizeof(wIniFileKey*) * section->cKeys);
|
||||
|
||||
if (!section->keys)
|
||||
{
|
||||
free(section->name);
|
||||
|
@ -215,11 +246,14 @@ void IniFile_Section_Free(wIniFileSection* section)
|
|||
if (!section)
|
||||
return;
|
||||
|
||||
free(section->name);
|
||||
|
||||
for (index = 0; index < section->nKeys; index++)
|
||||
{
|
||||
IniFile_Key_Free(section->keys[index]);
|
||||
}
|
||||
|
||||
free(section->keys);
|
||||
free(section);
|
||||
}
|
||||
|
||||
|
@ -258,8 +292,10 @@ wIniFileSection* IniFile_AddSection(wIniFile* ini, const char* name)
|
|||
|
||||
new_size = ini->cSections * 2;
|
||||
new_sect = (wIniFileSection**) realloc(ini->sections, sizeof(wIniFileSection*) * new_size);
|
||||
|
||||
if (!new_sect)
|
||||
return NULL;
|
||||
|
||||
ini->cSections = new_size;
|
||||
ini->sections = new_sect;
|
||||
}
|
||||
|
@ -307,15 +343,19 @@ wIniFileKey* IniFile_AddKey(wIniFile* ini, wIniFileSection* section, const char*
|
|||
|
||||
new_size = section->cKeys * 2;
|
||||
new_key = (wIniFileKey**) realloc(section->keys, sizeof(wIniFileKey*) * new_size);
|
||||
|
||||
if (!new_key)
|
||||
return NULL;
|
||||
|
||||
section->cKeys = new_size;
|
||||
section->keys = new_key;
|
||||
}
|
||||
|
||||
key = IniFile_Key_New(name, value);
|
||||
|
||||
if (!key)
|
||||
return NULL;
|
||||
|
||||
section->keys[section->nKeys] = key;
|
||||
section->nKeys++;
|
||||
}
|
||||
|
@ -323,6 +363,7 @@ wIniFileKey* IniFile_AddKey(wIniFile* ini, wIniFileSection* section, const char*
|
|||
{
|
||||
free(key->value);
|
||||
key->value = _strdup(value);
|
||||
|
||||
if (!key->value)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -432,6 +473,7 @@ int IniFile_ReadFile(wIniFile* ini, const char* filename)
|
|||
|
||||
free(ini->filename);
|
||||
ini->filename = _strdup(filename);
|
||||
|
||||
if (!ini->filename)
|
||||
return -1;
|
||||
|
||||
|
@ -459,11 +501,12 @@ char** IniFile_GetSectionNames(wIniFile* ini, int* count)
|
|||
for (index = 0; index < ini->nSections; index++)
|
||||
{
|
||||
section = ini->sections[index];
|
||||
nameLength = strlen(section->name);
|
||||
nameLength = (int) strlen(section->name);
|
||||
length += (nameLength + 1);
|
||||
}
|
||||
|
||||
sectionNames = (char**) malloc(length);
|
||||
|
||||
if (!sectionNames)
|
||||
return NULL;
|
||||
|
||||
|
@ -473,7 +516,7 @@ char** IniFile_GetSectionNames(wIniFile* ini, int* count)
|
|||
{
|
||||
sectionNames[index] = p;
|
||||
section = ini->sections[index];
|
||||
nameLength = strlen(section->name);
|
||||
nameLength = (int) strlen(section->name);
|
||||
CopyMemory(p, section->name, nameLength + 1);
|
||||
p += (nameLength + 1);
|
||||
}
|
||||
|
@ -505,7 +548,7 @@ char** IniFile_GetSectionKeyNames(wIniFile* ini, const char* section, int* count
|
|||
for (index = 0; index < pSection->nKeys; index++)
|
||||
{
|
||||
pKey = pSection->keys[index];
|
||||
nameLength = strlen(pKey->name);
|
||||
nameLength = (int) strlen(pKey->name);
|
||||
length += (nameLength + 1);
|
||||
}
|
||||
|
||||
|
@ -519,7 +562,7 @@ char** IniFile_GetSectionKeyNames(wIniFile* ini, const char* section, int* count
|
|||
{
|
||||
keyNames[index] = p;
|
||||
pKey = pSection->keys[index];
|
||||
nameLength = strlen(pKey->name);
|
||||
nameLength = (int) strlen(pKey->name);
|
||||
CopyMemory(p, pKey->name, nameLength + 1);
|
||||
p += (nameLength + 1);
|
||||
}
|
||||
|
@ -632,12 +675,12 @@ char* IniFile_WriteBuffer(wIniFile* ini)
|
|||
for (i = 0; i < ini->nSections; i++)
|
||||
{
|
||||
section = ini->sections[i];
|
||||
size += strlen(section->name) + 3;
|
||||
size += (int) (strlen(section->name) + 3);
|
||||
|
||||
for (j = 0; j < section->nKeys; j++)
|
||||
{
|
||||
key = section->keys[j];
|
||||
size += strlen(key->name) + strlen(key->value) + 2;
|
||||
size += (int) (strlen(key->name) + strlen(key->value) + 2);
|
||||
}
|
||||
|
||||
size += 1;
|
||||
|
@ -656,13 +699,13 @@ char* IniFile_WriteBuffer(wIniFile* ini)
|
|||
{
|
||||
section = ini->sections[i];
|
||||
sprintf_s(&buffer[offset], size - offset, "[%s]\n", section->name);
|
||||
offset += strlen(section->name) + 3;
|
||||
offset += (int) (strlen(section->name) + 3);
|
||||
|
||||
for (j = 0; j < section->nKeys; j++)
|
||||
{
|
||||
key = section->keys[j];
|
||||
sprintf_s(&buffer[offset], size - offset, "%s=%s\n", key->name, key->value);
|
||||
offset += strlen(key->name) + strlen(key->value) + 2;
|
||||
offset += (int) (strlen(key->name) + strlen(key->value) + 2);
|
||||
}
|
||||
|
||||
sprintf_s(&buffer[offset], size - offset, "\n");
|
||||
|
@ -686,7 +729,7 @@ int IniFile_WriteFile(wIniFile* ini, const char* filename)
|
|||
if (!buffer)
|
||||
return -1;
|
||||
|
||||
length = strlen(buffer);
|
||||
length = (int) strlen(buffer);
|
||||
|
||||
ini->readOnly = FALSE;
|
||||
|
||||
|
@ -718,6 +761,7 @@ wIniFile* IniFile_New()
|
|||
ini->nSections = 0;
|
||||
ini->cSections = 64;
|
||||
ini->sections = (wIniFileSection**) calloc(ini->cSections, sizeof(wIniFileSection*));
|
||||
|
||||
if (!ini->sections)
|
||||
{
|
||||
free(ini);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "../log.h"
|
||||
|
||||
void winpr_HexDump(const char* tag, int level, const BYTE* data, int length)
|
||||
void winpr_HexDump(const char* tag, UINT32 level, const BYTE* data, int length)
|
||||
{
|
||||
const BYTE* p = data;
|
||||
int i, line, offset = 0;
|
||||
|
@ -74,7 +74,7 @@ void winpr_HexDump(const char* tag, int level, const BYTE* data, int length)
|
|||
free(buffer);
|
||||
}
|
||||
|
||||
void winpr_CArrayDump(const char* tag, int level, const BYTE* data, int length, int width)
|
||||
void winpr_CArrayDump(const char* tag, UINT32 level, const BYTE* data, int length, int width)
|
||||
{
|
||||
const BYTE* p = data;
|
||||
int i, line, offset = 0;
|
||||
|
|
|
@ -124,9 +124,9 @@ static BOOL WLog_BinaryAppender_WriteMessage(wLog* log, wLogAppender* appender,
|
|||
if (!fp)
|
||||
return FALSE;
|
||||
|
||||
FileNameLength = strlen(message->FileName);
|
||||
FunctionNameLength = strlen(message->FunctionName);
|
||||
TextStringLength = strlen(message->TextString);
|
||||
FileNameLength = (int) strlen(message->FileName);
|
||||
FunctionNameLength = (int) strlen(message->FunctionName);
|
||||
TextStringLength = (int) strlen(message->TextString);
|
||||
|
||||
MessageLength = 16 +
|
||||
(4 + FileNameLength + 1) +
|
||||
|
|
|
@ -60,7 +60,7 @@ static BOOL WLog_UdpAppender_Open(wLog* log, wLogAppender* appender)
|
|||
colonPos = strchr(udpAppender->host, ':');
|
||||
if (!colonPos)
|
||||
return FALSE;
|
||||
addrLen = colonPos - udpAppender->host;
|
||||
addrLen = (int) (colonPos - udpAppender->host);
|
||||
memcpy(addressString, udpAppender->host, addrLen);
|
||||
addressString[addrLen] = '\0';
|
||||
|
||||
|
@ -79,7 +79,7 @@ static BOOL WLog_UdpAppender_Open(wLog* log, wLogAppender* appender)
|
|||
}
|
||||
|
||||
memcpy(&udpAppender->targetAddr, result->ai_addr, result->ai_addrlen);
|
||||
udpAppender->targetAddrLen = result->ai_addrlen;
|
||||
udpAppender->targetAddrLen = (int) result->ai_addrlen;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ BOOL WLog_ParseFilter(wLogFilter* filter, LPCSTR name)
|
|||
|
||||
while ((p = strchr(p, '.')) != NULL)
|
||||
{
|
||||
if (count < filter->NameCount)
|
||||
if (count < (int) filter->NameCount)
|
||||
filter->Names[count++] = p + 1;
|
||||
*p = '\0';
|
||||
p++;
|
||||
|
@ -603,7 +603,7 @@ BOOL WLog_ParseName(wLog* log, LPCSTR name)
|
|||
|
||||
while ((p = strchr(p, '.')) != NULL)
|
||||
{
|
||||
if (count < log->NameCount)
|
||||
if (count < (int) log->NameCount)
|
||||
log->Names[count++] = p + 1;
|
||||
*p = '\0';
|
||||
p++;
|
||||
|
|
|
@ -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