Merge remote-tracking branch 'upstream/master'

This commit is contained in:
C-o-r-E
2013-04-19 16:57:26 -04:00
433 changed files with 24656 additions and 7331 deletions

9
.gitignore vendored
View File

@@ -43,6 +43,11 @@ client/X11/xfreerdp.1
*.xcodeproj/
DerivedData/
# iOS
FreeRDP.build
Debug-*
Release-*
# Windows
*.vcxproj
*.vcxproj.*
@@ -80,7 +85,11 @@ xcode
Release
Win32
build/
*.orig
default.log
*Amplifier XE*
*Inspector XE*
*.cbp
*.txt.user

View File

@@ -111,6 +111,10 @@ if(MSVC)
message(STATUS "Random freeing errors are a common sign of runtime issues")
endif()
configure_msvc_runtime()
if(NOT DEFINED CMAKE_SUPPRESS_REGENERATION)
set(CMAKE_SUPPRESS_REGENERATION ON)
endif()
endif()
# Compiler-specific flags
@@ -166,22 +170,26 @@ if(MSVC)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_UNICODE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x0501")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
endif()
if(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNICODE -D_UNICODE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x0501")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
endif()
if(IOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isysroot ${CMAKE_IOS_SDK_ROOT}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isysroot ${CMAKE_IOS_SDK_ROOT} -g")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
# Include files
if(NOT IOS)
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(stdint.h HAVE_STDINT_H)
@@ -189,8 +197,19 @@ check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(sys/modem.h HAVE_SYS_MODEM_H)
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
check_include_files(sys/strtio.h HAVE_SYS_STRTIO_H)
else()
set(HAVE_FCNTL_H 1)
set(HAVE_UNISTD_H 1)
set(HAVE_STDINT_H 1)
set(HAVE_INTTYPES_H 1)
set(HAVE_SYS_FILIO_H 1)
endif()
if(NOT IOS)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
else()
set(HAVE_TM_GMTOFF 1)
endif()
# Mac OS X
if(APPLE)
@@ -199,7 +218,8 @@ if(APPLE)
message(STATUS "FREERDP_IOS_EXTERNAL_SSL_PATH not set! Required if openssl is not found in the iOS SDK (which usually isn't")
endif()
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_IOS_EXTERNAL_SSL_PATH})
else()
set_property(GLOBAL PROPERTY XCODE_ATTRIBUTE_SKIP_INSTALL YES)
else()
if(IS_DIRECTORY /opt/local/include)
include_directories(/opt/local/include)
link_directories(/opt/local/lib)
@@ -214,7 +234,11 @@ endif()
# Android
if(ANDROID)
if (NOT FREERDP_ANDROID_EXTERNAL_SSL_PATH)
message(STATUS "FREERDP_ANDROID_EXTERNAL_SSL_PATH not set! - Needs to be set if openssl is not found in the android NDK (which usually isn't)")
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
set(FREERDP_ANDROID_EXTERNAL_SSL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
else()
message(STATUS "FREERDP_ANDROID_EXTERNAL_SSL_PATH not set! - Needs to be set if openssl is not found in the android NDK (which usually isn't)")
endif()
endif()
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_ANDROID_EXTERNAL_SSL_PATH})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/client/Android/FreeRDPCore/libs/${ANDROID_ABI})
@@ -222,7 +246,7 @@ if(ANDROID)
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
if(NOT ANDROID)
if(NOT IOS AND NOT ANDROID)
find_package(Threads REQUIRED)
endif()
@@ -291,6 +315,7 @@ endif()
if(APPLE)
set(DIRECTFB_FEATURE_TYPE "DISABLED")
set(FFMPEG_FEATURE_TYPE "OPTIONAL")
set(GSTREAMER_FEATURE_TYPE "OPTIONAL")
if(IOS)
set(X11_FEATURE_TYPE "DISABLED")
set(ALSA_FEATURE_TYPE "DISABLED")
@@ -403,6 +428,13 @@ endif()
# Sub-directories
if(WITH_THIRD_PARTY)
add_subdirectory(third-party)
if (NOT "${THIRD_PARTY_INCLUDES}" STREQUAL "")
include_directories(${THIRD_PARTY_INCLUDES})
endif()
endif()
add_subdirectory(include)
add_subdirectory(libfreerdp)
@@ -411,6 +443,10 @@ if(WITH_CHANNELS)
add_subdirectory(channels)
endif()
if (IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
set(CMAKE_OSX_SYSROOT "iphoneos")
endif()
if(WITH_CLIENT)
add_subdirectory(client)
endif()
@@ -419,10 +455,6 @@ if(WITH_SERVER)
add_subdirectory(server)
endif()
if(WITH_THIRD_PARTY)
add_subdirectory(third-party)
endif()
# Packaging
SET(CPACK_BINARY_ZIP "ON")
@@ -529,4 +561,6 @@ if (ANDROID AND CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4")
message(STATUS "Disabled CXX system defines for eclipse (workaround).")
endif()
include(CPack)

View File

@@ -26,13 +26,14 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/cmdline.h>
#include <alsa/asoundlib.h>
#include <freerdp/addin.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/utils/thread.h>
#include <freerdp/channels/rdpsnd.h>
#include "audin_main.h"
@@ -54,7 +55,8 @@ typedef struct _AudinALSADevice
FREERDP_DSP_CONTEXT* dsp_context;
freerdp_thread* thread;
HANDLE thread;
HANDLE stopEvent;
BYTE* buffer;
int buffer_frames;
@@ -128,7 +130,7 @@ static BOOL audin_alsa_thread_receive(AudinALSADevice* alsa, BYTE* src, int size
while (frames > 0)
{
if (freerdp_thread_is_stopped(alsa->thread))
if (WaitForSingleObject(alsa->stopEvent, 0) == WAIT_OBJECT_0)
break;
cframes = alsa->frames_per_packet - alsa->buffer_frames;
@@ -160,7 +162,7 @@ static BOOL audin_alsa_thread_receive(AudinALSADevice* alsa, BYTE* src, int size
encoded_size = alsa->buffer_frames * tbytes_per_frame;
}
if (freerdp_thread_is_stopped(alsa->thread))
if (WaitForSingleObject(alsa->stopEvent, 0) == WAIT_OBJECT_0)
{
ret = 0;
frames = 0;
@@ -210,14 +212,16 @@ static void* audin_alsa_thread_func(void* arg)
DEBUG_WARN("snd_pcm_open (%s)", snd_strerror(error));
break;
}
if (!audin_alsa_set_params(alsa, capture_handle))
{
break;
}
while (!freerdp_thread_is_stopped(alsa->thread))
while (!(WaitForSingleObject(alsa->stopEvent, 0) == WAIT_OBJECT_0))
{
error = snd_pcm_readi(capture_handle, buffer, alsa->frames_per_packet);
if (error == -EPIPE)
{
snd_pcm_recover(capture_handle, error, 0);
@@ -228,10 +232,12 @@ static void* audin_alsa_thread_func(void* arg)
DEBUG_WARN("snd_pcm_readi (%s)", snd_strerror(error));
break;
}
if (!audin_alsa_thread_receive(alsa, buffer, error * rbytes_per_frame))
break;
}
} while (0);
}
while (0);
free(buffer);
@@ -241,7 +247,7 @@ static void* audin_alsa_thread_func(void* arg)
if (capture_handle)
snd_pcm_close(capture_handle);
freerdp_thread_quit(alsa->thread);
SetEvent(alsa->stopEvent);
DEBUG_DVC("out");
@@ -252,7 +258,8 @@ static void audin_alsa_free(IAudinDevice* device)
{
AudinALSADevice* alsa = (AudinALSADevice*) device;
freerdp_thread_free(alsa->thread);
SetEvent(alsa->stopEvent);
freerdp_dsp_context_free(alsa->dsp_context);
free(alsa->device_name);
@@ -337,7 +344,8 @@ static void audin_alsa_open(IAudinDevice* device, AudinReceive receive, void* us
alsa->receive = receive;
alsa->user_data = user_data;
freerdp_thread_start(alsa->thread, audin_alsa_thread_func, alsa);
alsa->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
alsa->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) audin_alsa_thread_func, alsa, 0, NULL);
}
static void audin_alsa_close(IAudinDevice* device)
@@ -346,7 +354,7 @@ static void audin_alsa_close(IAudinDevice* device)
DEBUG_DVC("");
freerdp_thread_stop(alsa->thread);
SetEvent(alsa->stopEvent);
alsa->receive = NULL;
alsa->user_data = NULL;
@@ -420,7 +428,6 @@ int freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEnt
alsa->target_channels = 2;
alsa->actual_channels = 2;
alsa->bytes_per_channel = 2;
alsa->thread = freerdp_thread_new();
alsa->dsp_context = freerdp_dsp_context_new();

View File

@@ -30,7 +30,7 @@
#include <freerdp/addin.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include "audin_main.h"
@@ -87,10 +87,10 @@ struct _AUDIN_PLUGIN
IAudinDevice* device;
};
static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, STREAM* s)
static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, wStream* s)
{
int error;
STREAM* out;
wStream* out;
UINT32 Version;
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
@@ -116,14 +116,14 @@ static int audin_send_incoming_data_pdu(IWTSVirtualChannelCallback* pChannelCall
return callback->channel->Write(callback->channel, 1, out_data, NULL);
}
static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, STREAM* s)
static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, wStream* s)
{
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin;
UINT32 i;
BYTE* fm;
int error;
STREAM* out;
wStream* out;
UINT32 NumFormats;
audinFormat format;
UINT32 cbSizeFormatsPacket;
@@ -198,7 +198,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S
static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCallback, UINT32 NewFormat)
{
int error;
STREAM* out;
wStream* out;
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
out = stream_new(5);
@@ -213,7 +213,7 @@ static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCall
static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallback, UINT32 Result)
{
int error;
STREAM* out;
wStream* out;
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
out = stream_new(5);
@@ -228,7 +228,7 @@ static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallbac
static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data)
{
int error;
STREAM* out;
wStream* out;
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) user_data;
error = audin_send_incoming_data_pdu((IWTSVirtualChannelCallback*) callback);
@@ -245,7 +245,7 @@ static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data)
return (error == 0 ? TRUE : FALSE);
}
static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, STREAM* s)
static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, wStream* s)
{
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin;
@@ -279,7 +279,7 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, STRE
return 0;
}
static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallback, STREAM* s)
static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallback, wStream* s)
{
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
AUDIN_PLUGIN * audin = (AUDIN_PLUGIN*) callback->plugin;
@@ -314,7 +314,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 cbSize, BYTE* pBuffer)
{
int error;
STREAM* s;
wStream* s;
BYTE MessageId;
s = stream_new(0);

View File

@@ -26,31 +26,37 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/utils/thread.h>
#include <freerdp/utils/stream.h>
#include <freerdp/codec/audio.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/server/audin.h>
#define MSG_SNDIN_VERSION 0x01
#define MSG_SNDIN_FORMATS 0x02
#define MSG_SNDIN_OPEN 0x03
#define MSG_SNDIN_OPEN_REPLY 0x04
#define MSG_SNDIN_DATA_INCOMING 0x05
#define MSG_SNDIN_DATA 0x06
#define MSG_SNDIN_FORMATCHANGE 0x07
#define MSG_SNDIN_VERSION 0x01
#define MSG_SNDIN_FORMATS 0x02
#define MSG_SNDIN_OPEN 0x03
#define MSG_SNDIN_OPEN_REPLY 0x04
#define MSG_SNDIN_DATA_INCOMING 0x05
#define MSG_SNDIN_DATA 0x06
#define MSG_SNDIN_FORMATCHANGE 0x07
typedef struct _audin_server
{
audin_server_context context;
BOOL opened;
HANDLE event;
HANDLE stopEvent;
HANDLE thread;
void* audin_channel;
freerdp_thread* audin_channel_thread;
FREERDP_DSP_CONTEXT* dsp_context;
BOOL opened;
} audin_server;
static void audin_server_select_format(audin_server_context* context, int client_format_index)
@@ -59,34 +65,38 @@ static void audin_server_select_format(audin_server_context* context, int client
if (client_format_index >= context->num_client_formats)
return;
context->selected_client_format = client_format_index;
if (audin->opened)
{
/* TODO: send MSG_SNDIN_FORMATCHANGE */
}
}
static void audin_server_send_version(audin_server* audin, STREAM* s)
static void audin_server_send_version(audin_server* audin, wStream* s)
{
stream_write_BYTE(s, MSG_SNDIN_VERSION);
stream_write_UINT32(s, 1); /* Version (4 bytes) */
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
}
static BOOL audin_server_recv_version(audin_server* audin, STREAM* s, UINT32 length)
static BOOL audin_server_recv_version(audin_server* audin, wStream* s, UINT32 length)
{
UINT32 Version;
if (length < 4)
return FALSE;
stream_read_UINT32(s, Version);
if (Version < 1)
return FALSE;
return TRUE;
}
static void audin_server_send_formats(audin_server* audin, STREAM* s)
static void audin_server_send_formats(audin_server* audin, wStream* s)
{
int i;
UINT32 nAvgBytesPerSec;
@@ -120,7 +130,7 @@ static void audin_server_send_formats(audin_server* audin, STREAM* s)
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
}
static BOOL audin_server_recv_formats(audin_server* audin, STREAM* s, UINT32 length)
static BOOL audin_server_recv_formats(audin_server* audin, wStream* s, UINT32 length)
{
int i;
@@ -164,7 +174,7 @@ static BOOL audin_server_recv_formats(audin_server* audin, STREAM* s, UINT32 len
return TRUE;
}
static void audin_server_send_open(audin_server* audin, STREAM* s)
static void audin_server_send_open(audin_server* audin, wStream* s)
{
if (audin->context.selected_client_format < 0)
return;
@@ -191,12 +201,13 @@ static void audin_server_send_open(audin_server* audin, STREAM* s)
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL);
}
static BOOL audin_server_recv_open_reply(audin_server* audin, STREAM* s, UINT32 length)
static BOOL audin_server_recv_open_reply(audin_server* audin, wStream* s, UINT32 length)
{
UINT32 Result;
if (length < 4)
return FALSE;
stream_read_UINT32(s, Result);
IFCALL(audin->context.OpenResult, &audin->context, Result);
@@ -204,7 +215,7 @@ static BOOL audin_server_recv_open_reply(audin_server* audin, STREAM* s, UINT32
return TRUE;
}
static BOOL audin_server_recv_data(audin_server* audin, STREAM* s, UINT32 length)
static BOOL audin_server_recv_data(audin_server* audin, wStream* s, UINT32 length)
{
AUDIO_FORMAT* format;
int sbytes_per_sample;
@@ -218,7 +229,7 @@ static BOOL audin_server_recv_data(audin_server* audin, STREAM* s, UINT32 length
format = &audin->context.client_formats[audin->context.selected_client_format];
if (format->wFormatTag == 2)
if (format->wFormatTag == WAVE_FORMAT_ADPCM)
{
audin->dsp_context->decode_ms_adpcm(audin->dsp_context,
stream_get_tail(s), length, format->nChannels, format->nBlockAlign);
@@ -227,7 +238,7 @@ static BOOL audin_server_recv_data(audin_server* audin, STREAM* s, UINT32 length
sbytes_per_sample = 2;
sbytes_per_frame = format->nChannels * 2;
}
else if (format->wFormatTag == 0x11)
else if (format->wFormatTag == WAVE_FORMAT_DVI_ADPCM)
{
audin->dsp_context->decode_ima_adpcm(audin->dsp_context,
stream_get_tail(s), length, format->nChannels, format->nBlockAlign);
@@ -265,29 +276,28 @@ static BOOL audin_server_recv_data(audin_server* audin, STREAM* s, UINT32 length
static void* audin_server_thread_func(void* arg)
{
void* fd;
STREAM* s;
wStream* s;
void* buffer;
BYTE MessageId;
BOOL ready = FALSE;
UINT32 bytes_returned = 0;
audin_server* audin = (audin_server*) arg;
freerdp_thread* thread = audin->audin_channel_thread;
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE)
{
fd = *((void**) buffer);
WTSFreeMemory(buffer);
thread->signals[thread->num_signals++] = CreateWaitObjectEvent(NULL, TRUE, FALSE, fd);
audin->event = CreateWaitObjectEvent(NULL, TRUE, FALSE, fd);
}
/* Wait for the client to confirm that the Audio Input dynamic channel is ready */
while (1)
{
if (freerdp_thread_wait(thread) < 0)
break;
WaitForSingleObject(audin->event, INFINITE);
if (freerdp_thread_is_stopped(thread))
if (WaitForSingleObject(audin->stopEvent, 0) == WAIT_OBJECT_0)
break;
if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualChannelReady, &buffer, &bytes_returned) == FALSE)
@@ -310,10 +320,9 @@ static void* audin_server_thread_func(void* arg)
while (ready)
{
if (freerdp_thread_wait(thread) < 0)
break;
if (freerdp_thread_is_stopped(thread))
WaitForSingleObject(audin->event, INFINITE);
if (WaitForSingleObject(audin->stopEvent, 0) == WAIT_OBJECT_0)
break;
stream_set_pos(s, 0);
@@ -330,11 +339,13 @@ static void* audin_server_thread_func(void* arg)
stream_get_size(s), &bytes_returned) == FALSE)
break;
}
if (bytes_returned < 1)
continue;
stream_read_BYTE(s, MessageId);
bytes_returned--;
switch (MessageId)
{
case MSG_SNDIN_VERSION:
@@ -362,7 +373,7 @@ static void* audin_server_thread_func(void* arg)
break;
default:
printf("audin_server_thread_func: unknown MessageId %d\n", MessageId);
fprintf(stderr, "audin_server_thread_func: unknown MessageId %d\n", MessageId);
break;
}
}
@@ -370,7 +381,6 @@ static void* audin_server_thread_func(void* arg)
stream_free(s);
WTSVirtualChannelClose(audin->audin_channel);
audin->audin_channel = NULL;
freerdp_thread_quit(thread);
return NULL;
}
@@ -379,15 +389,17 @@ static BOOL audin_server_open(audin_server_context* context)
{
audin_server* audin = (audin_server*) context;
if (audin->audin_channel_thread == NULL)
if (!audin->thread)
{
audin->audin_channel = WTSVirtualChannelOpenEx(context->vcm, "AUDIO_INPUT", WTS_CHANNEL_OPTION_DYNAMIC);
if (audin->audin_channel == NULL)
if (!audin->audin_channel)
return FALSE;
audin->audin_channel_thread = freerdp_thread_new();
freerdp_thread_start(audin->audin_channel_thread, audin_server_thread_func, audin);
audin->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
audin->thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) audin_server_thread_func, (void*) audin, 0, NULL);
return TRUE;
}
@@ -399,17 +411,20 @@ static BOOL audin_server_close(audin_server_context* context)
{
audin_server* audin = (audin_server*) context;
if (audin->audin_channel_thread)
if (audin->thread)
{
freerdp_thread_stop(audin->audin_channel_thread);
freerdp_thread_free(audin->audin_channel_thread);
audin->audin_channel_thread = NULL;
SetEvent(audin->stopEvent);
WaitForSingleObject(audin->thread, INFINITE);
CloseHandle(audin->thread);
audin->thread = NULL;
}
if (audin->audin_channel)
{
WTSVirtualChannelClose(audin->audin_channel);
audin->audin_channel = NULL;
}
audin->context.selected_client_format = -1;
return TRUE;

View File

@@ -21,6 +21,8 @@ set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT")
set(${MODULE_PREFIX}_SRCS
tables.c
tables.h
addin.c
addin.h
channels.c)
list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES)

335
channels/client/addin.c Normal file
View File

@@ -0,0 +1,335 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Channel Addins
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/path.h>
#include <winpr/file.h>
#include <winpr/synch.h>
#include <winpr/library.h>
#include <winpr/collections.h>
#include <freerdp/addin.h>
#include <freerdp/client/channels.h>
#include "tables.h"
#include "addin.h"
extern const STATIC_ENTRY_TABLE CLIENT_STATIC_ENTRY_TABLES[];
void* freerdp_channels_find_static_entry_in_table(const STATIC_ENTRY_TABLE* table, const char* identifier)
{
int index = 0;
STATIC_ENTRY* pEntry;
pEntry = (STATIC_ENTRY*) &table->table[index++];
while (pEntry->entry != NULL)
{
if (strcmp(pEntry->name, identifier) == 0)
{
return (void*) pEntry->entry;
}
pEntry = (STATIC_ENTRY*) &table->table[index++];
}
return NULL;
}
void* freerdp_channels_client_find_static_entry(const char* name, const char* identifier)
{
int index = 0;
STATIC_ENTRY_TABLE* pEntry;
pEntry = (STATIC_ENTRY_TABLE*) &CLIENT_STATIC_ENTRY_TABLES[index++];
while (pEntry->table != NULL)
{
if (strcmp(pEntry->name, name) == 0)
{
return freerdp_channels_find_static_entry_in_table(pEntry, identifier);
}
pEntry = (STATIC_ENTRY_TABLE*) &CLIENT_STATIC_ENTRY_TABLES[index++];
}
return NULL;
}
extern const STATIC_ADDIN_TABLE CLIENT_STATIC_ADDIN_TABLE[];
FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPSTR pszName, LPSTR pszSubsystem, LPSTR pszType, DWORD dwFlags)
{
int i, j;
DWORD nAddins;
FREERDP_ADDIN* pAddin;
FREERDP_ADDIN** ppAddins = NULL;
STATIC_SUBSYSTEM_ENTRY* subsystems;
nAddins = 0;
ppAddins = (FREERDP_ADDIN**) malloc(sizeof(FREERDP_ADDIN*) * 128);
ppAddins[nAddins] = NULL;
for (i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
{
pAddin = (FREERDP_ADDIN*) malloc(sizeof(FREERDP_ADDIN));
ZeroMemory(pAddin, sizeof(FREERDP_ADDIN));
strcpy(pAddin->cName, CLIENT_STATIC_ADDIN_TABLE[i].name);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
ppAddins[nAddins++] = pAddin;
subsystems = (STATIC_SUBSYSTEM_ENTRY*) CLIENT_STATIC_ADDIN_TABLE[i].table;
for (j = 0; subsystems[j].name != NULL; j++)
{
pAddin = (FREERDP_ADDIN*) malloc(sizeof(FREERDP_ADDIN));
ZeroMemory(pAddin, sizeof(FREERDP_ADDIN));
strcpy(pAddin->cName, CLIENT_STATIC_ADDIN_TABLE[i].name);
strcpy(pAddin->cSubsystem, subsystems[j].name);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
ppAddins[nAddins++] = pAddin;
}
}
ppAddins[nAddins] = NULL;
return ppAddins;
}
FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPSTR pszName, LPSTR pszSubsystem, LPSTR pszType, DWORD dwFlags)
{
int index;
int nDashes;
HANDLE hFind;
DWORD nAddins;
LPSTR pszPattern;
size_t cchPattern;
LPCSTR pszAddinPath = FREERDP_ADDIN_PATH;
LPCSTR pszInstallPrefix = FREERDP_INSTALL_PREFIX;
LPCSTR pszExtension;
LPSTR pszSearchPath;
size_t cchSearchPath;
size_t cchAddinPath;
size_t cchInstallPrefix;
FREERDP_ADDIN** ppAddins;
WIN32_FIND_DATAA FindData;
cchAddinPath = strlen(pszAddinPath);
cchInstallPrefix = strlen(pszInstallPrefix);
pszExtension = PathGetSharedLibraryExtensionA(0);
cchPattern = 128 + strlen(pszExtension) + 2;
pszPattern = (LPSTR) malloc(cchPattern + 1);
if (pszName && pszSubsystem && pszType)
{
sprintf_s(pszPattern, cchPattern, "%s-client-%s-%s.%s", pszName, pszSubsystem, pszType, pszExtension);
}
else if (pszName && pszType)
{
sprintf_s(pszPattern, cchPattern, "%s-client-?-%s.%s", pszName, pszType, pszExtension);
}
else if (pszName)
{
sprintf_s(pszPattern, cchPattern, "%s-client*.%s", pszName, pszExtension);
}
else
{
sprintf_s(pszPattern, cchPattern, "?-client*.%s", pszExtension);
}
cchPattern = strlen(pszPattern);
cchSearchPath = cchInstallPrefix + cchAddinPath + cchPattern + 3;
pszSearchPath = (LPSTR) malloc(cchSearchPath + 1);
CopyMemory(pszSearchPath, pszInstallPrefix, cchInstallPrefix);
pszSearchPath[cchInstallPrefix] = '\0';
NativePathCchAppendA(pszSearchPath, cchSearchPath + 1, pszAddinPath);
NativePathCchAppendA(pszSearchPath, cchSearchPath + 1, pszPattern);
cchSearchPath = strlen(pszSearchPath);
hFind = FindFirstFileA(pszSearchPath, &FindData);
nAddins = 0;
ppAddins = (FREERDP_ADDIN**) malloc(sizeof(FREERDP_ADDIN*) * 128);
ppAddins[nAddins] = NULL;
if (hFind == INVALID_HANDLE_VALUE)
return ppAddins;
do
{
char* p[5];
FREERDP_ADDIN* pAddin;
nDashes = 0;
pAddin = (FREERDP_ADDIN*) malloc(sizeof(FREERDP_ADDIN));
ZeroMemory(pAddin, sizeof(FREERDP_ADDIN));
for (index = 0; FindData.cFileName[index]; index++)
nDashes += (FindData.cFileName[index] == '-') ? 1 : 0;
if (nDashes == 1)
{
/* <name>-client.<extension> */
p[0] = FindData.cFileName;
p[1] = strchr(p[0], '-') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
ppAddins[nAddins++] = pAddin;
}
else if (nDashes == 2)
{
/* <name>-client-<subsystem>.<extension> */
p[0] = FindData.cFileName;
p[1] = strchr(p[0], '-') + 1;
p[2] = strchr(p[1], '-') + 1;
p[3] = strchr(p[2], '.') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
ppAddins[nAddins++] = pAddin;
}
else if (nDashes == 3)
{
/* <name>-client-<subsystem>-<type>.<extension> */
p[0] = FindData.cFileName;
p[1] = strchr(p[0], '-') + 1;
p[2] = strchr(p[1], '-') + 1;
p[3] = strchr(p[2], '-') + 1;
p[4] = strchr(p[3], '.') + 1;
strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);
strncpy(pAddin->cType, p[3], (p[4] - p[3]) - 1);
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
pAddin->dwFlags |= FREERDP_ADDIN_TYPE;
ppAddins[nAddins++] = pAddin;
}
else
{
free(pAddin);
}
}
while (FindNextFileA(hFind, &FindData));
FindClose(hFind);
ppAddins[nAddins] = NULL;
return ppAddins;
}
FREERDP_ADDIN** freerdp_channels_list_addins(LPSTR pszName, LPSTR pszSubsystem, LPSTR pszType, DWORD dwFlags)
{
if (dwFlags & FREERDP_ADDIN_STATIC)
return freerdp_channels_list_client_static_addins(pszName, pszSubsystem, pszType, dwFlags);
else if (dwFlags & FREERDP_ADDIN_DYNAMIC)
return freerdp_channels_list_dynamic_addins(pszName, pszSubsystem, pszType, dwFlags);
return NULL;
}
void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins)
{
int index;
for (index = 0; ppAddins[index] != NULL; index++)
free(ppAddins[index]);
free(ppAddins);
}
void* freerdp_channels_load_static_addin_entry(LPCSTR pszName, LPSTR pszSubsystem, LPSTR pszType, DWORD dwFlags)
{
int i, j;
STATIC_SUBSYSTEM_ENTRY* subsystems;
for (i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
{
if (strcmp(CLIENT_STATIC_ADDIN_TABLE[i].name, pszName) == 0)
{
if (pszSubsystem != NULL)
{
subsystems = (STATIC_SUBSYSTEM_ENTRY*) CLIENT_STATIC_ADDIN_TABLE[i].table;
for (j = 0; subsystems[j].name != NULL; j++)
{
if (strcmp(subsystems[j].name, pszSubsystem) == 0)
{
if (pszType)
{
if (strcmp(subsystems[j].type, pszType) == 0)
return (void*) subsystems[j].entry;
}
else
{
return (void*) subsystems[j].entry;
}
}
}
}
else
{
return (void*) CLIENT_STATIC_ADDIN_TABLE[i].entry;
}
}
}
return NULL;
}

20
channels/client/addin.h Normal file
View File

@@ -0,0 +1,20 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Channel Addins
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,7 @@
void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIST_EVENT* cb_event)
{
int i;
STREAM* s;
wStream* s;
DEBUG_CLIPRDR("Sending Clipboard Format List");
@@ -57,7 +57,7 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
}
else
{
STREAM* body = stream_new(0);
wStream* body = stream_new(0);
for (i = 0; i < cb_event->num_formats; i++)
{
@@ -79,7 +79,9 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
name = CFSTR_GIF; name_length = sizeof(CFSTR_GIF);
break;
default:
name = "\0\0"; name_length = 2;
name = "\0\0";
name_length = 2;
break;
}
if (!cliprdr->use_long_format_names)
@@ -101,13 +103,13 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
static void cliprdr_send_format_list_response(cliprdrPlugin* cliprdr)
{
STREAM* s;
wStream* s;
DEBUG_CLIPRDR("Sending Clipboard Format List Response");
s = cliprdr_packet_new(CB_FORMAT_LIST_RESPONSE, CB_RESPONSE_OK, 0);
cliprdr_packet_send(cliprdr, s);
}
void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT32 length, UINT16 flags)
void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT32 length, UINT16 flags)
{
int i;
BOOL ascii;
@@ -139,20 +141,20 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT3
if (ascii)
{
format_name->name = _strdup((char*) s->p);
format_name->name = _strdup((char*) s->pointer);
format_name->length = strlen(format_name->name);
}
else
{
format_name->name = NULL;
format_name->length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) s->p, 32 / 2, &format_name->name, 0, NULL, NULL);
format_name->length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) s->pointer, 32 / 2, &format_name->name, 0, NULL, NULL);
}
stream_seek(s, 32);
}
}
void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT32 length, UINT16 flags)
void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT32 length, UINT16 flags)
{
int allocated_formats = 8;
BYTE* end_mark;
@@ -194,7 +196,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT32
}
}
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
{
int i;
UINT32 format;
@@ -202,8 +204,8 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataL
CLIPRDR_FORMAT_NAME* format_name;
RDP_CB_FORMAT_LIST_EVENT* cb_event;
cb_event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR,
RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
cb_event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_FormatList, NULL, NULL);
if (dataLen > 0)
{
@@ -282,15 +284,15 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataL
cliprdr->num_format_names = 0;
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (RDP_EVENT*) cb_event);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (wMessage*) cb_event);
cliprdr_send_format_list_response(cliprdr);
}
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
{
/* where is this documented? */
#if 0
RDP_EVENT* event;
wMessage* event;
if ((msgFlags & CB_RESPONSE_FAIL) != 0)
{
@@ -300,20 +302,20 @@ void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, UIN
#endif
}
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
{
RDP_CB_DATA_REQUEST_EVENT* cb_event;
cb_event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR,
RDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL);
cb_event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_DataRequest, NULL, NULL);
stream_read_UINT32(s, cb_event->format);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (RDP_EVENT*) cb_event);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (wMessage*) cb_event);
}
void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, RDP_CB_DATA_RESPONSE_EVENT* cb_event)
{
STREAM* s;
wStream* s;
DEBUG_CLIPRDR("Sending Format Data Response");
@@ -332,7 +334,7 @@ void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, RDP_CB_D
void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DATA_REQUEST_EVENT* cb_event)
{
STREAM* s;
wStream* s;
DEBUG_CLIPRDR("Sending Format Data Request");
@@ -341,19 +343,19 @@ void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DA
cliprdr_packet_send(cliprdr, s);
}
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags)
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
{
RDP_CB_DATA_RESPONSE_EVENT* cb_event;
cb_event = (RDP_CB_DATA_RESPONSE_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR,
RDP_EVENT_TYPE_CB_DATA_RESPONSE, NULL, NULL);
cb_event = (RDP_CB_DATA_RESPONSE_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_DataResponse, NULL, NULL);
if (dataLen > 0)
{
cb_event->size = dataLen;
cb_event->data = (BYTE*) malloc(dataLen);
memcpy(cb_event->data, stream_get_tail(s), dataLen);
CopyMemory(cb_event->data, stream_get_tail(s), dataLen);
}
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (RDP_EVENT*) cb_event);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (wMessage*) cb_event);
}

