Merge branch 'master' of github.com:FreeRDP/FreeRDP
Conflicts: libfreerdp/core/input.c libfreerdp/core/update.c
This commit is contained in:
commit
83ad1730b8
@ -68,11 +68,11 @@ endif()
|
||||
|
||||
# Allow to search the host machine for git
|
||||
if(ANDROID OR IOS)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, BOTH)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
||||
endif(ANDROID OR IOS)
|
||||
include(GetGitRevisionDescription)
|
||||
if(ANDROID OR IOS)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
endif(ANDROID OR IOS)
|
||||
|
||||
git_describe(GIT_REVISION --match "[0-9]*" --abbrev=4 --tags --always)
|
||||
@ -301,8 +301,9 @@ endif()
|
||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/client/Android/FreeRDPCore/jni/${ANDROID_ABI})
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/regenerate_jni_headers.sh.cmake
|
||||
${CMAKE_BINARY_DIR}/scripts/regenerate_jni_headers.sh @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/gprof_generate.sh.cmake
|
||||
${CMAKE_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
|
||||
if (WITH_GPROF)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/gprof_generate.sh.cmake ${CMAKE_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
|
||||
endif(WITH_GPROF)
|
||||
|
||||
endif()
|
||||
|
||||
|
@ -43,12 +43,22 @@
|
||||
#define AVMEDIA_TYPE_AUDIO 1
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
#define MAX_AUDIO_FRAME_SIZE AVCODEC_MAX_AUDIO_FRAME_SIZE
|
||||
#else
|
||||
#define MAX_AUDIO_FRAME_SIZE 192000
|
||||
#endif
|
||||
|
||||
typedef struct _TSMFFFmpegDecoder
|
||||
{
|
||||
ITSMFDecoder iface;
|
||||
|
||||
int media_type;
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 55
|
||||
enum CodecID codec_id;
|
||||
#else
|
||||
enum AVCodecID codec_id;
|
||||
#endif
|
||||
AVCodecContext* codec_context;
|
||||
AVCodec* codec;
|
||||
AVFrame* frame;
|
||||
@ -98,6 +108,7 @@ static BOOL tsmf_ffmpeg_init_audio_stream(ITSMFDecoder* decoder, const TS_AM_MED
|
||||
mdecoder->codec_context->channels = media_type->Channels;
|
||||
mdecoder->codec_context->block_align = media_type->BlockAlign;
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 55
|
||||
#ifdef AV_CPU_FLAG_SSE2
|
||||
mdecoder->codec_context->dsp_mask = AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2;
|
||||
#else
|
||||
@ -107,6 +118,13 @@ static BOOL tsmf_ffmpeg_init_audio_stream(ITSMFDecoder* decoder, const TS_AM_MED
|
||||
mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMX2;
|
||||
#endif
|
||||
#endif
|
||||
#else /* LIBAVCODEC_VERSION_MAJOR < 55 */
|
||||
#ifdef AV_CPU_FLAG_SSE2
|
||||
av_set_cpu_flags_mask(AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2);
|
||||
#else
|
||||
av_set_cpu_flags_mask(FF_MM_SSE2 | FF_MM_MMX2);
|
||||
#endif
|
||||
#endif /* LIBAVCODEC_VERSION_MAJOR < 55 */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -351,7 +369,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
|
||||
#endif
|
||||
|
||||
if (mdecoder->decoded_size_max == 0)
|
||||
mdecoder->decoded_size_max = AVCODEC_MAX_AUDIO_FRAME_SIZE + 16;
|
||||
mdecoder->decoded_size_max = MAX_AUDIO_FRAME_SIZE + 16;
|
||||
mdecoder->decoded_data = malloc(mdecoder->decoded_size_max);
|
||||
ZeroMemory(mdecoder->decoded_data, mdecoder->decoded_size_max);
|
||||
/* align the memory for SSE2 needs */
|
||||
@ -363,7 +381,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
|
||||
while (src_size > 0)
|
||||
{
|
||||
/* Ensure enough space for decoding */
|
||||
if (mdecoder->decoded_size_max - mdecoder->decoded_size < AVCODEC_MAX_AUDIO_FRAME_SIZE)
|
||||
if (mdecoder->decoded_size_max - mdecoder->decoded_size < MAX_AUDIO_FRAME_SIZE)
|
||||
{
|
||||
mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16;
|
||||
mdecoder->decoded_data = realloc(mdecoder->decoded_data, mdecoder->decoded_size_max);
|
||||
|
@ -19,11 +19,10 @@ if (NOT ANDROID_NDK)
|
||||
message(FATAL_ERROR "ANDROID_NDK not set but required for building android native library.")
|
||||
endif()
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, BOTH)
|
||||
find_program(NDK_COMMAND ndk-build)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, ONLY)
|
||||
set(CMAKE_PROGRAM_PATH ${ANDROID_NDK})
|
||||
find_program(NDK_COMMAND ndk-build CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
|
||||
if(NDK_COMMAND STREQUAL "ANT_COMMAND-NOTFOUND")
|
||||
if(NDK_COMMAND STREQUAL "NDK_COMMAND-NOTFOUND")
|
||||
message(FATAL_ERROR "ndk-build not found but required to build native lib")
|
||||
endif()
|
||||
|
||||
@ -34,9 +33,9 @@ if(ANDROID_BUILD_JAVA)
|
||||
endif()
|
||||
# And isn't shiped with the android ndk/sdk so
|
||||
# we need to find it on the local machine
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, BOTH)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
||||
find_program(ANT_COMMAND ant)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER, ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
|
||||
if(ANT_COMMAND STREQUAL "ANT_COMMAND-NOTFOUND")
|
||||
message(FATAL_ERROR "ant not found but required to build android java")
|
||||
|
@ -15,6 +15,6 @@
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
build.dir=@CMAKE_CURRENT_BINARY_DIR@
|
||||
source.dir=@CMAKE_CURRENT_SOURCE_DIR@/src
|
||||
source.path=@CMAKE_CURRENT_SOURCE_DIR@/src:@CMAKE_CURRENT_BINARY_DIR@/src
|
||||
out.dir=@CMAKE_CURRENT_BINARY_DIR@/bin
|
||||
|
||||
|
@ -26,6 +26,14 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build.xml.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/build.xml @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/project.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/project.properties @ONLY)
|
||||
|
||||
# The following is required if building android out of tree
|
||||
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set (AFREERDP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
else()
|
||||
set (AFREERDP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src:${CMAKE_CURRENT_SOURCE_DIR}/../FreeRDPCore/src")
|
||||
endif()
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ant.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ant.properties @ONLY)
|
||||
|
||||
|
@ -15,6 +15,5 @@
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
build.dir=@CMAKE_CURRENT_BINARY_DIR@
|
||||
source.dir=@CMAKE_CURRENT_SOURCE_DIR@/src
|
||||
source.dir=@AFREERDP_SOURCE_DIR@
|
||||
out.dir=@CMAKE_CURRENT_BINARY_DIR@/bin
|
||||
|
||||
|
@ -51,10 +51,13 @@ static UINT32 get_local_format_id_by_name(cliprdrContext *cliprdr, void *format_
|
||||
formatMapping *map;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cliprdr->map_size; i++) {
|
||||
for (i = 0; i < cliprdr->map_size; i++)
|
||||
{
|
||||
map = &cliprdr->format_mappings[i];
|
||||
if ((cliprdr->capabilities & CAPS_USE_LONG_FORMAT_NAMES) != 0) {
|
||||
if (map->name) {
|
||||
if ((cliprdr->capabilities & CAPS_USE_LONG_FORMAT_NAMES) != 0)
|
||||
{
|
||||
if (map->name)
|
||||
{
|
||||
if (memcmp(map->name, format_name, wcslen((LPCWSTR)format_name)) == 0)
|
||||
return map->local_format_id;
|
||||
}
|
||||
@ -69,9 +72,11 @@ static UINT32 get_remote_format_id(cliprdrContext *cliprdr, UINT32 local_format)
|
||||
formatMapping *map;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cliprdr->map_size; i++) {
|
||||
for (i = 0; i < cliprdr->map_size; i++)
|
||||
{
|
||||
map = &cliprdr->format_mappings[i];
|
||||
if (map->local_format_id == local_format) {
|
||||
if (map->local_format_id == local_format)
|
||||
{
|
||||
return map->remote_format_id;
|
||||
}
|
||||
}
|
||||
@ -81,9 +86,10 @@ static UINT32 get_remote_format_id(cliprdrContext *cliprdr, UINT32 local_format)
|
||||
|
||||
static void map_ensure_capacity(cliprdrContext *cliprdr)
|
||||
{
|
||||
if (cliprdr->map_size >= cliprdr->map_capacity) {
|
||||
if (cliprdr->map_size >= cliprdr->map_capacity)
|
||||
{
|
||||
cliprdr->format_mappings = (formatMapping *)realloc(cliprdr->format_mappings,
|
||||
cliprdr->map_capacity * 2);
|
||||
sizeof(formatMapping) * cliprdr->map_capacity * 2);
|
||||
cliprdr->map_capacity *= 2;
|
||||
}
|
||||
}
|
||||
@ -93,13 +99,16 @@ static void clear_format_map(cliprdrContext *cliprdr)
|
||||
formatMapping *map;
|
||||
int i;
|
||||
|
||||
if (cliprdr->format_mappings) {
|
||||
for (i = 0; i < cliprdr->map_size; i++) {
|
||||
if (cliprdr->format_mappings)
|
||||
{
|
||||
for (i = 0; i < cliprdr->map_capacity; i++)
|
||||
{
|
||||
map = &cliprdr->format_mappings[i];
|
||||
map->remote_format_id = 0;
|
||||
map->local_format_id = 0;
|
||||
|
||||
if (map->name) {
|
||||
if (map->name)
|
||||
{
|
||||
free(map->name);
|
||||
map->name = NULL;
|
||||
}
|
||||
@ -119,7 +128,8 @@ static void cliprdr_send_format_list(cliprdrContext *cliprdr)
|
||||
int len = 0;
|
||||
int namelen;
|
||||
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard)) {
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard))
|
||||
{
|
||||
DEBUG_CLIPRDR("OpenClipboard failed with 0x%x", GetLastError());
|
||||
return;
|
||||
}
|
||||
@ -130,23 +140,36 @@ static void cliprdr_send_format_list(cliprdrContext *cliprdr)
|
||||
format_data = (BYTE *)calloc(1, data_size);
|
||||
assert(format_data != NULL);
|
||||
|
||||
while (format = EnumClipboardFormats(format)) {
|
||||
while (format = EnumClipboardFormats(format))
|
||||
{
|
||||
Write_UINT32(format_data + len, format);
|
||||
len += 4;
|
||||
if ((cliprdr->capabilities & CAPS_USE_LONG_FORMAT_NAMES) != 0) {
|
||||
if (format >= CF_MAX) {
|
||||
if ((cliprdr->capabilities & CAPS_USE_LONG_FORMAT_NAMES) != 0)
|
||||
{
|
||||
if (format >= CF_MAX)
|
||||
{
|
||||
namelen = GetClipboardFormatNameW(format, (LPWSTR)(format_data + len), MAX_PATH);
|
||||
len += namelen * sizeof(WCHAR);
|
||||
}
|
||||
len += 2; /* end of Unicode string */
|
||||
} else {
|
||||
ZeroMemory(format_data + len, 32);
|
||||
if (format >= CF_MAX) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (format >= CF_MAX)
|
||||
{
|
||||
static wchar_t wName[MAX_PATH] = {0};
|
||||
int wLen;
|
||||
|
||||
ZeroMemory(wName, MAX_PATH*2);
|
||||
GetClipboardFormatNameW(format, wName, MAX_PATH);
|
||||
memcpy(format_data + len, wName, 32); /* truncate the long name to 32 bytes */
|
||||
wLen = GetClipboardFormatNameW(format, wName, MAX_PATH);
|
||||
if (wLen < 16)
|
||||
{
|
||||
memcpy(format_data + len, wName, wLen * sizeof(WCHAR));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(format_data + len, wName, 32); /* truncate the long name to 32 bytes */
|
||||
}
|
||||
}
|
||||
len += 32;
|
||||
}
|
||||
@ -180,6 +203,8 @@ int cliprdr_send_data_request(cliprdrContext *cliprdr, UINT32 format)
|
||||
return -1;
|
||||
|
||||
cliprdr_event->format = get_remote_format_id(cliprdr, format);
|
||||
if (cliprdr_event->format == 0)
|
||||
return -1;
|
||||
|
||||
ret = freerdp_channels_send_event(cliprdr->channels, (wMessage *)cliprdr_event);
|
||||
|
||||
@ -196,12 +221,14 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
||||
{
|
||||
static cliprdrContext *cliprdr = NULL;
|
||||
|
||||
switch (Msg) {
|
||||
switch (Msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
cliprdr = (cliprdrContext *)((CREATESTRUCT *)lParam)->lpCreateParams;
|
||||
cliprdr->hwndNextViewer = SetClipboardViewer(hWnd);
|
||||
|
||||
if (cliprdr->hwndNextViewer == NULL && GetLastError() != 0) {
|
||||
if (cliprdr->hwndNextViewer == NULL && GetLastError() != 0)
|
||||
{
|
||||
DEBUG_CLIPRDR("error: SetClipboardViewer failed with 0x%0x.", GetLastError());
|
||||
}
|
||||
cliprdr->hwndClipboard = hWnd;
|
||||
@ -212,17 +239,23 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
||||
break;
|
||||
|
||||
case WM_CHANGECBCHAIN:
|
||||
if (cliprdr->hwndNextViewer == (HWND)wParam) {
|
||||
if (cliprdr->hwndNextViewer == (HWND)wParam)
|
||||
{
|
||||
cliprdr->hwndNextViewer = (HWND)lParam;
|
||||
} else if (cliprdr->hwndNextViewer != NULL) {
|
||||
}
|
||||
else if (cliprdr->hwndNextViewer != NULL)
|
||||
{
|
||||
SendMessage(cliprdr->hwndNextViewer, Msg, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DRAWCLIPBOARD:
|
||||
if (cliprdr->channel_initialized) {
|
||||
if (GetClipboardOwner() != cliprdr->hwndClipboard) {
|
||||
if (!cliprdr->hmem) {
|
||||
if (cliprdr->channel_initialized)
|
||||
{
|
||||
if (GetClipboardOwner() != cliprdr->hwndClipboard)
|
||||
{
|
||||
if (!cliprdr->hmem)
|
||||
{
|
||||
cliprdr->hmem = GlobalFree(cliprdr->hmem);
|
||||
}
|
||||
cliprdr_send_format_list(cliprdr);
|
||||
@ -234,7 +267,8 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
||||
|
||||
case WM_RENDERALLFORMATS:
|
||||
/* discard all contexts in clipboard */
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard)) {
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard))
|
||||
{
|
||||
DEBUG_CLIPRDR("OpenClipboard failed with 0x%x", GetLastError());
|
||||
break;
|
||||
}
|
||||
@ -243,12 +277,14 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
||||
break;
|
||||
|
||||
case WM_RENDERFORMAT:
|
||||
if (cliprdr_send_data_request(cliprdr, (UINT32)wParam) != 0) {
|
||||
if (cliprdr_send_data_request(cliprdr, (UINT32)wParam) != 0)
|
||||
{
|
||||
DEBUG_CLIPRDR("error: cliprdr_send_data_request failed.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (SetClipboardData(wParam, cliprdr->hmem) == NULL) {
|
||||
if (SetClipboardData(wParam, cliprdr->hmem) == NULL)
|
||||
{
|
||||
DEBUG_CLIPRDR("SetClipboardData failed with 0x%x", GetLastError());
|
||||
cliprdr->hmem = GlobalFree(cliprdr->hmem);
|
||||
}
|
||||
@ -292,7 +328,8 @@ static int create_cliprdr_window(cliprdrContext *cliprdr)
|
||||
L"rdpclip",
|
||||
0, 0, 0, 0, 0, HWND_MESSAGE, NULL, GetModuleHandle(NULL), cliprdr);
|
||||
|
||||
if (cliprdr->hwndClipboard == NULL) {
|
||||
if (cliprdr->hwndClipboard == NULL)
|
||||
{
|
||||
DEBUG_CLIPRDR("error: CreateWindowEx failed with %x.", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
@ -308,16 +345,21 @@ static void *cliprdr_thread_func(void *arg)
|
||||
int ret;
|
||||
HRESULT result;
|
||||
|
||||
if ((ret = create_cliprdr_window(cliprdr)) != 0) {
|
||||
if ((ret = create_cliprdr_window(cliprdr)) != 0)
|
||||
{
|
||||
DEBUG_CLIPRDR("error: create clipboard window failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((mcode = GetMessage(&msg, 0, 0, 0) != 0)) {
|
||||
if (mcode == -1) {
|
||||
while ((mcode = GetMessage(&msg, 0, 0, 0) != 0))
|
||||
{
|
||||
if (mcode == -1)
|
||||
{
|
||||
DEBUG_CLIPRDR("error: clipboard thread GetMessage failed.");
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
@ -362,7 +404,8 @@ void wf_cliprdr_uninit(wfContext* wfc)
|
||||
if (cliprdr->hwndClipboard)
|
||||
PostMessage(cliprdr->hwndClipboard, WM_QUIT, 0, 0);
|
||||
|
||||
if (cliprdr->cliprdr_thread) {
|
||||
if (cliprdr->cliprdr_thread)
|
||||
{
|
||||
WaitForSingleObject(cliprdr->cliprdr_thread, INFINITE);
|
||||
CloseHandle(cliprdr->cliprdr_thread);
|
||||
}
|
||||
@ -406,23 +449,32 @@ static void wf_cliprdr_process_cb_data_request_event(wfContext *wfc, RDP_CB_DATA
|
||||
|
||||
local_format = event->format;
|
||||
|
||||
if (local_format == 0x9) { /* FORMAT_ID_PALETTE */
|
||||
if (local_format == 0x9) /* FORMAT_ID_PALETTE */
|
||||
{
|
||||
/* TODO: implement this */
|
||||
DEBUG_CLIPRDR("FORMAT_ID_PALETTE is not supported yet.");
|
||||
} else if (local_format == 0x3) { /* FORMAT_ID_MATEFILE */
|
||||
}
|
||||
else if (local_format == 0x3) /* FORMAT_ID_MATEFILE */
|
||||
{
|
||||
/* TODO: implement this */
|
||||
DEBUG_CLIPRDR("FORMAT_ID_MATEFILE is not supported yet.");
|
||||
} else if (local_format == RegisterClipboardFormatW(L"FileGroupDescriptorW")) {
|
||||
}
|
||||
else if (local_format == RegisterClipboardFormatW(L"FileGroupDescriptorW"))
|
||||
{
|
||||
/* TODO: implement this */
|
||||
DEBUG_CLIPRDR("FileGroupDescriptorW is not supported yet.");
|
||||
} else {
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard)) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard))
|
||||
{
|
||||
DEBUG_CLIPRDR("OpenClipboard failed with 0x%x", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
hClipdata = GetClipboardData(event->format);
|
||||
if (!hClipdata) {
|
||||
if (!hClipdata)
|
||||
{
|
||||
DEBUG_CLIPRDR("GetClipboardData failed.");
|
||||
CloseClipboard();
|
||||
return;
|
||||
@ -466,8 +518,10 @@ static void wf_cliprdr_process_cb_format_list_event(wfContext *wfc, RDP_CB_FORMA
|
||||
|
||||
clear_format_map(cliprdr);
|
||||
|
||||
if ((cliprdr->capabilities & CAPS_USE_LONG_FORMAT_NAMES) != 0) {
|
||||
while (left_size >= 6) {
|
||||
if ((cliprdr->capabilities & CAPS_USE_LONG_FORMAT_NAMES) != 0)
|
||||
{
|
||||
while (left_size >= 6)
|
||||
{
|
||||
formatMapping *map;
|
||||
BYTE* tmp;
|
||||
int name_len;
|
||||
@ -475,19 +529,24 @@ static void wf_cliprdr_process_cb_format_list_event(wfContext *wfc, RDP_CB_FORMA
|
||||
map = &cliprdr->format_mappings[i++];
|
||||
|
||||
Read_UINT32(p, map->remote_format_id);
|
||||
map->name = NULL;
|
||||
|
||||
/* get name_len */
|
||||
for (tmp = p, name_len = 0; tmp + 1 < end_mark; tmp += 2, name_len += 2) {
|
||||
for (tmp = p, name_len = 0; tmp + 1 < end_mark; tmp += 2, name_len += 2)
|
||||
{
|
||||
if (*((unsigned short*) tmp) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (name_len > 0) {
|
||||
if (name_len > 0)
|
||||
{
|
||||
map->name = malloc(name_len + 2);
|
||||
memcpy(map->name, p, name_len + 2);
|
||||
|
||||
map->local_format_id = RegisterClipboardFormatW((LPCWSTR)map->name);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
map->local_format_id = map->remote_format_id;
|
||||
}
|
||||
|
||||
@ -498,43 +557,58 @@ static void wf_cliprdr_process_cb_format_list_event(wfContext *wfc, RDP_CB_FORMA
|
||||
|
||||
map_ensure_capacity(cliprdr);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k < event->raw_format_data_size / 36; k++) {
|
||||
for (k = 0; k < event->raw_format_data_size / 36; k++)
|
||||
{
|
||||
formatMapping *map;
|
||||
int name_len;
|
||||
|
||||
map = &cliprdr->format_mappings[i++];
|
||||
|
||||
Read_UINT32(p, map->remote_format_id);
|
||||
map->name = NULL;
|
||||
|
||||
if (event->raw_format_unicode) {
|
||||
if (event->raw_format_unicode)
|
||||
{
|
||||
/* get name_len, in bytes, if the file name is truncated, no terminated null will be included. */
|
||||
for (name_len = 0; name_len < 32; name_len += 2) {
|
||||
for (name_len = 0; name_len < 32; name_len += 2)
|
||||
{
|
||||
if (*((unsigned short*) (p + name_len)) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (name_len > 0) {
|
||||
if (name_len > 0)
|
||||
{
|
||||
map->name = calloc(1, name_len + 2);
|
||||
memcpy(map->name, p, name_len);
|
||||
map->local_format_id = RegisterClipboardFormatW((LPCWSTR)map->name);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
map->local_format_id = map->remote_format_id;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get name_len, in bytes, if the file name is truncated, no terminated null will be included. */
|
||||
for (name_len = 0; name_len < 32; name_len += 1) {
|
||||
for (name_len = 0; name_len < 32; name_len += 1)
|
||||
{
|
||||
if (*((unsigned char*) (p + name_len)) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (name_len > 0) {
|
||||
if (name_len > 0)
|
||||
{
|
||||
map->name = calloc(1, name_len + 1);
|
||||
memcpy(map->name, p, name_len);
|
||||
map->local_format_id = RegisterClipboardFormatA((LPCSTR)map->name);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
map->local_format_id = map->remote_format_id;
|
||||
}
|
||||
}
|
||||
@ -545,18 +619,21 @@ static void wf_cliprdr_process_cb_format_list_event(wfContext *wfc, RDP_CB_FORMA
|
||||
}
|
||||
}
|
||||
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard)) {
|
||||
if (!OpenClipboard(cliprdr->hwndClipboard))
|
||||
{
|
||||
DEBUG_CLIPRDR("OpenClipboard failed with 0x%x", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EmptyClipboard()) {
|
||||
if (!EmptyClipboard())
|
||||
{
|
||||
DEBUG_CLIPRDR("EmptyClipboard failed with 0x%x", GetLastError());
|
||||
CloseClipboard();
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < cliprdr->map_size; i++) {
|
||||
for (i = 0; i < cliprdr->map_size; i++)
|
||||
{
|
||||
SetClipboardData(cliprdr->format_mappings[i].local_format_id, NULL);
|
||||
}
|
||||
|
||||
@ -580,7 +657,8 @@ static void wf_cliprdr_process_cb_data_response_event(wfContext *wfc, RDP_CB_DAT
|
||||
|
||||
void wf_process_cliprdr_event(wfContext *wfc, wMessage *event)
|
||||
{
|
||||
switch (GetMessageType(event->id)) {
|
||||
switch (GetMessageType(event->id))
|
||||
{
|
||||
case CliprdrChannel_ClipCaps:
|
||||
wf_cliprdr_process_cb_clip_caps_event(wfc, (RDP_CB_CLIP_CAPS *)event);
|
||||
break;
|
||||
|
@ -226,43 +226,43 @@ BOOL freerdp_client_rdp_file_set_string(rdpFile* file, char* name, char* value)
|
||||
#endif
|
||||
|
||||
if (_stricmp(name, "username") == 0)
|
||||
file->Username = value;
|
||||
file->Username = _strdup(value);
|
||||
else if (_stricmp(name, "domain") == 0)
|
||||
file->Domain = value;
|
||||
file->Domain = _strdup(value);
|
||||
else if (_stricmp(name, "full address") == 0)
|
||||
file->FullAddress = value;
|
||||
file->FullAddress = _strdup(value);
|
||||
else if (_stricmp(name, "alternate full address") == 0)
|
||||
file->AlternateFullAddress = value;
|
||||
file->AlternateFullAddress = _strdup(value);
|
||||
else if (_stricmp(name, "usbdevicestoredirect") == 0)
|
||||
file->UsbDevicesToRedirect = value;
|
||||
file->UsbDevicesToRedirect = _strdup(value);
|
||||
else if (_stricmp(name, "loadbalanceinfo") == 0)
|
||||
file->LoadBalanceInfo = value;
|
||||
file->LoadBalanceInfo = _strdup(value);
|
||||
else if (_stricmp(name, "remoteapplicationname") == 0)
|
||||
file->RemoteApplicationName = value;
|
||||
file->RemoteApplicationName = _strdup(value);
|
||||
else if (_stricmp(name, "remoteapplicationicon") == 0)
|
||||
file->RemoteApplicationIcon = value;
|
||||
file->RemoteApplicationIcon = _strdup(value);
|
||||
else if (_stricmp(name, "remoteapplicationprogram") == 0)
|
||||
file->RemoteApplicationProgram = value;
|
||||
file->RemoteApplicationProgram = _strdup(value);
|
||||
else if (_stricmp(name, "remoteapplicationfile") == 0)
|
||||
file->RemoteApplicationFile = value;
|
||||
file->RemoteApplicationFile = _strdup(value);
|
||||
else if (_stricmp(name, "remoteapplicationguid") == 0)
|
||||
file->RemoteApplicationGuid = value;
|
||||
file->RemoteApplicationGuid = _strdup(value);
|
||||
else if (_stricmp(name, "remoteapplicationcmdline") == 0)
|
||||
file->RemoteApplicationCmdLine = value;
|
||||
file->RemoteApplicationCmdLine = _strdup(value);
|
||||
else if (_stricmp(name, "alternate shell") == 0)
|
||||
file->AlternateShell = value;
|
||||
file->AlternateShell = _strdup(value);
|
||||
else if (_stricmp(name, "shell working directory") == 0)
|
||||
file->ShellWorkingDirectory = value;
|
||||
file->ShellWorkingDirectory = _strdup(value);
|
||||
else if (_stricmp(name, "gatewayhostname") == 0)
|
||||
file->GatewayHostname = value;
|
||||
file->GatewayHostname = _strdup(value);
|
||||
else if (_stricmp(name, "kdcproxyname") == 0)
|
||||
file->KdcProxyName = value;
|
||||
file->KdcProxyName = _strdup(value);
|
||||
else if (_stricmp(name, "drivestoredirect") == 0)
|
||||
file->DrivesToRedirect = value;
|
||||
file->DrivesToRedirect = _strdup(value);
|
||||
else if (_stricmp(name, "devicestoredirect") == 0)
|
||||
file->DevicesToRedirect = value;
|
||||
file->DevicesToRedirect = _strdup(value);
|
||||
else if (_stricmp(name, "winposstr") == 0)
|
||||
file->WinPosStr = value;
|
||||
file->WinPosStr = _strdup(value);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
@ -297,10 +297,10 @@ void freerdp_client_parse_rdp_file_string_unicode(rdpFile* file, WCHAR* name, WC
|
||||
WideCharToMultiByte(CP_UTF8, 0, value, length, valueA, length, NULL, NULL);
|
||||
valueA[length] = '\0';
|
||||
|
||||
if (!freerdp_client_rdp_file_set_string(file, nameA, valueA))
|
||||
free(valueA);
|
||||
freerdp_client_rdp_file_set_string(file, nameA, valueA);
|
||||
|
||||
free(nameA);
|
||||
free(valueA);
|
||||
}
|
||||
|
||||
void freerdp_client_parse_rdp_file_string_ascii(rdpFile* file, char* name, char* value)
|
||||
|
@ -326,7 +326,7 @@ endif()
|
||||
# rpath makes low sence for Android
|
||||
set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )
|
||||
|
||||
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
|
||||
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
|
||||
if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
|
||||
if( CMAKE_HOST_WIN32 )
|
||||
file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
|
||||
@ -690,6 +690,7 @@ if( BUILD_WITH_ANDROID_NDK )
|
||||
endif()
|
||||
__LIST_FILTER( __availableToolchainsLst "^[.]" )
|
||||
__LIST_FILTER( __availableToolchainsLst "llvm" )
|
||||
__LIST_FILTER( __availableToolchainsLst "renderscript" )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
|
||||
if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
|
||||
@ -721,7 +722,7 @@ __INIT_VARIABLE( ANDROID_ABI OBSOLETE_ARM_TARGET OBSOLETE_ARM_TARGETS VALUES ${A
|
||||
# verify that target ABI is supported
|
||||
list( FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI}" __androidAbiIdx )
|
||||
if( __androidAbiIdx EQUAL -1 )
|
||||
string( REPLACE ";" "\", \"", PRINTABLE_ANDROID_SUPPORTED_ABIS "${ANDROID_SUPPORTED_ABIS}" )
|
||||
string( REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_ABIS "${ANDROID_SUPPORTED_ABIS}" )
|
||||
message( FATAL_ERROR "Specified ANDROID_ABI = \"${ANDROID_ABI}\" is not supported by this cmake toolchain or your NDK/toolchain.
|
||||
Supported values are: \"${PRINTABLE_ANDROID_SUPPORTED_ABIS}\"
|
||||
" )
|
||||
|
@ -29,14 +29,15 @@ FreeRDP requires openssl libraries for building but they are not part of the
|
||||
Android NDK and therefore they need to be prebuild manually.
|
||||
Multiple source versions and builds of static openssl libraries are floating around.
|
||||
At the time of writing we have tested and used:
|
||||
https://github.com/bmiklautz/Android-external-openssl-ndk-static.
|
||||
https://github.com/bmiklautz/Android-external-openssl-ndk-static
|
||||
https://github.com/akallabeth/openssl-android
|
||||
However, any other static build should work as well.
|
||||
|
||||
To build openssl:
|
||||
|
||||
git clone git@github.com:bmiklautz/android-external-openssl-ndk-static.git
|
||||
cd android-external-openssl-ndk-static
|
||||
ndk-build # found in the Android NDK
|
||||
Set up ANDROID_NDK and ANDROID_SDK to the absolute paths on your machine.
|
||||
From the project root folder run './scripts/android_setup_build_env.sh'
|
||||
This will set up openssl and gprof helper libraries as required for FreeRDP.
|
||||
|
||||
|
||||
Building
|
||||
|
@ -494,10 +494,9 @@ static void input_free_queued_message(void *obj)
|
||||
|
||||
rdpInput* input_new(rdpRdp* rdp)
|
||||
{
|
||||
wObject cb;
|
||||
const wObject cb = { NULL, NULL, NULL, input_free_queued_message, NULL };
|
||||
rdpInput* input;
|
||||
|
||||
cb.fnObjectFree = input_free_queued_message ;
|
||||
input = (rdpInput*) malloc(sizeof(rdpInput));
|
||||
|
||||
if (input != NULL)
|
||||
|
@ -1553,10 +1553,9 @@ static void update_free_queued_message(void *obj)
|
||||
|
||||
rdpUpdate* update_new(rdpRdp* rdp)
|
||||
{
|
||||
wObject cb;
|
||||
const wObject cb = { NULL, NULL, NULL, update_free_queued_message, NULL };
|
||||
rdpUpdate* update;
|
||||
|
||||
cb.fnObjectFree = update_free_queued_message;
|
||||
update = (rdpUpdate*) malloc(sizeof(rdpUpdate));
|
||||
|
||||
if (update)
|
||||
|
@ -10,28 +10,26 @@
|
||||
# Usage:
|
||||
# android_setup_build_env.sh <source root>
|
||||
|
||||
OPENSSL_SCM=https://github.com/bmiklautz/android-external-openssl-ndk-static
|
||||
OPENSSL_SCM=https://github.com/akallabeth/openssl-android
|
||||
NDK_PROFILER_SCM=https://github.com/richq/android-ndk-profiler
|
||||
|
||||
SCRIPT_NAME=`basename $0`
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
|
||||
echo "Missing command line argument."
|
||||
echo "$SCRIPT_NAME <FreeRDP source>"
|
||||
exit -1
|
||||
echo "Missing command line argument, current directory as root."
|
||||
ROOT=`pwd`
|
||||
ROOT=$ROOT/external
|
||||
else
|
||||
ROOT=`readlink -f $1`
|
||||
fi
|
||||
|
||||
if [ ! -d $1 ]; then
|
||||
echo "Argument '$1' is not a directory."
|
||||
if [ ! -d $ROOT ]; then
|
||||
echo "Argument '$ROOT' is not a directory."
|
||||
exit -2
|
||||
fi
|
||||
SRC=`realpath $1`
|
||||
|
||||
echo "Using '$SRC' as root."
|
||||
echo "Using '$ROOT' as root."
|
||||
|
||||
echo "Preparing OpenSSL..."
|
||||
OPENSSL_SRC=$SRC/external/openssl
|
||||
OPENSSL_SRC=$ROOT/openssl-build
|
||||
if [ -d $OPENSSL_SRC ]; then
|
||||
cd $OPENSSL_SRC
|
||||
git pull
|
||||
@ -39,21 +37,35 @@ if [ -d $OPENSSL_SRC ]; then
|
||||
else
|
||||
git clone $OPENSSL_SCM $OPENSSL_SRC
|
||||
RETVAL=$?
|
||||
cd $OPENSSL_SRC
|
||||
fi
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute git command [$RETVAL]"
|
||||
exit -3
|
||||
fi
|
||||
ndk-build
|
||||
RETVAL=$?
|
||||
|
||||
cd $OPENSSL_SRC
|
||||
make clean
|
||||
# The makefile has a bug, which aborts during
|
||||
# first compilation. Rerun make to build the whole lib.
|
||||
make
|
||||
make
|
||||
RETVAL=0 # TODO: Check, why 2 is returned.
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute ndk-build command [$RETVAL]"
|
||||
echo "Failed to execute make command [$RETVAL]"
|
||||
exit -4
|
||||
fi
|
||||
|
||||
# Copy the created library to the default openssl directory,
|
||||
# so that CMake will detect it automatically.
|
||||
SSL_ROOT=`find $OPENSSL_SRC -type d -name "openssl-?.?.*"`
|
||||
rm -f $ROOT/openssl
|
||||
ln -s $SSL_ROOT $ROOT/openssl
|
||||
mkdir -p $ROOT/openssl/obj/local/armeabi/
|
||||
cp $ROOT/openssl/libssl.a $ROOT/openssl/obj/local/armeabi/
|
||||
cp $ROOT/openssl/libcrypto.a $ROOT/openssl/obj/local/armeabi/
|
||||
|
||||
echo "Preparing NDK profiler..."
|
||||
NDK_PROFILER_SRC=$SRC/external/android-ndk-profiler
|
||||
NDK_PROFILER_SRC=$ROOT/android-ndk-profiler
|
||||
if [ -d $NDK_PROFILER_SRC ]; then
|
||||
cd $NDK_PROFILER_SRC
|
||||
git pull
|
||||
@ -61,13 +73,14 @@ if [ -d $NDK_PROFILER_SRC ]; then
|
||||
else
|
||||
git clone $NDK_PROFILER_SCM $NDK_PROFILER_SRC
|
||||
RETVAL=$?
|
||||
cd $NDK_PROFILER_SRC
|
||||
fi
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute git command [$RETVAL]"
|
||||
exit -5
|
||||
fi
|
||||
ndk-build
|
||||
cd $NDK_PROFILER_SRC
|
||||
ndk-build V=1 APP_ABI=armeabi-v7a clean
|
||||
ndk-build V=1 APP_ABI=armeabi-v7a
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute ndk-build command [$RETVAL]"
|
||||
|
56
scripts/gprof_generate.sh.cmake
Executable file
56
scripts/gprof_generate.sh.cmake
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script tries to pull gprof profiling information generated by aFreeRDP
|
||||
# from the target using adb and generating human readable profiling data from
|
||||
# it.
|
||||
#
|
||||
# Any arguments supplied to the script will be appended to adb.
|
||||
#
|
||||
# Requirements:
|
||||
# - ANDROID_SDK is set to the android SDK directory or adb is in path.
|
||||
#
|
||||
|
||||
if [ -d $ANDROID_SDK ]; then
|
||||
ADB=$ANDROID_SDK/platform-tools/adb
|
||||
else
|
||||
ADB=`which adb`
|
||||
fi
|
||||
|
||||
GCC=@CMAKE_C_COMPILER@
|
||||
GPROF=${GCC/gcc/gprof}
|
||||
LIB=@CMAKE_BINARY_DIR@/client/Android/FreeRDPCore/jni/armeabi-v7a/libfreerdp-android.so
|
||||
|
||||
if [ ! -f $LIB ]; then
|
||||
echo "Missing libfreerdp-android.so"
|
||||
echo "Please build the project first."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ ! -f $GPROF ]; then
|
||||
echo "gprof could not be found at $GPROF."
|
||||
echo "Please assure, that you are using a GCC based android toolchain."
|
||||
exit -2
|
||||
fi
|
||||
|
||||
if [ ! -f $ADB ] || [ ! -x $ADB ]; then
|
||||
echo "adb could not be found."
|
||||
echo "assure, that either ANDROID_SDK is set to the path of your android SDK"
|
||||
echo "or that adb is in path."
|
||||
exit -3
|
||||
fi
|
||||
|
||||
# Do the acutal work in a temporary directory.
|
||||
SRC=`mktemp -d`
|
||||
cd $SRC
|
||||
$ADB $@ pull /sdcard/gmon.out
|
||||
if [ ! -f gmon.out ]; then
|
||||
echo "Could not pull profiling information from device!"
|
||||
RC=-4
|
||||
else
|
||||
echo "Pulled profiling information from device, starting conversion..."
|
||||
$GPROF $LIB -PprofCount -QprofCount -P__gnu_mcount_nc -Q__gnu_mcount_nc
|
||||
RC=0
|
||||
fi
|
||||
rm -rf $SRC
|
||||
|
||||
exit $RC
|
@ -10,7 +10,7 @@ set(${MODULE_PREFIX}_TESTS
|
||||
TestInitializeSecurityContext.c
|
||||
TestAcquireCredentialsHandle.c
|
||||
TestNTLM.c
|
||||
TestSchannel.c)
|
||||
)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
${${MODULE_PREFIX}_DRIVER}
|
||||
|
@ -180,13 +180,14 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
pid_t pid;
|
||||
int flags;
|
||||
int numArgs;
|
||||
LPSTR* pArgs;
|
||||
char** envp;
|
||||
LPSTR* pArgs = NULL;
|
||||
char** envp = NULL;
|
||||
char* filename = NULL;
|
||||
WINPR_THREAD* thread;
|
||||
WINPR_PROCESS* process;
|
||||
WINPR_ACCESS_TOKEN* token;
|
||||
LPTCH lpszEnvironmentBlock;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
pid = 0;
|
||||
envp = NULL;
|
||||
@ -210,6 +211,8 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
}
|
||||
|
||||
filename = FindApplicationPath(pArgs[0]);
|
||||
if (NULL == filename)
|
||||
goto finish;
|
||||
|
||||
/* fork and exec */
|
||||
|
||||
@ -218,7 +221,7 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
if (pid < 0)
|
||||
{
|
||||
/* fork failure */
|
||||
return FALSE;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (pid == 0)
|
||||
@ -252,7 +255,8 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
|
||||
if (execve(filename, pArgs, envp) < 0)
|
||||
{
|
||||
return FALSE;
|
||||
/* execve failed - end the process */
|
||||
_exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -263,7 +267,9 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
process = (WINPR_PROCESS*) malloc(sizeof(WINPR_PROCESS));
|
||||
|
||||
if (!process)
|
||||
return FALSE;
|
||||
{
|
||||
goto finish;
|
||||
}
|
||||
|
||||
ZeroMemory(process, sizeof(WINPR_PROCESS));
|
||||
|
||||
@ -278,7 +284,9 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
ZeroMemory(thread, sizeof(WINPR_THREAD));
|
||||
|
||||
if (!thread)
|
||||
return FALSE;
|
||||
{
|
||||
goto finish;
|
||||
}
|
||||
|
||||
WINPR_HANDLE_SET_TYPE(thread, HANDLE_TYPE_THREAD);
|
||||
|
||||
@ -289,7 +297,13 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
lpProcessInformation->dwProcessId = (DWORD) pid;
|
||||
lpProcessInformation->dwThreadId = (DWORD) pid;
|
||||
|
||||
free(filename);
|
||||
ret = TRUE;
|
||||
|
||||
finish:
|
||||
if (filename)
|
||||
{
|
||||
free(filename);
|
||||
}
|
||||
|
||||
if (pArgs)
|
||||
{
|
||||
@ -312,7 +326,7 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
|
||||
free(envp);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
|
Loading…
Reference in New Issue
Block a user