View File

@@ -22,13 +22,13 @@
#define __CLIPRDR_FORMAT_H
void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIST_EVENT* cb_event);
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, RDP_CB_DATA_RESPONSE_EVENT* cb_event);
void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DATA_REQUEST_EVENT* cb_event);
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, UINT32 dataLen, UINT16 msgFlags);
void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags);
#endif /* __CLIPRDR_FORMAT_H */

View File

@@ -53,9 +53,9 @@ static const char* const CB_MSG_TYPE_STRINGS[] =
"CB_UNLOCK_CLIPDATA"
};
STREAM* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen)
wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen)
{
STREAM* s;
wStream* s;
s = stream_new(dataLen + 8);
stream_write_UINT16(s, msgType);
@@ -66,7 +66,7 @@ STREAM* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen)
return s;
}
void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* s)
void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
{
int pos;
UINT32 dataLen;
@@ -87,21 +87,21 @@ static void cliprdr_process_connect(rdpSvcPlugin* plugin)
void cliprdr_print_general_capability_flags(UINT32 flags)
{
printf("generalFlags (0x%08X) {\n", flags);
fprintf(stderr, "generalFlags (0x%08X) {\n", flags);
if (flags & CB_USE_LONG_FORMAT_NAMES)
printf("\tCB_USE_LONG_FORMAT_NAMES\n");
fprintf(stderr, "\tCB_USE_LONG_FORMAT_NAMES\n");
if (flags & CB_STREAM_FILECLIP_ENABLED)
printf("\tCB_STREAM_FILECLIP_ENABLED\n");
fprintf(stderr, "\tCB_STREAM_FILECLIP_ENABLED\n");
if (flags & CB_FILECLIP_NO_FILE_PATHS)
printf("\tCB_FILECLIP_NO_FILE_PATHS\n");
fprintf(stderr, "\tCB_FILECLIP_NO_FILE_PATHS\n");
if (flags & CB_CAN_LOCK_CLIPDATA)
printf("\tCB_CAN_LOCK_CLIPDATA\n");
fprintf(stderr, "\tCB_CAN_LOCK_CLIPDATA\n");
printf("}\n");
fprintf(stderr, "}\n");
}
static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, STREAM* s)
static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, wStream* s)
{
UINT32 version;
UINT32 generalFlags;
@@ -130,7 +130,7 @@ static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, STREAM* s
cliprdr->received_caps = TRUE;
}
static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, STREAM* s, UINT16 length, UINT16 flags)
static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s, UINT16 length, UINT16 flags)
{
int i;
UINT16 lengthCapability;
@@ -162,7 +162,7 @@ static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, STREAM* s, UINT16
static void cliprdr_send_clip_caps(cliprdrPlugin* cliprdr)
{
STREAM* s;
wStream* s;
UINT32 flags;
s = cliprdr_packet_new(CB_CLIP_CAPS, 0, 4 + CB_CAPSTYPE_GENERAL_LEN);
@@ -181,18 +181,19 @@ static void cliprdr_send_clip_caps(cliprdrPlugin* cliprdr)
cliprdr_packet_send(cliprdr, s);
}
static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, STREAM* s, UINT16 length, UINT16 flags)
static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, wStream* s, UINT16 length, UINT16 flags)
{
RDP_EVENT* event;
wMessage* event;
if (cliprdr->received_caps)
cliprdr_send_clip_caps(cliprdr);
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_MONITOR_READY, NULL, NULL);
event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_MonitorReady, NULL, NULL);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, event);
}
static void cliprdr_process_receive(rdpSvcPlugin* plugin, STREAM* s)
static void cliprdr_process_receive(rdpSvcPlugin* plugin, wStream* s)
{
UINT16 msgType;
UINT16 msgFlags;
@@ -240,24 +241,24 @@ static void cliprdr_process_receive(rdpSvcPlugin* plugin, STREAM* s)
stream_free(s);
}
static void cliprdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
static void cliprdr_process_event(rdpSvcPlugin* plugin, wMessage* event)
{
switch (event->event_type)
switch (GetMessageType(event->id))
{
case RDP_EVENT_TYPE_CB_FORMAT_LIST:
case CliprdrChannel_FormatList:
cliprdr_process_format_list_event((cliprdrPlugin*) plugin, (RDP_CB_FORMAT_LIST_EVENT*) event);
break;
case RDP_EVENT_TYPE_CB_DATA_REQUEST:
case CliprdrChannel_DataRequest:
cliprdr_process_format_data_request_event((cliprdrPlugin*) plugin, (RDP_CB_DATA_REQUEST_EVENT*) event);
break;
case RDP_EVENT_TYPE_CB_DATA_RESPONSE:
case CliprdrChannel_DataResponse:
cliprdr_process_format_data_response_event((cliprdrPlugin*) plugin, (RDP_CB_DATA_RESPONSE_EVENT*) event);
break;
default:
DEBUG_WARN("unknown event type %d", event->event_type);
DEBUG_WARN("unknown event type %d", GetMessageType(event->id));
break;
}
@@ -269,12 +270,37 @@ static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
free(plugin);
}
/**
* Callback Interface
*/
int cliprdr_monitor_ready(CliprdrClientContext* context)
{
return 0;
}
int cliprdr_format_list(CliprdrClientContext* context)
{
return 0;
}
int cliprdr_data_request(CliprdrClientContext* context)
{
return 0;
}
int cliprdr_data_response(CliprdrClientContext* context)
{
return 0;
}
/* cliprdr is always built-in */
#define VirtualChannelEntry cliprdr_VirtualChannelEntry
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
{
cliprdrPlugin* _p;
CliprdrClientContext* context;
_p = (cliprdrPlugin*) malloc(sizeof(cliprdrPlugin));
ZeroMemory(_p, sizeof(cliprdrPlugin));
@@ -292,6 +318,15 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
_p->plugin.event_callback = cliprdr_process_event;
_p->plugin.terminate_callback = cliprdr_process_terminate;
context = (CliprdrClientContext*) malloc(sizeof(CliprdrClientContext));
context->MonitorReady = cliprdr_monitor_ready;
context->FormatList = cliprdr_format_list;
context->DataRequest = cliprdr_data_request;
context->DataResponse = cliprdr_data_response;
_p->plugin.channel_entry_points.pInterface = (void*) context;
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
return 1;

View File

@@ -21,8 +21,9 @@
#ifndef __CLIPRDR_MAIN_H
#define __CLIPRDR_MAIN_H
#include <winpr/stream.h>
#include <freerdp/utils/debug.h>
#include <freerdp/utils/stream.h>
struct _CLIPRDR_FORMAT_NAME
{
@@ -45,8 +46,8 @@ struct cliprdr_plugin
};
typedef struct cliprdr_plugin cliprdrPlugin;
STREAM* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen);
void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* data_out);
wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen);
void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* data_out);
#ifdef WITH_DEBUG_CLIPRDR
#define DEBUG_CLIPRDR(fmt, ...) DEBUG_CLASS(CLIPRDR, fmt, ## __VA_ARGS__)

View File

@@ -28,7 +28,7 @@
#include <winpr/crt.h>
#include <freerdp/constants.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/svc_plugin.h>
#include "dvcman.h"
@@ -55,7 +55,7 @@ struct drdynvc_plugin
IWTSVirtualChannelManager* channel_mgr;
};
static int drdynvc_write_variable_uint(STREAM* stream, UINT32 val)
static int drdynvc_write_variable_uint(wStream* stream, UINT32 val)
{
int cb;
@@ -80,7 +80,7 @@ static int drdynvc_write_variable_uint(STREAM* stream, UINT32 val)
int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UINT32 data_size)
{
STREAM* data_out;
wStream* data_out;
UINT32 pos = 0;
UINT32 cbChId;
UINT32 cbLen;
@@ -158,7 +158,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
return 0;
}
int drdynvc_push_event(drdynvcPlugin* drdynvc, RDP_EVENT* event)
int drdynvc_push_event(drdynvcPlugin* drdynvc, wMessage* event)
{
int error;
@@ -173,9 +173,9 @@ int drdynvc_push_event(drdynvcPlugin* drdynvc, RDP_EVENT* event)
return 0;
}
static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
{
STREAM* data_out;
wStream* data_out;
int error;
DEBUG_DVC("Sp=%d cbChId=%d", Sp, cbChId);
@@ -206,7 +206,7 @@ static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, in
return 0;
}
static UINT32 drdynvc_read_variable_uint(STREAM* stream, int cbLen)
static UINT32 drdynvc_read_variable_uint(wStream* stream, int cbLen)
{
UINT32 val;
@@ -228,12 +228,12 @@ static UINT32 drdynvc_read_variable_uint(STREAM* stream, int cbLen)
return val;
}
static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
{
int pos;
int error;
UINT32 ChannelId;
STREAM* data_out;
wStream* data_out;
ChannelId = drdynvc_read_variable_uint(s, cbChId);
pos = stream_get_pos(s);
@@ -268,7 +268,7 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb
return 0;
}
static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
{
int error;
UINT32 Length;
@@ -287,7 +287,7 @@ static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId
stream_get_tail(s), stream_get_left(s));
}
static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
{
UINT32 ChannelId;
@@ -298,7 +298,7 @@ static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, STRE
stream_get_tail(s), stream_get_left(s));
}
static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s)
static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStream* s)
{
UINT32 ChannelId;
@@ -309,7 +309,7 @@ static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbC
return 0;
}
static void drdynvc_process_receive(rdpSvcPlugin* plugin, STREAM* s)
static void drdynvc_process_receive(rdpSvcPlugin* plugin, wStream* s)
{
int value;
int Cmd;
@@ -372,7 +372,7 @@ static void drdynvc_process_connect(rdpSvcPlugin* plugin)
dvcman_init(drdynvc->channel_mgr);
}
static void drdynvc_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
static void drdynvc_process_event(rdpSvcPlugin* plugin, wMessage* event)
{
freerdp_event_free(event);
}

View File

@@ -25,6 +25,6 @@
typedef struct drdynvc_plugin drdynvcPlugin;
int drdynvc_write_data(drdynvcPlugin* plugin, UINT32 ChannelId, BYTE* data, UINT32 data_size);
int drdynvc_push_event(drdynvcPlugin* plugin, RDP_EVENT* event);
int drdynvc_push_event(drdynvcPlugin* plugin, wMessage* event);
#endif

View File

@@ -30,7 +30,7 @@
#include <freerdp/addin.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/list.h>
#include "drdynvc_types.h"
@@ -86,7 +86,7 @@ struct _DVCMAN_CHANNEL
UINT32 channel_id;
IWTSVirtualChannelCallback* channel_callback;
STREAM* dvc_data;
wStream* dvc_data;
HANDLE dvc_chan_mutex;
};
@@ -131,7 +131,7 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,
}
}
static int dvcman_push_event(IWTSVirtualChannelManager* pChannelMgr, RDP_EVENT* pEvent)
static int dvcman_push_event(IWTSVirtualChannelManager* pChannelMgr, wMessage* pEvent)
{
int status;
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
@@ -140,11 +140,11 @@ static int dvcman_push_event(IWTSVirtualChannelManager* pChannelMgr, RDP_EVENT*
if (status == 0)
{
DEBUG_DVC("event_type %d pushed.", pEvent->event_type);
DEBUG_DVC("event_type %d pushed.", GetMessageType(pEvent->id));
}
else
{
DEBUG_WARN("event_type %d push failed.", pEvent->event_type);
DEBUG_WARN("event_type %d push failed.", GetMessageType(pEvent->id));
}
return status;
@@ -233,7 +233,7 @@ int dvcman_load_addin(IWTSVirtualChannelManager* pChannelMgr, ADDIN_ARGV* args)
DVCMAN_ENTRY_POINTS entryPoints;
PDVC_PLUGIN_ENTRY pDVCPluginEntry = NULL;
printf("Loading Dynamic Virtual Channel %s\n", args->argv[0]);
fprintf(stderr, "Loading Dynamic Virtual Channel %s\n", args->argv[0]);
pDVCPluginEntry = (PDVC_PLUGIN_ENTRY) freerdp_load_channel_addin_entry(args->argv[0],
NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);

View File

@@ -41,7 +41,7 @@
#include <winpr/crt.h>
#include <winpr/file.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/utils/svc_plugin.h>
@@ -376,7 +376,7 @@ BOOL drive_file_write(DRIVE_FILE* file, BYTE* buffer, UINT32 Length)
return TRUE;
}
BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, STREAM* output)
BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, wStream* output)
{
struct STAT st;
@@ -428,7 +428,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, S
return TRUE;
}
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input)
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input)
{
char* s = NULL;
mode_t m;
@@ -534,7 +534,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
}
BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,
const char* path, STREAM* output)
const char* path, wStream* output)
{
int length;
BOOL ret;

View File

@@ -107,9 +107,9 @@ void drive_file_free(DRIVE_FILE* file);
BOOL drive_file_seek(DRIVE_FILE* file, UINT64 Offset);
BOOL drive_file_read(DRIVE_FILE* file, BYTE* buffer, UINT32* Length);
BOOL drive_file_write(DRIVE_FILE* file, BYTE* buffer, UINT32 Length);
BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, STREAM* output);
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input);
BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, wStream* output);
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input);
BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,
const char* path, STREAM* output);
const char* path, wStream* output);
#endif /* FREERDP_CHANNEL_DRIVE_FILE_H */

View File

@@ -41,7 +41,7 @@
#include <winpr/interlocked.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/utils/svc_plugin.h>
@@ -386,7 +386,7 @@ static void drive_process_irp_set_information(DRIVE_DEVICE* disk, IRP* irp)
static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP* irp)
{
UINT32 FsInformationClass;
STREAM* output = irp->output;
wStream* output = irp->output;
struct STATVFS svfst;
struct STAT st;
char* volumeLabel = {"FREERDP"};
@@ -474,7 +474,7 @@ static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP*
static void drive_process_irp_silent_ignore(DRIVE_DEVICE* disk, IRP* irp)
{
UINT32 FsInformationClass;
STREAM* output = irp->output;
wStream* output = irp->output;
stream_read_UINT32(irp->input, FsInformationClass);

View File

@@ -30,7 +30,7 @@
#include <freerdp/addin.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include "echo_main.h"

View File

@@ -47,13 +47,12 @@
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/collections.h>
#include <winpr/interlocked.h>
#include <freerdp/types.h>
#include <freerdp/constants.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/thread.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/svc_plugin.h>
#include <freerdp/channels/rdpdr.h>
@@ -65,8 +64,8 @@ struct _PARALLEL_DEVICE
char* path;
UINT32 id;
PSLIST_HEADER pIrpList;
freerdp_thread* thread;
HANDLE thread;
wMessageQueue* queue;
};
typedef struct _PARALLEL_DEVICE PARALLEL_DEVICE;
@@ -138,7 +137,7 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
buffer = (BYTE*) malloc(Length);
status = read(parallel->file, irp->output->p, Length);
status = read(parallel->file, irp->output->pointer, Length);
if (status < 0)
{
@@ -155,11 +154,13 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
}
stream_write_UINT32(irp->output, Length);
if (Length > 0)
{
stream_check_size(irp->output, Length);
stream_write(irp->output, buffer, Length);
}
free(buffer);
irp->Complete(irp);
@@ -167,10 +168,10 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
{
UINT32 len;
UINT32 Length;
UINT64 Offset;
ssize_t status;
UINT32 len;
stream_read_UINT32(irp->input, Length);
stream_read_UINT64(irp->input, Offset);
@@ -244,43 +245,28 @@ static void parallel_process_irp(PARALLEL_DEVICE* parallel, IRP* irp)
}
}
static void parallel_process_irp_list(PARALLEL_DEVICE* parallel)
{
IRP* irp;
while (1)
{
if (freerdp_thread_is_stopped(parallel->thread))
break;
irp = (IRP*) InterlockedPopEntrySList(parallel->pIrpList);
if (irp == NULL)
break;
parallel_process_irp(parallel, irp);
}
}
static void* parallel_thread_func(void* arg)
{
IRP* irp;
wMessage message;
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) arg;
while (1)
{
if (freerdp_thread_wait(parallel->thread) < 0)
if (!MessageQueue_Wait(parallel->queue))
break;
if (freerdp_thread_is_stopped(parallel->thread))
if (!MessageQueue_Peek(parallel->queue, &message, TRUE))
break;
freerdp_thread_reset(parallel->thread);
if (message.id == WMQ_QUIT)
break;
parallel_process_irp_list(parallel);
irp = (IRP*) message.wParam;
parallel_process_irp(parallel, irp);
}
freerdp_thread_quit(parallel->thread);
return NULL;
}
@@ -288,25 +274,20 @@ static void parallel_irp_request(DEVICE* device, IRP* irp)
{
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;
InterlockedPushEntrySList(parallel->pIrpList, &(irp->ItemEntry));
freerdp_thread_signal(parallel->thread);
MessageQueue_Post(parallel->queue, NULL, 0, (void*) irp, NULL);
}
static void parallel_free(DEVICE* device)
{
IRP* irp;
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;
DEBUG_SVC("freeing device");
freerdp_thread_stop(parallel->thread);
freerdp_thread_free(parallel->thread);
MessageQueue_PostQuit(parallel->queue, 0);
WaitForSingleObject(parallel->thread, INFINITE);
while ((irp = (IRP*) InterlockedPopEntrySList(parallel->pIrpList)) != NULL)
irp->Discard(irp);
_aligned_free(parallel->pIrpList);
MessageQueue_Free(parallel->queue);
CloseHandle(parallel->thread);
free(parallel);
}
@@ -345,14 +326,11 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
parallel->path = path;
parallel->pIrpList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
InitializeSListHead(parallel->pIrpList);
parallel->thread = freerdp_thread_new();
parallel->queue = MessageQueue_New();
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) parallel);
freerdp_thread_start(parallel->thread, parallel_thread_func, parallel);
parallel->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) parallel_thread_func, (void*) parallel, 0, NULL);
}
return 0;

View File

@@ -30,10 +30,9 @@
#include <winpr/thread.h>
#include <winpr/interlocked.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/thread.h>
#include <freerdp/utils/svc_plugin.h>
#include <winpr/stream.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/utils/svc_plugin.h>
#ifdef WITH_CUPS
#include "printer_cups.h"
@@ -53,17 +52,21 @@ struct _PRINTER_DEVICE
rdpPrinter* printer;
PSLIST_HEADER pIrpList;
freerdp_thread* thread;
HANDLE event;
HANDLE stopEvent;
HANDLE thread;
};
static void printer_process_irp_create(PRINTER_DEVICE* printer_dev, IRP* irp)
{
rdpPrintJob* printjob = NULL;
if (printer_dev->printer != NULL)
if (printer_dev->printer)
printjob = printer_dev->printer->CreatePrintJob(printer_dev->printer, irp->devman->id_sequence++);
if (printjob != NULL)
if (printjob)
{
stream_write_UINT32(irp->output, printjob->id); /* FileId */
@@ -87,7 +90,7 @@ static void printer_process_irp_close(PRINTER_DEVICE* printer_dev, IRP* irp)
if (printer_dev->printer != NULL)
printjob = printer_dev->printer->FindPrintJob(printer_dev->printer, irp->FileId);
if (printjob == NULL)
if (!printjob)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
@@ -115,10 +118,10 @@ static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp)
stream_read_UINT64(irp->input, Offset);
stream_seek(irp->input, 20); /* Padding */
if (printer_dev->printer != NULL)
if (printer_dev->printer)
printjob = printer_dev->printer->FindPrintJob(printer_dev->printer, irp->FileId);
if (printjob == NULL)
if (!printjob)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
Length = 0;
@@ -162,15 +165,20 @@ static void printer_process_irp(PRINTER_DEVICE* printer_dev, IRP* irp)
}
}
static void printer_process_irp_list(PRINTER_DEVICE* printer_dev)
static void* printer_thread_func(void* arg)
{
IRP* irp;
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) arg;
while (1)
{
if (freerdp_thread_is_stopped(printer_dev->thread))
WaitForSingleObject(printer_dev->event, INFINITE);
if (WaitForSingleObject(printer_dev->stopEvent, 0) == WAIT_OBJECT_0)
break;
ResetEvent(printer_dev->event);
irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList);
if (irp == NULL)
@@ -178,24 +186,6 @@ static void printer_process_irp_list(PRINTER_DEVICE* printer_dev)
printer_process_irp(printer_dev, irp);
}
}
static void* printer_thread_func(void* arg)
{
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*)arg;
while (1)
{
freerdp_thread_wait(printer_dev->thread);
if (freerdp_thread_is_stopped(printer_dev->thread))
break;
freerdp_thread_reset(printer_dev->thread);
printer_process_irp_list(printer_dev);
}
freerdp_thread_quit(printer_dev->thread);
return NULL;
}
@@ -206,7 +196,7 @@ static void printer_irp_request(DEVICE* device, IRP* irp)
InterlockedPushEntrySList(printer_dev->pIrpList, &(irp->ItemEntry));
freerdp_thread_signal(printer_dev->thread);
SetEvent(printer_dev->event);
}
static void printer_free(DEVICE* device)
@@ -214,8 +204,9 @@ static void printer_free(DEVICE* device)
IRP* irp;
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) device;
freerdp_thread_stop(printer_dev->thread);
freerdp_thread_free(printer_dev->thread);
SetEvent(printer_dev->stopEvent);
WaitForSingleObject(printer_dev->thread, INFINITE);
CloseHandle(printer_dev->thread);
while ((irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList)) != NULL)
irp->Discard(irp);
@@ -292,11 +283,13 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
printer_dev->pIrpList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
InitializeSListHead(printer_dev->pIrpList);
printer_dev->thread = freerdp_thread_new();
printer_dev->event = CreateEvent(NULL, TRUE, FALSE, NULL);
printer_dev->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) printer_dev);
freerdp_thread_start(printer_dev->thread, printer_thread_func, printer_dev);
printer_dev->thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) printer_thread_func, (void*) printer_dev, 0, NULL);
}
#ifdef STATIC_CHANNELS
@@ -316,6 +309,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
#ifdef WITH_CUPS
driver = printer_cups_get_driver();
#endif
#ifdef WIN32
driver = printer_win_get_driver();
#endif
@@ -334,7 +328,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
{
printer = driver->GetPrinter(driver, name);
if (printer == NULL)
if (!printer)
{
DEBUG_WARN("printer %s not found.", name);
return 1;

View File

@@ -40,7 +40,7 @@
void rail_send_channel_data(void* rail_object, void* data, size_t length)
{
STREAM* s = NULL;
wStream* s = NULL;
railPlugin* plugin = (railPlugin*) rail_object;
s = stream_new(length);
@@ -49,25 +49,22 @@ void rail_send_channel_data(void* rail_object, void* data, size_t length)
svc_plugin_send((rdpSvcPlugin*) plugin, s);
}
static void on_free_rail_channel_event(RDP_EVENT* event)
static void on_free_rail_channel_event(wMessage* event)
{
if (event->event_class == RDP_EVENT_CLASS_RAIL)
{
rail_free_cloned_order(event->event_type, event->user_data);
}
rail_free_cloned_order(GetMessageType(event->id), event->wParam);
}
void rail_send_channel_event(void* rail_object, UINT16 event_type, void* param)
{
void * payload = NULL;
RDP_EVENT* out_event = NULL;
wMessage* out_event = NULL;
railPlugin* plugin = (railPlugin*) rail_object;
payload = rail_clone_order(event_type, param);
if (payload != NULL)
{
out_event = freerdp_event_new(RDP_EVENT_CLASS_RAIL, event_type,
out_event = freerdp_event_new(RailChannel_Class, event_type,
on_free_rail_channel_event, payload);
svc_plugin_send_event((rdpSvcPlugin*) plugin, out_event);
@@ -88,7 +85,7 @@ static void rail_process_terminate(rdpSvcPlugin* plugin)
}
static void rail_process_receive(rdpSvcPlugin* plugin, STREAM* s)
static void rail_process_receive(rdpSvcPlugin* plugin, wStream* s)
{
railPlugin* rail = (railPlugin*) plugin;
rail_order_recv(rail->rail_order, s);
@@ -114,13 +111,13 @@ static void rail_process_addin_args(rdpRailOrder* rail_order, rdpSettings* setti
rail_send_client_exec_order(rail_order);
}
static void rail_recv_set_sysparams_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_set_sysparams_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_SYSPARAM_ORDER* sysparam;
/* Send System Parameters */
sysparam = (RAIL_SYSPARAM_ORDER*) event->user_data;
sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
memmove(&rail_order->sysparam, sysparam, sizeof(RAIL_SYSPARAM_ORDER));
rail_send_client_sysparams_order(rail_order);
@@ -132,7 +129,7 @@ static void rail_recv_set_sysparams_event(rdpRailOrder* rail_order, RDP_EVENT* e
rail_process_addin_args(rail_order, rail_order->settings);
}
static void rail_recv_exec_remote_app_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_exec_remote_app_event(rdpRailOrder* rail_order, wMessage* event)
{
/**
* TODO: replace event system by an API to allow the execution
@@ -143,102 +140,102 @@ static void rail_recv_exec_remote_app_event(rdpRailOrder* rail_order, RDP_EVENT*
//rail_process_addin_args(rail_order, data);
}
static void rail_recv_activate_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_activate_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_ACTIVATE_ORDER* activate = (RAIL_ACTIVATE_ORDER*) event->user_data;
RAIL_ACTIVATE_ORDER* activate = (RAIL_ACTIVATE_ORDER*) event->wParam;
memcpy(&rail_order->activate, activate, sizeof(RAIL_ACTIVATE_ORDER));
CopyMemory(&rail_order->activate, activate, sizeof(RAIL_ACTIVATE_ORDER));
rail_send_client_activate_order(rail_order);
}
static void rail_recv_sysmenu_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_sysmenu_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_SYSMENU_ORDER* sysmenu = (RAIL_SYSMENU_ORDER*) event->user_data;
RAIL_SYSMENU_ORDER* sysmenu = (RAIL_SYSMENU_ORDER*) event->wParam;
memcpy(&rail_order->sysmenu, sysmenu, sizeof(RAIL_SYSMENU_ORDER));
CopyMemory(&rail_order->sysmenu, sysmenu, sizeof(RAIL_SYSMENU_ORDER));
rail_send_client_sysmenu_order(rail_order);
}
static void rail_recv_syscommand_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_syscommand_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_SYSCOMMAND_ORDER* syscommand = (RAIL_SYSCOMMAND_ORDER*) event->user_data;
RAIL_SYSCOMMAND_ORDER* syscommand = (RAIL_SYSCOMMAND_ORDER*) event->wParam;
memcpy(&rail_order->syscommand, syscommand, sizeof(RAIL_SYSCOMMAND_ORDER));
CopyMemory(&rail_order->syscommand, syscommand, sizeof(RAIL_SYSCOMMAND_ORDER));
rail_send_client_syscommand_order(rail_order);
}
static void rail_recv_notify_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_notify_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_NOTIFY_EVENT_ORDER* notify = (RAIL_NOTIFY_EVENT_ORDER*) event->user_data;
RAIL_NOTIFY_EVENT_ORDER* notify = (RAIL_NOTIFY_EVENT_ORDER*) event->wParam;
memcpy(&rail_order->notify_event, notify, sizeof(RAIL_NOTIFY_EVENT_ORDER));
CopyMemory(&rail_order->notify_event, notify, sizeof(RAIL_NOTIFY_EVENT_ORDER));
rail_send_client_notify_event_order(rail_order);
}
static void rail_recv_window_move_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_window_move_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_WINDOW_MOVE_ORDER* window_move = (RAIL_WINDOW_MOVE_ORDER*) event->user_data;
RAIL_WINDOW_MOVE_ORDER* window_move = (RAIL_WINDOW_MOVE_ORDER*) event->wParam;
memcpy(&rail_order->window_move, window_move, sizeof(RAIL_WINDOW_MOVE_ORDER));
CopyMemory(&rail_order->window_move, window_move, sizeof(RAIL_WINDOW_MOVE_ORDER));
rail_send_client_window_move_order(rail_order);
}
static void rail_recv_app_req_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_app_req_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_GET_APPID_REQ_ORDER* get_appid_req = (RAIL_GET_APPID_REQ_ORDER*) event->user_data;
RAIL_GET_APPID_REQ_ORDER* get_appid_req = (RAIL_GET_APPID_REQ_ORDER*) event->wParam;
memcpy(&rail_order->get_appid_req, get_appid_req, sizeof(RAIL_GET_APPID_REQ_ORDER));
CopyMemory(&rail_order->get_appid_req, get_appid_req, sizeof(RAIL_GET_APPID_REQ_ORDER));
rail_send_client_get_appid_req_order(rail_order);
}
static void rail_recv_langbarinfo_event(rdpRailOrder* rail_order, RDP_EVENT* event)
static void rail_recv_langbarinfo_event(rdpRailOrder* rail_order, wMessage* event)
{
RAIL_LANGBAR_INFO_ORDER* langbar_info = (RAIL_LANGBAR_INFO_ORDER*) event->user_data;
RAIL_LANGBAR_INFO_ORDER* langbar_info = (RAIL_LANGBAR_INFO_ORDER*) event->wParam;
memcpy(&rail_order->langbar_info, langbar_info, sizeof(RAIL_LANGBAR_INFO_ORDER));
CopyMemory(&rail_order->langbar_info, langbar_info, sizeof(RAIL_LANGBAR_INFO_ORDER));
rail_send_client_langbar_info_order(rail_order);
}
static void rail_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
static void rail_process_event(rdpSvcPlugin* plugin, wMessage* event)
{
railPlugin* rail = NULL;
rail = (railPlugin*) plugin;
switch (event->event_type)
switch (GetMessageType(event->id))
{
case RDP_EVENT_TYPE_RAIL_CLIENT_SET_SYSPARAMS:
case RailChannel_ClientSystemParam:
rail_recv_set_sysparams_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_EXEC_REMOTE_APP:
case RailChannel_ClientExecute:
rail_recv_exec_remote_app_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_ACTIVATE:
case RailChannel_ClientActivate:
rail_recv_activate_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_SYSMENU:
case RailChannel_ClientSystemMenu:
rail_recv_sysmenu_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_SYSCOMMAND:
case RailChannel_ClientSystemCommand:
rail_recv_syscommand_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_NOTIFY_EVENT:
case RailChannel_ClientNotifyEvent:
rail_recv_notify_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE:
case RailChannel_ClientWindowMove:
rail_recv_window_move_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_APPID_REQ:
case RailChannel_ClientGetAppIdRequest:
rail_recv_app_req_event(rail->rail_order, event);
break;
case RDP_EVENT_TYPE_RAIL_CLIENT_LANGBARINFO:
case RailChannel_ClientLanguageBarInfo:
rail_recv_langbarinfo_event(rail->rail_order, event);
break;

View File

@@ -25,9 +25,10 @@
#include <freerdp/rail.h>
#include <freerdp/settings.h>
#include <freerdp/utils/debug.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/svc_plugin.h>
#include <winpr/stream.h>
struct rdp_rail_order
{
rdpSettings* settings;

View File

@@ -88,30 +88,30 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_
unicode_string->length = (UINT16) length;
}
BOOL rail_read_pdu_header(STREAM* s, UINT16* orderType, UINT16* orderLength)
BOOL rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength)
{
if(stream_get_left(s) < 4)
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT16(s, *orderType); /* orderType (2 bytes) */
stream_read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
return TRUE;
}
void rail_write_pdu_header(STREAM* s, UINT16 orderType, UINT16 orderLength)
void rail_write_pdu_header(wStream* s, UINT16 orderType, UINT16 orderLength)
{
stream_write_UINT16(s, orderType); /* orderType (2 bytes) */
stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */
}
STREAM* rail_pdu_init(int length)
wStream* rail_pdu_init(int length)
{
STREAM* s;
wStream* s;
s = stream_new(length + RAIL_PDU_HEADER_LENGTH);
stream_seek(s, RAIL_PDU_HEADER_LENGTH);
return s;
}
void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, UINT16 orderType)
void rail_send_pdu(rdpRailOrder* rail_order, wStream* s, UINT16 orderType)
{
UINT16 orderLength;
@@ -125,10 +125,10 @@ void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, UINT16 orderType)
DEBUG_RAIL("Sending %s PDU, length:%d",
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
rail_send_channel_data(rail_order->plugin, s->data, orderLength);
rail_send_channel_data(rail_order->plugin, s->buffer, orderLength);
}
void rail_write_high_contrast(STREAM* s, HIGH_CONTRAST* high_contrast)
void rail_write_high_contrast(wStream* s, HIGH_CONTRAST* high_contrast)
{
high_contrast->colorSchemeLength = high_contrast->colorScheme.length + 2;
stream_write_UINT32(s, high_contrast->flags); /* flags (4 bytes) */
@@ -136,17 +136,17 @@ void rail_write_high_contrast(STREAM* s, HIGH_CONTRAST* high_contrast)
rail_write_unicode_string(s, &high_contrast->colorScheme); /* colorScheme */
}
BOOL rail_read_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake)
BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
{
if(stream_get_left(s) < 4)
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
return TRUE;
}
BOOL rail_read_server_exec_result_order(STREAM* s, RAIL_EXEC_RESULT_ORDER* exec_result)
BOOL rail_read_server_exec_result_order(wStream* s, RAIL_EXEC_RESULT_ORDER* exec_result)
{
if(stream_get_left(s) < 8)
if (stream_get_left(s) < 8)
return FALSE;
stream_read_UINT16(s, exec_result->flags); /* flags (2 bytes) */
stream_read_UINT16(s, exec_result->execResult); /* execResult (2 bytes) */
@@ -155,11 +155,11 @@ BOOL rail_read_server_exec_result_order(STREAM* s, RAIL_EXEC_RESULT_ORDER* exec_
return rail_read_unicode_string(s, &exec_result->exeOrFile); /* exeOrFile */
}
BOOL rail_read_server_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
BOOL rail_read_server_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
{
BYTE body;
if(stream_get_left(s) < 5)
if (stream_get_left(s) < 5)
return FALSE;
stream_read_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
stream_read_BYTE(s, body); /* body (1 byte) */
@@ -180,9 +180,9 @@ BOOL rail_read_server_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
return TRUE;
}
BOOL rail_read_server_minmaxinfo_order(STREAM* s, RAIL_MINMAXINFO_ORDER* minmaxinfo)
BOOL rail_read_server_minmaxinfo_order(wStream* s, RAIL_MINMAXINFO_ORDER* minmaxinfo)
{
if(stream_get_left(s) < 20)
if (stream_get_left(s) < 20)
return FALSE;
stream_read_UINT32(s, minmaxinfo->windowId); /* windowId (4 bytes) */
stream_read_UINT16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */
@@ -196,10 +196,10 @@ BOOL rail_read_server_minmaxinfo_order(STREAM* s, RAIL_MINMAXINFO_ORDER* minmaxi
return TRUE;
}
BOOL rail_read_server_localmovesize_order(STREAM* s, RAIL_LOCALMOVESIZE_ORDER* localmovesize)
BOOL rail_read_server_localmovesize_order(wStream* s, RAIL_LOCALMOVESIZE_ORDER* localmovesize)
{
UINT16 isMoveSizeStart;
if(stream_get_left(s) < 12)
if (stream_get_left(s) < 12)
return FALSE;
stream_read_UINT32(s, localmovesize->windowId); /* windowId (4 bytes) */
@@ -212,9 +212,9 @@ BOOL rail_read_server_localmovesize_order(STREAM* s, RAIL_LOCALMOVESIZE_ORDER* l
return TRUE;
}
BOOL rail_read_server_get_appid_resp_order(STREAM* s, RAIL_GET_APPID_RESP_ORDER* get_appid_resp)
BOOL rail_read_server_get_appid_resp_order(wStream* s, RAIL_GET_APPID_RESP_ORDER* get_appid_resp)
{
if(stream_get_left(s) < 516)
if (stream_get_left(s) < 516)
return FALSE;
stream_read_UINT32(s, get_appid_resp->windowId); /* windowId (4 bytes) */
stream_read(s, &get_appid_resp->applicationIdBuffer[0], 512); /* applicationId (256 UNICODE chars) */
@@ -224,25 +224,25 @@ BOOL rail_read_server_get_appid_resp_order(STREAM* s, RAIL_GET_APPID_RESP_ORDER*
return TRUE;
}
BOOL rail_read_langbar_info_order(STREAM* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
BOOL rail_read_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
{
if(stream_get_left(s) < 4)
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
return TRUE;
}
void rail_write_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake)
void rail_write_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
{
stream_write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
}
void rail_write_client_status_order(STREAM* s, RAIL_CLIENT_STATUS_ORDER* client_status)
void rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* client_status)
{
stream_write_UINT32(s, client_status->flags); /* flags (4 bytes) */
}
void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec)
void rail_write_client_exec_order(wStream* s, RAIL_EXEC_ORDER* exec)
{
stream_write_UINT16(s, exec->flags); /* flags (2 bytes) */
stream_write_UINT16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */
@@ -253,7 +253,7 @@ void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec)
rail_write_unicode_string_value(s, &exec->arguments); /* arguments */
}
void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
void rail_write_client_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
{
BYTE body;
stream_write_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
@@ -307,7 +307,7 @@ void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
}
}
void rail_write_client_activate_order(STREAM* s, RAIL_ACTIVATE_ORDER* activate)
void rail_write_client_activate_order(wStream* s, RAIL_ACTIVATE_ORDER* activate)
{
BYTE enabled;
@@ -317,27 +317,27 @@ void rail_write_client_activate_order(STREAM* s, RAIL_ACTIVATE_ORDER* activate)
stream_write_BYTE(s, enabled); /* enabled (1 byte) */
}
void rail_write_client_sysmenu_order(STREAM* s, RAIL_SYSMENU_ORDER* sysmenu)
void rail_write_client_sysmenu_order(wStream* s, RAIL_SYSMENU_ORDER* sysmenu)
{
stream_write_UINT32(s, sysmenu->windowId); /* windowId (4 bytes) */
stream_write_UINT16(s, sysmenu->left); /* left (2 bytes) */
stream_write_UINT16(s, sysmenu->top); /* top (2 bytes) */
}
void rail_write_client_syscommand_order(STREAM* s, RAIL_SYSCOMMAND_ORDER* syscommand)
void rail_write_client_syscommand_order(wStream* s, RAIL_SYSCOMMAND_ORDER* syscommand)
{
stream_write_UINT32(s, syscommand->windowId); /* windowId (4 bytes) */
stream_write_UINT16(s, syscommand->command); /* command (2 bytes) */
}
void rail_write_client_notify_event_order(STREAM* s, RAIL_NOTIFY_EVENT_ORDER* notify_event)
void rail_write_client_notify_event_order(wStream* s, RAIL_NOTIFY_EVENT_ORDER* notify_event)
{
stream_write_UINT32(s, notify_event->windowId); /* windowId (4 bytes) */
stream_write_UINT32(s, notify_event->notifyIconId); /* notifyIconId (4 bytes) */
stream_write_UINT32(s, notify_event->message); /* notifyIconId (4 bytes) */
}
void rail_write_client_window_move_order(STREAM* s, RAIL_WINDOW_MOVE_ORDER* window_move)
void rail_write_client_window_move_order(wStream* s, RAIL_WINDOW_MOVE_ORDER* window_move)
{
stream_write_UINT32(s, window_move->windowId); /* windowId (4 bytes) */
stream_write_UINT16(s, window_move->left); /* left (2 bytes) */
@@ -346,19 +346,19 @@ void rail_write_client_window_move_order(STREAM* s, RAIL_WINDOW_MOVE_ORDER* wind
stream_write_UINT16(s, window_move->bottom); /* bottom (2 bytes) */
}
void rail_write_client_get_appid_req_order(STREAM* s, RAIL_GET_APPID_REQ_ORDER* get_appid_req)
void rail_write_client_get_appid_req_order(wStream* s, RAIL_GET_APPID_REQ_ORDER* get_appid_req)
{
stream_write_UINT32(s, get_appid_req->windowId); /* windowId (4 bytes) */
}
void rail_write_langbar_info_order(STREAM* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
void rail_write_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
{
stream_write_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
}
BOOL rail_recv_handshake_order(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_recv_handshake_order(rdpRailOrder* rail_order, wStream* s)
{
if(!rail_read_handshake_order(s, &rail_order->handshake))
if (!rail_read_handshake_order(s, &rail_order->handshake))
return FALSE;
rail_order->handshake.buildNumber = 0x00001DB0;
@@ -395,70 +395,83 @@ BOOL rail_recv_handshake_order(rdpRailOrder* rail_order, STREAM* s)
rail_order->sysparam.workArea.bottom = 768;
rail_send_channel_event(rail_order->plugin,
RDP_EVENT_TYPE_RAIL_CHANNEL_GET_SYSPARAMS, &rail_order->sysparam);
RailChannel_GetSystemParam, &rail_order->sysparam);
return TRUE;
}
BOOL rail_recv_exec_result_order(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_recv_exec_result_order(rdpRailOrder* rail_order, wStream* s)
{
if(!rail_read_server_exec_result_order(s, &rail_order->exec_result))
if (!rail_read_server_exec_result_order(s, &rail_order->exec_result))
return FALSE;
rail_send_channel_event(rail_order->plugin,
RDP_EVENT_TYPE_RAIL_CHANNEL_EXEC_RESULTS, &rail_order->exec_result);
RailChannel_ServerExecuteResult, &rail_order->exec_result);
return TRUE;
}
BOOL rail_recv_server_sysparam_order(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_recv_server_sysparam_order(rdpRailOrder* rail_order, wStream* s)
{
if(!rail_read_server_sysparam_order(s, &rail_order->sysparam))
if (!rail_read_server_sysparam_order(s, &rail_order->sysparam))
return FALSE;
rail_send_channel_event(rail_order->plugin,
RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_SYSPARAM, &rail_order->sysparam);
RailChannel_ServerSystemParam, &rail_order->sysparam);
return TRUE;
}
BOOL rail_recv_server_minmaxinfo_order(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_recv_server_minmaxinfo_order(rdpRailOrder* rail_order, wStream* s)
{
if(!rail_read_server_minmaxinfo_order(s, &rail_order->minmaxinfo))
if (!rail_read_server_minmaxinfo_order(s, &rail_order->minmaxinfo))
return FALSE;
rail_send_channel_event(rail_order->plugin,
RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_MINMAXINFO, &rail_order->minmaxinfo);
RailChannel_ServerMinMaxInfo, &rail_order->minmaxinfo);
return TRUE;
}
BOOL rail_recv_server_localmovesize_order(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_recv_server_localmovesize_order(rdpRailOrder* rail_order, wStream* s)
{
if(!rail_read_server_localmovesize_order(s, &rail_order->localmovesize))
if (!rail_read_server_localmovesize_order(s, &rail_order->localmovesize))
return FALSE;
rail_send_channel_event(rail_order->plugin,
RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_LOCALMOVESIZE, &rail_order->localmovesize);
RailChannel_ServerLocalMoveSize, &rail_order->localmovesize);
return TRUE;
}
BOOL rail_recv_server_get_appid_resp_order(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_recv_server_get_appid_resp_order(rdpRailOrder* rail_order, wStream* s)
{
if(!rail_read_server_get_appid_resp_order(s, &rail_order->get_appid_resp))
if (!rail_read_server_get_appid_resp_order(s, &rail_order->get_appid_resp))
return FALSE;
rail_send_channel_event(rail_order->plugin,
RDP_EVENT_TYPE_RAIL_CHANNEL_APPID_RESP, &rail_order->get_appid_resp);
RailChannel_ServerGetAppIdResponse, &rail_order->get_appid_resp);
return TRUE;
}
BOOL rail_recv_langbar_info_order(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_recv_langbar_info_order(rdpRailOrder* rail_order, wStream* s)
{
if(!rail_read_langbar_info_order(s, &rail_order->langbar_info))
if (!rail_read_langbar_info_order(s, &rail_order->langbar_info))
return FALSE;
rail_send_channel_event(rail_order->plugin,
RDP_EVENT_TYPE_RAIL_CHANNEL_LANGBARINFO, &rail_order->langbar_info);
RailChannel_ServerLanguageBarInfo, &rail_order->langbar_info);
return TRUE;
}
BOOL rail_order_recv(rdpRailOrder* rail_order, STREAM* s)
BOOL rail_order_recv(rdpRailOrder* rail_order, wStream* s)
{
UINT16 orderType;
UINT16 orderLength;
if(!rail_read_pdu_header(s, &orderType, &orderLength))
if (!rail_read_pdu_header(s, &orderType, &orderLength))
return FALSE;
DEBUG_RAIL("Received %s PDU, length:%d",
@@ -488,7 +501,7 @@ BOOL rail_order_recv(rdpRailOrder* rail_order, STREAM* s)
return rail_recv_langbar_info_order(rail_order, s);
default:
printf("Unknown RAIL PDU order reveived.");
fprintf(stderr, "Unknown RAIL PDU order reveived.");
break;
}
return TRUE;
@@ -496,7 +509,7 @@ BOOL rail_order_recv(rdpRailOrder* rail_order, STREAM* s)
void rail_send_handshake_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_HANDSHAKE_ORDER_LENGTH);
rail_write_handshake_order(s, &rail_order->handshake);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_HANDSHAKE);
@@ -505,7 +518,7 @@ void rail_send_handshake_order(rdpRailOrder* rail_order)
void rail_send_client_status_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_CLIENT_STATUS_ORDER_LENGTH);
rail_write_client_status_order(s, &rail_order->client_status);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_CLIENT_STATUS);
@@ -514,7 +527,7 @@ void rail_send_client_status_order(rdpRailOrder* rail_order)
void rail_send_client_exec_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
int length;
length = RAIL_EXEC_ORDER_LENGTH +
@@ -530,7 +543,7 @@ void rail_send_client_exec_order(rdpRailOrder* rail_order)
void rail_send_client_sysparam_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
int length;
length = RAIL_SYSPARAM_ORDER_LENGTH;
@@ -608,7 +621,7 @@ void rail_send_client_sysparams_order(rdpRailOrder* rail_order)
void rail_send_client_activate_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_ACTIVATE_ORDER_LENGTH);
rail_write_client_activate_order(s, &rail_order->activate);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_ACTIVATE);
@@ -617,7 +630,7 @@ void rail_send_client_activate_order(rdpRailOrder* rail_order)
void rail_send_client_sysmenu_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_SYSMENU_ORDER_LENGTH);
rail_write_client_sysmenu_order(s, &rail_order->sysmenu);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_SYSMENU);
@@ -626,7 +639,7 @@ void rail_send_client_sysmenu_order(rdpRailOrder* rail_order)
void rail_send_client_syscommand_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_SYSCOMMAND_ORDER_LENGTH);
rail_write_client_syscommand_order(s, &rail_order->syscommand);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_SYSCOMMAND);
@@ -635,7 +648,7 @@ void rail_send_client_syscommand_order(rdpRailOrder* rail_order)
void rail_send_client_notify_event_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_NOTIFY_EVENT_ORDER_LENGTH);
rail_write_client_notify_event_order(s, &rail_order->notify_event);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_NOTIFY_EVENT);
@@ -644,7 +657,7 @@ void rail_send_client_notify_event_order(rdpRailOrder* rail_order)
void rail_send_client_window_move_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_WINDOW_MOVE_ORDER_LENGTH);
rail_write_client_window_move_order(s, &rail_order->window_move);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_WINDOW_MOVE);
@@ -653,7 +666,7 @@ void rail_send_client_window_move_order(rdpRailOrder* rail_order)
void rail_send_client_get_appid_req_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_GET_APPID_REQ_ORDER_LENGTH);
rail_write_client_get_appid_req_order(s, &rail_order->get_appid_req);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_GET_APPID_REQ);
@@ -662,7 +675,7 @@ void rail_send_client_get_appid_req_order(rdpRailOrder* rail_order)
void rail_send_client_langbar_info_order(rdpRailOrder* rail_order)
{
STREAM* s;
wStream* s;
s = rail_pdu_init(RAIL_LANGBAR_INFO_ORDER_LENGTH);
rail_write_langbar_info_order(s, &rail_order->langbar_info);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_LANGBAR_INFO);

View File

@@ -56,27 +56,27 @@
void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_UNICODE_STRING* unicode_string);
BOOL rail_read_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake);
BOOL rail_read_server_exec_result_order(STREAM* s, RAIL_EXEC_RESULT_ORDER* exec_result);
BOOL rail_read_server_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam);
BOOL rail_read_server_minmaxinfo_order(STREAM* s, RAIL_MINMAXINFO_ORDER* minmaxinfo);
BOOL rail_read_server_localmovesize_order(STREAM* s, RAIL_LOCALMOVESIZE_ORDER* localmovesize);
BOOL rail_read_server_get_appid_resp_order(STREAM* s, RAIL_GET_APPID_RESP_ORDER* get_appid_resp);
BOOL rail_read_langbar_info_order(STREAM* s, RAIL_LANGBAR_INFO_ORDER* langbar_info);
BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake);
BOOL rail_read_server_exec_result_order(wStream* s, RAIL_EXEC_RESULT_ORDER* exec_result);
BOOL rail_read_server_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam);
BOOL rail_read_server_minmaxinfo_order(wStream* s, RAIL_MINMAXINFO_ORDER* minmaxinfo);
BOOL rail_read_server_localmovesize_order(wStream* s, RAIL_LOCALMOVESIZE_ORDER* localmovesize);
BOOL rail_read_server_get_appid_resp_order(wStream* s, RAIL_GET_APPID_RESP_ORDER* get_appid_resp);
BOOL rail_read_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_info);
void rail_write_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake);
void rail_write_client_status_order(STREAM* s, RAIL_CLIENT_STATUS_ORDER* client_status);
void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec);
void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam);
void rail_write_client_activate_order(STREAM* s, RAIL_ACTIVATE_ORDER* activate);
void rail_write_client_sysmenu_order(STREAM* s, RAIL_SYSMENU_ORDER* sysmenu);
void rail_write_client_syscommand_order(STREAM* s, RAIL_SYSCOMMAND_ORDER* syscommand);
void rail_write_client_notify_event_order(STREAM* s, RAIL_NOTIFY_EVENT_ORDER* notify_event);
void rail_write_client_window_move_order(STREAM* s, RAIL_WINDOW_MOVE_ORDER* window_move);
void rail_write_client_get_appid_req_order(STREAM* s, RAIL_GET_APPID_REQ_ORDER* get_appid_req);
void rail_write_langbar_info_order(STREAM* s, RAIL_LANGBAR_INFO_ORDER* langbar_info);
void rail_write_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake);
void rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* client_status);
void rail_write_client_exec_order(wStream* s, RAIL_EXEC_ORDER* exec);
void rail_write_client_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam);
void rail_write_client_activate_order(wStream* s, RAIL_ACTIVATE_ORDER* activate);
void rail_write_client_sysmenu_order(wStream* s, RAIL_SYSMENU_ORDER* sysmenu);
void rail_write_client_syscommand_order(wStream* s, RAIL_SYSCOMMAND_ORDER* syscommand);
void rail_write_client_notify_event_order(wStream* s, RAIL_NOTIFY_EVENT_ORDER* notify_event);
void rail_write_client_window_move_order(wStream* s, RAIL_WINDOW_MOVE_ORDER* window_move);
void rail_write_client_get_appid_req_order(wStream* s, RAIL_GET_APPID_REQ_ORDER* get_appid_req);
void rail_write_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_info);
BOOL rail_order_recv(rdpRailOrder* rail_order, STREAM* s);
BOOL rail_order_recv(rdpRailOrder* rail_order, wStream* s);
void rail_send_handshake_order(rdpRailOrder* rail_order);
void rail_send_client_status_order(rdpRailOrder* rail_order);

View File

@@ -30,7 +30,7 @@
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/svc_plugin.h>
#include <freerdp/client/channels.h>
@@ -99,7 +99,7 @@ BOOL devman_load_device_service(DEVMAN* devman, RDPDR_DEVICE* device)
if (!ServiceName)
return FALSE;
printf("Loading device service %s (static)\n", ServiceName);
fprintf(stderr, "Loading device service %s (static)\n", ServiceName);
entry = (PDEVICE_SERVICE_ENTRY) freerdp_load_channel_addin_entry(ServiceName, NULL, "DeviceServiceEntry", 0);
if (entry == NULL)

View File

@@ -28,7 +28,7 @@
#include <winpr/crt.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/svc_plugin.h>
#include "rdpdr_main.h"
@@ -62,7 +62,7 @@ static void irp_complete(IRP* irp)
irp_free(irp);
}
IRP* irp_new(DEVMAN* devman, STREAM* data_in)
IRP* irp_new(DEVMAN* devman, wStream* data_in)
{
IRP* irp;
UINT32 DeviceId;

View File

@@ -23,6 +23,6 @@
#include "rdpdr_main.h"
IRP* irp_new(DEVMAN* devman, STREAM* data_in);
IRP* irp_new(DEVMAN* devman, wStream* data_in);
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H */

View File

@@ -26,14 +26,14 @@
#include <stdlib.h>
#include <string.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/svc_plugin.h>
#include "rdpdr_main.h"
#include "rdpdr_capabilities.h"
/* Output device redirection capability set header */
static void rdpdr_write_capset_header(STREAM* data_out, UINT16 capabilityType, UINT16 capabilityLength, UINT32 version)
static void rdpdr_write_capset_header(wStream* data_out, UINT16 capabilityType, UINT16 capabilityLength, UINT32 version)
{
stream_write_UINT16(data_out, capabilityType);
stream_write_UINT16(data_out, capabilityLength);
@@ -41,7 +41,7 @@ static void rdpdr_write_capset_header(STREAM* data_out, UINT16 capabilityType, U
}
/* Output device direction general capability set */
static void rdpdr_write_general_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
static void rdpdr_write_general_capset(rdpdrPlugin* rdpdr, wStream* data_out)
{
rdpdr_write_capset_header(data_out, CAP_GENERAL_TYPE, 44, GENERAL_CAPABILITY_VERSION_02);
@@ -58,7 +58,7 @@ static void rdpdr_write_general_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
}
/* Process device direction general capability set */
static void rdpdr_process_general_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_general_capset(rdpdrPlugin* rdpdr, wStream* data_in)
{
UINT16 capabilityLength;
@@ -67,13 +67,13 @@ static void rdpdr_process_general_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
}
/* Output printer direction capability set */
static void rdpdr_write_printer_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
static void rdpdr_write_printer_capset(rdpdrPlugin* rdpdr, wStream* data_out)
{
rdpdr_write_capset_header(data_out, CAP_PRINTER_TYPE, 8, PRINT_CAPABILITY_VERSION_01);
}
/* Process printer direction capability set */
static void rdpdr_process_printer_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_printer_capset(rdpdrPlugin* rdpdr, wStream* data_in)
{
UINT16 capabilityLength;
@@ -82,13 +82,13 @@ static void rdpdr_process_printer_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
}
/* Output port redirection capability set */
static void rdpdr_write_port_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
static void rdpdr_write_port_capset(rdpdrPlugin* rdpdr, wStream* data_out)
{
rdpdr_write_capset_header(data_out, CAP_PORT_TYPE, 8, PORT_CAPABILITY_VERSION_01);
}
/* Process port redirection capability set */
static void rdpdr_process_port_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_port_capset(rdpdrPlugin* rdpdr, wStream* data_in)
{
UINT16 capabilityLength;
@@ -97,13 +97,13 @@ static void rdpdr_process_port_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
}
/* Output drive redirection capability set */
static void rdpdr_write_drive_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
static void rdpdr_write_drive_capset(rdpdrPlugin* rdpdr, wStream* data_out)
{
rdpdr_write_capset_header(data_out, CAP_DRIVE_TYPE, 8, DRIVE_CAPABILITY_VERSION_02);
}
/* Process drive redirection capability set */
static void rdpdr_process_drive_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_drive_capset(rdpdrPlugin* rdpdr, wStream* data_in)
{
UINT16 capabilityLength;
@@ -112,13 +112,13 @@ static void rdpdr_process_drive_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
}
/* Output smart card redirection capability set */
static void rdpdr_write_smartcard_capset(rdpdrPlugin* rdpdr, STREAM* data_out)
static void rdpdr_write_smartcard_capset(rdpdrPlugin* rdpdr, wStream* data_out)
{
rdpdr_write_capset_header(data_out, CAP_SMARTCARD_TYPE, 8, SMARTCARD_CAPABILITY_VERSION_01);
}
/* Process smartcard redirection capability set */
static void rdpdr_process_smartcard_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_smartcard_capset(rdpdrPlugin* rdpdr, wStream* data_in)
{
UINT16 capabilityLength;
@@ -126,7 +126,7 @@ static void rdpdr_process_smartcard_capset(rdpdrPlugin* rdpdr, STREAM* data_in)
stream_seek(data_in, capabilityLength - 4);
}
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, STREAM* data_in)
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* data_in)
{
UINT16 i;
UINT16 numCapabilities;
@@ -170,7 +170,7 @@ void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, STREAM* data_in)
void rdpdr_send_capability_response(rdpdrPlugin* rdpdr)
{
STREAM* data_out;
wStream* data_out;
data_out = stream_new(256);

View File

@@ -23,7 +23,7 @@
#include "rdpdr_main.h"
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, STREAM* data_in);
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* data_in);
void rdpdr_send_capability_response(rdpdrPlugin* rdpdr);
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H */

View File

@@ -30,7 +30,7 @@
#include <freerdp/types.h>
#include <freerdp/constants.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/utils/svc_plugin.h>
@@ -64,7 +64,7 @@ static void rdpdr_process_connect(rdpSvcPlugin* plugin)
}
}
static void rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, wStream* data_in)
{
stream_read_UINT16(data_in, rdpdr->versionMajor);
stream_read_UINT16(data_in, rdpdr->versionMinor);
@@ -75,7 +75,7 @@ static void rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, STREAM* da
static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
{
STREAM* data_out;
wStream* data_out;
data_out = stream_new(12);
@@ -91,7 +91,7 @@ static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
{
STREAM* data_out;
wStream* data_out;
WCHAR* computerNameW = NULL;
size_t computerNameLenW;
@@ -116,7 +116,7 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
}
static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, STREAM* data_in)
static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, wStream* data_in)
{
UINT16 versionMajor;
UINT16 versionMinor;
@@ -148,7 +148,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
UINT32 count;
int data_len;
int count_pos;
STREAM* data_out;
wStream* data_out;
DEVICE* device;
LIST_ITEM* item;
@@ -199,7 +199,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
count++;
printf("registered device #%d: %s (type=%d id=%d)\n",
fprintf(stderr, "registered device #%d: %s (type=%d id=%d)\n",
count, device->name, device->type, device->id);
}
}
@@ -213,7 +213,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
}
static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in)
static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, wStream* data_in)
{
IRP* irp;
@@ -227,7 +227,7 @@ static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in)
return TRUE;
}
static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
static void rdpdr_process_receive(rdpSvcPlugin* plugin, wStream* data_in)
{
UINT16 component;
UINT16 packetID;
@@ -297,7 +297,7 @@ static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
stream_free(data_in);
}
static void rdpdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
static void rdpdr_process_event(rdpSvcPlugin* plugin, wMessage* event)
{
freerdp_event_free(event);
}

View File

@@ -0,0 +1,23 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
define_channel("rdpei")
if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
endif()

View File

@@ -0,0 +1,13 @@
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
define_channel_options(NAME "rdpei" TYPE "dynamic"
DESCRIPTION "Input Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEI]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@@ -0,0 +1,42 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
define_channel_client("rdpei")
set(${MODULE_PREFIX}_SRCS
rdpei_main.c
rdpei_main.h)
include_directories(..)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry")
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-common freerdp-utils)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
if(NOT STATIC_CHANNELS)
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client")

View File

@@ -0,0 +1,159 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Input Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/cmdline.h>
#include <freerdp/addin.h>
#include <winpr/stream.h>
#include "rdpei_main.h"
typedef struct _RDPEI_LISTENER_CALLBACK RDPEI_LISTENER_CALLBACK;
struct _RDPEI_LISTENER_CALLBACK
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
};
typedef struct _RDPEI_CHANNEL_CALLBACK RDPEI_CHANNEL_CALLBACK;
struct _RDPEI_CHANNEL_CALLBACK
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
};
typedef struct _RDPEI_PLUGIN RDPEI_PLUGIN;
struct _RDPEI_PLUGIN
{
IWTSPlugin iface;
RDPEI_LISTENER_CALLBACK* listener_callback;
};
static int rdpei_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 cbSize, BYTE* pBuffer)
{
int status = 0;
//RDPEI_CHANNEL_CALLBACK* callback = (RDPEI_CHANNEL_CALLBACK*) pChannelCallback;
return status;
}
static int rdpei_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
RDPEI_CHANNEL_CALLBACK* callback = (RDPEI_CHANNEL_CALLBACK*) pChannelCallback;
DEBUG_DVC("");
free(callback);
return 0;
}
static int rdpei_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
RDPEI_CHANNEL_CALLBACK* callback;
RDPEI_LISTENER_CALLBACK* listener_callback = (RDPEI_LISTENER_CALLBACK*) pListenerCallback;
DEBUG_DVC("");
callback = (RDPEI_CHANNEL_CALLBACK*) malloc(sizeof(RDPEI_CHANNEL_CALLBACK));
ZeroMemory(callback, sizeof(RDPEI_CHANNEL_CALLBACK));
callback->iface.OnDataReceived = rdpei_on_data_received;
callback->iface.OnClose = rdpei_on_close;
callback->plugin = listener_callback->plugin;
callback->channel_mgr = listener_callback->channel_mgr;
callback->channel = pChannel;
*ppCallback = (IWTSVirtualChannelCallback*) callback;
return 0;
}
static int rdpei_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManager* pChannelMgr)
{
RDPEI_PLUGIN* echo = (RDPEI_PLUGIN*) pPlugin;
DEBUG_DVC("");
echo->listener_callback = (RDPEI_LISTENER_CALLBACK*) malloc(sizeof(RDPEI_LISTENER_CALLBACK));
ZeroMemory(echo->listener_callback, sizeof(RDPEI_LISTENER_CALLBACK));
echo->listener_callback->iface.OnNewChannelConnection = rdpei_on_new_channel_connection;
echo->listener_callback->plugin = pPlugin;
echo->listener_callback->channel_mgr = pChannelMgr;
return pChannelMgr->CreateListener(pChannelMgr, "Microsoft::Windows::RDS::Input", 0,
(IWTSListenerCallback*) echo->listener_callback, NULL);
}
static int rdpei_plugin_terminated(IWTSPlugin* pPlugin)
{
RDPEI_PLUGIN* echo = (RDPEI_PLUGIN*) pPlugin;
DEBUG_DVC("");
free(echo);
return 0;
}
#ifdef STATIC_CHANNELS
#define DVCPluginEntry rdpei_DVCPluginEntry
#endif
int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
{
int error = 0;
RDPEI_PLUGIN* rdpei;
rdpei = (RDPEI_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "rdpei");
if (rdpei == NULL)
{
rdpei = (RDPEI_PLUGIN*) malloc(sizeof(RDPEI_PLUGIN));
ZeroMemory(rdpei, sizeof(RDPEI_PLUGIN));
rdpei->iface.Initialize = rdpei_plugin_initialize;
rdpei->iface.Connected = NULL;
rdpei->iface.Disconnected = NULL;
rdpei->iface.Terminated = rdpei_plugin_terminated;
error = pEntryPoints->RegisterPlugin(pEntryPoints, "rdpei", (IWTSPlugin*) rdpei);
}
return error;
}

View File

@@ -0,0 +1,39 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Input Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDPEI_CLIENT_MAIN_H
#define FREERDP_CHANNEL_RDPEI_CLIENT_MAIN_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/utils/debug.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif /* FREERDP_CHANNEL_RDPEI_CLIENT_MAIN_H */

View File

@@ -68,7 +68,7 @@ struct rdpsnd_alsa_plugin
#define SND_PCM_CHECK(_func, _status) \
if (_status < 0) \
{ \
printf("%s: %d\n", _func, _status); \
fprintf(stderr, "%s: %d\n", _func, _status); \
return -1; \
}
@@ -106,7 +106,7 @@ int rdpsnd_alsa_set_hw_params(rdpsndAlsaPlugin* alsa)
if (alsa->buffer_size > buffer_size_max)
{
printf("Warning: requested sound buffer size %d, got %d instead\n",
fprintf(stderr, "Warning: requested sound buffer size %d, got %d instead\n",
(int) alsa->buffer_size, (int) buffer_size_max);
alsa->buffer_size = buffer_size_max;
}
@@ -596,7 +596,7 @@ static void rdpsnd_alsa_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
}
else if (status < 0)
{
printf("status: %d\n", status);
fprintf(stderr, "status: %d\n", status);
snd_pcm_close(alsa->pcm_handle);
alsa->pcm_handle = NULL;
rdpsnd_alsa_open((rdpsndDevicePlugin*) alsa, NULL, alsa->latency);
@@ -617,7 +617,7 @@ static void rdpsnd_alsa_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
wave->wLatency = (UINT16) (wave->wLocalTimeB - wave->wLocalTimeA);
wave->wTimeStampB = wave->wTimeStampA + wave->wLatency;
//printf("wTimeStampA: %d wTimeStampB: %d wLatency: %d\n", wave->wTimeStampA, wave->wTimeStampB, wave->wLatency);
//fprintf(stderr, "wTimeStampA: %d wTimeStampB: %d wLatency: %d\n", wave->wTimeStampA, wave->wTimeStampB, wave->wLatency);
device->WaveConfirm(device, wave);
}

View File

@@ -110,7 +110,7 @@ static void rdpsnd_audio_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format,
&aq_plugin_p->aq_ref
);
if (rv != 0) {
printf("rdpsnd_audio_open: AudioQueueNewOutput() failed with error %d\n", rv);
fprintf(stderr, "rdpsnd_audio_open: AudioQueueNewOutput() failed with error %d\n", rv);
aq_plugin_p->is_open = 1;
return;
}
@@ -205,7 +205,7 @@ static void aq_playback_cb(void* user_data, AudioQueueRef aq_ref, AudioQueueBuff
int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
{
printf("freerdp_rdpsnd_client_subsystem_entry()\n\n");
fprintf(stderr, "freerdp_rdpsnd_client_subsystem_entry()\n\n");
ADDIN_ARGV* args;
rdpsndAudioQPlugin* aqPlugin;

View File

@@ -41,7 +41,7 @@
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/constants.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/signal.h>
#include <freerdp/utils/svc_plugin.h>
@@ -124,7 +124,7 @@ static void* rdpsnd_schedule_thread(void* arg)
void rdpsnd_send_quality_mode_pdu(rdpsndPlugin* rdpsnd)
{
STREAM* pdu;
wStream* pdu;
pdu = stream_new(8);
stream_write_BYTE(pdu, SNDC_QUALITYMODE); /* msgType */
@@ -178,20 +178,20 @@ void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
}
#if 0
printf("Server ");
fprintf(stderr, "Server ");
rdpsnd_print_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
printf("\n");
fprintf(stderr, "\n");
printf("Client ");
fprintf(stderr, "Client ");
rdpsnd_print_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
printf("\n");
fprintf(stderr, "\n");
#endif
}
void rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
{
int index;
STREAM* pdu;
wStream* pdu;
UINT16 length;
UINT32 dwVolume;
UINT16 dwVolumeLeft;
@@ -251,7 +251,7 @@ void rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
}
void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, STREAM* s)
void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
{
int index;
UINT16 wVersion;
@@ -300,7 +300,7 @@ void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, STREAM* s)
void rdpsnd_send_training_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, UINT16 wPackSize)
{
STREAM* pdu;
wStream* pdu;
pdu = stream_new(8);
stream_write_BYTE(pdu, SNDC_TRAINING); /* msgType */
@@ -312,7 +312,7 @@ void rdpsnd_send_training_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, U
svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
}
static void rdpsnd_recv_training_pdu(rdpsndPlugin* rdpsnd, STREAM* s)
static void rdpsnd_recv_training_pdu(rdpsndPlugin* rdpsnd, wStream* s)
{
UINT16 wTimeStamp;
UINT16 wPackSize;
@@ -323,7 +323,7 @@ static void rdpsnd_recv_training_pdu(rdpsndPlugin* rdpsnd, STREAM* s)
rdpsnd_send_training_confirm_pdu(rdpsnd, wTimeStamp, wPackSize);
}
static void rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, STREAM* s, UINT16 BodySize)
static void rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, wStream* s, UINT16 BodySize)
{
UINT16 wFormatNo;
AUDIO_FORMAT* format;
@@ -365,7 +365,7 @@ static void rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, STREAM* s, UINT16 Bo
void rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, BYTE cConfirmedBlockNo)
{
STREAM* pdu;
wStream* pdu;
pdu = stream_new(8);
stream_write_BYTE(pdu, SNDC_WAVECONFIRM);
@@ -383,7 +383,7 @@ void rdpsnd_device_send_wave_confirm_pdu(rdpsndDevicePlugin* device, RDPSND_WAVE
MessageQueue_Post(device->rdpsnd->queue, NULL, 0, (void*) wave, NULL);
}
static void rdpsnd_recv_wave_pdu(rdpsndPlugin* rdpsnd, STREAM* s)
static void rdpsnd_recv_wave_pdu(rdpsndPlugin* rdpsnd, wStream* s)
{
int size;
BYTE* data;
@@ -454,7 +454,7 @@ static void rdpsnd_recv_close_pdu(rdpsndPlugin* rdpsnd)
rdpsnd->isOpen = FALSE;
}
static void rdpsnd_recv_volume_pdu(rdpsndPlugin* rdpsnd, STREAM* s)
static void rdpsnd_recv_volume_pdu(rdpsndPlugin* rdpsnd, wStream* s)
{
UINT32 dwVolume;
@@ -467,7 +467,7 @@ static void rdpsnd_recv_volume_pdu(rdpsndPlugin* rdpsnd, STREAM* s)
}
}
static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, STREAM* s)
static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, wStream* s)
{
BYTE msgType;
UINT16 BodySize;
@@ -484,7 +484,7 @@ static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, STREAM* s)
stream_seek_BYTE(s); /* bPad */
stream_read_UINT16(s, BodySize);
//printf("msgType %d BodySize %d\n", msgType, BodySize);
//fprintf(stderr, "msgType %d BodySize %d\n", msgType, BodySize);
switch (msgType)
{
@@ -693,7 +693,7 @@ static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
}
}
static void rdpsnd_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
static void rdpsnd_process_event(rdpSvcPlugin* plugin, wMessage* event)
{
freerdp_event_free(event);
}

View File

@@ -29,9 +29,9 @@
#include <winpr/print.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/utils/stream.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/server/rdpsnd.h>
@@ -42,7 +42,7 @@ typedef struct _rdpsnd_server
HANDLE thread;
HANDLE StopEvent;
void* rdpsnd_channel;
STREAM* rdpsnd_pdu;
wStream* rdpsnd_pdu;
FREERDP_DSP_CONTEXT* dsp_context;
BYTE* out_buffer;
@@ -55,7 +55,7 @@ typedef struct _rdpsnd_server
} rdpsnd_server;
static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s)
static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, wStream* s)
{
int pos;
UINT16 i;
@@ -104,7 +104,7 @@ static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s)
return status;
}
static void rdpsnd_server_recv_waveconfirm(rdpsnd_server* rdpsnd, STREAM* s)
static void rdpsnd_server_recv_waveconfirm(rdpsnd_server* rdpsnd, wStream* s)
{
//unhandled for now
@@ -115,7 +115,7 @@ static void rdpsnd_server_recv_waveconfirm(rdpsnd_server* rdpsnd, STREAM* s)
stream_seek_BYTE(s); // padding
}
static void rdpsnd_server_recv_quality_mode(rdpsnd_server* rdpsnd, STREAM* s)
static void rdpsnd_server_recv_quality_mode(rdpsnd_server* rdpsnd, wStream* s)
{
//unhandled for now
UINT16 quality;
@@ -123,10 +123,10 @@ static void rdpsnd_server_recv_quality_mode(rdpsnd_server* rdpsnd, STREAM* s)
stream_read_UINT16(s, quality);
stream_seek_UINT16(s); // reserved
printf("Client requested sound quality: %#0X\n", quality);
fprintf(stderr, "Client requested sound quality: %#0X\n", quality);
}
static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, wStream* s)
{
int i, num_known_format = 0;
UINT32 flags, vol, pitch;
@@ -174,7 +174,7 @@ static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
if (num_known_format == 0)
{
printf("Client doesnt support any known formats!\n");
fprintf(stderr, "Client doesnt support any known formats!\n");
return FALSE;
}
@@ -184,7 +184,7 @@ static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
static void* rdpsnd_server_thread_func(void* arg)
{
void* fd;
STREAM* s;
wStream* s;
void* buffer;
DWORD status;
BYTE msgType;
@@ -251,7 +251,7 @@ static void* rdpsnd_server_thread_func(void* arg)
}
break;
default:
printf("UNKOWN MESSAGE TYPE!! (%#0X)\n\n", msgType);
fprintf(stderr, "UNKOWN MESSAGE TYPE!! (%#0X)\n\n", msgType);
break;
}
}
@@ -293,7 +293,7 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie
if (client_format_index < 0 || client_format_index >= context->num_client_formats)
{
printf("rdpsnd_server_select_format: index %d is not correct.\n", client_format_index);
fprintf(stderr, "rdpsnd_server_select_format: index %d is not correct.\n", client_format_index);
return;
}
@@ -305,7 +305,7 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie
if (format->nSamplesPerSec == 0)
{
printf("Invalid Client Sound Format!!\n\n");
fprintf(stderr, "Invalid Client Sound Format!!\n\n");
return;
}
@@ -350,7 +350,7 @@ static BOOL rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
BOOL status;
AUDIO_FORMAT* format;
int tbytes_per_frame;
STREAM* s = rdpsnd->rdpsnd_pdu;
wStream* s = rdpsnd->rdpsnd_pdu;
format = &rdpsnd->context.client_formats[rdpsnd->context.selected_client_format];
tbytes_per_frame = format->nChannels * rdpsnd->src_bytes_per_sample;
@@ -463,7 +463,7 @@ static BOOL rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, i
int pos;
BOOL status;
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
STREAM* s = rdpsnd->rdpsnd_pdu;
wStream* s = rdpsnd->rdpsnd_pdu;
stream_write_BYTE(s, SNDC_SETVOLUME);
stream_write_BYTE(s, 0);
@@ -487,7 +487,7 @@ static BOOL rdpsnd_server_close(rdpsnd_server_context* context)
int pos;
BOOL status;
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
STREAM* s = rdpsnd->rdpsnd_pdu;
wStream* s = rdpsnd->rdpsnd_pdu;
if (rdpsnd->context.selected_client_format < 0)
return FALSE;

View File

@@ -34,7 +34,7 @@
#include <freerdp/types.h>
#include <freerdp/constants.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/svc_plugin.h>
@@ -47,17 +47,17 @@ struct sample_plugin
/* put your private data here */
};
static void sample_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
static void sample_process_receive(rdpSvcPlugin* plugin, wStream* data_in)
{
int bytes;
STREAM* data_out;
wStream* data_out;
samplePlugin* sample = (samplePlugin*) plugin;
printf("sample_process_receive:\n");
fprintf(stderr, "sample_process_receive:\n");
if (!sample)
{
printf("sample_process_receive: sample is nil\n");
fprintf(stderr, "sample_process_receive: sample is nil\n");
return;
}
@@ -65,7 +65,7 @@ static void sample_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
/* here we just send the same data back */
bytes = stream_get_size(data_in);
printf("sample_process_receive: got bytes %d\n", bytes);
fprintf(stderr, "sample_process_receive: got bytes %d\n", bytes);
if (bytes > 0)
{
@@ -75,7 +75,7 @@ static void sample_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
we do not free it */
bytes = stream_get_length(data_in);
printf("sample_process_receive: sending bytes %d\n", bytes);
fprintf(stderr, "sample_process_receive: sending bytes %d\n", bytes);
svc_plugin_send(plugin, data_out);
}
@@ -88,15 +88,15 @@ static void sample_process_connect(rdpSvcPlugin* plugin)
samplePlugin* sample = (samplePlugin*) plugin;
DEBUG_SVC("connecting");
printf("sample_process_connect:\n");
fprintf(stderr, "sample_process_connect:\n");
if (!sample)
return;
}
static void sample_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
static void sample_process_event(rdpSvcPlugin* plugin, wMessage* event)
{
printf("sample_process_event:\n");
fprintf(stderr, "sample_process_event:\n");
/* events coming from main freerdp window to plugin */
/* send them back with svc_plugin_send_event */
@@ -108,7 +108,7 @@ static void sample_process_terminate(rdpSvcPlugin* plugin)
{
samplePlugin* sample = (samplePlugin*) plugin;
printf("sample_process_terminate:\n");
fprintf(stderr, "sample_process_terminate:\n");
if (!sample)
return;

View File

@@ -26,7 +26,7 @@ int main()
if (!ret)
{
long err = GetLastError();
printf("error 0x%8.8x\n", err);
fprintf(stderr, "error 0x%8.8x\n", err);
return 1;
}
@@ -34,12 +34,12 @@ int main()
if (!ret)
{
long err = GetLastError();
printf("error 0x%8.8x\n", err);
fprintf(stderr, "error 0x%8.8x\n", err);
return 1;
}
if (written != DSIZE)
{
printf("error read %d\n", written);
fprintf(stderr, "error read %d\n", written);
return 1;
}
@@ -49,11 +49,11 @@ int main()
}
else
{
printf("error data no match\n");
fprintf(stderr, "error data no match\n");
return 1;
}
printf("Success!\n");
fprintf(stderr, "Success!\n");
Sleep(2000);
return 0;

View File

@@ -44,10 +44,13 @@
#include "serial_constants.h"
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/collections.h>
#include <freerdp/freerdp.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/thread.h>
#include <freerdp/utils/list.h>
#include <winpr/stream.h>
#include <freerdp/channels/rdpdr.h>
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
@@ -59,9 +62,11 @@ struct _SERIAL_DEVICE
char* path;
SERIAL_TTY* tty;
LIST* irp_list;
HANDLE thread;
HANDLE stopEvent;
wQueue* queue;
LIST* pending_irps;
freerdp_thread* thread;
HANDLE in_event;
fd_set read_fds;
@@ -253,7 +258,7 @@ static void serial_process_irp_device_control(SERIAL_DEVICE* serial, IRP* irp)
tty = serial->tty;
if (tty == NULL)
if (!tty)
{
irp->IoStatus = STATUS_UNSUCCESSFUL;
OutputBufferLength = 0;
@@ -314,34 +319,18 @@ static void serial_process_irp(SERIAL_DEVICE* serial, IRP* irp)
serial_check_for_events(serial);
}
static void serial_process_irp_list(SERIAL_DEVICE* serial)
{
IRP* irp;
while (1)
{
if (freerdp_thread_is_stopped(serial->thread))
break;
freerdp_thread_lock(serial->thread);
irp = (IRP*) list_dequeue(serial->irp_list);
freerdp_thread_unlock(serial->thread);
if (irp == NULL)
break;
serial_process_irp(serial, irp);
}
}
static void* serial_thread_func(void* arg)
{
IRP* irp;
DWORD status;
SERIAL_DEVICE* serial = (SERIAL_DEVICE*)arg;
while (1)
{
if (freerdp_thread_wait_timeout(serial->thread, 500) < 0)
if (WaitForSingleObject(serial->stopEvent, 0) == WAIT_OBJECT_0)
break;
if (WaitForSingleObject(Queue_Event(serial->queue), 10) == WAIT_OBJECT_0)
break;
serial->nfds = 1;
@@ -352,23 +341,20 @@ static void* serial_thread_func(void* arg)
serial->tv.tv_usec = 0;
serial->select_timeout = 0;
if (freerdp_thread_is_stopped(serial->thread))
break;
irp = (IRP*) Queue_Dequeue(serial->queue);
freerdp_thread_reset(serial->thread);
serial_process_irp_list(serial);
if (irp)
serial_process_irp(serial, irp);
status = WaitForSingleObject(serial->in_event, 0);
if ((status == WAIT_OBJECT_0) || (status == WAIT_TIMEOUT))
{
if (serial_check_fds(serial))
ResetEvent(serial->in_event);
if (serial_check_fds(serial))
ResetEvent(serial->in_event);
}
}
freerdp_thread_quit(serial->thread);
return NULL;
}
@@ -376,40 +362,26 @@ static void serial_irp_request(DEVICE* device, IRP* irp)
{
SERIAL_DEVICE* serial = (SERIAL_DEVICE*) device;
freerdp_thread_lock(serial->thread);
list_enqueue(serial->irp_list, irp);
freerdp_thread_unlock(serial->thread);
freerdp_thread_signal(serial->thread);
Queue_Enqueue(serial->queue, irp);
}
static void serial_free(DEVICE* device)
{
IRP* irp;
SERIAL_DEVICE* serial = (SERIAL_DEVICE*) device;
DEBUG_SVC("freeing device");
freerdp_thread_stop(serial->thread);
freerdp_thread_free(serial->thread);
SetEvent(serial->stopEvent);
while ((irp = (IRP*) list_dequeue(serial->irp_list)) != NULL)
irp->Discard(irp);
list_free(serial->irp_list);
while ((irp = (IRP*) list_dequeue(serial->pending_irps)) != NULL)
irp->Discard(irp);
list_free(serial->pending_irps);
/* TODO: free lists */
free(serial);
}
static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32 abort_io, UINT32 io_status)
{
IRP* irp = NULL;
UINT32 major;
IRP* irp = NULL;
SERIAL_TTY* tty;
DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps));
@@ -626,7 +598,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial)
prev = irp;
irp = (IRP*) list_next(serial->pending_irps, irp);
if (irp_completed || prev->IoStatus == STATUS_SUCCESS)
if (irp_completed || (prev->IoStatus == STATUS_SUCCESS))
{
list_remove(serial->pending_irps, prev);
SetEvent(serial->in_event);
@@ -737,14 +709,15 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
stream_write_BYTE(serial->device.data, name[i] < 0 ? '_' : name[i]);
serial->path = path;
serial->irp_list = list_new();
serial->queue = Queue_New(TRUE, -1, -1);
serial->pending_irps = list_new();
serial->thread = freerdp_thread_new();
serial->in_event = CreateEvent(NULL, TRUE, FALSE, NULL);
serial->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) serial);
freerdp_thread_start(serial->thread, serial_thread_func, serial);
serial->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) serial_thread_func, (void*) serial, 0, NULL);
}
return 0;

View File

@@ -29,9 +29,8 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/thread.h>
#include <freerdp/utils/svc_plugin.h>
#include <freerdp/channels/rdpdr.h>
@@ -79,7 +78,7 @@ static void tty_set_termios(SERIAL_TTY* tty);
static BOOL tty_get_termios(SERIAL_TTY* tty);
static int tty_get_error_status();
UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, STREAM* input, STREAM* output, UINT32* abort_io)
UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input, wStream* output, UINT32* abort_io)
{
int purge_mask;
UINT32 result;
@@ -372,9 +371,9 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, STREAM* input,
BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length)
{
ssize_t r;
ssize_t status;
long timeout = 90;
struct termios *ptermios;
struct termios* ptermios;
DEBUG_SVC("in");
ptermios = tty->ptermios;
@@ -410,13 +409,13 @@ BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length)
ZeroMemory(buffer, *Length);
r = read(tty->fd, buffer, *Length);
status = read(tty->fd, buffer, *Length);
if (r < 0)
if (status < 0)
return FALSE;
tty->event_txempty = r;
*Length = r;
tty->event_txempty = status;
*Length = status;
return TRUE;
}
@@ -550,7 +549,7 @@ SERIAL_TTY* serial_tty_new(const char* path, UINT32 id)
BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result)
{
int bytes;
BOOL ret = FALSE;
BOOL status = FALSE;
DEBUG_SVC("in");
@@ -579,7 +578,7 @@ BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result)
{
DEBUG_SVC("SERIAL_EV_RLSD");
*result |= SERIAL_EV_RLSD;
ret = TRUE;
status = TRUE;
}
}
@@ -588,14 +587,14 @@ BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result)
{
DEBUG_SVC("SERIAL_EV_RXFLAG bytes %d", bytes);
*result |= SERIAL_EV_RXFLAG;
ret = TRUE;
status = TRUE;
}
if ((tty->wait_mask & SERIAL_EV_RXCHAR))
{
DEBUG_SVC("SERIAL_EV_RXCHAR bytes %d", bytes);
*result |= SERIAL_EV_RXCHAR;
ret = TRUE;
status = TRUE;
}
}
@@ -611,7 +610,7 @@ BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result)
{
DEBUG_SVC("SERIAL_EV_TXEMPTY");
*result |= SERIAL_EV_TXEMPTY;
ret = TRUE;
status = TRUE;
}
tty->event_txempty = bytes;
#endif
@@ -624,7 +623,7 @@ BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result)
{
DEBUG_SVC("SERIAL_EV_DSR %s", (bytes & TIOCM_DSR) ? "ON" : "OFF");
*result |= SERIAL_EV_DSR;
ret = TRUE;
status = TRUE;
}
}
@@ -635,14 +634,14 @@ BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result)
{
DEBUG_SVC("SERIAL_EV_CTS %s", (bytes & TIOCM_CTS) ? "ON" : "OFF");
*result |= SERIAL_EV_CTS;
ret = TRUE;
status = TRUE;
}
}
if (ret)
if (status)
tty->event_pending = 0;
return ret;
return status;
}
static BOOL tty_get_termios(SERIAL_TTY* tty)

View File

@@ -29,7 +29,8 @@
#endif
#include <freerdp/types.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
typedef struct _SERIAL_TTY SERIAL_TTY;
@@ -71,7 +72,7 @@ void serial_tty_free(SERIAL_TTY* tty);
BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length);
BOOL serial_tty_write(SERIAL_TTY* tty, BYTE* buffer, UINT32 Length);
UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, STREAM* input, STREAM* output, UINT32* abort_io);
UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input, wStream* output, UINT32* abort_io);
BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result);

View File

@@ -128,7 +128,7 @@ static void wts_queue_send_item(rdpPeerChannel* channel, wts_data_item* item)
SetEvent(vcm->send_event);
}
static int wts_read_variable_uint(STREAM* s, int cbLen, UINT32* val)
static int wts_read_variable_uint(wStream* s, int cbLen, UINT32* val)
{
switch (cbLen)
{
@@ -167,7 +167,7 @@ static void wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, UINT
channel->vcm->drdynvc_state = DRDYNVC_STATE_READY;
}
static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, STREAM* s, UINT32 length)
static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, wStream* s, UINT32 length)
{
UINT32 CreationStatus;
@@ -190,7 +190,7 @@ static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, STREAM* s,
SetEvent(channel->receive_event);
}
static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, STREAM* s, int cbLen, UINT32 length)
static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, wStream* s, int cbLen, UINT32 length)
{
int value;
@@ -209,14 +209,14 @@ static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, STREAM* s, int
stream_write(channel->receive_data, stream_get_tail(s), length);
}
static void wts_read_drdynvc_data(rdpPeerChannel* channel, STREAM* s, UINT32 length)
static void wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 length)
{
if (channel->dvc_total_length > 0)
{
if (stream_get_length(channel->receive_data) + length > channel->dvc_total_length)
{
channel->dvc_total_length = 0;
printf("wts_read_drdynvc_data: incorrect fragment data, discarded.\n");
fprintf(stderr, "wts_read_drdynvc_data: incorrect fragment data, discarded.\n");
return;
}
@@ -300,7 +300,7 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
break;
default:
printf("wts_read_drdynvc_pdu: Cmd %d not recognized.\n", Cmd);
fprintf(stderr, "wts_read_drdynvc_pdu: Cmd %d not recognized.\n", Cmd);
break;
}
}
@@ -311,11 +311,11 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
}
else
{
printf("wts_read_drdynvc_pdu: received Cmd %d but channel is not ready.\n", Cmd);
fprintf(stderr, "wts_read_drdynvc_pdu: received Cmd %d but channel is not ready.\n", Cmd);
}
}
static int wts_write_variable_uint(STREAM* stream, UINT32 val)
static int wts_write_variable_uint(wStream* stream, UINT32 val)
{
int cb;
@@ -338,7 +338,7 @@ static int wts_write_variable_uint(STREAM* stream, UINT32 val)
return cb;
}
static void wts_write_drdynvc_header(STREAM *s, BYTE Cmd, UINT32 ChannelId)
static void wts_write_drdynvc_header(wStream *s, BYTE Cmd, UINT32 ChannelId)
{
BYTE* bm;
int cbChId;
@@ -349,7 +349,7 @@ static void wts_write_drdynvc_header(STREAM *s, BYTE Cmd, UINT32 ChannelId)
*bm = ((Cmd & 0x0F) << 4) | cbChId;
}
static void wts_write_drdynvc_create_request(STREAM *s, UINT32 ChannelId, const char *ChannelName)
static void wts_write_drdynvc_create_request(wStream *s, UINT32 ChannelId, const char *ChannelName)
{
UINT32 len;
@@ -373,7 +373,7 @@ static void WTSProcessChannelData(rdpPeerChannel* channel, int channelId, BYTE*
{
if (stream_get_length(channel->receive_data) != total_size)
{
printf("WTSProcessChannelData: read error\n");
fprintf(stderr, "WTSProcessChannelData: read error\n");
}
if (channel == channel->vcm->drdynvc_channel)
{
@@ -545,7 +545,7 @@ void* WTSVirtualChannelOpenEx(
{
int i;
int len;
STREAM* s;
wStream* s;
rdpPeerChannel* channel;
freerdp_peer* client = vcm->client;
@@ -745,7 +745,7 @@ BOOL WTSVirtualChannelWrite(
{
rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;
wts_data_item* item;
STREAM* s;
wStream* s;
int cbLen;
int cbChId;
int first;
@@ -822,7 +822,7 @@ BOOL WTSVirtualChannelWrite(
BOOL WTSVirtualChannelClose(
/* __in */ void* hChannelHandle)
{
STREAM* s;
wStream* s;
wts_data_item* item;
WTSVirtualChannelManager* vcm;
rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;

View File

@@ -22,12 +22,12 @@
#define __WTSVC_H
#include <freerdp/freerdp.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/wtsvc.h>
#include <winpr/synch.h>
#include <winpr/stream.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
@@ -66,7 +66,7 @@ struct rdp_peer_channel
UINT16 channel_type;
UINT16 index;
STREAM* receive_data;
wStream* receive_data;
HANDLE receive_event;
LIST* receive_queue;
HANDLE mutex;

View File

@@ -73,7 +73,7 @@ static void smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp)
break;
default:
printf("MajorFunction 0x%X unexpected for smartcards.", irp->MajorFunction);
fprintf(stderr, "MajorFunction 0x%X unexpected for smartcards.", irp->MajorFunction);
DEBUG_WARN("Smartcard MajorFunction 0x%X not supported.", irp->MajorFunction);
irp->IoStatus = STATUS_NOT_SUPPORTED;
irp->Complete(irp);

View File

@@ -38,13 +38,12 @@
#undef BOOL
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/stream.h>
#include <freerdp/freerdp.h>
#include <winpr/print.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/svc_plugin.h>
#include <freerdp/utils/thread.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/utils/svc_plugin.h>
#include "smartcard_main.h"
@@ -750,10 +749,10 @@ static UINT32 handle_State(IRP* irp)
(unsigned) hCard, (int) atrLen, (unsigned) state, (unsigned) protocol);
#ifdef WITH_DEBUG_SCARD
printf(" ATR: ");
fprintf(stderr, " ATR: ");
for (i = 0; i < atrLen; i++)
printf("%02x%c", pbAtr[i], (i == atrLen - 1) ? ' ' : ':');
printf("\n");
fprintf(stderr, "%02x%c", pbAtr[i], (i == atrLen - 1) ? ' ' : ':');
fprintf(stderr, "\n");
#endif
state = smartcard_map_state(state);
@@ -823,10 +822,10 @@ static DWORD handle_Status(IRP *irp, BOOL wide)
DEBUG_SCARD(" Reader: \"%s\"", readerName ? readerName : "NULL");
#ifdef WITH_DEBUG_SCARD
printf(" ATR: ");
fprintf(stderr, " ATR: ");
for (i = 0; i < atrLen; i++)
printf("%02x%c", pbAtr[i], (i == atrLen - 1) ? ' ' : ':');
printf("\n");
fprintf(stderr, "%02x%c", pbAtr[i], (i == atrLen - 1) ? ' ' : ':');
fprintf(stderr, "\n");
#endif
state = smartcard_map_state(state);
@@ -1181,7 +1180,7 @@ static UINT32 handle_AccessStartedEvent(IRP* irp)
void scard_error(SMARTCARD_DEVICE* scard, IRP* irp, UINT32 ntstatus)
{
/* [MS-RDPESC] 3.1.4.4 */
printf("scard processing error %x\n", ntstatus);
fprintf(stderr, "scard processing error %x\n", ntstatus);
stream_set_pos(irp->output, 0); /* CHECKME */
irp->IoStatus = ntstatus;
@@ -1516,7 +1515,7 @@ void smartcard_device_control(SMARTCARD_DEVICE* scard, IRP* irp)
default:
result = 0xc0000001;
printf("scard unknown ioctl 0x%x\n", ioctl_code);
fprintf(stderr, "scard unknown ioctl 0x%x\n", ioctl_code);
break;
}

View File

@@ -57,9 +57,15 @@ if(WITH_FFMPEG)
add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "ffmpeg" "decoder")
endif()
if(WITH_XRANDR)
if(GSTREAMER_FOUND)
if(WITH_GSTREAMER)
set(XRANDR_FEATURE_TYPE "REQUIRED")
set(XRANDR_FEATURE_PURPOSE "X11 randr")
set(XRANDR_FEATURE_DESCRIPTION "X11 randr extension")
find_feature(XRandR ${XRANDR_FEATURE_TYPE} ${XRANDR_FEATURE_PURPOSE} ${XRANDR_FEATURE_DESCRIPTION})
if (WITH_XRANDR)
add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "gstreamer" "decoder")
else()
message(WARNING "Disabling tsmf gstreamer because XRandR wasn't found")
endif()
endif()

View File

@@ -29,8 +29,11 @@
#include <freerdp/utils/event.h>
#include <freerdp/client/tsmf.h>
#include <libavcodec/avcodec.h>
#include <pthread.h>
#include "tsmf_constants.h"
#include "tsmf_decoder.h"
@@ -533,7 +536,7 @@ ITSMFDecoder* freerdp_tsmf_client_decoder_subsystem_entry(void)
initialized = TRUE;
}
printf("TSMFDecoderEntry FFMPEG\n");
fprintf(stderr, "TSMFDecoderEntry FFMPEG\n");
decoder = (TSMFFFmpegDecoder*) malloc(sizeof(TSMFFFmpegDecoder));
ZeroMemory(decoder, sizeof(TSMFFFmpegDecoder));

View File

@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <winpr/print.h>
#include "tsmf_constants.h"
@@ -265,26 +265,26 @@ static void tsmf_print_guid(const BYTE* guid)
int i;
for (i = 3; i >= 0; i--)
printf("%02X", guid[i]);
printf("-");
fprintf(stderr, "%02X", guid[i]);
fprintf(stderr, "-");
for (i = 5; i >= 4; i--)
printf("%02X", guid[i]);
printf("-");
fprintf(stderr, "%02X", guid[i]);
fprintf(stderr, "-");
for (i = 7; i >= 6; i--)
printf("%02X", guid[i]);
printf("-");
fprintf(stderr, "%02X", guid[i]);
fprintf(stderr, "-");
for (i = 8; i < 16; i++)
{
printf("%02X", guid[i]);
fprintf(stderr, "%02X", guid[i]);
if (i == 9)
printf("-");
fprintf(stderr, "-");
}
printf("\n");
fprintf(stderr, "\n");
#endif
}
/* http://msdn.microsoft.com/en-us/library/dd318229.aspx */
static UINT32 tsmf_codec_parse_BITMAPINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, STREAM* s, BOOL bypass)
static UINT32 tsmf_codec_parse_BITMAPINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, wStream* s, BOOL bypass)
{
UINT32 biSize;
UINT32 biWidth;
@@ -308,7 +308,7 @@ static UINT32 tsmf_codec_parse_BITMAPINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, STR
}
/* http://msdn.microsoft.com/en-us/library/dd407326.aspx */
static UINT32 tsmf_codec_parse_VIDEOINFOHEADER2(TS_AM_MEDIA_TYPE* mediatype, STREAM* s)
static UINT32 tsmf_codec_parse_VIDEOINFOHEADER2(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
{
UINT64 AvgTimePerFrame;
@@ -334,7 +334,7 @@ static UINT32 tsmf_codec_parse_VIDEOINFOHEADER2(TS_AM_MEDIA_TYPE* mediatype, STR
}
/* http://msdn.microsoft.com/en-us/library/dd390700.aspx */
static UINT32 tsmf_codec_parse_VIDEOINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, STREAM* s)
static UINT32 tsmf_codec_parse_VIDEOINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
{
/*
typedef struct tagVIDEOINFOHEADER {
@@ -367,7 +367,7 @@ typedef struct tagVIDEOINFOHEADER {
return 48;
}
BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s)
BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
{
int i;
UINT32 cbFormat;
@@ -514,7 +514,7 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s)
return ret;
}
BOOL tsmf_codec_check_media_type(STREAM* s)
BOOL tsmf_codec_check_media_type(wStream* s)
{
BYTE* m;
BOOL ret;

View File

@@ -22,8 +22,8 @@
#include "tsmf_types.h"
BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s);
BOOL tsmf_codec_check_media_type(STREAM* s);
BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s);
BOOL tsmf_codec_check_media_type(wStream* s);
#endif

View File

@@ -28,7 +28,7 @@
#include <winpr/crt.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include "tsmf_types.h"
#include "tsmf_constants.h"

View File

@@ -31,9 +31,9 @@ struct _TSMF_IFMAN
UINT32 stream_id;
UINT32 message_id;
STREAM* input;
wStream* input;
UINT32 input_size;
STREAM* output;
wStream* output;
BOOL output_pending;
UINT32 output_interface_id;
};

View File

@@ -28,7 +28,7 @@
#include <winpr/crt.h>
#include <winpr/cmdline.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include "tsmf_types.h"
#include "tsmf_constants.h"
@@ -77,7 +77,7 @@ struct _TSMF_PLUGIN
void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback,
UINT32 message_id, UINT64 duration, UINT32 data_size)
{
STREAM* s;
wStream* s;
int status;
TSMF_CHANNEL_CALLBACK* callback = (TSMF_CHANNEL_CALLBACK*) pChannelCallback;
@@ -100,7 +100,7 @@ void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback,
stream_free(s);
}
BOOL tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback, RDP_EVENT* event)
BOOL tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback, wMessage* event)
{
int status;
TSMF_CHANNEL_CALLBACK* callback = (TSMF_CHANNEL_CALLBACK*) pChannelCallback;
@@ -121,8 +121,8 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
BYTE* pBuffer)
{
int length;
STREAM* input;
STREAM* output;
wStream* input;
wStream* output;
int status = -1;
TSMF_IFMAN ifman;
UINT32 MessageId;

View File

@@ -23,7 +23,7 @@
void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback,
UINT32 message_id, UINT64 duration, UINT32 data_size);
BOOL tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback,
RDP_EVENT* event);
wMessage* event);
#endif

View File

@@ -36,16 +36,15 @@
#endif
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/collections.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/thread.h>
#include <freerdp/utils/event.h>
#include <freerdp/client/tsmf.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include "tsmf_constants.h"
#include "tsmf_types.h"
#include "tsmf_decoder.h"
@@ -54,6 +53,8 @@
#include "tsmf_codec.h"
#include "tsmf_media.h"
#include <pthread.h>
#define AUDIO_TOLERANCE 10000000LL
struct _TSMF_PRESENTATION
@@ -83,8 +84,8 @@ struct _TSMF_PRESENTATION
UINT64 audio_start_time;
UINT64 audio_end_time;
/* The stream list could be accessed by different threads and need to be protected. */
HANDLE mutex;
HANDLE thread;
LIST* stream_list;
};
@@ -112,12 +113,13 @@ struct _TSMF_STREAM
/* Next sample should not start before this system time. */
UINT64 next_start_time;
freerdp_thread* thread;
BOOL started;
LIST* sample_list;
HANDLE thread;
HANDLE stopEvent;
/* The sample ack response queue will be accessed only by the stream thread. */
LIST* sample_ack_list;
wQueue* sample_list;
wQueue* sample_ack_list;
};
struct _TSMF_SAMPLE
@@ -158,7 +160,7 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync)
BOOL pending = FALSE;
TSMF_PRESENTATION* presentation = stream->presentation;
if (list_size(stream->sample_list) == 0)
if (Queue_Count(stream->sample_list) < 1)
return NULL;
if (sync)
@@ -204,11 +206,9 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync)
if (pending)
return NULL;
freerdp_thread_lock(stream->thread);
sample = (TSMF_SAMPLE*) list_dequeue(stream->sample_list);
freerdp_thread_unlock(stream->thread);
sample = (TSMF_SAMPLE*) Queue_Dequeue(stream->sample_list);
if (sample && sample->end_time > stream->last_end_time)
if (sample && (sample->end_time > stream->last_end_time))
stream->last_end_time = sample->end_time;
return sample;
@@ -218,6 +218,7 @@ static void tsmf_sample_free(TSMF_SAMPLE* sample)
{
if (sample->data)
free(sample->data);
free(sample);
}
@@ -230,7 +231,7 @@ static void tsmf_sample_queue_ack(TSMF_SAMPLE* sample)
{
TSMF_STREAM* stream = sample->stream;
list_enqueue(stream->sample_ack_list, sample);
Queue_Enqueue(stream->sample_ack_list, sample);
}
static void tsmf_stream_process_ack(TSMF_STREAM* stream)
@@ -239,13 +240,16 @@ static void tsmf_stream_process_ack(TSMF_STREAM* stream)
UINT64 ack_time;
ack_time = get_current_time();
while (list_size(stream->sample_ack_list) > 0 && !freerdp_thread_is_stopped(stream->thread))
while ((Queue_Count(stream->sample_ack_list) > 0) && !(WaitForSingleObject(stream->stopEvent, 0) == WAIT_OBJECT_0))
{
sample = (TSMF_SAMPLE*) list_peek(stream->sample_ack_list);
if (!sample || sample->ack_time > ack_time)
sample = (TSMF_SAMPLE*) Queue_Peek(stream->sample_ack_list);
if (!sample || (sample->ack_time > ack_time))
break;
sample = list_dequeue(stream->sample_ack_list);
sample = Queue_Dequeue(stream->sample_ack_list);
tsmf_sample_ack(sample);
tsmf_sample_free(sample);
}
@@ -306,16 +310,19 @@ static void tsmf_presentation_restore_last_video_frame(TSMF_PRESENTATION* presen
if (presentation->last_width && presentation->last_height)
{
revent = (RDP_REDRAW_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_TSMF, RDP_EVENT_TYPE_TSMF_REDRAW,
revent = (RDP_REDRAW_EVENT*) freerdp_event_new(TsmfChannel_Class, TsmfChannel_Redraw,
NULL, NULL);
revent->x = presentation->last_x;
revent->y = presentation->last_y;
revent->width = presentation->last_width;
revent->height = presentation->last_height;
if (!tsmf_push_event(presentation->channel_callback, (RDP_EVENT*) revent))
if (!tsmf_push_event(presentation->channel_callback, (wMessage*) revent))
{
freerdp_event_free((RDP_EVENT*) revent);
freerdp_event_free((wMessage*) revent);
}
presentation->last_x = 0;
presentation->last_y = 0;
presentation->last_width = 0;
@@ -379,8 +386,9 @@ static void tsmf_sample_playback_video(TSMF_SAMPLE* sample)
}
}
vevent = (RDP_VIDEO_FRAME_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_TSMF, RDP_EVENT_TYPE_TSMF_VIDEO_FRAME,
vevent = (RDP_VIDEO_FRAME_EVENT*) freerdp_event_new(TsmfChannel_Class, TsmfChannel_VideoFrame,
NULL, NULL);
vevent->frame_data = sample->data;
vevent->frame_size = sample->decoded_size;
vevent->frame_pixfmt = sample->pixfmt;
@@ -406,9 +414,9 @@ static void tsmf_sample_playback_video(TSMF_SAMPLE* sample)
sample->data = NULL;
sample->decoded_size = 0;
if (!tsmf_push_event(sample->channel_callback, (RDP_EVENT*) vevent))
if (!tsmf_push_event(sample->channel_callback, (wMessage*) vevent))
{
freerdp_event_free((RDP_EVENT*) vevent);
freerdp_event_free((wMessage*) vevent);
}
#if 0
@@ -670,7 +678,8 @@ static void* tsmf_stream_playback_func(void* arg)
}
}
}
while (!freerdp_thread_is_stopped(stream->thread))
while (!(WaitForSingleObject(stream->stopEvent, 0) == WAIT_OBJECT_0))
{
tsmf_stream_process_ack(stream);
sample = tsmf_stream_pop_sample(stream, 1);
@@ -680,18 +689,20 @@ static void* tsmf_stream_playback_func(void* arg)
else
USleep(5000);
}
if (stream->eos || presentation->eos)
{
while ((sample = tsmf_stream_pop_sample(stream, 1)) != NULL)
tsmf_sample_playback(sample);
}
if (stream->audio)
{
stream->audio->Free(stream->audio);
stream->audio = NULL;
}
freerdp_thread_quit(stream->thread);
SetEvent(stream->stopEvent);
DEBUG_DVC("out %d", stream->stream_id);
@@ -700,9 +711,10 @@ static void* tsmf_stream_playback_func(void* arg)
static void tsmf_stream_start(TSMF_STREAM* stream)
{
if (!freerdp_thread_is_running(stream->thread))
if (!stream->started)
{
freerdp_thread_start(stream->thread, tsmf_stream_playback_func, stream);
ResumeThread(stream->thread);
stream->started = TRUE;
}
}
@@ -714,10 +726,12 @@ static void tsmf_stream_stop(TSMF_STREAM* stream)
if (!stream->decoder)
return;
if (freerdp_thread_is_running(stream->thread))
if (stream->started)
{
freerdp_thread_stop(stream->thread);
SetEvent(stream->stopEvent);
stream->started = FALSE;
}
if (stream->decoder->Control)
{
stream->decoder->Control(stream->decoder, Control_Flush, NULL);
@@ -830,30 +844,35 @@ void tsmf_presentation_stop(TSMF_PRESENTATION* presentation)
}
tsmf_presentation_restore_last_video_frame(presentation);
if (presentation->last_rects)
{
free(presentation->last_rects);
presentation->last_rects = NULL;
}
presentation->last_num_rects = 0;
if (presentation->output_rects)
{
free(presentation->output_rects);
presentation->output_rects = NULL;
}
presentation->output_num_rects = 0;
}
void tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation,
UINT32 x, UINT32 y, UINT32 width, UINT32 height,
int num_rects, RDP_RECT* rects)
UINT32 x, UINT32 y, UINT32 width, UINT32 height, int num_rects, RDP_RECT* rects)
{
presentation->output_x = x;
presentation->output_y = y;
presentation->output_width = width;
presentation->output_height = height;
if (presentation->output_rects)
free(presentation->output_rects);
presentation->output_rects = rects;
presentation->output_num_rects = num_rects;
}
@@ -866,13 +885,9 @@ void tsmf_presentation_set_audio_device(TSMF_PRESENTATION* presentation, const c
static void tsmf_stream_flush(TSMF_STREAM* stream)
{
TSMF_SAMPLE* sample;
//TSMF_SAMPLE* sample;
while ((sample = tsmf_stream_pop_sample(stream, 0)) != NULL)
tsmf_sample_free(sample);
while ((sample = list_dequeue(stream->sample_ack_list)) != NULL)
tsmf_sample_free(sample);
/* TODO: free lists */
if (stream->audio)
stream->audio->Flush(stream->audio);
@@ -880,6 +895,7 @@ static void tsmf_stream_flush(TSMF_STREAM* stream)
stream->eos = 0;
stream->last_end_time = 0;
stream->next_start_time = 0;
if (stream->major_type == TSMF_MAJOR_TYPE_AUDIO)
{
stream->presentation->audio_start_time = 0;
@@ -929,6 +945,7 @@ TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, UINT32 stream_id)
TSMF_STREAM* stream;
stream = tsmf_stream_find_by_id(presentation, stream_id);
if (stream)
{
DEBUG_WARN("duplicated stream id %d!", stream_id);
@@ -940,9 +957,14 @@ TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, UINT32 stream_id)
stream->stream_id = stream_id;
stream->presentation = presentation;
stream->thread = freerdp_thread_new();
stream->sample_list = list_new();
stream->sample_ack_list = list_new();
stream->started = FALSE;
stream->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
stream->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) tsmf_stream_playback_func, stream, CREATE_SUSPENDED, NULL);
stream->sample_list = Queue_New(TRUE, -1, -1);
stream->sample_ack_list = Queue_New(TRUE, -1, -1);
WaitForSingleObject(presentation->mutex, INFINITE);
list_enqueue(presentation->stream_list, stream);
@@ -959,13 +981,15 @@ TSMF_STREAM* tsmf_stream_find_by_id(TSMF_PRESENTATION* presentation, UINT32 stre
for (item = presentation->stream_list->head; item; item = item->next)
{
stream = (TSMF_STREAM*) item->data;
if (stream->stream_id == stream_id)
return stream;
}
return NULL;
}
void tsmf_stream_set_format(TSMF_STREAM* stream, const char* name, STREAM* s)
void tsmf_stream_set_format(TSMF_STREAM* stream, const char* name, wStream* s)
{
TS_AM_MEDIA_TYPE mediatype;
@@ -981,7 +1005,7 @@ void tsmf_stream_set_format(TSMF_STREAM* stream, const char* name, STREAM* s)
{
DEBUG_DVC("video width %d height %d bit_rate %d frame_rate %f codec_data %d",
mediatype.Width, mediatype.Height, mediatype.BitRate,
(double)mediatype.SamplesPerSecond.Numerator / (double)mediatype.SamplesPerSecond.Denominator,
(double) mediatype.SamplesPerSecond.Numerator / (double) mediatype.SamplesPerSecond.Denominator,
mediatype.ExtraDataSize);
}
else if (mediatype.MajorType == TSMF_MAJOR_TYPE_AUDIO)
@@ -989,9 +1013,11 @@ void tsmf_stream_set_format(TSMF_STREAM* stream, const char* name, STREAM* s)
DEBUG_DVC("audio channel %d sample_rate %d bits_per_sample %d codec_data %d",
mediatype.Channels, mediatype.SamplesPerSecond.Numerator, mediatype.BitsPerSample,
mediatype.ExtraDataSize);
stream->sample_rate = mediatype.SamplesPerSecond.Numerator;
stream->channels = mediatype.Channels;
stream->bits_per_sample = mediatype.BitsPerSample;
if (stream->bits_per_sample == 0)
stream->bits_per_sample = 16;
}
@@ -1019,8 +1045,8 @@ void tsmf_stream_free(TSMF_STREAM* stream)
list_remove(presentation->stream_list, stream);
ReleaseMutex(presentation->mutex);
list_free(stream->sample_list);
list_free(stream->sample_ack_list);
Queue_Free(stream->sample_list);
Queue_Free(stream->sample_ack_list);
if (stream->decoder)
{
@@ -1028,7 +1054,7 @@ void tsmf_stream_free(TSMF_STREAM* stream)
stream->decoder = 0;
}
freerdp_thread_free(stream->thread);
SetEvent(stream->thread);
free(stream);
stream = 0;
@@ -1063,11 +1089,9 @@ void tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pC
sample->data_size = data_size;
sample->data = malloc(data_size + TSMF_BUFFER_PADDING_SIZE);
ZeroMemory(sample->data, data_size + TSMF_BUFFER_PADDING_SIZE);
memcpy(sample->data, data, data_size);
CopyMemory(sample->data, data, data_size);
freerdp_thread_lock(stream->thread);
list_enqueue(stream->sample_list, sample);
freerdp_thread_unlock(stream->thread);
Queue_Enqueue(stream->sample_list, sample);
}
#ifndef _WIN32

View File

@@ -49,7 +49,7 @@ void tsmf_presentation_free(TSMF_PRESENTATION* presentation);
TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, UINT32 stream_id);
TSMF_STREAM* tsmf_stream_find_by_id(TSMF_PRESENTATION* presentation, UINT32 stream_id);
void tsmf_stream_set_format(TSMF_STREAM* stream, const char* name, STREAM* s);
void tsmf_stream_set_format(TSMF_STREAM* stream, const char* name, wStream* s);
void tsmf_stream_end(TSMF_STREAM* stream);
void tsmf_stream_free(TSMF_STREAM* stream);

View File

@@ -237,7 +237,7 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da
{
case IOCTL_INTERNAL_USB_SUBMIT_URB: /** 0x00220003 */
LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_SUBMIT_URB"));
printf(" Function IOCTL_INTERNAL_USB_SUBMIT_URB: Unchecked\n");
fprintf(stderr, " Function IOCTL_INTERNAL_USB_SUBMIT_URB: Unchecked\n");
break;
case IOCTL_INTERNAL_USB_RESET_PORT: /** 0x00220007 */
@@ -269,12 +269,12 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da
case IOCTL_INTERNAL_USB_CYCLE_PORT: /** 0x0022001F */
LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_CYCLE_PORT"));
printf(" Function IOCTL_INTERNAL_USB_CYCLE_PORT: Unchecked\n");
fprintf(stderr, " Function IOCTL_INTERNAL_USB_CYCLE_PORT: Unchecked\n");
break;
case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: /** 0x00220027 */
LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION"));
printf(" Function IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: Unchecked\n");
fprintf(stderr, " Function IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: Unchecked\n");
break;
default:
@@ -447,7 +447,7 @@ static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, BYTE* dat
if (transferDir == 0)
{
printf("urb_select_configuration: not support transfer out\n");
fprintf(stderr, "urb_select_configuration: not support transfer out\n");
return -1;
}
@@ -539,7 +539,7 @@ static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, U
if (transferDir == 0)
{
printf("urb_select_interface: not support transfer out\n");
fprintf(stderr, "urb_select_interface: not support transfer out\n");
return -1;
}
@@ -1296,7 +1296,7 @@ static int urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
switch (transferDir)
{
case USBD_TRANSFER_DIRECTION_OUT:
printf("Function urb_os_feature_descriptor_request: OUT Unchecked\n");
fprintf(stderr, "Function urb_os_feature_descriptor_request: OUT Unchecked\n");
memcpy(buffer, data + offset, OutputBufferSize);
break;
case USBD_TRANSFER_DIRECTION_IN:
@@ -1699,7 +1699,7 @@ static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE
switch (transferDir)
{
case USBD_TRANSFER_DIRECTION_OUT:
printf("Function urb_control_feature_request: OUT Unchecked\n");
fprintf(stderr, "Function urb_control_feature_request: OUT Unchecked\n");
memcpy(buffer, data + offset, OutputBufferSize);
bmRequestType |= 0x00;
break;
@@ -1717,7 +1717,7 @@ static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE
bmRequest = 0x01; /* REQUEST_CLEAR_FEATURE */
break;
default:
printf("urb_control_feature_request: Error Command %x\n", command);
fprintf(stderr, "urb_control_feature_request: Error Command %x\n", command);
return -1;
}

View File

@@ -201,7 +201,7 @@ static void func_iso_callback(struct libusb_transfer *transfer)
}
else
{
//printf("actual length %d \n", act_len);
//fprintf(stderr, "actual length %d \n", act_len);
//exit(EXIT_FAILURE);
}
}
@@ -362,7 +362,7 @@ static int func_config_release_all_interface(LIBUSB_DEVICE_HANDLE* libusb_handle
if (ret < 0)
{
printf("config_release_all_interface: error num %d\n", ret);
fprintf(stderr, "config_release_all_interface: error num %d\n", ret);
return -1;
}
}
@@ -380,7 +380,7 @@ static int func_claim_all_interface(LIBUSB_DEVICE_HANDLE* libusb_handle, int Num
if (ret < 0)
{
printf("claim_all_interface: error num %d\n", ret);
fprintf(stderr, "claim_all_interface: error num %d\n", ret);
return -1;
}
}
@@ -394,28 +394,28 @@ static void* print_transfer_status(enum libusb_transfer_status status)
switch (status)
{
case LIBUSB_TRANSFER_COMPLETED:
//printf("Transfer Status: LIBUSB_TRANSFER_COMPLETED\n");
//fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_COMPLETED\n");
break;
case LIBUSB_TRANSFER_ERROR:
printf("Transfer Status: LIBUSB_TRANSFER_ERROR\n");
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_ERROR\n");
break;
case LIBUSB_TRANSFER_TIMED_OUT:
printf("Transfer Status: LIBUSB_TRANSFER_TIMED_OUT\n");
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_TIMED_OUT\n");
break;
case LIBUSB_TRANSFER_CANCELLED:
printf("Transfer Status: LIBUSB_TRANSFER_CANCELLED\n");
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_CANCELLED\n");
break;
case LIBUSB_TRANSFER_STALL:
printf("Transfer Status: LIBUSB_TRANSFER_STALL\n");
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_STALL\n");
break;
case LIBUSB_TRANSFER_NO_DEVICE:
printf("Transfer Status: LIBUSB_TRANSFER_NO_DEVICE\n");
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_NO_DEVICE\n");
break;
case LIBUSB_TRANSFER_OVERFLOW:
printf("Transfer Status: LIBUSB_TRANSFER_OVERFLOW\n");
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_OVERFLOW\n");
break;
default:
printf("Transfer Status: Get unknow error num %d (0x%x)\n",
fprintf(stderr, "Transfer Status: Get unknow error num %d (0x%x)\n",
status, status);
}
return 0;
@@ -426,28 +426,28 @@ static void print_status(enum libusb_transfer_status status)
switch (status)
{
case LIBUSB_TRANSFER_COMPLETED:
printf("Transfer status: LIBUSB_TRANSFER_COMPLETED\n");
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_COMPLETED\n");
break;
case LIBUSB_TRANSFER_ERROR:
printf("Transfer status: LIBUSB_TRANSFER_ERROR\n");
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_ERROR\n");
break;
case LIBUSB_TRANSFER_TIMED_OUT:
printf("Transfer status: LIBUSB_TRANSFER_TIMED_OUT\n");
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_TIMED_OUT\n");
break;
case LIBUSB_TRANSFER_CANCELLED:
printf("Transfer status: LIBUSB_TRANSFER_CANCELLED\n");
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_CANCELLED\n");
break;
case LIBUSB_TRANSFER_STALL:
printf("Transfer status: LIBUSB_TRANSFER_STALL\n");
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_STALL\n");
break;
case LIBUSB_TRANSFER_NO_DEVICE:
printf("Transfer status: LIBUSB_TRANSFER_NO_DEVICE\n");
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_NO_DEVICE\n");
break;
case LIBUSB_TRANSFER_OVERFLOW:
printf("Transfer status: LIBUSB_TRANSFER_OVERFLOW\n");
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_OVERFLOW\n");
break;
default:
printf("Transfer status: unknow status %d(0x%x)\n", status, status);
fprintf(stderr, "Transfer status: unknow status %d(0x%x)\n", status, status);
break;
}
}
@@ -484,7 +484,7 @@ static LIBUSB_DEVICE_DESCRIPTOR* udev_new_descript(LIBUSB_DEVICE* libusb_dev)
if (ret < 0)
{
printf("libusb_get_device_descriptor: ERROR!!\n");
fprintf(stderr, "libusb_get_device_descriptor: ERROR!!\n");
return NULL;
}
@@ -653,7 +653,7 @@ static int libusb_udev_select_interface(IUDEVICE* idev, BYTE InterfaceNumber, BY
if (error < 0)
{
printf("%s: Set interface altsetting get error num %d\n",
fprintf(stderr, "%s: Set interface altsetting get error num %d\n",
__func__, error);
}
}
@@ -680,7 +680,7 @@ static MSUSB_CONFIG_DESCRIPTOR* libusb_udev_complete_msconfig_setup(IUDEVICE* id
LibusbConfig = pdev->LibusbConfig;
if (LibusbConfig->bNumInterfaces != MsConfig->NumInterfaces)
{
printf("Select Configuration: Libusb NumberInterfaces(%d) is different "
fprintf(stderr, "Select Configuration: Libusb NumberInterfaces(%d) is different "
"with MsConfig NumberInterfaces(%d)\n",
LibusbConfig->bNumInterfaces, MsConfig->NumInterfaces);
}
@@ -826,7 +826,7 @@ static int libusb_udev_select_configuration(IUDEVICE* idev, UINT32 bConfiguratio
ret = libusb_set_configuration(libusb_handle, bConfigurationValue);
if (ret < 0){
printf("libusb_set_configuration: ERROR number %d!!\n", ret);
fprintf(stderr, "libusb_set_configuration: ERROR number %d!!\n", ret);
func_claim_all_interface(libusb_handle, (*LibusbConfig)->bNumInterfaces);
return -1;
}
@@ -834,7 +834,7 @@ static int libusb_udev_select_configuration(IUDEVICE* idev, UINT32 bConfiguratio
{
ret = libusb_get_active_config_descriptor (libusb_dev, LibusbConfig);
if (ret < 0){
printf("libusb_get_config_descriptor_by_value: ERROR number %d!!\n", ret);
fprintf(stderr, "libusb_get_config_descriptor_by_value: ERROR number %d!!\n", ret);
func_claim_all_interface(libusb_handle, (*LibusbConfig)->bNumInterfaces);
return -1;
}
@@ -884,7 +884,7 @@ static int libusb_udev_control_pipe_request(IUDEVICE* idev, UINT32 RequestId,
*UsbdStatus = 0;
/*
if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId))
printf("request_queue_unregister_request: not fount request 0x%x\n", RequestId);
fprintf(stderr, "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
*/
return error;
}
@@ -979,12 +979,12 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ
ms_string_desc,
0x12,
Timeout);
//printf("Get ms string: result number %d", error);
//fprintf(stderr, "Get ms string: result number %d", error);
if (error > 0)
{
BYTE bMS_Vendorcode;
data_read_BYTE(ms_string_desc + 16, bMS_Vendorcode);
//printf("bMS_Vendorcode:0x%x", bMS_Vendorcode);
//fprintf(stderr, "bMS_Vendorcode:0x%x", bMS_Vendorcode);
/** get os descriptor */
error = libusb_control_transfer(pdev->libusb_handle,
LIBUSB_ENDPOINT_IN |LIBUSB_REQUEST_TYPE_VENDOR | Recipient,
@@ -1003,7 +1003,7 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ
*UsbdStatus = USBD_STATUS_SUCCESS;
/*
if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId))
printf("request_queue_unregister_request: not fount request 0x%x\n", RequestId);
fprintf(stderr, "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
*/
return error;
}
@@ -1262,7 +1262,7 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, UINT32 RequestId, UINT32 E
if (iso_transfer == NULL)
{
printf("Error: libusb_alloc_transfer.\n");
fprintf(stderr, "Error: libusb_alloc_transfer.\n");
status = -1;
}
@@ -1367,7 +1367,7 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request
if (!ep_desc)
{
printf("func_get_ep_desc: endpoint 0x%x is not found!!\n", EndpointAddress);
fprintf(stderr, "func_get_ep_desc: endpoint 0x%x is not found!!\n", EndpointAddress);
return -1;
}
transfer_type = (ep_desc->bmAttributes) & 0x3;
@@ -1493,7 +1493,7 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request
if (request)
{
if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId))
printf("request_queue_unregister_request: not fount request 0x%x\n", RequestId);
fprintf(stderr, "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
}
libusb_free_transfer(transfer);
@@ -1698,7 +1698,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
if (status < 0)
{
printf("USB init: Error to get HUB handle!!\n");
fprintf(stderr, "USB init: Error to get HUB handle!!\n");
pdev->hub_handle = NULL;
}
@@ -1706,7 +1706,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
if (!pdev->devDescriptor)
{
printf("USB init: Error to get device descriptor!!\n");
fprintf(stderr, "USB init: Error to get device descriptor!!\n");
zfree(pdev);
return NULL;
}
@@ -1717,7 +1717,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
if (status < 0)
{
printf("libusb_get_descriptor: ERROR!!ret:%d\n", status);
fprintf(stderr, "libusb_get_descriptor: ERROR!!ret:%d\n", status);
zfree(pdev);
return NULL;
}
@@ -1746,7 +1746,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
case CLASS_CONTENT_SECURITY:
//case CLASS_WIRELESS_CONTROLLER:
//case CLASS_ELSE_DEVICE:
printf(" Device is not supported!!\n");
fprintf(stderr, " Device is not supported!!\n");
zfree(pdev);
return NULL;
default:
@@ -1812,7 +1812,7 @@ int udev_new_by_id(UINT16 idVendor, UINT16 idProduct, IUDEVICE*** devArray)
ssize_t total_device;
int i, status, num = 0;
printf("VID: 0x%04X PID: 0x%04X\n", idVendor, idProduct);
fprintf(stderr, "VID: 0x%04X PID: 0x%04X\n", idVendor, idProduct);
array = (UDEVICE**) malloc(16 * sizeof(UDEVICE*));
@@ -1833,7 +1833,7 @@ int udev_new_by_id(UINT16 idVendor, UINT16 idProduct, IUDEVICE*** devArray)
if (status < 0)
{
printf("libusb_open: (by id) error: 0x%08X (%d)\n", status, status);
fprintf(stderr, "libusb_open: (by id) error: 0x%08X (%d)\n", status, status);
zfree(descriptor);
zfree(array[num]);
continue;
@@ -1870,7 +1870,7 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number)
if (pDev->libusb_dev == NULL)
{
printf("libusb_device_new: ERROR!!\n");
fprintf(stderr, "libusb_device_new: ERROR!!\n");
zfree(pDev);
return NULL;
}
@@ -1879,7 +1879,7 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number)
if (status < 0)
{
printf("libusb_open: (by addr) ERROR!!\n");
fprintf(stderr, "libusb_open: (by addr) ERROR!!\n");
zfree(pDev);
return NULL;
}

View File

@@ -206,7 +206,7 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n
}
else
{
printf("udevman_register_udevice: function error!!");
fprintf(stderr, "udevman_register_udevice: function error!!");
return 0;
}

View File

@@ -100,7 +100,7 @@ TRANSFER_REQUEST* request_queue_get_request_by_endpoint(REQUEST_QUEUE* queue, BY
}
}
pthread_mutex_unlock(&queue->request_loading);
printf("request_queue_get_request_by_id: ERROR!!\n");
fprintf(stderr, "request_queue_get_request_by_id: ERROR!!\n");
return NULL;
}

View File

@@ -156,16 +156,16 @@ static void searchman_list_show(USB_SEARCHMAN* self)
int num = 0;
USB_SEARCHDEV* usb;
printf("=========== Usb Search List ========= \n");
fprintf(stderr, "=========== Usb Search List ========= \n");
self->rewind(self);
while (self->has_next(self))
{
usb = self->get_next(self);
printf(" USB %d: \n", num++);
printf(" idVendor: 0x%04X \n", usb->idVendor);
printf(" idProduct: 0x%04X \n", usb->idProduct);
fprintf(stderr, " USB %d: \n", num++);
fprintf(stderr, " idVendor: 0x%04X \n", usb->idVendor);
fprintf(stderr, " idProduct: 0x%04X \n", usb->idProduct);
}
printf("================= END =============== \n");
fprintf(stderr, "================= END =============== \n");
}
void searchman_free(USB_SEARCHMAN* self)
@@ -202,7 +202,7 @@ USB_SEARCHMAN* searchman_new(void * urbdrc, UINT32 UsbDevice)
if (ret != 0)
{
printf("searchman mutex initialization: searchman->mutex failed");
fprintf(stderr, "searchman mutex initialization: searchman->mutex failed");
exit(EXIT_FAILURE);
}

View File

@@ -464,7 +464,7 @@ static void* urbdrc_search_usb_device(void* arg)
if (!udev)
{
printf("Can't create udev\n");
fprintf(stderr, "Can't create udev\n");
return 0;
}
@@ -648,7 +648,7 @@ static void* urbdrc_search_usb_device(void* arg)
}
else
{
printf("No Device from receive_device(). An error occured.\n");
fprintf(stderr, "No Device from receive_device(). An error occured.\n");
}
}
}
@@ -830,7 +830,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
transfer_data = (TRANSFER_DATA*) malloc(sizeof(TRANSFER_DATA));
if (transfer_data == NULL)
printf("transfer_data is NULL!!");
fprintf(stderr, "transfer_data is NULL!!");
transfer_data->callback = callback;
transfer_data->urbdrc = urbdrc;

View File

@@ -28,13 +28,14 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/utils/debug.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/msusb.h>
#include <uuid/uuid.h>
#include <pthread.h>
#include <semaphore.h>
#include <winpr/stream.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else

2
client/.gitignore vendored
View File

@@ -0,0 +1,2 @@
WaykClient

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>aFreeRDP</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -9,41 +9,41 @@
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
<application>
<!-- Activity to create shortcuts -->
<activity android:name=".presentation.ShortcutsActivity"
android:theme="@style/Theme.Main"
android:label="@string/title_create_shortcut">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- Activity to create shortcuts -->
<activity android:name=".presentation.ShortcutsActivity"
android:theme="@style/Theme.Main"
android:label="@string/title_create_shortcut">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- It is recommended that you use an activity-alias to provide the "CREATE_SHORTCUT" -->
<!-- intent-filter. This gives you a way to set the text (and optionally the -->
<!-- icon) that will be seen in the launcher's create-shortcut user interface. -->
<activity-alias android:name=".presentation.CreateShortcuts"
android:targetActivity="com.freerdp.freerdpcore.presentation.ShortcutsActivity"
android:label="@string/title_create_shortcut">
<!-- This intent-filter allows your shortcuts to be created in the launcher. -->
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>
android:targetActivity="com.freerdp.freerdpcore.presentation.ShortcutsActivity"
android:label="@string/title_create_shortcut">
<!-- This intent-filter allows your shortcuts to be created in the launcher. -->
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>
<activity android:name=".presentation.BookmarkActivity"
android:label="@string/title_bookmark_settings"
android:theme="@style/Theme.Settings">
<intent-filter>
<action android:name="freerdp.intent.action.BOOKMARK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="preferences"/>
</intent-filter>
<intent-filter>
<action android:name="freerdp.intent.action.BOOKMARK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="preferences"/>
</intent-filter>
</activity>
<activity android:name=".presentation.ApplicationSettingsActivity"
android:label="@string/title_application_settings"
@@ -65,9 +65,10 @@
</activity>
<receiver android:name=".application.NetworkStateReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -24,7 +24,6 @@
#include <freerdp/utils/event.h>
#include <freerdp/constants.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/utils/file.h>
#include <android/bitmap.h>
#include <machine/cpu-features.h>
@@ -309,7 +308,7 @@ int android_receive_channel_data(freerdp* instance, int channelId, UINT8* data,
void android_process_channel_event(rdpChannels* channels, freerdp* instance)
{
RDP_EVENT* event;
wMessage* event;
event = freerdp_channels_pop_event(channels);
@@ -317,7 +316,7 @@ void android_process_channel_event(rdpChannels* channels, freerdp* instance)
{
/* switch (event->event_class)
{
case RDP_EVENT_CLASS_RAIL:
case RailChannel_Class:
xf_process_rail_event(ai, chanman, event);
break;
@@ -533,11 +532,17 @@ JNIEXPORT void JNICALL jni_freerdp_set_data_directory(JNIEnv *env, jclass cls, j
rdpSettings * settings = inst->settings;
const jbyte *directory = (*env)->GetStringUTFChars(env, jdirectory, NULL);
free(settings->HomePath);
free(settings->ConfigPath);
int config_dir_len = strlen(directory) + 10; /* +9 chars for /.freerdp and +1 for \0 */
char* config_dir_buf = (char*)malloc(config_dir_len);
strcpy(config_dir_buf, directory);
strcat(config_dir_buf, "/.freerdp");
settings->HomePath = strdup(directory);
settings->ConfigPath = NULL;
freerdp_detect_paths(settings);
settings->ConfigPath = config_dir_buf; /* will be freed by freerdp library */
(*env)->ReleaseStringUTFChars(env, jdirectory, directory);
}
@@ -596,6 +601,7 @@ JNIEXPORT void JNICALL jni_freerdp_set_connection_info(JNIEnv *env, jclass cls,
/* enable NSCodec */
settings->NSCodec = TRUE;
settings->BitmapCacheV3Enabled = TRUE;
switch ((int) security)
{

View File

@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
<!-- Button labels -->
<string name="yes">Si</string>
<string name="no">No</string>
<string name="cancel">Cancelar</string>
<string name="cont">Continuar</string>
<string name="login">Ingresar</string>
<string name="logout">Salir</string>
<!-- Home menu items -->
<string name="menu_exit">Salida</string>
<string name="menu_about">Sobre</string>
<string name="menu_help">Ayuda</string>
<string name="menu_new_bookmark">Nueva conexión</string>
<string name="menu_app_settings">Configuracion</string>
<!-- Bookmark menu items -->
<string name="menu_title_bookmark">Conexión</string>
<string name="menu_connect">Conectar</string>
<string name="menu_edit">Editar</string>
<string name="menu_delete">Borrar</string>
<!-- Session menu items -->
<string name="menu_sys_keyboard">Teclado</string>
<string name="menu_ext_keyboard">Funcion teclado</string>
<string name="menu_touch_pointer">Puntero Tactil</string>
<string name="menu_home">Inicio</string>
<string name="menu_disconnect">desconectart</string>
<!-- List section headers -->
<string name="section_bookmarks">Conexión Manual</string>
<string name="section_active_sessions">Sesiones Activas</string>
<!-- Search strings -->
<string name="search_hint">Connectarse a iWinCloud</string>
<!-- List placeholder labels -->
<string name="list_placeholder_login">Login</string>
<string name="list_placeholder_no_servers">No hay escritorios virtuales</string>
<string name="list_placeholder_connecting">Conectando ...</string>
<string name="list_placeholder_disconnecting">Desconectando ...</string>
<string name="list_placeholder_connection_error">Conexión perdida</string>
<string name="list_placeholder_wrong_password">Contraseña equivocada</string>
<string name="list_placeholder_invalid_username">Usuario Invalido</string>
<string name="list_placeholder_add_bookmark">Agregar escritorio virtual de iWinCloud</string>
<!-- Bookmark settings strings -->
<string name="settings_cat_host">Host</string>
<string name="settings_label">Su nombre</string>
<string name="settings_hostname">IP</string>
<string name="settings_port">Puerto</string>
<string name="settings_cat_credentials">Credenciales de iWinCloud</string>
<string name="settings_credentials">Credenciales</string>
<string name="settings_username">Usuario</string>
<string name="settings_password">Contraseña</string>
<string name="settings_domain">Dominio</string>
<string name="settings_cat_settings">Configuracion</string>
<string name="settings_screen">Pantalla</string>
<string name="settings_cat_screen">Configuracion Pantalla</string>
<string name="settings_colors">Colores</string>
<string-array name="colors_array">
<item>Calidad Normal (16 Bit)</item>
<item>Calidad Optima (24 Bit)</item>
<item>Calidad maxima (32 Bit)</item>
</string-array>
<string-array name="colors_values_array">
<item>16</item>
<item>24</item>
<item>32</item>
</string-array>
<string name="settings_resolution">Resolucion</string>
<string name="resolution_automatic">Automatico</string>
<string name="resolution_custom">Manual</string>
<string-array name="resolutions_array">
<item>Automatico</item>
<item>Manual</item>
<item>640x480</item>
<item>720x480</item>
<item>800x600</item>
<item>1024x768</item>
<item>1280x1024</item>
<item>1440x900</item>
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<string-array name="resolutions_values_array">
<item>automatico</item>
<item>manual</item>
<item>640x480</item>
<item>720x480</item>
<item>800x600</item>
<item>1024x768</item>
<item>1280x1024</item>
<item>1440x900</item>
<item>1920x1080</item>
<item>1920x1200</item>
</string-array>
<string name="settings_width">Ancho</string>
<string name="settings_height">Altura</string>
<string name="settings_performance">Rendimiento</string>
<string name="settings_cat_performance">Configuracion Rendimiento</string>
<string name="settings_perf_remotefx">RemoteFX</string>
<string name="settings_perf_wallpaper">Fondo escritorio</string>
<string name="settings_perf_font_smoothing">Fuente suave</string>
<string name="settings_perf_desktop_composition">Composicion escritorio</string>
<string name="settings_perf_full_window_drag">Contenidos de la ventana mientras se arrastra</string>
<string name="settings_perf_menu_animation">Animacion del menu</string>
<string name="settings_perf_theming">Estilo visual</string>
<string name="settings_advanced">Avanzado</string>
<string name="settings_cat_advanced">Configuracion Avanzada</string>
<string name="settings_enable_3g_settings">Configuracion 3G</string>
<string name="settings_screen_3g">Pantalla 3G</string>
<string name="settings_performance_3g">Rendimiento 3G</string>
<string name="settings_security">Seguridad</string>
<string-array name="security_array">
<item>Automatico</item>
<item>RDP</item>
<item>TLS</item>
<item>NLA</item>
</string-array>
<string-array name="security_values_array">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string name="settings_remote_program">Programa Remoto</string>
<string name="settings_work_dir">Directorio de trabajo</string>
<string name="settings_console_mode">Modo Consola</string>
<!-- App settings strings -->
<string name="settings_password_present">*******</string>
<string name="settings_password_empty">no configurado</string>
<string name="settings_cat_ui">Interfaze Usuario</string>
<string name="settings_ui_hide_status_bar">Ocultar barra de estado</string>
<string name="settings_ui_hide_zoom_controls">Ocultar controles de zoom</string>
<string name="settings_ui_swap_mouse_buttons">Intercambiar botones del mouse</string>
<string name="settings_ui_invert_scrolling">invertir desplazamiento</string>
<string name="settings_ui_auto_scroll_touchpointer">Puntero táctil de desplazamiento automático</string>
<string name="settings_ui_ask_on_exit">Mostrar cuadro de diálogo en la salida</string>
<string name="settings_cat_power">Ahorro de energía</string>
<string name="settings_power_disconnect_timeout">Cerrar las conexiones inactivas</string>
<string name="settings_cat_security">Seguridad</string>
<string name="settings_security_accept_certificates">Aceptar todos los certificados</string>
<string name="settings_security_clear_certificate_cache">Borrar el Cache de los certificados</string>
<string name="settings_description_after_minutes">Despues %1$d Minutos</string>
<string name="settings_description_disabled">Desabilitado</string>
<!-- Activity titles -->
<string name="title_bookmark_settings">Configuración de la conexión</string>
<string name="title_application_settings">Configuración</string>
<string name="title_home">iWinCloud - iWinCloud para Android</string>
<string name="title_create_shortcut">Conexiones RDP</string>
<string name="title_help">Ayuda</string>
<string name="title_about">Sobre</string>
<!-- Error message strings -->
<string name="error_bookmark_incomplete_title">Cancelar sin guardar?</string>
<string name="error_bookmark_incomplete">Pulse el botón "Cancelar" para abortar! \ NPulse "Continuar" para especificar los campos obligatorios!</string>
<string name="error_connection_failure">No se pudo establecer una conexión con iWinCloud!</string>
<!-- Info message strings -->
<string name="info_capabilities_changed">Los ajustes de pantalla se han cambiado porque el escritorio virtual no es compatible con la configuración especificada!</string>
<string name="info_reset_success">Eliminado el cache del certificado!</string>
<string name="info_reset_failed">No se pudo borrar el caché del certificado!</string>
<!-- Dialog strings -->
<string name="dlg_title_verify_certificate">verificar el certificado</string>
<string name="dlg_msg_verify_certificate">La identidad de su escritorio de iWinCloud debe ser verificada. ¿Desea conectarse de todos modos?</string>
<string name="dlg_title_credentials">Por favor, introduzca sus credenciales</string>
<string name="dlg_title_create_shortcut">Crear acceso directo</string>
<string name="dlg_msg_create_shortcut">Nombre corto:</string>
<string name="dlg_msg_connecting">Conectando ...</string>
<string name="dlg_msg_logging_in">Ingresando a ...</string>
<string name="dlg_title_about">Sobre iWinCloud</string>
<string name="dlg_msg_about">Version: %1$s\n\u00A9 2012 iWinCloud LLc</string>
<string name="dlg_title_create_bookmark_after_qc">Guardar configuración de conexión?</string>
<string name="dlg_msg_create_bookmark_after_qc">La configuración de conexión no se han guardado! ¿Quieres guardarlos?</string>
<string name="dlg_title_save_bookmark">Guardar Conexión</string>
<string name="dlg_save_bookmark">¿Desea guardar los cambios realizados en la configuración de conexión?</string>
<string name="dlg_dont_show_again">No volver a preguntar</string>
<string name="dlg_title_exit">Salir del programa?</string>
<string name="dlg_msg_exit">Esta seguro que desea salir del programa?</string>
<string name="dlg_title_clear_cert_cache">Borrar Certificados?</string>
<string name="dlg_msg_clear_cert_cache">Esta seguro que desea borrar todos los certificados?</string>
</resources>

View File

@@ -0,0 +1,174 @@
<resources>
<!-- Button labels -->
<string name="yes">"Oui"</string>
<string name="no">"Non"</string>
<string name="cancel">"Annuler"</string>
<string name="cont">"Continuer"</string>
<string name="login">"Se connecter"</string>
<string name="logout">"Déconnexion"</string>
<!-- Home menu items -->
<string name="menu_exit">"Quitter"</string>
<string name="menu_about">"À propos"</string>
<string name="menu_help">"Aide"</string>
<string name="menu_new_bookmark">"Nouvelle connexion"</string>
<string name="menu_app_settings">"Paramètres"</string>
<!-- Bookmark menu items -->
<string name="menu_title_bookmark">"Connexion"</string>
<string name="menu_connect">"Connexion"</string>
<string name="menu_edit">"Éditer"</string>
<string name="menu_delete">"Supprimer"</string>
<!-- Session menu items -->
<string name="menu_sys_keyboard">"Clavier"</string>
<string name="menu_ext_keyboard">"Touches de fonction"</string>
<string name="menu_touch_pointer">"Pointeur tactile"</string>
<string name="menu_home">"Accueil"</string>
<string name="menu_disconnect">"Se déconnecter"</string>
<!-- List section headers -->
<string name="section_bookmarks">"Connexions manuelles"</string>
<string name="section_active_sessions">"Sessions actives"</string>
<!-- Search strings -->
<string name="search_hint">"Connexion à l'ordinateur"</string>
<!-- List placeholder labels -->
<string name="list_placeholder_login">"Se connecter"</string>
<string name="list_placeholder_no_servers">"Pas de connexion"</string>
<string name="list_placeholder_connecting">"Connexion..."</string>
<string name="list_placeholder_disconnecting">"Déconnexion…"</string>
<string name="list_placeholder_connection_error">"Perte de la connexion"</string>
<string name="list_placeholder_wrong_password">"Mot de passe incorrect"</string>
<string name="list_placeholder_invalid_username">"Nom d'utilisateur invalide"</string>
<string name="list_placeholder_add_bookmark">"Ajouter une connexion"</string>
<!-- Bookmark settings strings -->
<string name="settings_cat_host">"Hôte"</string>
<string name="settings_label">"Étiquette"</string>
<string name="settings_hostname">"Hôte"</string>
<string name="settings_port">"Port"</string>
<string name="settings_cat_credentials">"Authentifiant"</string>
<string name="settings_credentials">"Authentifiant"</string>
<string name="settings_username">"Nom d'utilisateur"</string>
<string name="settings_password">"Mot de passe"</string>
<string name="settings_domain">"Nom de domaine"</string>
<string name="settings_cat_settings">"Paramètres"</string>
<string name="settings_screen">"Écran"</string>
<string name="settings_cat_screen">"Paramètres d'écran"</string>
<string name="settings_colors">"Couleurs"</string>
<string-array name="colors_array">
<item>"Hautes couleurs (16 bits)"</item>
<item>"Couleurs vraies (24 bits)"</item>
<item>"Haute qualité (32 bits)"</item>
</string-array>
<string-array name="colors_values_array">
<item>"16"</item>
<item>"24"</item>
<item>"32"</item>
</string-array>
<string name="settings_resolution">"Résolution"</string>
<string name="resolution_automatic">"Automatique"</string>
<string name="resolution_custom">"Personalisé"</string>
<string-array name="resolutions_array">
<item>"Automatique"</item>
<item>"Personalisé"</item>
<item>"640x480"</item>
<item>"720x480"</item>
<item>"800x600"</item>
<item>"1024x768"</item>
<item>"1280x1024"</item>
<item>"1440x900"</item>
<item>"1920x1080"</item>
<item>"1920x1200"</item>
</string-array>
<string-array name="resolutions_values_array">
<item>"Automatique"</item>
<item>"Personalisé"</item>
<item>"640x480"</item>
<item>"720x480"</item>
<item>"800x600"</item>
<item>"1024x768"</item>
<item>"1280x1024"</item>
<item>"1440x900"</item>
<item>"1920x1080"</item>
<item>"1920x1200"</item>
</string-array>
<string name="settings_width">"Largeur"</string>
<string name="settings_height">"Hauteur"</string>
<string name="settings_performance">"Performance"</string>
<string name="settings_cat_performance">"Paramètres de performance"</string>
<string name="settings_perf_remotefx">"RemoteFX"</string>
<string name="settings_perf_wallpaper">"Fond d'écran"</string>
<string name="settings_perf_font_smoothing">"Lissage des polices"</string>
<string name="settings_perf_desktop_composition">"Effets visuels Aero"</string>
<string name="settings_perf_full_window_drag">"Afficher le contenu des fenêtres en mouvement"</string>
<string name="settings_perf_menu_animation">"Animations de menu"</string>
<string name="settings_perf_theming">"Styles visuels"</string>
<string name="settings_advanced">"Avancé"</string>
<string name="settings_cat_advanced">"Paramètres avancés"</string>
<string name="settings_enable_3g_settings">"Paramètres 3G"</string>
<string name="settings_screen_3g">"Écran 3G"</string>
<string name="settings_performance_3g">"Performance 3G"</string>
<string name="settings_security">"Securité"</string>
<string-array name="security_array">
<item>"Automatique"</item>
<item>"RDP"</item>
<item>"TLS"</item>
<item>"NLA"</item>
</string-array>
<string-array name="security_values_array">
<item>"0"</item>
<item>"1"</item>
<item>"2"</item>
<item>"3"</item>
</string-array>
<string name="settings_remote_program">"Lancement de programme"</string>
<string name="settings_work_dir">"Répertoire de travail"</string>
<string name="settings_console_mode">"Mode console"</string>
<!-- App settings strings -->
<string name="settings_password_present">"*******"</string>
<string name="settings_password_empty">"Valeur non définie"</string>
<string name="settings_cat_ui">"Interface utilisateur"</string>
<string name="settings_ui_hide_status_bar">"Masquer la barre d'état"</string>
<string name="settings_ui_hide_zoom_controls">"Masquer les contrôles zoom"</string>
<string name="settings_ui_swap_mouse_buttons">"Inverser les boutons de la souris"</string>
<string name="settings_ui_invert_scrolling">"Inverser le défilement de la souris"</string>
<string name="settings_ui_auto_scroll_touchpointer">"Défilement automatique du pointeur tactile"</string>
<string name="settings_ui_ask_on_exit">"Confirmer au moment de quitter"</string>
<string name="settings_cat_power">"Economie d'énergie"</string>
<string name="settings_power_disconnect_timeout">"Fermer les connexions inactives"</string>
<string name="settings_cat_security">"Securité"</string>
<string name="settings_security_accept_certificates">"Accepter tous les certificats"</string>
<string name="settings_security_clear_certificate_cache">"Vider la cache de certificats"</string>
<string name="settings_description_after_minutes">"Après %1$d minutes"</string>
<string name="settings_description_disabled">"Désactivé"</string>
<!-- Activity titles -->
<string name="title_bookmark_settings">"Paramètres de connexion"</string>
<string name="title_application_settings">"Paramètres"</string>
<string name="title_home">"aFreeRDP - FreeRDP pour Android"</string>
<string name="title_create_shortcut">"Connexions RDP"</string>
<string name="title_help">"Aide"</string>
<string name="title_about">"À propos"</string>
<!-- Error message strings -->
<string name="error_bookmark_incomplete_title">"Annuler sans enregistrer?"</string>
<string name="error_bookmark_incomplete">"Appuyez sur \"Annuler\" pour annuler, ou cliquez sur «Continuer» pour spécifier les champs obligatoires."</string>
<string name="error_connection_failure">"Impossible d'établir une connexion au serveur!"</string>
<!-- Info message strings -->
<string name="info_capabilities_changed">"Les paramètres de l'écran ont changé parce que le serveur ne prend pas en charge les paramètres que vous avez spécifiés!"</string>
<string name="info_reset_success">"La cache de certificats a été supprimée!"</string>
<string name="info_reset_failed">"Impossible de supprimer la cache de certificat!"</string>
<!-- Dialog strings -->
<string name="dlg_title_verify_certificate">"Validation de certificat"</string>
<string name="dlg_msg_verify_certificate">"L'identité de l'ordinateur distant ne peut pas être vérifiée. Voulez-vous poursuivre la connexion?"</string>
<string name="dlg_title_credentials">"Veuillez entrer votre nom d'usager et mot de passe"</string>
<string name="dlg_title_create_shortcut">"Créer un raccourci"</string>
<string name="dlg_msg_create_shortcut">"Nom du raccourci:"</string>
<string name="dlg_msg_connecting">"Connexion..."</string>
<string name="dlg_msg_logging_in">"Connexion..."</string>
<string name="dlg_title_about">"À propos de aFreeRDP"</string>
<string name="dlg_msg_about">"Version: %1$s \ n \ u00A9 2012 Technologies GmbH Thinstuff"</string>
<string name="dlg_title_create_bookmark_after_qc">"Enregistrer les paramètres de connexion?"</string>
<string name="dlg_msg_create_bookmark_after_qc">"Vos paramètres de connexion n'ont pas été sauvegardés! Voulez-vous les enregistrer?"</string>
<string name="dlg_title_save_bookmark">"Enregistrer la connexion?"</string>
<string name="dlg_save_bookmark">"Voulez-vous enregistrer les modifications que vous avez apportées aux paramètres de connexion?"</string>
<string name="dlg_dont_show_again">"Ne plus demander"</string>
<string name="dlg_title_exit">"Quittez l'application?"</string>
<string name="dlg_msg_exit">"Êtes-vous sûr de vouloir quitter l'application?"</string>
<string name="dlg_title_clear_cert_cache">"Êtes-vous sûrs de vouloir supprimer les certificats?"</string>
<string name="dlg_msg_clear_cert_cache">"Êtes-vous sûr de vouloir supprimer tous les certificats mis en cache?"</string>
</resources>

View File

@@ -29,5 +29,4 @@
<Preference android:key="security.clear_certificate_cache" android:title="@string/settings_security_clear_certificate_cache" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -12,7 +12,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:freerdp="http://schemas.android.com/apk/res-auto" >
<PreferenceCategory android:key="category.host" android:title="@string/settings_cat_host">
<EditTextPreference android:key="bookmark.label" android:title="Label" android:summary="@string/settings_label"/>
<EditTextPreference android:key="bookmark.label" android:title="@string/settings_label" android:summary="@string/settings_label"/>
<EditTextPreference android:key="bookmark.hostname" android:title="@string/settings_hostname" android:summary="Name or address of the target computer"/>
<com.freerdp.freerdpcore.utils.IntEditTextPreference android:key="bookmark.port" android:title="@string/settings_port" android:summary="RDP Port on the target computer" android:numeric="integer" android:inputType="number" freerdp:bounds_min="10" freerdp:bounds_max="65535" freerdp:bounds_default="3389" />
</PreferenceCategory>

View File

@@ -11,8 +11,8 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="Credentials">
<EditTextPreference android:key="bookmark.username" android:title="Username"/>
<EditTextPreference android:key="bookmark.password" android:title="Password" android:inputType="textPassword" />
<EditTextPreference android:key="bookmark.domain" android:title="Domain" android:summary="Optional"/>
<EditTextPreference android:key="bookmark.username" android:title="@string/settings_username"/>
<EditTextPreference android:key="bookmark.password" android:title="@string/settings_password" android:inputType="textPassword" />
<EditTextPreference android:key="bookmark.domain" android:title="@string/settings_domain" android:summary="Optional"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -194,8 +194,7 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener
{
Log.v("LibFreeRDP", "OnConnectionFailure");
// free session
GlobalApp.freeSession(instance);
// send notification to session activity
sendRDPNotification(FREERDP_EVENT_CONNECTION_FAILURE, instance);
}
@@ -210,8 +209,5 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener
public void OnDisconnected(int instance)
{
Log.v("LibFreeRDP", "OnDisconnected");
// free session
GlobalApp.freeSession(instance);
}
}

View File

@@ -256,7 +256,6 @@ public class SessionActivity extends Activity
if (!connectCancelledByUser)
uiHandler.sendMessage(Message.obtain(null, UIHandler.DISPLAY_TOAST, getResources().getText(R.string.error_connection_failure)));
session = null;
closeSessionActivity(RESULT_CANCELED);
}
@@ -271,7 +270,6 @@ public class SessionActivity extends Activity
}
session.setUIEventListener(null);
session = null;
closeSessionActivity(RESULT_OK);
}
}
@@ -518,9 +516,13 @@ public class SessionActivity extends Activity
protected void onDestroy() {
super.onDestroy();
Log.v(TAG, "Session.onDestroy");
// unregister freerdp events broadcast receiver
unregisterReceiver(libFreeRDPBroadcastReceiver);
// free session
GlobalApp.freeSession(session.getInstance());
session = null;
}
@Override

View File

@@ -7,7 +7,7 @@
android:versionName="@FREERDP_VERSION_FULL@" >
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"/>
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
<application android:name="com.freerdp.afreerdp.application.GlobalApp"
android:label="aFreeRDP"
@@ -26,9 +26,9 @@
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="*" android:pathPattern=".*\\.rdp" />
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.rdp" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="*" android:pathPattern=".*\\.rdp" />
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.rdp" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
@@ -42,7 +42,7 @@
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</intent-filter>
</activity>
<activity-alias android:name=".services.SessionRequestHandlerActivity"
@@ -62,3 +62,4 @@
</application>
</manifest>

View File

@@ -51,3 +51,7 @@ if(ANDROID)
add_subdirectory(Android)
endif()
if(WITH_WAYK)
add_subdirectory(WaykClient)
endif()

View File

@@ -265,12 +265,12 @@ static int df_receive_channel_data(freerdp* instance, int channelId, BYTE* data,
static void df_process_cb_monitor_ready_event(rdpChannels* channels, freerdp* instance)
{
RDP_EVENT* event;
wMessage* event;
RDP_CB_FORMAT_LIST_EVENT* format_list_event;
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_FormatList, NULL, NULL);
format_list_event = (RDP_CB_FORMAT_LIST_EVENT*)event;
format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event;
format_list_event->num_formats = 0;
freerdp_channels_send_event(channels, event);
@@ -278,19 +278,20 @@ static void df_process_cb_monitor_ready_event(rdpChannels* channels, freerdp* in
static void df_process_channel_event(rdpChannels* channels, freerdp* instance)
{
RDP_EVENT* event;
wMessage* event;
event = freerdp_channels_pop_event(channels);
if (event)
{
switch (event->event_type)
switch (GetMessageType(event->id))
{
case RDP_EVENT_TYPE_CB_MONITOR_READY:
case CliprdrChannel_MonitorReady:
df_process_cb_monitor_ready_event(channels, instance);
break;
default:
printf("df_process_channel_event: unknown event type %d\n", event->event_type);
fprintf(stderr, "df_process_channel_event: unknown event type %d\n", GetMessageType(event->id));
break;
}
@@ -319,8 +320,8 @@ int dfreerdp_run(freerdp* instance)
dfContext* context;
rdpChannels* channels;
memset(rfds, 0, sizeof(rfds));
memset(wfds, 0, sizeof(wfds));
ZeroMemory(rfds, sizeof(rfds));
ZeroMemory(wfds, sizeof(wfds));
if (!freerdp_connect(instance))
return 0;
@@ -337,17 +338,17 @@ int dfreerdp_run(freerdp* instance)
if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
{
printf("Failed to get FreeRDP file descriptor\n");
fprintf(stderr, "Failed to get FreeRDP file descriptor\n");
break;
}
if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE)
{
printf("Failed to get channel manager file descriptor\n");
fprintf(stderr, "Failed to get channel manager file descriptor\n");
break;
}
if (df_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
{
printf("Failed to get dfreerdp file descriptor\n");
fprintf(stderr, "Failed to get dfreerdp file descriptor\n");
break;
}
@@ -376,24 +377,24 @@ int dfreerdp_run(freerdp* instance)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
printf("dfreerdp_run: select failed\n");
fprintf(stderr, "dfreerdp_run: select failed\n");
break;
}
}
if (freerdp_check_fds(instance) != TRUE)
{
printf("Failed to check FreeRDP file descriptor\n");
fprintf(stderr, "Failed to check FreeRDP file descriptor\n");
break;
}
if (df_check_fds(instance, &rfds_set) != TRUE)
{
printf("Failed to check dfreerdp file descriptor\n");
fprintf(stderr, "Failed to check dfreerdp file descriptor\n");
break;
}
if (freerdp_channels_check_fds(channels, instance) != TRUE)
{
printf("Failed to check channel manager file descriptor\n");
fprintf(stderr, "Failed to check channel manager file descriptor\n");
break;
}
df_process_channel_event(channels, instance);

View File

@@ -6,12 +6,10 @@ set(MODULE_PREFIX "FREERDP_CLIENT_MAC")
set(FRAMEWORK_HEADERS_PATH /System/Library/Frameworks/Cocoa.framework/Versions/A/Headers/)
include_directories(${FRAMEWORK_HEADERS_PATH} /System/Library/Frameworks)
# set(CMAKE_OSX_SYSROOT MacOSX10.7.sdk)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mmacosx-version-min=10.4")
set(GUI_TYPE MACOSX_BUNDLE)
# Import libraries
find_library(FOUNDATION_LIBRARY Foundation)
find_library(COCOA_LIBRARY Cocoa)
find_library(APPKIT_LIBRARY AppKit)
@@ -33,16 +31,32 @@ mark_as_advanced(COCOA_LIBRARY FOUNDATION_LIBRARY APPKIT_LIBRARY)
set(EXTRA_LIBS ${COCOA_LIBRARY} ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY})
set(APP_TYPE MACOSX_BUNDLE)
# OS X Interface Builder files
file(GLOB ${MODULE_NAME}_XIBS *.xib)
set(${MODULE_NAME}_XIBS
MainMenu.xib
PasswordDialog.xib)
set(${MODULE_NAME}_RESOURCES ${${MODULE_NAME}_XIBS} ${MACOSX_BUNDLE_ICON_FILE})
set(${MODULE_NAME}_RESOURCES
${${MODULE_NAME}_XIBS}
${MACOSX_BUNDLE_ICON_FILE})
# Headers
file(GLOB ${MODULE_NAME}_HEADERS *.h)
set(${MODULE_NAME}_HEADERS
AppDelegate.h
MRDPCursor.h
MRDPRailView.h
MRDPRailWindow.h
MRDPView.h
MRDPWindow.h
PasswordDialog.h)
# Source
file(GLOB ${MODULE_NAME}_SOURCES *.m)
set(${MODULE_NAME}_SOURCES
main.m
AppDelegate.m
MRDPCursor.m
MRDPRailView.m
MRDPRailWindow.m
MRDPView.m
MRDPWindow.m
PasswordDialog.m)
add_executable(${MODULE_NAME}
${APP_TYPE}
@@ -63,13 +77,6 @@ set_target_properties(${MODULE_NAME} PROPERTIES RESOURCE "${${MODULE_NAME}_RESOU
# Support for automatic reference counting requires non-fragile abi.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-nonfragile-abi")
# XCode project architecture to native architecture of build machine
# -----------------------------------------------------------------------------------------------------
# Issue: Had some issues with FreeRDP project building only 64 bit and
# MacFreeRDP attempting to link to both 32 and 64 for dual target.
# In the future the FreeRDP Xcode project should be pulled in for a couple of reasons:
# 1) better step-into debugging 2) automatic dependency compilation and multi-arch compilation + linkage
# If you know the solutions for 1 and 2, please add below.
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_ARCHS "$(NATIVE_ARCH_ACTUAL)")
# Set the info plist to the custom instance

View File

@@ -778,7 +778,7 @@ MRDPRailView* g_mrdpRailView;
apple_to_windowMove(&r, &windowMove);
windowMove.windowId = self->savedWindowId;
mac_send_rail_client_event(self->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
mac_send_rail_client_event(self->context->channels, RailChannel_ClientWindowMove, &windowMove);
}
/**
@@ -800,7 +800,7 @@ MRDPRailView* g_mrdpRailView;
apple_to_windowMove(&r, &windowMove);
windowMove.windowId = self->savedWindowId;
mac_send_rail_client_event(self->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
mac_send_rail_client_event(self->context->channels, RailChannel_ClientWindowMove, &windowMove);
}
/**
@@ -923,7 +923,7 @@ void mac_rail_send_activate(int window_id)
activate.windowId = window_id;
activate.enabled = 1;
mac_send_rail_client_event(g_mrdpRailView->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_ACTIVATE, &activate);
mac_send_rail_client_event(g_mrdpRailView->context->channels, RailChannel_ClientActivate, &activate);
}
@end

View File

@@ -111,7 +111,7 @@ void mf_Pointer_SetNull(rdpContext* context);
void mf_Pointer_SetDefault(rdpContext* context);
int rdp_connect(void);
BOOL mac_pre_connect(freerdp* instance);
BOOL mac_post_connect(freerdp* instance);
BOOL mac_post_connect(freerdp* instance);
BOOL mac_authenticate(freerdp* instance, char** username, char** password, char** domain);
void mac_context_new(freerdp* instance, rdpContext* context);
void mac_context_free(freerdp* instance, rdpContext* context);
@@ -126,7 +126,7 @@ int register_fds(int* fds, int count, void* instance);
int invoke_draw_rect(rdpContext* context);
int process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data);
int receive_channel_data(freerdp* instance, int chan_id, BYTE* data, int size, int flags, int total_size);
void process_cliprdr_event(freerdp* instance, RDP_EVENT* event);
void process_cliprdr_event(freerdp* instance, wMessage* event);
void cliprdr_process_cb_format_list_event(freerdp* instance, RDP_CB_FORMAT_LIST_EVENT* event);
void cliprdr_send_data_request(freerdp* instance, UINT32 format);
void cliprdr_process_cb_monitor_ready_event(freerdp* inst);
@@ -135,7 +135,7 @@ void cliprdr_process_text(freerdp* instance, BYTE* data, int len);
void cliprdr_send_supported_format_list(freerdp* instance);
int register_channel_fds(int* fds, int count, void* instance);
void mac_process_rail_event(freerdp* instance, RDP_EVENT* event);
void mac_process_rail_event(freerdp* instance, wMessage* event);
void mac_rail_register_callbacks(freerdp* instance, rdpRail* rail);
void mac_rail_CreateWindow(rdpRail* rail, rdpWindow* window);
void mac_rail_MoveWindow(rdpRail* rail, rdpWindow* window);
@@ -145,14 +145,14 @@ void mac_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon);
void mac_rail_SetWindowRects(rdpRail* rail, rdpWindow* window);
void mac_rail_SetWindowVisibilityRects(rdpRail* rail, rdpWindow* window);
void mac_rail_DestroyWindow(rdpRail* rail, rdpWindow* window);
void mac_process_rail_get_sysparams_event(rdpChannels* channels, RDP_EVENT* event);
void mac_process_rail_get_sysparams_event(rdpChannels* channels, wMessage* event);
void mac_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param);
void mac_on_free_rail_client_event(RDP_EVENT* event);
void mac_process_rail_server_sysparam_event(rdpChannels* channels, RDP_EVENT* event);
void mac_process_rail_exec_result_event(rdpChannels* channels, RDP_EVENT* event);
void mac_on_free_rail_client_event(wMessage* event);
void mac_process_rail_server_sysparam_event(rdpChannels* channels, wMessage* event);
void mac_process_rail_exec_result_event(rdpChannels* channels, wMessage* event);
void mac_rail_enable_remoteapp_mode(void);
void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, RDP_EVENT* event);
void mac_process_rail_server_localmovesize_event(freerdp* instance, RDP_EVENT* event);
void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, wMessage* event);
void mac_process_rail_server_localmovesize_event(freerdp* instance, wMessage* event);
void apple_center_window(NSRect* r);
void apple_to_windowMove(NSRect* r, RAIL_WINDOW_MOVE_ORDER * windowMove);

View File

@@ -1323,7 +1323,7 @@ void skt_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType,
void channel_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType,
CFDataRef address, const void* data, void* info)
{
RDP_EVENT* event;
wMessage* event;
freerdp* instance = (freerdp*) info;
freerdp_channels_check_fds(instance->context->channels, instance);
@@ -1331,13 +1331,13 @@ void channel_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType,
if (event)
{
switch (event->event_class)
switch (GetMessageClass(event->id))
{
case RDP_EVENT_CLASS_RAIL:
case RailChannel_Class:
mac_process_rail_event(instance, event);
break;
case RDP_EVENT_CLASS_CLIPRDR:
case CliprdrChannel_Class:
process_cliprdr_event(instance, event);
break;
}
@@ -1432,7 +1432,7 @@ void cliprdr_process_cb_data_request_event(freerdp* instance)
NSArray* types;
RDP_CB_DATA_RESPONSE_EVENT* event;
event = (RDP_CB_DATA_RESPONSE_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_DATA_RESPONSE, NULL, NULL);
event = (RDP_CB_DATA_RESPONSE_EVENT*) freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_DataResponse, NULL, NULL);
types = [NSArray arrayWithObject:NSStringPboardType];
NSString* str = [g_mrdpview->pasteboard_rd availableTypeFromArray:types];
@@ -1451,17 +1451,17 @@ void cliprdr_process_cb_data_request_event(freerdp* instance)
event->size = len;
}
freerdp_channels_send_event(instance->context->channels, (RDP_EVENT*) event);
freerdp_channels_send_event(instance->context->channels, (wMessage*) event);
}
void cliprdr_send_data_request(freerdp* instance, UINT32 format)
{
RDP_CB_DATA_REQUEST_EVENT* event;
event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL);
event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_DataRequest, NULL, NULL);
event->format = format;
freerdp_channels_send_event(instance->context->channels, (RDP_EVENT*) event);
freerdp_channels_send_event(instance->context->channels, (wMessage*) event);
}
/**
@@ -1489,10 +1489,10 @@ void cliprdr_process_cb_data_response_event(freerdp* instance, RDP_CB_DATA_RESPO
void cliprdr_process_cb_monitor_ready_event(freerdp* instance)
{
RDP_EVENT* event;
wMessage* event;
RDP_CB_FORMAT_LIST_EVENT* format_list_event;
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_FormatList, NULL, NULL);
format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event;
format_list_event->num_formats = 0;
@@ -1551,18 +1551,18 @@ void cliprdr_process_cb_format_list_event(freerdp* instance, RDP_CB_FORMAT_LIST_
}
}
void process_cliprdr_event(freerdp* instance, RDP_EVENT* event)
void process_cliprdr_event(freerdp* instance, wMessage* event)
{
if (event)
{
switch (event->event_type)
switch (GetMessageType(event->id))
{
/*
* Monitor Ready PDU is sent by server to indicate that it has been
* initialized and is ready. This PDU is transmitted by the server after it has sent
* Clipboard Capabilities PDU
*/
case RDP_EVENT_TYPE_CB_MONITOR_READY:
case CliprdrChannel_MonitorReady:
cliprdr_process_cb_monitor_ready_event(instance);
break;
@@ -1572,7 +1572,7 @@ void process_cliprdr_event(freerdp* instance, RDP_EVENT* event)
* contains the Clipboard Format ID and name pairs of the new Clipboard
* Formats on the clipboard
*/
case RDP_EVENT_TYPE_CB_FORMAT_LIST:
case CliprdrChannel_FormatList:
cliprdr_process_cb_format_list_event(instance, (RDP_CB_FORMAT_LIST_EVENT*) event);
break;
@@ -1581,7 +1581,7 @@ void process_cliprdr_event(freerdp* instance, RDP_EVENT* event)
* It is used to request the data for one of the formats that was listed in the
* Format List PDU
*/
case RDP_EVENT_TYPE_CB_DATA_REQUEST:
case CliprdrChannel_DataRequest:
cliprdr_process_cb_data_request_event(instance);
break;
@@ -1591,12 +1591,12 @@ void process_cliprdr_event(freerdp* instance, RDP_EVENT* event)
* was successful. If the processing was successful, the Format Data Response PDU
* includes the contents of the requested clipboard data
*/
case RDP_EVENT_TYPE_CB_DATA_RESPONSE:
case CliprdrChannel_DataResponse:
cliprdr_process_cb_data_response_event(instance, (RDP_CB_DATA_RESPONSE_EVENT*) event);
break;
default:
printf("process_cliprdr_event: unknown event type %d\n", event->event_type);
printf("process_cliprdr_event: unknown event type %d\n", GetMessageType(event->id));
break;
}
@@ -1608,13 +1608,13 @@ void cliprdr_send_supported_format_list(freerdp* instance)
{
RDP_CB_FORMAT_LIST_EVENT* event;
event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_FormatList, NULL, NULL);
event->formats = (UINT32*) malloc(sizeof(UINT32) * 1);
event->num_formats = 1;
event->formats[0] = CB_FORMAT_UNICODETEXT;
freerdp_channels_send_event(instance->context->channels, (RDP_EVENT*) event);
freerdp_channels_send_event(instance->context->channels, (wMessage*) event);
}
/****************************************************************************************
@@ -1625,35 +1625,35 @@ void cliprdr_send_supported_format_list(freerdp* instance)
* *
****************************************************************************************/
void mac_process_rail_event(freerdp* instance, RDP_EVENT* event)
void mac_process_rail_event(freerdp* instance, wMessage* event)
{
switch (event->event_type)
switch (GetMessageType(event->id))
{
case RDP_EVENT_TYPE_RAIL_CHANNEL_GET_SYSPARAMS:
case RailChannel_GetSystemParam:
mac_process_rail_get_sysparams_event(instance->context->channels, event);
break;
case RDP_EVENT_TYPE_RAIL_CHANNEL_EXEC_RESULTS:
case RailChannel_ServerExecuteResult:
mac_process_rail_exec_result_event(instance->context->channels, event);
break;
case RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_SYSPARAM:
case RailChannel_ServerSystemParam:
mac_process_rail_server_sysparam_event(instance->context->channels, event);
break;
case RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_MINMAXINFO:
case RailChannel_ServerMinMaxInfo:
mac_process_rail_server_minmaxinfo_event(instance->context->channels, event);
break;
case RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_LOCALMOVESIZE:
case RailChannel_ServerLocalMoveSize:
mac_process_rail_server_localmovesize_event(instance, event);
break;
case RDP_EVENT_TYPE_RAIL_CHANNEL_APPID_RESP:
case RailChannel_ServerGetAppIdResponse:
//xf_process_rail_appid_resp_event(xfi, channels, event);
break;
case RDP_EVENT_TYPE_RAIL_CHANNEL_LANGBARINFO:
case RailChannel_ServerLanguageBarInfo:
//xf_process_rail_langbarinfo_event(xfi, channels, event);
break;
}
@@ -1715,7 +1715,7 @@ void mac_rail_CreateWindow(rdpRail* rail, rdpWindow* window)
RAIL_WINDOW_MOVE_ORDER windowMove;
apple_to_windowMove(&winFrame, &windowMove);
windowMove.windowId = window->windowId;
mac_send_rail_client_event(g_mrdpview->rdp_instance->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
mac_send_rail_client_event(g_mrdpview->rdp_instance->context->channels, RailChannel_ClientWindowMove, &windowMove);
}
/* create MRDPRailView and add to above window */
@@ -1850,10 +1850,11 @@ void mac_rail_register_callbacks(freerdp* instance, rdpRail* rail)
* by the system taskbar or by application desktop toolbars
************************************************************************/
void mac_process_rail_get_sysparams_event(rdpChannels* channels, RDP_EVENT* event)
void mac_process_rail_get_sysparams_event(rdpChannels* channels, wMessage* event)
{
RAIL_SYSPARAM_ORDER * sysparam;
sysparam = (RAIL_SYSPARAM_ORDER*) event->user_data;
RAIL_SYSPARAM_ORDER* sysparam;
sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
sysparam->workArea.left = 0;
sysparam->workArea.top = 22;
@@ -1867,12 +1868,12 @@ void mac_process_rail_get_sysparams_event(rdpChannels* channels, RDP_EVENT* even
sysparam->dragFullWindows = FALSE;
mac_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_SET_SYSPARAMS, sysparam);
mac_send_rail_client_event(channels, RailChannel_ClientSystemParam, sysparam);
}
void mac_process_rail_server_sysparam_event(rdpChannels* channels, RDP_EVENT* event)
void mac_process_rail_server_sysparam_event(rdpChannels* channels, wMessage* event)
{
RAIL_SYSPARAM_ORDER* sysparam = (RAIL_SYSPARAM_ORDER*) event->user_data;
RAIL_SYSPARAM_ORDER* sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
switch (sysparam->param)
{
@@ -1888,11 +1889,11 @@ void mac_process_rail_server_sysparam_event(rdpChannels* channels, RDP_EVENT* ev
* server returned result of exec'ing remote app on server
************************************************************************/
void mac_process_rail_exec_result_event(rdpChannels* channels, RDP_EVENT* event)
void mac_process_rail_exec_result_event(rdpChannels* channels, wMessage* event)
{
RAIL_EXEC_RESULT_ORDER* exec_result;
exec_result = (RAIL_EXEC_RESULT_ORDER*) event->user_data;
exec_result = (RAIL_EXEC_RESULT_ORDER*) event->wParam;
if (exec_result->execResult != RAIL_EXEC_S_OK)
{
@@ -1913,10 +1914,10 @@ void mac_process_rail_exec_result_event(rdpChannels* channels, RDP_EVENT* event)
* to which the window can be moved or sized
************************************************************************/
void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, RDP_EVENT* event)
void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, wMessage* event)
{
#if 0
RAIL_MINMAXINFO_ORDER * minmax = (RAIL_MINMAXINFO_ORDER*) event->user_data;
RAIL_MINMAXINFO_ORDER * minmax = (RAIL_MINMAXINFO_ORDER*) event->wParam;
printf("minmax_info: maxPosX=%d maxPosY=%d maxWidth=%d maxHeight=%d minTrackWidth=%d minTrackHeight=%d maxTrackWidth=%d maxTrackHeight=%d\n",
minmax->maxPosX, minmax->maxPosY, minmax->maxWidth, minmax->maxHeight,
minmax->minTrackWidth, minmax->minTrackHeight, minmax->maxTrackWidth, minmax->maxTrackHeight);
@@ -1929,9 +1930,9 @@ void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, RDP_EVENT*
* corresponding local window
************************************************************************/
void mac_process_rail_server_localmovesize_event(freerdp* instance, RDP_EVENT *event)
void mac_process_rail_server_localmovesize_event(freerdp* instance, wMessage *event)
{
RAIL_LOCALMOVESIZE_ORDER* moveSize = (RAIL_LOCALMOVESIZE_ORDER*) event->user_data;
RAIL_LOCALMOVESIZE_ORDER* moveSize = (RAIL_LOCALMOVESIZE_ORDER*) event->wParam;
RAIL_WINDOW_MOVE_ORDER windowMove;
switch (moveSize->moveSizeType)
@@ -1983,7 +1984,7 @@ void mac_process_rail_server_localmovesize_event(freerdp* instance, RDP_EVENT *e
[g_mrdpview->currentWindow view]->saveInitialDragLoc = NO;
/* let RDP server know where this window is located */
mac_send_rail_client_event(instance->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
mac_send_rail_client_event(instance->context->channels, RailChannel_ClientWindowMove, &windowMove);
/* the event we just sent will cause an extra MoveWindow() to be invoked which we need to ignore */
[g_mrdpview->currentWindow view]->skipMoveWindowOnce = YES;
@@ -2008,23 +2009,20 @@ void mac_process_rail_server_localmovesize_event(freerdp* instance, RDP_EVENT *e
void mac_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param)
{
void* payload = NULL;
RDP_EVENT* out_event = NULL;
wMessage* out_event = NULL;
payload = rail_clone_order(event_type, param);
if (payload)
{
out_event = freerdp_event_new(RDP_EVENT_CLASS_RAIL, event_type, mac_on_free_rail_client_event, payload);
out_event = freerdp_event_new(RailChannel_Class, event_type, mac_on_free_rail_client_event, payload);
freerdp_channels_send_event(channels, out_event);
}
}
void mac_on_free_rail_client_event(RDP_EVENT* event)
void mac_on_free_rail_client_event(wMessage* event)
{
if (event->event_class == RDP_EVENT_CLASS_RAIL)
{
rail_free_cloned_order(event->event_type, event->user_data);
}
rail_free_cloned_order(GetMessageType(event->id), event->wParam);
}
void mac_rail_enable_remoteapp_mode()

View File

@@ -100,10 +100,10 @@ int tf_receive_channel_data(freerdp* instance, int channelId, BYTE* data, int si
void tf_process_cb_monitor_ready_event(rdpChannels* channels, freerdp* instance)
{
RDP_EVENT* event;
wMessage* event;
RDP_CB_FORMAT_LIST_EVENT* format_list_event;
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_FormatList, NULL, NULL);
format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event;
format_list_event->num_formats = 0;
@@ -113,19 +113,20 @@ void tf_process_cb_monitor_ready_event(rdpChannels* channels, freerdp* instance)
void tf_process_channel_event(rdpChannels* channels, freerdp* instance)
{
RDP_EVENT* event;
wMessage* event;
event = freerdp_channels_pop_event(channels);
if (event)
{
switch (event->event_type)
switch (GetMessageType(event->id))
{
case RDP_EVENT_TYPE_CB_MONITOR_READY:
case CliprdrChannel_MonitorReady:
tf_process_cb_monitor_ready_event(channels, instance);
break;
default:
printf("tf_process_channel_event: unknown event type %d\n", event->event_type);
printf("tf_process_channel_event: unknown event type %d\n", GetMessageType(event->id));
break;
}
@@ -204,8 +205,8 @@ int tfreerdp_run(freerdp* instance)
fd_set wfds_set;
rdpChannels* channels;
memset(rfds, 0, sizeof(rfds));
memset(wfds, 0, sizeof(wfds));
ZeroMemory(rfds, sizeof(rfds));
ZeroMemory(wfds, sizeof(wfds));
channels = instance->context->channels;

View File

@@ -37,14 +37,17 @@ set(${MODULE_PREFIX}_SRCS
resource.h)
if(WITH_CLIENT_INTERFACE)
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
if(CLIENT_INTERFACE_SHARED)
add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
else()
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
endif()
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION} PREFIX "lib")
else()
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} cli/wfreerdp.c cli/wfreerdp.h)
add_executable(${MODULE_NAME} WIN32 ${${MODULE_PREFIX}_SRCS})
endif()
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS

View File

@@ -47,11 +47,11 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int status;
wfInfo* wfi;
wf_global_init();
freerdp_client_global_init();
wfi = wf_new(hInstance, NULL, __argc, __argv);
wfi = freerdp_client_new(__argc, __argv);
status = wf_start(wfi);
status = freerdp_client_start(wfi);
if (status < 0)
{
@@ -64,7 +64,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
WaitForSingleObject(wfi->thread, INFINITE);
}
wf_free(wfi);
freerdp_client_free(wfi);
return 0;
}

View File

@@ -24,7 +24,7 @@
#include <winpr/crt.h>
#include <freerdp/utils/event.h>
#include <freerdp/utils/stream.h>
#include <winpr/stream.h>
#include <freerdp/client/cliprdr.h>
#include "wf_cliprdr.h"
@@ -59,23 +59,23 @@ static void wf_cliprdr_process_cb_data_response_event(wfInfo* wfi, RDP_CB_DATA_R
}
void wf_process_cliprdr_event(wfInfo* wfi, RDP_EVENT* event)
void wf_process_cliprdr_event(wfInfo* wfi, wMessage* event)
{
switch (event->event_type)
switch (GetMessageType(event->id))
{
case RDP_EVENT_TYPE_CB_MONITOR_READY:
case CliprdrChannel_MonitorReady:
wf_cliprdr_process_cb_monitor_ready_event(wfi);
break;
case RDP_EVENT_TYPE_CB_FORMAT_LIST:
case CliprdrChannel_FormatList:
wf_cliprdr_process_cb_format_list_event(wfi, (RDP_CB_FORMAT_LIST_EVENT*) event);
break;
case RDP_EVENT_TYPE_CB_DATA_REQUEST:
case CliprdrChannel_DataRequest:
wf_cliprdr_process_cb_data_request_event(wfi, (RDP_CB_DATA_REQUEST_EVENT*) event);
break;
case RDP_EVENT_TYPE_CB_DATA_RESPONSE:
case CliprdrChannel_DataResponse:
wf_cliprdr_process_cb_data_response_event(wfi, (RDP_CB_DATA_RESPONSE_EVENT*) event);
break;

View File

@@ -23,7 +23,7 @@
void wf_cliprdr_init(wfInfo* wfi, rdpChannels* chanman);
void wf_cliprdr_uninit(wfInfo* wfi);
void wf_process_cliprdr_event(wfInfo* wfi, RDP_EVENT* event);
void wf_process_cliprdr_event(wfInfo* wfi, wMessage* event);
BOOL wf_cliprdr_process_selection_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
BOOL wf_cliprdr_process_selection_request(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
BOOL wf_cliprdr_process_selection_clear(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

View File

@@ -37,6 +37,9 @@ static HWND g_focus_hWnd;
#define X_POS(lParam) (lParam & 0xFFFF)
#define Y_POS(lParam) ((lParam >> 16) & 0xFFFF)
BOOL wf_scale_blt(wfInfo* wfi, HDC hdc, int x, int y, int w, int h, HDC hdcSrc, int x1, int y1, DWORD rop);
void wf_scale_mouse_event(wfInfo* wfi, rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
{
wfInfo* wfi;
@@ -167,6 +170,10 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
switch (Msg)
{
case WM_ERASEBKGND:
/* Say we handled it - prevents flickering */
return (LRESULT) 1;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
@@ -175,31 +182,29 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
w = ps.rcPaint.right - ps.rcPaint.left + 1;
h = ps.rcPaint.bottom - ps.rcPaint.top + 1;
//printf("WM_PAINT: x:%d y:%d w:%d h:%d\n", x, y, w, h);
BitBlt(hdc, x, y, w, h, wfi->primary->hdc, x - wfi->offset_x, y - wfi->offset_y, SRCCOPY);
wf_scale_blt(wfi, hdc, x, y, w, h, wfi->primary->hdc, x - wfi->offset_x, y - wfi->offset_y, SRCCOPY);
EndPaint(hWnd, &ps);
break;
case WM_LBUTTONDOWN:
input->MouseEvent(input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
wf_scale_mouse_event(wfi, input,PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
break;
case WM_LBUTTONUP:
input->MouseEvent(input, PTR_FLAGS_BUTTON1, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
wf_scale_mouse_event(wfi, input, PTR_FLAGS_BUTTON1, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
break;
case WM_RBUTTONDOWN:
input->MouseEvent(input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
wf_scale_mouse_event(wfi, input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
break;
case WM_RBUTTONUP:
input->MouseEvent(input, PTR_FLAGS_BUTTON2, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
wf_scale_mouse_event(wfi, input, PTR_FLAGS_BUTTON2, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
break;
case WM_MOUSEMOVE:
input->MouseEvent(input, PTR_FLAGS_MOVE, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
wf_scale_mouse_event(wfi, input, PTR_FLAGS_MOVE, X_POS(lParam) - wfi->offset_x, Y_POS(lParam) - wfi->offset_y);
break;
case WM_MOUSEWHEEL:
@@ -257,3 +262,60 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
return 0;
}
BOOL wf_scale_blt(wfInfo* wfi, HDC hdc, int x, int y, int w, int h, HDC hdcSrc, int x1, int y1, DWORD rop)
{
int ww, wh, dw, dh;
if (!wfi->client_width)
wfi->client_width = wfi->width;
if (!wfi->client_height)
wfi->client_height = wfi->height;
ww = wfi->client_width;
wh = wfi->client_height;
dw = wfi->instance->settings->DesktopWidth;
dh = wfi->instance->settings->DesktopHeight;
if (!ww)
ww = dw;
if (!wh)
wh = dh;
if (!wfi->instance->settings->SmartSizing || (ww == dw && wh == dh))
{
return BitBlt(hdc, x, y, w, h, wfi->primary->hdc, x1, y1, SRCCOPY);
}
else
{
SetStretchBltMode(hdc, HALFTONE);
SetBrushOrgEx(hdc, 0, 0, NULL);
return StretchBlt(hdc, x * ww / dw, y * wh / dh, ww, wh, wfi->primary->hdc, x1, y1, dw, dh, SRCCOPY);
}
return TRUE;
}
void wf_scale_mouse_event(wfInfo* wfi, rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
int ww, wh, dw, dh;
if (!wfi->client_width)
wfi->client_width = wfi->width;
if (!wfi->client_height)
wfi->client_height = wfi->height;
ww = wfi->client_width;
wh = wfi->client_height;
dw = wfi->instance->settings->DesktopWidth;
dh = wfi->instance->settings->DesktopHeight;
if ((ww == dw) && (wh == dh))
input->MouseEvent(input, flags, x, y);
else
input->MouseEvent(input, flags, x * dw / ww, y * dh / wh);
}

View File

@@ -62,7 +62,7 @@ BOOL wf_set_rop2(HDC hdc, int rop2)
{
if ((rop2 < 0x01) || (rop2 > 0x10))
{
printf("Unsupported ROP2: %d\n", rop2);
fprintf(stderr, "Unsupported ROP2: %d\n", rop2);
return FALSE;
}
@@ -166,14 +166,54 @@ HBRUSH wf_create_brush(wfInfo * wfi, rdpBrush* brush, UINT32 color, int bpp)
return br;
}
void wf_scale_rect(wfInfo* wfi, RECT* source)
{
int ww, wh, dw, dh;
if (!wfi->client_width)
wfi->client_width = wfi->width;
if (!wfi->client_height)
wfi->client_height = wfi->height;
ww = wfi->client_width;
wh = wfi->client_height;
dw = wfi->instance->settings->DesktopWidth;
dh = wfi->instance->settings->DesktopHeight;
if (!ww)
ww = dw;
if (!wh)
wh = dh;
if (wfi->instance->settings->SmartSizing && (ww != dw || wh != dh))
{
source->bottom = MIN(dh, MAX(0, source->bottom * wh / dh + 2));
source->top = MIN(dh, MAX(0, source->top * wh / dh - 2));
source->left = MIN(dw, MAX(0, source->left * ww / dw - 2));
source->right = MIN(dw, MAX(0, source->right * ww / dw + 2));
}
}
void wf_invalidate_region(wfInfo* wfi, int x, int y, int width, int height)
{
RECT rect;
wfi->update_rect.left = x + wfi->offset_x;
wfi->update_rect.top = y + wfi->offset_y;
wfi->update_rect.right = wfi->update_rect.left + width;
wfi->update_rect.bottom = wfi->update_rect.top + height;
wf_scale_rect(wfi, &(wfi->update_rect));
InvalidateRect(wfi->hwnd, &(wfi->update_rect), FALSE);
gdi_InvalidateRegion(wfi->hdc, x, y, width, height);
rect.left = x;
rect.right = width;
rect.top = y;
rect.bottom = height;
wf_scale_rect(wfi, &rect);
gdi_InvalidateRegion(wfi->hdc, rect.left, rect.top, rect.right, rect.bottom);
}
void wf_update_offset(wfInfo* wfi)
@@ -201,17 +241,38 @@ void wf_resize_window(wfInfo* wfi)
SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_POPUP);
SetWindowPos(wfi->hwnd, HWND_TOP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_FRAMECHANGED);
}
else if (!wfi->instance->settings->Decorations)
{
RECT rc_wnd;
RECT rc_client;
SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_CHILD);
/* Now resize to get full canvas size and room for caption and borders */
SetWindowPos(wfi->hwnd, HWND_TOP, 0, 0, wfi->width, wfi->height, SWP_FRAMECHANGED);
GetClientRect(wfi->hwnd, &rc_client);
GetWindowRect(wfi->hwnd, &rc_wnd);
wfi->diff.x = (rc_wnd.right - rc_wnd.left) - rc_client.right;
wfi->diff.y = (rc_wnd.bottom - rc_wnd.top) - rc_client.bottom;
SetWindowPos(wfi->hwnd, HWND_TOP, -1, -1, wfi->width + wfi->diff.x, wfi->height + wfi->diff.y, SWP_NOMOVE | SWP_FRAMECHANGED);
}
else
{
RECT rc_client, rc_wnd;
RECT rc_wnd;
RECT rc_client;
SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX);
/* Now resize to get full canvas size and room for caption and borders */
SetWindowPos(wfi->hwnd, HWND_TOP, 10, 10, wfi->width, wfi->height, SWP_FRAMECHANGED);
GetClientRect(wfi->hwnd, &rc_client);
GetWindowRect(wfi->hwnd, &rc_wnd);
wfi->diff.x = (rc_wnd.right - rc_wnd.left) - rc_client.right;
wfi->diff.y = (rc_wnd.bottom - rc_wnd.top) - rc_client.bottom;
SetWindowPos(wfi->hwnd, HWND_TOP, -1, -1, wfi->width + wfi->diff.x, wfi->height + wfi->diff.y, SWP_NOMOVE | SWP_FRAMECHANGED);
}
wf_update_offset(wfi);
@@ -537,7 +598,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
}
else
{
printf("Unsupported codecID %d\n", surface_bits_command->codecID);
fprintf(stderr, "Unsupported codecID %d\n", surface_bits_command->codecID);
}
if (tile_bitmap != NULL)

View File

@@ -161,7 +161,7 @@ void wf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
if (status != TRUE)
{
printf("Bitmap Decompression Failed\n");
fprintf(stderr, "Bitmap Decompression Failed\n");
}
}
else

View File

@@ -84,7 +84,7 @@ int wf_create_console(void)
return 1;
freopen("CONOUT$", "w", stdout);
printf("Debug console created.\n");
fprintf(stderr, "Debug console created.\n");
return 0;
}
@@ -222,7 +222,7 @@ BOOL wf_pre_connect(freerdp* instance)
{
file = freerdp_client_rdp_file_new();
printf("Using connection file: %s\n", settings->ConnectionFile);
fprintf(stderr, "Using connection file: %s\n", settings->ConnectionFile);
freerdp_client_parse_rdp_file(file, settings->ConnectionFile);
freerdp_client_populate_settings_from_rdp_file(file, settings);
@@ -291,7 +291,7 @@ BOOL wf_pre_connect(freerdp* instance)
if ((settings->DesktopWidth < 64) || (settings->DesktopHeight < 64) ||
(settings->DesktopWidth > 4096) || (settings->DesktopHeight > 4096))
{
printf("wf_pre_connect: invalid dimensions %d %d\n", settings->DesktopWidth, settings->DesktopHeight);
fprintf(stderr, "wf_pre_connect: invalid dimensions %d %d\n", settings->DesktopWidth, settings->DesktopHeight);
return 1;
}
@@ -305,6 +305,7 @@ BOOL wf_post_connect(freerdp* instance)
{
rdpGdi* gdi;
wfInfo* wfi;
DWORD dwStyle;
rdpCache* cache;
wfContext* context;
WCHAR lpWindowName[64];
@@ -366,10 +367,15 @@ BOOL wf_post_connect(freerdp* instance)
else
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort);
if (!settings->Decorations)
dwStyle = WS_CHILD | WS_BORDER;
else
dwStyle = 0;
if (!wfi->hwnd)
{
wfi->hwnd = CreateWindowEx((DWORD) NULL, wfi->wndClassName, lpWindowName,
0, 0, 0, 0, 0, wfi->hWndParent, NULL, wfi->hInstance, NULL);
wfi->hwnd = CreateWindowEx((DWORD) NULL, wfi->wndClassName, lpWindowName, dwStyle,
0, 0, 0, 0, wfi->hWndParent, NULL, wfi->hInstance, NULL);
SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, (LONG_PTR) wfi);
}
@@ -445,7 +451,7 @@ BOOL wf_authenticate(freerdp* instance, char** username, char** password, char**
if (status != NO_ERROR)
{
printf("CredUIPromptForCredentials unexpected status: 0x%08X\n", status);
fprintf(stderr, "CredUIPromptForCredentials unexpected status: 0x%08X\n", status);
return FALSE;
}
@@ -454,7 +460,7 @@ BOOL wf_authenticate(freerdp* instance, char** username, char** password, char**
status = CredUIParseUserNameA(UserName, User, sizeof(User), Domain, sizeof(Domain));
//printf("User: %s Domain: %s Password: %s\n", User, Domain, Password);
//fprintf(stderr, "User: %s Domain: %s Password: %s\n", User, Domain, Password);
*username = _strdup(User);
@@ -504,7 +510,7 @@ int wf_receive_channel_data(freerdp* instance, int channelId, BYTE* data, int si
void wf_process_channel_event(rdpChannels* channels, freerdp* instance)
{
RDP_EVENT* event;
wMessage* event;
event = freerdp_channels_pop_event(channels);
@@ -528,6 +534,8 @@ DWORD WINAPI wf_thread(LPVOID lpParam)
int index;
int rcount;
int wcount;
int width;
int height;
BOOL msg_ret;
int quit_msg;
void* rfds[32];
@@ -554,17 +562,17 @@ DWORD WINAPI wf_thread(LPVOID lpParam)
if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
{
printf("Failed to get FreeRDP file descriptor\n");
fprintf(stderr, "Failed to get FreeRDP file descriptor\n");
break;
}
if (wf_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE)
{
printf("Failed to get wfreerdp file descriptor\n");
fprintf(stderr, "Failed to get wfreerdp file descriptor\n");
break;
}
if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE)
{
printf("Failed to get channel manager file descriptor\n");
fprintf(stderr, "Failed to get channel manager file descriptor\n");
break;
}
@@ -582,20 +590,20 @@ DWORD WINAPI wf_thread(LPVOID lpParam)
/* exit if nothing to do */
if (fds_count == 0)
{
printf("wfreerdp_run: fds_count is zero\n");
fprintf(stderr, "wfreerdp_run: fds_count is zero\n");
break;
}
/* do the wait */
if (MsgWaitForMultipleObjects(fds_count, fds, FALSE, 1000, QS_ALLINPUT) == WAIT_FAILED)
{
printf("wfreerdp_run: WaitForMultipleObjects failed: 0x%04X\n", GetLastError());
fprintf(stderr, "wfreerdp_run: WaitForMultipleObjects failed: 0x%04X\n", GetLastError());
break;
}
if (freerdp_check_fds(instance) != TRUE)
{
printf("Failed to check FreeRDP file descriptor\n");
fprintf(stderr, "Failed to check FreeRDP file descriptor\n");
break;
}
if (freerdp_shall_disconnect(instance))
@@ -604,12 +612,12 @@ DWORD WINAPI wf_thread(LPVOID lpParam)
}
if (wf_check_fds(instance) != TRUE)
{
printf("Failed to check wfreerdp file descriptor\n");
fprintf(stderr, "Failed to check wfreerdp file descriptor\n");
break;
}
if (freerdp_channels_check_fds(channels, instance) != TRUE)
{
printf("Failed to check channel manager file descriptor\n");
fprintf(stderr, "Failed to check channel manager file descriptor\n");
break;
}
wf_process_channel_event(channels, instance);
@@ -620,7 +628,30 @@ DWORD WINAPI wf_thread(LPVOID lpParam)
{
msg_ret = GetMessage(&msg, NULL, 0, 0);
if (msg_ret == 0 || msg_ret == -1)
if (instance->settings->EmbeddedWindow)
{
if ((msg.message == WM_SETFOCUS) && (msg.lParam == 1))
{
PostMessage(((wfContext*) instance->context)->wfi->hwnd, WM_SETFOCUS, 0, 0);
}
else if ((msg.message == WM_KILLFOCUS) && (msg.lParam == 1))
{
PostMessage(((wfContext*) instance->context)->wfi->hwnd, WM_KILLFOCUS, 0, 0);
}
}
if (msg.message == WM_SIZE)
{
width = LOWORD(msg.lParam);
height = HIWORD(msg.lParam);
((wfContext*) instance->context)->wfi->client_width = width;
((wfContext*) instance->context)->wfi->client_height = height;
SetWindowPos(((wfContext*) instance->context)->wfi->hwnd, HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
}
if ((msg_ret == 0) || (msg_ret == -1))
{
quit_msg = TRUE;
break;
@@ -659,7 +690,7 @@ DWORD WINAPI wf_keyboard_thread(LPVOID lpParam)
{
if (status == -1)
{
printf("keyboard thread error getting message\n");
fprintf(stderr, "keyboard thread error getting message\n");
break;
}
else
@@ -673,13 +704,13 @@ DWORD WINAPI wf_keyboard_thread(LPVOID lpParam)
}
else
{
printf("failed to install keyboard hook\n");
fprintf(stderr, "failed to install keyboard hook\n");
}
return (DWORD) NULL;
}
int wf_global_init()
int freerdp_client_global_init()
{
WSADATA wsaData;
@@ -705,21 +736,20 @@ int wf_global_init()
return 0;
}
int wf_global_uninit()
int freerdp_client_global_uninit()
{
WSACleanup();
return 0;
}
wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
wfInfo* freerdp_client_new(int argc, char** argv)
{
int index;
int status;
wfInfo* wfi;
freerdp* instance;
if (!hInstance)
hInstance = GetModuleHandle(NULL);
instance = freerdp_new();
instance->PreConnect = wf_pre_connect;
instance->PostConnect = wf_post_connect;
@@ -733,10 +763,30 @@ wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
freerdp_context_new(instance);
wfi = ((wfContext*) (instance->context))->wfi;
wfi->instance = instance;
wfi->client = instance->context->client;
instance->context->argc = argc;
instance->context->argv = argv;
instance->context->argv = (char**) malloc(sizeof(char*) * argc);
for (index = 0; index < argc; index++)
instance->context->argv[index] = _strdup(argv[index]);
status = freerdp_client_parse_command_line_arguments(instance->context->argc, instance->context->argv, instance->settings);
return wfi;
}
int freerdp_client_start(wfInfo* wfi)
{
HWND hWndParent;
HINSTANCE hInstance;
freerdp* instance = wfi->instance;
hInstance = GetModuleHandle(NULL);
hWndParent = (HWND) instance->settings->ParentWindowId;
instance->settings->EmbeddedWindow = (hWndParent) ? TRUE : FALSE;
wfi->hWndParent = hWndParent;
wfi->hInstance = hInstance;
@@ -758,24 +808,14 @@ wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv)
wfi->wndClass.hIconSm = wfi->icon;
RegisterClassEx(&(wfi->wndClass));
return wfi;
}
int wf_start(wfInfo* wfi)
{
int status;
freerdp* instance = wfi->instance;
wfi->keyboardThread = CreateThread(NULL, 0, wf_keyboard_thread, (void*) wfi, 0, NULL);
if (!wfi->keyboardThread)
return -1;
status = freerdp_client_parse_command_line_arguments(instance->context->argc, instance->context->argv, instance->settings);
freerdp_client_load_addins(instance->context->channels, instance->settings);
wfi->thread = CreateThread(NULL, 0, wf_thread, (void*) instance, 0, NULL);
wfi->thread = CreateThread(NULL, 0, wf_thread, (void*) instance, 0, &wfi->mainThreadId);
if (!wfi->thread)
return -1;
@@ -783,12 +823,35 @@ int wf_start(wfInfo* wfi)
return 0;
}
int wf_stop(wfInfo* wfi)
int freerdp_client_stop(wfInfo* wfi)
{
PostThreadMessage(wfi->mainThreadId, WM_QUIT, 0, 0);
return 0;
}
int wf_free(wfInfo* wfi)
int freerdp_client_focus_in(wfInfo* wfi)
{
PostThreadMessage(wfi->mainThreadId, WM_SETFOCUS, 0, 1);
return 0;
}
int freerdp_client_focus_out(wfInfo* wfi)
{
PostThreadMessage(wfi->mainThreadId, WM_KILLFOCUS, 0, 1);
return 0;
}
int wf_set_window_size(wfInfo* wfi, int width, int height)
{
if ((width != wfi->client_width) || (height != wfi->client_height))
{
PostThreadMessage(wfi->mainThreadId, WM_SIZE, SIZE_RESTORED, ((UINT) height << 16) | (UINT) width);
}
return 0;
}
int freerdp_client_free(wfInfo* wfi)
{
freerdp* instance = wfi->instance;

View File

@@ -38,6 +38,10 @@
#include "wf_event.h"
#ifdef __cplusplus
extern "C" {
#endif
struct wf_bitmap
{
rdpBitmap _bitmap;
@@ -67,6 +71,8 @@ typedef struct wf_context wfContext;
struct wf_info
{
rdpClient* client;
int width;
int height;
int offset_x;
@@ -75,6 +81,8 @@ struct wf_info
int fullscreen;
int percentscreen;
char window_title[64];
int client_width;
int client_height;
HANDLE thread;
HANDLE keyboardThread;
@@ -99,21 +107,38 @@ struct wf_info
HBRUSH brush;
HBRUSH org_brush;
RECT update_rect;
RECT scale_update_rect;
wfBitmap* tile;
DWORD mainThreadId;
RFX_CONTEXT* rfx_context;
NSC_CONTEXT* nsc_context;
BOOL sw_gdi;
};
FREERDP_API int wf_global_init();
FREERDP_API int wf_global_uninit();
/**
* Client Interface
*/
FREERDP_API int wf_start(wfInfo* wfi);
FREERDP_API int wf_stop(wfInfo* wfi);
#define cfInfo wfInfo
FREERDP_API wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv);
FREERDP_API int wf_free(wfInfo* wfi);
FREERDP_API int freerdp_client_global_init();
FREERDP_API int freerdp_client_global_uninit();
FREERDP_API int freerdp_client_start(wfInfo* cfi);
FREERDP_API int freerdp_client_stop(wfInfo* cfi);
FREERDP_API int freerdp_client_focus_in(wfInfo* cfi);
FREERDP_API int freerdp_client_focus_out(wfInfo* cfi);
FREERDP_API int freerdp_client_set_window_size(wfInfo* cfi, int width, int height);
FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv);
FREERDP_API int freerdp_client_free(wfInfo* cfi);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -45,7 +45,7 @@ void wf_rail_send_activate(wfInfo* wfi, HWND window, BOOL enabled)
{
}
void wf_process_rail_event(wfInfo* wfi, rdpChannels* chanman, RDP_EVENT* event)
void wf_process_rail_event(wfInfo* wfi, rdpChannels* chanman, wMessage* event)
{
}

View File

@@ -25,7 +25,7 @@ void wf_rail_paint(wfInfo* wfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 u
void wf_rail_register_callbacks(wfInfo* wfi, rdpRail* rail);
void wf_rail_send_client_system_command(wfInfo* wfi, UINT32 windowId, UINT16 command);
void wf_rail_send_activate(wfInfo* wfi, HWND window, BOOL enabled);
void wf_process_rail_event(wfInfo* wfi, rdpChannels* chanman, RDP_EVENT* event);
void wf_process_rail_event(wfInfo* wfi, rdpChannels* chanman, wMessage* event);
void wf_rail_adjust_position(wfInfo* wfi, rdpWindow *window);
void wf_rail_end_local_move(wfInfo* wfi, rdpWindow *window);

View File

@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set(MODULE_NAME "xfreerdp")
set(MODULE_PREFIX "FREERDP_CLIENT_X11")
set(MODULE_NAME "xfreerdp-client")
set(MODULE_PREFIX "FREERDP_CLIENT_X11_CONTROL")
include(FindXmlto)
include_directories(${X11_INCLUDE_DIRS})
@@ -40,10 +40,20 @@ set(${MODULE_PREFIX}_SRCS
xf_keyboard.h
xf_window.c
xf_window.h
xfreerdp.c
xfreerdp.h)
xf_interface.c
xf_interface.h)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
if(WITH_CLIENT_INTERFACE)
if(CLIENT_INTERFACE_SHARED)
add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS})
else()
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
endif()
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION} PREFIX "lib")
else()
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} cli/xfreerdp.c cli/xfreerdp.h)
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
endif()
set(${MODULE_PREFIX}_LIBS
${X11_LIBRARIES}
@@ -128,6 +138,12 @@ if(WITH_IPP)
target_link_libraries(xfreerdp ${IPP_LIBRARY_LIST})
endif()
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
if(WITH_CLIENT_INTERFACE)
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
add_subdirectory(cli)
else()
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/X11")

2
client/X11/cli/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
xfreerdp

Some files were not shown because too many files have changed in this diff Show More