diff --git a/.gitignore b/.gitignore index 8bb66ef8b..e47362dfd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # CMake CMakeFiles/ +CMakeScripts/ CMakeCache.txt config.h install_manifest.txt @@ -23,6 +24,7 @@ client/X11/xfreerdp.1 # Mac OS X .DS_Store +*.xcodeproj/ # Windows *.vcxproj diff --git a/CMakeLists.txt b/CMakeLists.txt index e5eaa9a8d..24bb41129 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -18,8 +18,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) + project(FreeRDP C) + set(CMAKE_COLOR_MAKEFILE ON) # Include cmake modules @@ -62,8 +64,8 @@ if(NOT DEFINED BUILD_SHARED_LIBS) set(BUILD_SHARED_LIBS ON) endif() -if(NOT BUILD_SHARED_LIBS AND WITH_MONOLITHIC_BUILD) - set(WITH_STATIC_PLUGINS ON) +if(NOT BUILD_SHARED_LIBS AND MONOLITHIC_BUILD) + set(STATIC_CHANNELS ON) endif() # Configure MSVC Runtime @@ -171,12 +173,23 @@ if(NOT WIN32) endif() endif() +if(WIN32) + set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}) + set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}) + set(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}) +endif() + # Path to put FreeRDP data set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/freerdp") set(FREERDP_KEYMAP_PATH "${FREERDP_DATA_PATH}/keymaps") # Path to put plugins -set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp") +if(WIN32) + set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}") +else() + set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp") +endif() + set(FREERDP_CLIENT_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/client") set(FREERDP_SERVER_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}/server") diff --git a/channels/CMakeLists.txt b/channels/CMakeLists.txt index 09cba743f..d4b49faad 100644 --- a/channels/CMakeLists.txt +++ b/channels/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(FILENAME "ChannelOptions.cmake") file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") @@ -30,6 +32,11 @@ foreach(FILEPATH ${FILEPATHS}) endif() endforeach(FILEPATH) +if(WITH_CLIENT_CHANNELS) + add_subdirectory(client) +endif() + if(WITH_SERVER_CHANNELS) add_subdirectory(server) endif() + diff --git a/channels/audin/CMakeLists.txt b/channels/audin/CMakeLists.txt index dc9f2b019..fce6756af 100644 --- a/channels/audin/CMakeLists.txt +++ b/channels/audin/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau diff --git a/channels/audin/client/CMakeLists.txt b/channels/audin/client/CMakeLists.txt index 2be9f936b..0eaa9f61c 100644 --- a/channels/audin/client/CMakeLists.txt +++ b/channels/audin/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,22 +15,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(AUDIN_SRCS +set(MODULE_NAME "audin") +set(MODULE_PREFIX "CHANNEL_AUDIN_CLIENT") + +set(${MODULE_PREFIX}_SRCS audin_main.c audin_main.h) include_directories(..) -add_library(audin ${AUDIN_SRCS}) -set_target_properties(audin PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(audin freerdp) +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(audin freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS audin DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") if(WITH_ALSA) add_subdirectory(alsa) diff --git a/channels/audin/client/alsa/CMakeLists.txt b/channels/audin/client/alsa/CMakeLists.txt index e7a0df6a2..cb469b635 100644 --- a/channels/audin/client/alsa/CMakeLists.txt +++ b/channels/audin/client/alsa/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -26,7 +26,7 @@ include_directories(${ALSA_INCLUDE_DIRS}) add_library(audin_alsa ${AUDIN_ALSA_SRCS}) set_target_properties(audin_alsa PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(audin_alsa freerdp) else() target_link_libraries(audin_alsa freerdp-utils) diff --git a/channels/audin/client/alsa/audin_alsa.c b/channels/audin/client/alsa/audin_alsa.c index cfada9a9f..bb2e04dd3 100644 --- a/channels/audin/client/alsa/audin_alsa.c +++ b/channels/audin/client/alsa/audin_alsa.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Input Redirection Virtual Channel - ALSA implementation * * Copyright 2010-2011 Vic Lee @@ -37,12 +37,12 @@ typedef struct _AudinALSADevice IAudinDevice iface; char device_name[32]; - uint32 frames_per_packet; - uint32 target_rate; - uint32 actual_rate; + UINT32 frames_per_packet; + UINT32 target_rate; + UINT32 actual_rate; snd_pcm_format_t format; - uint32 target_channels; - uint32 actual_channels; + UINT32 target_channels; + UINT32 actual_channels; int bytes_per_channel; int wformat; int block_size; @@ -51,14 +51,14 @@ typedef struct _AudinALSADevice freerdp_thread* thread; - uint8* buffer; + BYTE* buffer; int buffer_frames; AudinReceive receive; void* user_data; } AudinALSADevice; -static boolean audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_handle) +static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_handle) { int error; snd_pcm_hw_params_t* hw_params; @@ -67,7 +67,7 @@ static boolean audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_h { DEBUG_WARN("snd_pcm_hw_params_malloc (%s)", snd_strerror(error)); - return false; + return FALSE; } snd_pcm_hw_params_any(capture_handle, hw_params); snd_pcm_hw_params_set_access(capture_handle, hw_params, @@ -90,16 +90,16 @@ static boolean audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_h alsa->actual_rate, alsa->actual_channels, alsa->target_rate, alsa->target_channels); } - return true; + return TRUE; } -static boolean audin_alsa_thread_receive(AudinALSADevice* alsa, uint8* src, int size) +static BOOL audin_alsa_thread_receive(AudinALSADevice* alsa, BYTE* src, int size) { int frames; int cframes; int ret = 0; int encoded_size; - uint8* encoded_data; + BYTE* encoded_data; int rbytes_per_frame; int tbytes_per_frame; @@ -173,7 +173,7 @@ static boolean audin_alsa_thread_receive(AudinALSADevice* alsa, uint8* src, int static void* audin_alsa_thread_func(void* arg) { int error; - uint8* buffer; + BYTE* buffer; int rbytes_per_frame; int tbytes_per_frame; snd_pcm_t* capture_handle = NULL; @@ -183,9 +183,9 @@ static void* audin_alsa_thread_func(void* arg) rbytes_per_frame = alsa->actual_channels * alsa->bytes_per_channel; tbytes_per_frame = alsa->target_channels * alsa->bytes_per_channel; - alsa->buffer = (uint8*) xzalloc(tbytes_per_frame * alsa->frames_per_packet); + alsa->buffer = (BYTE*) xzalloc(tbytes_per_frame * alsa->frames_per_packet); alsa->buffer_frames = 0; - buffer = (uint8*) xzalloc(rbytes_per_frame * alsa->frames_per_packet); + buffer = (BYTE*) xzalloc(rbytes_per_frame * alsa->frames_per_packet); freerdp_dsp_context_reset_adpcm(alsa->dsp_context); do { @@ -217,8 +217,8 @@ static void* audin_alsa_thread_func(void* arg) } } while (0); - xfree(buffer); - xfree(alsa->buffer); + free(buffer); + free(alsa->buffer); alsa->buffer = NULL; if (capture_handle) snd_pcm_close(capture_handle); @@ -236,10 +236,10 @@ static void audin_alsa_free(IAudinDevice* device) freerdp_thread_free(alsa->thread); freerdp_dsp_context_free(alsa->dsp_context); - xfree(alsa); + free(alsa); } -static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* format) +static BOOL audin_alsa_format_supported(IAudinDevice* device, audinFormat* format) { switch (format->wFormatTag) { @@ -249,7 +249,7 @@ static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* fo (format->wBitsPerSample == 8 || format->wBitsPerSample == 16) && (format->nChannels == 1 || format->nChannels == 2)) { - return true; + return TRUE; } break; @@ -258,14 +258,14 @@ static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* fo (format->wBitsPerSample == 4) && (format->nChannels == 1 || format->nChannels == 2)) { - return true; + return TRUE; } break; } - return false; + return FALSE; } -static void audin_alsa_set_format(IAudinDevice* device, audinFormat* format, uint32 FramesPerPacket) +static void audin_alsa_set_format(IAudinDevice* device, audinFormat* format, UINT32 FramesPerPacket) { int bs; AudinALSADevice* alsa = (AudinALSADevice*) device; diff --git a/channels/audin/client/audin_main.c b/channels/audin/client/audin_main.c index 71395d421..f4546319d 100644 --- a/channels/audin/client/audin_main.c +++ b/channels/audin/client/audin_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Input Redirection Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -74,9 +74,9 @@ struct _AUDIN_PLUGIN AUDIN_LISTENER_CALLBACK* listener_callback; /* Parsed plugin data */ - uint16 fixed_format; - uint16 fixed_channel; - uint32 fixed_rate; + UINT16 fixed_format; + UINT16 fixed_channel; + UINT32 fixed_rate; /* Device interface */ IAudinDevice* device; @@ -86,16 +86,16 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, S { int error; STREAM* out; - uint32 Version; + UINT32 Version; AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; - stream_read_uint32(s, Version); + stream_read_UINT32(s, Version); DEBUG_DVC("Version=%d", Version); out = stream_new(5); - stream_write_uint8(out, MSG_SNDIN_VERSION); - stream_write_uint32(out, Version); + stream_write_BYTE(out, MSG_SNDIN_VERSION); + stream_write_UINT32(out, Version); error = callback->channel->Write(callback->channel, stream_get_length(s), stream_get_head(s), NULL); stream_free(out); @@ -104,7 +104,7 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, S static int audin_send_incoming_data_pdu(IWTSVirtualChannelCallback* pChannelCallback) { - uint8 out_data[1]; + BYTE out_data[1]; AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; out_data[0] = MSG_SNDIN_DATA_INCOMING; @@ -115,22 +115,22 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S { AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin; - uint32 i; - uint8* fm; + UINT32 i; + BYTE* fm; int error; STREAM* out; - uint32 NumFormats; + UINT32 NumFormats; audinFormat format; - uint32 cbSizeFormatsPacket; + UINT32 cbSizeFormatsPacket; - stream_read_uint32(s, NumFormats); + stream_read_UINT32(s, NumFormats); DEBUG_DVC("NumFormats %d", NumFormats); if ((NumFormats < 1) || (NumFormats > 1000)) { DEBUG_WARN("bad NumFormats %d", NumFormats); return 1; } - stream_seek_uint32(s); /* cbSizeFormatsPacket */ + stream_seek_UINT32(s); /* cbSizeFormatsPacket */ callback->formats = (audinFormat*) xzalloc(NumFormats * sizeof(audinFormat)); @@ -141,13 +141,13 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S for (i = 0; i < NumFormats; i++) { stream_get_mark(s, fm); - stream_read_uint16(s, format.wFormatTag); - stream_read_uint16(s, format.nChannels); - stream_read_uint32(s, format.nSamplesPerSec); - stream_seek_uint32(s); /* nAvgBytesPerSec */ - stream_read_uint16(s, format.nBlockAlign); - stream_read_uint16(s, format.wBitsPerSample); - stream_read_uint16(s, format.cbSize); + stream_read_UINT16(s, format.wFormatTag); + stream_read_UINT16(s, format.nChannels); + stream_read_UINT32(s, format.nSamplesPerSec); + stream_seek_UINT32(s); /* nAvgBytesPerSec */ + stream_read_UINT16(s, format.nBlockAlign); + stream_read_UINT16(s, format.wBitsPerSample); + stream_read_UINT16(s, format.cbSize); format.data = stream_get_tail(s); stream_seek(s, format.cbSize); @@ -179,9 +179,9 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S cbSizeFormatsPacket = stream_get_pos(out); stream_set_pos(out, 0); - stream_write_uint8(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */ - stream_write_uint32(out, callback->formats_count); /* NumFormats (4 bytes) */ - stream_write_uint32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */ + stream_write_BYTE(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */ + stream_write_UINT32(out, callback->formats_count); /* NumFormats (4 bytes) */ + stream_write_UINT32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */ error = callback->channel->Write(callback->channel, cbSizeFormatsPacket, stream_get_head(out), NULL); stream_free(out); @@ -189,37 +189,37 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, S return error; } -static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCallback, uint32 NewFormat) +static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCallback, UINT32 NewFormat) { int error; STREAM* out; AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; out = stream_new(5); - stream_write_uint8(out, MSG_SNDIN_FORMATCHANGE); - stream_write_uint32(out, NewFormat); + stream_write_BYTE(out, MSG_SNDIN_FORMATCHANGE); + stream_write_UINT32(out, NewFormat); error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL); stream_free(out); return error; } -static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallback, uint32 Result) +static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallback, UINT32 Result) { int error; STREAM* out; AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; out = stream_new(5); - stream_write_uint8(out, MSG_SNDIN_OPEN_REPLY); - stream_write_uint32(out, Result); + stream_write_BYTE(out, MSG_SNDIN_OPEN_REPLY); + stream_write_UINT32(out, Result); error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL); stream_free(out); return error; } -static boolean audin_receive_wave_data(uint8* data, int size, void* user_data) +static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data) { int error; STREAM* out; @@ -228,15 +228,15 @@ static boolean audin_receive_wave_data(uint8* data, int size, void* user_data) error = audin_send_incoming_data_pdu((IWTSVirtualChannelCallback*) callback); if (error != 0) - return false; + return FALSE; out = stream_new(size + 1); - stream_write_uint8(out, MSG_SNDIN_DATA); + stream_write_BYTE(out, MSG_SNDIN_DATA); stream_write(out, data, size); error = callback->channel->Write(callback->channel, stream_get_length(out), stream_get_head(out), NULL); stream_free(out); - return (error == 0 ? true : false); + return (error == 0 ? TRUE : FALSE); } static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, STREAM* s) @@ -244,16 +244,16 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, STRE AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin; audinFormat* format; - uint32 initialFormat; - uint32 FramesPerPacket; + UINT32 initialFormat; + UINT32 FramesPerPacket; - stream_read_uint32(s, FramesPerPacket); - stream_read_uint32(s, initialFormat); + stream_read_UINT32(s, FramesPerPacket); + stream_read_UINT32(s, initialFormat); DEBUG_DVC("FramesPerPacket=%d initialFormat=%d", FramesPerPacket, initialFormat); - if (initialFormat >= (uint32) callback->formats_count) + if (initialFormat >= (UINT32) callback->formats_count) { DEBUG_WARN("invalid format index %d (total %d)", initialFormat, callback->formats_count); @@ -277,14 +277,14 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb { AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; AUDIN_PLUGIN * audin = (AUDIN_PLUGIN*) callback->plugin; - uint32 NewFormat; + UINT32 NewFormat; audinFormat* format; - stream_read_uint32(s, NewFormat); + stream_read_UINT32(s, NewFormat); DEBUG_DVC("NewFormat=%d", NewFormat); - if (NewFormat >= (uint32) callback->formats_count) + if (NewFormat >= (UINT32) callback->formats_count) { DEBUG_WARN("invalid format index %d (total %d)", NewFormat, callback->formats_count); @@ -305,16 +305,16 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb return 0; } -static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, uint32 cbSize, uint8* pBuffer) +static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 cbSize, BYTE* pBuffer) { int error; STREAM* s; - uint8 MessageId; + BYTE MessageId; s = stream_new(0); stream_attach(s, pBuffer, cbSize); - stream_read_uint8(s, MessageId); + stream_read_BYTE(s, MessageId); DEBUG_DVC("MessageId=0x%x", MessageId); @@ -358,14 +358,14 @@ static int audin_on_close(IWTSVirtualChannelCallback* pChannelCallback) if (audin->device) IFCALL(audin->device->Close, audin->device); - xfree(callback->formats); - xfree(callback); + free(callback->formats); + free(callback); return 0; } static int audin_on_new_channel_connection(IWTSListenerCallback* pListenerCallback, - IWTSVirtualChannel* pChannel, uint8* Data, int* pbAccept, + IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept, IWTSVirtualChannelCallback** ppCallback) { AUDIN_CHANNEL_CALLBACK* callback; @@ -415,8 +415,8 @@ static int audin_plugin_terminated(IWTSPlugin* pPlugin) audin->device = NULL; } - xfree(audin->listener_callback); - xfree(audin); + free(audin->listener_callback); + free(audin); return 0; } @@ -436,7 +436,7 @@ static void audin_register_device_plugin(IWTSPlugin* pPlugin, IAudinDevice* devi audin->device = device; } -static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, RDP_PLUGIN_DATA* data) +static BOOL audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, RDP_PLUGIN_DATA* data) { char* fullname; PFREERDP_AUDIN_DEVICE_ENTRY entry; @@ -452,11 +452,11 @@ static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, R strcpy(fullname, "audin_"); strcat(fullname, name); entry = (PFREERDP_AUDIN_DEVICE_ENTRY) freerdp_load_plugin(fullname, AUDIN_DEVICE_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) - return false; + return FALSE; entryPoints.plugin = pPlugin; entryPoints.pRegisterAudinDevice = audin_register_device_plugin; @@ -465,15 +465,15 @@ static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, R if (entry(&entryPoints) != 0) { DEBUG_WARN("%s entry returns error.", name); - return false; + return FALSE; } - return true; + return TRUE; } -static boolean audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data) +static BOOL audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data) { - boolean ret; + BOOL ret; AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin; RDP_PLUGIN_DATA default_data[2] = { { 0 }, { 0 } }; @@ -482,17 +482,17 @@ static boolean audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* d if (data->data[1] && strcmp((char*)data->data[1], "format") == 0) { audin->fixed_format = atoi(data->data[2]); - return true; + return TRUE; } else if (data->data[1] && strcmp((char*)data->data[1], "rate") == 0) { audin->fixed_rate = atoi(data->data[2]); - return true; + return TRUE; } else if (data->data[1] && strcmp((char*)data->data[1], "channel") == 0) { audin->fixed_channel = atoi(data->data[2]); - return true; + return TRUE; } else if (data->data[1] && ((char*)data->data[1])[0]) { @@ -520,7 +520,7 @@ static boolean audin_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* d } } - return true; + return TRUE; } int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) diff --git a/channels/audin/client/audin_main.h b/channels/audin/client/audin_main.h index e848acf7a..761cf572c 100644 --- a/channels/audin/client/audin_main.h +++ b/channels/audin/client/audin_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Input Redirection Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -34,26 +34,26 @@ #define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) #endif -typedef boolean (*AudinReceive) (uint8* data, int size, void* user_data); +typedef BOOL (*AudinReceive) (BYTE* data, int size, void* user_data); typedef struct audin_format audinFormat; struct audin_format { - uint16 wFormatTag; - uint16 nChannels; - uint32 nSamplesPerSec; - uint16 nBlockAlign; - uint16 wBitsPerSample; - uint16 cbSize; - uint8* data; + UINT16 wFormatTag; + UINT16 nChannels; + UINT32 nSamplesPerSec; + UINT16 nBlockAlign; + UINT16 wBitsPerSample; + UINT16 cbSize; + BYTE* data; }; typedef struct _IAudinDevice IAudinDevice; struct _IAudinDevice { void (*Open) (IAudinDevice* devplugin, AudinReceive receive, void* user_data); - boolean (*FormatSupported) (IAudinDevice* devplugin, audinFormat* format); - void (*SetFormat) (IAudinDevice* devplugin, audinFormat* format, uint32 FramesPerPacket); + BOOL (*FormatSupported) (IAudinDevice* devplugin, audinFormat* format); + void (*SetFormat) (IAudinDevice* devplugin, audinFormat* format, UINT32 FramesPerPacket); void (*Close) (IAudinDevice* devplugin); void (*Free) (IAudinDevice* devplugin); }; diff --git a/channels/audin/client/pulse/CMakeLists.txt b/channels/audin/client/pulse/CMakeLists.txt index bb81b0b99..2753ef1bf 100644 --- a/channels/audin/client/pulse/CMakeLists.txt +++ b/channels/audin/client/pulse/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -27,7 +27,7 @@ include_directories(${PULSEAUDIO_INCLUDE_DIR}) add_library(audin_pulse ${AUDIN_PULSE_SRCS}) set_target_properties(audin_pulse PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(audin_pulse freerdp) else() target_link_libraries(audin_pulse freerdp-utils) diff --git a/channels/audin/client/pulse/audin_pulse.c b/channels/audin/client/pulse/audin_pulse.c index 1ad2cc285..9797b275e 100644 --- a/channels/audin/client/pulse/audin_pulse.c +++ b/channels/audin/client/pulse/audin_pulse.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Input Redirection Virtual Channel - PulseAudio implementation * * Copyright 2010-2011 Vic Lee @@ -37,7 +37,7 @@ typedef struct _AudinPulseDevice IAudinDevice iface; char device_name[32]; - uint32 frames_per_packet; + UINT32 frames_per_packet; pa_threaded_mainloop* mainloop; pa_context* context; pa_sample_spec sample_spec; @@ -48,7 +48,7 @@ typedef struct _AudinPulseDevice FREERDP_DSP_CONTEXT* dsp_context; int bytes_per_frame; - uint8* buffer; + BYTE* buffer; int buffer_frames; AudinReceive receive; @@ -80,19 +80,19 @@ static void audin_pulse_context_state_callback(pa_context* context, void* userda } } -static boolean audin_pulse_connect(IAudinDevice* device) +static BOOL audin_pulse_connect(IAudinDevice* device) { pa_context_state_t state; AudinPulseDevice* pulse = (AudinPulseDevice*) device; if (!pulse->context) - return false; + return FALSE; if (pa_context_connect(pulse->context, NULL, 0, NULL)) { DEBUG_WARN("pa_context_connect failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } pa_threaded_mainloop_lock(pulse->mainloop); if (pa_threaded_mainloop_start(pulse->mainloop) < 0) @@ -100,7 +100,7 @@ static boolean audin_pulse_connect(IAudinDevice* device) pa_threaded_mainloop_unlock(pulse->mainloop); DEBUG_WARN("pa_threaded_mainloop_start failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } for (;;) { @@ -119,12 +119,12 @@ static boolean audin_pulse_connect(IAudinDevice* device) if (state == PA_CONTEXT_READY) { DEBUG_DVC("connected"); - return true; + return TRUE; } else { pa_context_disconnect(pulse->context); - return false; + return FALSE; } } @@ -152,10 +152,10 @@ static void audin_pulse_free(IAudinDevice* device) pulse->mainloop = NULL; } freerdp_dsp_context_free(pulse->dsp_context); - xfree(pulse); + free(pulse); } -static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* format) +static BOOL audin_pulse_format_supported(IAudinDevice* device, audinFormat* format) { AudinPulseDevice* pulse = (AudinPulseDevice*) device; @@ -170,7 +170,7 @@ static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* f (format->wBitsPerSample == 8 || format->wBitsPerSample == 16) && (format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX)) { - return true; + return TRUE; } break; @@ -181,7 +181,7 @@ static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* f (format->wBitsPerSample == 8) && (format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX)) { - return true; + return TRUE; } break; @@ -190,14 +190,14 @@ static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* f (format->wBitsPerSample == 4) && (format->nChannels == 1 || format->nChannels == 2)) { - return true; + return TRUE; } break; } - return false; + return FALSE; } -static void audin_pulse_set_format(IAudinDevice* device, audinFormat* format, uint32 FramesPerPacket) +static void audin_pulse_set_format(IAudinDevice* device, audinFormat* format, UINT32 FramesPerPacket) { int bs; pa_sample_spec sample_spec = { 0 }; @@ -279,11 +279,11 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length { int frames; int cframes; - boolean ret; + BOOL ret; const void* data; - const uint8* src; + const BYTE* src; int encoded_size; - uint8* encoded_data; + BYTE* encoded_data; AudinPulseDevice* pulse = (AudinPulseDevice*) userdata; pa_stream_peek(stream, &data, &length); @@ -291,7 +291,7 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length DEBUG_DVC("length %d frames %d", (int) length, frames); - src = (const uint8*) data; + src = (const BYTE*) data; while (frames > 0) { cframes = pulse->frames_per_packet - pulse->buffer_frames; @@ -350,7 +350,7 @@ static void audin_pulse_close(IAudinDevice* device) pulse->user_data = NULL; if (pulse->buffer) { - xfree(pulse->buffer); + free(pulse->buffer); pulse->buffer = NULL; pulse->buffer_frames = 0; } @@ -387,10 +387,10 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u audin_pulse_stream_state_callback, pulse); pa_stream_set_read_callback(pulse->stream, audin_pulse_stream_request_callback, pulse); - buffer_attr.maxlength = (uint32_t) -1; - buffer_attr.tlength = (uint32_t) -1; - buffer_attr.prebuf = (uint32_t) -1; - buffer_attr.minreq = (uint32_t) -1; + buffer_attr.maxlength = (UINT32_t) -1; + buffer_attr.tlength = (UINT32_t) -1; + buffer_attr.prebuf = (UINT32_t) -1; + buffer_attr.minreq = (UINT32_t) -1; /* 500ms latency */ buffer_attr.fragsize = pa_usec_to_bytes(500000, &pulse->sample_spec); if (pa_stream_connect_record(pulse->stream, diff --git a/channels/audin/server/CMakeLists.txt b/channels/audin/server/CMakeLists.txt index d728b7009..3c93917b0 100644 --- a/channels/audin/server/CMakeLists.txt +++ b/channels/audin/server/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -21,7 +21,7 @@ set(${MODULE_PREFIX}_SRCS audin.c PARENT_SCOPE) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS freerdp PARENT_SCOPE) else() set(${MODULE_PREFIX}_LIBS freerdp-utils freerdp-channels PARENT_SCOPE) diff --git a/channels/audin/server/audin.c b/channels/audin/server/audin.c index 3f51f0a2b..8ed36382b 100644 --- a/channels/audin/server/audin.c +++ b/channels/audin/server/audin.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Server Audio Input Virtual Channel * * Copyright 2012 Vic Lee @@ -50,7 +50,7 @@ typedef struct _audin_server FREERDP_DSP_CONTEXT* dsp_context; - boolean opened; + BOOL opened; } audin_server; static void audin_server_select_format(audin_server_context* context, int client_format_index) @@ -68,33 +68,33 @@ static void audin_server_select_format(audin_server_context* context, int client static void audin_server_send_version(audin_server* audin, STREAM* s) { - stream_write_uint8(s, MSG_SNDIN_VERSION); - stream_write_uint32(s, 1); /* Version (4 bytes) */ + 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 boolean audin_server_recv_version(audin_server* audin, STREAM* s, uint32 length) +static BOOL audin_server_recv_version(audin_server* audin, STREAM* s, UINT32 length) { - uint32 Version; + UINT32 Version; if (length < 4) - return false; - stream_read_uint32(s, Version); + return FALSE; + stream_read_UINT32(s, Version); if (Version < 1) - return false; + return FALSE; - return true; + return TRUE; } static void audin_server_send_formats(audin_server* audin, STREAM* s) { int i; - uint32 nAvgBytesPerSec; + UINT32 nAvgBytesPerSec; stream_set_pos(s, 0); - stream_write_uint8(s, MSG_SNDIN_FORMATS); - stream_write_uint32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */ - stream_write_uint32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */ + stream_write_BYTE(s, MSG_SNDIN_FORMATS); + stream_write_UINT32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */ + stream_write_UINT32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */ for (i = 0; i < audin->context.num_server_formats; i++) { @@ -102,13 +102,13 @@ static void audin_server_send_formats(audin_server* audin, STREAM* s) audin->context.server_formats[i].nChannels * audin->context.server_formats[i].wBitsPerSample / 8; stream_check_size(s, 18); - stream_write_uint16(s, audin->context.server_formats[i].wFormatTag); - stream_write_uint16(s, audin->context.server_formats[i].nChannels); - stream_write_uint32(s, audin->context.server_formats[i].nSamplesPerSec); - stream_write_uint32(s, nAvgBytesPerSec); - stream_write_uint16(s, audin->context.server_formats[i].nBlockAlign); - stream_write_uint16(s, audin->context.server_formats[i].wBitsPerSample); - stream_write_uint16(s, audin->context.server_formats[i].cbSize); + stream_write_UINT16(s, audin->context.server_formats[i].wFormatTag); + stream_write_UINT16(s, audin->context.server_formats[i].nChannels); + stream_write_UINT32(s, audin->context.server_formats[i].nSamplesPerSec); + stream_write_UINT32(s, nAvgBytesPerSec); + stream_write_UINT16(s, audin->context.server_formats[i].nBlockAlign); + stream_write_UINT16(s, audin->context.server_formats[i].wBitsPerSample); + stream_write_UINT16(s, audin->context.server_formats[i].cbSize); if (audin->context.server_formats[i].cbSize) { stream_check_size(s, audin->context.server_formats[i].cbSize); @@ -120,37 +120,37 @@ 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 boolean audin_server_recv_formats(audin_server* audin, STREAM* s, uint32 length) +static BOOL audin_server_recv_formats(audin_server* audin, STREAM* s, UINT32 length) { int i; if (length < 8) - return false; + return FALSE; - stream_read_uint32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */ - stream_seek_uint32(s); /* cbSizeFormatsPacket (4 bytes) */ + stream_read_UINT32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */ + stream_seek_UINT32(s); /* cbSizeFormatsPacket (4 bytes) */ length -= 8; if (audin->context.num_client_formats <= 0) - return false; + return FALSE; audin->context.client_formats = xzalloc(audin->context.num_client_formats * sizeof(rdpsndFormat)); for (i = 0; i < audin->context.num_client_formats; i++) { if (length < 18) { - xfree(audin->context.client_formats); + free(audin->context.client_formats); audin->context.client_formats = NULL; - return false; + return FALSE; } - stream_read_uint16(s, audin->context.client_formats[i].wFormatTag); - stream_read_uint16(s, audin->context.client_formats[i].nChannels); - stream_read_uint32(s, audin->context.client_formats[i].nSamplesPerSec); - stream_seek_uint32(s); /* nAvgBytesPerSec */ - stream_read_uint16(s, audin->context.client_formats[i].nBlockAlign); - stream_read_uint16(s, audin->context.client_formats[i].wBitsPerSample); - stream_read_uint16(s, audin->context.client_formats[i].cbSize); + stream_read_UINT16(s, audin->context.client_formats[i].wFormatTag); + stream_read_UINT16(s, audin->context.client_formats[i].nChannels); + stream_read_UINT32(s, audin->context.client_formats[i].nSamplesPerSec); + stream_seek_UINT32(s); /* nAvgBytesPerSec */ + stream_read_UINT16(s, audin->context.client_formats[i].nBlockAlign); + stream_read_UINT16(s, audin->context.client_formats[i].wBitsPerSample); + stream_read_UINT16(s, audin->context.client_formats[i].cbSize); if (audin->context.client_formats[i].cbSize > 0) { stream_seek(s, audin->context.client_formats[i].cbSize); @@ -159,7 +159,7 @@ static boolean audin_server_recv_formats(audin_server* audin, STREAM* s, uint32 IFCALL(audin->context.Opening, &audin->context); - return true; + return TRUE; } static void audin_server_send_open(audin_server* audin, STREAM* s) @@ -167,52 +167,52 @@ static void audin_server_send_open(audin_server* audin, STREAM* s) if (audin->context.selected_client_format < 0) return; - audin->opened = true; + audin->opened = TRUE; stream_set_pos(s, 0); - stream_write_uint8(s, MSG_SNDIN_OPEN); - stream_write_uint32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */ - stream_write_uint32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */ + stream_write_BYTE(s, MSG_SNDIN_OPEN); + stream_write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */ + stream_write_UINT32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */ /* * [MS-RDPEAI] 3.2.5.1.6 * The second format specify the format that SHOULD be used to capture data from * the actual audio input device. */ - stream_write_uint16(s, 1); /* wFormatTag = PCM */ - stream_write_uint16(s, 2); /* nChannels */ - stream_write_uint32(s, 44100); /* nSamplesPerSec */ - stream_write_uint32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */ - stream_write_uint16(s, 4); /* nBlockAlign */ - stream_write_uint16(s, 16); /* wBitsPerSample */ - stream_write_uint16(s, 0); /* cbSize */ + stream_write_UINT16(s, 1); /* wFormatTag = PCM */ + stream_write_UINT16(s, 2); /* nChannels */ + stream_write_UINT32(s, 44100); /* nSamplesPerSec */ + stream_write_UINT32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */ + stream_write_UINT16(s, 4); /* nBlockAlign */ + stream_write_UINT16(s, 16); /* wBitsPerSample */ + stream_write_UINT16(s, 0); /* cbSize */ WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), stream_get_length(s), NULL); } -static boolean audin_server_recv_open_reply(audin_server* audin, STREAM* s, uint32 length) +static BOOL audin_server_recv_open_reply(audin_server* audin, STREAM* s, UINT32 length) { - uint32 Result; + UINT32 Result; if (length < 4) - return false; - stream_read_uint32(s, Result); + return FALSE; + stream_read_UINT32(s, Result); IFCALL(audin->context.OpenResult, &audin->context, Result); - return true; + return TRUE; } -static boolean audin_server_recv_data(audin_server* audin, STREAM* s, uint32 length) +static BOOL audin_server_recv_data(audin_server* audin, STREAM* s, UINT32 length) { rdpsndFormat* format; int sbytes_per_sample; int sbytes_per_frame; - uint8* src; + BYTE* src; int size; int frames; if (audin->context.selected_client_format < 0) - return false; + return FALSE; format = &audin->context.client_formats[audin->context.selected_client_format]; @@ -257,7 +257,7 @@ static boolean audin_server_recv_data(audin_server* audin, STREAM* s, uint32 len IFCALL(audin->context.ReceiveSamples, &audin->context, src, frames); - return true; + return TRUE; } static void* audin_server_thread_func(void* arg) @@ -265,13 +265,13 @@ static void* audin_server_thread_func(void* arg) void* fd; STREAM* s; void* buffer; - uint8 MessageId; - boolean ready = false; - uint32 bytes_returned = 0; + 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) + if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE) { fd = *((void**)buffer); WTSFreeMemory(buffer); @@ -285,9 +285,9 @@ static void* audin_server_thread_func(void* arg) if (freerdp_thread_is_stopped(thread)) break; - if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualChannelReady, &buffer, &bytes_returned) == false) + if (WTSVirtualChannelQuery(audin->audin_channel, WTSVirtualChannelReady, &buffer, &bytes_returned) == FALSE) break; - ready = *((boolean*)buffer); + ready = *((BOOL*)buffer); WTSFreeMemory(buffer); if (ready) break; @@ -310,7 +310,7 @@ static void* audin_server_thread_func(void* arg) stream_set_pos(s, 0); if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s), - stream_get_size(s), &bytes_returned) == false) + stream_get_size(s), &bytes_returned) == FALSE) { if (bytes_returned == 0) break; @@ -318,13 +318,13 @@ static void* audin_server_thread_func(void* arg) stream_check_size(s, (int) bytes_returned); if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s), - stream_get_size(s), &bytes_returned) == false) + stream_get_size(s), &bytes_returned) == FALSE) break; } if (bytes_returned < 1) continue; - stream_read_uint8(s, MessageId); + stream_read_BYTE(s, MessageId); bytes_returned--; switch (MessageId) { @@ -366,26 +366,27 @@ static void* audin_server_thread_func(void* arg) return NULL; } -static boolean audin_server_open(audin_server_context* context) +static BOOL audin_server_open(audin_server_context* context) { audin_server* audin = (audin_server*) context; if (audin->audin_channel_thread == NULL) { audin->audin_channel = WTSVirtualChannelOpenEx(context->vcm, "AUDIO_INPUT", WTS_CHANNEL_OPTION_DYNAMIC); + if (audin->audin_channel == NULL) - return false; + return FALSE; audin->audin_channel_thread = freerdp_thread_new(); freerdp_thread_start(audin->audin_channel_thread, audin_server_thread_func, audin); - return true; + return TRUE; } - return false; + return FALSE; } -static boolean audin_server_close(audin_server_context* context) +static BOOL audin_server_close(audin_server_context* context) { audin_server* audin = (audin_server*) context; @@ -402,7 +403,7 @@ static boolean audin_server_close(audin_server_context* context) } audin->context.selected_client_format = -1; - return true; + return TRUE; } audin_server_context* audin_server_context_new(WTSVirtualChannelManager* vcm) @@ -430,6 +431,6 @@ void audin_server_context_free(audin_server_context* context) if (audin->dsp_context) freerdp_dsp_context_free(audin->dsp_context); if (audin->context.client_formats) - xfree(audin->context.client_formats); - xfree(audin); + free(audin->context.client_formats); + free(audin); } diff --git a/channels/client/.gitignore b/channels/client/.gitignore new file mode 100644 index 000000000..aa03c94be --- /dev/null +++ b/channels/client/.gitignore @@ -0,0 +1,2 @@ +tables.c + diff --git a/channels/client/CMakeLists.txt b/channels/client/CMakeLists.txt new file mode 100644 index 000000000..c06d73ae0 --- /dev/null +++ b/channels/client/CMakeLists.txt @@ -0,0 +1,60 @@ +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +set(MODULE_NAME "freerdp-channels-client") +set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT") + +set(${MODULE_PREFIX}_SRCS + tables.c + tables.h + channels.c) + +foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES}) + + set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME}) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME}) + + if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "VirtualChannelEntry") + set(ENTRY_POINT_NAME "${${STATIC_MODULE}_CLIENT_NAME}_${${STATIC_MODULE}_CLIENT_ENTRY}") + set(ENTRY_POINT_IMPORT "extern int ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS pEntryPoints);") + set(VIRTUAL_CHANNEL_ENTRY_IMPORTS "${VIRTUAL_CHANNEL_ENTRY_IMPORTS}\n${ENTRY_POINT_IMPORT}") + set(VIRTUAL_CHANNEL_ENTRY_TABLE "${VIRTUAL_CHANNEL_ENTRY_TABLE}\n\t{ \"${STATIC_MODULE_NAME}\", ${ENTRY_POINT_NAME} },") + endif() + + if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "DeviceServiceEntry") + set(ENTRY_POINT_NAME "${${STATIC_MODULE}_CLIENT_NAME}_${${STATIC_MODULE}_CLIENT_ENTRY}") + set(ENTRY_POINT_IMPORT "extern int ${ENTRY_POINT_NAME}(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);") + set(DEVICE_SERVICE_ENTRY_IMPORTS "${DEVICE_SERVICE_ENTRY_IMPORTS}\n${ENTRY_POINT_IMPORT}") + set(DEVICE_SERVICE_ENTRY_TABLE "${DEVICE_SERVICE_ENTRY_TABLE}\n\t{ \"${STATIC_MODULE_NAME}\", ${ENTRY_POINT_NAME} },") + endif() + +endforeach() + +set(VIRTUAL_CHANNEL_ENTRY_TABLE "${VIRTUAL_CHANNEL_ENTRY_TABLE}\n\t{ \"\", NULL }") +set(DEVICE_SERVICE_ENTRY_TABLE "${DEVICE_SERVICE_ENTRY_TABLE}\n\t{ \"\", NULL }") + +configure_file(tables.c.in tables.c) + +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") + +target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) +install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Client") + diff --git a/channels/client/channels.c b/channels/client/channels.c new file mode 100644 index 000000000..dca5ba2d3 --- /dev/null +++ b/channels/client/channels.c @@ -0,0 +1,84 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Client Channels + * + * Copyright 2012 Marc-Andre Moreau + * + * 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. + */ + +#include "tables.h" + +#include +#include +#include + +#include + +extern const VIRTUAL_CHANNEL_ENTRY VIRTUAL_CHANNEL_TABLE[]; +extern const DEVICE_SERVICE_ENTRY DEVICE_SERVICE_TABLE[]; + +void* freerdp_channels_find_static_virtual_channel_entry(const char* name) +{ + int index = 0; + VIRTUAL_CHANNEL_ENTRY* pEntry; + + pEntry = (VIRTUAL_CHANNEL_ENTRY*) &VIRTUAL_CHANNEL_TABLE[index++]; + + while (pEntry->entry != NULL) + { + if (strcmp(pEntry->name, name) == 0) + { + return (void*) pEntry->entry; + } + + pEntry = (VIRTUAL_CHANNEL_ENTRY*) &VIRTUAL_CHANNEL_TABLE[index++]; + } + + return NULL; +} + +void* freerdp_channels_find_static_device_service_entry(const char* name) +{ + int index = 0; + DEVICE_SERVICE_ENTRY* pEntry; + + pEntry = (DEVICE_SERVICE_ENTRY*) &DEVICE_SERVICE_TABLE[index++]; + + while (pEntry->entry != NULL) + { + if (strcmp(pEntry->name, name) == 0) + { + return (void*) pEntry->entry; + } + + pEntry = (DEVICE_SERVICE_ENTRY*) &DEVICE_SERVICE_TABLE[index++]; + } + + return NULL; +} + +void* freerdp_channels_find_static_entry(const char* name, const char* entry) +{ + if (strcmp(entry, "VirtualChannelEntry") == 0) + { + return freerdp_channels_find_static_virtual_channel_entry(name); + } + else if (strcmp(entry, "DeviceServiceEntry") == 0) + { + return freerdp_channels_find_static_device_service_entry(name); + } + + return NULL; +} + diff --git a/channels/client/tables.c.in b/channels/client/tables.c.in new file mode 100644 index 000000000..087dc827e --- /dev/null +++ b/channels/client/tables.c.in @@ -0,0 +1,31 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Static Entry Point Tables + * + * Copyright 2012 Marc-Andre Moreau + * + * 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. + */ + +#include "tables.h" +${VIRTUAL_CHANNEL_ENTRY_IMPORTS} +${DEVICE_SERVICE_ENTRY_IMPORTS} + +const VIRTUAL_CHANNEL_ENTRY VIRTUAL_CHANNEL_TABLE[] = +{${VIRTUAL_CHANNEL_ENTRY_TABLE} +}; + +const DEVICE_SERVICE_ENTRY DEVICE_SERVICE_TABLE[] = +{${DEVICE_SERVICE_ENTRY_TABLE} +}; + diff --git a/channels/client/tables.h b/channels/client/tables.h new file mode 100644 index 000000000..3851748e4 --- /dev/null +++ b/channels/client/tables.h @@ -0,0 +1,42 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Static Entry Point Tables + * + * Copyright 2012 Marc-Andre Moreau + * + * 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. + */ + +#include + +#ifndef PDEVICE_SERVICE_ENTRY_POINTS +#define PDEVICE_SERVICE_ENTRY_POINTS void* +#endif + +typedef int (*VIRTUAL_CHANNEL_ENTRY_FN)(PCHANNEL_ENTRY_POINTS pEntryPoints); +typedef int (*DEVICE_SERVICE_ENTRY_FN)(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints); + +struct _VIRTUAL_CHANNEL_ENTRY +{ + const char* name; + const VIRTUAL_CHANNEL_ENTRY_FN entry; +}; +typedef struct _VIRTUAL_CHANNEL_ENTRY VIRTUAL_CHANNEL_ENTRY; + +struct _DEVICE_SERVICE_ENTRY +{ + const char* name; + const DEVICE_SERVICE_ENTRY_FN entry; +}; +typedef struct _DEVICE_SERVICE_ENTRY DEVICE_SERVICE_ENTRY; + diff --git a/channels/cliprdr/CMakeLists.txt b/channels/cliprdr/CMakeLists.txt index 676de4e85..f9d3c38e8 100644 --- a/channels/cliprdr/CMakeLists.txt +++ b/channels/cliprdr/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,7 +15,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "cliprdr") +set(MODULE_PREFIX "CHANNEL_CLIPRDR") + if(WITH_CLIENT_CHANNELS) add_subdirectory(client) + if(${MODULE_PREFIX}_CLIENT_STATIC) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE) + endif() endif() diff --git a/channels/cliprdr/client/CMakeLists.txt b/channels/cliprdr/client/CMakeLists.txt index 5c30a67ef..8a617b880 100644 --- a/channels/cliprdr/client/CMakeLists.txt +++ b/channels/cliprdr/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,20 +15,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(CLIPRDR_SRCS +set(MODULE_NAME "cliprdr") +set(MODULE_PREFIX "CHANNEL_CLIPRDR_CLIENT") + +set(${MODULE_PREFIX}_SRCS cliprdr_constants.h cliprdr_format.c cliprdr_format.h cliprdr_main.c cliprdr_main.h) -add_library(cliprdr ${CLIPRDR_SRCS}) -set_target_properties(cliprdr PROPERTIES PREFIX "") +# cliprdr is always built-in -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(cliprdr freerdp) +set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE) +set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE) +set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE) + +add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp winpr) else() - target_link_libraries(cliprdr freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt) endif() -install(TARGETS cliprdr DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/cliprdr/client/cliprdr_constants.h b/channels/cliprdr/client/cliprdr_constants.h index d3544ba32..e3e141986 100644 --- a/channels/cliprdr/client/cliprdr_constants.h +++ b/channels/cliprdr/client/cliprdr_constants.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel * * Copyright 2009-2011 Jay Sorg diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index 1d9b2865b..895d75269 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel * * Copyright 2009-2011 Jay Sorg @@ -25,13 +25,16 @@ #include #include #include + +#include + #include #include #include #include #include #include -#include +#include #include "cliprdr_constants.h" #include "cliprdr_main.h" @@ -86,7 +89,7 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS stream_extend(body, stream_get_size(body) + 4 + name_length); - stream_write_uint32(body, cb_event->formats[i]); + stream_write_UINT32(body, cb_event->formats[i]); stream_write(body, name, name_length); } @@ -106,10 +109,10 @@ static void cliprdr_send_format_list_response(cliprdrPlugin* cliprdr) 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, STREAM* s, UINT32 length, UINT16 flags) { int i; - boolean ascii; + BOOL ascii; int num_formats; CLIPRDR_FORMAT_NAME* format_name; @@ -125,20 +128,20 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3 if (num_formats * 36 != length) DEBUG_WARN("dataLen %d not divided by 36!", length); - ascii = (flags & CB_ASCII_NAMES) ? true : false; + ascii = (flags & CB_ASCII_NAMES) ? TRUE : FALSE; - cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xmalloc(sizeof(CLIPRDR_FORMAT_NAME) * num_formats); + cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * num_formats); cliprdr->num_format_names = num_formats; for (i = 0; i < num_formats; i++) { format_name = &cliprdr->format_names[i]; - stream_read_uint32(s, format_name->id); + stream_read_UINT32(s, format_name->id); if (ascii) { - format_name->name = xstrdup((char*) s->p); + format_name->name = _strdup((char*) s->p); format_name->length = strlen(format_name->name); } else @@ -150,32 +153,32 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3 } } -void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32 length, uint16 flags) +void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT32 length, UINT16 flags) { int allocated_formats = 8; - uint8* end_mark; + BYTE* end_mark; CLIPRDR_FORMAT_NAME* format_name; stream_get_mark(s, end_mark); end_mark += length; - cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xmalloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats); + cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats); cliprdr->num_format_names = 0; while (stream_get_left(s) >= 6) { - uint8* p; + BYTE* p; int name_len; if (cliprdr->num_format_names >= allocated_formats) { allocated_formats *= 2; - cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xrealloc(cliprdr->format_names, + cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) realloc(cliprdr->format_names, sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats); } format_name = &cliprdr->format_names[cliprdr->num_format_names++]; - stream_read_uint32(s, format_name->id); + stream_read_UINT32(s, format_name->id); format_name->name = NULL; format_name->length = 0; @@ -191,11 +194,11 @@ 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, STREAM* s, UINT32 dataLen, UINT16 msgFlags) { int i; - uint32 format; - boolean supported; + UINT32 format; + BOOL supported; CLIPRDR_FORMAT_NAME* format_name; RDP_CB_FORMAT_LIST_EVENT* cb_event; @@ -204,7 +207,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL if (dataLen > 0) { - cb_event->raw_format_data = (uint8*) xmalloc(dataLen); + cb_event->raw_format_data = (BYTE*) malloc(dataLen); memcpy(cb_event->raw_format_data, stream_get_tail(s), dataLen); cb_event->raw_format_data_size = dataLen; } @@ -215,13 +218,13 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL cliprdr_process_short_format_names(cliprdr, s, dataLen, msgFlags); if (cliprdr->num_format_names > 0) - cb_event->formats = (uint32*) xmalloc(sizeof(uint32) * cliprdr->num_format_names); + cb_event->formats = (UINT32*) malloc(sizeof(UINT32) * cliprdr->num_format_names); cb_event->num_formats = 0; for (i = 0; i < cliprdr->num_format_names; i++) { - supported = true; + supported = TRUE; format_name = &cliprdr->format_names[i]; format = format_name->id; @@ -261,7 +264,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL } else { - supported = false; + supported = FALSE; } break; @@ -271,10 +274,10 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL cb_event->formats[cb_event->num_formats++] = format; if (format_name->length > 0) - xfree(format_name->name); + free(format_name->name); } - xfree(cliprdr->format_names); + free(cliprdr->format_names); cliprdr->format_names = NULL; cliprdr->num_format_names = 0; @@ -283,7 +286,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL 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, STREAM* s, UINT32 dataLen, UINT16 msgFlags) { /* where is this documented? */ #if 0 @@ -297,14 +300,14 @@ 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, STREAM* 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); - stream_read_uint32(s, cb_event->format); + stream_read_UINT32(s, cb_event->format); svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (RDP_EVENT*) cb_event); } @@ -334,11 +337,11 @@ void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DA DEBUG_CLIPRDR("Sending Format Data Request"); s = cliprdr_packet_new(CB_FORMAT_DATA_REQUEST, 0, 4); - stream_write_uint32(s, cb_event->format); + stream_write_UINT32(s, cb_event->format); 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, STREAM* s, UINT32 dataLen, UINT16 msgFlags) { RDP_CB_DATA_RESPONSE_EVENT* cb_event; @@ -348,7 +351,7 @@ void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, uin if (dataLen > 0) { cb_event->size = dataLen; - cb_event->data = (uint8*) xmalloc(dataLen); + cb_event->data = (BYTE*) malloc(dataLen); memcpy(cb_event->data, stream_get_tail(s), dataLen); } diff --git a/channels/cliprdr/client/cliprdr_format.h b/channels/cliprdr/client/cliprdr_format.h index 48040b64f..ec6bb343d 100644 --- a/channels/cliprdr/client/cliprdr_format.h +++ b/channels/cliprdr/client/cliprdr_format.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel * * Copyright 2009-2011 Jay Sorg @@ -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, STREAM* s, UINT32 dataLen, UINT16 msgFlags); +void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, STREAM* 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, STREAM* 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, STREAM* s, UINT32 dataLen, UINT16 msgFlags); #endif /* __CLIPRDR_FORMAT_H */ diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index 10eb26c9b..b42338579 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel * * Copyright 2009-2011 Jay Sorg @@ -25,12 +25,15 @@ #include #include #include + +#include + #include #include #include #include #include -#include +#include #include "cliprdr_constants.h" #include "cliprdr_main.h" @@ -52,13 +55,13 @@ static const char* const CB_MSG_TYPE_STRINGS[] = "CB_UNLOCK_CLIPDATA" }; -STREAM* cliprdr_packet_new(uint16 msgType, uint16 msgFlags, uint32 dataLen) +STREAM* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen) { STREAM* s; s = stream_new(dataLen + 8); - stream_write_uint16(s, msgType); - stream_write_uint16(s, msgFlags); + stream_write_UINT16(s, msgType); + stream_write_UINT16(s, msgFlags); /* Write actual length after the entire packet has been constructed. */ stream_seek(s, 4); @@ -68,12 +71,12 @@ STREAM* cliprdr_packet_new(uint16 msgType, uint16 msgFlags, uint32 dataLen) void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* s) { int pos; - uint32 dataLen; + UINT32 dataLen; pos = stream_get_pos(s); dataLen = pos - 8; stream_set_pos(s, 4); - stream_write_uint32(s, dataLen); + stream_write_UINT32(s, dataLen); stream_set_pos(s, pos); svc_plugin_send((rdpSvcPlugin*) cliprdr, s); @@ -84,7 +87,7 @@ static void cliprdr_process_connect(rdpSvcPlugin* plugin) DEBUG_CLIPRDR("connecting"); } -void cliprdr_print_general_capability_flags(uint32 flags) +void cliprdr_print_general_capability_flags(UINT32 flags) { printf("generalFlags (0x%08X) {\n", flags); @@ -102,11 +105,11 @@ void cliprdr_print_general_capability_flags(uint32 flags) static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, STREAM* s) { - uint32 version; - uint32 generalFlags; + UINT32 version; + UINT32 generalFlags; - stream_read_uint32(s, version); /* version (4 bytes) */ - stream_read_uint32(s, generalFlags); /* generalFlags (4 bytes) */ + stream_read_UINT32(s, version); /* version (4 bytes) */ + stream_read_UINT32(s, generalFlags); /* generalFlags (4 bytes) */ DEBUG_CLIPRDR("Version: %d", version); @@ -115,36 +118,36 @@ static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, STREAM* s #endif if (generalFlags & CB_USE_LONG_FORMAT_NAMES) - cliprdr->use_long_format_names = true; + cliprdr->use_long_format_names = TRUE; if (generalFlags & CB_STREAM_FILECLIP_ENABLED) - cliprdr->stream_fileclip_enabled = true; + cliprdr->stream_fileclip_enabled = TRUE; if (generalFlags & CB_FILECLIP_NO_FILE_PATHS) - cliprdr->fileclip_no_file_paths = true; + cliprdr->fileclip_no_file_paths = TRUE; if (generalFlags & CB_CAN_LOCK_CLIPDATA) - cliprdr->can_lock_clipdata = true; + cliprdr->can_lock_clipdata = TRUE; - cliprdr->received_caps = true; + 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, STREAM* s, UINT16 length, UINT16 flags) { int i; - uint16 lengthCapability; - uint16 cCapabilitiesSets; - uint16 capabilitySetType; + UINT16 lengthCapability; + UINT16 cCapabilitiesSets; + UINT16 capabilitySetType; - stream_read_uint16(s, cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */ - stream_seek_uint16(s); /* pad1 (2 bytes) */ + stream_read_UINT16(s, cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */ + stream_seek_UINT16(s); /* pad1 (2 bytes) */ DEBUG_CLIPRDR("cCapabilitiesSets %d", cCapabilitiesSets); for (i = 0; i < cCapabilitiesSets; i++) { - stream_read_uint16(s, capabilitySetType); /* capabilitySetType (2 bytes) */ - stream_read_uint16(s, lengthCapability); /* lengthCapability (2 bytes) */ + stream_read_UINT16(s, capabilitySetType); /* capabilitySetType (2 bytes) */ + stream_read_UINT16(s, lengthCapability); /* lengthCapability (2 bytes) */ switch (capabilitySetType) { @@ -162,7 +165,7 @@ static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, STREAM* s, uint16 static void cliprdr_send_clip_caps(cliprdrPlugin* cliprdr) { STREAM* s; - uint32 flags; + UINT32 flags; s = cliprdr_packet_new(CB_CLIP_CAPS, 0, 4 + CB_CAPSTYPE_GENERAL_LEN); @@ -170,17 +173,17 @@ static void cliprdr_send_clip_caps(cliprdrPlugin* cliprdr) flags = CB_USE_LONG_FORMAT_NAMES; - stream_write_uint16(s, 1); /* cCapabilitiesSets */ - stream_write_uint16(s, 0); /* pad1 */ - stream_write_uint16(s, CB_CAPSTYPE_GENERAL); /* capabilitySetType */ - stream_write_uint16(s, CB_CAPSTYPE_GENERAL_LEN); /* lengthCapability */ - stream_write_uint32(s, CB_CAPS_VERSION_2); /* version */ - stream_write_uint32(s, flags); /* generalFlags */ + stream_write_UINT16(s, 1); /* cCapabilitiesSets */ + stream_write_UINT16(s, 0); /* pad1 */ + stream_write_UINT16(s, CB_CAPSTYPE_GENERAL); /* capabilitySetType */ + stream_write_UINT16(s, CB_CAPSTYPE_GENERAL_LEN); /* lengthCapability */ + stream_write_UINT32(s, CB_CAPS_VERSION_2); /* version */ + stream_write_UINT32(s, flags); /* generalFlags */ 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, STREAM* s, UINT16 length, UINT16 flags) { RDP_EVENT* event; @@ -193,14 +196,14 @@ static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, STREAM* s, uin static void cliprdr_process_receive(rdpSvcPlugin* plugin, STREAM* s) { - uint16 msgType; - uint16 msgFlags; - uint32 dataLen; + UINT16 msgType; + UINT16 msgFlags; + UINT32 dataLen; cliprdrPlugin* cliprdr = (cliprdrPlugin*) plugin; - stream_read_uint16(s, msgType); - stream_read_uint16(s, msgFlags); - stream_read_uint32(s, dataLen); + stream_read_UINT16(s, msgType); + stream_read_UINT16(s, msgFlags); + stream_read_UINT32(s, dataLen); DEBUG_CLIPRDR("msgType: %s (%d), msgFlags: %d dataLen: %d", CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen); @@ -265,9 +268,35 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) static void cliprdr_process_terminate(rdpSvcPlugin* plugin) { - xfree(plugin); + free(plugin); } -DEFINE_SVC_PLUGIN(cliprdr, "cliprdr", - CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | - CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL) +/* cliprdr is always built-in */ +#define VirtualChannelEntry cliprdr_VirtualChannelEntry + +const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) +{ + cliprdrPlugin* _p; + + _p = (cliprdrPlugin*) malloc(sizeof(cliprdrPlugin)); + ZeroMemory(_p, sizeof(cliprdrPlugin)); + + _p->plugin.channel_def.options = + CHANNEL_OPTION_INITIALIZED | + CHANNEL_OPTION_ENCRYPT_RDP | + CHANNEL_OPTION_COMPRESS_RDP | + CHANNEL_OPTION_SHOW_PROTOCOL; + + strcpy(_p->plugin.channel_def.name, "cliprdr"); + + _p->plugin.connect_callback = cliprdr_process_connect; + _p->plugin.receive_callback = cliprdr_process_receive; + _p->plugin.event_callback = cliprdr_process_event; + _p->plugin.terminate_callback = cliprdr_process_terminate; + + svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints); + + return 1; +} + + diff --git a/channels/cliprdr/client/cliprdr_main.h b/channels/cliprdr/client/cliprdr_main.h index bc6b35584..f48a4a742 100644 --- a/channels/cliprdr/client/cliprdr_main.h +++ b/channels/cliprdr/client/cliprdr_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel * * Copyright 2009-2011 Jay Sorg @@ -26,7 +26,7 @@ struct _CLIPRDR_FORMAT_NAME { - uint32 id; + UINT32 id; char* name; int length; }; @@ -35,17 +35,17 @@ typedef struct _CLIPRDR_FORMAT_NAME CLIPRDR_FORMAT_NAME; struct cliprdr_plugin { rdpSvcPlugin plugin; - boolean received_caps; - boolean use_long_format_names; - boolean stream_fileclip_enabled; - boolean fileclip_no_file_paths; - boolean can_lock_clipdata; + BOOL received_caps; + BOOL use_long_format_names; + BOOL stream_fileclip_enabled; + BOOL fileclip_no_file_paths; + BOOL can_lock_clipdata; CLIPRDR_FORMAT_NAME* format_names; int num_format_names; }; typedef struct cliprdr_plugin cliprdrPlugin; -STREAM* cliprdr_packet_new(uint16 msgType, uint16 msgFlags, uint32 dataLen); +STREAM* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen); void cliprdr_packet_send(cliprdrPlugin* cliprdr, STREAM* data_out); #ifdef WITH_DEBUG_CLIPRDR diff --git a/channels/cliprdr/client/module.def b/channels/cliprdr/client/module.def new file mode 100644 index 000000000..7336368ec --- /dev/null +++ b/channels/cliprdr/client/module.def @@ -0,0 +1,3 @@ +LIBRARY "cliprdr" +EXPORTS + VirtualChannelEntry @1 diff --git a/channels/rdpdr/client/parallel/CMakeLists.txt b/channels/disk/CMakeLists.txt similarity index 51% rename from channels/rdpdr/client/parallel/CMakeLists.txt rename to channels/disk/CMakeLists.txt index 024f12995..270a87583 100644 --- a/channels/rdpdr/client/parallel/CMakeLists.txt +++ b/channels/disk/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,19 +15,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(PARALLEL_SRCS - parallel_main.c -) +set(MODULE_NAME "disk") +set(MODULE_PREFIX "CHANNEL_RDPDR_DISK") -include_directories(..) - -add_library(parallel ${PARALLEL_SRCS}) -set_target_properties(parallel PROPERTIES PREFIX "") - -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(parallel freerdp) -else() - target_link_libraries(parallel freerdp-utils) +if(WITH_CLIENT_CHANNELS) + add_subdirectory(client) + if(${MODULE_PREFIX}_CLIENT_STATIC) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE) + endif() endif() -install(TARGETS parallel DESTINATION ${FREERDP_PLUGIN_PATH}) diff --git a/channels/disk/ChannelOptions.cmake b/channels/disk/ChannelOptions.cmake new file mode 100644 index 000000000..9bb8f8f15 --- /dev/null +++ b/channels/disk/ChannelOptions.cmake @@ -0,0 +1,11 @@ + +set(CHANNEL_TYPE "device") +set(CHANNEL_SHORT_NAME "disk") +set(CHANNEL_LONG_NAME "Disk Redirection Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPEFS]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) + +option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) + + diff --git a/channels/rdpdr/client/disk/CMakeLists.txt b/channels/disk/client/CMakeLists.txt similarity index 58% rename from channels/rdpdr/client/disk/CMakeLists.txt rename to channels/disk/client/CMakeLists.txt index eca9ea0bd..c0c58429b 100644 --- a/channels/rdpdr/client/disk/CMakeLists.txt +++ b/channels/disk/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +16,7 @@ # limitations under the License. set(MODULE_NAME "disk") -set(MODULE_PREFIX "CHANNEL_DEVICE_DISK") +set(MODULE_PREFIX "CHANNEL_RDPDR_DISK_CLIENT") set(${MODULE_PREFIX}_SRCS disk_file.c @@ -26,22 +24,38 @@ set(${MODULE_PREFIX}_SRCS disk_main.c) if(WIN32) - set(${MODULE_PREFIX}_SRCS + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} statvfs.c statvfs.h dirent.h) endif() -include_directories(..) +if(MSVC AND (NOT STATIC_CHANNELS)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + +if(NOT STATIC_CHANNELS) + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +else() + set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE) + set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE) + set(${MODULE_PREFIX}_ENTRY "DeviceServiceEntry" PARENT_SCOPE) + + add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) +endif() -add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS freerdp winpr) else() set(${MODULE_PREFIX}_LIBS freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked) endif() target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) + install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") + + diff --git a/channels/rdpdr/client/disk/dirent.h b/channels/disk/client/dirent.h similarity index 99% rename from channels/rdpdr/client/disk/dirent.h rename to channels/disk/client/dirent.h index fa5a294d5..9a293daa1 100644 --- a/channels/rdpdr/client/disk/dirent.h +++ b/channels/disk/client/dirent.h @@ -137,7 +137,7 @@ /* * File type macros. Note that block devices, sockets and links cannot be * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are - * only defined for compatibility. These macros should always return false + * only defined for compatibility. These macros should always return FALSE * on Windows. */ #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO) diff --git a/channels/rdpdr/client/disk/disk_file.c b/channels/disk/client/disk_file.c similarity index 61% rename from channels/rdpdr/client/disk/disk_file.c rename to channels/disk/client/disk_file.c index 0bf28af66..7afa38575 100644 --- a/channels/rdpdr/client/disk/disk_file.c +++ b/channels/disk/client/disk_file.c @@ -1,10 +1,10 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * File System Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau + * Copyright 2010-2012 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee - * Copyright 2012 Gerald Richter + * Copyright 2012 Gerald Richter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,9 +38,12 @@ #include #include +#include + #include #include #include +#include #include #ifdef HAVE_UNISTD_H @@ -50,11 +53,9 @@ #include #endif -#include "rdpdr_constants.h" -#include "rdpdr_types.h" #include "disk_file.h" -static boolean disk_file_wildcard_match(const char* pattern, const char* filename) +static BOOL disk_file_wildcard_match(const char* pattern, const char* filename) { const char *p = pattern, *f = filename; char c; @@ -70,39 +71,49 @@ static boolean disk_file_wildcard_match(const char* pattern, const char* filenam { c = *p++; if (!c) /* shortcut */ - return true; + return TRUE; /* TODO: skip to tail comparison */ } if (c != *f++) - return false; + return FALSE; } if (!*f) - return true; + return TRUE; - return false; + return FALSE; } static void disk_file_fix_path(char* path) { - int len; int i; + int length; - len = strlen(path); - for (i = 0; i < len; i++) + length = strlen(path); + + for (i = 0; i < length; i++) { if (path[i] == '\\') path[i] = '/'; } - if (len > 0 && path[len - 1] == '/') - path[len - 1] = '\0'; + +#ifdef WIN32 + if ((length == 3) && (path[1] == ':') && (path[2] == '/')) + return; +#else + if ((length == 1) && (path[0] == '/')) + return; +#endif + + if ((length > 0) && (path[length - 1] == '/')) + path[length - 1] = '\0'; } static char* disk_file_combine_fullpath(const char* base_path, const char* path) { char* fullpath; - fullpath = xmalloc(strlen(base_path) + strlen(path) + 1); + fullpath = (char*) malloc(strlen(base_path) + strlen(path) + 1); strcpy(fullpath, base_path); strcat(fullpath, path); disk_file_fix_path(fullpath); @@ -110,18 +121,18 @@ static char* disk_file_combine_fullpath(const char* base_path, const char* path) return fullpath; } -static boolean disk_file_remove_dir(const char* path) +static BOOL disk_file_remove_dir(const char* path) { DIR* dir; - struct dirent* pdirent; - struct STAT st; char* p; - boolean ret = true; + struct STAT st; + struct dirent* pdirent; + BOOL ret = TRUE; dir = opendir(path); if (dir == NULL) - return false; + return FALSE; pdirent = readdir(dir); @@ -133,12 +144,13 @@ static boolean disk_file_remove_dir(const char* path) continue; } - p = xmalloc(strlen(path) + strlen(pdirent->d_name) + 2); + p = (char*) malloc(strlen(path) + strlen(pdirent->d_name) + 2); sprintf(p, "%s/%s", path, pdirent->d_name); + if (STAT(p, &st) != 0) { DEBUG_WARN("stat %s failed.", p); - ret = false; + ret = FALSE; } else if (S_ISDIR(st.st_mode)) { @@ -147,11 +159,14 @@ static boolean disk_file_remove_dir(const char* path) else if (unlink(p) < 0) { DEBUG_WARN("unlink %s failed.", p); - ret = false; + ret = FALSE; } else - ret = true; - xfree(p); + { + ret = TRUE; + } + + free(p); if (!ret) break; @@ -160,12 +175,13 @@ static boolean disk_file_remove_dir(const char* path) } closedir(dir); + if (ret) { if (rmdir(path) < 0) { DEBUG_WARN("rmdir %s failed.", path); - ret = false; + ret = FALSE; } } @@ -174,7 +190,7 @@ static boolean disk_file_remove_dir(const char* path) static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath) { - xfree(file->fullpath); + free(file->fullpath); file->fullpath = fullpath; file->filename = strrchr(file->fullpath, '/'); @@ -184,30 +200,30 @@ static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath) file->filename += 1; } -static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions) +static BOOL disk_file_init(DISK_FILE* file, UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions) { struct STAT st; - boolean exists; + BOOL exists; #ifdef WIN32 const static int mode = _S_IREAD | _S_IWRITE ; #else const static int mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH; - boolean largeFile = false; + BOOL largeFile = FALSE; #endif int oflag = 0; if (STAT(file->fullpath, &st) == 0) { - file->is_dir = (S_ISDIR(st.st_mode) ? true : false); + file->is_dir = (S_ISDIR(st.st_mode) ? TRUE : FALSE); #ifndef WIN32 if (st.st_size > (unsigned long)0x07fffffff) - largeFile = true; + largeFile = TRUE; #endif - exists = true; + exists = TRUE; } else { - file->is_dir = ((CreateOptions & FILE_DIRECTORY_FILE) ? true : false); + file->is_dir = ((CreateOptions & FILE_DIRECTORY_FILE) ? TRUE : FALSE); if (file->is_dir) { //Should only create the directory if the disposition allows for it @@ -216,11 +232,11 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea if (mkdir(file->fullpath, mode) != 0) { file->err = errno; - return true; + return TRUE; } } } - exists = false; + exists = FALSE; } if (file->is_dir) @@ -229,7 +245,7 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea if (file->dir == NULL) { file->err = errno; - return true; + return TRUE; } } else @@ -259,7 +275,7 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea if (CreateOptions & FILE_DELETE_ON_CLOSE && DesiredAccess & DELETE) { - file->delete_pending = true; + file->delete_pending = TRUE; } if ((DesiredAccess & GENERIC_ALL) @@ -283,15 +299,15 @@ static boolean disk_file_init(DISK_FILE* file, uint32 DesiredAccess, uint32 Crea if (file->fd == -1) { file->err = errno; - return true; + return TRUE; } } - return true; + return TRUE; } -DISK_FILE* disk_file_new(const char* base_path, const char* path, uint32 id, - uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions) +DISK_FILE* disk_file_new(const char* base_path, const char* path, UINT32 id, + UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions) { DISK_FILE* file; @@ -325,132 +341,132 @@ void disk_file_free(DISK_FILE* file) unlink(file->fullpath); } - xfree(file->pattern); - xfree(file->fullpath); - xfree(file); + free(file->pattern); + free(file->fullpath); + free(file); } -boolean disk_file_seek(DISK_FILE* file, uint64 Offset) +BOOL disk_file_seek(DISK_FILE* file, UINT64 Offset) { if (file->is_dir || file->fd == -1) - return false; + return FALSE; if (LSEEK(file->fd, Offset, SEEK_SET) == (off_t)-1) - return false; + return FALSE; - return true; + return TRUE; } -boolean disk_file_read(DISK_FILE* file, uint8* buffer, uint32* Length) +BOOL disk_file_read(DISK_FILE* file, BYTE* buffer, UINT32* Length) { ssize_t r; if (file->is_dir || file->fd == -1) - return false; + return FALSE; r = read(file->fd, buffer, *Length); if (r < 0) - return false; - *Length = (uint32)r; + return FALSE; + *Length = (UINT32)r; - return true; + return TRUE; } -boolean disk_file_write(DISK_FILE* file, uint8* buffer, uint32 Length) +BOOL disk_file_write(DISK_FILE* file, BYTE* buffer, UINT32 Length) { ssize_t r; if (file->is_dir || file->fd == -1) - return false; + return FALSE; while (Length > 0) { r = write(file->fd, buffer, Length); if (r == -1) - return false; + return FALSE; Length -= r; buffer += r; } - return true; + return TRUE; } -boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass, STREAM* output) +BOOL disk_file_query_information(DISK_FILE* file, UINT32 FsInformationClass, STREAM* output) { struct STAT st; if (STAT(file->fullpath, &st) != 0) { - stream_write_uint32(output, 0); /* Length */ - return false; + stream_write_UINT32(output, 0); /* Length */ + return FALSE; } switch (FsInformationClass) { case FileBasicInformation: /* http://msdn.microsoft.com/en-us/library/cc232094.aspx */ - stream_write_uint32(output, 36); /* Length */ + stream_write_UINT32(output, 36); /* Length */ stream_check_size(output, 36); - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ - stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ + stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ /* Reserved(4), MUST NOT be added! */ break; case FileStandardInformation: /* http://msdn.microsoft.com/en-us/library/cc232088.aspx */ - stream_write_uint32(output, 22); /* Length */ + stream_write_UINT32(output, 22); /* Length */ stream_check_size(output, 22); - stream_write_uint64(output, st.st_size); /* AllocationSize */ - stream_write_uint64(output, st.st_size); /* EndOfFile */ - stream_write_uint32(output, st.st_nlink); /* NumberOfLinks */ - stream_write_uint8(output, file->delete_pending ? 1 : 0); /* DeletePending */ - stream_write_uint8(output, file->is_dir ? 1 : 0); /* Directory */ + stream_write_UINT64(output, st.st_size); /* AllocationSize */ + stream_write_UINT64(output, st.st_size); /* EndOfFile */ + stream_write_UINT32(output, st.st_nlink); /* NumberOfLinks */ + stream_write_BYTE(output, file->delete_pending ? 1 : 0); /* DeletePending */ + stream_write_BYTE(output, file->is_dir ? 1 : 0); /* Directory */ /* Reserved(2), MUST NOT be added! */ break; case FileAttributeTagInformation: /* http://msdn.microsoft.com/en-us/library/cc232093.aspx */ - stream_write_uint32(output, 8); /* Length */ + stream_write_UINT32(output, 8); /* Length */ stream_check_size(output, 8); - stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ - stream_write_uint32(output, 0); /* ReparseTag */ + stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ + stream_write_UINT32(output, 0); /* ReparseTag */ break; default: - stream_write_uint32(output, 0); /* Length */ + stream_write_UINT32(output, 0); /* Length */ DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass); - return false; + return FALSE; } - return true; + return TRUE; } -boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, uint32 Length, STREAM* input) +BOOL disk_file_set_information(DISK_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input) { char* s; mode_t m; - uint64 size; + UINT64 size; char* fullpath; struct STAT st; struct timeval tv[2]; - uint64 LastWriteTime; - uint32 FileAttributes; - uint32 FileNameLength; + UINT64 LastWriteTime; + UINT32 FileAttributes; + UINT32 FileNameLength; switch (FsInformationClass) { case FileBasicInformation: /* http://msdn.microsoft.com/en-us/library/cc232094.aspx */ - stream_seek_uint64(input); /* CreationTime */ - stream_seek_uint64(input); /* LastAccessTime */ - stream_read_uint64(input, LastWriteTime); - stream_seek_uint64(input); /* ChangeTime */ - stream_read_uint32(input, FileAttributes); + stream_seek_UINT64(input); /* CreationTime */ + stream_seek_UINT64(input); /* LastAccessTime */ + stream_read_UINT64(input, LastWriteTime); + stream_seek_UINT64(input); /* ChangeTime */ + stream_read_UINT32(input, FileAttributes); if (FSTAT(file->fd, &st) != 0) - return false; + return FALSE; tv[0].tv_sec = st.st_atime; tv[0].tv_usec = 0; @@ -477,30 +493,30 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui /* http://msdn.microsoft.com/en-us/library/cc232067.aspx */ case FileAllocationInformation: /* http://msdn.microsoft.com/en-us/library/cc232076.aspx */ - stream_read_uint64(input, size); + stream_read_UINT64(input, size); if (ftruncate(file->fd, size) != 0) - return false; + return FALSE; break; case FileDispositionInformation: /* http://msdn.microsoft.com/en-us/library/cc232098.aspx */ /* http://msdn.microsoft.com/en-us/library/cc241371.aspx */ if (Length) - stream_read_uint8(input, file->delete_pending); + stream_read_BYTE(input, file->delete_pending); else file->delete_pending = 1; break; case FileRenameInformation: /* http://msdn.microsoft.com/en-us/library/cc232085.aspx */ - stream_seek_uint8(input); /* ReplaceIfExists */ - stream_seek_uint8(input); /* RootDirectory */ - stream_read_uint32(input, FileNameLength); + stream_seek_BYTE(input); /* ReplaceIfExists */ + stream_seek_BYTE(input); /* RootDirectory */ + stream_read_UINT32(input, FileNameLength); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(input), &s, FileNameLength / 2); fullpath = disk_file_combine_fullpath(file->basepath, s); - xfree(s); + free(s); /* TODO rename does not work on win32 */ if (rename(file->fullpath, fullpath) == 0) @@ -512,24 +528,24 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui { DEBUG_WARN("rename %s to %s failed, errno = %d", file->fullpath, fullpath, errno); free(fullpath); - return false; + return FALSE; } break; default: DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass); - return false; + return FALSE; } - return true; + return TRUE; } -boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, uint8 InitialQuery, +BOOL disk_file_query_directory(DISK_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery, const char* path, STREAM* output) { int length; - boolean ret; + BOOL ret; WCHAR* ent_path; struct STAT st; struct dirent* ent; @@ -538,18 +554,18 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui if (!file->dir) { - stream_write_uint32(output, 0); /* Length */ - stream_write_uint8(output, 0); /* Padding */ - return false; + stream_write_UINT32(output, 0); /* Length */ + stream_write_BYTE(output, 0); /* Padding */ + return FALSE; } if (InitialQuery != 0) { rewinddir(file->dir); - xfree(file->pattern); + free(file->pattern); if (path[0]) - file->pattern = strdup(strrchr(path, '\\') + 1); + file->pattern = _strdup(strrchr(path, '\\') + 1); else file->pattern = NULL; } @@ -575,9 +591,9 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui if (ent == NULL) { DEBUG_SVC(" pattern %s not found.", file->pattern); - stream_write_uint32(output, 0); /* Length */ - stream_write_uint8(output, 0); /* Padding */ - return false; + stream_write_UINT32(output, 0); /* Length */ + stream_write_BYTE(output, 0); /* Padding */ + return FALSE; } memset(&st, 0, sizeof(struct STAT)); @@ -590,65 +606,65 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui } DEBUG_SVC(" pattern %s matched %s", file->pattern, ent_path); - xfree(ent_path); + free(ent_path); length = freerdp_AsciiToUnicodeAlloc(ent->d_name, &ent_path, 0) * 2; - ret = true; + ret = TRUE; switch (FsInformationClass) { case FileDirectoryInformation: /* http://msdn.microsoft.com/en-us/library/cc232097.aspx */ - stream_write_uint32(output, 64 + length); /* Length */ + stream_write_UINT32(output, 64 + length); /* Length */ stream_check_size(output, 64 + length); - stream_write_uint32(output, 0); /* NextEntryOffset */ - stream_write_uint32(output, 0); /* FileIndex */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ - stream_write_uint64(output, st.st_size); /* EndOfFile */ - stream_write_uint64(output, st.st_size); /* AllocationSize */ - stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ - stream_write_uint32(output, length); /* FileNameLength */ + stream_write_UINT32(output, 0); /* NextEntryOffset */ + stream_write_UINT32(output, 0); /* FileIndex */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ + stream_write_UINT64(output, st.st_size); /* EndOfFile */ + stream_write_UINT64(output, st.st_size); /* AllocationSize */ + stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ + stream_write_UINT32(output, length); /* FileNameLength */ stream_write(output, ent_path, length); break; case FileFullDirectoryInformation: /* http://msdn.microsoft.com/en-us/library/cc232068.aspx */ - stream_write_uint32(output, 68 + length); /* Length */ + stream_write_UINT32(output, 68 + length); /* Length */ stream_check_size(output, 68 + length); - stream_write_uint32(output, 0); /* NextEntryOffset */ - stream_write_uint32(output, 0); /* FileIndex */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ - stream_write_uint64(output, st.st_size); /* EndOfFile */ - stream_write_uint64(output, st.st_size); /* AllocationSize */ - stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ - stream_write_uint32(output, length); /* FileNameLength */ - stream_write_uint32(output, 0); /* EaSize */ + stream_write_UINT32(output, 0); /* NextEntryOffset */ + stream_write_UINT32(output, 0); /* FileIndex */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ + stream_write_UINT64(output, st.st_size); /* EndOfFile */ + stream_write_UINT64(output, st.st_size); /* AllocationSize */ + stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ + stream_write_UINT32(output, length); /* FileNameLength */ + stream_write_UINT32(output, 0); /* EaSize */ stream_write(output, ent_path, length); break; case FileBothDirectoryInformation: /* http://msdn.microsoft.com/en-us/library/cc232095.aspx */ - stream_write_uint32(output, 93 + length); /* Length */ + stream_write_UINT32(output, 93 + length); /* Length */ stream_check_size(output, 93 + length); - stream_write_uint32(output, 0); /* NextEntryOffset */ - stream_write_uint32(output, 0); /* FileIndex */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ - stream_write_uint64(output, st.st_size); /* EndOfFile */ - stream_write_uint64(output, st.st_size); /* AllocationSize */ - stream_write_uint32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ - stream_write_uint32(output, length); /* FileNameLength */ - stream_write_uint32(output, 0); /* EaSize */ - stream_write_uint8(output, 0); /* ShortNameLength */ + stream_write_UINT32(output, 0); /* NextEntryOffset */ + stream_write_UINT32(output, 0); /* FileIndex */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */ + stream_write_UINT64(output, st.st_size); /* EndOfFile */ + stream_write_UINT64(output, st.st_size); /* AllocationSize */ + stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */ + stream_write_UINT32(output, length); /* FileNameLength */ + stream_write_UINT32(output, 0); /* EaSize */ + stream_write_BYTE(output, 0); /* ShortNameLength */ /* Reserved(1), MUST NOT be added! */ stream_write_zero(output, 24); /* ShortName */ stream_write(output, ent_path, length); @@ -656,23 +672,23 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui case FileNamesInformation: /* http://msdn.microsoft.com/en-us/library/cc232077.aspx */ - stream_write_uint32(output, 12 + length); /* Length */ + stream_write_UINT32(output, 12 + length); /* Length */ stream_check_size(output, 12 + length); - stream_write_uint32(output, 0); /* NextEntryOffset */ - stream_write_uint32(output, 0); /* FileIndex */ - stream_write_uint32(output, length); /* FileNameLength */ + stream_write_UINT32(output, 0); /* NextEntryOffset */ + stream_write_UINT32(output, 0); /* FileIndex */ + stream_write_UINT32(output, length); /* FileNameLength */ stream_write(output, ent_path, length); break; default: - stream_write_uint32(output, 0); /* Length */ - stream_write_uint8(output, 0); /* Padding */ + stream_write_UINT32(output, 0); /* Length */ + stream_write_BYTE(output, 0); /* Padding */ DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass); - ret = false; + ret = FALSE; break; } - xfree(ent_path); + free(ent_path); return ret; } diff --git a/channels/rdpdr/client/disk/disk_file.h b/channels/disk/client/disk_file.h similarity index 70% rename from channels/rdpdr/client/disk/disk_file.h rename to channels/disk/client/disk_file.h index ba55f3c7c..60147fc9b 100644 --- a/channels/rdpdr/client/disk/disk_file.h +++ b/channels/disk/client/disk_file.h @@ -1,10 +1,10 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * File System Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau + * Copyright 2010-2012 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee - * Copyright 2012 Gerald Richter + * Copyright 2012 Gerald Richter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,8 +49,8 @@ #define unlink(a) _unlink(a) #define ftruncate(a,b) _chsize(a,b) -typedef uint32 ssize_t ; -typedef uint32 mode_t ; +typedef UINT32 ssize_t ; +typedef UINT32 mode_t ; #elif defined(__APPLE__) || defined(__FreeBSD__) #define STAT stat @@ -70,9 +70,9 @@ typedef uint32 mode_t ; #define EPOCH_DIFF 11644473600LL #define FILE_TIME_SYSTEM_TO_RDP(_t) \ - (((uint64)(_t) + EPOCH_DIFF) * 10000000LL) + (((UINT64)(_t) + EPOCH_DIFF) * 10000000LL) #define FILE_TIME_RDP_TO_SYSTEM(_t) \ - (((_t) == 0LL || (_t) == (uint64)(-1LL)) ? 0 : (time_t)((_t) / 10000000LL - EPOCH_DIFF)) + (((_t) == 0LL || (_t) == (UINT64)(-1LL)) ? 0 : (time_t)((_t) / 10000000LL - EPOCH_DIFF)) #define FILE_ATTR_SYSTEM_TO_RDP(_f, _st) ( \ (S_ISDIR(_st.st_mode) ? FILE_ATTRIBUTE_DIRECTORY : 0) | \ @@ -83,8 +83,8 @@ typedef uint32 mode_t ; typedef struct _DISK_FILE DISK_FILE; struct _DISK_FILE { - uint32 id; - boolean is_dir; + UINT32 id; + BOOL is_dir; int fd; int err; DIR* dir; @@ -92,19 +92,19 @@ struct _DISK_FILE char* fullpath; char* filename; char* pattern; - boolean delete_pending; + BOOL delete_pending; }; -DISK_FILE* disk_file_new(const char* base_path, const char* path, uint32 id, - uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions); +DISK_FILE* disk_file_new(const char* base_path, const char* path, UINT32 id, + UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions); void disk_file_free(DISK_FILE* file); -boolean disk_file_seek(DISK_FILE* file, uint64 Offset); -boolean disk_file_read(DISK_FILE* file, uint8* buffer, uint32* Length); -boolean disk_file_write(DISK_FILE* file, uint8* buffer, uint32 Length); -boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass, STREAM* output); -boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, uint32 Length, STREAM* input); -boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, uint8 InitialQuery, +BOOL disk_file_seek(DISK_FILE* file, UINT64 Offset); +BOOL disk_file_read(DISK_FILE* file, BYTE* buffer, UINT32* Length); +BOOL disk_file_write(DISK_FILE* file, BYTE* buffer, UINT32 Length); +BOOL disk_file_query_information(DISK_FILE* file, UINT32 FsInformationClass, STREAM* output); +BOOL disk_file_set_information(DISK_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input); +BOOL disk_file_query_directory(DISK_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery, const char* path, STREAM* output); #endif /* __DISK_FILE_H */ diff --git a/channels/rdpdr/client/disk/disk_main.c b/channels/disk/client/disk_main.c similarity index 79% rename from channels/rdpdr/client/disk/disk_main.c rename to channels/disk/client/disk_main.c index 8e28df4c0..e721f67ae 100644 --- a/channels/rdpdr/client/disk/disk_main.c +++ b/channels/disk/client/disk_main.c @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * File System Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -46,8 +47,6 @@ #include #include -#include "rdpdr_constants.h" -#include "rdpdr_types.h" #include "disk_file.h" typedef struct _DISK_DEVICE DISK_DEVICE; @@ -67,9 +66,9 @@ struct _DISK_DEVICE DEVMAN* devman; }; -static uint32 disk_map_posix_err(int fs_errno) +static UINT32 disk_map_posix_err(int fs_errno) { - uint32 rc; + UINT32 rc; /* try to return NTSTATUS version of error code */ @@ -102,7 +101,7 @@ static uint32 disk_map_posix_err(int fs_errno) return rc; } -static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, uint32 id) +static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, UINT32 id) { LIST_ITEM* item; DISK_FILE* file; @@ -120,20 +119,20 @@ static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, uint32 id) static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp) { - DISK_FILE* file; - uint32 DesiredAccess; - uint32 CreateDisposition; - uint32 CreateOptions; - uint32 PathLength; char* path; - uint32 FileId; - uint8 Information; + UINT32 FileId; + DISK_FILE* file; + BYTE Information; + UINT32 DesiredAccess; + UINT32 CreateDisposition; + UINT32 CreateOptions; + UINT32 PathLength; - stream_read_uint32(irp->input, DesiredAccess); + stream_read_UINT32(irp->input, DesiredAccess); stream_seek(irp->input, 16); /* AllocationSize(8), FileAttributes(4), SharedAccess(4) */ - stream_read_uint32(irp->input, CreateDisposition); - stream_read_uint32(irp->input, CreateOptions); - stream_read_uint32(irp->input, PathLength); + stream_read_UINT32(irp->input, CreateDisposition); + stream_read_UINT32(irp->input, CreateOptions); + stream_read_UINT32(irp->input, PathLength); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2); @@ -155,7 +154,7 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp) FileId = 0; Information = 0; - /* map errno to windows result*/ + /* map errno to windows result */ irp->IoStatus = disk_map_posix_err(file->err); disk_file_free(file); } @@ -184,10 +183,10 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp) DEBUG_SVC("%s(%d) created.", file->fullpath, file->id); } - stream_write_uint32(irp->output, FileId); - stream_write_uint8(irp->output, Information); + stream_write_UINT32(irp->output, FileId); + stream_write_BYTE(irp->output, Information); - xfree(path); + free(path); irp->Complete(irp); } @@ -220,12 +219,12 @@ static void disk_process_irp_close(DISK_DEVICE* disk, IRP* irp) static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp) { DISK_FILE* file; - uint32 Length; - uint64 Offset; - uint8* buffer = NULL; + UINT32 Length; + UINT64 Offset; + BYTE* buffer = NULL; - stream_read_uint32(irp->input, Length); - stream_read_uint64(irp->input, Offset); + stream_read_UINT32(irp->input, Length); + stream_read_UINT64(irp->input, Offset); file = disk_get_file_by_id(disk, irp->FileId); @@ -245,11 +244,11 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp) } else { - buffer = (uint8*) xmalloc(Length); + buffer = (BYTE*) malloc(Length); if (!disk_file_read(file, buffer, &Length)) { irp->IoStatus = STATUS_UNSUCCESSFUL; - xfree(buffer); + free(buffer); buffer = NULL; Length = 0; @@ -261,7 +260,7 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp) } } - stream_write_uint32(irp->output, Length); + stream_write_UINT32(irp->output, Length); if (Length > 0) { @@ -269,7 +268,7 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp) stream_write(irp->output, buffer, Length); } - xfree(buffer); + free(buffer); irp->Complete(irp); } @@ -277,11 +276,11 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp) static void disk_process_irp_write(DISK_DEVICE* disk, IRP* irp) { DISK_FILE* file; - uint32 Length; - uint64 Offset; + UINT32 Length; + UINT64 Offset; - stream_read_uint32(irp->input, Length); - stream_read_uint64(irp->input, Offset); + stream_read_UINT32(irp->input, Length); + stream_read_UINT64(irp->input, Offset); stream_seek(irp->input, 20); /* Padding */ file = disk_get_file_by_id(disk, irp->FileId); @@ -312,8 +311,8 @@ static void disk_process_irp_write(DISK_DEVICE* disk, IRP* irp) DEBUG_SVC("write %llu-%llu to %s(%d).", Offset, Offset + Length, file->fullpath, file->id); } - stream_write_uint32(irp->output, Length); - stream_write_uint8(irp->output, 0); /* Padding */ + stream_write_UINT32(irp->output, Length); + stream_write_BYTE(irp->output, 0); /* Padding */ irp->Complete(irp); } @@ -321,9 +320,9 @@ static void disk_process_irp_write(DISK_DEVICE* disk, IRP* irp) static void disk_process_irp_query_information(DISK_DEVICE* disk, IRP* irp) { DISK_FILE* file; - uint32 FsInformationClass; + UINT32 FsInformationClass; - stream_read_uint32(irp->input, FsInformationClass); + stream_read_UINT32(irp->input, FsInformationClass); file = disk_get_file_by_id(disk, irp->FileId); @@ -350,11 +349,11 @@ static void disk_process_irp_query_information(DISK_DEVICE* disk, IRP* irp) static void disk_process_irp_set_information(DISK_DEVICE* disk, IRP* irp) { DISK_FILE* file; - uint32 FsInformationClass; - uint32 Length; + UINT32 FsInformationClass; + UINT32 Length; - stream_read_uint32(irp->input, FsInformationClass); - stream_read_uint32(irp->input, Length); + stream_read_UINT32(irp->input, FsInformationClass); + stream_read_UINT32(irp->input, Length); stream_seek(irp->input, 24); /* Padding */ file = disk_get_file_by_id(disk, irp->FileId); @@ -376,14 +375,14 @@ static void disk_process_irp_set_information(DISK_DEVICE* disk, IRP* irp) DEBUG_SVC("FsInformationClass %d on %s(%d) ok.", FsInformationClass, file->fullpath, file->id); } - stream_write_uint32(irp->output, Length); + stream_write_UINT32(irp->output, Length); irp->Complete(irp); } static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* irp) { - uint32 FsInformationClass; + UINT32 FsInformationClass; STREAM* output = irp->output; struct STATVFS svfst; struct STAT st; @@ -392,7 +391,7 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir WCHAR* outStr; int length; - stream_read_uint32(irp->input, FsInformationClass); + stream_read_UINT32(irp->input, FsInformationClass); STATVFS(disk->path, &svfst); STAT(disk->path, &st); @@ -402,64 +401,64 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir case FileFsVolumeInformation: /* http://msdn.microsoft.com/en-us/library/cc232108.aspx */ length = freerdp_AsciiToUnicodeAlloc(volumeLabel, &outStr, 0) * 2; - stream_write_uint32(output, 17 + length); /* Length */ + stream_write_UINT32(output, 17 + length); /* Length */ stream_check_size(output, 17 + length); - stream_write_uint64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* VolumeCreationTime */ - stream_write_uint32(output, svfst.f_fsid); /* VolumeSerialNumber */ - stream_write_uint32(output, length); /* VolumeLabelLength */ - stream_write_uint8(output, 0); /* SupportsObjects */ + stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* VolumeCreationTime */ + stream_write_UINT32(output, svfst.f_fsid); /* VolumeSerialNumber */ + stream_write_UINT32(output, length); /* VolumeLabelLength */ + stream_write_BYTE(output, 0); /* SupportsObjects */ /* Reserved(1), MUST NOT be added! */ stream_write(output, outStr, length); /* VolumeLabel (Unicode) */ - xfree(outStr); + free(outStr); break; case FileFsSizeInformation: /* http://msdn.microsoft.com/en-us/library/cc232107.aspx */ - stream_write_uint32(output, 24); /* Length */ + stream_write_UINT32(output, 24); /* Length */ stream_check_size(output, 24); - stream_write_uint64(output, svfst.f_blocks); /* TotalAllocationUnits */ - stream_write_uint64(output, svfst.f_bavail); /* AvailableAllocationUnits */ - stream_write_uint32(output, 1); /* SectorsPerAllocationUnit */ - stream_write_uint32(output, svfst.f_bsize); /* BytesPerSector */ + stream_write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */ + stream_write_UINT64(output, svfst.f_bavail); /* AvailableAllocationUnits */ + stream_write_UINT32(output, 1); /* SectorsPerAllocationUnit */ + stream_write_UINT32(output, svfst.f_bsize); /* BytesPerSector */ break; case FileFsAttributeInformation: /* http://msdn.microsoft.com/en-us/library/cc232101.aspx */ length = freerdp_AsciiToUnicodeAlloc(diskType, &outStr, 0) * 2; - stream_write_uint32(output, 12 + length); /* Length */ + stream_write_UINT32(output, 12 + length); /* Length */ stream_check_size(output, 12 + length); - stream_write_uint32(output, + stream_write_UINT32(output, FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK); /* FileSystemAttributes */ - stream_write_uint32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */ - stream_write_uint32(output, length); /* FileSystemNameLength */ + stream_write_UINT32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */ + stream_write_UINT32(output, length); /* FileSystemNameLength */ stream_write(output, outStr, length); /* FileSystemName (Unicode) */ - xfree(outStr); + free(outStr); break; case FileFsFullSizeInformation: /* http://msdn.microsoft.com/en-us/library/cc232104.aspx */ - stream_write_uint32(output, 32); /* Length */ + stream_write_UINT32(output, 32); /* Length */ stream_check_size(output, 32); - stream_write_uint64(output, svfst.f_blocks); /* TotalAllocationUnits */ - stream_write_uint64(output, svfst.f_bavail); /* CallerAvailableAllocationUnits */ - stream_write_uint64(output, svfst.f_bfree); /* AvailableAllocationUnits */ - stream_write_uint32(output, 1); /* SectorsPerAllocationUnit */ - stream_write_uint32(output, svfst.f_bsize); /* BytesPerSector */ + stream_write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */ + stream_write_UINT64(output, svfst.f_bavail); /* CallerAvailableAllocationUnits */ + stream_write_UINT64(output, svfst.f_bfree); /* AvailableAllocationUnits */ + stream_write_UINT32(output, 1); /* SectorsPerAllocationUnit */ + stream_write_UINT32(output, svfst.f_bsize); /* BytesPerSector */ break; case FileFsDeviceInformation: /* http://msdn.microsoft.com/en-us/library/cc232109.aspx */ - stream_write_uint32(output, 8); /* Length */ + stream_write_UINT32(output, 8); /* Length */ stream_check_size(output, 8); - stream_write_uint32(output, FILE_DEVICE_DISK); /* DeviceType */ - stream_write_uint32(output, 0); /* Characteristics */ + stream_write_UINT32(output, FILE_DEVICE_DISK); /* DeviceType */ + stream_write_UINT32(output, 0); /* Characteristics */ break; default: irp->IoStatus = STATUS_UNSUCCESSFUL; - stream_write_uint32(output, 0); /* Length */ + stream_write_UINT32(output, 0); /* Length */ DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass); break; } @@ -471,13 +470,13 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp) { char* path; DISK_FILE* file; - uint8 InitialQuery; - uint32 PathLength; - uint32 FsInformationClass; + BYTE InitialQuery; + UINT32 PathLength; + UINT32 FsInformationClass; - stream_read_uint32(irp->input, FsInformationClass); - stream_read_uint8(irp->input, InitialQuery); - stream_read_uint32(irp->input, PathLength); + stream_read_UINT32(irp->input, FsInformationClass); + stream_read_BYTE(irp->input, InitialQuery); + stream_read_UINT32(irp->input, PathLength); stream_seek(irp->input, 23); /* Padding */ freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2); @@ -487,7 +486,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp) if (file == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; - stream_write_uint32(irp->output, 0); /* Length */ + stream_write_UINT32(irp->output, 0); /* Length */ DEBUG_WARN("FileId %d not valid.", irp->FileId); } else if (!disk_file_query_directory(file, FsInformationClass, InitialQuery, path, irp->output)) @@ -495,7 +494,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp) irp->IoStatus = STATUS_NO_MORE_FILES; } - xfree(path); + free(path); irp->Complete(irp); } @@ -515,7 +514,7 @@ static void disk_process_irp_directory_control(DISK_DEVICE* disk, IRP* irp) default: DEBUG_WARN("MinorFunction 0x%X not supported", irp->MinorFunction); irp->IoStatus = STATUS_NOT_SUPPORTED; - stream_write_uint32(irp->output, 0); /* Length */ + stream_write_UINT32(irp->output, 0); /* Length */ irp->Complete(irp); break; } @@ -523,12 +522,14 @@ static void disk_process_irp_directory_control(DISK_DEVICE* disk, IRP* irp) static void disk_process_irp_device_control(DISK_DEVICE* disk, IRP* irp) { - stream_write_uint32(irp->output, 0); /* OutputBufferLength */ + stream_write_UINT32(irp->output, 0); /* OutputBufferLength */ irp->Complete(irp); } static void disk_process_irp(DISK_DEVICE* disk, IRP* irp) { + irp->IoStatus = STATUS_SUCCESS; + switch (irp->MajorFunction) { case IRP_MJ_CREATE: @@ -639,7 +640,7 @@ static void disk_free(DEVICE* device) disk_file_free(file); list_free(disk->files); - xfree(disk); + free(disk); } void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* name, char* path) @@ -674,7 +675,7 @@ void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* na disk->device.data = stream_new(length + 1); for (i = 0; i <= length; i++) - stream_write_uint8(disk->device.data, name[i] < 0 ? '_' : name[i]); + stream_write_BYTE(disk->device.data, name[i] < 0 ? '_' : name[i]); disk->path = path; disk->files = list_new(); @@ -692,11 +693,11 @@ void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* na } } -#ifdef WITH_STATIC_PLUGINS -int disk_entry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) -#else -int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) +#ifdef STATIC_CHANNELS +#define DeviceServiceEntry disk_DeviceServiceEntry #endif + +const int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) { char* name; char* path; @@ -717,7 +718,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) if( path[0] == '%' ) { _snprintf(buf, sizeof(buf), "%s\\", getenv("USERPROFILE")); - disk_register_disk_path(pEntryPoints, name, xstrdup(buf)); + disk_register_disk_path(pEntryPoints, name, _strdup(buf)); } else if( path[0] == '*' ) { @@ -737,7 +738,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) buf[len + 1] = dev[0]; buf[len + 2] = 0; buf[len + 3] = 0; - disk_register_disk_path(pEntryPoints, xstrdup(buf), xstrdup(dev)); + disk_register_disk_path(pEntryPoints, _strdup(buf), _strdup(dev)); } } } diff --git a/channels/disk/client/module.def b/channels/disk/client/module.def new file mode 100644 index 000000000..dd2815569 --- /dev/null +++ b/channels/disk/client/module.def @@ -0,0 +1,3 @@ +LIBRARY "disk" +EXPORTS + DeviceServiceEntry @1 diff --git a/channels/rdpdr/client/disk/statvfs.c b/channels/disk/client/statvfs.c similarity index 97% rename from channels/rdpdr/client/disk/statvfs.c rename to channels/disk/client/statvfs.c index 6ab29c4ea..19004b4e2 100644 --- a/channels/rdpdr/client/disk/statvfs.c +++ b/channels/disk/client/statvfs.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * statvfs emulation für windows * * Copyright 2012 Gerald Richter diff --git a/channels/rdpdr/client/disk/statvfs.h b/channels/disk/client/statvfs.h similarity index 96% rename from channels/rdpdr/client/disk/statvfs.h rename to channels/disk/client/statvfs.h index a38dc71dc..6912c29a4 100644 --- a/channels/rdpdr/client/disk/statvfs.h +++ b/channels/disk/client/statvfs.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * statvfs emulation for windows * * Copyright 2012 Gerald Richter diff --git a/channels/drdynvc/CMakeLists.txt b/channels/drdynvc/CMakeLists.txt index 676de4e85..873fd5e11 100644 --- a/channels/drdynvc/CMakeLists.txt +++ b/channels/drdynvc/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,7 +15,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "drdynvc") +set(MODULE_PREFIX "CHANNEL_DRDYNVC") + if(WITH_CLIENT_CHANNELS) add_subdirectory(client) + if(${MODULE_PREFIX}_CLIENT_STATIC) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE) + endif() endif() diff --git a/channels/drdynvc/client/CMakeLists.txt b/channels/drdynvc/client/CMakeLists.txt index 42f8bf1d2..914c71fa3 100644 --- a/channels/drdynvc/client/CMakeLists.txt +++ b/channels/drdynvc/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,22 +15,31 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(DRDYNVC_SRCS +set(MODULE_NAME "drdynvc") +set(MODULE_PREFIX "CHANNEL_DRDYNVC_CLIENT") + +set(${MODULE_PREFIX}_SRCS drdynvc_main.c drdynvc_main.h drdynvc_types.h dvcman.c - dvcman.h -) + dvcman.h) -add_library(drdynvc ${DRDYNVC_SRCS}) -set_target_properties(drdynvc PROPERTIES PREFIX "") +# drdynvc is always built-in -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(drdynvc freerdp winpr) +set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE) +set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE) +set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE) + +add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp winpr) else() - target_link_libraries(drdynvc freerdp-utils winpr-synch) + target_link_libraries(${MODULE_NAME} freerdp-utils winpr-synch) endif() -install(TARGETS drdynvc DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 801cc9c33..3f581159d 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -25,6 +25,8 @@ #include #include +#include + #include #include #include @@ -55,35 +57,35 @@ struct drdynvc_plugin IWTSVirtualChannelManager* channel_mgr; }; -static int drdynvc_write_variable_uint(STREAM* stream, uint32 val) +static int drdynvc_write_variable_uint(STREAM* stream, UINT32 val) { int cb; if (val <= 0xFF) { cb = 0; - stream_write_uint8(stream, val); + stream_write_BYTE(stream, val); } else if (val <= 0xFFFF) { cb = 1; - stream_write_uint16(stream, val); + stream_write_UINT16(stream, val); } else { cb = 2; - stream_write_uint32(stream, val); + stream_write_UINT32(stream, val); } return cb; } -int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, uint32 data_size) +int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UINT32 data_size) { STREAM* data_out; - uint32 pos = 0; - uint32 cbChId; - uint32 cbLen; - uint32 chunk_len; + UINT32 pos = 0; + UINT32 cbChId; + UINT32 cbLen; + UINT32 chunk_len; int error; DEBUG_DVC("ChannelId=%d size=%d", ChannelId, data_size); @@ -99,7 +101,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui { pos = stream_get_pos(data_out); stream_set_pos(data_out, 0); - stream_write_uint8(data_out, 0x40 | cbChId); + stream_write_BYTE(data_out, 0x40 | cbChId); stream_set_pos(data_out, pos); error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out); } @@ -107,7 +109,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui { pos = stream_get_pos(data_out); stream_set_pos(data_out, 0); - stream_write_uint8(data_out, 0x30 | cbChId); + stream_write_BYTE(data_out, 0x30 | cbChId); stream_set_pos(data_out, pos); stream_write(data_out, data, data_size); error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out); @@ -118,7 +120,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui cbLen = drdynvc_write_variable_uint(data_out, data_size); pos = stream_get_pos(data_out); stream_set_pos(data_out, 0); - stream_write_uint8(data_out, 0x20 | cbChId | (cbLen << 2)); + stream_write_BYTE(data_out, 0x20 | cbChId | (cbLen << 2)); stream_set_pos(data_out, pos); chunk_len = CHANNEL_CHUNK_LENGTH - pos; stream_write(data_out, data, chunk_len); @@ -134,7 +136,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, uint32 ChannelId, uint8* data, ui pos = stream_get_pos(data_out); stream_set_pos(data_out, 0); - stream_write_uint8(data_out, 0x30 | cbChId); + stream_write_BYTE(data_out, 0x30 | cbChId); stream_set_pos(data_out, pos); chunk_len = data_size; @@ -175,17 +177,17 @@ static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, in DEBUG_DVC("Sp=%d cbChId=%d", Sp, cbChId); stream_seek(s, 1); /* pad */ - stream_read_uint16(s, drdynvc->version); + stream_read_UINT16(s, drdynvc->version); if (drdynvc->version == 2) { - stream_read_uint16(s, drdynvc->PriorityCharge0); - stream_read_uint16(s, drdynvc->PriorityCharge1); - stream_read_uint16(s, drdynvc->PriorityCharge2); - stream_read_uint16(s, drdynvc->PriorityCharge3); + stream_read_UINT16(s, drdynvc->PriorityCharge0); + stream_read_UINT16(s, drdynvc->PriorityCharge1); + stream_read_UINT16(s, drdynvc->PriorityCharge2); + stream_read_UINT16(s, drdynvc->PriorityCharge3); } data_out = stream_new(4); - stream_write_uint16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */ - stream_write_uint16(data_out, drdynvc->version); + stream_write_UINT16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */ + stream_write_UINT16(data_out, drdynvc->version); error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out); if (error != CHANNEL_RC_OK) { @@ -197,20 +199,20 @@ 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(STREAM* stream, int cbLen) { - uint32 val; + UINT32 val; switch (cbLen) { case 0: - stream_read_uint8(stream, val); + stream_read_BYTE(stream, val); break; case 1: - stream_read_uint16(stream, val); + stream_read_UINT16(stream, val); break; default: - stream_read_uint32(stream, val); + stream_read_UINT32(stream, val); break; } return val; @@ -221,7 +223,7 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb STREAM* data_out; int pos; int error; - uint32 ChannelId; + UINT32 ChannelId; ChannelId = drdynvc_read_variable_uint(s, cbChId); pos = stream_get_pos(s); @@ -230,19 +232,19 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb error = dvcman_create_channel(drdynvc->channel_mgr, ChannelId, (char*)stream_get_tail(s)); data_out = stream_new(pos + 4); - stream_write_uint8(data_out, 0x10 | cbChId); + stream_write_BYTE(data_out, 0x10 | cbChId); stream_set_pos(s, 1); stream_copy(data_out, s, pos - 1); if (error == 0) { DEBUG_DVC("channel created"); - stream_write_uint32(data_out, 0); + stream_write_UINT32(data_out, 0); } else { DEBUG_DVC("no listener"); - stream_write_uint32(data_out, (uint32)(-1)); + stream_write_UINT32(data_out, (UINT32)(-1)); } error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out); @@ -256,8 +258,8 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s) { - uint32 ChannelId; - uint32 Length; + UINT32 ChannelId; + UINT32 Length; int error; ChannelId = drdynvc_read_variable_uint(s, cbChId); @@ -274,7 +276,7 @@ static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s) { - uint32 ChannelId; + UINT32 ChannelId; ChannelId = drdynvc_read_variable_uint(s, cbChId); DEBUG_DVC("ChannelId=%d", ChannelId); @@ -285,7 +287,7 @@ static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, STRE static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbChId, STREAM* s) { - uint32 ChannelId; + UINT32 ChannelId; ChannelId = drdynvc_read_variable_uint(s, cbChId); DEBUG_DVC("ChannelId=%d", ChannelId); @@ -302,7 +304,7 @@ static void drdynvc_process_receive(rdpSvcPlugin* plugin, STREAM* s) int Sp; int cbChId; - stream_read_uint8(s, value); + stream_read_BYTE(s, value); Cmd = (value & 0xf0) >> 4; Sp = (value & 0x0c) >> 2; cbChId = (value & 0x03) >> 0; @@ -359,9 +361,34 @@ static void drdynvc_process_terminate(rdpSvcPlugin* plugin) if (drdynvc->channel_mgr != NULL) dvcman_free(drdynvc->channel_mgr); - xfree(drdynvc); + + free(drdynvc); +} + +/* drdynvc is always built-in */ +#define VirtualChannelEntry drdynvc_VirtualChannelEntry + +const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) +{ + drdynvcPlugin* _p; + + _p = (drdynvcPlugin*) malloc(sizeof(drdynvcPlugin)); + ZeroMemory(_p, sizeof(drdynvcPlugin)); + + _p->plugin.channel_def.options = + CHANNEL_OPTION_INITIALIZED | + CHANNEL_OPTION_ENCRYPT_RDP | + CHANNEL_OPTION_COMPRESS_RDP; + + strcpy(_p->plugin.channel_def.name, "drdynvc"); + + _p->plugin.connect_callback = drdynvc_process_connect; + _p->plugin.receive_callback = drdynvc_process_receive; + _p->plugin.event_callback = drdynvc_process_event; + _p->plugin.terminate_callback = drdynvc_process_terminate; + + svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints); + + return 1; } -DEFINE_SVC_PLUGIN(drdynvc, "drdynvc", - CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | - CHANNEL_OPTION_COMPRESS_RDP) diff --git a/channels/drdynvc/client/drdynvc_main.h b/channels/drdynvc/client/drdynvc_main.h index 519c61d19..3cfdcd6d3 100644 --- a/channels/drdynvc/client/drdynvc_main.h +++ b/channels/drdynvc/client/drdynvc_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -24,7 +24,7 @@ typedef struct drdynvc_plugin drdynvcPlugin; -int drdynvc_write_data(drdynvcPlugin* plugin, uint32 ChannelId, uint8* data, uint32 data_size); +int drdynvc_write_data(drdynvcPlugin* plugin, UINT32 ChannelId, BYTE* data, UINT32 data_size); int drdynvc_push_event(drdynvcPlugin* plugin, RDP_EVENT* event); #endif diff --git a/channels/drdynvc/client/drdynvc_types.h b/channels/drdynvc/client/drdynvc_types.h index 5c9ce5947..b7b629dcc 100644 --- a/channels/drdynvc/client/drdynvc_types.h +++ b/channels/drdynvc/client/drdynvc_types.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel * * Copyright 2010-2011 Vic Lee diff --git a/channels/drdynvc/client/dvcman.c b/channels/drdynvc/client/dvcman.c index 1e55c028f..6db0744fa 100644 --- a/channels/drdynvc/client/dvcman.c +++ b/channels/drdynvc/client/dvcman.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel Manager * * Copyright 2010-2011 Vic Lee @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -61,7 +62,7 @@ struct _DVCMAN_LISTENER DVCMAN* dvcman; char* channel_name; - uint32 flags; + UINT32 flags; IWTSListenerCallback* listener_callback; }; @@ -81,7 +82,7 @@ struct _DVCMAN_CHANNEL DVCMAN* dvcman; DVCMAN_CHANNEL* next; - uint32 channel_id; + UINT32 channel_id; IWTSVirtualChannelCallback* channel_callback; STREAM* dvc_data; @@ -96,7 +97,7 @@ static int dvcman_get_configuration(IWTSListener* pListener, void** ppPropertyBa } static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr, - const char* pszChannelName, uint32 ulFlags, + const char* pszChannelName, UINT32 ulFlags, IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener) { DVCMAN* dvcman = (DVCMAN*)pChannelMgr; @@ -108,7 +109,7 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr, listener = xnew(DVCMAN_LISTENER); listener->iface.GetConfiguration = dvcman_get_configuration; listener->dvcman = dvcman; - listener->channel_name = xstrdup(pszChannelName); + listener->channel_name = _strdup(pszChannelName); listener->flags = ulFlags; listener->listener_callback = pListenerCallback; @@ -185,12 +186,12 @@ RDP_PLUGIN_DATA* dvcman_get_plugin_data(IDRDYNVC_ENTRY_POINTS* pEntryPoints) return ((DVCMAN_ENTRY_POINTS*) pEntryPoints)->plugin_data; } -uint32 dvcman_get_channel_id(IWTSVirtualChannel * channel) +UINT32 dvcman_get_channel_id(IWTSVirtualChannel * channel) { return ((DVCMAN_CHANNEL*)channel)->channel_id; } -IWTSVirtualChannel* dvcman_find_channel_by_id(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId) +IWTSVirtualChannel* dvcman_find_channel_by_id(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId) { LIST_ITEM* curr; DVCMAN* dvcman = (DVCMAN*) pChannelMgr; @@ -240,7 +241,7 @@ int dvcman_load_plugin(IWTSVirtualChannelManager* pChannelMgr, RDP_PLUGIN_DATA* pDVCPluginEntry((IDRDYNVC_ENTRY_POINTS*) &entryPoints); } - data = (RDP_PLUGIN_DATA*)(((uint8*) data) + data->size); + data = (RDP_PLUGIN_DATA*)(((BYTE*) data) + data->size); } return 0; @@ -251,7 +252,7 @@ static void dvcman_channel_free(DVCMAN_CHANNEL* channel) if (channel->channel_callback) channel->channel_callback->OnClose(channel->channel_callback); - xfree(channel); + free(channel); } void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) @@ -270,8 +271,8 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) for (i = 0; i < dvcman->num_listeners; i++) { listener = (DVCMAN_LISTENER*) dvcman->listeners[i]; - xfree(listener->channel_name); - xfree(listener); + free(listener->channel_name); + free(listener); } for (i = 0; i < dvcman->num_plugins; i++) @@ -282,7 +283,7 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) pPlugin->Terminated(pPlugin); } - xfree(dvcman); + free(dvcman); } int dvcman_init(IWTSVirtualChannelManager* pChannelMgr) @@ -302,7 +303,7 @@ int dvcman_init(IWTSVirtualChannelManager* pChannelMgr) return 0; } -static int dvcman_write_channel(IWTSVirtualChannel* pChannel, uint32 cbSize, uint8* pBuffer, void* pReserved) +static int dvcman_write_channel(IWTSVirtualChannel* pChannel, UINT32 cbSize, BYTE* pBuffer, void* pReserved) { int status; DVCMAN_CHANNEL* channel = (DVCMAN_CHANNEL*) pChannel; @@ -329,7 +330,7 @@ static int dvcman_close_channel_iface(IWTSVirtualChannel* pChannel) return 1; } -int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, const char* ChannelName) +int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, const char* ChannelName) { int i; int bAccept; @@ -377,7 +378,7 @@ int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 Channel } -int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId) +int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId) { DVCMAN_CHANNEL* channel; IWTSVirtualChannel* ichannel; @@ -403,7 +404,7 @@ int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelI return 0; } -int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint32 length) +int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, UINT32 length) { DVCMAN_CHANNEL* channel; @@ -423,7 +424,7 @@ int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, ui return 0; } -int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint8* data, uint32 data_size) +int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, BYTE* data, UINT32 data_size) { int error = 0; DVCMAN_CHANNEL* channel; @@ -439,7 +440,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 C if (channel->dvc_data) { /* Fragmented data */ - if (stream_get_length(channel->dvc_data) + data_size > (uint32) stream_get_size(channel->dvc_data)) + if (stream_get_length(channel->dvc_data) + data_size > (UINT32) stream_get_size(channel->dvc_data)) { DEBUG_WARN("data exceeding declared length!"); stream_free(channel->dvc_data); diff --git a/channels/drdynvc/client/dvcman.h b/channels/drdynvc/client/dvcman.h index 0e0bb9ce2..479434187 100644 --- a/channels/drdynvc/client/dvcman.h +++ b/channels/drdynvc/client/dvcman.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel Manager * * Copyright 2010-2011 Vic Lee @@ -27,10 +27,10 @@ IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin); int dvcman_load_plugin(IWTSVirtualChannelManager* pChannelMgr, RDP_PLUGIN_DATA* data); void dvcman_free(IWTSVirtualChannelManager* pChannelMgr); int dvcman_init(IWTSVirtualChannelManager* pChannelMgr); -int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, const char* ChannelName); -int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId); -int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint32 length); -int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId, uint8* data, uint32 data_size); +int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, const char* ChannelName); +int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId); +int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, UINT32 length); +int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId, BYTE* data, UINT32 data_size); #endif diff --git a/channels/parallel/CMakeLists.txt b/channels/parallel/CMakeLists.txt new file mode 100644 index 000000000..65f8452a1 --- /dev/null +++ b/channels/parallel/CMakeLists.txt @@ -0,0 +1,21 @@ +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +if(WITH_CLIENT_CHANNELS) + add_subdirectory(client) +endif() + diff --git a/channels/parallel/ChannelOptions.cmake b/channels/parallel/ChannelOptions.cmake new file mode 100644 index 000000000..3f6e7abaf --- /dev/null +++ b/channels/parallel/ChannelOptions.cmake @@ -0,0 +1,14 @@ + +set(CHANNEL_TYPE "device") +set(CHANNEL_SHORT_NAME "parallel") +set(CHANNEL_LONG_NAME "Parallel Port Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPESP]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) + +if(WIN32) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +else() + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +endif() + diff --git a/channels/parallel/client/CMakeLists.txt b/channels/parallel/client/CMakeLists.txt new file mode 100644 index 000000000..064c23b4c --- /dev/null +++ b/channels/parallel/client/CMakeLists.txt @@ -0,0 +1,36 @@ +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +set(MODULE_NAME "parallel") +set(MODULE_PREFIX "CHANNEL_RDPDR_PARALLEL_CLIENT") + +set(${MODULE_PREFIX}_SRCS + parallel_main.c) + +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp) +else() + target_link_libraries(${MODULE_NAME} freerdp-utils winpr-interlocked) +endif() + +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rdpdr/client/parallel/parallel_main.c b/channels/parallel/client/parallel_main.c similarity index 88% rename from channels/rdpdr/client/parallel/parallel_main.c rename to channels/parallel/client/parallel_main.c index d6c0cdb01..a8ddab6e0 100644 --- a/channels/rdpdr/client/parallel/parallel_main.c +++ b/channels/parallel/client/parallel_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Redirected Parallel Port Device Service * * Copyright 2010 O.S. Systems Software Ltda. @@ -57,9 +57,7 @@ #include #include #include - -#include "rdpdr_constants.h" -#include "rdpdr_types.h" +#include struct _PARALLEL_DEVICE { @@ -67,7 +65,7 @@ struct _PARALLEL_DEVICE int file; char* path; - uint32 id; + UINT32 id; PSLIST_HEADER pIrpList; freerdp_thread* thread; @@ -77,12 +75,12 @@ typedef struct _PARALLEL_DEVICE PARALLEL_DEVICE; static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp) { char* path; - uint32 PathLength; + UINT32 PathLength; stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */ /* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */ - stream_read_uint32(irp->input, PathLength); + stream_read_UINT32(irp->input, PathLength); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2); @@ -105,10 +103,10 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp) DEBUG_SVC("%s(%d) created", parallel->path, parallel->file); } - stream_write_uint32(irp->output, parallel->id); - stream_write_uint8(irp->output, 0); + stream_write_UINT32(irp->output, parallel->id); + stream_write_BYTE(irp->output, 0); - xfree(path); + free(path); irp->Complete(irp); } @@ -127,22 +125,22 @@ static void parallel_process_irp_close(PARALLEL_DEVICE* parallel, IRP* irp) static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp) { - uint32 Length; - uint64 Offset; + UINT32 Length; + UINT64 Offset; ssize_t status; - uint8* buffer = NULL; + BYTE* buffer = NULL; - stream_read_uint32(irp->input, Length); - stream_read_uint64(irp->input, Offset); + stream_read_UINT32(irp->input, Length); + stream_read_UINT64(irp->input, Offset); - buffer = (uint8*) xmalloc(Length); + buffer = (BYTE*) malloc(Length); status = read(parallel->file, irp->output->p, Length); if (status < 0) { irp->IoStatus = STATUS_UNSUCCESSFUL; - xfree(buffer); + free(buffer); buffer = NULL; Length = 0; @@ -153,26 +151,26 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp) DEBUG_SVC("read %llu-%llu from %d", Offset, Offset + Length, parallel->id); } - stream_write_uint32(irp->output, Length); + stream_write_UINT32(irp->output, Length); if (Length > 0) { stream_check_size(irp->output, Length); stream_write(irp->output, buffer, Length); } - xfree(buffer); + free(buffer); irp->Complete(irp); } static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp) { - uint32 Length; - uint64 Offset; + UINT32 Length; + UINT64 Offset; ssize_t status; - uint32 len; + UINT32 len; - stream_read_uint32(irp->input, Length); - stream_read_uint64(irp->input, Offset); + stream_read_UINT32(irp->input, Length); + stream_read_UINT64(irp->input, Offset); stream_seek(irp->input, 20); /* Padding */ DEBUG_SVC("Length %u Offset %llu", Length, Offset); @@ -196,8 +194,8 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp) len -= status; } - stream_write_uint32(irp->output, Length); - stream_write_uint8(irp->output, 0); /* Padding */ + stream_write_UINT32(irp->output, Length); + stream_write_BYTE(irp->output, 0); /* Padding */ irp->Complete(irp); } @@ -205,7 +203,7 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp) static void parallel_process_irp_device_control(PARALLEL_DEVICE* parallel, IRP* irp) { DEBUG_SVC("in"); - stream_write_uint32(irp->output, 0); /* OutputBufferLength */ + stream_write_UINT32(irp->output, 0); /* OutputBufferLength */ irp->Complete(irp); } @@ -306,7 +304,7 @@ static void parallel_free(DEVICE* device) _aligned_free(parallel->pIrpList); - xfree(parallel); + free(parallel); } int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) @@ -332,7 +330,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) parallel->device.data = stream_new(length + 1); for (i = 0; i <= length; i++) - stream_write_uint8(parallel->device.data, name[i] < 0 ? '_' : name[i]); + stream_write_BYTE(parallel->device.data, name[i] < 0 ? '_' : name[i]); parallel->path = path; diff --git a/channels/printer/CMakeLists.txt b/channels/printer/CMakeLists.txt new file mode 100644 index 000000000..65f8452a1 --- /dev/null +++ b/channels/printer/CMakeLists.txt @@ -0,0 +1,21 @@ +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +if(WITH_CLIENT_CHANNELS) + add_subdirectory(client) +endif() + diff --git a/channels/printer/ChannelOptions.cmake b/channels/printer/ChannelOptions.cmake new file mode 100644 index 000000000..16db8e2a2 --- /dev/null +++ b/channels/printer/ChannelOptions.cmake @@ -0,0 +1,16 @@ + +set(CHANNEL_TYPE "device") +set(CHANNEL_SHORT_NAME "printer") +set(CHANNEL_LONG_NAME "Print Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPEPC]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) + +if(WIN32) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +elseif(WITH_CUPS) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +else() + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +endif() + diff --git a/channels/rdpdr/client/printer/CMakeLists.txt b/channels/printer/client/CMakeLists.txt similarity index 50% rename from channels/rdpdr/client/printer/CMakeLists.txt rename to channels/printer/client/CMakeLists.txt index 8dbfc7bac..34779d8df 100644 --- a/channels/rdpdr/client/printer/CMakeLists.txt +++ b/channels/printer/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,13 +15,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(PRINTER_SRCS +set(MODULE_NAME "printer") +set(MODULE_PREFIX "CHANNEL_RDPDR_PRINTER_CLIENT") + +set(${MODULE_PREFIX}_SRCS printer_main.c printer_main.h) if(WITH_CUPS) - set(PRINTER_SRCS - ${PRINTER_SRCS} + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} printer_cups.c printer_cups.h) @@ -32,25 +32,25 @@ if(WITH_CUPS) endif() if(WIN32) - set(PRINTER_SRCS - ${PRINTER_SRCS} + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} printer_win.c printer_win.h) endif() -include_directories(..) +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -add_library(printer ${PRINTER_SRCS}) -set_target_properties(printer PROPERTIES PREFIX "") +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(printer freerdp winpr) +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp winpr) else() - target_link_libraries(printer freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked) + target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked) endif() if(WITH_CUPS) - target_link_libraries(printer ${CUPS_LIBRARIES}) + target_link_libraries(${MODULE_NAME} ${CUPS_LIBRARIES}) endif() -install(TARGETS printer DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rdpdr/client/printer/printer_cups.c b/channels/printer/client/printer_cups.c similarity index 92% rename from channels/rdpdr/client/printer/printer_cups.c rename to channels/printer/client/printer_cups.c index 84d0a2ce8..08c9f1483 100644 --- a/channels/rdpdr/client/printer/printer_cups.c +++ b/channels/printer/client/printer_cups.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Print Virtual Channel - CUPS driver * * Copyright 2010-2011 Vic Lee @@ -29,11 +29,12 @@ #include #include +#include + #include #include +#include -#include "rdpdr_constants.h" -#include "rdpdr_types.h" #include "printer_main.h" #include "printer_cups.h" @@ -76,7 +77,7 @@ static void printer_cups_get_printjob_name(char* buf, int size) t->tm_hour, t->tm_min, t->tm_sec); } -static void printer_cups_write_printjob(rdpPrintJob* printjob, uint8* data, int size) +static void printer_cups_write_printjob(rdpPrintJob* printjob, BYTE* data, int size) { rdpCupsPrintJob* cups_printjob = (rdpCupsPrintJob*)printjob; @@ -120,7 +121,7 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob) DEBUG_WARN("cupsPrintFile: %s", cupsLastErrorString()); } unlink(cups_printjob->printjob_object); - xfree(cups_printjob->printjob_object); + free(cups_printjob->printjob_object); } #else @@ -132,10 +133,10 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob) #endif ((rdpCupsPrinter*)printjob->printer)->printjob = NULL; - xfree(cups_printjob) ; + free(cups_printjob) ; } -static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id) +static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, UINT32 id) { rdpCupsPrinter* cups_printer = (rdpCupsPrinter*)printer; rdpCupsPrintJob* cups_printjob; @@ -153,7 +154,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id) #ifndef _CUPS_API_1_4 - cups_printjob->printjob_object = xstrdup(tmpnam(NULL)); + cups_printjob->printjob_object = _strdup(tmpnam(NULL)); #else { @@ -163,7 +164,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id) if (cups_printjob->printjob_object == NULL) { DEBUG_WARN("httpConnectEncrypt: %s", cupsLastErrorString()); - xfree(cups_printjob); + free(cups_printjob); return NULL; } @@ -175,7 +176,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id) { DEBUG_WARN("cupsCreateJob: %s", cupsLastErrorString()); httpClose((http_t*)cups_printjob->printjob_object); - xfree(cups_printjob); + free(cups_printjob); return NULL; } cupsStartDocument((http_t*)cups_printjob->printjob_object, @@ -190,7 +191,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id) return (rdpPrintJob*)cups_printjob; } -static rdpPrintJob* printer_cups_find_printjob(rdpPrinter* printer, uint32 id) +static rdpPrintJob* printer_cups_find_printjob(rdpPrinter* printer, UINT32 id) { rdpCupsPrinter* cups_printer = (rdpCupsPrinter*)printer; @@ -208,18 +209,18 @@ static void printer_cups_free_printer(rdpPrinter* printer) if (cups_printer->printjob) cups_printer->printjob->printjob.Close((rdpPrintJob*)cups_printer->printjob); - xfree(printer->name); - xfree(printer); + free(printer->name); + free(printer); } -static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, const char* name, boolean is_default) +static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, const char* name, BOOL is_default) { rdpCupsPrinter* cups_printer; cups_printer = xnew(rdpCupsPrinter); cups_printer->printer.id = cups_driver->id_sequence++; - cups_printer->printer.name = xstrdup(name); + cups_printer->printer.name = _strdup(name); /* This is a generic PostScript printer driver developed by MS, so it should be good in most cases */ cups_printer->printer.driver = "MS Publisher Imagesetter"; cups_printer->printer.is_default = is_default; @@ -260,7 +261,7 @@ static rdpPrinter* printer_cups_get_printer(rdpPrinterDriver* driver, const char { rdpCupsPrinterDriver* cups_driver = (rdpCupsPrinterDriver*)driver; - return printer_cups_new_printer(cups_driver, name, cups_driver->id_sequence == 1 ? true : false); + return printer_cups_new_printer(cups_driver, name, cups_driver->id_sequence == 1 ? TRUE : FALSE); } static rdpCupsPrinterDriver* cups_driver = NULL; diff --git a/channels/rdpdr/client/printer/printer_cups.h b/channels/printer/client/printer_cups.h similarity index 93% rename from channels/rdpdr/client/printer/printer_cups.h rename to channels/printer/client/printer_cups.h index c6e1ff51a..434d64aba 100644 --- a/channels/rdpdr/client/printer/printer_cups.h +++ b/channels/printer/client/printer_cups.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Print Virtual Channel - CUPS driver * * Copyright 2010-2011 Vic Lee diff --git a/channels/rdpdr/client/printer/printer_main.c b/channels/printer/client/printer_main.c similarity index 86% rename from channels/rdpdr/client/printer/printer_main.c rename to channels/printer/client/printer_main.c index bd4368a83..da235cefd 100644 --- a/channels/rdpdr/client/printer/printer_main.c +++ b/channels/printer/client/printer_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Print Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -35,9 +35,7 @@ #include #include #include - -#include "rdpdr_constants.h" -#include "rdpdr_types.h" +#include #ifdef WITH_CUPS #include "printer_cups.h" @@ -69,13 +67,13 @@ static void printer_process_irp_create(PRINTER_DEVICE* printer_dev, IRP* irp) if (printjob != NULL) { - stream_write_uint32(irp->output, printjob->id); /* FileId */ + stream_write_UINT32(irp->output, printjob->id); /* FileId */ DEBUG_SVC("printjob id: %d", printjob->id); } else { - stream_write_uint32(irp->output, 0); /* FileId */ + stream_write_UINT32(irp->output, 0); /* FileId */ irp->IoStatus = STATUS_PRINT_QUEUE_FULL; DEBUG_WARN("error creating print job."); @@ -111,12 +109,12 @@ static void printer_process_irp_close(PRINTER_DEVICE* printer_dev, IRP* irp) static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp) { - uint32 Length; - uint64 Offset; + UINT32 Length; + UINT64 Offset; rdpPrintJob* printjob = NULL; - stream_read_uint32(irp->input, Length); - stream_read_uint64(irp->input, Offset); + stream_read_UINT32(irp->input, Length); + stream_read_UINT64(irp->input, Offset); stream_seek(irp->input, 20); /* Padding */ if (printer_dev->printer != NULL) @@ -136,8 +134,8 @@ static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp) DEBUG_SVC("printjob id %d written %d bytes.", irp->FileId, Length); } - stream_write_uint32(irp->output, Length); - stream_write_uint8(irp->output, 0); /* Padding */ + stream_write_UINT32(irp->output, Length); + stream_write_BYTE(irp->output, 0); /* Padding */ irp->Complete(irp); } @@ -229,24 +227,24 @@ static void printer_free(DEVICE* device) if (printer_dev->printer) printer_dev->printer->Free(printer_dev->printer); - xfree(printer_dev->device.name); + free(printer_dev->device.name); - xfree(printer_dev); + free(printer_dev); } void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* printer) { char* port; - uint32 Flags; + UINT32 Flags; int DriverNameLen; WCHAR* DriverName; int PrintNameLen; WCHAR* PrintName; - uint32 CachedFieldsLen; - uint8* CachedPrinterConfigData; + UINT32 CachedFieldsLen; + BYTE* CachedPrinterConfigData; PRINTER_DEVICE* printer_dev; - port = xmalloc(10); + port = malloc(10); snprintf(port, 10, "PRN%d", printer->id); printer_dev = xnew(PRINTER_DEVICE); @@ -273,24 +271,24 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri printer_dev->device.data = stream_new(28 + DriverNameLen + PrintNameLen + CachedFieldsLen); - stream_write_uint32(printer_dev->device.data, Flags); - stream_write_uint32(printer_dev->device.data, 0); /* CodePage, reserved */ - stream_write_uint32(printer_dev->device.data, 0); /* PnPNameLen */ - stream_write_uint32(printer_dev->device.data, DriverNameLen + 2); - stream_write_uint32(printer_dev->device.data, PrintNameLen + 2); - stream_write_uint32(printer_dev->device.data, CachedFieldsLen); + stream_write_UINT32(printer_dev->device.data, Flags); + stream_write_UINT32(printer_dev->device.data, 0); /* CodePage, reserved */ + stream_write_UINT32(printer_dev->device.data, 0); /* PnPNameLen */ + stream_write_UINT32(printer_dev->device.data, DriverNameLen + 2); + stream_write_UINT32(printer_dev->device.data, PrintNameLen + 2); + stream_write_UINT32(printer_dev->device.data, CachedFieldsLen); stream_write(printer_dev->device.data, DriverName, DriverNameLen); - stream_write_uint16(printer_dev->device.data, 0); + stream_write_UINT16(printer_dev->device.data, 0); stream_write(printer_dev->device.data, PrintName, PrintNameLen); - stream_write_uint16(printer_dev->device.data, 0); + stream_write_UINT16(printer_dev->device.data, 0); if (CachedFieldsLen > 0) { stream_write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen); } - xfree(DriverName); - xfree(PrintName); + free(DriverName); + free(PrintName); printer_dev->pIrpList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT); InitializeSListHead(printer_dev->pIrpList); @@ -302,7 +300,7 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri freerdp_thread_start(printer_dev->thread, printer_thread_func, printer_dev); } -#ifdef WITH_STATIC_PLUGINS +#ifdef STATIC_CHANNELS int printer_entry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) #else int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) @@ -356,7 +354,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) printer_register(pEntryPoints, printer); } - xfree(printers); + free(printers); } return 0; diff --git a/channels/rdpdr/client/printer/printer_main.h b/channels/printer/client/printer_main.h similarity index 85% rename from channels/rdpdr/client/printer/printer_main.h rename to channels/printer/client/printer_main.h index 256c4a77d..55df7309b 100644 --- a/channels/rdpdr/client/printer/printer_main.h +++ b/channels/printer/client/printer_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Print Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -20,7 +20,7 @@ #ifndef __PRINTER_MAIN_H #define __PRINTER_MAIN_H -#include "rdpdr_types.h" +#include /* SERVER_PRINTER_CACHE_EVENT.cachedata */ #define RDPDR_ADD_PRINTER_EVENT 0x00000001 @@ -48,8 +48,8 @@ struct rdp_printer_driver pcGetPrinter GetPrinter; }; -typedef rdpPrintJob* (*pcCreatePrintJob) (rdpPrinter* printer, uint32 id); -typedef rdpPrintJob* (*pcFindPrintJob) (rdpPrinter* printer, uint32 id); +typedef rdpPrintJob* (*pcCreatePrintJob) (rdpPrinter* printer, UINT32 id); +typedef rdpPrintJob* (*pcFindPrintJob) (rdpPrinter* printer, UINT32 id); typedef void (*pcFreePrinter) (rdpPrinter* printer); struct rdp_printer @@ -57,19 +57,19 @@ struct rdp_printer int id; char* name; char* driver; - boolean is_default; + BOOL is_default; pcCreatePrintJob CreatePrintJob; pcFindPrintJob FindPrintJob; pcFreePrinter Free; }; -typedef void (*pcWritePrintJob) (rdpPrintJob* printjob, uint8* data, int size); +typedef void (*pcWritePrintJob) (rdpPrintJob* printjob, BYTE* data, int size); typedef void (*pcClosePrintJob) (rdpPrintJob* printjob); struct rdp_print_job { - uint32 id; + UINT32 id; rdpPrinter* printer; pcWritePrintJob Write; diff --git a/channels/rdpdr/client/printer/printer_win.c b/channels/printer/client/printer_win.c similarity index 93% rename from channels/rdpdr/client/printer/printer_win.c rename to channels/printer/client/printer_win.c index 6b00704b4..787de648c 100644 --- a/channels/rdpdr/client/printer/printer_win.c +++ b/channels/printer/client/printer_win.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Print Virtual Channel - WIN driver * * Copyright 2012 Gerald Richter @@ -17,18 +17,22 @@ * limitations under the License. */ -#include -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include #include #include #include -#include +#include -#include "config.h" #include #include -#include "rdpdr_types.h" #include "printer_main.h" #include "printer_win.h" @@ -78,7 +82,7 @@ static void printer_win_get_printjob_name(char* buf, int size) } -static void printer_win_write_printjob(rdpPrintJob* printjob, uint8* data, int size) +static void printer_win_write_printjob(rdpPrintJob* printjob, BYTE* data, int size) { rdpWinPrintJob* win_printjob = (rdpWinPrintJob*)printjob; @@ -104,10 +108,10 @@ static void printer_win_close_printjob(rdpPrintJob* printjob) DEBUG_WINPR("ClosePrinter failed");; ((rdpWinPrinter*)printjob->printer)->printjob = NULL; - xfree(win_printjob) ; + free(win_printjob) ; } -static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, uint32 id) +static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, UINT32 id) { rdpWinPrinter* win_printer = (rdpWinPrinter*)printer; rdpWinPrintJob* win_printjob; @@ -141,7 +145,7 @@ static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, uint32 id) return (rdpPrintJob*)win_printjob; } -static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, uint32 id) +static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, UINT32 id) { rdpWinPrinter* win_printer = (rdpWinPrinter*)printer; @@ -163,11 +167,11 @@ static void printer_win_free_printer(rdpPrinter* printer) if (win_printer->printjob) win_printer->printjob->printjob.Close((rdpPrintJob*)win_printer->printjob); - xfree(printer->name); - xfree(printer); + free(printer->name); + free(printer); } -static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, const char* name, const wchar_t* drivername, boolean is_default) +static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, const char* name, const wchar_t* drivername, BOOL is_default) { rdpWinPrinter* win_printer; wchar_t wname[256]; @@ -179,7 +183,7 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, cons win_printer = xnew(rdpWinPrinter); win_printer->printer.id = win_driver->id_sequence++; - win_printer->printer.name = xstrdup(name); + win_printer->printer.name = _strdup(name); win_printer->printer.is_default = is_default; win_printer->printer.CreatePrintJob = printer_win_create_printjob; @@ -194,7 +198,7 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, cons prninfo = (PRINTER_INFO_2*) GlobalAlloc(GPTR,needed); GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, needed, &needed); - win_printer->printer.driver = xmalloc(1000); + win_printer->printer.driver = malloc(1000); wcstombs_s(&charsConverted, win_printer->printer.driver, 1000, prninfo->pDriverName, _TRUNCATE); return (rdpPrinter*)win_printer; @@ -251,7 +255,7 @@ static rdpPrinter* printer_win_get_printer(rdpPrinterDriver* driver, const char* DEBUG_WINPR("printer %s", name); - myPrinter = printer_win_new_printer(win_driver, name, L"", win_driver->id_sequence == 1 ? true : false); + myPrinter = printer_win_new_printer(win_driver, name, L"", win_driver->id_sequence == 1 ? TRUE : FALSE); return myPrinter; } diff --git a/channels/rdpdr/client/printer/printer_win.h b/channels/printer/client/printer_win.h similarity index 94% rename from channels/rdpdr/client/printer/printer_win.h rename to channels/printer/client/printer_win.h index 5b694ac40..eecbb17ba 100644 --- a/channels/rdpdr/client/printer/printer_win.h +++ b/channels/printer/client/printer_win.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Print Virtual Channel - win driver * * Copyright 2012 Gerald Richter @@ -20,7 +20,6 @@ #ifndef __PRINTER_WIN_H #define __PRINTER_WIN_H - rdpPrinterDriver* printer_win_get_driver(void); #ifdef WITH_DEBUG_WINPR diff --git a/channels/rail/CMakeLists.txt b/channels/rail/CMakeLists.txt index 676de4e85..f2b1dd1b8 100644 --- a/channels/rail/CMakeLists.txt +++ b/channels/rail/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -17,5 +17,10 @@ if(WITH_CLIENT_CHANNELS) add_subdirectory(client) + if(${MODULE_PREFIX}_CLIENT_STATIC) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE) + endif() endif() diff --git a/channels/rail/client/CMakeLists.txt b/channels/rail/client/CMakeLists.txt index 6e6a45441..5ccf2041b 100644 --- a/channels/rail/client/CMakeLists.txt +++ b/channels/rail/client/CMakeLists.txt @@ -1,8 +1,6 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador # Copyright 2011 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,20 +15,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(RAIL_SRCS +set(MODULE_NAME "rail") +set(MODULE_PREFIX "CHANNEL_RAIL_CLIENT") + +set(${MODULE_PREFIX}_SRCS rail_main.c rail_main.h rail_orders.c rail_orders.h) -add_library(rail ${RAIL_SRCS}) -set_target_properties(rail PROPERTIES PREFIX "") +# rail is always built-in -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rail freerdp) +set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE) +set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE) +set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE) + +add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(rail freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS rail DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rail/client/rail_main.c b/channels/rail/client/rail_main.c index 06c3b5bf0..aa9c85d2b 100644 --- a/channels/rail/client/rail_main.c +++ b/channels/rail/client/rail_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RAIL Virtual Channel Plugin * * Copyright 2011 Marc-Andre Moreau @@ -27,8 +27,10 @@ #include #include -#include +#include + #include +#include #include #include #include @@ -56,7 +58,7 @@ static void on_free_rail_channel_event(RDP_EVENT* event) } } -void rail_send_channel_event(void* rail_object, uint16 event_type, void* param) +void rail_send_channel_event(void* rail_object, UINT16 event_type, void* param) { void * payload = NULL; RDP_EVENT* out_event = NULL; @@ -250,7 +252,31 @@ static void rail_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) freerdp_event_free(event); } -DEFINE_SVC_PLUGIN(rail, "rail", - CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | - CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL) +/* rail is always built-in */ +#define VirtualChannelEntry rail_VirtualChannelEntry + +const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) +{ + railPlugin* _p; + + _p = (railPlugin*) malloc(sizeof(railPlugin)); + ZeroMemory(_p, sizeof(railPlugin)); + + _p->plugin.channel_def.options = + CHANNEL_OPTION_INITIALIZED | + CHANNEL_OPTION_ENCRYPT_RDP | + CHANNEL_OPTION_COMPRESS_RDP | + CHANNEL_OPTION_SHOW_PROTOCOL; + + strcpy(_p->plugin.channel_def.name, "rail"); + + _p->plugin.connect_callback = rail_process_connect; + _p->plugin.receive_callback = rail_process_receive; + _p->plugin.event_callback = rail_process_event; + _p->plugin.terminate_callback = rail_process_terminate; + + svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints); + + return 1; +} diff --git a/channels/rail/client/rail_main.h b/channels/rail/client/rail_main.h index 31c243aa0..ec9fc1f97 100644 --- a/channels/rail/client/rail_main.h +++ b/channels/rail/client/rail_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RAIL Virtual Channel Plugin * * Copyright 2011 Marc-Andre Moreau @@ -56,7 +56,7 @@ struct rail_plugin }; typedef struct rail_plugin railPlugin; -void rail_send_channel_event(void* rail_object, uint16 event_type, void* param); +void rail_send_channel_event(void* rail_object, UINT16 event_type, void* param); void rail_send_channel_data(void* rail_object, void* data, size_t length); #ifdef WITH_DEBUG_RAIL diff --git a/channels/rail/client/rail_orders.c b/channels/rail/client/rail_orders.c index db99515f4..c9c529ebe 100644 --- a/channels/rail/client/rail_orders.c +++ b/channels/rail/client/rail_orders.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) Orders * * Copyright 2009 Marc-Andre Moreau @@ -22,8 +22,12 @@ #include "config.h" #endif +#include +#include + +#include + #include -#include #include #include "rail_orders.h" @@ -71,7 +75,7 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_ int length = 0; if (unicode_string->string != NULL) - xfree(unicode_string->string); + free(unicode_string->string); unicode_string->string = NULL; unicode_string->length = 0; @@ -81,20 +85,20 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_ length = freerdp_AsciiToUnicodeAlloc(string, &buffer, 0) * 2; - unicode_string->string = (uint8*) buffer; - unicode_string->length = (uint16) length; + unicode_string->string = (BYTE*) buffer; + unicode_string->length = (UINT16) length; } -void rail_read_pdu_header(STREAM* s, uint16* orderType, uint16* orderLength) +void rail_read_pdu_header(STREAM* s, UINT16* orderType, UINT16* orderLength) { - stream_read_uint16(s, *orderType); /* orderType (2 bytes) */ - stream_read_uint16(s, *orderLength); /* orderLength (2 bytes) */ + stream_read_UINT16(s, *orderType); /* orderType (2 bytes) */ + stream_read_UINT16(s, *orderLength); /* orderLength (2 bytes) */ } -void rail_write_pdu_header(STREAM* s, uint16 orderType, uint16 orderLength) +void rail_write_pdu_header(STREAM* s, UINT16 orderType, UINT16 orderLength) { - stream_write_uint16(s, orderType); /* orderType (2 bytes) */ - stream_write_uint16(s, orderLength); /* orderLength (2 bytes) */ + stream_write_UINT16(s, orderType); /* orderType (2 bytes) */ + stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */ } STREAM* rail_pdu_init(int length) @@ -105,9 +109,9 @@ STREAM* rail_pdu_init(int length) return s; } -void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, uint16 orderType) +void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, UINT16 orderType) { - uint16 orderLength; + UINT16 orderLength; orderLength = stream_get_length(s); stream_set_pos(s, 0); @@ -125,39 +129,39 @@ void rail_send_pdu(rdpRailOrder* rail_order, STREAM* s, uint16 orderType) void rail_write_high_contrast(STREAM* s, HIGH_CONTRAST* high_contrast) { high_contrast->colorSchemeLength = high_contrast->colorScheme.length + 2; - stream_write_uint32(s, high_contrast->flags); /* flags (4 bytes) */ - stream_write_uint32(s, high_contrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */ + stream_write_UINT32(s, high_contrast->flags); /* flags (4 bytes) */ + stream_write_UINT32(s, high_contrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */ rail_write_unicode_string(s, &high_contrast->colorScheme); /* colorScheme */ } void rail_read_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake) { - stream_read_uint32(s, handshake->buildNumber); /* buildNumber (4 bytes) */ + stream_read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */ } void rail_read_server_exec_result_order(STREAM* s, RAIL_EXEC_RESULT_ORDER* exec_result) { - stream_read_uint16(s, exec_result->flags); /* flags (2 bytes) */ - stream_read_uint16(s, exec_result->execResult); /* execResult (2 bytes) */ - stream_read_uint32(s, exec_result->rawResult); /* rawResult (4 bytes) */ - stream_seek_uint16(s); /* padding (2 bytes) */ + stream_read_UINT16(s, exec_result->flags); /* flags (2 bytes) */ + stream_read_UINT16(s, exec_result->execResult); /* execResult (2 bytes) */ + stream_read_UINT32(s, exec_result->rawResult); /* rawResult (4 bytes) */ + stream_seek_UINT16(s); /* padding (2 bytes) */ rail_read_unicode_string(s, &exec_result->exeOrFile); /* exeOrFile */ } void rail_read_server_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam) { - uint8 body; - stream_read_uint32(s, sysparam->param); /* systemParam (4 bytes) */ - stream_read_uint8(s, body); /* body (1 byte) */ + BYTE body; + stream_read_UINT32(s, sysparam->param); /* systemParam (4 bytes) */ + stream_read_BYTE(s, body); /* body (1 byte) */ switch (sysparam->param) { case SPI_SET_SCREEN_SAVE_ACTIVE: - sysparam->setScreenSaveActive = (body != 0) ? true : false; + sysparam->setScreenSaveActive = (body != 0) ? TRUE : FALSE; break; case SPI_SET_SCREEN_SAVE_SECURE: - sysparam->setScreenSaveSecure = (body != 0) ? true : false; + sysparam->setScreenSaveSecure = (body != 0) ? TRUE : FALSE; break; default: @@ -167,33 +171,33 @@ void rail_read_server_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam) void rail_read_server_minmaxinfo_order(STREAM* s, RAIL_MINMAXINFO_ORDER* minmaxinfo) { - stream_read_uint32(s, minmaxinfo->windowId); /* windowId (4 bytes) */ - stream_read_uint16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */ - stream_read_uint16(s, minmaxinfo->maxHeight); /* maxHeight (2 bytes) */ - stream_read_uint16(s, minmaxinfo->maxPosX); /* maxPosX (2 bytes) */ - stream_read_uint16(s, minmaxinfo->maxPosY); /* maxPosY (2 bytes) */ - stream_read_uint16(s, minmaxinfo->minTrackWidth); /* minTrackWidth (2 bytes) */ - stream_read_uint16(s, minmaxinfo->minTrackHeight); /* minTrackHeight (2 bytes) */ - stream_read_uint16(s, minmaxinfo->maxTrackWidth); /* maxTrackWidth (2 bytes) */ - stream_read_uint16(s, minmaxinfo->maxTrackHeight); /* maxTrackHeight (2 bytes) */ + stream_read_UINT32(s, minmaxinfo->windowId); /* windowId (4 bytes) */ + stream_read_UINT16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */ + stream_read_UINT16(s, minmaxinfo->maxHeight); /* maxHeight (2 bytes) */ + stream_read_UINT16(s, minmaxinfo->maxPosX); /* maxPosX (2 bytes) */ + stream_read_UINT16(s, minmaxinfo->maxPosY); /* maxPosY (2 bytes) */ + stream_read_UINT16(s, minmaxinfo->minTrackWidth); /* minTrackWidth (2 bytes) */ + stream_read_UINT16(s, minmaxinfo->minTrackHeight); /* minTrackHeight (2 bytes) */ + stream_read_UINT16(s, minmaxinfo->maxTrackWidth); /* maxTrackWidth (2 bytes) */ + stream_read_UINT16(s, minmaxinfo->maxTrackHeight); /* maxTrackHeight (2 bytes) */ } void rail_read_server_localmovesize_order(STREAM* s, RAIL_LOCALMOVESIZE_ORDER* localmovesize) { - uint16 isMoveSizeStart; - stream_read_uint32(s, localmovesize->windowId); /* windowId (4 bytes) */ + UINT16 isMoveSizeStart; + stream_read_UINT32(s, localmovesize->windowId); /* windowId (4 bytes) */ - stream_read_uint16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */ - localmovesize->isMoveSizeStart = (isMoveSizeStart != 0) ? true : false; + stream_read_UINT16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */ + localmovesize->isMoveSizeStart = (isMoveSizeStart != 0) ? TRUE : FALSE; - stream_read_uint16(s, localmovesize->moveSizeType); /* moveSizeType (2 bytes) */ - stream_read_uint16(s, localmovesize->posX); /* posX (2 bytes) */ - stream_read_uint16(s, localmovesize->posY); /* posY (2 bytes) */ + stream_read_UINT16(s, localmovesize->moveSizeType); /* moveSizeType (2 bytes) */ + stream_read_UINT16(s, localmovesize->posX); /* posX (2 bytes) */ + stream_read_UINT16(s, localmovesize->posY); /* posY (2 bytes) */ } void rail_read_server_get_appid_resp_order(STREAM* s, RAIL_GET_APPID_RESP_ORDER* get_appid_resp) { - stream_read_uint32(s, get_appid_resp->windowId); /* windowId (4 bytes) */ + stream_read_UINT32(s, get_appid_resp->windowId); /* windowId (4 bytes) */ stream_read(s, &get_appid_resp->applicationIdBuffer[0], 512); /* applicationId (256 UNICODE chars) */ get_appid_resp->applicationId.length = 512; @@ -202,25 +206,25 @@ void rail_read_server_get_appid_resp_order(STREAM* s, RAIL_GET_APPID_RESP_ORDER* void rail_read_langbar_info_order(STREAM* s, RAIL_LANGBAR_INFO_ORDER* langbar_info) { - stream_read_uint32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */ + stream_read_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */ } void rail_write_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake) { - stream_write_uint32(s, handshake->buildNumber); /* buildNumber (4 bytes) */ + stream_write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */ } void rail_write_client_status_order(STREAM* s, RAIL_CLIENT_STATUS_ORDER* client_status) { - stream_write_uint32(s, client_status->flags); /* flags (4 bytes) */ + stream_write_UINT32(s, client_status->flags); /* flags (4 bytes) */ } void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec) { - stream_write_uint16(s, exec->flags); /* flags (2 bytes) */ - stream_write_uint16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */ - stream_write_uint16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */ - stream_write_uint16(s, exec->arguments.length); /* argumentsLength (2 bytes) */ + stream_write_UINT16(s, exec->flags); /* flags (2 bytes) */ + stream_write_UINT16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */ + stream_write_UINT16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */ + stream_write_UINT16(s, exec->arguments.length); /* argumentsLength (2 bytes) */ rail_write_unicode_string_value(s, &exec->exeOrFile); /* exeOrFile */ rail_write_unicode_string_value(s, &exec->workingDir); /* workingDir */ rail_write_unicode_string_value(s, &exec->arguments); /* arguments */ @@ -228,50 +232,50 @@ void rail_write_client_exec_order(STREAM* s, RAIL_EXEC_ORDER* exec) void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam) { - uint8 body; - stream_write_uint32(s, sysparam->param); /* systemParam (4 bytes) */ + BYTE body; + stream_write_UINT32(s, sysparam->param); /* systemParam (4 bytes) */ switch (sysparam->param) { case SPI_SET_DRAG_FULL_WINDOWS: body = sysparam->dragFullWindows; - stream_write_uint8(s, body); + stream_write_BYTE(s, body); break; case SPI_SET_KEYBOARD_CUES: body = sysparam->keyboardCues; - stream_write_uint8(s, body); + stream_write_BYTE(s, body); break; case SPI_SET_KEYBOARD_PREF: body = sysparam->keyboardPref; - stream_write_uint8(s, body); + stream_write_BYTE(s, body); break; case SPI_SET_MOUSE_BUTTON_SWAP: body = sysparam->mouseButtonSwap; - stream_write_uint8(s, body); + stream_write_BYTE(s, body); break; case SPI_SET_WORK_AREA: - stream_write_uint16(s, sysparam->workArea.left); /* left (2 bytes) */ - stream_write_uint16(s, sysparam->workArea.top); /* top (2 bytes) */ - stream_write_uint16(s, sysparam->workArea.right); /* right (2 bytes) */ - stream_write_uint16(s, sysparam->workArea.bottom); /* bottom (2 bytes) */ + stream_write_UINT16(s, sysparam->workArea.left); /* left (2 bytes) */ + stream_write_UINT16(s, sysparam->workArea.top); /* top (2 bytes) */ + stream_write_UINT16(s, sysparam->workArea.right); /* right (2 bytes) */ + stream_write_UINT16(s, sysparam->workArea.bottom); /* bottom (2 bytes) */ break; case SPI_DISPLAY_CHANGE: - stream_write_uint16(s, sysparam->displayChange.left); /* left (2 bytes) */ - stream_write_uint16(s, sysparam->displayChange.top); /* top (2 bytes) */ - stream_write_uint16(s, sysparam->displayChange.right); /* right (2 bytes) */ - stream_write_uint16(s, sysparam->displayChange.bottom); /* bottom (2 bytes) */ + stream_write_UINT16(s, sysparam->displayChange.left); /* left (2 bytes) */ + stream_write_UINT16(s, sysparam->displayChange.top); /* top (2 bytes) */ + stream_write_UINT16(s, sysparam->displayChange.right); /* right (2 bytes) */ + stream_write_UINT16(s, sysparam->displayChange.bottom); /* bottom (2 bytes) */ break; case SPI_TASKBAR_POS: - stream_write_uint16(s, sysparam->taskbarPos.left); /* left (2 bytes) */ - stream_write_uint16(s, sysparam->taskbarPos.top); /* top (2 bytes) */ - stream_write_uint16(s, sysparam->taskbarPos.right); /* right (2 bytes) */ - stream_write_uint16(s, sysparam->taskbarPos.bottom); /* bottom (2 bytes) */ + stream_write_UINT16(s, sysparam->taskbarPos.left); /* left (2 bytes) */ + stream_write_UINT16(s, sysparam->taskbarPos.top); /* top (2 bytes) */ + stream_write_UINT16(s, sysparam->taskbarPos.right); /* right (2 bytes) */ + stream_write_UINT16(s, sysparam->taskbarPos.bottom); /* bottom (2 bytes) */ break; case SPI_SET_HIGH_CONTRAST: @@ -282,51 +286,51 @@ void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam) void rail_write_client_activate_order(STREAM* s, RAIL_ACTIVATE_ORDER* activate) { - uint8 enabled; + BYTE enabled; - stream_write_uint32(s, activate->windowId); /* windowId (4 bytes) */ + stream_write_UINT32(s, activate->windowId); /* windowId (4 bytes) */ enabled = activate->enabled; - stream_write_uint8(s, enabled); /* enabled (1 byte) */ + stream_write_BYTE(s, enabled); /* enabled (1 byte) */ } void rail_write_client_sysmenu_order(STREAM* 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) */ + 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) { - stream_write_uint32(s, syscommand->windowId); /* windowId (4 bytes) */ - stream_write_uint16(s, syscommand->command); /* command (2 bytes) */ + 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) { - 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) */ + 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) { - stream_write_uint32(s, window_move->windowId); /* windowId (4 bytes) */ - stream_write_uint16(s, window_move->left); /* left (2 bytes) */ - stream_write_uint16(s, window_move->top); /* top (2 bytes) */ - stream_write_uint16(s, window_move->right); /* right (2 bytes) */ - stream_write_uint16(s, window_move->bottom); /* bottom (2 bytes) */ + stream_write_UINT32(s, window_move->windowId); /* windowId (4 bytes) */ + stream_write_UINT16(s, window_move->left); /* left (2 bytes) */ + stream_write_UINT16(s, window_move->top); /* top (2 bytes) */ + stream_write_UINT16(s, window_move->right); /* right (2 bytes) */ + 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) { - stream_write_uint32(s, get_appid_req->windowId); /* windowId (4 bytes) */ + 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) { - stream_write_uint32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */ + stream_write_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */ } void rail_recv_handshake_order(rdpRailOrder* rail_order, STREAM* s) @@ -349,16 +353,16 @@ void rail_recv_handshake_order(rdpRailOrder* rail_order, STREAM* s) rail_order->sysparam.highContrast.flags = 0x7E; rail_order->sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP; - rail_order->sysparam.mouseButtonSwap = false; + rail_order->sysparam.mouseButtonSwap = FALSE; rail_order->sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF; - rail_order->sysparam.keyboardPref = false; + rail_order->sysparam.keyboardPref = FALSE; rail_order->sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS; - rail_order->sysparam.dragFullWindows = false; + rail_order->sysparam.dragFullWindows = FALSE; rail_order->sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES; - rail_order->sysparam.keyboardCues = false; + rail_order->sysparam.keyboardCues = FALSE; rail_order->sysparam.params |= SPI_MASK_SET_WORK_AREA; rail_order->sysparam.workArea.left = 0; @@ -414,8 +418,8 @@ void rail_recv_langbar_info_order(rdpRailOrder* rail_order, STREAM* s) void rail_order_recv(rdpRailOrder* rail_order, STREAM* s) { - uint16 orderType; - uint16 orderLength; + UINT16 orderType; + UINT16 orderLength; rail_read_pdu_header(s, &orderType, &orderLength); @@ -630,14 +634,15 @@ void rail_send_client_langbar_info_order(rdpRailOrder* rail_order) 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); - stream_free(s) ; + stream_free(s); } rdpRailOrder* rail_order_new() { rdpRailOrder* rail_order; - rail_order = xnew(rdpRailOrder); + rail_order = (rdpRailOrder*) malloc(sizeof(rdpRailOrder)); + ZeroMemory(rail_order, sizeof(rdpRailOrder)); if (rail_order != NULL) { @@ -652,7 +657,7 @@ void rail_order_free(rdpRailOrder* rail_order) if (rail_order != NULL) { - xfree(rail_order); + free(rail_order); } } diff --git a/channels/rail/client/rail_orders.h b/channels/rail/client/rail_orders.h index cd4e07bb5..ffc87d6b7 100644 --- a/channels/rail/client/rail_orders.h +++ b/channels/rail/client/rail_orders.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) * * Copyright 2009 Marc-Andre Moreau diff --git a/channels/rdpdr/CMakeLists.txt b/channels/rdpdr/CMakeLists.txt index 676de4e85..036e7e48c 100644 --- a/channels/rdpdr/CMakeLists.txt +++ b/channels/rdpdr/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,7 +15,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "rdpdr") +set(MODULE_PREFIX "CHANNEL_RDPDR") + if(WITH_CLIENT_CHANNELS) add_subdirectory(client) + if(${MODULE_PREFIX}_CLIENT_STATIC) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE) + endif() endif() diff --git a/channels/rdpdr/ChannelOptions.cmake b/channels/rdpdr/ChannelOptions.cmake index 85e3f63b5..6ae191b62 100644 --- a/channels/rdpdr/ChannelOptions.cmake +++ b/channels/rdpdr/ChannelOptions.cmake @@ -6,9 +6,5 @@ set(CHANNEL_SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]") string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) -if(WIN32) - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) -else() - option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) -endif() +option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) diff --git a/channels/rdpdr/client/CMakeLists.txt b/channels/rdpdr/client/CMakeLists.txt index a3fa82e1c..fd45da480 100644 --- a/channels/rdpdr/client/CMakeLists.txt +++ b/channels/rdpdr/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,36 +15,34 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(RDPDR_SRCS - rdpdr_constants.h - rdpdr_types.h - rdpdr_capabilities.c - rdpdr_capabilities.h - devman.c - devman.h +set(MODULE_NAME "rdpdr") +set(MODULE_PREFIX "CHANNEL_RDPDR_CLIENT") + +set(${MODULE_PREFIX}_SRCS irp.c irp.h + devman.c + devman.h rdpdr_main.c - rdpdr_main.h) + rdpdr_main.h + rdpdr_capabilities.c + rdpdr_capabilities.h) -add_library(rdpdr ${RDPDR_SRCS}) -set_target_properties(rdpdr PROPERTIES PREFIX "") +# rdpdr is always built-in -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rdpdr freerdp) +set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE) +set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE) +set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE) + +add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp winpr) else() - target_link_libraries(rdpdr freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked) endif() -install(TARGETS rdpdr DESTINATION ${FREERDP_PLUGIN_PATH}) +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") -add_subdirectory(disk) -add_subdirectory(printer) -if(NOT WIN32) - add_subdirectory(parallel) - add_subdirectory(serial) -endif() - -if(WITH_PCSC) - add_subdirectory(smartcard) -endif() diff --git a/channels/rdpdr/client/devman.c b/channels/rdpdr/client/devman.c index a9fbe1671..2273d2aa8 100644 --- a/channels/rdpdr/client/devman.c +++ b/channels/rdpdr/client/devman.c @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,9 @@ #include #include #include +#include -#include "rdpdr_types.h" +#include "rdpdr_main.h" #include "devman.h" DEVMAN* devman_new(rdpSvcPlugin* plugin) @@ -57,7 +58,7 @@ void devman_free(DEVMAN* devman) list_free(devman->devices); - xfree(devman); + free(devman); } static void devman_register_device(DEVMAN* devman, DEVICE* device) @@ -68,15 +69,27 @@ static void devman_register_device(DEVMAN* devman, DEVICE* device) DEBUG_SVC("device %d.%s registered", device->id, device->name); } -boolean devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data) +BOOL devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data) { + char* name; DEVICE_SERVICE_ENTRY_POINTS ep; - PDEVICE_SERVICE_ENTRY entry; + PDEVICE_SERVICE_ENTRY entry = NULL; - entry = freerdp_load_plugin((char*) plugin_data->data[0], "DeviceServiceEntry"); + name = (char*) plugin_data->data[0]; + entry = (PDEVICE_SERVICE_ENTRY) freerdp_channels_find_static_device_service_entry(name); + + if (!entry) + { + printf("loading device service %s (plugin)\n", name); + entry = freerdp_load_plugin(name, "DeviceServiceEntry"); + } + else + { + printf("loading device service %s (static)\n", name); + } if (entry == NULL) - return false; + return FALSE; ep.devman = devman; ep.RegisterDevice = devman_register_device; @@ -84,10 +97,10 @@ boolean devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data) entry(&ep); - return true; + return TRUE; } -DEVICE* devman_get_device_by_id(DEVMAN* devman, uint32 id) +DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id) { LIST_ITEM* item; DEVICE* device; diff --git a/channels/rdpdr/client/devman.h b/channels/rdpdr/client/devman.h index 586034775..290e897a5 100644 --- a/channels/rdpdr/client/devman.h +++ b/channels/rdpdr/client/devman.h @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,12 @@ * limitations under the License. */ -#ifndef __DEVMAN_H -#define __DEVMAN_H +#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H +#define FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H DEVMAN* devman_new(rdpSvcPlugin* plugin); void devman_free(DEVMAN* devman); -boolean devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data); -DEVICE* devman_get_device_by_id(DEVMAN* devman, uint32 id); +BOOL devman_load_device_service(DEVMAN* devman, RDP_PLUGIN_DATA* plugin_data); +DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id); -#endif /* __DEVMAN_H */ +#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H */ diff --git a/channels/rdpdr/client/irp.c b/channels/rdpdr/client/irp.c index 9ca5180bc..154540fba 100644 --- a/channels/rdpdr/client/irp.c +++ b/channels/rdpdr/client/irp.c @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +32,7 @@ #include #include -#include "rdpdr_types.h" -#include "rdpdr_constants.h" +#include "rdpdr_main.h" #include "devman.h" #include "irp.h" @@ -55,7 +54,7 @@ static void irp_complete(IRP* irp) pos = stream_get_pos(irp->output); stream_set_pos(irp->output, 12); - stream_write_uint32(irp->output, irp->IoStatus); + stream_write_UINT32(irp->output, irp->IoStatus); stream_set_pos(irp->output, pos); svc_plugin_send(irp->devman->plugin, irp->output); @@ -67,10 +66,10 @@ static void irp_complete(IRP* irp) IRP* irp_new(DEVMAN* devman, STREAM* data_in) { IRP* irp; - uint32 DeviceId; + UINT32 DeviceId; DEVICE* device; - stream_read_uint32(data_in, DeviceId); + stream_read_UINT32(data_in, DeviceId); device = devman_get_device_by_id(devman, DeviceId); if (device == NULL) @@ -84,18 +83,18 @@ IRP* irp_new(DEVMAN* devman, STREAM* data_in) irp->device = device; irp->devman = devman; - stream_read_uint32(data_in, irp->FileId); - stream_read_uint32(data_in, irp->CompletionId); - stream_read_uint32(data_in, irp->MajorFunction); - stream_read_uint32(data_in, irp->MinorFunction); + stream_read_UINT32(data_in, irp->FileId); + stream_read_UINT32(data_in, irp->CompletionId); + stream_read_UINT32(data_in, irp->MajorFunction); + stream_read_UINT32(data_in, irp->MinorFunction); irp->input = data_in; irp->output = stream_new(256); - stream_write_uint16(irp->output, RDPDR_CTYP_CORE); - stream_write_uint16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION); - stream_write_uint32(irp->output, DeviceId); - stream_write_uint32(irp->output, irp->CompletionId); - stream_seek_uint32(irp->output); /* IoStatus */ + stream_write_UINT16(irp->output, RDPDR_CTYP_CORE); + stream_write_UINT16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION); + stream_write_UINT32(irp->output, DeviceId); + stream_write_UINT32(irp->output, irp->CompletionId); + stream_seek_UINT32(irp->output); /* IoStatus */ irp->Complete = irp_complete; irp->Discard = irp_free; diff --git a/channels/rdpdr/client/irp.h b/channels/rdpdr/client/irp.h index d33e51885..fcdeba109 100644 --- a/channels/rdpdr/client/irp.h +++ b/channels/rdpdr/client/irp.h @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,11 @@ * limitations under the License. */ -#ifndef __IRP_H -#define __IRP_H +#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H +#define FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H -#include "rdpdr_types.h" +#include "rdpdr_main.h" IRP* irp_new(DEVMAN* devman, STREAM* data_in); -#endif /* __IRP_H */ +#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H */ diff --git a/channels/rdpdr/client/rdpdr_capabilities.c b/channels/rdpdr/client/rdpdr_capabilities.c index 0b1b81e51..de983d8ea 100644 --- a/channels/rdpdr/client/rdpdr_capabilities.c +++ b/channels/rdpdr/client/rdpdr_capabilities.c @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,16 +29,15 @@ #include #include -#include "rdpdr_types.h" -#include "rdpdr_constants.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(STREAM* data_out, UINT16 capabilityType, UINT16 capabilityLength, UINT32 version) { - stream_write_uint16(data_out, capabilityType); - stream_write_uint16(data_out, capabilityLength); - stream_write_uint32(data_out, version); + stream_write_UINT16(data_out, capabilityType); + stream_write_UINT16(data_out, capabilityLength); + stream_write_UINT32(data_out, version); } /* Output device direction general capability set */ @@ -46,24 +45,24 @@ static void rdpdr_write_general_capset(rdpdrPlugin* rdpdr, STREAM* data_out) { rdpdr_write_capset_header(data_out, CAP_GENERAL_TYPE, 44, GENERAL_CAPABILITY_VERSION_02); - stream_write_uint32(data_out, 0); /* osType, ignored on receipt */ - stream_write_uint32(data_out, 0); /* osVersion, unused and must be set to zero */ - stream_write_uint16(data_out, 1); /* protocolMajorVersion, must be set to 1 */ - stream_write_uint16(data_out, RDPDR_MINOR_RDP_VERSION_5_2); /* protocolMinorVersion */ - stream_write_uint32(data_out, 0x0000FFFF); /* ioCode1 */ - stream_write_uint32(data_out, 0); /* ioCode2, must be set to zero, reserved for future use */ - stream_write_uint32(data_out, RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU | RDPDR_USER_LOGGEDON_PDU); /* extendedPDU */ - stream_write_uint32(data_out, ENABLE_ASYNCIO); /* extraFlags1 */ - stream_write_uint32(data_out, 0); /* extraFlags2, must be set to zero, reserved for future use */ - stream_write_uint32(data_out, 0); /* SpecialTypeDeviceCap, number of special devices to be redirected before logon */ + stream_write_UINT32(data_out, 0); /* osType, ignored on receipt */ + stream_write_UINT32(data_out, 0); /* osVersion, unused and must be set to zero */ + stream_write_UINT16(data_out, 1); /* protocolMajorVersion, must be set to 1 */ + stream_write_UINT16(data_out, RDPDR_MINOR_RDP_VERSION_5_2); /* protocolMinorVersion */ + stream_write_UINT32(data_out, 0x0000FFFF); /* ioCode1 */ + stream_write_UINT32(data_out, 0); /* ioCode2, must be set to zero, reserved for future use */ + stream_write_UINT32(data_out, RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU | RDPDR_USER_LOGGEDON_PDU); /* extendedPDU */ + stream_write_UINT32(data_out, ENABLE_ASYNCIO); /* extraFlags1 */ + stream_write_UINT32(data_out, 0); /* extraFlags2, must be set to zero, reserved for future use */ + stream_write_UINT32(data_out, 0); /* SpecialTypeDeviceCap, number of special devices to be redirected before logon */ } /* Process device direction general capability set */ static void rdpdr_process_general_capset(rdpdrPlugin* rdpdr, STREAM* data_in) { - uint16 capabilityLength; + UINT16 capabilityLength; - stream_read_uint16(data_in, capabilityLength); + stream_read_UINT16(data_in, capabilityLength); stream_seek(data_in, capabilityLength - 4); } @@ -76,9 +75,9 @@ static void rdpdr_write_printer_capset(rdpdrPlugin* rdpdr, STREAM* data_out) /* Process printer direction capability set */ static void rdpdr_process_printer_capset(rdpdrPlugin* rdpdr, STREAM* data_in) { - uint16 capabilityLength; + UINT16 capabilityLength; - stream_read_uint16(data_in, capabilityLength); + stream_read_UINT16(data_in, capabilityLength); stream_seek(data_in, capabilityLength - 4); } @@ -91,9 +90,9 @@ static void rdpdr_write_port_capset(rdpdrPlugin* rdpdr, STREAM* data_out) /* Process port redirection capability set */ static void rdpdr_process_port_capset(rdpdrPlugin* rdpdr, STREAM* data_in) { - uint16 capabilityLength; + UINT16 capabilityLength; - stream_read_uint16(data_in, capabilityLength); + stream_read_UINT16(data_in, capabilityLength); stream_seek(data_in, capabilityLength - 4); } @@ -106,9 +105,9 @@ static void rdpdr_write_drive_capset(rdpdrPlugin* rdpdr, STREAM* data_out) /* Process drive redirection capability set */ static void rdpdr_process_drive_capset(rdpdrPlugin* rdpdr, STREAM* data_in) { - uint16 capabilityLength; + UINT16 capabilityLength; - stream_read_uint16(data_in, capabilityLength); + stream_read_UINT16(data_in, capabilityLength); stream_seek(data_in, capabilityLength - 4); } @@ -121,24 +120,24 @@ static void rdpdr_write_smartcard_capset(rdpdrPlugin* rdpdr, STREAM* data_out) /* Process smartcard redirection capability set */ static void rdpdr_process_smartcard_capset(rdpdrPlugin* rdpdr, STREAM* data_in) { - uint16 capabilityLength; + UINT16 capabilityLength; - stream_read_uint16(data_in, capabilityLength); + stream_read_UINT16(data_in, capabilityLength); stream_seek(data_in, capabilityLength - 4); } void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, STREAM* data_in) { - uint16 i; - uint16 numCapabilities; - uint16 capabilityType; + UINT16 i; + UINT16 numCapabilities; + UINT16 capabilityType; - stream_read_uint16(data_in, numCapabilities); + stream_read_UINT16(data_in, numCapabilities); stream_seek(data_in, 2); /* pad (2 bytes) */ for(i = 0; i < numCapabilities; i++) { - stream_read_uint16(data_in, capabilityType); + stream_read_UINT16(data_in, capabilityType); switch (capabilityType) { @@ -175,11 +174,11 @@ void rdpdr_send_capability_response(rdpdrPlugin* rdpdr) data_out = stream_new(256); - stream_write_uint16(data_out, RDPDR_CTYP_CORE); - stream_write_uint16(data_out, PAKID_CORE_CLIENT_CAPABILITY); + stream_write_UINT16(data_out, RDPDR_CTYP_CORE); + stream_write_UINT16(data_out, PAKID_CORE_CLIENT_CAPABILITY); - stream_write_uint16(data_out, 5); /* numCapabilities */ - stream_write_uint16(data_out, 0); /* pad */ + stream_write_UINT16(data_out, 5); /* numCapabilities */ + stream_write_UINT16(data_out, 0); /* pad */ rdpdr_write_general_capset(rdpdr, data_out); rdpdr_write_printer_capset(rdpdr, data_out); diff --git a/channels/rdpdr/client/rdpdr_capabilities.h b/channels/rdpdr/client/rdpdr_capabilities.h index 28b83c745..16f0b1db9 100644 --- a/channels/rdpdr/client/rdpdr_capabilities.h +++ b/channels/rdpdr/client/rdpdr_capabilities.h @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,12 @@ * limitations under the License. */ -#ifndef __RDPDR_CAPABILITIES_H -#define __RDPDR_CAPABILITIES_H +#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H +#define FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H #include "rdpdr_main.h" void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, STREAM* data_in); void rdpdr_send_capability_response(rdpdrPlugin* rdpdr); -#endif /* __RDPDR_CAPABILITIES_H */ +#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H */ diff --git a/channels/rdpdr/client/rdpdr_main.c b/channels/rdpdr/client/rdpdr_main.c index e38048ae4..379555e3e 100644 --- a/channels/rdpdr/client/rdpdr_main.c +++ b/channels/rdpdr/client/rdpdr_main.c @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,22 +26,25 @@ #include #include -#include +#include + #include +#include #include #include #include +#include #include #ifdef HAVE_UNISTD_H #include #endif -#include "rdpdr_types.h" -#include "rdpdr_constants.h" #include "rdpdr_capabilities.h" + #include "devman.h" #include "irp.h" + #include "rdpdr_main.h" static void rdpdr_process_connect(rdpSvcPlugin* plugin) @@ -63,15 +66,16 @@ static void rdpdr_process_connect(rdpSvcPlugin* plugin) { devman_load_device_service(rdpdr->devman, data); } - data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size); + + data = (RDP_PLUGIN_DATA*) (((BYTE*) data) + data->size); } } static void rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, STREAM* data_in) { - stream_read_uint16(data_in, rdpdr->versionMajor); - stream_read_uint16(data_in, rdpdr->versionMinor); - stream_read_uint32(data_in, rdpdr->clientID); + stream_read_UINT16(data_in, rdpdr->versionMajor); + stream_read_UINT16(data_in, rdpdr->versionMinor); + stream_read_UINT32(data_in, rdpdr->clientID); DEBUG_SVC("version %d.%d clientID %d", rdpdr->versionMajor, rdpdr->versionMinor, rdpdr->clientID); } @@ -82,12 +86,12 @@ static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr) data_out = stream_new(12); - stream_write_uint16(data_out, RDPDR_CTYP_CORE); - stream_write_uint16(data_out, PAKID_CORE_CLIENTID_CONFIRM); + stream_write_UINT16(data_out, RDPDR_CTYP_CORE); + stream_write_UINT16(data_out, PAKID_CORE_CLIENTID_CONFIRM); - stream_write_uint16(data_out, rdpdr->versionMajor); - stream_write_uint16(data_out, rdpdr->versionMinor); - stream_write_uint32(data_out, (uint32) rdpdr->clientID); + stream_write_UINT16(data_out, rdpdr->versionMajor); + stream_write_UINT16(data_out, rdpdr->versionMinor); + stream_write_UINT32(data_out, (UINT32) rdpdr->clientID); svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out); } @@ -105,29 +109,29 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr) data_out = stream_new(16 + computerNameLenW + 2); - stream_write_uint16(data_out, RDPDR_CTYP_CORE); - stream_write_uint16(data_out, PAKID_CORE_CLIENT_NAME); + stream_write_UINT16(data_out, RDPDR_CTYP_CORE); + stream_write_UINT16(data_out, PAKID_CORE_CLIENT_NAME); - stream_write_uint32(data_out, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */ - stream_write_uint32(data_out, 0); /* codePage, must be set to zero */ - stream_write_uint32(data_out, computerNameLenW + 2); /* computerNameLen, including null terminator */ + stream_write_UINT32(data_out, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */ + stream_write_UINT32(data_out, 0); /* codePage, must be set to zero */ + stream_write_UINT32(data_out, computerNameLenW + 2); /* computerNameLen, including null terminator */ stream_write(data_out, computerNameW, computerNameLenW); - stream_write_uint16(data_out, 0); /* null terminator */ + stream_write_UINT16(data_out, 0); /* null terminator */ - xfree(computerNameW); + free(computerNameW); svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out); } static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, STREAM* data_in) { - uint16 versionMajor; - uint16 versionMinor; - uint32 clientID; + UINT16 versionMajor; + UINT16 versionMinor; + UINT32 clientID; - stream_read_uint16(data_in, versionMajor); - stream_read_uint16(data_in, versionMinor); - stream_read_uint32(data_in, clientID); + stream_read_UINT16(data_in, versionMajor); + stream_read_UINT16(data_in, versionMinor); + stream_read_UINT32(data_in, clientID); if (versionMajor != rdpdr->versionMajor || versionMinor != rdpdr->versionMinor) { @@ -143,12 +147,12 @@ static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, STREAM* da } } -static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean user_loggedon) +static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL user_loggedon) { int i; int pos; - uint8 c; - uint32 count; + BYTE c; + UINT32 count; int data_len; int count_pos; STREAM* data_out; @@ -157,12 +161,12 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean data_out = stream_new(256); - stream_write_uint16(data_out, RDPDR_CTYP_CORE); - stream_write_uint16(data_out, PAKID_CORE_DEVICELIST_ANNOUNCE); + stream_write_UINT16(data_out, RDPDR_CTYP_CORE); + stream_write_UINT16(data_out, PAKID_CORE_DEVICELIST_ANNOUNCE); count_pos = stream_get_pos(data_out); count = 0; - stream_seek_uint32(data_out); /* deviceCount */ + stream_seek_UINT32(data_out); /* deviceCount */ for (item = rdpdr->devman->devices->head; item; item = item->next) { @@ -180,21 +184,21 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean data_len = (device->data == NULL ? 0 : stream_get_length(device->data)); stream_check_size(data_out, 20 + data_len); - stream_write_uint32(data_out, device->type); /* deviceType */ - stream_write_uint32(data_out, device->id); /* deviceID */ + stream_write_UINT32(data_out, device->type); /* deviceType */ + stream_write_UINT32(data_out, device->id); /* deviceID */ strncpy((char*) stream_get_tail(data_out), device->name, 8); for (i = 0; i < 8; i++) { - stream_peek_uint8(data_out, c); + stream_peek_BYTE(data_out, c); if (c > 0x7F) - stream_write_uint8(data_out, '_'); + stream_write_BYTE(data_out, '_'); else - stream_seek_uint8(data_out); + stream_seek_BYTE(data_out); } - stream_write_uint32(data_out, data_len); + stream_write_UINT32(data_out, data_len); if (data_len > 0) stream_write(data_out, stream_get_data(device->data), data_len); @@ -208,37 +212,37 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, boolean pos = stream_get_pos(data_out); stream_set_pos(data_out, count_pos); - stream_write_uint32(data_out, count); + stream_write_UINT32(data_out, count); stream_set_pos(data_out, pos); stream_seal(data_out); svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out); } -static boolean rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in) +static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, STREAM* data_in) { IRP* irp; irp = irp_new(rdpdr->devman, data_in); if (irp == NULL) - return false; + return FALSE; IFCALL(irp->device->IRPRequest, irp->device, irp); - return true; + return TRUE; } static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) { - uint16 component; - uint16 packetID; - uint32 deviceID; - uint32 status; + UINT16 component; + UINT16 packetID; + UINT32 deviceID; + UINT32 status; rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin; - stream_read_uint16(data_in, component); - stream_read_uint16(data_in, packetID); + stream_read_UINT16(data_in, component); + stream_read_UINT16(data_in, packetID); if (component == RDPDR_CTYP_CORE) { @@ -260,18 +264,18 @@ static void rdpdr_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) case PAKID_CORE_CLIENTID_CONFIRM: DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_CLIENTID_CONFIRM"); rdpdr_process_server_clientid_confirm(rdpdr, data_in); - rdpdr_send_device_list_announce_request(rdpdr, false); + rdpdr_send_device_list_announce_request(rdpdr, FALSE); break; case PAKID_CORE_USER_LOGGEDON: DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_USER_LOGGEDON"); - rdpdr_send_device_list_announce_request(rdpdr, true); + rdpdr_send_device_list_announce_request(rdpdr, TRUE); break; case PAKID_CORE_DEVICE_REPLY: /* connect to a specific resource */ - stream_read_uint32(data_in, deviceID); - stream_read_uint32(data_in, status); + stream_read_UINT32(data_in, deviceID); + stream_read_UINT32(data_in, status); DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_DEVICE_REPLY (deviceID=%d status=0x%08X)", deviceID, status); break; @@ -309,9 +313,32 @@ static void rdpdr_process_terminate(rdpSvcPlugin* plugin) rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin; devman_free(rdpdr->devman); - xfree(plugin); + free(plugin); } -DEFINE_SVC_PLUGIN(rdpdr, "rdpdr", - CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | - CHANNEL_OPTION_COMPRESS_RDP) +/* rdpdr is always built-in */ +#define VirtualChannelEntry rdpdr_VirtualChannelEntry + +const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) +{ + rdpdrPlugin* _p; + + _p = (rdpdrPlugin*) malloc(sizeof(rdpdrPlugin)); + ZeroMemory(_p, sizeof(rdpdrPlugin)); + + _p->plugin.channel_def.options = + CHANNEL_OPTION_INITIALIZED | + CHANNEL_OPTION_ENCRYPT_RDP | + CHANNEL_OPTION_COMPRESS_RDP; + + strcpy(_p->plugin.channel_def.name, "rdpdr"); + + _p->plugin.connect_callback = rdpdr_process_connect; + _p->plugin.receive_callback = rdpdr_process_receive; + _p->plugin.event_callback = rdpdr_process_event; + _p->plugin.terminate_callback = rdpdr_process_terminate; + + svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints); + + return 1; +} diff --git a/channels/rdpdr/client/rdpdr_main.h b/channels/rdpdr/client/rdpdr_main.h index af867fbf5..c988a3169 100644 --- a/channels/rdpdr/client/rdpdr_main.h +++ b/channels/rdpdr/client/rdpdr_main.h @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,24 +18,24 @@ * limitations under the License. */ -#ifndef __RDPDR_MAIN_H -#define __RDPDR_MAIN_H +#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H +#define FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H +#include #include -#include "rdpdr_types.h" - typedef struct rdpdr_plugin rdpdrPlugin; + struct rdpdr_plugin { rdpSvcPlugin plugin; DEVMAN* devman; - uint16 versionMajor; - uint16 versionMinor; - uint16 clientID; + UINT16 versionMajor; + UINT16 versionMinor; + UINT16 clientID; char computerName[256]; }; -#endif /* __RDPDR_MAIN_H */ +#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H */ diff --git a/channels/rdpdr/client/rdpdr_types.h b/channels/rdpdr/client/rdpdr_types.h deleted file mode 100644 index 1c8ba5b47..000000000 --- a/channels/rdpdr/client/rdpdr_types.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel - * - * Copyright 2010-2011 Marc-Andre Moreau - * Copyright 2010-2011 Vic Lee - * - * 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 __RDPDR_TYPES_H -#define __RDPDR_TYPES_H - -#include -#include -#include -#include - -#include -#include -#include - -typedef struct _DEVICE DEVICE; -typedef struct _IRP IRP; -typedef struct _DEVMAN DEVMAN; - -typedef void (*pcIRPRequest)(DEVICE* device, IRP* irp); -typedef void (*pcFreeDevice)(DEVICE* device); - -struct _DEVICE -{ - uint32 id; - - uint32 type; - char* name; - STREAM* data; - - pcIRPRequest IRPRequest; - pcFreeDevice Free; -}; - -typedef void (*pcIRPResponse)(IRP* irp); - -struct _IRP -{ - SLIST_ENTRY ItemEntry; - - DEVICE* device; - DEVMAN* devman; - uint32 FileId; - uint32 CompletionId; - uint32 MajorFunction; - uint32 MinorFunction; - STREAM* input; - - uint32 IoStatus; - STREAM* output; - - pcIRPResponse Complete; - pcIRPResponse Discard; -}; - -struct _DEVMAN -{ - rdpSvcPlugin* plugin; - uint32 id_sequence; /* generate unique device id */ - LIST* devices; -}; - -typedef void (*pcRegisterDevice)(DEVMAN* devman, DEVICE* device); - -struct _DEVICE_SERVICE_ENTRY_POINTS -{ - DEVMAN* devman; - - pcRegisterDevice RegisterDevice; - RDP_PLUGIN_DATA* plugin_data; -}; -typedef struct _DEVICE_SERVICE_ENTRY_POINTS DEVICE_SERVICE_ENTRY_POINTS; -typedef DEVICE_SERVICE_ENTRY_POINTS* PDEVICE_SERVICE_ENTRY_POINTS; - -typedef int (*PDEVICE_SERVICE_ENTRY)(PDEVICE_SERVICE_ENTRY_POINTS); - -#endif /* __RDPDR_TYPES_H */ diff --git a/channels/rdpdr/client/smartcard/CMakeLists.txt b/channels/rdpdr/client/smartcard/CMakeLists.txt deleted file mode 100644 index 7a8717a0a..000000000 --- a/channels/rdpdr/client/smartcard/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# FreeRDP: A Remote Desktop Protocol Client -# FreeRDP cmake build script -# -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau -# -# 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. - -set(SCARD_SRCS - scard_main.c - scard_operations.c -) - -include_directories(..) -include_directories(${PCSC_INCLUDE_DIRS}) - -add_library(scard ${SCARD_SRCS}) -set_target_properties(scard PROPERTIES PREFIX "") - -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(scard freerdp winpr) -else() - target_link_libraries(scard freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked) -endif() - -target_link_libraries(scard ${PCSC_LIBRARIES}) - -install(TARGETS scard DESTINATION ${FREERDP_PLUGIN_PATH}) diff --git a/channels/rdpsnd/CMakeLists.txt b/channels/rdpsnd/CMakeLists.txt index 14ce938d1..c5aa005cb 100644 --- a/channels/rdpsnd/CMakeLists.txt +++ b/channels/rdpsnd/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -20,6 +20,11 @@ set(MODULE_PREFIX "CHANNEL_RDPSND") if(WITH_CLIENT_CHANNELS) add_subdirectory(client) + if(${MODULE_PREFIX}_CLIENT_STATIC) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${MODULE_PREFIX} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_NAME ${${MODULE_PREFIX}_CLIENT_NAME} PARENT_SCOPE) + set(${MODULE_PREFIX}_CLIENT_ENTRY ${${MODULE_PREFIX}_CLIENT_ENTRY} PARENT_SCOPE) + endif() endif() if(WITH_SERVER_CHANNELS) diff --git a/channels/rdpsnd/client/CMakeLists.txt b/channels/rdpsnd/client/CMakeLists.txt index 745358da0..c24c0ca64 100644 --- a/channels/rdpsnd/client/CMakeLists.txt +++ b/channels/rdpsnd/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,20 +15,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(RDPSND_SRCS +set(MODULE_NAME "rdpsnd") +set(MODULE_PREFIX "CHANNEL_RDPSND_CLIENT") + +set(${MODULE_PREFIX}_SRCS rdpsnd_main.c rdpsnd_main.h) -add_library(rdpsnd ${RDPSND_SRCS}) -set_target_properties(rdpsnd PROPERTIES PREFIX "") +# rdpsnd is always built-in -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rdpsnd freerdp) +set(${MODULE_PREFIX}_STATIC ON PARENT_SCOPE) +set(${MODULE_PREFIX}_NAME ${MODULE_NAME} PARENT_SCOPE) +set(${MODULE_PREFIX}_ENTRY "VirtualChannelEntry" PARENT_SCOPE) + +add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(rdpsnd freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS rdpsnd DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") if(WITH_ALSA) add_subdirectory(alsa) @@ -41,6 +51,6 @@ if(WITH_PULSEAUDIO) endif() if(WITH_MACAUDIO) - add_subdirectory(mac_audio) + add_subdirectory(MacAudio) endif() diff --git a/channels/rdpsnd/client/mac_audio/CMakeLists.txt b/channels/rdpsnd/client/MacAudio/CMakeLists.txt similarity index 83% rename from channels/rdpsnd/client/mac_audio/CMakeLists.txt rename to channels/rdpsnd/client/MacAudio/CMakeLists.txt index 45b50548c..c5c375685 100644 --- a/channels/rdpsnd/client/mac_audio/CMakeLists.txt +++ b/channels/rdpsnd/client/MacAudio/CMakeLists.txt @@ -1,10 +1,8 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Laxmikant Rashinkar -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,7 +25,7 @@ include_directories(${MACAUDIO_INCLUDE_DIRS}) add_library(rdpsnd_macaudio ${RDPSND_MACAUDIO_SRCS}) set_target_properties(rdpsnd_macaudio PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(rdpsnd_macaudio freerdp) else() target_link_libraries(rdpsnd_macaudio freerdp-utils) diff --git a/channels/rdpsnd/client/mac_audio/rdpsnd_audio_q.c b/channels/rdpsnd/client/MacAudio/rdpsnd_audio_q.c similarity index 96% rename from channels/rdpsnd/client/mac_audio/rdpsnd_audio_q.c rename to channels/rdpsnd/client/MacAudio/rdpsnd_audio_q.c index f089588d9..477c90256 100644 --- a/channels/rdpsnd/client/mac_audio/rdpsnd_audio_q.c +++ b/channels/rdpsnd/client/MacAudio/rdpsnd_audio_q.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Output Virtual Channel * * Copyright 2012 Laxmikant Rashinkar @@ -125,7 +125,7 @@ static void rdpsnd_audio_free(rdpsndDevicePlugin* device) { } -static boolean rdpsnd_audio_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) +static BOOL rdpsnd_audio_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) { switch (format->wFormatTag) { @@ -146,11 +146,11 @@ static void rdpsnd_audio_set_format(rdpsndDevicePlugin* device, rdpsndFormat* fo { } -static void rdpsnd_audio_set_volume(rdpsndDevicePlugin* device, uint32 value) +static void rdpsnd_audio_set_volume(rdpsndDevicePlugin* device, UINT32 value) { } -static void rdpsnd_audio_play(rdpsndDevicePlugin* device, uint8* data, int size) +static void rdpsnd_audio_play(rdpsndDevicePlugin* device, BYTE* data, int size) { rdpsndAudioQPlugin* aq_plugin_p = (rdpsndAudioQPlugin *) device; AudioQueueBufferRef aq_buf_ref; diff --git a/channels/rdpsnd/client/alsa/CMakeLists.txt b/channels/rdpsnd/client/alsa/CMakeLists.txt index 1dbe268cf..1f9db48b2 100644 --- a/channels/rdpsnd/client/alsa/CMakeLists.txt +++ b/channels/rdpsnd/client/alsa/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -18,8 +18,7 @@ # limitations under the License. set(RDPSND_ALSA_SRCS - rdpsnd_alsa.c -) + rdpsnd_alsa.c) include_directories(..) include_directories(${ALSA_INCLUDE_DIRS}) @@ -27,10 +26,10 @@ include_directories(${ALSA_INCLUDE_DIRS}) add_library(rdpsnd_alsa ${RDPSND_ALSA_SRCS}) set_target_properties(rdpsnd_alsa PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(rdpsnd_alsa freerdp) +if(MONOLITHIC_BUILD) + target_link_libraries(rdpsnd_alsa freerdp winpr) else() - target_link_libraries(rdpsnd_alsa freerdp-utils) + target_link_libraries(rdpsnd_alsa freerdp-utils winpr-crt) endif() target_link_libraries(rdpsnd_alsa ${ALSA_LIBRARIES}) diff --git a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c index de66f56fd..8331b5e08 100644 --- a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c +++ b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Output Virtual Channel * * Copyright 2009-2011 Jay Sorg @@ -26,6 +26,8 @@ #include #include +#include + #include #include @@ -43,11 +45,11 @@ struct rdpsnd_alsa_plugin char* device_name; snd_pcm_t* out_handle; snd_mixer_t* mixer_handle; - uint32 source_rate; - uint32 actual_rate; + UINT32 source_rate; + UINT32 actual_rate; snd_pcm_format_t format; - uint32 source_channels; - uint32 actual_channels; + UINT32 source_channels; + UINT32 actual_channels; int bytes_per_channel; int wformat; int block_size; @@ -257,12 +259,12 @@ static void rdpsnd_alsa_free(rdpsndDevicePlugin* device) rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device; rdpsnd_alsa_close(device); - xfree(alsa->device_name); + free(alsa->device_name); freerdp_dsp_context_free(alsa->dsp_context); - xfree(alsa); + free(alsa); } -static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) +static BOOL rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) { switch (format->wFormatTag) { @@ -272,7 +274,7 @@ static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFo (format->wBitsPerSample == 8 || format->wBitsPerSample == 16) && (format->nChannels == 1 || format->nChannels == 2)) { - return true; + return TRUE; } break; @@ -282,14 +284,14 @@ static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFo format->wBitsPerSample == 4 && (format->nChannels == 1 || format->nChannels == 2)) { - return true; + return TRUE; } break; } - return false; + return FALSE; } -static void rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, uint32 value) +static void rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, UINT32 value) { long left; long right; @@ -319,16 +321,16 @@ static void rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, uint32 value) } } -static void rdpsnd_alsa_play(rdpsndDevicePlugin* device, uint8* data, int size) +static void rdpsnd_alsa_play(rdpsndDevicePlugin* device, BYTE* data, int size) { - uint8* src; + BYTE* src; int len; int status; int frames; int rbytes_per_frame; int sbytes_per_frame; - uint8* pindex; - uint8* end; + BYTE* pindex; + BYTE* end; rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*) device; if (alsa->out_handle == 0) @@ -434,12 +436,12 @@ int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints) if (data && strcmp((char*) data->data[0], "alsa") == 0) { - alsa->device_name = xstrdup((char*) data->data[1]); + alsa->device_name = _strdup((char*) data->data[1]); } if (alsa->device_name == NULL) { - alsa->device_name = xstrdup("default"); + alsa->device_name = _strdup("default"); } alsa->out_handle = 0; diff --git a/channels/rdpsnd/client/pulse/CMakeLists.txt b/channels/rdpsnd/client/pulse/CMakeLists.txt index 5ff96249f..73a29cda3 100644 --- a/channels/rdpsnd/client/pulse/CMakeLists.txt +++ b/channels/rdpsnd/client/pulse/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -26,7 +26,7 @@ include_directories(${PULSEAUDIO_INCLUDE_DIR}) add_library(rdpsnd_pulse ${RDPSND_PULSE_SRCS}) set_target_properties(rdpsnd_pulse PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(rdpsnd_pulse freerdp) else() target_link_libraries(rdpsnd_pulse freerdp-utils) diff --git a/channels/rdpsnd/client/pulse/rdpsnd_pulse.c b/channels/rdpsnd/client/pulse/rdpsnd_pulse.c index ee9fa1bac..4710eb88f 100644 --- a/channels/rdpsnd/client/pulse/rdpsnd_pulse.c +++ b/channels/rdpsnd/client/pulse/rdpsnd_pulse.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Output Virtual Channel * * Copyright 2011 Vic Lee @@ -25,7 +25,10 @@ #include #include +#include + #include + #include #include #include @@ -77,18 +80,18 @@ static void rdpsnd_pulse_context_state_callback(pa_context* context, void* userd } } -static boolean rdpsnd_pulse_connect(rdpsndDevicePlugin* device) +static BOOL rdpsnd_pulse_connect(rdpsndDevicePlugin* device) { pa_context_state_t state; rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*) device; if (!pulse->context) - return false; + return FALSE; if (pa_context_connect(pulse->context, NULL, 0, NULL)) { DEBUG_WARN("pa_context_connect failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } pa_threaded_mainloop_lock(pulse->mainloop); @@ -97,7 +100,7 @@ static boolean rdpsnd_pulse_connect(rdpsndDevicePlugin* device) { pa_threaded_mainloop_unlock(pulse->mainloop); DEBUG_WARN("pa_threaded_mainloop_start failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } for (;;) @@ -118,12 +121,12 @@ static boolean rdpsnd_pulse_connect(rdpsndDevicePlugin* device) if (state == PA_CONTEXT_READY) { DEBUG_SVC("connected"); - return true; + return TRUE; } else { pa_context_disconnect(pulse->context); - return false; + return FALSE; } } @@ -285,9 +288,9 @@ static void rdpsnd_pulse_open(rdpsndDevicePlugin* device, rdpsndFormat* format, { buffer_attr.maxlength = pa_usec_to_bytes(pulse->latency * 2 * 1000, &pulse->sample_spec); buffer_attr.tlength = pa_usec_to_bytes(pulse->latency * 1000, &pulse->sample_spec); - buffer_attr.prebuf = (uint32_t) -1; - buffer_attr.minreq = (uint32_t) -1; - buffer_attr.fragsize = (uint32_t) -1; + buffer_attr.prebuf = (UINT32_t) -1; + buffer_attr.minreq = (UINT32_t) -1; + buffer_attr.fragsize = (UINT32_t) -1; flags |= PA_STREAM_ADJUST_LATENCY; } @@ -357,17 +360,17 @@ static void rdpsnd_pulse_free(rdpsndDevicePlugin* device) pulse->mainloop = NULL; } - xfree(pulse->device_name); + free(pulse->device_name); freerdp_dsp_context_free(pulse->dsp_context); - xfree(pulse); + free(pulse); } -static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) +static BOOL rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) { rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device; if (!pulse->context) - return false; + return FALSE; switch (format->wFormatTag) { @@ -377,7 +380,7 @@ static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndF (format->wBitsPerSample == 8 || format->wBitsPerSample == 16) && (format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX)) { - return true; + return TRUE; } break; @@ -388,7 +391,7 @@ static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndF (format->wBitsPerSample == 8) && (format->nChannels >= 1 && format->nChannels <= PA_CHANNELS_MAX)) { - return true; + return TRUE; } break; @@ -398,11 +401,11 @@ static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndF (format->wBitsPerSample == 4) && (format->nChannels == 1 || format->nChannels == 2)) { - return true; + return TRUE; } break; } - return false; + return FALSE; } static void rdpsnd_pulse_set_format(rdpsndDevicePlugin* device, rdpsndFormat* format, int latency) @@ -421,7 +424,7 @@ static void rdpsnd_pulse_set_format(rdpsndDevicePlugin* device, rdpsndFormat* fo rdpsnd_pulse_open(device, format, latency); } -static void rdpsnd_pulse_set_volume(rdpsndDevicePlugin* device, uint32 value) +static void rdpsnd_pulse_set_volume(rdpsndDevicePlugin* device, UINT32 value) { pa_cvolume cv; pa_volume_t left; @@ -450,11 +453,11 @@ static void rdpsnd_pulse_set_volume(rdpsndDevicePlugin* device, uint32 value) pa_threaded_mainloop_unlock(pulse->mainloop); } -static void rdpsnd_pulse_play(rdpsndDevicePlugin* device, uint8* data, int size) +static void rdpsnd_pulse_play(rdpsndDevicePlugin* device, BYTE* data, int size) { int len; int ret; - uint8* src; + BYTE* src; rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*) device; if (!pulse->stream) @@ -541,7 +544,7 @@ int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints) if (data && strcmp((char*)data->data[0], "pulse") == 0) { if(data->data[1] && strlen((char*)data->data[1]) > 0) - pulse->device_name = xstrdup((char*)data->data[1]); + pulse->device_name = _strdup((char*)data->data[1]); else pulse->device_name = NULL; } diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index cdee38187..182457311 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Output Virtual Channel * * Copyright 2009-2011 Jay Sorg @@ -30,6 +30,8 @@ #include #include +#include + #include #include #include @@ -46,23 +48,23 @@ struct rdpsnd_plugin LIST* data_out_list; - uint8 cBlockNo; + BYTE cBlockNo; rdpsndFormat* supported_formats; int n_supported_formats; int current_format; - boolean expectingWave; - uint8 waveData[4]; - uint16 waveDataSize; - uint32 wTimeStamp; /* server timestamp */ - uint32 wave_timestamp; /* client timestamp */ + BOOL expectingWave; + BYTE waveData[4]; + UINT16 waveDataSize; + UINT32 wTimeStamp; /* server timestamp */ + UINT32 wave_timestamp; /* client timestamp */ - boolean is_open; - uint32 close_timestamp; + BOOL is_open; + UINT32 close_timestamp; - uint16 fixed_format; - uint16 fixed_channel; - uint32 fixed_rate; + UINT16 fixed_format; + UINT16 fixed_channel; + UINT32 fixed_rate; int latency; /* Device plugin */ @@ -72,11 +74,11 @@ struct rdpsnd_plugin struct data_out_item { STREAM* data_out; - uint32 out_timestamp; + UINT32 out_timestamp; }; /* get time in milliseconds */ -static uint32 get_mstime(void) +static UINT32 get_mstime(void) { struct timeval tp; @@ -89,7 +91,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin) { rdpsndPlugin* rdpsnd = (rdpsndPlugin*)plugin; struct data_out_item* item; - uint32 cur_time; + UINT32 cur_time; while (list_size(rdpsnd->data_out_list) > 0) { @@ -102,7 +104,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin) item = (struct data_out_item*) list_dequeue(rdpsnd->data_out_list); svc_plugin_send(plugin, item->data_out); - xfree(item); + free(item); DEBUG_SVC("processed data_out"); } @@ -115,7 +117,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin) { if (rdpsnd->device) IFCALL(rdpsnd->device->Close, rdpsnd->device); - rdpsnd->is_open = false; + rdpsnd->is_open = FALSE; rdpsnd->close_timestamp = 0; DEBUG_SVC("processed close"); @@ -130,11 +132,11 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin) static void rdpsnd_free_supported_formats(rdpsndPlugin* rdpsnd) { - uint16 i; + UINT16 i; for (i = 0; i < rdpsnd->n_supported_formats; i++) - xfree(rdpsnd->supported_formats[i].data); - xfree(rdpsnd->supported_formats); + free(rdpsnd->supported_formats[i].data); + free(rdpsnd->supported_formats); rdpsnd->supported_formats = NULL; rdpsnd->n_supported_formats = 0; @@ -144,27 +146,27 @@ static void rdpsnd_free_supported_formats(rdpsndPlugin* rdpsnd) of client supported formats */ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in) { - uint16 wNumberOfFormats; - uint16 nFormat; - uint16 wVersion; + UINT16 wNumberOfFormats; + UINT16 nFormat; + UINT16 wVersion; STREAM* data_out; rdpsndFormat* out_formats; - uint16 n_out_formats; + UINT16 n_out_formats; rdpsndFormat* format; - uint8* format_mark; - uint8* data_mark; + BYTE* format_mark; + BYTE* data_mark; int pos; rdpsnd_free_supported_formats(rdpsnd); - stream_seek_uint32(data_in); /* dwFlags */ - stream_seek_uint32(data_in); /* dwVolume */ - stream_seek_uint32(data_in); /* dwPitch */ - stream_seek_uint16(data_in); /* wDGramPort */ - stream_read_uint16(data_in, wNumberOfFormats); - stream_read_uint8(data_in, rdpsnd->cBlockNo); /* cLastBlockConfirmed */ - stream_read_uint16(data_in, wVersion); - stream_seek_uint8(data_in); /* bPad */ + stream_seek_UINT32(data_in); /* dwFlags */ + stream_seek_UINT32(data_in); /* dwVolume */ + stream_seek_UINT32(data_in); /* dwPitch */ + stream_seek_UINT16(data_in); /* wDGramPort */ + stream_read_UINT16(data_in, wNumberOfFormats); + stream_read_BYTE(data_in, rdpsnd->cBlockNo); /* cLastBlockConfirmed */ + stream_read_UINT16(data_in, wVersion); + stream_seek_BYTE(data_in); /* bPad */ DEBUG_SVC("wNumberOfFormats %d wVersion %d", wNumberOfFormats, wVersion); if (wNumberOfFormats < 1) @@ -177,29 +179,29 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in n_out_formats = 0; data_out = stream_new(24); - stream_write_uint8(data_out, SNDC_FORMATS); /* msgType */ - stream_write_uint8(data_out, 0); /* bPad */ - stream_seek_uint16(data_out); /* BodySize */ - stream_write_uint32(data_out, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */ - stream_write_uint32(data_out, 0xFFFFFFFF); /* dwVolume */ - stream_write_uint32(data_out, 0); /* dwPitch */ - stream_write_uint16_be(data_out, 0); /* wDGramPort */ - stream_seek_uint16(data_out); /* wNumberOfFormats */ - stream_write_uint8(data_out, 0); /* cLastBlockConfirmed */ - stream_write_uint16(data_out, 6); /* wVersion */ - stream_write_uint8(data_out, 0); /* bPad */ + stream_write_BYTE(data_out, SNDC_FORMATS); /* msgType */ + stream_write_BYTE(data_out, 0); /* bPad */ + stream_seek_UINT16(data_out); /* BodySize */ + stream_write_UINT32(data_out, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */ + stream_write_UINT32(data_out, 0xFFFFFFFF); /* dwVolume */ + stream_write_UINT32(data_out, 0); /* dwPitch */ + stream_write_UINT16_be(data_out, 0); /* wDGramPort */ + stream_seek_UINT16(data_out); /* wNumberOfFormats */ + stream_write_BYTE(data_out, 0); /* cLastBlockConfirmed */ + stream_write_UINT16(data_out, 6); /* wVersion */ + stream_write_BYTE(data_out, 0); /* bPad */ for (nFormat = 0; nFormat < wNumberOfFormats; nFormat++) { stream_get_mark(data_in, format_mark); format = &out_formats[n_out_formats]; - stream_read_uint16(data_in, format->wFormatTag); - stream_read_uint16(data_in, format->nChannels); - stream_read_uint32(data_in, format->nSamplesPerSec); - stream_seek_uint32(data_in); /* nAvgBytesPerSec */ - stream_read_uint16(data_in, format->nBlockAlign); - stream_read_uint16(data_in, format->wBitsPerSample); - stream_read_uint16(data_in, format->cbSize); + stream_read_UINT16(data_in, format->wFormatTag); + stream_read_UINT16(data_in, format->nChannels); + stream_read_UINT32(data_in, format->nSamplesPerSec); + stream_seek_UINT32(data_in); /* nAvgBytesPerSec */ + stream_read_UINT16(data_in, format->nBlockAlign); + stream_read_UINT16(data_in, format->wBitsPerSample); + stream_read_UINT16(data_in, format->cbSize); stream_get_mark(data_in, data_mark); stream_seek(data_in, format->cbSize); format->data = NULL; @@ -222,7 +224,7 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in stream_write(data_out, format_mark, 18 + format->cbSize); if (format->cbSize > 0) { - format->data = xmalloc(format->cbSize); + format->data = malloc(format->cbSize); memcpy(format->data, data_mark, format->cbSize); } n_out_formats++; @@ -236,15 +238,15 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in } else { - xfree(out_formats); + free(out_formats); DEBUG_WARN("no formats supported"); } pos = stream_get_pos(data_out); stream_set_pos(data_out, 2); - stream_write_uint16(data_out, pos - 4); + stream_write_UINT16(data_out, pos - 4); stream_set_pos(data_out, 18); - stream_write_uint16(data_out, n_out_formats); + stream_write_UINT16(data_out, n_out_formats); stream_set_pos(data_out, pos); svc_plugin_send((rdpSvcPlugin*)rdpsnd, data_out); @@ -252,11 +254,11 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in if (wVersion >= 6) { data_out = stream_new(8); - stream_write_uint8(data_out, SNDC_QUALITYMODE); /* msgType */ - stream_write_uint8(data_out, 0); /* bPad */ - stream_write_uint16(data_out, 4); /* BodySize */ - stream_write_uint16(data_out, HIGH_QUALITY); /* wQualityMode */ - stream_write_uint16(data_out, 0); /* Reserved */ + stream_write_BYTE(data_out, SNDC_QUALITYMODE); /* msgType */ + stream_write_BYTE(data_out, 0); /* bPad */ + stream_write_UINT16(data_out, 4); /* BodySize */ + stream_write_UINT16(data_out, HIGH_QUALITY); /* wQualityMode */ + stream_write_UINT16(data_out, 0); /* Reserved */ svc_plugin_send((rdpSvcPlugin*)rdpsnd, data_out); } @@ -265,35 +267,35 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in /* server is getting a feel of the round trip time */ static void rdpsnd_process_message_training(rdpsndPlugin* rdpsnd, STREAM* data_in) { - uint16 wTimeStamp; - uint16 wPackSize; + UINT16 wTimeStamp; + UINT16 wPackSize; STREAM* data_out; - stream_read_uint16(data_in, wTimeStamp); - stream_read_uint16(data_in, wPackSize); + stream_read_UINT16(data_in, wTimeStamp); + stream_read_UINT16(data_in, wPackSize); data_out = stream_new(8); - stream_write_uint8(data_out, SNDC_TRAINING); /* msgType */ - stream_write_uint8(data_out, 0); /* bPad */ - stream_write_uint16(data_out, 4); /* BodySize */ - stream_write_uint16(data_out, wTimeStamp); - stream_write_uint16(data_out, wPackSize); + stream_write_BYTE(data_out, SNDC_TRAINING); /* msgType */ + stream_write_BYTE(data_out, 0); /* bPad */ + stream_write_UINT16(data_out, 4); /* BodySize */ + stream_write_UINT16(data_out, wTimeStamp); + stream_write_UINT16(data_out, wPackSize); svc_plugin_send((rdpSvcPlugin*)rdpsnd, data_out); } -static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_in, uint16 BodySize) +static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_in, UINT16 BodySize) { - uint16 wFormatNo; + UINT16 wFormatNo; - stream_read_uint16(data_in, rdpsnd->wTimeStamp); - stream_read_uint16(data_in, wFormatNo); - stream_read_uint8(data_in, rdpsnd->cBlockNo); + stream_read_UINT16(data_in, rdpsnd->wTimeStamp); + stream_read_UINT16(data_in, wFormatNo); + stream_read_BYTE(data_in, rdpsnd->cBlockNo); stream_seek(data_in, 3); /* bPad */ stream_read(data_in, rdpsnd->waveData, 4); rdpsnd->waveDataSize = BodySize - 8; rdpsnd->wave_timestamp = get_mstime(); - rdpsnd->expectingWave = true; + rdpsnd->expectingWave = TRUE; DEBUG_SVC("waveDataSize %d wFormatNo %d", rdpsnd->waveDataSize, wFormatNo); @@ -301,7 +303,7 @@ static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_ if (!rdpsnd->is_open) { rdpsnd->current_format = wFormatNo; - rdpsnd->is_open = true; + rdpsnd->is_open = TRUE; if (rdpsnd->device) IFCALL(rdpsnd->device->Open, rdpsnd->device, &rdpsnd->supported_formats[wFormatNo], rdpsnd->latency); @@ -318,9 +320,9 @@ static void rdpsnd_process_message_wave_info(rdpsndPlugin* rdpsnd, STREAM* data_ /* header is not removed from data in this function */ static void rdpsnd_process_message_wave(rdpsndPlugin* rdpsnd, STREAM* data_in) { - uint16 wTimeStamp; - uint32 delay_ms; - uint32 process_ms; + UINT16 wTimeStamp; + UINT32 delay_ms; + UINT32 process_ms; struct data_out_item* item; rdpsnd->expectingWave = 0; @@ -342,12 +344,12 @@ static void rdpsnd_process_message_wave(rdpsndPlugin* rdpsnd, STREAM* data_in) item = xnew(struct data_out_item); item->data_out = stream_new(8); - stream_write_uint8(item->data_out, SNDC_WAVECONFIRM); - stream_write_uint8(item->data_out, 0); - stream_write_uint16(item->data_out, 4); - stream_write_uint16(item->data_out, wTimeStamp); - stream_write_uint8(item->data_out, rdpsnd->cBlockNo); /* cConfirmedBlockNo */ - stream_write_uint8(item->data_out, 0); /* bPad */ + stream_write_BYTE(item->data_out, SNDC_WAVECONFIRM); + stream_write_BYTE(item->data_out, 0); + stream_write_UINT16(item->data_out, 4); + stream_write_UINT16(item->data_out, wTimeStamp); + stream_write_BYTE(item->data_out, rdpsnd->cBlockNo); /* cConfirmedBlockNo */ + stream_write_BYTE(item->data_out, 0); /* bPad */ item->out_timestamp = rdpsnd->wave_timestamp + delay_ms; list_enqueue(rdpsnd->data_out_list, item); @@ -365,9 +367,9 @@ static void rdpsnd_process_message_close(rdpsndPlugin* rdpsnd) static void rdpsnd_process_message_setvolume(rdpsndPlugin* rdpsnd, STREAM* data_in) { - uint32 dwVolume; + UINT32 dwVolume; - stream_read_uint32(data_in, dwVolume); + stream_read_UINT32(data_in, dwVolume); DEBUG_SVC("dwVolume 0x%X", dwVolume); if (rdpsnd->device) IFCALL(rdpsnd->device->SetVolume, rdpsnd->device, dwVolume); @@ -376,8 +378,8 @@ static void rdpsnd_process_message_setvolume(rdpsndPlugin* rdpsnd, STREAM* data_ static void rdpsnd_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) { rdpsndPlugin* rdpsnd = (rdpsndPlugin*)plugin; - uint8 msgType; - uint16 BodySize; + BYTE msgType; + UINT16 BodySize; if (rdpsnd->expectingWave) { @@ -386,9 +388,9 @@ static void rdpsnd_process_receive(rdpSvcPlugin* plugin, STREAM* data_in) return; } - stream_read_uint8(data_in, msgType); /* msgType */ - stream_seek_uint8(data_in); /* bPad */ - stream_read_uint16(data_in, BodySize); + stream_read_BYTE(data_in, msgType); /* msgType */ + stream_seek_BYTE(data_in); /* bPad */ + stream_read_UINT16(data_in, BodySize); DEBUG_SVC("msgType %d BodySize %d", msgType, BodySize); @@ -427,7 +429,7 @@ static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlug rdpsnd->device = device; } -static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, RDP_PLUGIN_DATA* data) +static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, RDP_PLUGIN_DATA* data) { FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints; PFREERDP_RDPSND_DEVICE_ENTRY entry; @@ -441,11 +443,11 @@ static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, strcpy(fullname, "rdpsnd_"); strcat(fullname, name); entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_plugin(fullname, RDPSND_DEVICE_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) { - return false; + return FALSE; } entryPoints.rdpsnd = rdpsnd; @@ -454,9 +456,9 @@ static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, if (entry(&entryPoints) != 0) { DEBUG_WARN("%s entry returns error.", name); - return false; + return FALSE; } - return true; + return TRUE; } static void rdpsnd_process_plugin_data(rdpsndPlugin* rdpsnd, RDP_PLUGIN_DATA* data) @@ -501,7 +503,7 @@ static void rdpsnd_process_connect(rdpSvcPlugin* plugin) while (data && data->size > 0) { rdpsnd_process_plugin_data(rdpsnd, data); - data = (RDP_PLUGIN_DATA*) (((uint8*) data) + data->size); + data = (RDP_PLUGIN_DATA*) (((BYTE*) data) + data->size); } if (rdpsnd->device == NULL) @@ -554,15 +556,37 @@ static void rdpsnd_process_terminate(rdpSvcPlugin* plugin) while ((item = list_dequeue(rdpsnd->data_out_list)) != NULL) { stream_free(item->data_out); - xfree(item); + free(item); } list_free(rdpsnd->data_out_list); rdpsnd_free_supported_formats(rdpsnd); - xfree(plugin); + free(plugin); } -DEFINE_SVC_PLUGIN(rdpsnd, "rdpsnd", - CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP) +/* rdpsnd is always built-in */ +#define VirtualChannelEntry rdpsnd_VirtualChannelEntry +const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) +{ + rdpsndPlugin* _p; + + _p = (rdpsndPlugin*) malloc(sizeof(rdpsndPlugin)); + ZeroMemory(_p, sizeof(rdpsndPlugin)); + + _p->plugin.channel_def.options = + CHANNEL_OPTION_INITIALIZED | + CHANNEL_OPTION_ENCRYPT_RDP; + + strcpy(_p->plugin.channel_def.name, "rdpsnd"); + + _p->plugin.connect_callback = rdpsnd_process_connect; + _p->plugin.receive_callback = rdpsnd_process_receive; + _p->plugin.event_callback = rdpsnd_process_event; + _p->plugin.terminate_callback = rdpsnd_process_terminate; + + svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints); + + return 1; +} diff --git a/channels/rdpsnd/client/rdpsnd_main.h b/channels/rdpsnd/client/rdpsnd_main.h index c8c402e1e..d92bdafe3 100644 --- a/channels/rdpsnd/client/rdpsnd_main.h +++ b/channels/rdpsnd/client/rdpsnd_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Output Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -26,11 +26,11 @@ typedef struct rdpsnd_plugin rdpsndPlugin; typedef struct rdpsnd_device_plugin rdpsndDevicePlugin; -typedef boolean (*pcFormatSupported) (rdpsndDevicePlugin* device, rdpsndFormat* format); +typedef BOOL (*pcFormatSupported) (rdpsndDevicePlugin* device, rdpsndFormat* format); typedef void (*pcOpen) (rdpsndDevicePlugin* device, rdpsndFormat* format, int latency); typedef void (*pcSetFormat) (rdpsndDevicePlugin* device, rdpsndFormat* format, int latency); -typedef void (*pcSetVolume) (rdpsndDevicePlugin* device, uint32 value); -typedef void (*pcPlay) (rdpsndDevicePlugin* device, uint8* data, int size); +typedef void (*pcSetVolume) (rdpsndDevicePlugin* device, UINT32 value); +typedef void (*pcPlay) (rdpsndDevicePlugin* device, BYTE* data, int size); typedef void (*pcStart) (rdpsndDevicePlugin* device); typedef void (*pcClose) (rdpsndDevicePlugin* device); typedef void (*pcFree) (rdpsndDevicePlugin* device); diff --git a/channels/rdpsnd/server/CMakeLists.txt b/channels/rdpsnd/server/CMakeLists.txt index 2e680b46e..c10a5b9dc 100644 --- a/channels/rdpsnd/server/CMakeLists.txt +++ b/channels/rdpsnd/server/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,15 +15,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "rdpsnd") set(MODULE_PREFIX "CHANNEL_RDPSND_SERVER") set(${MODULE_PREFIX}_SRCS rdpsnd.c PARENT_SCOPE) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS freerdp PARENT_SCOPE) else() set(${MODULE_PREFIX}_LIBS freerdp-utils PARENT_SCOPE) endif() +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Server") + diff --git a/channels/rdpsnd/server/rdpsnd.c b/channels/rdpsnd/server/rdpsnd.c index 61a080a20..c4f261751 100644 --- a/channels/rdpsnd/server/rdpsnd.c +++ b/channels/rdpsnd/server/rdpsnd.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Server Audio Virtual Channel * * Copyright 2012 Vic Lee @@ -42,61 +42,64 @@ typedef struct _rdpsnd_server STREAM* rdpsnd_pdu; FREERDP_DSP_CONTEXT* dsp_context; - uint8* out_buffer; + BYTE* out_buffer; int out_buffer_size; int out_frames; int out_pending_frames; - uint32 src_bytes_per_sample; - uint32 src_bytes_per_frame; + UINT32 src_bytes_per_sample; + UINT32 src_bytes_per_frame; } rdpsnd_server; #define RDPSND_PDU_INIT(_s, _msgType) \ { \ - stream_write_uint8(_s, _msgType); \ - stream_write_uint8(_s, 0); \ - stream_seek_uint16(_s); \ + stream_write_BYTE(_s, _msgType); \ + stream_write_BYTE(_s, 0); \ + stream_seek_UINT16(_s); \ } #define RDPSND_PDU_FINISH(_s) \ { \ - boolean _r; \ + BOOL _r; \ int _pos; \ _pos = stream_get_pos(_s); \ stream_set_pos(_s, 2); \ - stream_write_uint16(_s, _pos - 4); \ + stream_write_UINT16(_s, _pos - 4); \ stream_set_pos(_s, _pos); \ _r = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(_s), stream_get_length(_s), NULL); \ stream_set_pos(_s, 0); \ return _r; \ } -static boolean rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s) +static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s) { - uint16 i; + UINT16 i; RDPSND_PDU_INIT(s, SNDC_FORMATS); - stream_write_uint32(s, 0); /* dwFlags */ - stream_write_uint32(s, 0); /* dwVolume */ - stream_write_uint32(s, 0); /* dwPitch */ - stream_write_uint16(s, 0); /* wDGramPort */ - stream_write_uint16(s, rdpsnd->context.num_server_formats); /* wNumberOfFormats */ - stream_write_uint8(s, rdpsnd->context.block_no); /* cLastBlockConfirmed */ - stream_write_uint16(s, 0x06); /* wVersion */ - stream_write_uint8(s, 0); /* bPad */ + stream_write_UINT32(s, 0); /* dwFlags */ + stream_write_UINT32(s, 0); /* dwVolume */ + stream_write_UINT32(s, 0); /* dwPitch */ + stream_write_UINT16(s, 0); /* wDGramPort */ + stream_write_UINT16(s, rdpsnd->context.num_server_formats); /* wNumberOfFormats */ + stream_write_BYTE(s, rdpsnd->context.block_no); /* cLastBlockConfirmed */ + stream_write_UINT16(s, 0x06); /* wVersion */ + stream_write_BYTE(s, 0); /* bPad */ for (i = 0; i < rdpsnd->context.num_server_formats; i++) { - stream_write_uint16(s, rdpsnd->context.server_formats[i].wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */ - stream_write_uint16(s, rdpsnd->context.server_formats[i].nChannels); /* nChannels */ - stream_write_uint32(s, rdpsnd->context.server_formats[i].nSamplesPerSec); /* nSamplesPerSec */ - stream_write_uint32(s, rdpsnd->context.server_formats[i].nSamplesPerSec * + stream_write_UINT16(s, rdpsnd->context.server_formats[i].wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */ + stream_write_UINT16(s, rdpsnd->context.server_formats[i].nChannels); /* nChannels */ + stream_write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec); /* nSamplesPerSec */ + + stream_write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec * rdpsnd->context.server_formats[i].nChannels * rdpsnd->context.server_formats[i].wBitsPerSample / 8); /* nAvgBytesPerSec */ - stream_write_uint16(s, rdpsnd->context.server_formats[i].nBlockAlign); /* nBlockAlign */ - stream_write_uint16(s, rdpsnd->context.server_formats[i].wBitsPerSample); /* wBitsPerSample */ - stream_write_uint16(s, rdpsnd->context.server_formats[i].cbSize); /* cbSize */ + + stream_write_UINT16(s, rdpsnd->context.server_formats[i].nBlockAlign); /* nBlockAlign */ + stream_write_UINT16(s, rdpsnd->context.server_formats[i].wBitsPerSample); /* wBitsPerSample */ + stream_write_UINT16(s, rdpsnd->context.server_formats[i].cbSize); /* cbSize */ + if (rdpsnd->context.server_formats[i].cbSize > 0) { stream_write(s, rdpsnd->context.server_formats[i].data, rdpsnd->context.server_formats[i].cbSize); @@ -106,21 +109,21 @@ static boolean rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s) RDPSND_PDU_FINISH(s); } -static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) +static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) { int i; if (stream_get_left(s) < 20) - return false; + return FALSE; - stream_seek_uint32(s); /* dwFlags */ - stream_seek_uint32(s); /* dwVolume */ - stream_seek_uint32(s); /* dwPitch */ - stream_seek_uint16(s); /* wDGramPort */ - stream_read_uint16(s, rdpsnd->context.num_client_formats); /* wNumberOfFormats */ - stream_seek_uint8(s); /* cLastBlockConfirmed */ - stream_seek_uint16(s); /* wVersion */ - stream_seek_uint8(s); /* bPad */ + stream_seek_UINT32(s); /* dwFlags */ + stream_seek_UINT32(s); /* dwVolume */ + stream_seek_UINT32(s); /* dwPitch */ + stream_seek_UINT16(s); /* wDGramPort */ + stream_read_UINT16(s, rdpsnd->context.num_client_formats); /* wNumberOfFormats */ + stream_seek_BYTE(s); /* cLastBlockConfirmed */ + stream_seek_UINT16(s); /* wVersion */ + stream_seek_BYTE(s); /* bPad */ if (rdpsnd->context.num_client_formats > 0) { @@ -130,18 +133,18 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) { if (stream_get_left(s) < 18) { - xfree(rdpsnd->context.client_formats); + free(rdpsnd->context.client_formats); rdpsnd->context.client_formats = NULL; - return false; + return FALSE; } - stream_read_uint16(s, rdpsnd->context.client_formats[i].wFormatTag); - stream_read_uint16(s, rdpsnd->context.client_formats[i].nChannels); - stream_read_uint32(s, rdpsnd->context.client_formats[i].nSamplesPerSec); - stream_seek_uint32(s); /* nAvgBytesPerSec */ - stream_read_uint16(s, rdpsnd->context.client_formats[i].nBlockAlign); - stream_read_uint16(s, rdpsnd->context.client_formats[i].wBitsPerSample); - stream_read_uint16(s, rdpsnd->context.client_formats[i].cbSize); + stream_read_UINT16(s, rdpsnd->context.client_formats[i].wFormatTag); + stream_read_UINT16(s, rdpsnd->context.client_formats[i].nChannels); + stream_read_UINT32(s, rdpsnd->context.client_formats[i].nSamplesPerSec); + stream_seek_UINT32(s); /* nAvgBytesPerSec */ + stream_read_UINT16(s, rdpsnd->context.client_formats[i].nBlockAlign); + stream_read_UINT16(s, rdpsnd->context.client_formats[i].wBitsPerSample); + stream_read_UINT16(s, rdpsnd->context.client_formats[i].cbSize); if (rdpsnd->context.client_formats[i].cbSize > 0) { @@ -150,7 +153,7 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) } } - return true; + return TRUE; } static void* rdpsnd_server_thread_func(void* arg) @@ -158,13 +161,13 @@ static void* rdpsnd_server_thread_func(void* arg) void* fd; STREAM* s; void* buffer; - uint8 msgType; - uint16 BodySize; - uint32 bytes_returned = 0; + BYTE msgType; + UINT16 BodySize; + UINT32 bytes_returned = 0; rdpsnd_server* rdpsnd = (rdpsnd_server*) arg; freerdp_thread* thread = rdpsnd->rdpsnd_channel_thread; - if (WTSVirtualChannelQuery(rdpsnd->rdpsnd_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == true) + if (WTSVirtualChannelQuery(rdpsnd->rdpsnd_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE) { fd = *((void**)buffer); WTSFreeMemory(buffer); @@ -185,7 +188,7 @@ static void* rdpsnd_server_thread_func(void* arg) stream_set_pos(s, 0); if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s), - stream_get_size(s), &bytes_returned) == false) + stream_get_size(s), &bytes_returned) == FALSE) { if (bytes_returned == 0) break; @@ -193,13 +196,13 @@ static void* rdpsnd_server_thread_func(void* arg) stream_check_size(s, (int) bytes_returned); if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s), - stream_get_size(s), &bytes_returned) == false) + stream_get_size(s), &bytes_returned) == FALSE) break; } - stream_read_uint8(s, msgType); - stream_seek_uint8(s); /* bPad */ - stream_read_uint16(s, BodySize); + stream_read_BYTE(s, msgType); + stream_seek_BYTE(s); /* bPad */ + stream_read_UINT16(s, BodySize); if (BodySize + 4 > (int) bytes_returned) continue; @@ -223,7 +226,7 @@ static void* rdpsnd_server_thread_func(void* arg) return 0; } -static boolean rdpsnd_server_initialize(rdpsnd_server_context* context) +static BOOL rdpsnd_server_initialize(rdpsnd_server_context* context) { rdpsnd_server* rdpsnd = (rdpsnd_server*) context; @@ -235,11 +238,11 @@ static boolean rdpsnd_server_initialize(rdpsnd_server_context* context) rdpsnd->rdpsnd_channel_thread = freerdp_thread_new(); freerdp_thread_start(rdpsnd->rdpsnd_channel_thread, rdpsnd_server_thread_func, rdpsnd); - return true; + return TRUE; } else { - return false; + return FALSE; } } @@ -287,28 +290,29 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie if (rdpsnd->out_buffer_size < out_buffer_size) { - rdpsnd->out_buffer = xrealloc(rdpsnd->out_buffer, out_buffer_size); + rdpsnd->out_buffer = realloc(rdpsnd->out_buffer, out_buffer_size); rdpsnd->out_buffer_size = out_buffer_size; } freerdp_dsp_context_reset_adpcm(rdpsnd->dsp_context); } -static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd) +static BOOL rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd) { - STREAM* s = rdpsnd->rdpsnd_pdu; - rdpsndFormat* format; - int tbytes_per_frame; - uint8* src; int size; + BOOL r; + BYTE* src; int frames; int fill_size; - boolean r; + rdpsndFormat* format; + int tbytes_per_frame; + STREAM* s = rdpsnd->rdpsnd_pdu; format = &rdpsnd->context.client_formats[rdpsnd->context.selected_client_format]; tbytes_per_frame = format->nChannels * rdpsnd->src_bytes_per_sample; - if (format->nSamplesPerSec == rdpsnd->context.src_format.nSamplesPerSec && format->nChannels == rdpsnd->context.src_format.nChannels) + if ((format->nSamplesPerSec == rdpsnd->context.src_format.nSamplesPerSec) && + (format->nChannels == rdpsnd->context.src_format.nChannels)) { src = rdpsnd->out_buffer; frames = rdpsnd->out_pending_frames; @@ -349,13 +353,13 @@ static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd) /* WaveInfo PDU */ stream_set_pos(s, 0); - stream_write_uint8(s, SNDC_WAVE); /* msgType */ - stream_write_uint8(s, 0); /* bPad */ - stream_write_uint16(s, size + fill_size + 8); /* BodySize */ + stream_write_BYTE(s, SNDC_WAVE); /* msgType */ + stream_write_BYTE(s, 0); /* bPad */ + stream_write_UINT16(s, size + fill_size + 8); /* BodySize */ - stream_write_uint16(s, 0); /* wTimeStamp */ - stream_write_uint16(s, rdpsnd->context.selected_client_format); /* wFormatNo */ - stream_write_uint8(s, rdpsnd->context.block_no); /* cBlockNo */ + stream_write_UINT16(s, 0); /* wTimeStamp */ + stream_write_UINT16(s, rdpsnd->context.selected_client_format); /* wFormatNo */ + stream_write_BYTE(s, rdpsnd->context.block_no); /* cBlockNo */ stream_seek(s, 3); /* bPad */ stream_write(s, src, 4); @@ -364,8 +368,9 @@ static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd) /* Wave PDU */ stream_check_size(s, size + fill_size); - stream_write_uint32(s, 0); /* bPad */ + stream_write_UINT32(s, 0); /* bPad */ stream_write(s, src + 4, size - 4); + if (fill_size > 0) stream_write_zero(s, fill_size); @@ -377,60 +382,60 @@ static boolean rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd) return r; } -static boolean rdpsnd_server_send_samples(rdpsnd_server_context* context, const void* buf, int nframes) +static BOOL rdpsnd_server_send_samples(rdpsnd_server_context* context, const void* buf, int nframes) { int cframes; int cframesize; rdpsnd_server* rdpsnd = (rdpsnd_server*) context; if (rdpsnd->context.selected_client_format < 0) - return false; + return FALSE; while (nframes > 0) { cframes = MIN(nframes, rdpsnd->out_frames - rdpsnd->out_pending_frames); cframesize = cframes * rdpsnd->src_bytes_per_frame; - memcpy(rdpsnd->out_buffer + (rdpsnd->out_pending_frames * rdpsnd->src_bytes_per_frame), - buf, cframesize); - buf = (uint8*)buf + cframesize; + + memcpy(rdpsnd->out_buffer + (rdpsnd->out_pending_frames * rdpsnd->src_bytes_per_frame), buf, cframesize); + buf = (BYTE*) buf + cframesize; nframes -= cframes; rdpsnd->out_pending_frames += cframes; if (rdpsnd->out_pending_frames >= rdpsnd->out_frames) { if (!rdpsnd_server_send_audio_pdu(rdpsnd)) - return false; + return FALSE; } } - return true; + return TRUE; } -static boolean rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, int right) +static BOOL rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, int right) { rdpsnd_server* rdpsnd = (rdpsnd_server*) context; STREAM* s = rdpsnd->rdpsnd_pdu; RDPSND_PDU_INIT(s, SNDC_SETVOLUME); - stream_write_uint16(s, left); - stream_write_uint16(s, right); + stream_write_UINT16(s, left); + stream_write_UINT16(s, right); RDPSND_PDU_FINISH(s); } -static boolean rdpsnd_server_close(rdpsnd_server_context* context) +static BOOL rdpsnd_server_close(rdpsnd_server_context* context) { rdpsnd_server* rdpsnd = (rdpsnd_server*) context; STREAM* s = rdpsnd->rdpsnd_pdu; if (rdpsnd->context.selected_client_format < 0) - return false; + return FALSE; if (rdpsnd->out_pending_frames > 0) { if (!rdpsnd_server_send_audio_pdu(rdpsnd)) - return false; + return FALSE; } rdpsnd->context.selected_client_format = -1; @@ -466,15 +471,21 @@ void rdpsnd_server_context_free(rdpsnd_server_context* context) freerdp_thread_stop(rdpsnd->rdpsnd_channel_thread); freerdp_thread_free(rdpsnd->rdpsnd_channel_thread); } + if (rdpsnd->rdpsnd_channel) WTSVirtualChannelClose(rdpsnd->rdpsnd_channel); + if (rdpsnd->rdpsnd_pdu) stream_free(rdpsnd->rdpsnd_pdu); + if (rdpsnd->out_buffer) - xfree(rdpsnd->out_buffer); + free(rdpsnd->out_buffer); + if (rdpsnd->dsp_context) freerdp_dsp_context_free(rdpsnd->dsp_context); + if (rdpsnd->context.client_formats) - xfree(rdpsnd->context.client_formats); - xfree(rdpsnd); + free(rdpsnd->context.client_formats); + + free(rdpsnd); } diff --git a/channels/sample/CMakeLists.txt b/channels/sample/CMakeLists.txt index 676de4e85..65f8452a1 100644 --- a/channels/sample/CMakeLists.txt +++ b/channels/sample/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau diff --git a/channels/sample/client/CMakeLists.txt b/channels/sample/client/CMakeLists.txt index 1c2943c8f..f3d2c6540 100644 --- a/channels/sample/client/CMakeLists.txt +++ b/channels/sample/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,17 +15,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(SKEL_SRCS +set(MODULE_NAME "sample") +set(MODULE_PREFIX "CHANNEL_SAMPLE_CLIENT") + +set(${MODULE_PREFIX}_SRCS skel_main.c skel_main.h) -add_library(skel ${SKEL_SRCS}) -set_target_properties(skel PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(skel freerdp) +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(skel freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS skel DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) diff --git a/channels/sample/client/skel_main.c b/channels/sample/client/skel_main.c index 5fbd92611..f9841de05 100644 --- a/channels/sample/client/skel_main.c +++ b/channels/sample/client/skel_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Output Virtual Channel * * Copyright 2009-2012 Jay Sorg @@ -129,7 +129,7 @@ static void skel_process_terminate(rdpSvcPlugin* plugin) /* put your cleanup here */ - xfree(plugin); + free(plugin); } DEFINE_SVC_PLUGIN(skel, "skel", diff --git a/channels/sample/client/skel_main.h b/channels/sample/client/skel_main.h index 582e48a5a..2402c0acd 100644 --- a/channels/sample/client/skel_main.h +++ b/channels/sample/client/skel_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Output Virtual Channel * * Copyright 2012 Jay Sorg diff --git a/channels/serial/CMakeLists.txt b/channels/serial/CMakeLists.txt new file mode 100644 index 000000000..65f8452a1 --- /dev/null +++ b/channels/serial/CMakeLists.txt @@ -0,0 +1,21 @@ +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +if(WITH_CLIENT_CHANNELS) + add_subdirectory(client) +endif() + diff --git a/channels/serial/ChannelOptions.cmake b/channels/serial/ChannelOptions.cmake new file mode 100644 index 000000000..232f123db --- /dev/null +++ b/channels/serial/ChannelOptions.cmake @@ -0,0 +1,14 @@ + +set(CHANNEL_TYPE "device") +set(CHANNEL_SHORT_NAME "serial") +set(CHANNEL_LONG_NAME "Serial Port Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPESP]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) + +if(WIN32) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +else() + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +endif() + diff --git a/channels/rdpdr/client/serial/CMakeLists.txt b/channels/serial/client/CMakeLists.txt similarity index 56% rename from channels/rdpdr/client/serial/CMakeLists.txt rename to channels/serial/client/CMakeLists.txt index 4b3ac4492..679df16d8 100644 --- a/channels/rdpdr/client/serial/CMakeLists.txt +++ b/channels/serial/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,21 +15,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(serial_SRCS +set(MODULE_NAME "serial") +set(MODULE_PREFIX "CHANNEL_DEVICE_SERIAL_CLIENT") + +set(${MODULE_PREFIX}_SRCS serial_tty.c serial_tty.h serial_constants.h serial_main.c) -include_directories(..) - -add_library(serial ${serial_SRCS}) +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set_target_properties(serial PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(serial freerdp) +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(serial freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS serial DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rdpdr/client/serial/serial_constants.h b/channels/serial/client/serial_constants.h similarity index 98% rename from channels/rdpdr/client/serial/serial_constants.h rename to channels/serial/client/serial_constants.h index ac16f9a7b..a42c4f001 100644 --- a/channels/rdpdr/client/serial/serial_constants.h +++ b/channels/serial/client/serial_constants.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Serial Port Device Service Virtual Channel * * Copyright 2011 O.S. Systems Software Ltda. diff --git a/channels/rdpdr/client/serial/serial_main.c b/channels/serial/client/serial_main.c similarity index 88% rename from channels/rdpdr/client/serial/serial_main.c rename to channels/serial/client/serial_main.c index 0ef98333a..edd4308a5 100644 --- a/channels/rdpdr/client/serial/serial_main.c +++ b/channels/serial/client/serial_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Serial Port Device Service Virtual Channel * * Copyright 2011 O.S. Systems Software Ltda. @@ -40,18 +40,18 @@ #include #endif -#include "rdpdr_types.h" -#include "rdpdr_constants.h" -#include "devman.h" #include "serial_tty.h" #include "serial_constants.h" +#include #include #include #include #include +#include typedef struct _SERIAL_DEVICE SERIAL_DEVICE; + struct _SERIAL_DEVICE { DEVICE device; @@ -66,27 +66,27 @@ struct _SERIAL_DEVICE fd_set read_fds; fd_set write_fds; - uint32 nfds; + UINT32 nfds; struct timeval tv; - uint32 select_timeout; - uint32 timeout_id; + UINT32 select_timeout; + UINT32 timeout_id; }; -static void serial_abort_single_io(SERIAL_DEVICE* serial, uint32 file_id, uint32 abort_io, uint32 io_status); +static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32 abort_io, UINT32 io_status); static void serial_check_for_events(SERIAL_DEVICE* serial); static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp); -static boolean serial_check_fds(SERIAL_DEVICE* serial); +static BOOL serial_check_fds(SERIAL_DEVICE* serial); static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) { char* path; SERIAL_TTY* tty; - uint32 PathLength; - uint32 FileId; + UINT32 PathLength; + UINT32 FileId; stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */ /* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */ - stream_read_uint32(irp->input, PathLength); + stream_read_UINT32(irp->input, PathLength); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2); @@ -107,10 +107,10 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) DEBUG_SVC("%s(%d) created.", serial->path, FileId); } - stream_write_uint32(irp->output, FileId); - stream_write_uint8(irp->output, 0); + stream_write_UINT32(irp->output, FileId); + stream_write_BYTE(irp->output, 0); - xfree(path); + free(path); irp->Complete(irp); } @@ -142,12 +142,12 @@ static void serial_process_irp_close(SERIAL_DEVICE* serial, IRP* irp) static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) { SERIAL_TTY* tty; - uint32 Length; - uint64 Offset; - uint8* buffer = NULL; + UINT32 Length; + UINT64 Offset; + BYTE* buffer = NULL; - stream_read_uint32(irp->input, Length); - stream_read_uint64(irp->input, Offset); + stream_read_UINT32(irp->input, Length); + stream_read_UINT64(irp->input, Offset); DEBUG_SVC("length %u offset %llu", Length, Offset); @@ -162,12 +162,12 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) } else { - buffer = (uint8*) xmalloc(Length); + buffer = (BYTE*) malloc(Length); if (!serial_tty_read(tty, buffer, &Length)) { irp->IoStatus = STATUS_UNSUCCESSFUL; - xfree(buffer); + free(buffer); buffer = NULL; Length = 0; @@ -179,7 +179,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) } } - stream_write_uint32(irp->output, Length); + stream_write_UINT32(irp->output, Length); if (Length > 0) { @@ -187,7 +187,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) stream_write(irp->output, buffer, Length); } - xfree(buffer); + free(buffer); irp->Complete(irp); } @@ -195,11 +195,11 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp) { SERIAL_TTY* tty; - uint32 Length; - uint64 Offset; + UINT32 Length; + UINT64 Offset; - stream_read_uint32(irp->input, Length); - stream_read_uint64(irp->input, Offset); + stream_read_UINT32(irp->input, Length); + stream_read_UINT64(irp->input, Offset); stream_seek(irp->input, 20); /* Padding */ DEBUG_SVC("length %u offset %llu", Length, Offset); @@ -225,8 +225,8 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp) DEBUG_SVC("write %llu-%llu to %s(%d).", Offset, Offset + Length, serial->path, tty->id); } - stream_write_uint32(irp->output, Length); - stream_write_uint8(irp->output, 0); /* Padding */ + stream_write_UINT32(irp->output, Length); + stream_write_BYTE(irp->output, 0); /* Padding */ irp->Complete(irp); } @@ -234,16 +234,16 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp) static void serial_process_irp_device_control(SERIAL_DEVICE* serial, IRP* irp) { SERIAL_TTY* tty; - uint32 IoControlCode; - uint32 InputBufferLength; - uint32 OutputBufferLength; - uint32 abort_io = SERIAL_ABORT_IO_NONE; + UINT32 IoControlCode; + UINT32 InputBufferLength; + UINT32 OutputBufferLength; + UINT32 abort_io = SERIAL_ABORT_IO_NONE; DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps)); - stream_read_uint32(irp->input, InputBufferLength); - stream_read_uint32(irp->input, OutputBufferLength); - stream_read_uint32(irp->input, IoControlCode); + stream_read_UINT32(irp->input, InputBufferLength); + stream_read_UINT32(irp->input, OutputBufferLength); + stream_read_UINT32(irp->input, IoControlCode); stream_seek(irp->input, 20); /* Padding */ tty = serial->tty; @@ -394,7 +394,7 @@ static void serial_free(DEVICE* device) list_free(serial->pending_irps); - xfree(serial); + free(serial); } int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) @@ -420,7 +420,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) serial->device.data = stream_new(len + 1); for (i = 0; i <= len; i++) - stream_write_uint8(serial->device.data, name[i] < 0 ? '_' : name[i]); + stream_write_BYTE(serial->device.data, name[i] < 0 ? '_' : name[i]); serial->path = path; serial->irp_list = list_new(); @@ -436,10 +436,10 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) return 0; } -static void serial_abort_single_io(SERIAL_DEVICE* serial, uint32 file_id, uint32 abort_io, uint32 io_status) +static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32 abort_io, UINT32 io_status) { IRP* irp = NULL; - uint32 major; + UINT32 major; SERIAL_TTY* tty; DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps)); @@ -478,7 +478,7 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, uint32 file_id, uint32 /* Process a SINGLE FileId and MajorFunction */ list_remove(serial->pending_irps, irp); irp->IoStatus = io_status; - stream_write_uint32(irp->output, 0); + stream_write_UINT32(irp->output, 0); irp->Complete(irp); wait_obj_set(serial->in_event); @@ -492,7 +492,7 @@ static void serial_check_for_events(SERIAL_DEVICE* serial) { IRP* irp = NULL; IRP* prev; - uint32 result = 0; + UINT32 result = 0; SERIAL_TTY* tty; tty = serial->tty; @@ -512,7 +512,7 @@ static void serial_check_for_events(SERIAL_DEVICE* serial) DEBUG_SVC("got event result %u", result); irp->IoStatus = STATUS_SUCCESS; - stream_write_uint32(irp->output, result); + stream_write_UINT32(irp->output, result); irp->Complete(irp); prev = irp; @@ -530,14 +530,14 @@ static void serial_check_for_events(SERIAL_DEVICE* serial) DEBUG_SVC("[out] pending size %d", list_size(serial->pending_irps)); } -void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, uint32* timeout, uint32* interval_timeout) +void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, UINT32* timeout, UINT32* interval_timeout) { SERIAL_TTY* tty; - uint32 Length; - uint32 pos; + UINT32 Length; + UINT32 pos; pos = stream_get_pos(irp->input); - stream_read_uint32(irp->input, Length); + stream_read_UINT32(irp->input, Length); stream_set_pos(irp->input, pos); DEBUG_SVC("length read %u", Length); @@ -552,8 +552,8 @@ void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, uint32* timeout, uint3 static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp) { - uint32 timeout = 0; - uint32 itv_timeout = 0; + UINT32 timeout = 0; + UINT32 itv_timeout = 0; SERIAL_TTY* tty; tty = serial->tty; @@ -603,7 +603,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial) IRP* irp; IRP* prev; SERIAL_TTY* tty; - uint32 result = 0; + UINT32 result = 0; memset(&serial->tv, 0, sizeof(struct timeval)); tty = serial->tty; @@ -639,7 +639,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial) DEBUG_SVC("got event result %u", result); irp->IoStatus = STATUS_SUCCESS; - stream_write_uint32(irp->output, result); + stream_write_UINT32(irp->output, result); irp->Complete(irp); } break; @@ -696,7 +696,7 @@ static void serial_set_fds(SERIAL_DEVICE* serial) } } -static boolean serial_check_fds(SERIAL_DEVICE* serial) +static BOOL serial_check_fds(SERIAL_DEVICE* serial) { if (list_size(serial->pending_irps) == 0) return 1; diff --git a/channels/rdpdr/client/serial/serial_tty.c b/channels/serial/client/serial_tty.c similarity index 85% rename from channels/rdpdr/client/serial/serial_tty.c rename to channels/serial/client/serial_tty.c index 4dfa690e7..c5761f26b 100644 --- a/channels/rdpdr/client/serial/serial_tty.c +++ b/channels/serial/client/serial_tty.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Serial Port Device Service Virtual Channel * * Copyright 2011 O.S. Systems Software Ltda. @@ -33,6 +33,7 @@ #include #include #include +#include #ifndef _WIN32 #include @@ -46,8 +47,6 @@ #include #include -#include "rdpdr_constants.h" -#include "rdpdr_types.h" #include "serial_tty.h" #include "serial_constants.h" @@ -74,49 +73,49 @@ #define TIOCOUTQ FIONWRITE #endif -static uint32 tty_write_data(SERIAL_TTY* tty, uint8* data, int len); +static UINT32 tty_write_data(SERIAL_TTY* tty, BYTE* data, int len); static void tty_set_termios(SERIAL_TTY* tty); -static boolean tty_get_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, STREAM* input, STREAM* output, UINT32* abort_io) { int purge_mask; - uint32 result; - uint32 modemstate; - uint8 immediate; - uint32 ret = STATUS_SUCCESS; - uint32 length = 0; - uint32 pos; + UINT32 result; + UINT32 modemstate; + BYTE immediate; + UINT32 ret = STATUS_SUCCESS; + UINT32 length = 0; + UINT32 pos; DEBUG_SVC("in"); - stream_seek(output, sizeof(uint32)); + stream_seek(output, sizeof(UINT32)); switch (IoControlCode) { case IOCTL_SERIAL_SET_BAUD_RATE: - stream_read_uint32(input, tty->baud_rate); + stream_read_UINT32(input, tty->baud_rate); tty_set_termios(tty); DEBUG_SVC("SERIAL_SET_BAUD_RATE %d", tty->baud_rate); break; case IOCTL_SERIAL_GET_BAUD_RATE: length = 4; - stream_write_uint32(output, tty->baud_rate); + stream_write_UINT32(output, tty->baud_rate); DEBUG_SVC("SERIAL_GET_BAUD_RATE %d", tty->baud_rate); break; case IOCTL_SERIAL_SET_QUEUE_SIZE: - stream_read_uint32(input, tty->queue_in_size); - stream_read_uint32(input, tty->queue_out_size); + stream_read_UINT32(input, tty->queue_in_size); + stream_read_UINT32(input, tty->queue_out_size); DEBUG_SVC("SERIAL_SET_QUEUE_SIZE in %d out %d", tty->queue_in_size, tty->queue_out_size); break; case IOCTL_SERIAL_SET_LINE_CONTROL: - stream_read_uint8(input, tty->stop_bits); - stream_read_uint8(input, tty->parity); - stream_read_uint8(input, tty->word_length); + stream_read_BYTE(input, tty->stop_bits); + stream_read_BYTE(input, tty->parity); + stream_read_BYTE(input, tty->word_length); tty_set_termios(tty); DEBUG_SVC("SERIAL_SET_LINE_CONTROL stop %d parity %d word %d", tty->stop_bits, tty->parity, tty->word_length); @@ -125,21 +124,21 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, case IOCTL_SERIAL_GET_LINE_CONTROL: DEBUG_SVC("SERIAL_GET_LINE_CONTROL"); length = 3; - stream_write_uint8(output, tty->stop_bits); - stream_write_uint8(output, tty->parity); - stream_write_uint8(output, tty->word_length); + stream_write_BYTE(output, tty->stop_bits); + stream_write_BYTE(output, tty->parity); + stream_write_BYTE(output, tty->word_length); break; case IOCTL_SERIAL_IMMEDIATE_CHAR: DEBUG_SVC("SERIAL_IMMEDIATE_CHAR"); - stream_read_uint8(input, immediate); + stream_read_BYTE(input, immediate); tty_write_data(tty, &immediate, 1); break; case IOCTL_SERIAL_CONFIG_SIZE: DEBUG_SVC("SERIAL_CONFIG_SIZE"); length = 4; - stream_write_uint32(output, 0); + stream_write_UINT32(output, 0); break; case IOCTL_SERIAL_GET_CHARS: @@ -157,30 +156,30 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, case IOCTL_SERIAL_GET_HANDFLOW: length = 16; tty_get_termios(tty); - stream_write_uint32(output, tty->control); - stream_write_uint32(output, tty->xonoff); - stream_write_uint32(output, tty->onlimit); - stream_write_uint32(output, tty->offlimit); + stream_write_UINT32(output, tty->control); + stream_write_UINT32(output, tty->xonoff); + stream_write_UINT32(output, tty->onlimit); + stream_write_UINT32(output, tty->offlimit); DEBUG_SVC("IOCTL_SERIAL_GET_HANDFLOW %X %X %X %X", tty->control, tty->xonoff, tty->onlimit, tty->offlimit); break; case IOCTL_SERIAL_SET_HANDFLOW: - stream_read_uint32(input, tty->control); - stream_read_uint32(input, tty->xonoff); - stream_read_uint32(input, tty->onlimit); - stream_read_uint32(input, tty->offlimit); + stream_read_UINT32(input, tty->control); + stream_read_UINT32(input, tty->xonoff); + stream_read_UINT32(input, tty->onlimit); + stream_read_UINT32(input, tty->offlimit); DEBUG_SVC("IOCTL_SERIAL_SET_HANDFLOW %X %X %X %X", tty->control, tty->xonoff, tty->onlimit, tty->offlimit); tty_set_termios(tty); break; case IOCTL_SERIAL_SET_TIMEOUTS: - stream_read_uint32(input, tty->read_interval_timeout); - stream_read_uint32(input, tty->read_total_timeout_multiplier); - stream_read_uint32(input, tty->read_total_timeout_constant); - stream_read_uint32(input, tty->write_total_timeout_multiplier); - stream_read_uint32(input, tty->write_total_timeout_constant); + stream_read_UINT32(input, tty->read_interval_timeout); + stream_read_UINT32(input, tty->read_total_timeout_multiplier); + stream_read_UINT32(input, tty->read_total_timeout_constant); + stream_read_UINT32(input, tty->write_total_timeout_multiplier); + stream_read_UINT32(input, tty->write_total_timeout_constant); /* http://www.codeproject.com/KB/system/chaiyasit_t.aspx, see 'ReadIntervalTimeout' section http://msdn.microsoft.com/en-us/library/ms885171.aspx */ @@ -202,21 +201,21 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, tty->read_total_timeout_multiplier, tty->read_total_timeout_constant); length = 20; - stream_write_uint32(output, tty->read_interval_timeout); - stream_write_uint32(output, tty->read_total_timeout_multiplier); - stream_write_uint32(output, tty->read_total_timeout_constant); - stream_write_uint32(output, tty->write_total_timeout_multiplier); - stream_write_uint32(output, tty->write_total_timeout_constant); + stream_write_UINT32(output, tty->read_interval_timeout); + stream_write_UINT32(output, tty->read_total_timeout_multiplier); + stream_write_UINT32(output, tty->read_total_timeout_constant); + stream_write_UINT32(output, tty->write_total_timeout_multiplier); + stream_write_UINT32(output, tty->write_total_timeout_constant); break; case IOCTL_SERIAL_GET_WAIT_MASK: DEBUG_SVC("SERIAL_GET_WAIT_MASK %X", tty->wait_mask); length = 4; - stream_write_uint32(output, tty->wait_mask); + stream_write_UINT32(output, tty->wait_mask); break; case IOCTL_SERIAL_SET_WAIT_MASK: - stream_read_uint32(input, tty->wait_mask); + stream_read_UINT32(input, tty->wait_mask); DEBUG_SVC("SERIAL_SET_WAIT_MASK %X", tty->wait_mask); break; @@ -271,19 +270,19 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, #endif DEBUG_SVC("SERIAL_GET_MODEMSTATUS %X", modemstate); length = 4; - stream_write_uint32(output, modemstate); + stream_write_UINT32(output, modemstate); break; case IOCTL_SERIAL_GET_COMMSTATUS: length = 18; - stream_write_uint32(output, 0); /* Errors */ - stream_write_uint32(output, 0); /* Hold reasons */ + stream_write_UINT32(output, 0); /* Errors */ + stream_write_UINT32(output, 0); /* Hold reasons */ result = 0; #ifdef TIOCINQ ioctl(tty->fd, TIOCINQ, &result); #endif - stream_write_uint32(output, result); /* Amount in in queue */ + stream_write_UINT32(output, result); /* Amount in in queue */ if (result) DEBUG_SVC("SERIAL_GET_COMMSTATUS in queue %d", result); @@ -291,15 +290,15 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, #ifdef TIOCOUTQ ioctl(tty->fd, TIOCOUTQ, &result); #endif - stream_write_uint32(output, result); /* Amount in out queue */ + stream_write_UINT32(output, result); /* Amount in out queue */ DEBUG_SVC("SERIAL_GET_COMMSTATUS out queue %d", result); - stream_write_uint8(output, 0); /* EofReceived */ - stream_write_uint8(output, 0); /* WaitForImmediate */ + stream_write_BYTE(output, 0); /* EofReceived */ + stream_write_BYTE(output, 0); /* WaitForImmediate */ break; case IOCTL_SERIAL_PURGE: - stream_read_uint32(input, purge_mask); + stream_read_UINT32(input, purge_mask); DEBUG_SVC("SERIAL_PURGE purge_mask %X", purge_mask); /* See http://msdn.microsoft.com/en-us/library/ms901431.aspx @@ -328,7 +327,7 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, if (serial_tty_get_event(tty, &result)) { DEBUG_SVC("WAIT end event = %X", result); - stream_write_uint32(output, result); + stream_write_UINT32(output, result); break; } ret = STATUS_PENDING; @@ -364,13 +363,13 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, /* Write OutputBufferLength */ pos = stream_get_pos(output); stream_set_pos(output, 16); - stream_write_uint32(output, length); + stream_write_UINT32(output, length); stream_set_pos(output, pos); return ret; } -boolean serial_tty_read(SERIAL_TTY* tty, uint8* buffer, uint32* Length) +BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length) { long timeout = 90; struct termios *ptermios; @@ -411,18 +410,18 @@ boolean serial_tty_read(SERIAL_TTY* tty, uint8* buffer, uint32* Length) memset(buffer, 0, *Length); r = read(tty->fd, buffer, *Length); if (r < 0) - return false; + return FALSE; tty->event_txempty = r; *Length = r; - return true; + return TRUE; } -boolean serial_tty_write(SERIAL_TTY* tty, uint8* buffer, uint32 Length) +BOOL serial_tty_write(SERIAL_TTY* tty, BYTE* buffer, UINT32 Length) { ssize_t r; - uint32 event_txempty = Length; + UINT32 event_txempty = Length; DEBUG_SVC("in"); @@ -430,14 +429,14 @@ boolean serial_tty_write(SERIAL_TTY* tty, uint8* buffer, uint32 Length) { r = write(tty->fd, buffer, Length); if (r < 0) - return false; + return FALSE; Length -= r; buffer += r; } tty->event_txempty = event_txempty; - return true; + return TRUE; } /** @@ -458,13 +457,13 @@ void serial_tty_free(SERIAL_TTY* tty) close(tty->fd); } - xfree(tty->ptermios); - xfree(tty->pold_termios); - xfree(tty); + free(tty->ptermios); + free(tty->pold_termios); + free(tty); } -SERIAL_TTY* serial_tty_new(const char* path, uint32 id) +SERIAL_TTY* serial_tty_new(const char* path, UINT32 id) { SERIAL_TTY* tty; @@ -532,10 +531,10 @@ SERIAL_TTY* serial_tty_new(const char* path, uint32 id) return tty; } -boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result) +BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result) { int bytes; - boolean ret = false; + BOOL ret = FALSE; DEBUG_SVC("in"); @@ -547,7 +546,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result) if (tty->wait_mask == 0) { tty->event_pending = 0; - return true; + return TRUE; } ioctl(tty->fd, TIOCINQ, &bytes); @@ -563,7 +562,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result) { DEBUG_SVC("SERIAL_EV_RLSD"); *result |= SERIAL_EV_RLSD; - ret = true; + ret = TRUE; } } @@ -572,13 +571,13 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result) { DEBUG_SVC("SERIAL_EV_RXFLAG bytes %d", bytes); *result |= SERIAL_EV_RXFLAG; - ret = true; + ret = TRUE; } if ((tty->wait_mask & SERIAL_EV_RXCHAR)) { DEBUG_SVC("SERIAL_EV_RXCHAR bytes %d", bytes); *result |= SERIAL_EV_RXCHAR; - ret = true; + ret = TRUE; } } @@ -595,7 +594,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result) { DEBUG_SVC("SERIAL_EV_TXEMPTY"); *result |= SERIAL_EV_TXEMPTY; - ret = true; + ret = TRUE; } tty->event_txempty = bytes; #endif @@ -608,7 +607,7 @@ boolean 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; + ret = TRUE; } } @@ -619,7 +618,7 @@ boolean 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; + ret = TRUE; } } @@ -629,7 +628,7 @@ boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result) return ret; } -static boolean tty_get_termios(SERIAL_TTY* tty) +static BOOL tty_get_termios(SERIAL_TTY* tty) { speed_t speed; struct termios *ptermios; @@ -637,7 +636,7 @@ static boolean tty_get_termios(SERIAL_TTY* tty) DEBUG_SVC("tcgetattr? %d", tcgetattr(tty->fd, ptermios) >= 0); if (tcgetattr(tty->fd, ptermios) < 0) - return false; + return FALSE; speed = cfgetispeed(ptermios); switch (speed) @@ -777,7 +776,7 @@ static boolean tty_get_termios(SERIAL_TTY* tty) tty->chars[SERIAL_CHAR_BREAK] = ptermios->c_cc[VINTR]; tty->chars[SERIAL_CHAR_ERROR] = ptermios->c_cc[VKILL]; - return true; + return TRUE; } static void tty_set_termios(SERIAL_TTY* tty) @@ -970,7 +969,7 @@ static void tty_set_termios(SERIAL_TTY* tty) tcsetattr(tty->fd, TCSANOW, ptermios); } -static uint32 tty_write_data(SERIAL_TTY* tty, uint8* data, int len) +static UINT32 tty_write_data(SERIAL_TTY* tty, BYTE* data, int len) { ssize_t r; diff --git a/channels/rdpdr/client/serial/serial_tty.h b/channels/serial/client/serial_tty.h similarity index 56% rename from channels/rdpdr/client/serial/serial_tty.h rename to channels/serial/client/serial_tty.h index d9b76414e..bace6e709 100644 --- a/channels/rdpdr/client/serial/serial_tty.h +++ b/channels/serial/client/serial_tty.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Serial Port Device Service Virtual Channel * * Copyright 2011 O.S. Systems Software Ltda. @@ -28,31 +28,35 @@ #include #endif +#include +#include + typedef struct _SERIAL_TTY SERIAL_TTY; + struct _SERIAL_TTY { - uint32 id; + UINT32 id; int fd; int dtr; int rts; - uint32 control; - uint32 xonoff; - uint32 onlimit; - uint32 offlimit; - uint32 baud_rate; - uint32 queue_in_size; - uint32 queue_out_size; - uint32 wait_mask; - uint32 read_interval_timeout; - uint32 read_total_timeout_multiplier; - uint32 read_total_timeout_constant; - uint32 write_total_timeout_multiplier; - uint32 write_total_timeout_constant; - uint8 stop_bits; - uint8 parity; - uint8 word_length; - uint8 chars[6]; + UINT32 control; + UINT32 xonoff; + UINT32 onlimit; + UINT32 offlimit; + UINT32 baud_rate; + UINT32 queue_in_size; + UINT32 queue_out_size; + UINT32 wait_mask; + UINT32 read_interval_timeout; + UINT32 read_total_timeout_multiplier; + UINT32 read_total_timeout_constant; + UINT32 write_total_timeout_multiplier; + UINT32 write_total_timeout_constant; + BYTE stop_bits; + BYTE parity; + BYTE word_length; + BYTE chars[6]; struct termios* ptermios; struct termios* pold_termios; int event_txempty; @@ -62,13 +66,13 @@ struct _SERIAL_TTY int event_pending; }; -SERIAL_TTY* serial_tty_new(const char* path, uint32 id); +SERIAL_TTY* serial_tty_new(const char* path, UINT32 id); void serial_tty_free(SERIAL_TTY* tty); -boolean serial_tty_read(SERIAL_TTY* tty, uint8* buffer, uint32* Length); -boolean serial_tty_write(SERIAL_TTY* tty, uint8* buffer, uint32 Length); -uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input, STREAM* output, uint32* abort_io); +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); -boolean serial_tty_get_event(SERIAL_TTY* tty, uint32* result); +BOOL serial_tty_get_event(SERIAL_TTY* tty, UINT32* result); #endif /* __SERIAL_TTY_H */ diff --git a/channels/server/CMakeLists.txt b/channels/server/CMakeLists.txt index b8de4ee2d..dff6f542e 100644 --- a/channels/server/CMakeLists.txt +++ b/channels/server/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,8 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(MODULE_NAME "freerdp-server-channels") -set(MODULE_PREFIX "FREERDP_SERVER_CHANNELS") +set(MODULE_NAME "freerdp-channels-server") +set(MODULE_PREFIX "FREERDP_CHANNELS_SERVER") foreach(_MODULE_NAME ${CHANNEL_BUILTIN_SERVER_MODULES}) string(TOUPPER "CHANNEL_${_MODULE_NAME}" _MODULE_PREFIX) @@ -35,3 +35,6 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} target_link_libraries(${MODULE_NAME} ${CHANNEL_SERVER_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/Server") + diff --git a/channels/smartcard/CMakeLists.txt b/channels/smartcard/CMakeLists.txt new file mode 100644 index 000000000..65f8452a1 --- /dev/null +++ b/channels/smartcard/CMakeLists.txt @@ -0,0 +1,21 @@ +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +if(WITH_CLIENT_CHANNELS) + add_subdirectory(client) +endif() + diff --git a/channels/smartcard/ChannelOptions.cmake b/channels/smartcard/ChannelOptions.cmake new file mode 100644 index 000000000..e06f9e13e --- /dev/null +++ b/channels/smartcard/ChannelOptions.cmake @@ -0,0 +1,16 @@ + +set(CHANNEL_TYPE "device") +set(CHANNEL_SHORT_NAME "smartcard") +set(CHANNEL_LONG_NAME "Smart Card Virtual Channel Extension") +set(CHANNEL_SPECIFICATIONS "[MS-RDPESC]") + +string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION) + +if(WIN32) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +elseif(WITH_PCSC) + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON) +else() + option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF) +endif() + diff --git a/channels/smartcard/client/CMakeLists.txt b/channels/smartcard/client/CMakeLists.txt new file mode 100644 index 000000000..7e5a3bf38 --- /dev/null +++ b/channels/smartcard/client/CMakeLists.txt @@ -0,0 +1,40 @@ +# FreeRDP: A Remote Desktop Protocol Implementation +# FreeRDP cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +set(MODULE_NAME "smartcard") +set(MODULE_PREFIX "CHANNEL_RDPDR_SMARTCARD_CLIENT") + +set(${MODULE_PREFIX}_SRCS + scard_main.c + scard_operations.c) + +include_directories(${PCSC_INCLUDE_DIRS}) + +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp winpr) +else() + target_link_libraries(${MODULE_NAME} freerdp-utils winpr-crt winpr-synch winpr-thread winpr-interlocked) +endif() + +target_link_libraries(${MODULE_NAME} ${PCSC_LIBRARIES}) + +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/rdpdr/client/smartcard/scard_main.c b/channels/smartcard/client/scard_main.c similarity index 91% rename from channels/rdpdr/client/smartcard/scard_main.c rename to channels/smartcard/client/scard_main.c index b5998fbe0..38e0b8976 100644 --- a/channels/rdpdr/client/smartcard/scard_main.c +++ b/channels/smartcard/client/scard_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Smartcard Device Service Virtual Channel * * Copyright 2011 O.S. Systems Software Ltda. @@ -31,9 +31,7 @@ #include #include #include - -#include "rdpdr_types.h" -#include "rdpdr_constants.h" +#include #include "scard_main.h" @@ -54,13 +52,13 @@ static void scard_free(DEVICE* dev) /* Begin TS Client defect workaround. */ while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(scard->CompletionIds)) != NULL) - xfree(CompletionIdInfo); + free(CompletionIdInfo); list_free(scard->CompletionIds); /* End TS Client defect workaround. */ - xfree(dev); + free(dev); return; } @@ -108,7 +106,7 @@ static void scard_process_irp_thread_func(struct scard_irp_thread_args* args) scard_process_irp(args->scard, args->irp); freerdp_thread_free(args->thread); - xfree(args); + free(args); } static void* scard_thread_func(void* arg) @@ -132,7 +130,7 @@ static void* scard_thread_func(void* arg) } /* Begin TS Client defect workaround. */ -static COMPLETIONIDINFO* scard_mark_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId) +static COMPLETIONIDINFO* scard_mark_duplicate_id(SCARD_DEVICE* scard, UINT32 CompletionId) { /* * Search from the beginning of the LIST for one outstanding "CompletionID" @@ -147,9 +145,9 @@ static COMPLETIONIDINFO* scard_mark_duplicate_id(SCARD_DEVICE* scard, uint32 Com CompletionIdInfo = (COMPLETIONIDINFO*)item->data; if (CompletionIdInfo->ID == CompletionId) { - if (false == CompletionIdInfo->duplicate) + if (FALSE == CompletionIdInfo->duplicate) { - CompletionIdInfo->duplicate = true; + CompletionIdInfo->duplicate = TRUE; DEBUG_WARN("CompletionID number %u is now marked as a duplicate.", CompletionId); } return CompletionIdInfo; @@ -159,7 +157,7 @@ static COMPLETIONIDINFO* scard_mark_duplicate_id(SCARD_DEVICE* scard, uint32 Com return NULL; /* Either no items in the list or no match. */ } -static boolean scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 CompletionId) +static BOOL scard_check_for_duplicate_id(SCARD_DEVICE* scard, UINT32 CompletionId) { /* * Search from the end of the LIST for one outstanding "CompletionID" @@ -169,7 +167,7 @@ static boolean scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 Complet */ LIST_ITEM* item; COMPLETIONIDINFO* CompletionIdInfo; - boolean duplicate; + BOOL duplicate; for (item = scard->CompletionIds->tail; item; item = item->prev) { @@ -177,12 +175,12 @@ static boolean scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 Complet if (CompletionIdInfo->ID == CompletionId) { duplicate = CompletionIdInfo->duplicate; - if (true == duplicate) + if (TRUE == duplicate) { DEBUG_WARN("CompletionID number %u was previously marked as a duplicate. The response to the command is removed.", CompletionId); } list_remove(scard->CompletionIds, CompletionIdInfo); - xfree(CompletionIdInfo); + free(CompletionIdInfo); return duplicate; } } @@ -192,7 +190,7 @@ static boolean scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 Complet */ DEBUG_WARN("Error!!! No CompletionIDs (or no matching IDs) in the list!"); - return false; + return FALSE; } static void scard_irp_complete(IRP* irp) @@ -203,14 +201,14 @@ static void scard_irp_complete(IRP* irp) * to be in this file so that "scard_irp_request()" can reference it. */ int pos; - boolean duplicate; + BOOL duplicate; SCARD_DEVICE* scard = (SCARD_DEVICE*)irp->device; DEBUG_SVC("DeviceId %d FileId %d CompletionId %d", irp->device->id, irp->FileId, irp->CompletionId); pos = stream_get_pos(irp->output); stream_set_pos(irp->output, 12); - stream_write_uint32(irp->output, irp->IoStatus); + stream_write_UINT32(irp->output, irp->IoStatus); stream_set_pos(irp->output, pos); /* Begin TS Client defect workaround. */ @@ -221,7 +219,7 @@ static void scard_irp_complete(IRP* irp) duplicate = scard_check_for_duplicate_id(scard, irp->CompletionId); ReleaseMutex(scard->CompletionIdsMutex); - if (false == duplicate) + if (FALSE == duplicate) { svc_plugin_send(irp->devman->plugin, irp->output); irp->output = NULL; @@ -247,7 +245,7 @@ static void scard_irp_request(DEVICE* device, IRP* irp) /* Begin TS Client defect workaround. */ CompletionIdInfo= xnew(COMPLETIONIDINFO); CompletionIdInfo->ID = irp->CompletionId;/* "duplicate" member is set - * to false by "xnew()" + * to FALSE by "xnew()" */ WaitForSingleObject(scard->CompletionIdsMutex, INFINITE); scard_mark_duplicate_id(scard, irp->CompletionId); @@ -268,7 +266,7 @@ static void scard_irp_request(DEVICE* device, IRP* irp) * get their own thread * TODO: revise this mechanism.. maybe worker pool */ - struct scard_irp_thread_args *args = xmalloc(sizeof(struct scard_irp_thread_args)); + struct scard_irp_thread_args *args = malloc(sizeof(struct scard_irp_thread_args)); args->thread = freerdp_thread_new(); @@ -309,7 +307,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) scard->device.data = stream_new(length + 1); for (i = 0; i <= length; i++) - stream_write_uint8(scard->device.data, name[i] < 0 ? '_' : name[i]); + stream_write_BYTE(scard->device.data, name[i] < 0 ? '_' : name[i]); scard->path = path; diff --git a/channels/rdpdr/client/smartcard/scard_main.h b/channels/smartcard/client/scard_main.h similarity index 94% rename from channels/rdpdr/client/smartcard/scard_main.h rename to channels/smartcard/client/scard_main.h index c8143ef31..103a03f2a 100644 --- a/channels/rdpdr/client/smartcard/scard_main.h +++ b/channels/smartcard/client/scard_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Smartcard Device Service Virtual Channel * * Copyright 2011 O.S. Systems Software Ltda. @@ -23,11 +23,9 @@ #include -#include "devman.h" -#include "rdpdr_types.h" - #include #include +#include #include @@ -85,8 +83,8 @@ */ struct _COMPLETIONIDINFO { - uint32 ID; /* CompletionID */ - boolean duplicate; /* Indicates whether or not this + UINT32 ID; /* CompletionID */ + BOOL duplicate; /* Indicates whether or not this * CompletionID is a duplicate of an * earlier, outstanding, CompletionID. */ @@ -117,7 +115,7 @@ typedef struct _SCARD_DEVICE SCARD_DEVICE; #define DEBUG_SCARD(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) #endif -boolean scard_async_op(IRP*); +BOOL scard_async_op(IRP*); void scard_device_control(SCARD_DEVICE*, IRP*); #endif diff --git a/channels/rdpdr/client/smartcard/scard_operations.c b/channels/smartcard/client/scard_operations.c similarity index 69% rename from channels/rdpdr/client/smartcard/scard_operations.c rename to channels/smartcard/client/scard_operations.c index 88bdc6358..c0c07e990 100644 --- a/channels/rdpdr/client/smartcard/scard_operations.c +++ b/channels/smartcard/client/scard_operations.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Smartcard Device Service Virtual Channel * * Copyright (C) Alexi Volkov 2006 @@ -43,53 +43,51 @@ #include #include #include - -#include "rdpdr_types.h" -#include "rdpdr_constants.h" +#include #include "scard_main.h" /* [MS-RDPESC] 3.1.4 */ -#define SCARD_IOCTL_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */ -#define SCARD_IOCTL_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */ -#define SCARD_IOCTL_IS_VALID_CONTEXT 0x0009001C /* IsValidContext */ -#define SCARD_IOCTL_LIST_READER_GROUPS 0x00090020 /* ListReaderGroups */ -#define SCARD_IOCTL_LIST_READERS 0x00090028 /* ListReadersA */ -#define SCARD_IOCTL_INTRODUCE_READER_GROUP 0x00090050 /* IntroduceReaderGroup */ -#define SCARD_IOCTL_FORGET_READER_GROUP 0x00090058 /* ForgetReader */ -#define SCARD_IOCTL_INTRODUCE_READER 0x00090060 /* IntroduceReader */ -#define SCARD_IOCTL_FORGET_READER 0x00090068 /* IntroduceReader */ -#define SCARD_IOCTL_ADD_READER_TO_GROUP 0x00090070 /* AddReaderToGroup */ -#define SCARD_IOCTL_REMOVE_READER_FROM_GROUP 0x00090078 /* RemoveReaderFromGroup */ -#define SCARD_IOCTL_GET_STATUS_CHANGE 0x000900A0 /* GetStatusChangeA */ -#define SCARD_IOCTL_CANCEL 0x000900A8 /* Cancel */ -#define SCARD_IOCTL_CONNECT 0x000900AC /* ConnectA */ -#define SCARD_IOCTL_RECONNECT 0x000900B4 /* Reconnect */ -#define SCARD_IOCTL_DISCONNECT 0x000900B8 /* Disconnect */ -#define SCARD_IOCTL_BEGIN_TRANSACTION 0x000900BC /* BeginTransaction */ -#define SCARD_IOCTL_END_TRANSACTION 0x000900C0 /* EndTransaction */ -#define SCARD_IOCTL_STATE 0x000900C4 /* State */ -#define SCARD_IOCTL_STATUS 0x000900C8 /* StatusA */ -#define SCARD_IOCTL_TRANSMIT 0x000900D0 /* Transmit */ -#define SCARD_IOCTL_CONTROL 0x000900D4 /* Control */ -#define SCARD_IOCTL_GETATTRIB 0x000900D8 /* GetAttrib */ -#define SCARD_IOCTL_SETATTRIB 0x000900DC /* SetAttrib */ -#define SCARD_IOCTL_ACCESS_STARTED_EVENT 0x000900E0 /* SCardAccessStartedEvent */ -#define SCARD_IOCTL_LOCATE_CARDS_BY_ATR 0x000900E8 /* LocateCardsByATR */ +#define SCARD_IOCTL_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */ +#define SCARD_IOCTL_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */ +#define SCARD_IOCTL_IS_VALID_CONTEXT 0x0009001C /* IsValidContext */ +#define SCARD_IOCTL_LIST_READER_GROUPS 0x00090020 /* ListReaderGroups */ +#define SCARD_IOCTL_LIST_READERS 0x00090028 /* ListReadersA */ +#define SCARD_IOCTL_INTRODUCE_READER_GROUP 0x00090050 /* IntroduceReaderGroup */ +#define SCARD_IOCTL_FORGET_READER_GROUP 0x00090058 /* ForgetReader */ +#define SCARD_IOCTL_INTRODUCE_READER 0x00090060 /* IntroduceReader */ +#define SCARD_IOCTL_FORGET_READER 0x00090068 /* IntroduceReader */ +#define SCARD_IOCTL_ADD_READER_TO_GROUP 0x00090070 /* AddReaderToGroup */ +#define SCARD_IOCTL_REMOVE_READER_FROM_GROUP 0x00090078 /* RemoveReaderFromGroup */ +#define SCARD_IOCTL_GET_STATUS_CHANGE 0x000900A0 /* GetStatusChangeA */ +#define SCARD_IOCTL_CANCEL 0x000900A8 /* Cancel */ +#define SCARD_IOCTL_CONNECT 0x000900AC /* ConnectA */ +#define SCARD_IOCTL_RECONNECT 0x000900B4 /* Reconnect */ +#define SCARD_IOCTL_DISCONNECT 0x000900B8 /* Disconnect */ +#define SCARD_IOCTL_BEGIN_TRANSACTION 0x000900BC /* BeginTransaction */ +#define SCARD_IOCTL_END_TRANSACTION 0x000900C0 /* EndTransaction */ +#define SCARD_IOCTL_STATE 0x000900C4 /* State */ +#define SCARD_IOCTL_STATUS 0x000900C8 /* StatusA */ +#define SCARD_IOCTL_TRANSMIT 0x000900D0 /* Transmit */ +#define SCARD_IOCTL_CONTROL 0x000900D4 /* Control */ +#define SCARD_IOCTL_GETATTRIB 0x000900D8 /* GetAttrib */ +#define SCARD_IOCTL_SETATTRIB 0x000900DC /* SetAttrib */ +#define SCARD_IOCTL_ACCESS_STARTED_EVENT 0x000900E0 /* SCardAccessStartedEvent */ +#define SCARD_IOCTL_LOCATE_CARDS_BY_ATR 0x000900E8 /* LocateCardsByATR */ -#define SCARD_INPUT_LINKED 0xFFFFFFFF +#define SCARD_INPUT_LINKED 0xFFFFFFFF /* Decode Win CTL_CODE values */ -#define WIN_CTL_FUNCTION(ctl_code) ((ctl_code & 0x3FFC) >> 2) -#define WIN_CTL_DEVICE_TYPE(ctl_code) (ctl_code >> 16) +#define WIN_CTL_FUNCTION(ctl_code) ((ctl_code & 0x3FFC) >> 2) +#define WIN_CTL_DEVICE_TYPE(ctl_code) (ctl_code >> 16) -#define WIN_FILE_DEVICE_SMARTCARD 0x00000031 +#define WIN_FILE_DEVICE_SMARTCARD 0x00000031 -static uint32 sc_output_string(IRP* irp, char *src, boolean wide) +static UINT32 sc_output_string(IRP* irp, char *src, BOOL wide) { - uint8* p; - uint32 len; + BYTE* p; + UINT32 len; p = stream_get_tail(irp->output); len = strlen(src) + 1; @@ -115,29 +113,29 @@ static uint32 sc_output_string(IRP* irp, char *src, boolean wide) return len; } -static void sc_output_alignment(IRP *irp, uint32 seed) +static void sc_output_alignment(IRP *irp, UINT32 seed) { - const uint32 field_lengths = 20;/* Remove the lengths of the fields + const UINT32 field_lengths = 20;/* Remove the lengths of the fields * RDPDR_HEADER, DeviceID, * CompletionID, and IoStatus * of Section 2.2.1.5.5 of MS-RDPEFS. */ - uint32 size = stream_get_length(irp->output) - field_lengths; - uint32 add = (seed - (size % seed)) % seed; + UINT32 size = stream_get_length(irp->output) - field_lengths; + UINT32 add = (seed - (size % seed)) % seed; if (add > 0) stream_write_zero(irp->output, add); } -static void sc_output_repos(IRP* irp, uint32 written) +static void sc_output_repos(IRP* irp, UINT32 written) { - uint32 add = (4 - (written % 4)) % 4; + UINT32 add = (4 - (written % 4)) % 4; if (add > 0) stream_write_zero(irp->output, add); } -static uint32 sc_output_return(IRP* irp, uint32 rv) +static UINT32 sc_output_return(IRP* irp, UINT32 rv) { stream_write_zero(irp->output, 256); return rv; @@ -147,11 +145,11 @@ static void sc_output_buffer_limit(IRP* irp, char *buffer, unsigned int length, { int header = (length < 0) ? (0) : ((length > highLimit) ? (highLimit) : (length)); - stream_write_uint32(irp->output, header); + stream_write_UINT32(irp->output, header); if (length <= 0) { - stream_write_uint32(irp->output, 0); + stream_write_UINT32(irp->output, 0); } else { @@ -172,8 +170,8 @@ static void sc_output_buffer_start_limit(IRP *irp, int length, int highLimit) { int header = (length < 0) ? (0) : ((length > highLimit) ? (highLimit) : (length)); - stream_write_uint32(irp->output, header); - stream_write_uint32(irp->output, 0x00000001); /* Magic DWORD - any non zero */ + stream_write_UINT32(irp->output, header); + stream_write_UINT32(irp->output, 0x00000001); /* Magic DWORD - any non zero */ } static void sc_output_buffer_start(IRP *irp, int length) @@ -181,15 +179,16 @@ static void sc_output_buffer_start(IRP *irp, int length) sc_output_buffer_start_limit(irp, length, 0x7FFFFFFF); } -static uint32 sc_input_string(IRP* irp, char **dest, uint32 dataLength, boolean wide) +static UINT32 sc_input_string(IRP* irp, char **dest, UINT32 dataLength, BOOL wide) { - char *buffer; + char* buffer; int bufferSize; bufferSize = wide ? (2 * dataLength) : dataLength; - buffer = xmalloc(bufferSize + 2); /* reserve 2 bytes for the '\0' */ + buffer = malloc(bufferSize + 2); /* reserve 2 bytes for the '\0' */ stream_read(irp->input, buffer, bufferSize); + if (wide) { int i; @@ -208,20 +207,20 @@ static uint32 sc_input_string(IRP* irp, char **dest, uint32 dataLength, boolean return bufferSize; } -static void sc_input_repos(IRP* irp, uint32 read) +static void sc_input_repos(IRP* irp, UINT32 read) { - uint32 add = 4 - (read % 4); + UINT32 add = 4 - (read % 4); if (add < 4 && add > 0) stream_seek(irp->input, add); } -static void sc_input_reader_name(IRP* irp, char **dest, boolean wide) +static void sc_input_reader_name(IRP* irp, char **dest, BOOL wide) { - uint32 dataLength; + UINT32 dataLength; stream_seek(irp->input, 8); - stream_read_uint32(irp->input, dataLength); + stream_read_UINT32(irp->input, dataLength); DEBUG_SCARD("datalength %d", dataLength); sc_input_repos(irp, sc_input_string(irp, dest, dataLength, wide)); @@ -229,8 +228,8 @@ static void sc_input_reader_name(IRP* irp, char **dest, boolean wide) static void sc_input_skip_linked(IRP* irp) { - uint32 len; - stream_read_uint32(irp->input, len); + UINT32 len; + stream_read_UINT32(irp->input, len); if (len > 0) { @@ -239,7 +238,7 @@ static void sc_input_skip_linked(IRP* irp) } } -static uint32 sc_map_state(uint32 state) +static UINT32 sc_map_state(UINT32 state) { /* is this mapping still needed? */ @@ -261,28 +260,28 @@ static uint32 sc_map_state(uint32 state) return state; } -static uint32 handle_EstablishContext(IRP* irp) +static UINT32 handle_EstablishContext(IRP* irp) { - uint32 len, rv; - uint32 scope; + UINT32 len, rv; + UINT32 scope; SCARDCONTEXT hContext = -1; stream_seek(irp->input, 8); - stream_read_uint32(irp->input, len); + stream_read_UINT32(irp->input, len); if (len != 8) return SCARD_F_INTERNAL_ERROR; - stream_seek_uint32(irp->input); - stream_read_uint32(irp->input, scope); + stream_seek_UINT32(irp->input); + stream_read_UINT32(irp->input, scope); rv = SCardEstablishContext(scope, NULL, NULL, &hContext); - stream_write_uint32(irp->output, 4); // cbContext - stream_write_uint32(irp->output, -1); // ReferentID + stream_write_UINT32(irp->output, 4); // cbContext + stream_write_UINT32(irp->output, -1); // ReferentID - stream_write_uint32(irp->output, 4); - stream_write_uint32(irp->output, hContext); + stream_write_UINT32(irp->output, 4); + stream_write_UINT32(irp->output, hContext); /* TODO: store hContext in allowed context list */ @@ -290,16 +289,16 @@ static uint32 handle_EstablishContext(IRP* irp) return SCARD_S_SUCCESS; } -static uint32 handle_ReleaseContext(IRP* irp) +static UINT32 handle_ReleaseContext(IRP* irp) { - uint32 len, rv; + UINT32 len, rv; SCARDCONTEXT hContext = -1; stream_seek(irp->input, 8); - stream_read_uint32(irp->input, len); + stream_read_UINT32(irp->input, len); stream_seek(irp->input, 0x10); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); rv = SCardReleaseContext(hContext); if (rv) @@ -311,13 +310,13 @@ static uint32 handle_ReleaseContext(IRP* irp) return rv; } -static uint32 handle_IsValidContext(IRP* irp) +static UINT32 handle_IsValidContext(IRP* irp) { - uint32 rv; + UINT32 rv; SCARDCONTEXT hContext; stream_seek(irp->input, 0x1C); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); rv = SCardIsValidContext(hContext); @@ -331,9 +330,9 @@ static uint32 handle_IsValidContext(IRP* irp) return rv; } -static uint32 handle_ListReaders(IRP* irp, boolean wide) +static UINT32 handle_ListReaders(IRP* irp, BOOL wide) { - uint32 len, rv; + UINT32 len, rv; SCARDCONTEXT hContext; DWORD dwReaders; char *readerList = NULL, *walker; @@ -341,15 +340,15 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide) int pos, poslen1, poslen2; stream_seek(irp->input, 8); - stream_read_uint32(irp->input, len); + stream_read_UINT32(irp->input, len); stream_seek(irp->input, 0x1c); - stream_read_uint32(irp->input, len); + stream_read_UINT32(irp->input, len); if (len != 4) return SCARD_F_INTERNAL_ERROR; - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); /* ignore rest of [MS-RDPESC] 2.2.2.4 ListReaders_Call */ @@ -360,7 +359,7 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide) #else rv = SCardListReaders(hContext, NULL, NULL, &dwReaders); - readerList = xmalloc(dwReaders); + readerList = malloc(dwReaders); rv = SCardListReaders(hContext, NULL, readerList, &dwReaders); #endif if (rv != SCARD_S_SUCCESS) @@ -372,12 +371,12 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide) /* DEBUG_SCARD("Success 0x%08x %d %d", (unsigned) hContext, (unsigned) cchReaders, (int) strlen(readerList));*/ poslen1 = stream_get_pos(irp->output); - stream_seek_uint32(irp->output); + stream_seek_UINT32(irp->output); - stream_write_uint32(irp->output, 0x01760650); + stream_write_UINT32(irp->output, 0x01760650); poslen2 = stream_get_pos(irp->output); - stream_seek_uint32(irp->output); + stream_seek_UINT32(irp->output); walker = readerList; dataLength = 0; @@ -398,9 +397,9 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide) pos = stream_get_pos(irp->output); stream_set_pos(irp->output, poslen1); - stream_write_uint32(irp->output, dataLength); + stream_write_UINT32(irp->output, dataLength); stream_set_pos(irp->output, poslen2); - stream_write_uint32(irp->output, dataLength); + stream_write_UINT32(irp->output, dataLength); stream_set_pos(irp->output, pos); @@ -410,13 +409,13 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide) #ifdef SCARD_AUTOALLOCATE SCardFreeMemory(hContext, readerList); #else - xfree(readerList); + free(readerList); #endif return rv; } -static uint32 handle_GetStatusChange(IRP* irp, boolean wide) +static UINT32 handle_GetStatusChange(IRP* irp, BOOL wide) { LONG rv; SCARDCONTEXT hContext; @@ -426,12 +425,12 @@ static uint32 handle_GetStatusChange(IRP* irp, boolean wide) int i; stream_seek(irp->input, 0x18); - stream_read_uint32(irp->input, dwTimeout); - stream_read_uint32(irp->input, readerCount); + stream_read_UINT32(irp->input, dwTimeout); + stream_read_UINT32(irp->input, readerCount); stream_seek(irp->input, 8); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); stream_seek(irp->input, 4); @@ -455,9 +454,9 @@ static uint32 handle_GetStatusChange(IRP* irp, boolean wide) * convert to host endian or fix the headers to * request the order we want */ - stream_read_uint32(irp->input, cur->dwCurrentState); - stream_read_uint32(irp->input, cur->dwEventState); - stream_read_uint32(irp->input, cur->cbAtr); + stream_read_UINT32(irp->input, cur->dwCurrentState); + stream_read_UINT32(irp->input, cur->dwEventState); + stream_read_UINT32(irp->input, cur->cbAtr); stream_read(irp->input, cur->rgbAtr, 32); stream_seek(irp->input, 4); @@ -470,10 +469,10 @@ static uint32 handle_GetStatusChange(IRP* irp, boolean wide) for (i = 0; i < readerCount; i++) { cur = &readerStates[i]; - uint32 dataLength; + UINT32 dataLength; stream_seek(irp->input, 8); - stream_read_uint32(irp->input, dataLength); + stream_read_UINT32(irp->input, dataLength); sc_input_repos(irp, sc_input_string(irp, (char **) &cur->szReader, dataLength, wide)); DEBUG_SCARD(" \"%s\"", cur->szReader ? cur->szReader : "NULL"); @@ -497,9 +496,9 @@ static uint32 handle_GetStatusChange(IRP* irp, boolean wide) else DEBUG_SCARD("Success"); - stream_write_uint32(irp->output, readerCount); - stream_write_uint32(irp->output, 0x00084dd8); - stream_write_uint32(irp->output, readerCount); + stream_write_UINT32(irp->output, readerCount); + stream_write_UINT32(irp->output, 0x00084dd8); + stream_write_UINT32(irp->output, readerCount); for (i = 0; i < readerCount; i++) { @@ -511,29 +510,29 @@ static uint32 handle_GetStatusChange(IRP* irp, boolean wide) (unsigned) cur->dwEventState); /* TODO: do byte conversions if necessary */ - stream_write_uint32(irp->output, cur->dwCurrentState); - stream_write_uint32(irp->output, cur->dwEventState); - stream_write_uint32(irp->output, cur->cbAtr); + stream_write_UINT32(irp->output, cur->dwCurrentState); + stream_write_UINT32(irp->output, cur->dwEventState); + stream_write_UINT32(irp->output, cur->cbAtr); stream_write(irp->output, cur->rgbAtr, 32); stream_write_zero(irp->output, 4); - xfree((void *)cur->szReader); + free((void *)cur->szReader); } sc_output_alignment(irp, 8); - xfree(readerStates); + free(readerStates); return rv; } -static uint32 handle_Cancel(IRP *irp) +static UINT32 handle_Cancel(IRP *irp) { LONG rv; SCARDCONTEXT hContext; stream_seek(irp->input, 0x1C); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); rv = SCardCancel(hContext); @@ -547,7 +546,7 @@ static uint32 handle_Cancel(IRP *irp) return rv; } -static uint32 handle_Connect(IRP* irp, boolean wide) +static UINT32 handle_Connect(IRP* irp, BOOL wide) { LONG rv; SCARDCONTEXT hContext; @@ -558,13 +557,13 @@ static uint32 handle_Connect(IRP* irp, boolean wide) SCARDHANDLE hCard; stream_seek(irp->input, 0x1c); - stream_read_uint32(irp->input, dwShareMode); - stream_read_uint32(irp->input, dwPreferredProtocol); + stream_read_UINT32(irp->input, dwShareMode); + stream_read_UINT32(irp->input, dwPreferredProtocol); sc_input_reader_name(irp, &readerName, wide); stream_seek(irp->input, 4); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); DEBUG_SCARD("(context: 0x%08x, share: 0x%08x, proto: 0x%08x, reader: \"%s\")", (unsigned) hContext, (unsigned) dwShareMode, @@ -578,21 +577,21 @@ static uint32 handle_Connect(IRP* irp, boolean wide) else DEBUG_SCARD("Success 0x%08x", (unsigned) hCard); - stream_write_uint32(irp->output, 0x00000000); - stream_write_uint32(irp->output, 0x00000000); - stream_write_uint32(irp->output, 0x00000004); - stream_write_uint32(irp->output, 0x016Cff34); - stream_write_uint32(irp->output, dwActiveProtocol); - stream_write_uint32(irp->output, 0x00000004); - stream_write_uint32(irp->output, hCard); + stream_write_UINT32(irp->output, 0x00000000); + stream_write_UINT32(irp->output, 0x00000000); + stream_write_UINT32(irp->output, 0x00000004); + stream_write_UINT32(irp->output, 0x016Cff34); + stream_write_UINT32(irp->output, dwActiveProtocol); + stream_write_UINT32(irp->output, 0x00000004); + stream_write_UINT32(irp->output, hCard); sc_output_alignment(irp, 8); - xfree(readerName); + free(readerName); return rv; } -static uint32 handle_Reconnect(IRP* irp) +static UINT32 handle_Reconnect(IRP* irp) { LONG rv; SCARDCONTEXT hContext; @@ -603,14 +602,14 @@ static uint32 handle_Reconnect(IRP* irp) DWORD dwActiveProtocol = 0; stream_seek(irp->input, 0x20); - stream_read_uint32(irp->input, dwShareMode); - stream_read_uint32(irp->input, dwPreferredProtocol); - stream_read_uint32(irp->input, dwInitialization); + stream_read_UINT32(irp->input, dwShareMode); + stream_read_UINT32(irp->input, dwPreferredProtocol); + stream_read_UINT32(irp->input, dwInitialization); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); DEBUG_SCARD("(context: 0x%08x, hcard: 0x%08x, share: 0x%08x, proto: 0x%08x, init: 0x%08x)", (unsigned) hContext, (unsigned) hCard, @@ -624,13 +623,13 @@ static uint32 handle_Reconnect(IRP* irp) else DEBUG_SCARD("Success (proto: 0x%08x)", (unsigned) dwActiveProtocol); - stream_write_uint32(irp->output, dwActiveProtocol); + stream_write_UINT32(irp->output, dwActiveProtocol); sc_output_alignment(irp, 8); return rv; } -static uint32 handle_Disconnect(IRP* irp) +static UINT32 handle_Disconnect(IRP* irp) { LONG rv; SCARDCONTEXT hContext; @@ -638,11 +637,11 @@ static uint32 handle_Disconnect(IRP* irp) DWORD dwDisposition = 0; stream_seek(irp->input, 0x20); - stream_read_uint32(irp->input, dwDisposition); + stream_read_UINT32(irp->input, dwDisposition); stream_seek(irp->input, 4); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); stream_seek(irp->input, 4); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); DEBUG_SCARD("(context: 0x%08x, hcard: 0x%08x, disposition: 0x%08x)", (unsigned) hContext, (unsigned) hCard, (unsigned) dwDisposition); @@ -659,13 +658,13 @@ static uint32 handle_Disconnect(IRP* irp) return rv; } -static uint32 handle_BeginTransaction(IRP* irp) +static UINT32 handle_BeginTransaction(IRP* irp) { LONG rv; SCARDCONTEXT hCard; stream_seek(irp->input, 0x30); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); rv = SCardBeginTransaction(hCard); @@ -679,17 +678,17 @@ static uint32 handle_BeginTransaction(IRP* irp) return rv; } -static uint32 handle_EndTransaction(IRP* irp) +static UINT32 handle_EndTransaction(IRP* irp) { LONG rv; SCARDCONTEXT hCard; DWORD dwDisposition = 0; stream_seek(irp->input, 0x20); - stream_read_uint32(irp->input, dwDisposition); + stream_read_UINT32(irp->input, dwDisposition); stream_seek(irp->input, 0x0C); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); rv = SCardEndTransaction(hCard, dwDisposition); @@ -703,7 +702,7 @@ static uint32 handle_EndTransaction(IRP* irp) return rv; } -static uint32 handle_State(IRP* irp) +static UINT32 handle_State(IRP* irp) { LONG rv; SCARDHANDLE hCard; @@ -718,10 +717,10 @@ static uint32 handle_State(IRP* irp) #endif stream_seek(irp->input, 0x24); - stream_seek_uint32(irp->input); /* atrLen */ + stream_seek_UINT32(irp->input); /* atrLen */ stream_seek(irp->input, 0x0c); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); stream_seek(irp->input, 0x04); #ifdef SCARD_AUTOALLOCATE @@ -730,7 +729,7 @@ static uint32 handle_State(IRP* irp) rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #else readerLen = 256; - readerName = xmalloc(readerLen); + readerName = malloc(readerLen); rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #endif @@ -753,26 +752,26 @@ static uint32 handle_State(IRP* irp) state = sc_map_state(state); - stream_write_uint32(irp->output, state); - stream_write_uint32(irp->output, protocol); - stream_write_uint32(irp->output, atrLen); - stream_write_uint32(irp->output, 0x00000001); - stream_write_uint32(irp->output, atrLen); + stream_write_UINT32(irp->output, state); + stream_write_UINT32(irp->output, protocol); + stream_write_UINT32(irp->output, atrLen); + stream_write_UINT32(irp->output, 0x00000001); + stream_write_UINT32(irp->output, atrLen); stream_write(irp->output, pbAtr, atrLen); sc_output_repos(irp, atrLen); sc_output_alignment(irp, 8); #ifdef SCARD_AUTOALLOCATE - xfree(readerName); + free(readerName); #else - xfree(readerName); + free(readerName); #endif return rv; } -static DWORD handle_Status(IRP *irp, boolean wide) +static DWORD handle_Status(IRP *irp, BOOL wide) { LONG rv; SCARDHANDLE hCard; @@ -781,7 +780,7 @@ static DWORD handle_Status(IRP *irp, boolean wide) DWORD atrLen = 0; char * readerName; BYTE pbAtr[MAX_ATR_SIZE]; - uint32 dataLength; + UINT32 dataLength; int pos, poslen1, poslen2; #ifdef WITH_DEBUG_SCARD @@ -789,10 +788,10 @@ static DWORD handle_Status(IRP *irp, boolean wide) #endif stream_seek(irp->input, 0x24); - stream_read_uint32(irp->input, readerLen); - stream_read_uint32(irp->input, atrLen); + stream_read_UINT32(irp->input, readerLen); + stream_read_UINT32(irp->input, atrLen); stream_seek(irp->input, 0x0c); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); stream_seek(irp->input, 0x4); atrLen = MAX_ATR_SIZE; @@ -803,7 +802,7 @@ static DWORD handle_Status(IRP *irp, boolean wide) rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #else readerLen = 256; - readerName = xmalloc(readerLen); + readerName = malloc(readerLen); rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #endif @@ -827,18 +826,18 @@ static DWORD handle_Status(IRP *irp, boolean wide) state = sc_map_state(state); poslen1 = stream_get_pos(irp->output); - stream_write_uint32(irp->output, readerLen); - stream_write_uint32(irp->output, 0x00020000); - stream_write_uint32(irp->output, state); - stream_write_uint32(irp->output, protocol); + stream_write_UINT32(irp->output, readerLen); + stream_write_UINT32(irp->output, 0x00020000); + stream_write_UINT32(irp->output, state); + stream_write_UINT32(irp->output, protocol); stream_write(irp->output, pbAtr, atrLen); if (atrLen < 32) stream_write_zero(irp->output, 32 - atrLen); - stream_write_uint32(irp->output, atrLen); + stream_write_UINT32(irp->output, atrLen); poslen2 = stream_get_pos(irp->output); - stream_write_uint32(irp->output, readerLen); + stream_write_UINT32(irp->output, readerLen); dataLength = sc_output_string(irp, readerName, wide); dataLength += sc_output_string(irp, "\0", wide); @@ -846,9 +845,9 @@ static DWORD handle_Status(IRP *irp, boolean wide) pos = stream_get_pos(irp->output); stream_set_pos(irp->output, poslen1); - stream_write_uint32(irp->output,dataLength); + stream_write_UINT32(irp->output,dataLength); stream_set_pos(irp->output, poslen2); - stream_write_uint32(irp->output,dataLength); + stream_write_UINT32(irp->output,dataLength); stream_set_pos(irp->output, pos); sc_output_alignment(irp, 8); @@ -857,48 +856,48 @@ static DWORD handle_Status(IRP *irp, boolean wide) /* SCardFreeMemory(NULL, readerName); */ free(readerName); #else - xfree(readerName); + free(readerName); #endif return rv; } -static uint32 handle_Transmit(IRP* irp) +static UINT32 handle_Transmit(IRP* irp) { LONG rv; SCARDCONTEXT hCard; - uint32 map[7], linkedLen; + UINT32 map[7], linkedLen; SCARD_IO_REQUEST pioSendPci, pioRecvPci, *pPioRecvPci; DWORD cbSendLength = 0, cbRecvLength = 0; BYTE *sendBuf = NULL, *recvBuf = NULL; stream_seek(irp->input, 0x14); - stream_read_uint32(irp->input, map[0]); + stream_read_UINT32(irp->input, map[0]); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, map[1]); + stream_read_UINT32(irp->input, map[1]); - stream_read_uint32(irp->input, pioSendPci.dwProtocol); - stream_read_uint32(irp->input, pioSendPci.cbPciLength); + stream_read_UINT32(irp->input, pioSendPci.dwProtocol); + stream_read_UINT32(irp->input, pioSendPci.cbPciLength); - stream_read_uint32(irp->input, map[2]); - stream_read_uint32(irp->input, cbSendLength); - stream_read_uint32(irp->input, map[3]); - stream_read_uint32(irp->input, map[4]); - stream_read_uint32(irp->input, map[5]); - stream_read_uint32(irp->input, cbRecvLength); + stream_read_UINT32(irp->input, map[2]); + stream_read_UINT32(irp->input, cbSendLength); + stream_read_UINT32(irp->input, map[3]); + stream_read_UINT32(irp->input, map[4]); + stream_read_UINT32(irp->input, map[5]); + stream_read_UINT32(irp->input, cbRecvLength); if (map[0] & SCARD_INPUT_LINKED) sc_input_skip_linked(irp); stream_seek(irp->input, 4); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); if (map[2] & SCARD_INPUT_LINKED) { /* sendPci */ - stream_read_uint32(irp->input, linkedLen); + stream_read_UINT32(irp->input, linkedLen); - stream_read_uint32(irp->input, pioSendPci.dwProtocol); + stream_read_UINT32(irp->input, pioSendPci.dwProtocol); stream_seek(irp->input, linkedLen - 4); sc_input_repos(irp, linkedLen); @@ -908,31 +907,31 @@ static uint32 handle_Transmit(IRP* irp) if (map[3] & SCARD_INPUT_LINKED) { /* send buffer */ - stream_read_uint32(irp->input, linkedLen); + stream_read_UINT32(irp->input, linkedLen); - sendBuf = xmalloc(linkedLen); + sendBuf = malloc(linkedLen); stream_read(irp->input, sendBuf, linkedLen); sc_input_repos(irp, linkedLen); } if (cbRecvLength) - recvBuf = xmalloc(cbRecvLength); + recvBuf = malloc(cbRecvLength); if (map[4] & SCARD_INPUT_LINKED) { /* recvPci */ - stream_read_uint32(irp->input, linkedLen); + stream_read_UINT32(irp->input, linkedLen); - stream_read_uint32(irp->input, pioRecvPci.dwProtocol); + stream_read_UINT32(irp->input, pioRecvPci.dwProtocol); stream_seek(irp->input, linkedLen - 4); sc_input_repos(irp, linkedLen); - stream_read_uint32(irp->input, map[6]); + stream_read_UINT32(irp->input, map[6]); if (map[6] & SCARD_INPUT_LINKED) { /* not sure what this is */ - stream_read_uint32(irp->input, linkedLen); + stream_read_UINT32(irp->input, linkedLen); stream_seek(irp->input, linkedLen); sc_input_repos(irp, linkedLen); @@ -960,7 +959,7 @@ static uint32 handle_Transmit(IRP* irp) { DEBUG_SCARD("Success (%d bytes)", (int) cbRecvLength); - stream_write_uint32(irp->output, 0); /* pioRecvPci 0x00; */ + stream_write_UINT32(irp->output, 0); /* pioRecvPci 0x00; */ sc_output_buffer_start(irp, cbRecvLength); /* start of recvBuf output */ @@ -969,38 +968,38 @@ static uint32 handle_Transmit(IRP* irp) sc_output_alignment(irp, 8); - xfree(sendBuf); - xfree(recvBuf); + free(sendBuf); + free(recvBuf); return rv; } -static uint32 handle_Control(IRP* irp) +static UINT32 handle_Control(IRP* irp) { LONG rv; SCARDCONTEXT hContext; SCARDHANDLE hCard; - uint32 map[3]; - uint32 controlCode; - uint32 controlFunction; + UINT32 map[3]; + UINT32 controlCode; + UINT32 controlFunction; BYTE *recvBuffer = NULL, *sendBuffer = NULL; - uint32 recvLength; + UINT32 recvLength; DWORD nBytesReturned; DWORD outBufferSize; stream_seek(irp->input, 0x14); - stream_read_uint32(irp->input, map[0]); + stream_read_UINT32(irp->input, map[0]); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, map[1]); - stream_read_uint32(irp->input, controlCode); - stream_read_uint32(irp->input, recvLength); - stream_read_uint32(irp->input, map[2]); + stream_read_UINT32(irp->input, map[1]); + stream_read_UINT32(irp->input, controlCode); + stream_read_UINT32(irp->input, recvLength); + stream_read_UINT32(irp->input, map[2]); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, outBufferSize); + stream_read_UINT32(irp->input, outBufferSize); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, hContext); + stream_read_UINT32(irp->input, hContext); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); /* Translate Windows SCARD_CTL_CODE's to corresponding local code */ if (WIN_CTL_DEVICE_TYPE(controlCode) == WIN_FILE_DEVICE_SMARTCARD) @@ -1013,9 +1012,9 @@ static uint32 handle_Control(IRP* irp) if (map[2] & SCARD_INPUT_LINKED) { /* read real input size */ - stream_read_uint32(irp->input, recvLength); + stream_read_UINT32(irp->input, recvLength); - recvBuffer = xmalloc(recvLength); + recvBuffer = malloc(recvLength); if (!recvBuffer) return sc_output_return(irp, SCARD_E_NO_MEMORY); @@ -1024,7 +1023,7 @@ static uint32 handle_Control(IRP* irp) } nBytesReturned = outBufferSize; - sendBuffer = xmalloc(outBufferSize); + sendBuffer = malloc(outBufferSize); if (!sendBuffer) return sc_output_return(irp, SCARD_E_NO_MEMORY); @@ -1037,9 +1036,9 @@ static uint32 handle_Control(IRP* irp) else DEBUG_SCARD("Success (out: %u bytes)", (unsigned) nBytesReturned); - stream_write_uint32(irp->output, (uint32) nBytesReturned); - stream_write_uint32(irp->output, 0x00000004); - stream_write_uint32(irp->output, nBytesReturned); + stream_write_UINT32(irp->output, (UINT32) nBytesReturned); + stream_write_UINT32(irp->output, 0x00000004); + stream_write_UINT32(irp->output, nBytesReturned); if (nBytesReturned > 0) { @@ -1049,26 +1048,26 @@ static uint32 handle_Control(IRP* irp) sc_output_alignment(irp, 8); - xfree(recvBuffer); - xfree(sendBuffer); + free(recvBuffer); + free(sendBuffer); return rv; } -static uint32 handle_GetAttrib(IRP* irp) +static UINT32 handle_GetAttrib(IRP* irp) { LONG rv; SCARDHANDLE hCard; DWORD dwAttrId = 0, dwAttrLen = 0; DWORD attrLen = 0; - uint8* pbAttr = NULL; + BYTE* pbAttr = NULL; stream_seek(irp->input, 0x20); - stream_read_uint32(irp->input, dwAttrId); + stream_read_UINT32(irp->input, dwAttrId); stream_seek(irp->input, 0x4); - stream_read_uint32(irp->input, dwAttrLen); + stream_read_UINT32(irp->input, dwAttrLen); stream_seek(irp->input, 0xC); - stream_read_uint32(irp->input, hCard); + stream_read_UINT32(irp->input, hCard); DEBUG_SCARD("hcard: 0x%08x, attrib: 0x%08x (%d bytes)", (unsigned) hCard, (unsigned) dwAttrId, (int) dwAttrLen); @@ -1084,7 +1083,7 @@ static uint32 handle_GetAttrib(IRP* irp) } #endif - rv = SCardGetAttrib(hCard, dwAttrId, attrLen == 0 ? NULL : (uint8*) &pbAttr, &attrLen); + rv = SCardGetAttrib(hCard, dwAttrId, attrLen == 0 ? NULL : (BYTE*) &pbAttr, &attrLen); if( rv != SCARD_S_SUCCESS ) { #ifdef SCARD_AUTOALLOCATE if(dwAttrLen == 0) @@ -1101,7 +1100,7 @@ static uint32 handle_GetAttrib(IRP* irp) if(dwAttrId == SCARD_ATTR_DEVICE_FRIENDLY_NAME_A && rv == SCARD_E_UNSUPPORTED_FEATURE) { rv = SCardGetAttrib(hCard, SCARD_ATTR_DEVICE_FRIENDLY_NAME_W, - attrLen == 0 ? NULL : (uint8*) &pbAttr, &attrLen); + attrLen == 0 ? NULL : (BYTE*) &pbAttr, &attrLen); if( rv != SCARD_S_SUCCESS ) { #ifdef SCARD_AUTOALLOCATE if(dwAttrLen == 0) @@ -1118,7 +1117,7 @@ static uint32 handle_GetAttrib(IRP* irp) if(dwAttrId == SCARD_ATTR_DEVICE_FRIENDLY_NAME_W && rv == SCARD_E_UNSUPPORTED_FEATURE) { rv = SCardGetAttrib(hCard, SCARD_ATTR_DEVICE_FRIENDLY_NAME_A, - attrLen == 0 ? NULL : (uint8*) &pbAttr, &attrLen); + attrLen == 0 ? NULL : (BYTE*) &pbAttr, &attrLen); if( rv != SCARD_S_SUCCESS ) { #ifdef SCARD_AUTOALLOCATE if(dwAttrLen == 0) @@ -1148,9 +1147,9 @@ static uint32 handle_GetAttrib(IRP* irp) { DEBUG_SCARD("Success (%d bytes)", (int) dwAttrLen); - stream_write_uint32(irp->output, dwAttrLen); - stream_write_uint32(irp->output, 0x00000200); - stream_write_uint32(irp->output, dwAttrLen); + stream_write_UINT32(irp->output, dwAttrLen); + stream_write_UINT32(irp->output, 0x00000200); + stream_write_UINT32(irp->output, dwAttrLen); if (!pbAttr) { @@ -1162,22 +1161,22 @@ static uint32 handle_GetAttrib(IRP* irp) } sc_output_repos(irp, dwAttrLen); /* align to multiple of 4 */ - stream_write_uint32(irp->output, 0); + stream_write_UINT32(irp->output, 0); } sc_output_alignment(irp, 8); - xfree(pbAttr); + free(pbAttr); return rv; } -static uint32 handle_AccessStartedEvent(IRP* irp) +static UINT32 handle_AccessStartedEvent(IRP* irp) { sc_output_alignment(irp, 8); return SCARD_S_SUCCESS; } -void scard_error(SCARD_DEVICE* scard, IRP* irp, uint32 ntstatus) +void scard_error(SCARD_DEVICE* scard, IRP* irp, UINT32 ntstatus) { /* [MS-RDPESC] 3.1.4.4 */ printf("scard processing error %x\n", ntstatus); @@ -1190,19 +1189,19 @@ void scard_error(SCARD_DEVICE* scard, IRP* irp, uint32 ntstatus) /* http://msdn.microsoft.com/en-gb/library/ms938473.aspx */ typedef struct _SERVER_SCARD_ATRMASK { - uint32 cbAtr; - uint8 rgbAtr[36]; - uint8 rgbMask[36]; + UINT32 cbAtr; + BYTE rgbAtr[36]; + BYTE rgbMask[36]; } SERVER_SCARD_ATRMASK; -static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide) +static UINT32 handle_LocateCardsByATR(IRP* irp, BOOL wide) { LONG rv; int i, j, k; SCARDCONTEXT hContext; - uint32 atrMaskCount = 0; - uint32 readerCount = 0; + UINT32 atrMaskCount = 0; + UINT32 readerCount = 0; SCARD_READERSTATE* cur = NULL; SCARD_READERSTATE* rsCur = NULL; SCARD_READERSTATE* readerStates = NULL; @@ -1210,22 +1209,22 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide) SERVER_SCARD_ATRMASK* pAtrMasks = NULL; stream_seek(irp->input, 0x2C); - stream_read_uint32(irp->input, hContext); - stream_read_uint32(irp->input, atrMaskCount); + stream_read_UINT32(irp->input, hContext); + stream_read_UINT32(irp->input, atrMaskCount); - pAtrMasks = xmalloc(atrMaskCount * sizeof(SERVER_SCARD_ATRMASK)); + pAtrMasks = malloc(atrMaskCount * sizeof(SERVER_SCARD_ATRMASK)); if (!pAtrMasks) return sc_output_return(irp, SCARD_E_NO_MEMORY); for (i = 0; i < atrMaskCount; i++) { - stream_read_uint32(irp->input, pAtrMasks[i].cbAtr); + stream_read_UINT32(irp->input, pAtrMasks[i].cbAtr); stream_read(irp->input, pAtrMasks[i].rgbAtr, 36); stream_read(irp->input, pAtrMasks[i].rgbMask, 36); } - stream_read_uint32(irp->input, readerCount); + stream_read_UINT32(irp->input, readerCount); readerStates = xzalloc(readerCount * sizeof(SCARD_READERSTATE)); @@ -1243,9 +1242,9 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide) * convert to host endian or fix the headers to * request the order we want */ - stream_read_uint32(irp->input, cur->dwCurrentState); - stream_read_uint32(irp->input, cur->dwEventState); - stream_read_uint32(irp->input, cur->cbAtr); + stream_read_UINT32(irp->input, cur->dwCurrentState); + stream_read_UINT32(irp->input, cur->dwEventState); + stream_read_UINT32(irp->input, cur->cbAtr); stream_read(irp->input, cur->rgbAtr, 32); stream_seek(irp->input, 4); @@ -1259,10 +1258,10 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide) for (i = 0; i < readerCount; i++) { cur = &readerStates[i]; - uint32 dataLength; + UINT32 dataLength; stream_seek(irp->input, 8); - stream_read_uint32(irp->input, dataLength); + stream_read_UINT32(irp->input, dataLength); sc_input_repos(irp, sc_input_string(irp, (char **) &cur->szReader, dataLength, wide)); DEBUG_SCARD(" \"%s\"", cur->szReader ? cur->szReader : "NULL"); @@ -1288,7 +1287,7 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide) { for (j = 0, rsCur = readerStates; j < readerCount; j++, rsCur++) { - boolean equal = 1; + BOOL equal = 1; for (k = 0; k < cur->cbAtr; k++) { if ((curAtr->rgbAtr[k] & curAtr->rgbMask[k]) != @@ -1305,20 +1304,20 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide) } } - stream_write_uint32(irp->output, readerCount); - stream_write_uint32(irp->output, 0x00084dd8); - stream_write_uint32(irp->output, readerCount); + stream_write_UINT32(irp->output, readerCount); + stream_write_UINT32(irp->output, 0x00084dd8); + stream_write_UINT32(irp->output, readerCount); for (i = 0, rsCur = readerStates; i < readerCount; i++, rsCur++) { - stream_write_uint32(irp->output, cur->dwCurrentState); - stream_write_uint32(irp->output, cur->dwEventState); - stream_write_uint32(irp->output, cur->cbAtr); + stream_write_UINT32(irp->output, cur->dwCurrentState); + stream_write_UINT32(irp->output, cur->dwEventState); + stream_write_UINT32(irp->output, cur->cbAtr); stream_write(irp->output, cur->rgbAtr, 32); stream_write_zero(irp->output, 4); - xfree((void*) cur->szReader); + free((void*) cur->szReader); } sc_output_alignment(irp, 8); @@ -1328,13 +1327,13 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide) return rv; } -boolean scard_async_op(IRP* irp) +BOOL scard_async_op(IRP* irp) { - uint32 ioctl_code; + UINT32 ioctl_code; /* peek ahead */ stream_seek(irp->input, 8); - stream_read_uint32(irp->input, ioctl_code); + stream_read_UINT32(irp->input, ioctl_code); stream_rewind(irp->input, 12); switch (ioctl_code) @@ -1346,7 +1345,7 @@ boolean scard_async_op(IRP* irp) case SCARD_IOCTL_RELEASE_CONTEXT: case SCARD_IOCTL_IS_VALID_CONTEXT: - return false; + return FALSE; break; /* async events */ @@ -1357,7 +1356,7 @@ boolean scard_async_op(IRP* irp) case SCARD_IOCTL_STATUS: case SCARD_IOCTL_STATUS + 4: - return true; + return TRUE; break; default: @@ -1365,27 +1364,27 @@ boolean scard_async_op(IRP* irp) } /* default to async */ - return true; + return TRUE; } void scard_device_control(SCARD_DEVICE* scard, IRP* irp) { - uint32 pos; - uint32 result; - uint32 result_pos; - uint32 output_len; - uint32 input_len; - uint32 ioctl_code; - uint32 stream_len; - uint32 irp_result_pos; - uint32 output_len_pos; - const uint32 header_lengths = 16; /* MS-RPCE, Sections 2.2.6.1 + UINT32 pos; + UINT32 result; + UINT32 result_pos; + UINT32 output_len; + UINT32 input_len; + UINT32 ioctl_code; + UINT32 stream_len; + UINT32 irp_result_pos; + UINT32 output_len_pos; + const UINT32 header_lengths = 16; /* MS-RPCE, Sections 2.2.6.1 * and 2.2.6.2. */ - stream_read_uint32(irp->input, output_len); - stream_read_uint32(irp->input, input_len); - stream_read_uint32(irp->input, ioctl_code); + stream_read_UINT32(irp->input, output_len); + stream_read_UINT32(irp->input, input_len); + stream_read_UINT32(irp->input, ioctl_code); stream_seek(irp->input, 20); /* padding */ @@ -1398,20 +1397,20 @@ void scard_device_control(SCARD_DEVICE* scard, IRP* irp) irp_result_pos = stream_get_pos(irp->output); - stream_write_uint32(irp->output, 0x00000000); /* MS-RDPEFS + stream_write_UINT32(irp->output, 0x00000000); /* MS-RDPEFS * OutputBufferLength * will be updated * later in this * function. */ /* [MS-RPCE] 2.2.6.1 */ - stream_write_uint32(irp->output, 0x00081001); /* len 8, LE, v1 */ - stream_write_uint32(irp->output, 0xcccccccc); /* filler */ + stream_write_UINT32(irp->output, 0x00081001); /* len 8, LE, v1 */ + stream_write_UINT32(irp->output, 0xcccccccc); /* filler */ output_len_pos = stream_get_pos(irp->output); stream_seek(irp->output, 4); /* size */ - stream_write_uint32(irp->output, 0x0); /* filler */ + stream_write_UINT32(irp->output, 0x0); /* filler */ result_pos = stream_get_pos(irp->output); stream_seek(irp->output, 4); /* result */ @@ -1531,16 +1530,16 @@ void scard_device_control(SCARD_DEVICE* scard, IRP* irp) pos = stream_get_pos(irp->output); stream_len = pos - irp_result_pos - 4; /* Value of OutputBufferLength */ stream_set_pos(irp->output, irp_result_pos); - stream_write_uint32(irp->output, stream_len); + stream_write_UINT32(irp->output, stream_len); stream_set_pos(irp->output, output_len_pos); /* Remove the effect of the MS-RPCE Common Type Header and Private * Header (Sections 2.2.6.1 and 2.2.6.2). */ - stream_write_uint32(irp->output, stream_len - header_lengths); + stream_write_UINT32(irp->output, stream_len - header_lengths); stream_set_pos(irp->output, result_pos); - stream_write_uint32(irp->output, result); + stream_write_UINT32(irp->output, result); stream_set_pos(irp->output, pos); diff --git a/channels/tsmf/CMakeLists.txt b/channels/tsmf/CMakeLists.txt index 7d38fd55f..42d0751fe 100644 --- a/channels/tsmf/CMakeLists.txt +++ b/channels/tsmf/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau diff --git a/channels/tsmf/client/CMakeLists.txt b/channels/tsmf/client/CMakeLists.txt index baf97c55b..f3ca6a932 100644 --- a/channels/tsmf/client/CMakeLists.txt +++ b/channels/tsmf/client/CMakeLists.txt @@ -1,9 +1,7 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(TSMF_SRCS +set(MODULE_NAME "tsmf") +set(MODULE_PREFIX "CHANNEL_TSMF_CLIENT") + +set(${MODULE_PREFIX}_SRCS tsmf_audio.c tsmf_audio.h tsmf_codec.c @@ -36,25 +37,27 @@ set(TSMF_SRCS include_directories(..) -add_library(tsmf ${TSMF_SRCS}) -set_target_properties(tsmf PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) - target_link_libraries(tsmf freerdp) +if(MONOLITHIC_BUILD) + target_link_libraries(${MODULE_NAME} freerdp) else() - target_link_libraries(tsmf freerdp-utils) + target_link_libraries(${MODULE_NAME} freerdp-utils) endif() -install(TARGETS tsmf DESTINATION ${FREERDP_PLUGIN_PATH}) +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") if(WITH_FFMPEG) add_subdirectory(ffmpeg) endif() if(WITH_XRANDR) -if(GSTREAMER_FOUND) - add_subdirectory(gstreamer) -endif() + if(GSTREAMER_FOUND) + add_subdirectory(gstreamer) + endif() endif() if(WITH_ALSA) @@ -64,4 +67,3 @@ endif() if(WITH_PULSEAUDIO) add_subdirectory(pulse) endif() - diff --git a/channels/tsmf/client/alsa/CMakeLists.txt b/channels/tsmf/client/alsa/CMakeLists.txt index 4b984e4bf..07ba391c8 100644 --- a/channels/tsmf/client/alsa/CMakeLists.txt +++ b/channels/tsmf/client/alsa/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -27,7 +27,7 @@ include_directories(${ALSA_INCLUDE_DIRS}) add_library(tsmf_alsa ${TSMF_ALSA_SRCS}) set_target_properties(tsmf_alsa PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(tsmf_alsa freerdp) else() target_link_libraries(tsmf_alsa freerdp-utils) diff --git a/channels/tsmf/client/alsa/tsmf_alsa.c b/channels/tsmf/client/alsa/tsmf_alsa.c index a05ff09fa..176e89dce 100644 --- a/channels/tsmf/client/alsa/tsmf_alsa.c +++ b/channels/tsmf/client/alsa/tsmf_alsa.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - ALSA Audio Device * * Copyright 2010-2011 Vic Lee @@ -39,16 +39,16 @@ typedef struct _TSMFALSAAudioDevice char device[32]; snd_pcm_t* out_handle; - uint32 source_rate; - uint32 actual_rate; - uint32 source_channels; - uint32 actual_channels; - uint32 bytes_per_sample; + UINT32 source_rate; + UINT32 actual_rate; + UINT32 source_channels; + UINT32 actual_channels; + UINT32 bytes_per_sample; FREERDP_DSP_CONTEXT* dsp_context; } TSMFALSAAudioDevice; -static boolean tsmf_alsa_open_device(TSMFALSAAudioDevice* alsa) +static BOOL tsmf_alsa_open_device(TSMFALSAAudioDevice* alsa) { int error; @@ -56,14 +56,14 @@ static boolean tsmf_alsa_open_device(TSMFALSAAudioDevice* alsa) if (error < 0) { DEBUG_WARN("failed to open device %s", alsa->device); - return false; + return FALSE; } DEBUG_DVC("open device %s", alsa->device); - return true; + return TRUE; } -static boolean tsmf_alsa_open(ITSMFAudioDevice* audio, const char* device) +static BOOL tsmf_alsa_open(ITSMFAudioDevice* audio, const char* device) { TSMFALSAAudioDevice* alsa = (TSMFALSAAudioDevice*) audio; @@ -80,8 +80,8 @@ static boolean tsmf_alsa_open(ITSMFAudioDevice* audio, const char* device) return tsmf_alsa_open_device(alsa); } -static boolean tsmf_alsa_set_format(ITSMFAudioDevice* audio, - uint32 sample_rate, uint32 channels, uint32 bits_per_sample) +static BOOL tsmf_alsa_set_format(ITSMFAudioDevice* audio, + UINT32 sample_rate, UINT32 channels, UINT32 bits_per_sample) { int error; snd_pcm_uframes_t frames; @@ -90,7 +90,7 @@ static boolean tsmf_alsa_set_format(ITSMFAudioDevice* audio, TSMFALSAAudioDevice* alsa = (TSMFALSAAudioDevice*) audio; if (!alsa->out_handle) - return false; + return FALSE; snd_pcm_drop(alsa->out_handle); @@ -102,7 +102,7 @@ static boolean tsmf_alsa_set_format(ITSMFAudioDevice* audio, if (error < 0) { DEBUG_WARN("snd_pcm_hw_params_malloc failed"); - return false; + return FALSE; } snd_pcm_hw_params_any(alsa->out_handle, hw_params); snd_pcm_hw_params_set_access(alsa->out_handle, hw_params, @@ -123,7 +123,7 @@ static boolean tsmf_alsa_set_format(ITSMFAudioDevice* audio, if (error < 0) { DEBUG_WARN("snd_pcm_sw_params_malloc"); - return false; + return FALSE; } snd_pcm_sw_params_current(alsa->out_handle, sw_params); snd_pcm_sw_params_set_start_threshold(alsa->out_handle, sw_params, @@ -144,17 +144,17 @@ static boolean tsmf_alsa_set_format(ITSMFAudioDevice* audio, alsa->actual_rate, alsa->actual_channels, alsa->source_rate, alsa->source_channels); } - return true; + return TRUE; } -static boolean tsmf_alsa_play(ITSMFAudioDevice* audio, uint8* data, uint32 data_size) +static BOOL tsmf_alsa_play(ITSMFAudioDevice* audio, BYTE* data, UINT32 data_size) { int len; int error; int frames; - uint8* end; - uint8* src; - uint8* pindex; + BYTE* end; + BYTE* src; + BYTE* pindex; int rbytes_per_frame; int sbytes_per_frame; TSMFALSAAudioDevice* alsa = (TSMFALSAAudioDevice*) audio; @@ -209,14 +209,14 @@ static boolean tsmf_alsa_play(ITSMFAudioDevice* audio, uint8* data, uint32 data_ pindex += error * rbytes_per_frame; } } - xfree(data); + free(data); - return true; + return TRUE; } -static uint64 tsmf_alsa_get_latency(ITSMFAudioDevice* audio) +static UINT64 tsmf_alsa_get_latency(ITSMFAudioDevice* audio) { - uint64 latency = 0; + UINT64 latency = 0; snd_pcm_sframes_t frames = 0; TSMFALSAAudioDevice* alsa = (TSMFALSAAudioDevice*) audio; @@ -224,7 +224,7 @@ static uint64 tsmf_alsa_get_latency(ITSMFAudioDevice* audio) snd_pcm_delay(alsa->out_handle, &frames) == 0 && frames > 0) { - latency = ((uint64)frames) * 10000000LL / (uint64)alsa->actual_rate; + latency = ((UINT64)frames) * 10000000LL / (UINT64)alsa->actual_rate; } return latency; } @@ -245,7 +245,7 @@ static void tsmf_alsa_free(ITSMFAudioDevice* audio) snd_pcm_close(alsa->out_handle); } freerdp_dsp_context_free(alsa->dsp_context); - xfree(alsa); + free(alsa); } ITSMFAudioDevice* TSMFAudioDeviceEntry(void) diff --git a/channels/tsmf/client/ffmpeg/CMakeLists.txt b/channels/tsmf/client/ffmpeg/CMakeLists.txt index 290237b5c..b30464d2b 100644 --- a/channels/tsmf/client/ffmpeg/CMakeLists.txt +++ b/channels/tsmf/client/ffmpeg/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -34,7 +34,7 @@ if(CMAKE_COMPILER_IS_GNUCC) endif() endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(tsmf_ffmpeg freerdp) else() target_link_libraries(tsmf_ffmpeg freerdp-utils) diff --git a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c index a4dbe8113..d085a32e7 100644 --- a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c +++ b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - FFmpeg Decoder * * Copyright 2010-2011 Vic Lee @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include "tsmf_constants.h" @@ -50,12 +50,12 @@ typedef struct _TSMFFFmpegDecoder AVFrame* frame; int prepared; - uint8* decoded_data; - uint32 decoded_size; - uint32 decoded_size_max; + BYTE* decoded_data; + UINT32 decoded_size; + UINT32 decoded_size_max; } TSMFFFmpegDecoder; -static boolean tsmf_ffmpeg_init_context(ITSMFDecoder* decoder) +static BOOL tsmf_ffmpeg_init_context(ITSMFDecoder* decoder) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; @@ -63,13 +63,13 @@ static boolean tsmf_ffmpeg_init_context(ITSMFDecoder* decoder) if (!mdecoder->codec_context) { DEBUG_WARN("avcodec_alloc_context failed."); - return false; + return FALSE; } - return true; + return TRUE; } -static boolean tsmf_ffmpeg_init_video_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYPE* media_type) +static BOOL tsmf_ffmpeg_init_video_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYPE* media_type) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; @@ -81,10 +81,10 @@ static boolean tsmf_ffmpeg_init_video_stream(ITSMFDecoder* decoder, const TS_AM_ mdecoder->frame = avcodec_alloc_frame(); - return true; + return TRUE; } -static boolean tsmf_ffmpeg_init_audio_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYPE* media_type) +static BOOL tsmf_ffmpeg_init_audio_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYPE* media_type) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; @@ -103,21 +103,21 @@ static boolean tsmf_ffmpeg_init_audio_stream(ITSMFDecoder* decoder, const TS_AM_ #endif #endif - return true; + return TRUE; } -static boolean tsmf_ffmpeg_init_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYPE* media_type) +static BOOL tsmf_ffmpeg_init_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYPE* media_type) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; - uint32 size; - const uint8* s; - uint8* p; + UINT32 size; + const BYTE* s; + BYTE* p; mdecoder->codec = avcodec_find_decoder(mdecoder->codec_id); if (!mdecoder->codec) { DEBUG_WARN("avcodec_find_decoder failed."); - return false; + return FALSE; } mdecoder->codec_context->codec_id = mdecoder->codec_id; @@ -126,12 +126,12 @@ static boolean tsmf_ffmpeg_init_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_ if (mdecoder->media_type == AVMEDIA_TYPE_VIDEO) { if (!tsmf_ffmpeg_init_video_stream(decoder, media_type)) - return false; + return FALSE; } else if (mdecoder->media_type == AVMEDIA_TYPE_AUDIO) { if (!tsmf_ffmpeg_init_audio_stream(decoder, media_type)) - return false; + return FALSE; } if (media_type->ExtraData) @@ -151,12 +151,12 @@ static boolean tsmf_ffmpeg_init_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_ *p++ = 0xff; /* Flag? */ *p++ = 0xe0 | 0x01; /* Reserved | #sps */ s = media_type->ExtraData + 20; - size = ((uint32)(*s)) * 256 + ((uint32)(*(s + 1))); + size = ((UINT32)(*s)) * 256 + ((UINT32)(*(s + 1))); memcpy(p, s, size + 2); s += size + 2; p += size + 2; *p++ = 1; /* #pps */ - size = ((uint32)(*s)) * 256 + ((uint32)(*(s + 1))); + size = ((UINT32)(*s)) * 256 + ((UINT32)(*(s + 1))); memcpy(p, s, size + 2); } else @@ -172,25 +172,25 @@ static boolean tsmf_ffmpeg_init_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_ if (mdecoder->codec->capabilities & CODEC_CAP_TRUNCATED) mdecoder->codec_context->flags |= CODEC_FLAG_TRUNCATED; - return true; + return TRUE; } -static boolean tsmf_ffmpeg_prepare(ITSMFDecoder* decoder) +static BOOL tsmf_ffmpeg_prepare(ITSMFDecoder* decoder) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; if (avcodec_open2(mdecoder->codec_context, mdecoder->codec, NULL) < 0) { DEBUG_WARN("avcodec_open2 failed."); - return false; + return FALSE; } mdecoder->prepared = 1; - return true; + return TRUE; } -static boolean tsmf_ffmpeg_set_format(ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* media_type) +static BOOL tsmf_ffmpeg_set_format(ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* media_type) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; @@ -203,7 +203,7 @@ static boolean tsmf_ffmpeg_set_format(ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* m mdecoder->media_type = AVMEDIA_TYPE_AUDIO; break; default: - return false; + return FALSE; } switch (media_type->SubType) { @@ -247,26 +247,26 @@ static boolean tsmf_ffmpeg_set_format(ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* m mdecoder->codec_id = CODEC_ID_AC3; break; default: - return false; + return FALSE; } if (!tsmf_ffmpeg_init_context(decoder)) - return false; + return FALSE; if (!tsmf_ffmpeg_init_stream(decoder, media_type)) - return false; + return FALSE; if (!tsmf_ffmpeg_prepare(decoder)) - return false; + return FALSE; - return true; + return TRUE; } -static boolean tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const uint8* data, uint32 data_size, uint32 extensions) +static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const BYTE* data, UINT32 data_size, UINT32 extensions) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; int decoded; int len; AVFrame* frame; - boolean ret = true; + BOOL ret = TRUE; #if LIBAVCODEC_VERSION_MAJOR < 52 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR <= 20) len = avcodec_decode_video(mdecoder->codec_context, mdecoder->frame, &decoded, data, data_size); @@ -274,7 +274,7 @@ static boolean tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const uint8* data { AVPacket pkt; av_init_packet(&pkt); - pkt.data = (uint8*) data; + pkt.data = (BYTE*) data; pkt.size = data_size; if (extensions & TSMM_SAMPLE_EXT_CLEANPOINT) pkt.flags |= AV_PKT_FLAG_KEY; @@ -285,12 +285,12 @@ static boolean tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const uint8* data if (len < 0) { DEBUG_WARN("data_size %d, avcodec_decode_video failed (%d)", data_size, len); - ret = false; + ret = FALSE; } else if (!decoded) { DEBUG_WARN("data_size %d, no frame is decoded.", data_size); - ret = false; + ret = FALSE; } else { @@ -319,14 +319,14 @@ static boolean tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const uint8* data return ret; } -static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data, uint32 data_size, uint32 extensions) +static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UINT32 data_size, UINT32 extensions) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; int len; int frame_size; - uint32 src_size; - const uint8* src; - uint8* dst; + UINT32 src_size; + const BYTE* src; + BYTE* dst; int dst_offset; #if 0 @@ -345,7 +345,7 @@ static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data mdecoder->decoded_size_max = AVCODEC_MAX_AUDIO_FRAME_SIZE + 16; mdecoder->decoded_data = xzalloc(mdecoder->decoded_size_max); /* align the memory for SSE2 needs */ - dst = (uint8*) (((uintptr_t)mdecoder->decoded_data + 15) & ~ 0x0F); + dst = (BYTE*) (((uintptr_t)mdecoder->decoded_data + 15) & ~ 0x0F); dst_offset = dst - mdecoder->decoded_data; src = data; src_size = data_size; @@ -356,8 +356,8 @@ static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data if (mdecoder->decoded_size_max - mdecoder->decoded_size < AVCODEC_MAX_AUDIO_FRAME_SIZE) { mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16; - mdecoder->decoded_data = xrealloc(mdecoder->decoded_data, mdecoder->decoded_size_max); - dst = (uint8*) (((uintptr_t)mdecoder->decoded_data + 15) & ~ 0x0F); + mdecoder->decoded_data = realloc(mdecoder->decoded_data, mdecoder->decoded_size_max); + dst = (BYTE*) (((uintptr_t)mdecoder->decoded_data + 15) & ~ 0x0F); if (dst - mdecoder->decoded_data != dst_offset) { /* re-align the memory if the alignment has changed after realloc */ @@ -377,7 +377,7 @@ static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data int got_frame = 0; AVPacket pkt; av_init_packet(&pkt); - pkt.data = (uint8*) src; + pkt.data = (BYTE*) src; pkt.size = src_size; len = avcodec_decode_audio4(mdecoder->codec_context, decoded_frame, &got_frame, &pkt); @@ -404,7 +404,7 @@ static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data if (mdecoder->decoded_size == 0) { - xfree(mdecoder->decoded_data); + free(mdecoder->decoded_data); mdecoder->decoded_data = NULL; } else if (dst_offset) @@ -416,16 +416,16 @@ static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data DEBUG_DVC("data_size %d decoded_size %d", data_size, mdecoder->decoded_size); - return true; + return TRUE; } -static boolean tsmf_ffmpeg_decode(ITSMFDecoder* decoder, const uint8* data, uint32 data_size, uint32 extensions) +static BOOL tsmf_ffmpeg_decode(ITSMFDecoder* decoder, const BYTE* data, UINT32 data_size, UINT32 extensions) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; if (mdecoder->decoded_data) { - xfree(mdecoder->decoded_data); + free(mdecoder->decoded_data); mdecoder->decoded_data = NULL; } mdecoder->decoded_size = 0; @@ -438,14 +438,14 @@ static boolean tsmf_ffmpeg_decode(ITSMFDecoder* decoder, const uint8* data, uint return tsmf_ffmpeg_decode_audio(decoder, data, data_size, extensions); default: DEBUG_WARN("unknown media type."); - return false; + return FALSE; } } -static uint8* tsmf_ffmpeg_get_decoded_data(ITSMFDecoder* decoder, uint32* size) +static BYTE* tsmf_ffmpeg_get_decoded_data(ITSMFDecoder* decoder, UINT32* size) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; - uint8* buf; + BYTE* buf; *size = mdecoder->decoded_size; buf = mdecoder->decoded_data; @@ -454,7 +454,7 @@ static uint8* tsmf_ffmpeg_get_decoded_data(ITSMFDecoder* decoder, uint32* size) return buf; } -static uint32 tsmf_ffmpeg_get_decoded_format(ITSMFDecoder* decoder) +static UINT32 tsmf_ffmpeg_get_decoded_format(ITSMFDecoder* decoder) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; @@ -466,11 +466,11 @@ static uint32 tsmf_ffmpeg_get_decoded_format(ITSMFDecoder* decoder) default: DEBUG_WARN("unsupported pixel format %u", mdecoder->codec_context->pix_fmt); - return (uint32) -1; + return (UINT32) -1; } } -static boolean tsmf_ffmpeg_get_decoded_dimension(ITSMFDecoder* decoder, uint32* width, uint32* height) +static BOOL tsmf_ffmpeg_get_decoded_dimension(ITSMFDecoder* decoder, UINT32* width, UINT32* height) { TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder; @@ -478,11 +478,11 @@ static boolean tsmf_ffmpeg_get_decoded_dimension(ITSMFDecoder* decoder, uint32* { *width = mdecoder->codec_context->width; *height = mdecoder->codec_context->height; - return true; + return TRUE; } else { - return false; + return FALSE; } } @@ -493,19 +493,19 @@ static void tsmf_ffmpeg_free(ITSMFDecoder* decoder) if (mdecoder->frame) av_free(mdecoder->frame); if (mdecoder->decoded_data) - xfree(mdecoder->decoded_data); + free(mdecoder->decoded_data); if (mdecoder->codec_context) { if (mdecoder->prepared) avcodec_close(mdecoder->codec_context); if (mdecoder->codec_context->extradata) - xfree(mdecoder->codec_context->extradata); + free(mdecoder->codec_context->extradata); av_free(mdecoder->codec_context); } - xfree(decoder); + free(decoder); } -static boolean initialized = false; +static BOOL initialized = FALSE; ITSMFDecoder* TSMFDecoderEntry(void) @@ -515,7 +515,7 @@ TSMFDecoderEntry(void) if (!initialized) { avcodec_register_all(); - initialized = true; + initialized = TRUE; } decoder = xnew(TSMFFFmpegDecoder); diff --git a/channels/tsmf/client/gstreamer/CMakeLists.txt b/channels/tsmf/client/gstreamer/CMakeLists.txt index f1a72abbf..9834e942c 100644 --- a/channels/tsmf/client/gstreamer/CMakeLists.txt +++ b/channels/tsmf/client/gstreamer/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script for gstreamer plugin # # (C) Copyright 2012 Hewlett-Packard Development Company, L.P. @@ -27,7 +27,7 @@ include_directories(${GSTREAMER_INCLUDE_DIRS}) add_library(tsmf_gstreamer ${TSMF_GSTREAMER_SRCS}) set_target_properties(tsmf_gstreamer PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(tsmf_gstreamer freerdp) else() target_link_libraries(tsmf_gstreamer freerdp-utils) diff --git a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c index 0a5c8580c..89b52e6d4 100644 --- a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c +++ b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c @@ -1,5 +1,5 @@ /* - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - GStreamer Decoder * * (C) Copyright 2012 HP Development Company, LLC @@ -69,8 +69,8 @@ typedef struct _TSMFGstreamerDecoder GstElement *outsink; GstElement *aVolume; - boolean paused; - uint64 last_sample_end_time; + BOOL paused; + UINT64 last_sample_end_time; Display *disp; int *xfwin; @@ -95,7 +95,7 @@ const char *NAME_GST_STATE_NULL = "GST_STATE_NULL"; const char *NAME_GST_STATE_VOID_PENDING = "GST_STATE_VOID_PENDING"; const char *NAME_GST_STATE_OTHER = "GST_STATE_?"; -static inline const GstClockTime tsmf_gstreamer_timestamp_ms_to_gst(uint64 ms_timestamp) +static inline const GstClockTime tsmf_gstreamer_timestamp_ms_to_gst(UINT64 ms_timestamp) { /* * Convert Microsoft 100ns timestamps to Gstreamer 1ns units. @@ -319,11 +319,11 @@ static int tsmf_gstreamer_pipeline_set_state(TSMFGstreamerDecoder * mdecoder, Gs return 0; } -static boolean tsmf_gstreamer_set_format(ITSMFDecoder * decoder, TS_AM_MEDIA_TYPE * media_type) +static BOOL tsmf_gstreamer_set_format(ITSMFDecoder * decoder, TS_AM_MEDIA_TYPE * media_type) { TSMFGstreamerDecoder * mdecoder = (TSMFGstreamerDecoder *) decoder; if (!mdecoder) - return false; + return FALSE; GstBuffer *gst_buf_cap_codec_data; /* Buffer to hold extra descriptive codec-specific caps data */ DEBUG_DVC("tsmf_gstreamer_set_format: "); @@ -680,7 +680,7 @@ static void tsmf_gstreamer_pipeline_send_end_of_stream(TSMFGstreamerDecoder * md #ifdef __arm__ /* code from TI to check whether OMX is being lock or not */ -static boolean tsmf_gstreamer_pipeline_omx_available() +static BOOL tsmf_gstreamer_pipeline_omx_available() { bool ret = TRUE; int shm_fd = 0; @@ -772,10 +772,10 @@ static void tsmf_gstreamer_clean_up(TSMFGstreamerDecoder * mdecoder) } -static boolean tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder * mdecoder) +static BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder * mdecoder) { if (!mdecoder) - return false; + return FALSE; GstPad *out_pad; mdecoder->pipe = gst_pipeline_new (NULL); @@ -1036,7 +1036,7 @@ static boolean tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder * mdecoder) out_pad = gst_element_get_static_pad(mdecoder->outconv, "sink"); - gboolean linkResult = FALSE; + gBOOL linkResult = FALSE; gst_bin_add(GST_BIN(mdecoder->outbin), mdecoder->outconv); gst_bin_add(GST_BIN(mdecoder->outbin), mdecoder->outsink); if (mdecoder->aVolume) @@ -1094,8 +1094,8 @@ static boolean tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder * mdecoder) return TRUE; } -static boolean tsmf_gstreamer_decodeEx(ITSMFDecoder * decoder, const uint8 * data, uint32 data_size, uint32 extensions, - uint64 start_time, uint64 end_time, uint64 duration) +static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder * decoder, const BYTE * data, UINT32 data_size, UINT32 extensions, + UINT64 start_time, UINT64 end_time, UINT64 duration) { TSMFGstreamerDecoder * mdecoder = (TSMFGstreamerDecoder *) decoder; if (!mdecoder) @@ -1215,12 +1215,12 @@ static boolean tsmf_gstreamer_decodeEx(ITSMFDecoder * decoder, const uint8 * dat FILE *fin = fopen("/tmp/tsmf_aseek.info", "rt"); if (fin) { - uint64 AStartTime = 0; + UINT64 AStartTime = 0; fscanf(fin, "%"PRIu64, &AStartTime); fclose(fin); if (start_time > AStartTime) { - uint64 streamDelay = (start_time - AStartTime) / 10; + UINT64 streamDelay = (start_time - AStartTime) / 10; usleep(streamDelay); } unlink("/tmp/tsmf_aseek.info"); @@ -1249,12 +1249,12 @@ static boolean tsmf_gstreamer_decodeEx(ITSMFDecoder * decoder, const uint8 * dat fin = fopen("/tmp/tsmf_vseek.info", "rt"); if (fin) { - uint64 VStartTime = 0; + UINT64 VStartTime = 0; fscanf(fin, "%"PRIu64, &VStartTime); fclose(fin); if (start_time > VStartTime) { - uint64 streamDelay = (start_time - VStartTime) / 10; + UINT64 streamDelay = (start_time - VStartTime) / 10; usleep(streamDelay); } unlink("/tmp/tsmf_vseek.info"); @@ -1301,7 +1301,7 @@ static boolean tsmf_gstreamer_decodeEx(ITSMFDecoder * decoder, const uint8 * dat return TRUE; } -static void tsmf_gstreamer_change_volume(ITSMFDecoder * decoder, uint32 newVolume, uint32 muted) +static void tsmf_gstreamer_change_volume(ITSMFDecoder * decoder, UINT32 newVolume, UINT32 muted) { TSMFGstreamerDecoder * mdecoder = (TSMFGstreamerDecoder *) decoder; if (!mdecoder) @@ -1327,7 +1327,7 @@ static void tsmf_gstreamer_change_volume(ITSMFDecoder * decoder, uint32 newVolum g_object_set(mdecoder->aVolume, "volume", mdecoder->gstVolume, NULL); } -static void tsmf_gstreamer_control(ITSMFDecoder * decoder, ITSMFControlMsg control_msg, uint32 *arg) +static void tsmf_gstreamer_control(ITSMFDecoder * decoder, ITSMFControlMsg control_msg, UINT32 *arg) { TSMFGstreamerDecoder * mdecoder = (TSMFGstreamerDecoder *) decoder; if (!mdecoder) @@ -1453,7 +1453,7 @@ static void tsmf_gstreamer_free(ITSMFDecoder * decoder) } } -static uint64 tsmf_gstreamer_get_running_time(ITSMFDecoder * decoder) +static UINT64 tsmf_gstreamer_get_running_time(ITSMFDecoder * decoder) { TSMFGstreamerDecoder *mdecoder = (TSMFGstreamerDecoder *) decoder; if (!mdecoder) diff --git a/channels/tsmf/client/pulse/CMakeLists.txt b/channels/tsmf/client/pulse/CMakeLists.txt index ef488cd13..647e32c9b 100644 --- a/channels/tsmf/client/pulse/CMakeLists.txt +++ b/channels/tsmf/client/pulse/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -26,7 +26,7 @@ include_directories(${PULSEAUDIO_INCLUDE_DIR}) add_library(tsmf_pulse ${TSMF_PULSE_SRCS}) set_target_properties(tsmf_pulse PROPERTIES PREFIX "") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(tsmf_pulse ${PULSEAUDIO_LIBRARY} freerdp) else() target_link_libraries(tsmf_pulse ${PULSEAUDIO_LIBRARY} freerdp-utils) diff --git a/channels/tsmf/client/pulse/tsmf_pulse.c b/channels/tsmf/client/pulse/tsmf_pulse.c index ca162ae72..08d776179 100644 --- a/channels/tsmf/client/pulse/tsmf_pulse.c +++ b/channels/tsmf/client/pulse/tsmf_pulse.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - PulseAudio Device * * Copyright 2010-2011 Vic Lee @@ -67,18 +67,18 @@ static void tsmf_pulse_context_state_callback(pa_context* context, void* userdat } } -static boolean tsmf_pulse_connect(TSMFPulseAudioDevice* pulse) +static BOOL tsmf_pulse_connect(TSMFPulseAudioDevice* pulse) { pa_context_state_t state; if (!pulse->context) - return false; + return FALSE; if (pa_context_connect(pulse->context, NULL, 0, NULL)) { DEBUG_WARN("pa_context_connect failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } pa_threaded_mainloop_lock(pulse->mainloop); if (pa_threaded_mainloop_start(pulse->mainloop) < 0) @@ -86,7 +86,7 @@ static boolean tsmf_pulse_connect(TSMFPulseAudioDevice* pulse) pa_threaded_mainloop_unlock(pulse->mainloop); DEBUG_WARN("pa_threaded_mainloop_start failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } for (;;) { @@ -105,16 +105,16 @@ static boolean tsmf_pulse_connect(TSMFPulseAudioDevice* pulse) if (state == PA_CONTEXT_READY) { DEBUG_DVC("connected"); - return true; + return TRUE; } else { pa_context_disconnect(pulse->context); - return false; + return FALSE; } } -static boolean tsmf_pulse_open(ITSMFAudioDevice* audio, const char* device) +static BOOL tsmf_pulse_open(ITSMFAudioDevice* audio, const char* device) { TSMFPulseAudioDevice* pulse = (TSMFPulseAudioDevice*) audio; @@ -127,23 +127,23 @@ static boolean tsmf_pulse_open(ITSMFAudioDevice* audio, const char* device) if (!pulse->mainloop) { DEBUG_WARN("pa_threaded_mainloop_new failed"); - return false; + return FALSE; } pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp"); if (!pulse->context) { DEBUG_WARN("pa_context_new failed"); - return false; + return FALSE; } pa_context_set_state_callback(pulse->context, tsmf_pulse_context_state_callback, pulse); if (tsmf_pulse_connect(pulse)) { DEBUG_WARN("tsmf_pulse_connect failed"); - return false; + return FALSE; } DEBUG_DVC("open device %s", pulse->device); - return true; + return TRUE; } static void tsmf_pulse_stream_success_callback(pa_stream* stream, int success, void* userdata) @@ -198,10 +198,10 @@ static void tsmf_pulse_stream_request_callback(pa_stream* stream, size_t length, pa_threaded_mainloop_signal(pulse->mainloop, 0); } -static boolean tsmf_pulse_close_stream(TSMFPulseAudioDevice* pulse) +static BOOL tsmf_pulse_close_stream(TSMFPulseAudioDevice* pulse) { if (!pulse->context || !pulse->stream) - return false; + return FALSE; DEBUG_DVC(""); @@ -214,16 +214,16 @@ static boolean tsmf_pulse_close_stream(TSMFPulseAudioDevice* pulse) pulse->stream = NULL; pa_threaded_mainloop_unlock(pulse->mainloop); - return true; + return TRUE; } -static boolean tsmf_pulse_open_stream(TSMFPulseAudioDevice* pulse) +static BOOL tsmf_pulse_open_stream(TSMFPulseAudioDevice* pulse) { pa_stream_state_t state; pa_buffer_attr buffer_attr = { 0 }; if (!pulse->context) - return false; + return FALSE; DEBUG_DVC(""); @@ -235,7 +235,7 @@ static boolean tsmf_pulse_open_stream(TSMFPulseAudioDevice* pulse) pa_threaded_mainloop_unlock(pulse->mainloop); DEBUG_WARN("pa_stream_new failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } pa_stream_set_state_callback(pulse->stream, tsmf_pulse_stream_state_callback, pulse); @@ -243,9 +243,9 @@ static boolean tsmf_pulse_open_stream(TSMFPulseAudioDevice* pulse) tsmf_pulse_stream_request_callback, pulse); buffer_attr.maxlength = pa_usec_to_bytes(500000, &pulse->sample_spec); buffer_attr.tlength = pa_usec_to_bytes(250000, &pulse->sample_spec); - buffer_attr.prebuf = (uint32_t) -1; - buffer_attr.minreq = (uint32_t) -1; - buffer_attr.fragsize = (uint32_t) -1; + buffer_attr.prebuf = (UINT32_t) -1; + buffer_attr.minreq = (UINT32_t) -1; + buffer_attr.fragsize = (UINT32_t) -1; if (pa_stream_connect_playback(pulse->stream, pulse->device[0] ? pulse->device : NULL, &buffer_attr, PA_STREAM_ADJUST_LATENCY | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE, @@ -254,7 +254,7 @@ static boolean tsmf_pulse_open_stream(TSMFPulseAudioDevice* pulse) pa_threaded_mainloop_unlock(pulse->mainloop); DEBUG_WARN("pa_stream_connect_playback failed (%d)", pa_context_errno(pulse->context)); - return false; + return FALSE; } for (;;) @@ -274,17 +274,17 @@ static boolean tsmf_pulse_open_stream(TSMFPulseAudioDevice* pulse) if (state == PA_STREAM_READY) { DEBUG_DVC("connected"); - return true; + return TRUE; } else { tsmf_pulse_close_stream(pulse); - return false; + return FALSE; } } -static boolean tsmf_pulse_set_format(ITSMFAudioDevice* audio, - uint32 sample_rate, uint32 channels, uint32 bits_per_sample) +static BOOL tsmf_pulse_set_format(ITSMFAudioDevice* audio, + UINT32 sample_rate, UINT32 channels, UINT32 bits_per_sample) { TSMFPulseAudioDevice* pulse = (TSMFPulseAudioDevice*) audio; @@ -298,10 +298,10 @@ static boolean tsmf_pulse_set_format(ITSMFAudioDevice* audio, return tsmf_pulse_open_stream(pulse); } -static boolean tsmf_pulse_play(ITSMFAudioDevice* audio, uint8* data, uint32 data_size) +static BOOL tsmf_pulse_play(ITSMFAudioDevice* audio, BYTE* data, UINT32 data_size) { TSMFPulseAudioDevice* pulse = (TSMFPulseAudioDevice*) audio; - uint8* src; + BYTE* src; int len; int ret; @@ -336,20 +336,20 @@ static boolean tsmf_pulse_play(ITSMFAudioDevice* audio, uint8* data, uint32 data pa_threaded_mainloop_unlock(pulse->mainloop); } - xfree(data); + free(data); - return true; + return TRUE; } -static uint64 tsmf_pulse_get_latency(ITSMFAudioDevice* audio) +static UINT64 tsmf_pulse_get_latency(ITSMFAudioDevice* audio) { pa_usec_t usec; - uint64 latency = 0; + UINT64 latency = 0; TSMFPulseAudioDevice* pulse = (TSMFPulseAudioDevice*) audio; if (pulse->stream && pa_stream_get_latency(pulse->stream, &usec, NULL) == 0) { - latency = ((uint64)usec) * 10LL; + latency = ((UINT64)usec) * 10LL; } return latency; } @@ -386,7 +386,7 @@ static void tsmf_pulse_free(ITSMFAudioDevice* audio) pa_threaded_mainloop_free(pulse->mainloop); pulse->mainloop = NULL; } - xfree(pulse); + free(pulse); } ITSMFAudioDevice* TSMFAudioDeviceEntry(void) diff --git a/channels/tsmf/client/tsmf_audio.c b/channels/tsmf/client/tsmf_audio.c index e9f37ce92..dfe8793f6 100644 --- a/channels/tsmf/client/tsmf_audio.c +++ b/channels/tsmf/client/tsmf_audio.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Audio Device Manager * * Copyright 2010-2011 Vic Lee @@ -44,7 +44,7 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const strcpy(fullname, "tsmf_"); strcat(fullname, name); entry = (TSMF_AUDIO_DEVICE_ENTRY) freerdp_load_plugin(fullname, TSMF_AUDIO_DEVICE_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) { diff --git a/channels/tsmf/client/tsmf_audio.h b/channels/tsmf/client/tsmf_audio.h index 1215460c5..98af8013d 100644 --- a/channels/tsmf/client/tsmf_audio.h +++ b/channels/tsmf/client/tsmf_audio.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Audio Device Manager * * Copyright 2010-2011 Vic Lee @@ -27,15 +27,15 @@ typedef struct _ITSMFAudioDevice ITSMFAudioDevice; struct _ITSMFAudioDevice { /* Open the audio device. */ - boolean (*Open) (ITSMFAudioDevice* audio, const char* device); + BOOL (*Open) (ITSMFAudioDevice* audio, const char* device); /* Set the audio data format. */ - boolean (*SetFormat) (ITSMFAudioDevice* audio, uint32 sample_rate, uint32 channels, uint32 bits_per_sample); + BOOL (*SetFormat) (ITSMFAudioDevice* audio, UINT32 sample_rate, UINT32 channels, UINT32 bits_per_sample); /* Play audio data. */ - boolean (*Play) (ITSMFAudioDevice* audio, uint8* data, uint32 data_size); + BOOL (*Play) (ITSMFAudioDevice* audio, BYTE* data, UINT32 data_size); /* Get the latency of the last written sample, in 100ns */ - uint64 (*GetLatency) (ITSMFAudioDevice* audio); + UINT64 (*GetLatency) (ITSMFAudioDevice* audio); /* Change the playback volume level */ - void (*ChangeVolume) (ITSMFAudioDevice* audio, uint32 newVolume, uint32 muted); + void (*ChangeVolume) (ITSMFAudioDevice* audio, UINT32 newVolume, UINT32 muted); /* Flush queued audio data */ void (*Flush) (ITSMFAudioDevice* audio); /* Free the audio device */ diff --git a/channels/tsmf/client/tsmf_codec.c b/channels/tsmf/client/tsmf_codec.c index ceb28bbcf..e0d1c8efc 100644 --- a/channels/tsmf/client/tsmf_codec.c +++ b/channels/tsmf/client/tsmf_codec.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Codec * * Copyright 2010-2011 Vic Lee @@ -36,7 +36,7 @@ typedef struct _TSMFMediaTypeMap { - uint8 guid[16]; + BYTE guid[16]; const char* name; int type; } TSMFMediaTypeMap; @@ -259,7 +259,7 @@ static const TSMFMediaTypeMap tsmf_format_type_map[] = } }; -static void tsmf_print_guid(const uint8* guid) +static void tsmf_print_guid(const BYTE* guid) { #ifdef WITH_DEBUG_DVC int i; @@ -284,15 +284,15 @@ static void tsmf_print_guid(const uint8* guid) } /* http://msdn.microsoft.com/en-us/library/dd318229.aspx */ -static uint32 tsmf_codec_parse_BITMAPINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, STREAM* s, boolean bypass) +static UINT32 tsmf_codec_parse_BITMAPINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, STREAM* s, BOOL bypass) { - uint32 biSize; - uint32 biWidth; - uint32 biHeight; + UINT32 biSize; + UINT32 biWidth; + UINT32 biHeight; - stream_read_uint32(s, biSize); - stream_read_uint32(s, biWidth); - stream_read_uint32(s, biHeight); + stream_read_UINT32(s, biSize); + stream_read_UINT32(s, biWidth); + stream_read_UINT32(s, biHeight); stream_seek(s, 28); if (mediatype->Width == 0) @@ -308,23 +308,23 @@ 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, STREAM* s) { - uint64 AvgTimePerFrame; + UINT64 AvgTimePerFrame; /* VIDEOINFOHEADER2.rcSource, RECT(LONG left, LONG top, LONG right, LONG bottom) */ - stream_seek_uint32(s); - stream_seek_uint32(s); - stream_read_uint32(s, mediatype->Width); - stream_read_uint32(s, mediatype->Height); + stream_seek_UINT32(s); + stream_seek_UINT32(s); + stream_read_UINT32(s, mediatype->Width); + stream_read_UINT32(s, mediatype->Height); /* VIDEOINFOHEADER2.rcTarget */ stream_seek(s, 16); /* VIDEOINFOHEADER2.dwBitRate */ - stream_read_uint32(s, mediatype->BitRate); + stream_read_UINT32(s, mediatype->BitRate); /* VIDEOINFOHEADER2.dwBitErrorRate */ - stream_seek_uint32(s); + stream_seek_UINT32(s); /* VIDEOINFOHEADER2.AvgTimePerFrame */ - stream_read_uint64(s, AvgTimePerFrame); + stream_read_UINT64(s, AvgTimePerFrame); mediatype->SamplesPerSecond.Numerator = 1000000; mediatype->SamplesPerSecond.Denominator = (int)(AvgTimePerFrame / 10LL); /* Remaining fields before bmiHeader */ @@ -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, STREAM* s) { /* typedef struct tagVIDEOINFOHEADER { @@ -346,32 +346,32 @@ typedef struct tagVIDEOINFOHEADER { BITMAPINFOHEADER bmiHeader; } VIDEOINFOHEADER; */ - uint64 AvgTimePerFrame; + UINT64 AvgTimePerFrame; /* VIDEOINFOHEADER.rcSource, RECT(LONG left, LONG top, LONG right, LONG bottom) */ - stream_seek_uint32(s); - stream_seek_uint32(s); - stream_read_uint32(s, mediatype->Width); - stream_read_uint32(s, mediatype->Height); + stream_seek_UINT32(s); + stream_seek_UINT32(s); + stream_read_UINT32(s, mediatype->Width); + stream_read_UINT32(s, mediatype->Height); /* VIDEOINFOHEADER.rcTarget */ stream_seek(s, 16); /* VIDEOINFOHEADER.dwBitRate */ - stream_read_uint32(s, mediatype->BitRate); + stream_read_UINT32(s, mediatype->BitRate); /* VIDEOINFOHEADER.dwBitErrorRate */ - stream_seek_uint32(s); + stream_seek_UINT32(s); /* VIDEOINFOHEADER.AvgTimePerFrame */ - stream_read_uint64(s, AvgTimePerFrame); + stream_read_UINT64(s, AvgTimePerFrame); mediatype->SamplesPerSecond.Numerator = 1000000; mediatype->SamplesPerSecond.Denominator = (int)(AvgTimePerFrame / 10LL); return 48; } -boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) +BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) { int i; - uint32 cbFormat; - boolean ret = true; + UINT32 cbFormat; + BOOL ret = TRUE; memset(mediatype, 0, sizeof(TS_AM_MEDIA_TYPE)); @@ -385,7 +385,7 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) } mediatype->MajorType = tsmf_major_type_map[i].type; if (mediatype->MajorType == TSMF_MAJOR_TYPE_UNKNOWN) - ret = false; + ret = FALSE; DEBUG_DVC("MajorType %s", tsmf_major_type_map[i].name); stream_seek(s, 16); @@ -399,7 +399,7 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) } mediatype->SubType = tsmf_sub_type_map[i].type; if (mediatype->SubType == TSMF_SUB_TYPE_UNKNOWN) - ret = false; + ret = FALSE; DEBUG_DVC("SubType %s", tsmf_sub_type_map[i].name); stream_seek(s, 16); @@ -416,12 +416,12 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) } mediatype->FormatType = tsmf_format_type_map[i].type; if (mediatype->FormatType == TSMF_FORMAT_TYPE_UNKNOWN) - ret = false; + ret = FALSE; DEBUG_DVC("FormatType %s", tsmf_format_type_map[i].name); stream_seek(s, 16); /* cbFormat */ - stream_read_uint32(s, cbFormat); + stream_read_UINT32(s, cbFormat); DEBUG_DVC("cbFormat %d", cbFormat); #ifdef WITH_DEBUG_DVC @@ -434,14 +434,14 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) /* http://msdn.microsoft.com/en-us/library/aa473808.aspx */ stream_seek(s, 8); /* dwSize and ? */ - stream_read_uint32(s, mediatype->Width); /* videoInfo.dwWidth */ - stream_read_uint32(s, mediatype->Height); /* videoInfo.dwHeight */ + stream_read_UINT32(s, mediatype->Width); /* videoInfo.dwWidth */ + stream_read_UINT32(s, mediatype->Height); /* videoInfo.dwHeight */ stream_seek(s, 32); /* videoInfo.FramesPerSecond */ - stream_read_uint32(s, mediatype->SamplesPerSecond.Numerator); - stream_read_uint32(s, mediatype->SamplesPerSecond.Denominator); + stream_read_UINT32(s, mediatype->SamplesPerSecond.Numerator); + stream_read_UINT32(s, mediatype->SamplesPerSecond.Denominator); stream_seek(s, 80); - stream_read_uint32(s, mediatype->BitRate); /* compressedInfo.AvgBitrate */ + stream_read_UINT32(s, mediatype->BitRate); /* compressedInfo.AvgBitrate */ stream_seek(s, 36); if (cbFormat > 176) @@ -454,15 +454,15 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) case TSMF_FORMAT_TYPE_WAVEFORMATEX: /* http://msdn.microsoft.com/en-us/library/dd757720.aspx */ - stream_seek_uint16(s); - stream_read_uint16(s, mediatype->Channels); - stream_read_uint32(s, mediatype->SamplesPerSecond.Numerator); + stream_seek_UINT16(s); + stream_read_UINT16(s, mediatype->Channels); + stream_read_UINT32(s, mediatype->SamplesPerSecond.Numerator); mediatype->SamplesPerSecond.Denominator = 1; - stream_read_uint32(s, mediatype->BitRate); + stream_read_UINT32(s, mediatype->BitRate); mediatype->BitRate *= 8; - stream_read_uint16(s, mediatype->BlockAlign); - stream_read_uint16(s, mediatype->BitsPerSample); - stream_read_uint16(s, mediatype->ExtraDataSize); + stream_read_UINT16(s, mediatype->BlockAlign); + stream_read_UINT16(s, mediatype->BitsPerSample); + stream_read_UINT16(s, mediatype->ExtraDataSize); if (mediatype->ExtraDataSize > 0) mediatype->ExtraData = stream_get_tail(s); @@ -472,7 +472,7 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) /* http://msdn.microsoft.com/en-us/library/dd390700.aspx */ i = tsmf_codec_parse_VIDEOINFOHEADER(mediatype, s); - i += tsmf_codec_parse_BITMAPINFOHEADER(mediatype, s, true); + i += tsmf_codec_parse_BITMAPINFOHEADER(mediatype, s, TRUE); if (cbFormat > i) { mediatype->ExtraDataSize = cbFormat - i; @@ -484,7 +484,7 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) /* http://msdn.microsoft.com/en-us/library/dd390707.aspx */ i = tsmf_codec_parse_VIDEOINFOHEADER2(mediatype, s); - i += tsmf_codec_parse_BITMAPINFOHEADER(mediatype, s, true); + i += tsmf_codec_parse_BITMAPINFOHEADER(mediatype, s, TRUE); if (cbFormat > i) { mediatype->ExtraDataSize = cbFormat - i; @@ -494,7 +494,7 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) case TSMF_FORMAT_TYPE_VIDEOINFO2: i = tsmf_codec_parse_VIDEOINFOHEADER2(mediatype, s); - i += tsmf_codec_parse_BITMAPINFOHEADER(mediatype, s, false); + i += tsmf_codec_parse_BITMAPINFOHEADER(mediatype, s, FALSE); if (cbFormat > i) { mediatype->ExtraDataSize = cbFormat - i; @@ -514,10 +514,10 @@ boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s) return ret; } -boolean tsmf_codec_check_media_type(STREAM* s) +BOOL tsmf_codec_check_media_type(STREAM* s) { - uint8* m; - boolean ret; + BYTE* m; + BOOL ret; TS_AM_MEDIA_TYPE mediatype; stream_get_mark(s, m); diff --git a/channels/tsmf/client/tsmf_codec.h b/channels/tsmf/client/tsmf_codec.h index eb6bbeaf5..b00c0895f 100644 --- a/channels/tsmf/client/tsmf_codec.h +++ b/channels/tsmf/client/tsmf_codec.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Codec * * Copyright 2010-2011 Vic Lee @@ -22,8 +22,8 @@ #include "tsmf_types.h" -boolean tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s); -boolean tsmf_codec_check_media_type(STREAM* s); +BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, STREAM* s); +BOOL tsmf_codec_check_media_type(STREAM* s); #endif diff --git a/channels/tsmf/client/tsmf_constants.h b/channels/tsmf/client/tsmf_constants.h index a93b2dd13..107372992 100644 --- a/channels/tsmf/client/tsmf_constants.h +++ b/channels/tsmf/client/tsmf_constants.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Constants * * Copyright 2010-2011 Vic Lee diff --git a/channels/tsmf/client/tsmf_decoder.c b/channels/tsmf/client/tsmf_decoder.c index 267a9f97e..778420349 100644 --- a/channels/tsmf/client/tsmf_decoder.c +++ b/channels/tsmf/client/tsmf_decoder.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Decoder * * Copyright 2010-2011 Vic Lee @@ -46,7 +46,7 @@ static ITSMFDecoder* tsmf_load_decoder_by_name(const char* name, TS_AM_MEDIA_TYP strcpy(fullname, "tsmf_"); strcat(fullname, name); entry = (TSMF_DECODER_ENTRY) freerdp_load_plugin(fullname, TSMF_DECODER_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) { diff --git a/channels/tsmf/client/tsmf_decoder.h b/channels/tsmf/client/tsmf_decoder.h index 91d3ee31f..792bc6e62 100644 --- a/channels/tsmf/client/tsmf_decoder.h +++ b/channels/tsmf/client/tsmf_decoder.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Decoder * * Copyright 2010-2011 Vic Lee @@ -36,30 +36,30 @@ typedef struct _ITSMFDecoder ITSMFDecoder; struct _ITSMFDecoder { /* Set the decoder format. Return true if supported. */ - boolean (*SetFormat) (ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* media_type); + BOOL (*SetFormat) (ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* media_type); /* Decode a sample. */ - boolean (*Decode) (ITSMFDecoder* decoder, const uint8* data, uint32 data_size, uint32 extensions); + BOOL (*Decode) (ITSMFDecoder* decoder, const BYTE* data, UINT32 data_size, UINT32 extensions); /* Get the decoded data */ - uint8* (*GetDecodedData) (ITSMFDecoder* decoder, uint32* size); + BYTE* (*GetDecodedData) (ITSMFDecoder* decoder, UINT32* size); /* Get the pixel format of decoded video frame */ - uint32 (*GetDecodedFormat) (ITSMFDecoder* decoder); + UINT32 (*GetDecodedFormat) (ITSMFDecoder* decoder); /* Get the width and height of decoded video frame */ - boolean (*GetDecodedDimension) (ITSMFDecoder* decoder, uint32* width, uint32* height); + BOOL (*GetDecodedDimension) (ITSMFDecoder* decoder, UINT32* width, UINT32* height); /* Free the decoder */ void (*Free) (ITSMFDecoder * decoder); /* Optional Contol function */ - void (*Control) (ITSMFDecoder * decoder, ITSMFControlMsg control_msg, uint32 *arg); + void (*Control) (ITSMFDecoder * decoder, ITSMFControlMsg control_msg, UINT32 *arg); /* Decode a sample with extended interface. */ - int (*DecodeEx) (ITSMFDecoder * decoder, const uint8 * data, uint32 data_size, uint32 extensions, - uint64 start_time, uint64 end_time, uint64 duration); + int (*DecodeEx) (ITSMFDecoder * decoder, const BYTE * data, UINT32 data_size, UINT32 extensions, + UINT64 start_time, UINT64 end_time, UINT64 duration); /* Get current play time */ - uint64 (*GetRunningTime) (ITSMFDecoder * decoder); + UINT64 (*GetRunningTime) (ITSMFDecoder * decoder); /* Update Gstreamer Rendering Area */ void (*UpdateRenderingArea) (ITSMFDecoder * decoder, int newX, int newY, int newWidth, int newHeight, int numRectangles, RDP_RECT *rectangles); /* Change Gstreamer Audio Volume */ - void (*ChangeVolume) (ITSMFDecoder * decoder, uint32 newVolume, uint32 muted); + void (*ChangeVolume) (ITSMFDecoder * decoder, UINT32 newVolume, UINT32 muted); /* Check buffer level */ - uint32 (*BufferLevel) (ITSMFDecoder * decoder); + UINT32 (*BufferLevel) (ITSMFDecoder * decoder); }; #define TSMF_DECODER_EXPORT_FUNC_NAME "TSMFDecoderEntry" diff --git a/channels/tsmf/client/tsmf_ifman.c b/channels/tsmf/client/tsmf_ifman.c index 86f5101b3..f33b26f3e 100644 --- a/channels/tsmf/client/tsmf_ifman.c +++ b/channels/tsmf/client/tsmf_ifman.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Interface Manipulation * * Copyright 2010-2011 Vic Lee @@ -38,49 +38,49 @@ int tsmf_ifman_rim_exchange_capability_request(TSMF_IFMAN* ifman) { - uint32 CapabilityValue; + UINT32 CapabilityValue; - stream_read_uint32(ifman->input, CapabilityValue); + stream_read_UINT32(ifman->input, CapabilityValue); DEBUG_DVC("server CapabilityValue %d", CapabilityValue); stream_check_size(ifman->output, 8); - stream_write_uint32(ifman->output, 1); /* CapabilityValue */ - stream_write_uint32(ifman->output, 0); /* Result */ + stream_write_UINT32(ifman->output, 1); /* CapabilityValue */ + stream_write_UINT32(ifman->output, 0); /* Result */ return 0; } int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman) { - uint32 i; - uint32 v; - uint32 pos; - uint32 CapabilityType; - uint32 cbCapabilityLength; - uint32 numHostCapabilities; + UINT32 i; + UINT32 v; + UINT32 pos; + UINT32 CapabilityType; + UINT32 cbCapabilityLength; + UINT32 numHostCapabilities; pos = stream_get_pos(ifman->output); stream_check_size(ifman->output, ifman->input_size + 4); stream_copy(ifman->output, ifman->input, ifman->input_size); stream_set_pos(ifman->output, pos); - stream_read_uint32(ifman->output, numHostCapabilities); + stream_read_UINT32(ifman->output, numHostCapabilities); for (i = 0; i < numHostCapabilities; i++) { - stream_read_uint32(ifman->output, CapabilityType); - stream_read_uint32(ifman->output, cbCapabilityLength); + stream_read_UINT32(ifman->output, CapabilityType); + stream_read_UINT32(ifman->output, cbCapabilityLength); pos = stream_get_pos(ifman->output); switch (CapabilityType) { case 1: /* Protocol version request */ - stream_read_uint32(ifman->output, v); + stream_read_UINT32(ifman->output, v); DEBUG_DVC("server protocol version %d", v); break; case 2: /* Supported platform */ - stream_peek_uint32(ifman->output, v); + stream_peek_UINT32(ifman->output, v); DEBUG_DVC("server supported platform %d", v); /* Claim that we support both MF and DShow platforms. */ - stream_write_uint32(ifman->output, + stream_write_UINT32(ifman->output, MMREDIR_CAPABILITY_PLATFORM_MF | MMREDIR_CAPABILITY_PLATFORM_DSHOW); break; default: @@ -89,7 +89,7 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman) } stream_set_pos(ifman->output, pos + cbCapabilityLength); } - stream_write_uint32(ifman->output, 0); /* Result */ + stream_write_UINT32(ifman->output, 0); /* Result */ ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB; @@ -98,13 +98,13 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman) int tsmf_ifman_check_format_support_request(TSMF_IFMAN* ifman) { - uint32 numMediaType; - uint32 PlatformCookie; - uint32 FormatSupported = 1; + UINT32 numMediaType; + UINT32 PlatformCookie; + UINT32 FormatSupported = 1; - stream_read_uint32(ifman->input, PlatformCookie); - stream_seek_uint32(ifman->input); /* NoRolloverFlags (4 bytes) */ - stream_read_uint32(ifman->input, numMediaType); + stream_read_UINT32(ifman->input, PlatformCookie); + stream_seek_UINT32(ifman->input); /* NoRolloverFlags (4 bytes) */ + stream_read_UINT32(ifman->input, numMediaType); DEBUG_DVC("PlatformCookie %d numMediaType %d", PlatformCookie, numMediaType); @@ -115,9 +115,9 @@ int tsmf_ifman_check_format_support_request(TSMF_IFMAN* ifman) DEBUG_DVC("format ok."); stream_check_size(ifman->output, 12); - stream_write_uint32(ifman->output, FormatSupported); - stream_write_uint32(ifman->output, PlatformCookie); - stream_write_uint32(ifman->output, 0); /* Result */ + stream_write_UINT32(ifman->output, FormatSupported); + stream_write_UINT32(ifman->output, PlatformCookie); + stream_write_UINT32(ifman->output, 0); /* Result */ ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB; @@ -134,7 +134,7 @@ int tsmf_ifman_on_new_presentation(TSMF_IFMAN* ifman) DEBUG_DVC(""); if (pexisted) { - ifman->output_pending = false; + ifman->output_pending = FALSE; return 0; } @@ -145,13 +145,13 @@ int tsmf_ifman_on_new_presentation(TSMF_IFMAN* ifman) error = 1; else tsmf_presentation_set_audio_device(presentation, ifman->audio_name, ifman->audio_device); - ifman->output_pending = true; + ifman->output_pending = TRUE; return error; } int tsmf_ifman_add_stream(TSMF_IFMAN* ifman) { - uint32 StreamId; + UINT32 StreamId; int error = 0; TSMF_STREAM* stream; TSMF_PRESENTATION* presentation; @@ -165,13 +165,13 @@ int tsmf_ifman_add_stream(TSMF_IFMAN* ifman) error = 1; else { - stream_read_uint32(ifman->input, StreamId); - stream_seek_uint32(ifman->input); /* numMediaType */ + stream_read_UINT32(ifman->input, StreamId); + stream_seek_UINT32(ifman->input); /* numMediaType */ stream = tsmf_stream_new(presentation, StreamId); if (stream) tsmf_stream_set_format(stream, ifman->decoder_name, ifman->input); } - ifman->output_pending = true; + ifman->output_pending = TRUE; return error; } @@ -180,8 +180,8 @@ int tsmf_ifman_set_topology_request(TSMF_IFMAN* ifman) DEBUG_DVC(""); stream_check_size(ifman->output, 8); - stream_write_uint32(ifman->output, 1); /* TopologyReady */ - stream_write_uint32(ifman->output, 0); /* Result */ + stream_write_UINT32(ifman->output, 1); /* TopologyReady */ + stream_write_UINT32(ifman->output, 0); /* Result */ ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB; return 0; } @@ -189,7 +189,7 @@ int tsmf_ifman_set_topology_request(TSMF_IFMAN* ifman) int tsmf_ifman_remove_stream(TSMF_IFMAN* ifman) { int error = 0; - uint32 StreamId; + UINT32 StreamId; TSMF_STREAM* stream; TSMF_PRESENTATION* presentation; @@ -202,14 +202,14 @@ int tsmf_ifman_remove_stream(TSMF_IFMAN* ifman) error = 1; else { - stream_read_uint32(ifman->input, StreamId); + stream_read_UINT32(ifman->input, StreamId); stream = tsmf_stream_find_by_id(presentation, StreamId); if (stream) tsmf_stream_free(stream); else error = 1; } - ifman->output_pending = true; + ifman->output_pending = TRUE; return error; } @@ -226,7 +226,7 @@ int tsmf_ifman_shutdown_presentation(TSMF_IFMAN* ifman) pexisted = 0; stream_check_size(ifman->output, 4); - stream_write_uint32(ifman->output, 0); /* Result */ + stream_write_UINT32(ifman->output, 0); /* Result */ ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB; return 0; } @@ -241,13 +241,13 @@ int tsmf_ifman_on_stream_volume(TSMF_IFMAN* ifman) if (presentation) { - uint32 newVolume; - uint32 muted; + UINT32 newVolume; + UINT32 muted; stream_seek(ifman->input, 16); - stream_read_uint32(ifman->input, newVolume); + stream_read_UINT32(ifman->input, newVolume); DEBUG_DVC("on stream volume: new volume=[%d]", newVolume); - stream_read_uint32(ifman->input, muted); + stream_read_UINT32(ifman->input, muted); DEBUG_DVC("on stream volume: muted=[%d]", muted); tsmf_presentation_volume_changed(presentation, newVolume, muted); } @@ -256,7 +256,7 @@ int tsmf_ifman_on_stream_volume(TSMF_IFMAN* ifman) DEBUG_WARN("unknown presentation id"); } - ifman->output_pending = true; + ifman->output_pending = TRUE; return 0; } @@ -271,17 +271,17 @@ int tsmf_ifman_on_channel_volume(TSMF_IFMAN* ifman) if (presentation) { - uint32 channelVolume; - uint32 changedChannel; + UINT32 channelVolume; + UINT32 changedChannel; stream_seek(ifman->input, 16); - stream_read_uint32(ifman->input, channelVolume); + stream_read_UINT32(ifman->input, channelVolume); DEBUG_DVC("on channel volume: channel volume=[%d]", channelVolume); - stream_read_uint32(ifman->input, changedChannel); + stream_read_UINT32(ifman->input, changedChannel); DEBUG_DVC("on stream volume: changed channel=[%d]", changedChannel); } - ifman->output_pending = true; + ifman->output_pending = TRUE; return 0; } @@ -289,19 +289,19 @@ int tsmf_ifman_on_channel_volume(TSMF_IFMAN* ifman) int tsmf_ifman_set_video_window(TSMF_IFMAN* ifman) { DEBUG_DVC(""); - ifman->output_pending = true; + ifman->output_pending = TRUE; return 0; } int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman) { TSMF_PRESENTATION* presentation; - uint32 numGeometryInfo; - uint32 Left; - uint32 Top; - uint32 Width; - uint32 Height; - uint32 cbVisibleRect; + UINT32 numGeometryInfo; + UINT32 Left; + UINT32 Top; + UINT32 Width; + UINT32 Height; + UINT32 cbVisibleRect; RDP_RECT* rects = NULL; int num_rects = 0; int error = 0; @@ -311,17 +311,17 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman) presentation = tsmf_presentation_find_by_id(stream_get_tail(ifman->input)); stream_seek(ifman->input, 16); - stream_read_uint32(ifman->input, numGeometryInfo); + stream_read_UINT32(ifman->input, numGeometryInfo); pos = stream_get_pos(ifman->input); stream_seek(ifman->input, 12); /* VideoWindowId (8 bytes), VideoWindowState (4 bytes) */ - stream_read_uint32(ifman->input, Width); - stream_read_uint32(ifman->input, Height); - stream_read_uint32(ifman->input, Left); - stream_read_uint32(ifman->input, Top); + stream_read_UINT32(ifman->input, Width); + stream_read_UINT32(ifman->input, Height); + stream_read_UINT32(ifman->input, Left); + stream_read_UINT32(ifman->input, Top); stream_set_pos(ifman->input, pos + numGeometryInfo); - stream_read_uint32(ifman->input, cbVisibleRect); + stream_read_UINT32(ifman->input, cbVisibleRect); num_rects = cbVisibleRect / 16; DEBUG_DVC("numGeometryInfo %d Width %d Height %d Left %d Top %d cbVisibleRect %d num_rects %d", @@ -338,14 +338,14 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman) rects = (RDP_RECT*) xzalloc(sizeof(RDP_RECT) * num_rects); for (i = 0; i < num_rects; i++) { - stream_read_uint16(ifman->input, rects[i].y); /* Top */ - stream_seek_uint16(ifman->input); - stream_read_uint16(ifman->input, rects[i].x); /* Left */ - stream_seek_uint16(ifman->input); - stream_read_uint16(ifman->input, rects[i].height); /* Bottom */ - stream_seek_uint16(ifman->input); - stream_read_uint16(ifman->input, rects[i].width); /* Right */ - stream_seek_uint16(ifman->input); + stream_read_UINT16(ifman->input, rects[i].y); /* Top */ + stream_seek_UINT16(ifman->input); + stream_read_UINT16(ifman->input, rects[i].x); /* Left */ + stream_seek_UINT16(ifman->input); + stream_read_UINT16(ifman->input, rects[i].height); /* Bottom */ + stream_seek_UINT16(ifman->input); + stream_read_UINT16(ifman->input, rects[i].width); /* Right */ + stream_seek_UINT16(ifman->input); rects[i].width -= rects[i].x; rects[i].height -= rects[i].y; @@ -356,7 +356,7 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman) tsmf_presentation_set_geometry_info(presentation, Left, Top, Width, Height, num_rects, rects); } - ifman->output_pending = true; + ifman->output_pending = TRUE; return error; } @@ -364,14 +364,14 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman) int tsmf_ifman_set_allocator(TSMF_IFMAN* ifman) { DEBUG_DVC(""); - ifman->output_pending = true; + ifman->output_pending = TRUE; return 0; } int tsmf_ifman_notify_preroll(TSMF_IFMAN* ifman) { DEBUG_DVC(""); - ifman->output_pending = true; + ifman->output_pending = TRUE; return 0; } @@ -379,22 +379,22 @@ int tsmf_ifman_on_sample(TSMF_IFMAN* ifman) { TSMF_PRESENTATION* presentation; TSMF_STREAM* stream; - uint32 StreamId; - uint64 SampleStartTime; - uint64 SampleEndTime; - uint64 ThrottleDuration; - uint32 SampleExtensions; - uint32 cbData; + UINT32 StreamId; + UINT64 SampleStartTime; + UINT64 SampleEndTime; + UINT64 ThrottleDuration; + UINT32 SampleExtensions; + UINT32 cbData; stream_seek(ifman->input, 16); - stream_read_uint32(ifman->input, StreamId); - stream_seek_uint32(ifman->input); /* numSample */ - stream_read_uint64(ifman->input, SampleStartTime); - stream_read_uint64(ifman->input, SampleEndTime); - stream_read_uint64(ifman->input, ThrottleDuration); - stream_seek_uint32(ifman->input); /* SampleFlags */ - stream_read_uint32(ifman->input, SampleExtensions); - stream_read_uint32(ifman->input, cbData); + stream_read_UINT32(ifman->input, StreamId); + stream_seek_UINT32(ifman->input); /* numSample */ + stream_read_UINT64(ifman->input, SampleStartTime); + stream_read_UINT64(ifman->input, SampleEndTime); + stream_read_UINT64(ifman->input, ThrottleDuration); + stream_seek_UINT32(ifman->input); /* SampleFlags */ + stream_read_UINT32(ifman->input, SampleExtensions); + stream_read_UINT32(ifman->input, cbData); DEBUG_DVC("MessageId %d StreamId %d SampleStartTime %d SampleEndTime %d " "ThrottleDuration %d SampleExtensions %d cbData %d", @@ -417,17 +417,17 @@ int tsmf_ifman_on_sample(TSMF_IFMAN* ifman) ifman->message_id, SampleStartTime, SampleEndTime, ThrottleDuration, SampleExtensions, cbData, stream_get_tail(ifman->input)); - ifman->output_pending = true; + ifman->output_pending = TRUE; return 0; } int tsmf_ifman_on_flush(TSMF_IFMAN* ifman) { TSMF_PRESENTATION* presentation; - uint32 StreamId; + UINT32 StreamId; stream_seek(ifman->input, 16); - stream_read_uint32(ifman->input, StreamId); + stream_read_UINT32(ifman->input, StreamId); DEBUG_DVC("StreamId %d", StreamId); presentation = tsmf_presentation_find_by_id(ifman->presentation_id); @@ -439,7 +439,7 @@ int tsmf_ifman_on_flush(TSMF_IFMAN* ifman) tsmf_presentation_flush(presentation); - ifman->output_pending = true; + ifman->output_pending = TRUE; return 0; } @@ -447,11 +447,11 @@ int tsmf_ifman_on_end_of_stream(TSMF_IFMAN* ifman) { TSMF_PRESENTATION* presentation; TSMF_STREAM* stream; - uint32 StreamId; + UINT32 StreamId; presentation = tsmf_presentation_find_by_id(stream_get_tail(ifman->input)); stream_seek(ifman->input, 16); - stream_read_uint32(ifman->input, StreamId); + stream_read_UINT32(ifman->input, StreamId); if (presentation) { stream = tsmf_stream_find_by_id(presentation, StreamId); @@ -461,10 +461,10 @@ int tsmf_ifman_on_end_of_stream(TSMF_IFMAN* ifman) DEBUG_DVC("StreamId %d", StreamId); stream_check_size(ifman->output, 16); - stream_write_uint32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ - stream_write_uint32(ifman->output, StreamId); /* StreamId */ - stream_write_uint32(ifman->output, TSMM_CLIENT_EVENT_ENDOFSTREAM); /* EventId */ - stream_write_uint32(ifman->output, 0); /* cbData */ + stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ + stream_write_UINT32(ifman->output, StreamId); /* StreamId */ + stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_ENDOFSTREAM); /* EventId */ + stream_write_UINT32(ifman->output, 0); /* cbData */ ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY; return 0; @@ -483,10 +483,10 @@ int tsmf_ifman_on_playback_started(TSMF_IFMAN* ifman) DEBUG_WARN("unknown presentation id"); stream_check_size(ifman->output, 16); - stream_write_uint32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ - stream_write_uint32(ifman->output, 0); /* StreamId */ - stream_write_uint32(ifman->output, TSMM_CLIENT_EVENT_START_COMPLETED); /* EventId */ - stream_write_uint32(ifman->output, 0); /* cbData */ + stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ + stream_write_UINT32(ifman->output, 0); /* StreamId */ + stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_START_COMPLETED); /* EventId */ + stream_write_UINT32(ifman->output, 0); /* cbData */ ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY; return 0; @@ -497,7 +497,7 @@ int tsmf_ifman_on_playback_paused(TSMF_IFMAN* ifman) TSMF_PRESENTATION* presentation; DEBUG_DVC(""); - ifman->output_pending = true; + ifman->output_pending = TRUE; /* Added pause control so gstreamer pipeline can be paused accordingly */ @@ -514,7 +514,7 @@ int tsmf_ifman_on_playback_restarted(TSMF_IFMAN* ifman) TSMF_PRESENTATION* presentation; DEBUG_DVC(""); - ifman->output_pending = true; + ifman->output_pending = TRUE; /* Added restart control so gstreamer pipeline can be resumed accordingly */ @@ -542,10 +542,10 @@ int tsmf_ifman_on_playback_stopped(TSMF_IFMAN* ifman) DEBUG_WARN("unknown presentation id"); stream_check_size(ifman->output, 16); - stream_write_uint32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ - stream_write_uint32(ifman->output, 0); /* StreamId */ - stream_write_uint32(ifman->output, TSMM_CLIENT_EVENT_STOP_COMPLETED); /* EventId */ - stream_write_uint32(ifman->output, 0); /* cbData */ + stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ + stream_write_UINT32(ifman->output, 0); /* StreamId */ + stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_STOP_COMPLETED); /* EventId */ + stream_write_UINT32(ifman->output, 0); /* cbData */ ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY; return 0; @@ -556,10 +556,10 @@ int tsmf_ifman_on_playback_rate_changed(TSMF_IFMAN * ifman) DEBUG_DVC(""); stream_check_size(ifman->output, 16); - stream_write_uint32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ - stream_write_uint32(ifman->output, 0); /* StreamId */ - stream_write_uint32(ifman->output, TSMM_CLIENT_EVENT_MONITORCHANGED); /* EventId */ - stream_write_uint32(ifman->output, 0); /* cbData */ + stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */ + stream_write_UINT32(ifman->output, 0); /* StreamId */ + stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_MONITORCHANGED); /* EventId */ + stream_write_UINT32(ifman->output, 0); /* cbData */ ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY; return 0; diff --git a/channels/tsmf/client/tsmf_ifman.h b/channels/tsmf/client/tsmf_ifman.h index 7a68c06b7..90719f85f 100644 --- a/channels/tsmf/client/tsmf_ifman.h +++ b/channels/tsmf/client/tsmf_ifman.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Interface Manipulation * * Copyright 2010-2011 Vic Lee @@ -27,15 +27,15 @@ struct _TSMF_IFMAN const char* decoder_name; const char* audio_name; const char* audio_device; - uint8 presentation_id[16]; - uint32 stream_id; - uint32 message_id; + BYTE presentation_id[16]; + UINT32 stream_id; + UINT32 message_id; STREAM* input; - uint32 input_size; + UINT32 input_size; STREAM* output; - boolean output_pending; - uint32 output_interface_id; + BOOL output_pending; + UINT32 output_interface_id; }; int tsmf_ifman_rim_exchange_capability_request(TSMF_IFMAN* ifman); diff --git a/channels/tsmf/client/tsmf_main.c b/channels/tsmf/client/tsmf_main.c index 6c266cf51..fd0472cfc 100644 --- a/channels/tsmf/client/tsmf_main.c +++ b/channels/tsmf/client/tsmf_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -57,8 +57,8 @@ struct _TSMF_CHANNEL_CALLBACK IWTSVirtualChannelManager* channel_mgr; IWTSVirtualChannel* channel; - uint8 presentation_id[16]; - uint32 stream_id; + BYTE presentation_id[16]; + UINT32 stream_id; }; struct _TSMF_PLUGIN @@ -73,19 +73,19 @@ struct _TSMF_PLUGIN }; void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback, - uint32 message_id, uint64 duration, uint32 data_size) + UINT32 message_id, UINT64 duration, UINT32 data_size) { STREAM* s; int error; TSMF_CHANNEL_CALLBACK* callback = (TSMF_CHANNEL_CALLBACK*) pChannelCallback; s = stream_new(32); - stream_write_uint32(s, TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY); - stream_write_uint32(s, message_id); - stream_write_uint32(s, PLAYBACK_ACK); /* FunctionId */ - stream_write_uint32(s, callback->stream_id); /* StreamId */ - stream_write_uint64(s, duration); /* DataDuration */ - stream_write_uint64(s, data_size); /* cbData */ + stream_write_UINT32(s, TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY); + stream_write_UINT32(s, message_id); + stream_write_UINT32(s, PLAYBACK_ACK); /* FunctionId */ + stream_write_UINT32(s, callback->stream_id); /* StreamId */ + stream_write_UINT64(s, duration); /* DataDuration */ + stream_write_UINT64(s, data_size); /* cbData */ DEBUG_DVC("response size %d", (int) stream_get_length(s)); error = callback->channel->Write(callback->channel, stream_get_length(s), stream_get_head(s), NULL); @@ -96,7 +96,7 @@ void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback, stream_free(s); } -boolean tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback, +BOOL tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback, RDP_EVENT* event) { int error; @@ -106,23 +106,23 @@ boolean tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback, if (error) { DEBUG_WARN("response error %d", error); - return false; + return FALSE; } - return true; + return TRUE; } static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, - uint32 cbSize, - uint8* pBuffer) + UINT32 cbSize, + BYTE* pBuffer) { int length; STREAM* input; STREAM* output; int error = -1; TSMF_IFMAN ifman; - uint32 MessageId; - uint32 FunctionId; - uint32 InterfaceId; + UINT32 MessageId; + UINT32 FunctionId; + UINT32 InterfaceId; TSMF_CHANNEL_CALLBACK* callback = (TSMF_CHANNEL_CALLBACK*) pChannelCallback; /* 2.2.1 Shared Message Header (SHARED_MSG_HEADER) */ @@ -132,13 +132,13 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, return 1; } input = stream_new(0); - stream_attach(input, (uint8*) pBuffer, cbSize); + stream_attach(input, (BYTE*) pBuffer, cbSize); output = stream_new(256); stream_seek(output, 8); - stream_read_uint32(input, InterfaceId); - stream_read_uint32(input, MessageId); - stream_read_uint32(input, FunctionId); + stream_read_UINT32(input, InterfaceId); + stream_read_UINT32(input, MessageId); + stream_read_UINT32(input, FunctionId); DEBUG_DVC("cbSize=%d InterfaceId=0x%X MessageId=0x%X FunctionId=0x%X", cbSize, InterfaceId, MessageId, FunctionId); @@ -153,7 +153,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, ifman.input = input; ifman.input_size = cbSize - 12; ifman.output = output; - ifman.output_pending = false; + ifman.output_pending = FALSE; ifman.output_interface_id = InterfaceId; switch (InterfaceId) @@ -178,9 +178,9 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, case SET_CHANNEL_PARAMS: memcpy(callback->presentation_id, stream_get_tail(input), 16); stream_seek(input, 16); - stream_read_uint32(input, callback->stream_id); + stream_read_UINT32(input, callback->stream_id); DEBUG_DVC("SET_CHANNEL_PARAMS StreamId=%d", callback->stream_id); - ifman.output_pending = true; + ifman.output_pending = TRUE; error = 0; break; @@ -314,8 +314,8 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, /* Response packet does not have FunctionId */ length = stream_get_length(output); stream_set_pos(output, 0); - stream_write_uint32(output, ifman.output_interface_id); - stream_write_uint32(output, MessageId); + stream_write_UINT32(output, ifman.output_interface_id); + stream_write_UINT32(output, MessageId); DEBUG_DVC("response size %d", length); error = callback->channel->Write(callback->channel, length, stream_get_head(output), NULL); @@ -348,14 +348,14 @@ static int tsmf_on_close(IWTSVirtualChannelCallback* pChannelCallback) tsmf_stream_free(stream); } } - xfree(pChannelCallback); + free(pChannelCallback); return 0; } static int tsmf_on_new_channel_connection(IWTSListenerCallback* pListenerCallback, IWTSVirtualChannel* pChannel, - uint8* Data, + BYTE* Data, int* pbAccept, IWTSVirtualChannelCallback** ppCallback) { @@ -396,8 +396,8 @@ static int tsmf_plugin_terminated(IWTSPlugin* pPlugin) DEBUG_DVC(""); if (tsmf->listener_callback) - xfree(tsmf->listener_callback); - xfree(tsmf); + free(tsmf->listener_callback); + free(tsmf); return 0; } @@ -421,7 +421,7 @@ static void tsmf_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data) } } - data = (RDP_PLUGIN_DATA*)(((uint8*)data) + data->size); + data = (RDP_PLUGIN_DATA*)(((BYTE*)data) + data->size); } } diff --git a/channels/tsmf/client/tsmf_main.h b/channels/tsmf/client/tsmf_main.h index deda1ceb6..b7b9589a8 100644 --- a/channels/tsmf/client/tsmf_main.h +++ b/channels/tsmf/client/tsmf_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel * * Copyright 2010-2011 Vic Lee @@ -21,8 +21,8 @@ #define __TSMF_MAIN_H void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback, - uint32 message_id, uint64 duration, uint32 data_size); -boolean tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback, + UINT32 message_id, UINT64 duration, UINT32 data_size); +BOOL tsmf_push_event(IWTSVirtualChannelCallback* pChannelCallback, RDP_EVENT* event); #endif diff --git a/channels/tsmf/client/tsmf_media.c b/channels/tsmf/client/tsmf_media.c index 58568b958..ab091de2c 100644 --- a/channels/tsmf/client/tsmf_media.c +++ b/channels/tsmf/client/tsmf_media.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Media Container * * Copyright 2010-2011 Vic Lee @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include @@ -57,30 +57,30 @@ struct _TSMF_PRESENTATION { - uint8 presentation_id[GUID_SIZE]; + BYTE presentation_id[GUID_SIZE]; const char* audio_name; const char* audio_device; int eos; - uint32 last_x; - uint32 last_y; - uint32 last_width; - uint32 last_height; - uint16 last_num_rects; + UINT32 last_x; + UINT32 last_y; + UINT32 last_width; + UINT32 last_height; + UINT16 last_num_rects; RDP_RECT* last_rects; - uint32 output_x; - uint32 output_y; - uint32 output_width; - uint32 output_height; - uint16 output_num_rects; + UINT32 output_x; + UINT32 output_y; + UINT32 output_width; + UINT32 output_height; + UINT16 output_num_rects; RDP_RECT* output_rects; IWTSVirtualChannelCallback* channel_callback; - uint64 audio_start_time; - uint64 audio_end_time; + UINT64 audio_start_time; + UINT64 audio_end_time; /* The stream list could be accessed by different threads and need to be protected. */ HANDLE mutex; @@ -90,7 +90,7 @@ struct _TSMF_PRESENTATION struct _TSMF_STREAM { - uint32 stream_id; + UINT32 stream_id; TSMF_PRESENTATION* presentation; @@ -98,18 +98,18 @@ struct _TSMF_STREAM int major_type; int eos; - uint32 width; - uint32 height; + UINT32 width; + UINT32 height; ITSMFAudioDevice* audio; - uint32 sample_rate; - uint32 channels; - uint32 bits_per_sample; + UINT32 sample_rate; + UINT32 channels; + UINT32 bits_per_sample; /* The end_time of last played sample */ - uint64 last_end_time; + UINT64 last_end_time; /* Next sample should not start before this system time. */ - uint64 next_start_time; + UINT64 next_start_time; freerdp_thread* thread; @@ -121,32 +121,32 @@ struct _TSMF_STREAM struct _TSMF_SAMPLE { - uint32 sample_id; - uint64 start_time; - uint64 end_time; - uint64 duration; - uint32 extensions; - uint32 data_size; - uint8* data; - uint32 decoded_size; - uint32 pixfmt; + UINT32 sample_id; + UINT64 start_time; + UINT64 end_time; + UINT64 duration; + UINT32 extensions; + UINT32 data_size; + BYTE* data; + UINT32 decoded_size; + UINT32 pixfmt; TSMF_STREAM* stream; IWTSVirtualChannelCallback* channel_callback; - uint64 ack_time; + UINT64 ack_time; }; static LIST* presentation_list = NULL; -static uint64 last_played_audio_time = 0; +static UINT64 last_played_audio_time = 0; static HANDLE tsmf_mutex = NULL; static int TERMINATING = 0; -static uint64 get_current_time(void) +static UINT64 get_current_time(void) { struct timeval tp; gettimeofday(&tp, 0); - return ((uint64)tp.tv_sec) * 10000000LL + ((uint64)tp.tv_usec) * 10LL; + return ((UINT64)tp.tv_sec) * 10000000LL + ((UINT64)tp.tv_usec) * 10LL; } static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync) @@ -154,7 +154,7 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync) TSMF_STREAM* s; LIST_ITEM* item; TSMF_SAMPLE* sample; - boolean pending = false; + BOOL pending = FALSE; TSMF_PRESENTATION* presentation = stream->presentation; if (list_size(stream->sample_list) == 0) @@ -180,7 +180,7 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync) if (s != stream && !s->eos && s->last_end_time && s->last_end_time < stream->last_end_time - AUDIO_TOLERANCE) { - pending = true; + pending = TRUE; break; } } @@ -192,7 +192,7 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync) { if (stream->last_end_time > presentation->audio_end_time) { - pending = true; + pending = TRUE; } } @@ -216,8 +216,8 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync) static void tsmf_sample_free(TSMF_SAMPLE* sample) { if (sample->data) - xfree(sample->data); - xfree(sample); + free(sample->data); + free(sample); } static void tsmf_sample_ack(TSMF_SAMPLE* sample) @@ -235,7 +235,7 @@ static void tsmf_sample_queue_ack(TSMF_SAMPLE* sample) static void tsmf_stream_process_ack(TSMF_STREAM* stream) { TSMF_SAMPLE* sample; - uint64 ack_time; + UINT64 ack_time; ack_time = get_current_time(); while (list_size(stream->sample_ack_list) > 0 && !freerdp_thread_is_stopped(stream->thread)) @@ -250,7 +250,7 @@ static void tsmf_stream_process_ack(TSMF_STREAM* stream) } } -TSMF_PRESENTATION* tsmf_presentation_new(const uint8* guid, IWTSVirtualChannelCallback* pChannelCallback) +TSMF_PRESENTATION* tsmf_presentation_new(const BYTE* guid, IWTSVirtualChannelCallback* pChannelCallback) { TSMF_PRESENTATION* presentation; pthread_t thid = pthread_self(); @@ -284,7 +284,7 @@ TSMF_PRESENTATION* tsmf_presentation_new(const uint8* guid, IWTSVirtualChannelCa return presentation; } -TSMF_PRESENTATION* tsmf_presentation_find_by_id(const uint8* guid) +TSMF_PRESENTATION* tsmf_presentation_find_by_id(const BYTE* guid) { LIST_ITEM* item; TSMF_PRESENTATION* presentation; @@ -323,7 +323,7 @@ static void tsmf_presentation_restore_last_video_frame(TSMF_PRESENTATION* presen static void tsmf_sample_playback_video(TSMF_SAMPLE* sample) { - uint64 t; + UINT64 t; RDP_VIDEO_FRAME_EVENT* vevent; TSMF_STREAM* stream = sample->stream; TSMF_PRESENTATION* presentation = stream->presentation; @@ -361,7 +361,7 @@ static void tsmf_sample_playback_video(TSMF_SAMPLE* sample) if (presentation->last_rects) { - xfree(presentation->last_rects); + free(presentation->last_rects); presentation->last_rects = NULL; } presentation->last_num_rects = presentation->output_num_rects; @@ -426,7 +426,7 @@ static void tsmf_sample_playback_video(TSMF_SAMPLE* sample) static void tsmf_sample_playback_audio(TSMF_SAMPLE* sample) { - uint64 latency = 0; + UINT64 latency = 0; TSMF_STREAM* stream = sample->stream; DEBUG_DVC("MessageId %d EndTime %d consumed.", @@ -455,10 +455,10 @@ static void tsmf_sample_playback_audio(TSMF_SAMPLE* sample) static void tsmf_sample_playback(TSMF_SAMPLE* sample) { - boolean ret = false; - uint32 width; - uint32 height; - uint32 pixfmt = 0; + BOOL ret = FALSE; + UINT32 width; + UINT32 height; + UINT32 pixfmt = 0; TSMF_STREAM* stream = sample->stream; if (stream->decoder) @@ -477,7 +477,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample) return; } - xfree(sample->data); + free(sample->data); sample->data = NULL; if (stream->major_type == TSMF_MAJOR_TYPE_VIDEO) @@ -485,7 +485,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample) if (stream->decoder->GetDecodedFormat) { pixfmt = stream->decoder->GetDecodedFormat(stream->decoder); - if (pixfmt == ((uint32) -1)) + if (pixfmt == ((UINT32) -1)) { tsmf_sample_ack(sample); tsmf_sample_free(sample); @@ -494,7 +494,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample) sample->pixfmt = pixfmt; } - ret = false ; + ret = FALSE ; if (stream->decoder->GetDecodedDimension) { ret = stream->decoder->GetDecodedDimension(stream->decoder, &width, &height); @@ -526,9 +526,9 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample) else { TSMF_STREAM * stream = sample->stream; - uint64 ack_anticipation_time = get_current_time(); - uint64 currentRunningTime = sample->start_time; - uint32 bufferLevel = 0; + UINT64 ack_anticipation_time = get_current_time(); + UINT64 currentRunningTime = sample->start_time; + UINT32 bufferLevel = 0; if (stream->decoder->GetRunningTime) { currentRunningTime = stream->decoder->GetRunningTime(stream->decoder); @@ -564,7 +564,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample) { if (presentation->last_rects) { - xfree(presentation->last_rects); + free(presentation->last_rects); presentation->last_rects = NULL; } presentation->last_num_rects = presentation->output_num_rects; @@ -738,7 +738,7 @@ static void tsmf_stream_restart(TSMF_STREAM* stream) } } -static void tsmf_stream_change_volume(TSMF_STREAM* stream, uint32 newVolume, uint32 muted) +static void tsmf_stream_change_volume(TSMF_STREAM* stream, UINT32 newVolume, UINT32 muted) { if (!stream) return; @@ -753,7 +753,7 @@ static void tsmf_stream_change_volume(TSMF_STREAM* stream, uint32 newVolume, uin } } -void tsmf_presentation_volume_changed(TSMF_PRESENTATION* presentation, uint32 newVolume, uint32 muted) +void tsmf_presentation_volume_changed(TSMF_PRESENTATION* presentation, UINT32 newVolume, UINT32 muted) { LIST_ITEM* item; TSMF_STREAM* stream; @@ -818,20 +818,20 @@ void tsmf_presentation_stop(TSMF_PRESENTATION* presentation) tsmf_presentation_restore_last_video_frame(presentation); if (presentation->last_rects) { - xfree(presentation->last_rects); + free(presentation->last_rects); presentation->last_rects = NULL; } presentation->last_num_rects = 0; if (presentation->output_rects) { - xfree(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, + UINT32 x, UINT32 y, UINT32 width, UINT32 height, int num_rects, RDP_RECT* rects) { presentation->output_x = x; @@ -839,7 +839,7 @@ void tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation, presentation->output_width = width; presentation->output_height = height; if (presentation->output_rects) - xfree(presentation->output_rects); + free(presentation->output_rects); presentation->output_rects = rects; presentation->output_num_rects = num_rects; } @@ -907,10 +907,10 @@ void tsmf_presentation_free(TSMF_PRESENTATION* presentation) CloseHandle(presentation->mutex); - xfree(presentation); + free(presentation); } -TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, uint32 stream_id) +TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, UINT32 stream_id) { TSMF_STREAM* stream; @@ -936,7 +936,7 @@ TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, uint32 stream_id) return stream; } -TSMF_STREAM* tsmf_stream_find_by_id(TSMF_PRESENTATION* presentation, uint32 stream_id) +TSMF_STREAM* tsmf_stream_find_by_id(TSMF_PRESENTATION* presentation, UINT32 stream_id) { LIST_ITEM* item; TSMF_STREAM* stream; @@ -1015,13 +1015,13 @@ void tsmf_stream_free(TSMF_STREAM* stream) freerdp_thread_free(stream->thread); - xfree(stream); + free(stream); stream = 0; } void tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pChannelCallback, - uint32 sample_id, uint64 start_time, uint64 end_time, uint64 duration, uint32 extensions, - uint32 data_size, uint8* data) + UINT32 sample_id, UINT64 start_time, UINT64 end_time, UINT64 duration, UINT32 extensions, + UINT32 data_size, BYTE* data) { TSMF_SAMPLE* sample; diff --git a/channels/tsmf/client/tsmf_media.h b/channels/tsmf/client/tsmf_media.h index ae58d9132..9ba358820 100644 --- a/channels/tsmf/client/tsmf_media.h +++ b/channels/tsmf/client/tsmf_media.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Media Container * * Copyright 2010-2011 Vic Lee @@ -32,30 +32,30 @@ typedef struct _TSMF_STREAM TSMF_STREAM; typedef struct _TSMF_SAMPLE TSMF_SAMPLE; -TSMF_PRESENTATION* tsmf_presentation_new(const uint8* guid, IWTSVirtualChannelCallback* pChannelCallback); -TSMF_PRESENTATION* tsmf_presentation_find_by_id(const uint8* guid); +TSMF_PRESENTATION* tsmf_presentation_new(const BYTE* guid, IWTSVirtualChannelCallback* pChannelCallback); +TSMF_PRESENTATION* tsmf_presentation_find_by_id(const BYTE* guid); void tsmf_presentation_start(TSMF_PRESENTATION* presentation); void tsmf_presentation_stop(TSMF_PRESENTATION* presentation); void tsmf_presentation_paused(TSMF_PRESENTATION* presentation); void tsmf_presentation_restarted(TSMF_PRESENTATION* presentation); -void tsmf_presentation_volume_changed(TSMF_PRESENTATION* presentation, uint32 newVolume, uint32 muted); +void tsmf_presentation_volume_changed(TSMF_PRESENTATION* presentation, UINT32 newVolume, UINT32 muted); void tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation, - uint32 x, uint32 y, uint32 width, uint32 height, + UINT32 x, UINT32 y, UINT32 width, UINT32 height, int num_rects, RDP_RECT* rects); void tsmf_presentation_set_audio_device(TSMF_PRESENTATION* presentation, const char* name, const char* device); void tsmf_presentation_flush(TSMF_PRESENTATION* presentation); 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); +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_end(TSMF_STREAM* stream); void tsmf_stream_free(TSMF_STREAM* stream); void tsmf_stream_push_sample(TSMF_STREAM* stream, IWTSVirtualChannelCallback* pChannelCallback, - uint32 sample_id, uint64 start_time, uint64 end_time, uint64 duration, uint32 extensions, - uint32 data_size, uint8* data); + UINT32 sample_id, UINT64 start_time, UINT64 end_time, UINT64 duration, UINT32 extensions, + UINT32 data_size, BYTE* data); void tsmf_media_init(void); diff --git a/channels/tsmf/client/tsmf_types.h b/channels/tsmf/client/tsmf_types.h index 65e8b2a18..0ccdafae8 100644 --- a/channels/tsmf/client/tsmf_types.h +++ b/channels/tsmf/client/tsmf_types.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Video Redirection Virtual Channel - Types * * Copyright 2010-2011 Vic Lee @@ -40,19 +40,19 @@ typedef struct _TS_AM_MEDIA_TYPE int SubType; int FormatType; - uint32 Width; - uint32 Height; - uint32 BitRate; + UINT32 Width; + UINT32 Height; + UINT32 BitRate; struct { - uint32 Numerator; - uint32 Denominator; + UINT32 Numerator; + UINT32 Denominator; } SamplesPerSecond; - uint32 Channels; - uint32 BitsPerSample; - uint32 BlockAlign; - const uint8* ExtraData; - uint32 ExtraDataSize; + UINT32 Channels; + UINT32 BitsPerSample; + UINT32 BlockAlign; + const BYTE* ExtraData; + UINT32 ExtraDataSize; } TS_AM_MEDIA_TYPE; #endif diff --git a/channels/urbdrc/CMakeLists.txt b/channels/urbdrc/CMakeLists.txt index f49c8bedc..268379c3e 100644 --- a/channels/urbdrc/CMakeLists.txt +++ b/channels/urbdrc/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -20,5 +20,3 @@ add_subdirectory(libusb) if(WITH_CLIENT_CHANNELS) add_subdirectory(client) endif() - - diff --git a/channels/urbdrc/client/CMakeLists.txt b/channels/urbdrc/client/CMakeLists.txt index ce8087e8c..7033ca482 100644 --- a/channels/urbdrc/client/CMakeLists.txt +++ b/channels/urbdrc/client/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Atrust corp. @@ -16,27 +16,38 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(URBDRC_SRCS - searchman.c - searchman.h +set(MODULE_NAME "urbdrc") +set(MODULE_PREFIX "CHANNEL_URBDRC_CLIENT") + +set(${MODULE_PREFIX}_SRCS + searchman.c + searchman.h isoch_queue.c isoch_queue.h - data_transfer.c - data_transfer.h - urbdrc_main.c - urbdrc_main.h + data_transfer.c + data_transfer.h + urbdrc_main.c + urbdrc_main.h urbdrc_types.h) include_directories(..) -add_library(urbdrc ${URBDRC_SRCS}) -set_target_properties(urbdrc PROPERTIES PREFIX "") +add_library(${MODULE_NAME} ${URBDRC_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") -target_link_libraries(urbdrc udev) -target_link_libraries(urbdrc dbus-glib-1) -target_link_libraries(urbdrc pthread) -target_link_libraries(urbdrc uuid) -target_link_libraries(urbdrc freerdp-utils) +set(${MODULE_PREFIX}_LIBS + dbus-glib-1 + udev + uuid) -install(TARGETS urbdrc DESTINATION ${FREERDP_PLUGIN_PATH}) +if(MONOLITHIC_BUILD) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) + target_link_libraries(${MODULE_NAME} ${MODULE_PREFIX}_LIBS) +else() + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-utils) + target_link_libraries(${MODULE_NAME} ${MODULE_PREFIX}_LIBS) +endif() +install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH}) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${MODULE_NAME}/Client") diff --git a/channels/urbdrc/client/data_transfer.c b/channels/urbdrc/client/data_transfer.c index 541b0cc28..45fc217ee 100644 --- a/channels/urbdrc/client/data_transfer.c +++ b/channels/urbdrc/client/data_transfer.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -30,26 +30,26 @@ #include "urbdrc_types.h" #include "data_transfer.h" -static void usb_process_get_port_status(IUDEVICE* pdev, uint8* OutputBuffer) +static void usb_process_get_port_status(IUDEVICE* pdev, BYTE* OutputBuffer) { int bcdUSB = pdev->query_device_descriptor(pdev, BCD_USB); switch (bcdUSB) { case USB_v1_0: - data_write_uint32(OutputBuffer, 0x303); + data_write_UINT32(OutputBuffer, 0x303); break; case USB_v1_1: - data_write_uint32(OutputBuffer, 0x103); + data_write_UINT32(OutputBuffer, 0x103); break; case USB_v2_0: - data_write_uint32(OutputBuffer, 0x503); + data_write_UINT32(OutputBuffer, 0x503); break; default: - data_write_uint32(OutputBuffer, 0x503); + data_write_UINT32(OutputBuffer, 0x503); break; } } @@ -59,8 +59,8 @@ static void usb_process_get_port_status(IUDEVICE* pdev, uint8* OutputBuffer) static int func_check_isochronous_fds(IUDEVICE* pdev) { int ret = 0; - uint8* data_temp; - uint32 size_temp, process_times = 2; + BYTE* data_temp; + UINT32 size_temp, process_times = 2; ISOCH_CALLBACK_QUEUE* isoch_queue = NULL; ISOCH_CALLBACK_DATA* isoch = NULL; URBDRC_CHANNEL_CALLBACK* callback; @@ -118,11 +118,11 @@ static int func_check_isochronous_fds(IUDEVICE* pdev) #endif static int urbdrc_process_register_request_callback(URBDRC_CHANNEL_CALLBACK* callback, - uint8* data, uint32 data_sizem, IUDEVMAN* udevman, uint32 UsbDevice) + BYTE* data, UINT32 data_sizem, IUDEVMAN* udevman, UINT32 UsbDevice) { IUDEVICE* pdev; - uint32 NumRequestCompletion = 0; - uint32 RequestCompletion = 0; + UINT32 NumRequestCompletion = 0; + UINT32 RequestCompletion = 0; LLOGLN(urbdrc_debug, ("urbdrc_process_register_request_callback")); @@ -133,15 +133,15 @@ static int urbdrc_process_register_request_callback(URBDRC_CHANNEL_CALLBACK* cal if (data_sizem >= 8) { - data_read_uint32(data + 0, NumRequestCompletion); /** must be 1 */ + data_read_UINT32(data + 0, NumRequestCompletion); /** must be 1 */ /** RequestCompletion: * unique Request Completion interface for the client to use */ - data_read_uint32(data + 4, RequestCompletion); + data_read_UINT32(data + 4, RequestCompletion); pdev->set_ReqCompletion(pdev, RequestCompletion); } else /** Unregister the device */ { - data_read_uint32(data + 0, RequestCompletion); + data_read_UINT32(data + 0, RequestCompletion); if (1)//(pdev->get_ReqCompletion(pdev) == RequestCompletion) { @@ -157,13 +157,13 @@ static int urbdrc_process_register_request_callback(URBDRC_CHANNEL_CALLBACK* cal return 0; } -static int urbdrc_process_cancel_request(uint8* data, uint32 data_sizem, IUDEVMAN* udevman, uint32 UsbDevice) +static int urbdrc_process_cancel_request(BYTE* data, UINT32 data_sizem, IUDEVMAN* udevman, UINT32 UsbDevice) { IUDEVICE* pdev; - uint32 CancelId; + UINT32 CancelId; int error = 0; - data_read_uint32(data + 0, CancelId); /** RequestId */ + data_read_UINT32(data + 0, CancelId); /** RequestId */ LLOGLN(urbdrc_debug, ("urbdrc_process_cancel_request: id 0x%x", CancelId)); @@ -177,12 +177,12 @@ static int urbdrc_process_cancel_request(uint8* data, uint32 data_sizem, IUDEVMA return error; } -static int urbdrc_process_retract_device_request(uint8* data, uint32 data_sizem, IUDEVMAN* udevman, uint32 UsbDevice) +static int urbdrc_process_retract_device_request(BYTE* data, UINT32 data_sizem, IUDEVMAN* udevman, UINT32 UsbDevice) { - uint32 Reason; + UINT32 Reason; LLOGLN(urbdrc_debug, ("urbdrc_process_retract_device_request")); - data_read_uint32(data + 0, Reason); /** Reason */ + data_read_UINT32(data + 0, Reason); /** Reason */ switch (Reason) { @@ -200,27 +200,27 @@ static int urbdrc_process_retract_device_request(uint8* data, uint32 data_sizem, return 0; } -static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, - uint32 data_sizem, uint32 MessageId, IUDEVMAN * udevman, uint32 UsbDevice) +static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, + UINT32 data_sizem, UINT32 MessageId, IUDEVMAN * udevman, UINT32 UsbDevice) { IUDEVICE* pdev; - uint32 out_size; - uint32 InterfaceId; - uint32 IoControlCode; - uint32 InputBufferSize; - uint32 OutputBufferSize; - uint32 RequestId; - uint32 usbd_status = USBD_STATUS_SUCCESS; - uint8* OutputBuffer; - uint8* out_data; + UINT32 out_size; + UINT32 InterfaceId; + UINT32 IoControlCode; + UINT32 InputBufferSize; + UINT32 OutputBufferSize; + UINT32 RequestId; + UINT32 usbd_status = USBD_STATUS_SUCCESS; + BYTE* OutputBuffer; + BYTE* out_data; int i, offset, success = 0; LLOGLN(urbdrc_debug, ("urbdrc_process__io_control")); - data_read_uint32(data + 0, IoControlCode); - data_read_uint32(data + 4, InputBufferSize); - data_read_uint32(data + 8 + InputBufferSize, OutputBufferSize); - data_read_uint32(data + 12 + InputBufferSize, RequestId); + data_read_UINT32(data + 0, IoControlCode); + data_read_UINT32(data + 4, InputBufferSize); + data_read_UINT32(data + 8 + InputBufferSize, OutputBufferSize); + data_read_UINT32(data + 12 + InputBufferSize, RequestId); pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -230,7 +230,7 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, uint8* d InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); /** process */ - OutputBuffer = (uint8 *)malloc(OutputBufferSize); + OutputBuffer = (BYTE *)malloc(OutputBufferSize); memset(OutputBuffer, 0, OutputBufferSize); switch (IoControlCode) @@ -253,7 +253,7 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, uint8* d { if (pdev->isExist(pdev) == 0) { - data_write_uint32(OutputBuffer, 0); + data_write_UINT32(OutputBuffer, 0); } else { @@ -285,19 +285,19 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, uint8* d offset = 28; out_size = offset + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ - data_write_uint32(out_data + 8, IOCONTROL_COMPLETION); /** function id */ - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, USBD_STATUS_SUCCESS); /** HResult */ - data_write_uint32(out_data + 20, OutputBufferSize); /** Information */ - data_write_uint32(out_data + 24, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 8, IOCONTROL_COMPLETION); /** function id */ + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, USBD_STATUS_SUCCESS); /** HResult */ + data_write_UINT32(out_data + 20, OutputBufferSize); /** Information */ + data_write_UINT32(out_data + 24, OutputBufferSize); /** OutputBufferSize */ for (i=0;iget_udevice_by_UsbDevice(udevman, UsbDevice); @@ -333,20 +333,20 @@ static int urbdrc_process_internal_io_control(URBDRC_CHANNEL_CALLBACK* callback, InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - /** Fixme: Currently this is a false bustime... */ + /** Fixme: Currently this is a FALSE bustime... */ urbdrc_get_mstime(frames); out_size = 32; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ - data_write_uint32(out_data + 8, IOCONTROL_COMPLETION); /** function id */ - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 0); /** HResult */ - data_write_uint32(out_data + 20, 4); /** Information */ - data_write_uint32(out_data + 24, 4); /** OutputBufferSize */ - data_write_uint32(out_data + 28, frames); /** OutputBuffer */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 8, IOCONTROL_COMPLETION); /** function id */ + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 0); /** HResult */ + data_write_UINT32(out_data + 20, 4); /** Information */ + data_write_UINT32(out_data + 24, 4); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, frames); /** OutputBuffer */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -356,23 +356,23 @@ static int urbdrc_process_internal_io_control(URBDRC_CHANNEL_CALLBACK* callback, return 0; } -static int urbdrc_process_query_device_text(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, - uint32 data_sizem, uint32 MessageId, IUDEVMAN* udevman, uint32 UsbDevice) +static int urbdrc_process_query_device_text(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, + UINT32 data_sizem, UINT32 MessageId, IUDEVMAN* udevman, UINT32 UsbDevice) { IUDEVICE* pdev; - uint32 out_size; - uint32 InterfaceId; - uint32 TextType; - uint32 LocaleId; - uint32 bufferSize = 1024; - uint8* out_data; - uint8 DeviceDescription[bufferSize]; + UINT32 out_size; + UINT32 InterfaceId; + UINT32 TextType; + UINT32 LocaleId; + UINT32 bufferSize = 1024; + BYTE* out_data; + BYTE DeviceDescription[bufferSize]; int out_offset; LLOGLN(urbdrc_debug, ("urbdrc_process_query_device_text")); - data_read_uint32(data + 0, TextType); - data_read_uint32(data + 4, LocaleId); + data_read_UINT32(data + 0, TextType); + data_read_UINT32(data + 4, LocaleId); pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -389,28 +389,28 @@ static int urbdrc_process_query_device_text(URBDRC_CHANNEL_CALLBACK* callback, u if (bufferSize != 0) out_size += 2; - out_data = (uint8*) malloc(out_size); + out_data = (BYTE*) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if (bufferSize != 0) { - data_write_uint32(out_data + 8, (bufferSize/2)+1); /** cchDeviceDescription */ + data_write_UINT32(out_data + 8, (bufferSize/2)+1); /** cchDeviceDescription */ out_offset = 12; memcpy(out_data + out_offset, DeviceDescription, bufferSize); out_offset += bufferSize; - data_write_uint16(out_data + out_offset, 0x0000); + data_write_UINT16(out_data + out_offset, 0x0000); out_offset += 2; } else { - data_write_uint32(out_data + 8, 0); /** cchDeviceDescription */ + data_write_UINT32(out_data + 8, 0); /** cchDeviceDescription */ out_offset = 12; } - data_write_uint32(out_data + out_offset, 0); /** HResult */ + data_write_UINT32(out_data + out_offset, 0); /** HResult */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -424,8 +424,8 @@ static void func_select_all_interface_for_msconfig(IUDEVICE* pdev, MSUSB_CONFIG_ { int inum; MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = MsConfig->MsInterfaces; - uint8 InterfaceNumber, AlternateSetting; - uint32 NumInterfaces = MsConfig->NumInterfaces; + BYTE InterfaceNumber, AlternateSetting; + UINT32 NumInterfaces = MsConfig->NumInterfaces; for (inum = 0; inum < NumInterfaces; inum++) { @@ -435,14 +435,14 @@ static void func_select_all_interface_for_msconfig(IUDEVICE* pdev, MSUSB_CONFIG_ } } -static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, - uint32 data_sizem, uint32 MessageId, IUDEVMAN* udevman, uint32 UsbDevice, int transferDir) +static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, + UINT32 data_sizem, UINT32 MessageId, IUDEVMAN* udevman, UINT32 UsbDevice, int transferDir) { MSUSB_CONFIG_DESCRIPTOR * MsConfig = NULL; IUDEVICE* pdev = NULL; - uint32 out_size, InterfaceId, RequestId, NumInterfaces, usbd_status = 0; - uint8 ConfigurationDescriptorIsValid; - uint8* out_data; + UINT32 out_size, InterfaceId, RequestId, NumInterfaces, usbd_status = 0; + BYTE ConfigurationDescriptorIsValid; + BYTE* out_data; int MsOutSize = 0, offset = 0; if (transferDir == 0) @@ -457,9 +457,9 @@ static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, uint8* da return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint8(data + 4, ConfigurationDescriptorIsValid); - data_read_uint32(data + 8, NumInterfaces); + data_read_UINT32(data + 0, RequestId); + data_read_BYTE(data + 4, ConfigurationDescriptorIsValid); + data_read_UINT32(data + 8, NumInterfaces); offset = 12; /** if ConfigurationDescriptorIsValid is zero, then just do nothing.*/ @@ -482,28 +482,28 @@ static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, uint8* da out_size = 36 + MsOutSize; else out_size = 44; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); /** function id */ - data_write_uint32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); /** function id */ + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ if (MsOutSize > 0) { /** CbTsUrbResult */ - data_write_uint32(out_data + 16, 8 + MsOutSize); + data_write_UINT32(out_data + 16, 8 + MsOutSize); /** TS_URB_RESULT_HEADER Size*/ - data_write_uint16(out_data + 20, 8 + MsOutSize); + data_write_UINT16(out_data + 20, 8 + MsOutSize); } else { - data_write_uint32(out_data + 16, 16); - data_write_uint16(out_data + 20, 16); + data_write_UINT32(out_data + 16, 16); + data_write_UINT16(out_data + 20, 16); } /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_SELECT_CONFIGURATION); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_SELECT_CONFIGURATION); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ offset = 28; /** TS_URB_SELECT_CONFIGURATION_RESULT */ if (MsOutSize > 0) @@ -512,12 +512,12 @@ static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, uint8* da } else { - data_write_uint32(out_data + offset, 0); /** ConfigurationHandle */ - data_write_uint32(out_data + offset + 4, NumInterfaces); /** NumInterfaces */ + data_write_UINT32(out_data + offset, 0); /** ConfigurationHandle */ + data_write_UINT32(out_data + offset + 4, NumInterfaces); /** NumInterfaces */ offset += 8; } - data_write_uint32(out_data + offset, 0); /** HResult */ - data_write_uint32(out_data + offset + 4, 0); /** OutputBufferSize */ + data_write_UINT32(out_data + offset, 0); /** HResult */ + data_write_UINT32(out_data + offset + 4, 0); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -525,16 +525,16 @@ static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, uint8* da return 0; } -static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, uint32 data_sizem, - uint32 MessageId, IUDEVMAN* udevman, uint32 UsbDevice, int transferDir) +static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN* udevman, UINT32 UsbDevice, int transferDir) { MSUSB_CONFIG_DESCRIPTOR* MsConfig; MSUSB_INTERFACE_DESCRIPTOR* MsInterface; IUDEVICE* pdev; - uint32 out_size, InterfaceId, RequestId, ConfigurationHandle; - uint32 OutputBufferSize; - uint8 InterfaceNumber; - uint8* out_data; + UINT32 out_size, InterfaceId, RequestId, ConfigurationHandle; + UINT32 OutputBufferSize; + BYTE InterfaceNumber; + BYTE* out_data; int out_offset, interface_size; if (transferDir == 0) @@ -550,13 +550,13 @@ static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, InterfaceId = ((STREAM_ID_PROXY << 30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint32(data + 4, ConfigurationHandle); + data_read_UINT32(data + 0, RequestId); + data_read_UINT32(data + 4, ConfigurationHandle); out_offset = 8; MsInterface = msusb_msinterface_read(data + out_offset, data_sizem - out_offset, &out_offset); - data_read_uint32(data + out_offset, OutputBufferSize); + data_read_UINT32(data + out_offset, OutputBufferSize); pdev->select_interface(pdev, MsInterface->InterfaceNumber, MsInterface->AlternateSetting); @@ -571,26 +571,26 @@ static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, interface_size = 16 + (MsInterface->NumberOfPipes * 20); out_size = 36 + interface_size ; - out_data = (uint8*) malloc(out_size); + out_data = (BYTE*) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); /** function id */ - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 8 + interface_size); /** CbTsUrbResult */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); /** function id */ + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 8 + interface_size); /** CbTsUrbResult */ /** TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 8 + interface_size); /** Size */ + data_write_UINT16(out_data + 20, 8 + interface_size); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_SELECT_INTERFACE); - data_write_uint32(out_data + 24, USBD_STATUS_SUCCESS); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_SELECT_INTERFACE); + data_write_UINT32(out_data + 24, USBD_STATUS_SUCCESS); /** UsbdStatus */ out_offset = 28; /** TS_URB_SELECT_INTERFACE_RESULT */ msusb_msinterface_write(MsInterface, out_data + out_offset, &out_offset); - data_write_uint32(out_data + out_offset, 0); /** HResult */ - data_write_uint32(out_data + out_offset + 4, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + out_offset, 0); /** HResult */ + data_write_UINT32(out_data + out_offset + 4, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -600,16 +600,16 @@ static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, return 0; } -static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, - uint32 data_sizem, uint32 MessageId, IUDEVMAN* udevman, uint32 UsbDevice, int transferDir, int External) +static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, + UINT32 data_sizem, UINT32 MessageId, IUDEVMAN* udevman, UINT32 UsbDevice, int transferDir, int External) { IUDEVICE* pdev; - uint32 out_size, RequestId, InterfaceId, EndpointAddress, PipeHandle; - uint32 TransferFlags, OutputBufferSize, usbd_status, Timeout; - uint8 bmRequestType, Request; - uint16 Value, Index, length; - uint8* buffer; - uint8* out_data; + UINT32 out_size, RequestId, InterfaceId, EndpointAddress, PipeHandle; + UINT32 TransferFlags, OutputBufferSize, usbd_status, Timeout; + BYTE bmRequestType, Request; + UINT16 Value, Index, length; + BYTE* buffer; + BYTE* out_data; int offset, ret; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -618,9 +618,9 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, return 0; InterfaceId = ((STREAM_ID_PROXY << 30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint32(data + 4, PipeHandle); - data_read_uint32(data + 8, TransferFlags); /** TransferFlags */ + data_read_UINT32(data + 0, RequestId); + data_read_UINT32(data + 4, PipeHandle); + data_read_UINT32(data + 8, TransferFlags); /** TransferFlags */ EndpointAddress = (PipeHandle & 0x000000ff); offset = 12; @@ -629,7 +629,7 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, switch (External) { case URB_CONTROL_TRANSFER_EXTERNAL: - data_read_uint32(data + offset, Timeout); /** TransferFlags */ + data_read_UINT32(data + offset, Timeout); /** TransferFlags */ offset += 4; break; case URB_CONTROL_TRANSFER_NONEXTERNAL: @@ -637,12 +637,12 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, } /** SetupPacket 8 bytes */ - data_read_uint8(data + offset, bmRequestType); - data_read_uint8(data + offset + 1, Request); - data_read_uint16(data + offset + 2, Value); - data_read_uint16(data + offset + 4, Index); - data_read_uint16(data + offset + 6, length); - data_read_uint32(data + offset + 8, OutputBufferSize); + data_read_BYTE(data + offset, bmRequestType); + data_read_BYTE(data + offset + 1, Request); + data_read_UINT16(data + offset + 2, Value); + data_read_UINT16(data + offset + 4, Index); + data_read_UINT16(data + offset + 6, length); + data_read_UINT32(data + offset + 8, OutputBufferSize); offset += 12; if (length != OutputBufferSize) @@ -652,7 +652,7 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, } out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -685,24 +685,24 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, else out_size = offset; - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if(transferDir == USBD_TRANSFER_DIRECTION_IN && OutputBufferSize != 0) - data_write_uint32(out_data + 8, URB_COMPLETION); /** function id */ + data_write_UINT32(out_data + 8, URB_COMPLETION); /** function id */ else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 0x00000008); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 0x00000008); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 0x0008); /** Size */ + data_write_UINT16(out_data + 20, 0x0008); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_CONTROL_TRANSFER); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_CONTROL_TRANSFER); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -712,14 +712,14 @@ static int urb_control_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, return 0; } -static int urb_bulk_or_interrupt_transfer(URBDRC_CHANNEL_CALLBACK* callback, uint8* data, - uint32 data_sizem, uint32 MessageId, IUDEVMAN* udevman, uint32 UsbDevice, int transferDir) +static int urb_bulk_or_interrupt_transfer(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, + UINT32 data_sizem, UINT32 MessageId, IUDEVMAN* udevman, UINT32 UsbDevice, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, EndpointAddress, PipeHandle; - uint32 TransferFlags, OutputBufferSize, usbd_status = 0; - uint8 * Buffer; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, EndpointAddress, PipeHandle; + UINT32 TransferFlags, OutputBufferSize, usbd_status = 0; + BYTE * Buffer; + BYTE * out_data; int offset; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -728,10 +728,10 @@ static int urb_bulk_or_interrupt_transfer(URBDRC_CHANNEL_CALLBACK* callback, uin InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint32(data + 4, PipeHandle); - data_read_uint32(data + 8, TransferFlags); /** TransferFlags */ - data_read_uint32(data + 12, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT32(data + 4, PipeHandle); + data_read_UINT32(data + 8, TransferFlags); /** TransferFlags */ + data_read_UINT32(data + 12, OutputBufferSize); offset = 16; EndpointAddress = (PipeHandle & 0x000000ff); @@ -740,7 +740,7 @@ static int urb_bulk_or_interrupt_transfer(URBDRC_CHANNEL_CALLBACK* callback, uin else out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); switch (transferDir) @@ -767,23 +767,23 @@ static int urb_bulk_or_interrupt_transfer(URBDRC_CHANNEL_CALLBACK* callback, uin else out_size = offset; /** send data */ - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if(transferDir == USBD_TRANSFER_DIRECTION_IN && OutputBufferSize != 0) - data_write_uint32(out_data + 8, URB_COMPLETION); /** function id */ + data_write_UINT32(out_data + 8, URB_COMPLETION); /** function id */ else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 0x00000008); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 0x00000008); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 0x0008); /** Size */ + data_write_UINT16(out_data + 20, 0x0008); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (pdev && !pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -795,22 +795,22 @@ static int urb_bulk_or_interrupt_transfer(URBDRC_CHANNEL_CALLBACK* callback, uin static int -urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, - uint32 data_sizem, - uint32 MessageId, +urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, + UINT32 UsbDevice, int transferDir) { IUDEVICE * pdev; - uint32 RequestId, InterfaceId, EndpointAddress; - uint32 PipeHandle, TransferFlags, StartFrame, NumberOfPackets; - uint32 ErrorCount, OutputBufferSize, usbd_status = 0; - uint32 RequestField, noAck = 0; - uint32 out_size = 0; - uint8 * iso_buffer = NULL; - uint8 * iso_packets = NULL; - uint8 * out_data = NULL; + UINT32 RequestId, InterfaceId, EndpointAddress; + UINT32 PipeHandle, TransferFlags, StartFrame, NumberOfPackets; + UINT32 ErrorCount, OutputBufferSize, usbd_status = 0; + UINT32 RequestField, noAck = 0; + UINT32 out_size = 0; + BYTE * iso_buffer = NULL; + BYTE * iso_packets = NULL; + BYTE * out_data = NULL; int offset, nullBuffer = 0, iso_status; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -820,30 +820,30 @@ urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestField); + data_read_UINT32(data + 0, RequestField); RequestId = RequestField & 0x7fffffff; noAck = (RequestField & 0x80000000)>>31; - data_read_uint32(data + 4, PipeHandle); + data_read_UINT32(data + 4, PipeHandle); EndpointAddress = (PipeHandle & 0x000000ff); - data_read_uint32(data + 8, TransferFlags); /** TransferFlags */ - data_read_uint32(data + 12, StartFrame); /** StartFrame */ - data_read_uint32(data + 16, NumberOfPackets); /** NumberOfPackets */ - data_read_uint32(data + 20, ErrorCount); /** ErrorCount */ + data_read_UINT32(data + 8, TransferFlags); /** TransferFlags */ + data_read_UINT32(data + 12, StartFrame); /** StartFrame */ + data_read_UINT32(data + 16, NumberOfPackets); /** NumberOfPackets */ + data_read_UINT32(data + 20, ErrorCount); /** ErrorCount */ offset = 24 + (NumberOfPackets * 12); - data_read_uint32(data + offset, OutputBufferSize); + data_read_UINT32(data + offset, OutputBufferSize); offset += 4; /** send data memory alloc */ if (transferDir == USBD_TRANSFER_DIRECTION_OUT) { if (!noAck) { out_size = 48 + (NumberOfPackets * 12); - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); iso_packets = out_data + 40; } } else { out_size = 48 + OutputBufferSize + (NumberOfPackets * 12); - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); iso_packets = out_data + 40; } @@ -908,37 +908,37 @@ urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, else out_size += OutputBufferSize + (NumberOfPackets * 12); /* fill the send data */ - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if(OutputBufferSize != 0 && !nullBuffer) - data_write_uint32(out_data + 8, URB_COMPLETION); /** function id */ + data_write_UINT32(out_data + 8, URB_COMPLETION); /** function id */ else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 20 + (NumberOfPackets * 12)); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 20 + (NumberOfPackets * 12)); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 20 + (NumberOfPackets * 12)); /** Size */ + data_write_UINT16(out_data + 20, 20 + (NumberOfPackets * 12)); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_ISOCH_TRANSFER); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_ISOCH_TRANSFER); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, StartFrame); /** StartFrame */ + data_write_UINT32(out_data + 28, StartFrame); /** StartFrame */ if (!nullBuffer) { /** NumberOfPackets */ - data_write_uint32(out_data + 32, NumberOfPackets); - data_write_uint32(out_data + 36, ErrorCount); /** ErrorCount */ + data_write_UINT32(out_data + 32, NumberOfPackets); + data_write_UINT32(out_data + 36, ErrorCount); /** ErrorCount */ offset = 40 + (NumberOfPackets * 12); } else { - data_write_uint32(out_data + 32, 0); /** NumberOfPackets */ - data_write_uint32(out_data + 36, NumberOfPackets); /** ErrorCount */ + data_write_UINT32(out_data + 32, 0); /** NumberOfPackets */ + data_write_UINT32(out_data + 36, NumberOfPackets); /** ErrorCount */ offset = 40; } - data_write_uint32(out_data + offset, 0); /** HResult */ - data_write_uint32(out_data + offset + 4, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + offset, 0); /** HResult */ + data_write_UINT32(out_data + offset + 4, OutputBufferSize); /** OutputBufferSize */ #if ISOCH_FIFO if(!noAck){ @@ -961,34 +961,34 @@ urb_isoch_transfer(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, static int urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, - uint8 * data, - uint32 data_sizem, - uint32 MessageId, + BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, - uint8 func_recipient, + UINT32 UsbDevice, + BYTE func_recipient, int transferDir) { IUDEVICE * pdev; - uint32 out_size, InterfaceId, RequestId, OutputBufferSize, usbd_status; - uint8 bmRequestType, desc_index, desc_type; - uint16 langId; - uint8 * buffer; - uint8 * out_data; + UINT32 out_size, InterfaceId, RequestId, OutputBufferSize, usbd_status; + BYTE bmRequestType, desc_index, desc_type; + UINT16 langId; + BYTE * buffer; + BYTE * out_data; int ret, offset; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); if (pdev == NULL) return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint8(data + 4, desc_index); - data_read_uint8(data + 5, desc_type); - data_read_uint16(data + 6, langId); - data_read_uint32(data + 8, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_BYTE(data + 4, desc_index); + data_read_BYTE(data + 5, desc_type); + data_read_UINT16(data + 6, langId); + data_read_UINT32(data + 8, OutputBufferSize); out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -1031,18 +1031,18 @@ urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, offset = 36; out_size = offset + OutputBufferSize; - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ - data_write_uint32(out_data + 8, URB_COMPLETION); /** function id */ - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 0x00000008); /** CbTsUrbResult */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 8, URB_COMPLETION); /** function id */ + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 0x00000008); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 0x0008); /** Size */ + data_write_UINT16(out_data + 20, 0x0008); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT16(out_data + 22, URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1055,20 +1055,20 @@ urb_control_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, static int -urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, - uint32 data_sizem, - uint32 MessageId, +urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, - uint8 func_recipient, + UINT32 UsbDevice, + BYTE func_recipient, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; - uint16 Index; - uint8 bmRequestType; - uint8 * buffer; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; + UINT16 Index; + BYTE bmRequestType; + BYTE * buffer; + BYTE * out_data; int offset, ret; if (transferDir == 0){ @@ -1081,12 +1081,12 @@ urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint16(data + 4, Index); /** Index */ - data_read_uint32(data + 8, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT16(data + 4, Index); /** Index */ + data_read_UINT32(data + 8, OutputBufferSize); out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -1119,24 +1119,24 @@ urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, else out_size = offset; - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if(transferDir == USBD_TRANSFER_DIRECTION_IN && OutputBufferSize != 0) - data_write_uint32(out_data + 8, URB_COMPLETION); /** function id */ + data_write_UINT32(out_data + 8, URB_COMPLETION); /** function id */ else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId, include NoAck*/ - data_write_uint32(out_data + 16, 0x00000008); /** CbTsUrbResult */ + data_write_UINT32(out_data + 12, RequestId); /** RequestId, include NoAck*/ + data_write_UINT32(out_data + 16, 0x00000008); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 0x0008); /** Size */ + data_write_UINT16(out_data + 20, 0x0008); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_VENDOR_DEVICE); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_VENDOR_DEVICE); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1148,22 +1148,22 @@ urb_control_get_status_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, static int urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback, - uint8 * data, - uint32 data_sizem, - uint32 MessageId, + BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, - uint8 func_type, - uint8 func_recipient, + UINT32 UsbDevice, + BYTE func_type, + BYTE func_recipient, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, TransferFlags, usbd_status; - uint32 OutputBufferSize; - uint8 ReqTypeReservedBits, Request, bmRequestType; - uint16 Value, Index, Padding; - uint8 * buffer; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, TransferFlags, usbd_status; + UINT32 OutputBufferSize; + BYTE ReqTypeReservedBits, Request, bmRequestType; + UINT16 Value, Index, Padding; + BYTE * buffer; + BYTE * out_data; int offset, ret; /** control by vendor command */ @@ -1172,18 +1172,18 @@ urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint32(data + 4, TransferFlags); /** TransferFlags */ - data_read_uint8(data + 8, ReqTypeReservedBits); /** ReqTypeReservedBids */ - data_read_uint8(data + 9, Request); /** Request */ - data_read_uint16(data + 10, Value); /** value */ - data_read_uint16(data + 12, Index); /** index */ - data_read_uint16(data + 14, Padding); /** Padding */ - data_read_uint32(data + 16, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT32(data + 4, TransferFlags); /** TransferFlags */ + data_read_BYTE(data + 8, ReqTypeReservedBits); /** ReqTypeReservedBids */ + data_read_BYTE(data + 9, Request); /** Request */ + data_read_UINT16(data + 10, Value); /** value */ + data_read_UINT16(data + 12, Index); /** index */ + data_read_UINT16(data + 14, Padding); /** Padding */ + data_read_UINT32(data + 16, OutputBufferSize); offset = 20; out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -1229,23 +1229,23 @@ urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback, else out_size = offset; /** send data */ - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if(transferDir == USBD_TRANSFER_DIRECTION_IN && OutputBufferSize != 0) - data_write_uint32(out_data + 8, URB_COMPLETION); /** function id */ + data_write_UINT32(out_data + 8, URB_COMPLETION); /** function id */ else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId, include NoAck*/ - data_write_uint32(out_data + 16, 0x00000008); /** CbTsUrbResult */ + data_write_UINT32(out_data + 12, RequestId); /** RequestId, include NoAck*/ + data_write_UINT32(out_data + 16, 0x00000008); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 0x0008); /** Size */ - data_write_uint16(out_data + 22, URB_FUNCTION_VENDOR_DEVICE); /** Padding, MUST be ignored upon receipt */ - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 20, 0x0008); /** Size */ + data_write_UINT16(out_data + 22, URB_FUNCTION_VENDOR_DEVICE); /** Padding, MUST be ignored upon receipt */ + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1258,19 +1258,19 @@ urb_control_vendor_or_class_request(URBDRC_CHANNEL_CALLBACK * callback, static int urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, - uint8 * data, - uint32 data_sizem, - uint32 MessageId, + BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, + UINT32 UsbDevice, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; - uint8 Recipient, InterfaceNumber, Ms_PageIndex; - uint16 Ms_featureDescIndex; - uint8 * out_data; - uint8 * buffer; + UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; + BYTE Recipient, InterfaceNumber, Ms_PageIndex; + UINT16 Ms_featureDescIndex; + BYTE * out_data; + BYTE * buffer; int offset, ret; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -1278,17 +1278,17 @@ urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint8(data + 4, Recipient); /** Recipient */ + data_read_UINT32(data + 0, RequestId); + data_read_BYTE(data + 4, Recipient); /** Recipient */ Recipient = Recipient && 0x1f; - data_read_uint8(data + 5, InterfaceNumber); /** InterfaceNumber */ - data_read_uint8(data + 6, Ms_PageIndex); /** Ms_PageIndex */ - data_read_uint16(data + 7, Ms_featureDescIndex); /** Ms_featureDescIndex */ - data_read_uint32(data + 12, OutputBufferSize); + data_read_BYTE(data + 5, InterfaceNumber); /** InterfaceNumber */ + data_read_BYTE(data + 6, Ms_PageIndex); /** Ms_PageIndex */ + data_read_UINT16(data + 7, Ms_featureDescIndex); /** Ms_featureDescIndex */ + data_read_UINT32(data + 12, OutputBufferSize); offset = 16; out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -1325,23 +1325,23 @@ urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, offset = 36; out_size = offset + OutputBufferSize; /** send data */ - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if(OutputBufferSize!=0) - data_write_uint32(out_data + 8, URB_COMPLETION); /** function id */ + data_write_UINT32(out_data + 8, URB_COMPLETION); /** function id */ else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 0x00000008); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 0x00000008); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 0x0008); /** Size */ + data_write_UINT16(out_data + 20, 0x0008); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1354,18 +1354,18 @@ urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback, static int -urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, - uint32 data_sizem, - uint32 MessageId, +urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, + UINT32 UsbDevice, int transferDir, int action) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, PipeHandle, EndpointAddress; - uint32 OutputBufferSize, usbd_status = 0; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, PipeHandle, EndpointAddress; + UINT32 OutputBufferSize, usbd_status = 0; + BYTE * out_data; int out_offset, ret; if (transferDir == 0){ @@ -1378,9 +1378,9 @@ urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint32(data + 4, PipeHandle); /** PipeHandle */ - data_read_uint32(data + 8, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT32(data + 4, PipeHandle); /** PipeHandle */ + data_read_UINT32(data + 8, OutputBufferSize); EndpointAddress = (PipeHandle & 0x000000ff); @@ -1420,23 +1420,23 @@ urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, /** send data */ out_offset = 36; out_size = out_offset + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 0x00000008); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 0x00000008); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 0x0008); /** Size */ + data_write_UINT16(out_data + 20, 0x0008); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, 0); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, 0); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1449,17 +1449,17 @@ urb_pipe_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, static int urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK * callback, - uint8 * data, - uint32 data_sizem, - uint32 MessageId, + BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, + UINT32 UsbDevice, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, OutputBufferSize; - uint32 dummy_frames; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, OutputBufferSize; + UINT32 dummy_frames; + BYTE * out_data; if (transferDir == 0){ LLOGLN(urbdrc_debug, ("urb_get_current_frame_number: not support transfer out\n")); @@ -1472,31 +1472,31 @@ urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK * callback, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint32(data + 4, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT32(data + 4, OutputBufferSize); /** Fixme: Need to fill actual frame number!!*/ urbdrc_get_mstime(dummy_frames); out_size = 40; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 12); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 12); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 12); /** Size */ + data_write_UINT16(out_data + 20, 12); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_GET_CURRENT_FRAME_NUMBER); - data_write_uint32(out_data + 24, USBD_STATUS_SUCCESS); /** UsbdStatus */ - data_write_uint32(out_data + 28, dummy_frames); /** FrameNumber */ + data_write_UINT16(out_data + 22, URB_FUNCTION_GET_CURRENT_FRAME_NUMBER); + data_write_UINT32(out_data + 24, USBD_STATUS_SUCCESS); /** UsbdStatus */ + data_write_UINT32(out_data + 28, dummy_frames); /** FrameNumber */ - data_write_uint32(out_data + 32, 0); /** HResult */ - data_write_uint32(out_data + 36, 0); /** OutputBufferSize */ + data_write_UINT32(out_data + 32, 0); /** HResult */ + data_write_UINT32(out_data + 36, 0); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1508,17 +1508,17 @@ urb_get_current_frame_number(URBDRC_CHANNEL_CALLBACK * callback, /* Unused function for current server */ static int urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK * callback, - uint8 * data, - uint32 data_sizem, - uint32 MessageId, + BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, + UINT32 UsbDevice, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; - uint8 * buffer; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; + BYTE * buffer; + BYTE * out_data; int ret, offset; if (transferDir == 0){ @@ -1532,11 +1532,11 @@ urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK * callback, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint32(data + 4, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT32(data + 4, OutputBufferSize); out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -1559,24 +1559,24 @@ urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK * callback, offset = 36; out_size = offset + OutputBufferSize; - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if (OutputBufferSize != 0) - data_write_uint32(out_data + 8, URB_COMPLETION); + data_write_UINT32(out_data + 8, URB_COMPLETION); else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 8); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 8); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 8); /** Size */ + data_write_UINT16(out_data + 20, 8); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_GET_CONFIGURATION); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_GET_CONFIGURATION); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1587,18 +1587,18 @@ urb_control_get_configuration_request(URBDRC_CHANNEL_CALLBACK * callback, /* Unused function for current server */ static int urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK * callback, - uint8 * data, - uint32 data_sizem, - uint32 MessageId, + BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, + UINT32 UsbDevice, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; - uint16 interface; - uint8 * buffer; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; + UINT16 interface; + BYTE * buffer; + BYTE * out_data; int ret, offset; if (transferDir == 0){ @@ -1611,12 +1611,12 @@ urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK * callback, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint16(data + 4, interface); - data_read_uint32(data + 8, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT16(data + 4, interface); + data_read_UINT32(data + 8, OutputBufferSize); out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -1637,24 +1637,24 @@ urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK * callback, offset = 36; out_size = offset + OutputBufferSize; - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if (OutputBufferSize != 0) - data_write_uint32(out_data + 8, URB_COMPLETION); + data_write_UINT32(out_data + 8, URB_COMPLETION); else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 8); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 8); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 8); /** Size */ + data_write_UINT16(out_data + 20, 8); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_GET_INTERFACE); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_GET_INTERFACE); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) callback->channel->Write(callback->channel, out_size, out_data, NULL); @@ -1663,21 +1663,21 @@ urb_control_get_interface_request(URBDRC_CHANNEL_CALLBACK * callback, } static int -urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, - uint32 data_sizem, - uint32 MessageId, +urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, - uint8 func_recipient, - uint8 command, + UINT32 UsbDevice, + BYTE func_recipient, + BYTE command, int transferDir) { IUDEVICE * pdev; - uint32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; - uint16 FeatureSelector, Index; - uint8 bmRequestType, bmRequest; - uint8 * buffer; - uint8 * out_data; + UINT32 out_size, RequestId, InterfaceId, OutputBufferSize, usbd_status; + UINT16 FeatureSelector, Index; + BYTE bmRequestType, bmRequest; + BYTE * buffer; + BYTE * out_data; int ret, offset; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -1685,14 +1685,14 @@ urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, return 0; InterfaceId = ((STREAM_ID_PROXY<<30) | pdev->get_ReqCompletion(pdev)); - data_read_uint32(data + 0, RequestId); - data_read_uint16(data + 4, FeatureSelector); - data_read_uint16(data + 6, Index); - data_read_uint32(data + 8, OutputBufferSize); + data_read_UINT32(data + 0, RequestId); + data_read_UINT16(data + 4, FeatureSelector); + data_read_UINT16(data + 6, Index); + data_read_UINT32(data + 8, OutputBufferSize); offset = 12; out_size = 36 + OutputBufferSize; - out_data = (uint8 *) malloc(out_size); + out_data = (BYTE *) malloc(out_size); memset(out_data, 0, out_size); buffer = out_data + 36; @@ -1739,24 +1739,24 @@ urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, offset = 36; out_size = offset + OutputBufferSize; - data_write_uint32(out_data + 0, InterfaceId); /** interface */ - data_write_uint32(out_data + 4, MessageId); /** message id */ + data_write_UINT32(out_data + 0, InterfaceId); /** interface */ + data_write_UINT32(out_data + 4, MessageId); /** message id */ if (OutputBufferSize != 0) - data_write_uint32(out_data + 8, URB_COMPLETION); + data_write_UINT32(out_data + 8, URB_COMPLETION); else - data_write_uint32(out_data + 8, URB_COMPLETION_NO_DATA); - data_write_uint32(out_data + 12, RequestId); /** RequestId */ - data_write_uint32(out_data + 16, 8); /** CbTsUrbResult */ + data_write_UINT32(out_data + 8, URB_COMPLETION_NO_DATA); + data_write_UINT32(out_data + 12, RequestId); /** RequestId */ + data_write_UINT32(out_data + 16, 8); /** CbTsUrbResult */ /** TsUrbResult TS_URB_RESULT_HEADER */ - data_write_uint16(out_data + 20, 8); /** Size */ + data_write_UINT16(out_data + 20, 8); /** Size */ /** Padding, MUST be ignored upon receipt */ - data_write_uint16(out_data + 22, URB_FUNCTION_GET_INTERFACE); - data_write_uint32(out_data + 24, usbd_status); /** UsbdStatus */ + data_write_UINT16(out_data + 22, URB_FUNCTION_GET_INTERFACE); + data_write_UINT32(out_data + 24, usbd_status); /** UsbdStatus */ - data_write_uint32(out_data + 28, 0); /** HResult */ - data_write_uint32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ + data_write_UINT32(out_data + 28, 0); /** HResult */ + data_write_UINT32(out_data + 32, OutputBufferSize); /** OutputBufferSize */ if (!pdev->isSigToEnd(pdev)) @@ -1766,27 +1766,27 @@ urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, } static int -urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, uint8 * data, - uint32 data_sizem, - uint32 MessageId, +urbdrc_process_transfer_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE * data, + UINT32 data_sizem, + UINT32 MessageId, IUDEVMAN * udevman, - uint32 UsbDevice, + UINT32 UsbDevice, int transferDir) { IUDEVICE * pdev; - uint32 CbTsUrb; - uint16 Size; - uint16 URB_Function; - uint32 OutputBufferSize; + UINT32 CbTsUrb; + UINT16 Size; + UINT16 URB_Function; + UINT32 OutputBufferSize; int error = 0; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); if (pdev == NULL) return 0; - data_read_uint32(data + 0, CbTsUrb); /** CbTsUrb */ - data_read_uint16(data + 4, Size); /** size */ - data_read_uint16(data + 6, URB_Function); - data_read_uint32(data + 4 + CbTsUrb, OutputBufferSize); + data_read_UINT32(data + 0, CbTsUrb); /** CbTsUrb */ + data_read_UINT16(data + 4, Size); /** size */ + data_read_UINT16(data + 6, URB_Function); + data_read_UINT32(data + 4 + CbTsUrb, OutputBufferSize); switch (URB_Function) { @@ -2302,12 +2302,12 @@ urbdrc_process_udev_data_transfer(void* arg) { TRANSFER_DATA* transfer_data = (TRANSFER_DATA*) arg; URBDRC_CHANNEL_CALLBACK * callback = transfer_data->callback; - uint8 * pBuffer = transfer_data->pBuffer; - uint32 cbSize = transfer_data->cbSize; - uint32 UsbDevice = transfer_data->UsbDevice; + BYTE * pBuffer = transfer_data->pBuffer; + UINT32 cbSize = transfer_data->cbSize; + UINT32 UsbDevice = transfer_data->UsbDevice; IUDEVMAN * udevman = transfer_data->udevman; - uint32 MessageId; - uint32 FunctionId; + UINT32 MessageId; + UINT32 FunctionId; IUDEVICE* pdev; int error = 0; pdev = udevman->get_udevice_by_UsbDevice(udevman, UsbDevice); @@ -2327,8 +2327,8 @@ urbdrc_process_udev_data_transfer(void* arg) /* USB kernel driver detach!! */ pdev->detach_kernel_driver(pdev); - data_read_uint32(pBuffer + 0, MessageId); - data_read_uint32(pBuffer + 4, FunctionId); + data_read_UINT32(pBuffer + 0, MessageId); + data_read_UINT32(pBuffer + 4, FunctionId); switch (FunctionId) { case CANCEL_REQUEST: diff --git a/channels/urbdrc/client/data_transfer.h b/channels/urbdrc/client/data_transfer.h index eb6af0a93..535c053d5 100644 --- a/channels/urbdrc/client/data_transfer.h +++ b/channels/urbdrc/client/data_transfer.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. diff --git a/channels/urbdrc/client/isoch_queue.c b/channels/urbdrc/client/isoch_queue.c index 22a64ce09..0d124ca1d 100644 --- a/channels/urbdrc/client/isoch_queue.c +++ b/channels/urbdrc/client/isoch_queue.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. diff --git a/channels/urbdrc/client/isoch_queue.h b/channels/urbdrc/client/isoch_queue.h index 94b077375..14e3b5cf3 100644 --- a/channels/urbdrc/client/isoch_queue.h +++ b/channels/urbdrc/client/isoch_queue.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -34,8 +34,8 @@ struct _ISOCH_CALLBACK_DATA void * prev; void * next; void * device; - uint8 * out_data; - uint32 out_size; + BYTE * out_data; + UINT32 out_size; void * callback; }; diff --git a/channels/urbdrc/client/searchman.c b/channels/urbdrc/client/searchman.c index 6b710997e..1d760c5da 100644 --- a/channels/urbdrc/client/searchman.c +++ b/channels/urbdrc/client/searchman.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -48,7 +48,7 @@ static USB_SEARCHDEV* searchman_get_next(USB_SEARCHMAN* searchman) return search; } -static int searchman_list_add(USB_SEARCHMAN* searchman, uint16 idVendor, uint16 idProduct) +static int searchman_list_add(USB_SEARCHMAN* searchman, UINT16 idVendor, UINT16 idProduct) { USB_SEARCHDEV* search; @@ -77,7 +77,7 @@ static int searchman_list_add(USB_SEARCHMAN* searchman, uint16 idVendor, uint16 return 1; } -static int searchman_list_remove(USB_SEARCHMAN* searchman, uint16 idVendor, uint16 idProduct) +static int searchman_list_remove(USB_SEARCHMAN* searchman, UINT16 idVendor, UINT16 idProduct) { USB_SEARCHDEV* search; USB_SEARCHDEV* point; @@ -180,7 +180,7 @@ void searchman_free(USB_SEARCHMAN* self) free(self); } -USB_SEARCHMAN* searchman_new(void * urbdrc, uint32 UsbDevice) +USB_SEARCHMAN* searchman_new(void * urbdrc, UINT32 UsbDevice) { int ret; USB_SEARCHMAN* searchman; diff --git a/channels/urbdrc/client/searchman.h b/channels/urbdrc/client/searchman.h index 0a690d1b8..c6d20c511 100644 --- a/channels/urbdrc/client/searchman.h +++ b/channels/urbdrc/client/searchman.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -30,15 +30,15 @@ struct _USB_SEARCHDEV void * inode; void * prev; void * next; - uint16 idVendor; - uint16 idProduct; + UINT16 idVendor; + UINT16 idProduct; }; typedef struct _USB_SEARCHMAN USB_SEARCHMAN; struct _USB_SEARCHMAN { int usb_numbers; - uint32 UsbDevice; + UINT32 UsbDevice; USB_SEARCHDEV * idev; /* iterator device */ USB_SEARCHDEV * head; /* head device in linked list */ USB_SEARCHDEV * tail; /* tail device in linked list */ @@ -60,9 +60,9 @@ struct _USB_SEARCHMAN /* close searchman */ void (*close) (USB_SEARCHMAN* self); /* add a new usb device for search */ - int (*add) (USB_SEARCHMAN* seachman, uint16 idVendor, uint16 idProduct); + int (*add) (USB_SEARCHMAN* seachman, UINT16 idVendor, UINT16 idProduct); /* remove a usb device from list */ - int (*remove) (USB_SEARCHMAN* searchman, uint16 idVendor, uint16 idProduct); + int (*remove) (USB_SEARCHMAN* searchman, UINT16 idVendor, UINT16 idProduct); /* check list has next device*/ int (*has_next) (USB_SEARCHMAN* seachman); /* get the device from list*/ @@ -71,7 +71,7 @@ struct _USB_SEARCHMAN void (*free) (USB_SEARCHMAN* searchman); }; -USB_SEARCHMAN * searchman_new(void * urbdrc, uint32 UsbDevice); +USB_SEARCHMAN * searchman_new(void * urbdrc, UINT32 UsbDevice); #endif diff --git a/channels/urbdrc/client/urbdrc_main.c b/channels/urbdrc/client/urbdrc_main.c index f3a051a74..270b7ca1d 100644 --- a/channels/urbdrc/client/urbdrc_main.c +++ b/channels/urbdrc/client/urbdrc_main.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -94,7 +94,7 @@ static void func_close_udevice(USB_SEARCHMAN* searchman, IUDEVICE* pdev) pdev->SigToEnd(pdev); idVendor = pdev->query_device_descriptor(pdev, ID_VENDOR); idProduct = pdev->query_device_descriptor(pdev, ID_PRODUCT); - searchman->add(searchman, (uint16) idVendor, (uint16) idProduct); + searchman->add(searchman, (UINT16) idVendor, (UINT16) idProduct); pdev->cancel_all_transfer_request(pdev); pdev->wait_action_completion(pdev); @@ -121,12 +121,12 @@ static int fun_device_string_send_set(char* out_data, int out_offset, char* str) while (str[i]) { - data_write_uint16(out_data + out_offset + offset, str[i]); /* str */ + data_write_UINT16(out_data + out_offset + offset, str[i]); /* str */ i++; offset += 2; } - data_write_uint16(out_data + out_offset + offset, 0x0000); /* add "\0" */ + data_write_UINT16(out_data + out_offset + offset, 0x0000); /* add "\0" */ offset += 2; return offset + out_offset; @@ -185,25 +185,25 @@ static void func_lock_isoch_mutex(TRANSFER_DATA* transfer_data) { int noAck = 0; IUDEVICE* pdev; - uint32 FunctionId; - uint32 RequestField; - uint16 URB_Function; + UINT32 FunctionId; + UINT32 RequestField; + UINT16 URB_Function; IUDEVMAN* udevman = transfer_data->udevman; if (transfer_data->cbSize >= 8) { - data_read_uint32(transfer_data->pBuffer + 4, FunctionId); + data_read_UINT32(transfer_data->pBuffer + 4, FunctionId); if ((FunctionId == TRANSFER_IN_REQUEST || FunctionId == TRANSFER_OUT_REQUEST) && transfer_data->cbSize >= 16) { - data_read_uint16(transfer_data->pBuffer + 14, URB_Function); + data_read_UINT16(transfer_data->pBuffer + 14, URB_Function); if (URB_Function == URB_FUNCTION_ISOCH_TRANSFER && transfer_data->cbSize >= 20) { - data_read_uint32(transfer_data->pBuffer + 16, RequestField); + data_read_UINT32(transfer_data->pBuffer + 16, RequestField); noAck = (RequestField & 0x80000000)>>31; if (!noAck) @@ -218,66 +218,66 @@ static void func_lock_isoch_mutex(TRANSFER_DATA* transfer_data) #endif -static int urbdrc_process_capability_request(URBDRC_CHANNEL_CALLBACK* callback, char* data, uint32 data_sizem, uint32 MessageId) +static int urbdrc_process_capability_request(URBDRC_CHANNEL_CALLBACK* callback, char* data, UINT32 data_sizem, UINT32 MessageId) { - uint32 InterfaceId; - uint32 Version; - uint32 out_size; + UINT32 InterfaceId; + UINT32 Version; + UINT32 out_size; char * out_data; LLOGLN(10, ("urbdrc_process_capability_request")); - data_read_uint32(data + 0, Version); + data_read_UINT32(data + 0, Version); InterfaceId = ((STREAM_ID_NONE<<30) | CAPABILITIES_NEGOTIATOR); out_size = 16; out_data = (char *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /* interface id */ - data_write_uint32(out_data + 4, MessageId); /* message id */ - data_write_uint32(out_data + 8, Version); /* usb protocol version */ - data_write_uint32(out_data + 12, 0x00000000); /* HRESULT */ - callback->channel->Write(callback->channel, out_size, (uint8*) out_data, NULL); + data_write_UINT32(out_data + 0, InterfaceId); /* interface id */ + data_write_UINT32(out_data + 4, MessageId); /* message id */ + data_write_UINT32(out_data + 8, Version); /* usb protocol version */ + data_write_UINT32(out_data + 12, 0x00000000); /* HRESULT */ + callback->channel->Write(callback->channel, out_size, (BYTE*) out_data, NULL); zfree(out_data); return 0; } -static int urbdrc_process_channel_create(URBDRC_CHANNEL_CALLBACK* callback, char* data, uint32 data_sizem, uint32 MessageId) +static int urbdrc_process_channel_create(URBDRC_CHANNEL_CALLBACK* callback, char* data, UINT32 data_sizem, UINT32 MessageId) { - uint32 InterfaceId; - uint32 out_size; - uint32 MajorVersion; - uint32 MinorVersion; - uint32 Capabilities; + UINT32 InterfaceId; + UINT32 out_size; + UINT32 MajorVersion; + UINT32 MinorVersion; + UINT32 Capabilities; char* out_data; LLOGLN(10, ("urbdrc_process_channel_create")); - data_read_uint32(data + 0, MajorVersion); - data_read_uint32(data + 4, MinorVersion); - data_read_uint32(data + 8, Capabilities); + data_read_UINT32(data + 0, MajorVersion); + data_read_UINT32(data + 4, MinorVersion); + data_read_UINT32(data + 8, Capabilities); InterfaceId = ((STREAM_ID_PROXY<<30) | CLIENT_CHANNEL_NOTIFICATION); out_size = 24; out_data = (char *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /* interface id */ - data_write_uint32(out_data + 4, MessageId); /* message id */ - data_write_uint32(out_data + 8, CHANNEL_CREATED); /* function id */ - data_write_uint32(out_data + 12, MajorVersion); - data_write_uint32(out_data + 16, MinorVersion); - data_write_uint32(out_data + 20, Capabilities); /* capabilities version */ - callback->channel->Write(callback->channel, out_size, (uint8 *)out_data, NULL); + data_write_UINT32(out_data + 0, InterfaceId); /* interface id */ + data_write_UINT32(out_data + 4, MessageId); /* message id */ + data_write_UINT32(out_data + 8, CHANNEL_CREATED); /* function id */ + data_write_UINT32(out_data + 12, MajorVersion); + data_write_UINT32(out_data + 16, MinorVersion); + data_write_UINT32(out_data + 20, Capabilities); /* capabilities version */ + callback->channel->Write(callback->channel, out_size, (BYTE *)out_data, NULL); zfree(out_data); return 0; } -static int urdbrc_send_virtual_channel_add(IWTSVirtualChannel* channel, uint32 MessageId) +static int urdbrc_send_virtual_channel_add(IWTSVirtualChannel* channel, UINT32 MessageId) { - uint32 out_size; - uint32 InterfaceId; + UINT32 out_size; + UINT32 InterfaceId; char* out_data; LLOGLN(10, ("urdbrc_send_virtual_channel_add")); @@ -287,11 +287,11 @@ static int urdbrc_send_virtual_channel_add(IWTSVirtualChannel* channel, uint32 M out_size = 12; out_data = (char *) malloc(out_size); memset(out_data, 0, out_size); - data_write_uint32(out_data + 0, InterfaceId); /* interface */ - data_write_uint32(out_data + 4, MessageId); /* message id */ - data_write_uint32(out_data + 8, ADD_VIRTUAL_CHANNEL); /* function id */ + data_write_UINT32(out_data + 0, InterfaceId); /* interface */ + data_write_UINT32(out_data + 4, MessageId); /* message id */ + data_write_UINT32(out_data + 8, ADD_VIRTUAL_CHANNEL); /* function id */ - channel->Write(channel, out_size, (uint8*) out_data, NULL); + channel->Write(channel, out_size, (BYTE*) out_data, NULL); zfree(out_data); return 0; @@ -300,7 +300,7 @@ static int urdbrc_send_virtual_channel_add(IWTSVirtualChannel* channel, uint32 M static int urdbrc_send_usb_device_add(URBDRC_CHANNEL_CALLBACK* callback, IUDEVICE* pdev) { char* out_data; - uint32 InterfaceId; + UINT32 InterfaceId; char HardwareIds[2][DEVICE_HARDWARE_ID_SIZE]; char CompatibilityIds[3][DEVICE_COMPATIBILITY_ID_SIZE]; char strContainerId[DEVICE_CONTAINER_STR_SIZE]; @@ -343,25 +343,25 @@ static int urdbrc_send_usb_device_add(URBDRC_CHANNEL_CALLBACK* callback, IUDEVIC out_data = (char*) malloc(size); memset(out_data, 0, size); - data_write_uint32(out_data + 0, InterfaceId); /* interface */ - data_write_uint32(out_data + 4, 0); /* message id */ - data_write_uint32(out_data + 8, ADD_DEVICE); /* function id */ - data_write_uint32(out_data + 12, 0x00000001); /* NumUsbDevice */ - data_write_uint32(out_data + 16, pdev->get_UsbDevice(pdev)); /* UsbDevice */ - data_write_uint32(out_data + 20, 0x00000025); /* cchDeviceInstanceId */ + data_write_UINT32(out_data + 0, InterfaceId); /* interface */ + data_write_UINT32(out_data + 4, 0); /* message id */ + data_write_UINT32(out_data + 8, ADD_DEVICE); /* function id */ + data_write_UINT32(out_data + 12, 0x00000001); /* NumUsbDevice */ + data_write_UINT32(out_data + 16, pdev->get_UsbDevice(pdev)); /* UsbDevice */ + data_write_UINT32(out_data + 20, 0x00000025); /* cchDeviceInstanceId */ out_offset = fun_device_string_send_set(out_data, out_offset, strInstanceId); - data_write_uint32(out_data + out_offset, 0x00000036); /* cchHwIds */ + data_write_UINT32(out_data + out_offset, 0x00000036); /* cchHwIds */ out_offset += 4; /* HardwareIds 1 */ out_offset = fun_device_string_send_set(out_data, out_offset, HardwareIds[0]); /* HardwareIds 2 */ out_offset = fun_device_string_send_set(out_data, out_offset, HardwareIds[1]); - data_write_uint16(out_data + out_offset, 0x0000); /* add "\0" */ + data_write_UINT16(out_data + out_offset, 0x0000); /* add "\0" */ out_offset += 2; - data_write_uint32(out_data + out_offset, cchCompatIds); /* cchCompatIds */ + data_write_UINT32(out_data + out_offset, cchCompatIds); /* cchCompatIds */ out_offset += 4; /* CompatibilityIds 1 */ out_offset = fun_device_string_send_set(out_data, out_offset, CompatibilityIds[0]); @@ -373,47 +373,47 @@ static int urdbrc_send_usb_device_add(URBDRC_CHANNEL_CALLBACK* callback, IUDEVIC if (pdev->isCompositeDevice(pdev)) out_offset = fun_device_string_send_set(out_data, out_offset, composite_str); - data_write_uint16(out_data + out_offset, 0x0000); /* add "\0" */ + data_write_UINT16(out_data + out_offset, 0x0000); /* add "\0" */ out_offset += 2; - data_write_uint32(out_data + out_offset, 0x00000027); /* cchContainerId */ + data_write_UINT32(out_data + out_offset, 0x00000027); /* cchContainerId */ out_offset += 4; /* ContainerId */ out_offset = fun_device_string_send_set(out_data, out_offset, strContainerId); /* USB_DEVICE_CAPABILITIES 28 bytes */ - data_write_uint32(out_data + out_offset, 0x0000001c); /* CbSize */ - data_write_uint32(out_data + out_offset + 4, 2); /* UsbBusInterfaceVersion, 0 ,1 or 2 */ - data_write_uint32(out_data + out_offset + 8, 0x600); /* USBDI_Version, 0x500 or 0x600 */ + data_write_UINT32(out_data + out_offset, 0x0000001c); /* CbSize */ + data_write_UINT32(out_data + out_offset + 4, 2); /* UsbBusInterfaceVersion, 0 ,1 or 2 */ + data_write_UINT32(out_data + out_offset + 8, 0x600); /* USBDI_Version, 0x500 or 0x600 */ /* Supported_USB_Version, 0x110,0x110 or 0x200(usb2.0) */ bcdUSB = pdev->query_device_descriptor(pdev, BCD_USB); - data_write_uint32(out_data + out_offset + 12, bcdUSB); - data_write_uint32(out_data + out_offset + 16, 0x00000000); /* HcdCapabilities, MUST always be zero */ + data_write_UINT32(out_data + out_offset + 12, bcdUSB); + data_write_UINT32(out_data + out_offset + 16, 0x00000000); /* HcdCapabilities, MUST always be zero */ if (bcdUSB < 0x200) - data_write_uint32(out_data + out_offset + 20, 0x00000000); /* DeviceIsHighSpeed */ + data_write_UINT32(out_data + out_offset + 20, 0x00000000); /* DeviceIsHighSpeed */ else - data_write_uint32(out_data + out_offset + 20, 0x00000001); /* DeviceIsHighSpeed */ + data_write_UINT32(out_data + out_offset + 20, 0x00000001); /* DeviceIsHighSpeed */ - data_write_uint32(out_data + out_offset + 24, 0x50); /* NoAckIsochWriteJitterBufferSizeInMs, >=10 or <=512 */ + data_write_UINT32(out_data + out_offset + 24, 0x50); /* NoAckIsochWriteJitterBufferSizeInMs, >=10 or <=512 */ out_offset += 28; - callback->channel->Write(callback->channel, out_offset, (uint8 *)out_data, NULL); + callback->channel->Write(callback->channel, out_offset, (BYTE *)out_data, NULL); zfree(out_data); return 0; } -static int urbdrc_exchange_capabilities(URBDRC_CHANNEL_CALLBACK* callback, char* pBuffer, uint32 cbSize) +static int urbdrc_exchange_capabilities(URBDRC_CHANNEL_CALLBACK* callback, char* pBuffer, UINT32 cbSize) { - uint32 MessageId; - uint32 FunctionId; + UINT32 MessageId; + UINT32 FunctionId; int error = 0; - data_read_uint32(pBuffer + 0, MessageId); - data_read_uint32(pBuffer + 4, FunctionId); + data_read_UINT32(pBuffer + 0, MessageId); + data_read_UINT32(pBuffer + 4, FunctionId); switch (FunctionId) { @@ -658,19 +658,19 @@ void* urbdrc_new_device_create(void * arg) IWTSVirtualChannelManager* channel_mgr; URBDRC_PLUGIN* urbdrc = transfer_data->urbdrc; USB_SEARCHMAN* searchman = urbdrc->searchman; - uint8* pBuffer = transfer_data->pBuffer; + BYTE* pBuffer = transfer_data->pBuffer; IUDEVMAN* udevman = transfer_data->udevman; IUDEVICE* pdev = NULL; - uint32 ChannelId = 0; - uint32 MessageId; - uint32 FunctionId; + UINT32 ChannelId = 0; + UINT32 MessageId; + UINT32 FunctionId; int i = 0, found = 0; channel_mgr = urbdrc->listener_callback->channel_mgr; ChannelId = channel_mgr->GetChannelId(callback->channel); - data_read_uint32(pBuffer + 0, MessageId); - data_read_uint32(pBuffer + 4, FunctionId); + data_read_UINT32(pBuffer + 0, MessageId); + data_read_UINT32(pBuffer + 4, FunctionId); int error = 0; @@ -728,15 +728,15 @@ void* urbdrc_new_device_create(void * arg) return 0; } -static int urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback, char* pBuffer, uint32 cbSize) +static int urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback, char* pBuffer, UINT32 cbSize) { int i, error = 0; - uint32 MessageId; - uint32 FunctionId; + UINT32 MessageId; + UINT32 FunctionId; URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*) callback->plugin; - data_read_uint32(pBuffer + 0, MessageId); - data_read_uint32(pBuffer + 4, FunctionId); + data_read_UINT32(pBuffer + 0, MessageId); + data_read_UINT32(pBuffer + 4, FunctionId); switch (FunctionId) { @@ -756,7 +756,7 @@ static int urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback transfer_data->udevman = urbdrc->udevman; transfer_data->urbdrc = urbdrc; transfer_data->cbSize = cbSize; - transfer_data->pBuffer = (uint8 *)malloc((cbSize)); + transfer_data->pBuffer = (BYTE *)malloc((cbSize)); for (i = 0; i < (cbSize); i++) { @@ -775,14 +775,14 @@ static int urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback return error; } -static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, uint32 cbSize, uint8* Buffer) +static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 cbSize, BYTE* Buffer) { URBDRC_CHANNEL_CALLBACK* callback = (URBDRC_CHANNEL_CALLBACK*) pChannelCallback; URBDRC_PLUGIN* urbdrc; IUDEVMAN* udevman; - uint32 InterfaceTemp; - uint32 InterfaceId; - uint32 Mask; + UINT32 InterfaceTemp; + UINT32 InterfaceId; + UINT32 Mask; int error = 0; char* pBuffer = (char*) Buffer; @@ -799,7 +799,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, udevman = (IUDEVMAN*) urbdrc->udevman; - data_read_uint32(pBuffer + 0, InterfaceTemp); + data_read_UINT32(pBuffer + 0, InterfaceTemp); InterfaceId = (InterfaceTemp & 0x0fffffff); Mask = ((InterfaceTemp & 0xf0000000)>>30); LLOGLN(10, ("urbdrc_on_data_received: Size=%d InterfaceId=0x%X Mask=0x%X", cbSize, InterfaceId, Mask)); @@ -829,7 +829,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, transfer_data->udevman = udevman; transfer_data->cbSize = cbSize - 4; transfer_data->UsbDevice = InterfaceId; - transfer_data->pBuffer = (uint8 *)malloc((cbSize - 4)); + transfer_data->pBuffer = (BYTE *)malloc((cbSize - 4)); memcpy(transfer_data->pBuffer, pBuffer + 4, (cbSize - 4)); @@ -861,7 +861,7 @@ static int urbdrc_on_close(IWTSVirtualChannelCallback * pChannelCallback) IUDEVMAN* udevman = (IUDEVMAN*) urbdrc->udevman; USB_SEARCHMAN* searchman = (USB_SEARCHMAN*) urbdrc->searchman; IUDEVICE* pdev = NULL; - uint32 ChannelId = 0; + UINT32 ChannelId = 0; int found = 0; ChannelId = callback->channel_mgr->GetChannelId(callback->channel); @@ -898,7 +898,7 @@ static int urbdrc_on_close(IWTSVirtualChannelCallback * pChannelCallback) } static int urbdrc_on_new_channel_connection(IWTSListenerCallback* pListenerCallback, - IWTSVirtualChannel * pChannel, uint8* pData, int* pbAccept, IWTSVirtualChannelCallback** ppCallback) + IWTSVirtualChannel * pChannel, BYTE* pData, int* pbAccept, IWTSVirtualChannelCallback** ppCallback) { URBDRC_LISTENER_CALLBACK* listener_callback = (URBDRC_LISTENER_CALLBACK*) pListenerCallback; URBDRC_CHANNEL_CALLBACK* callback; @@ -1010,11 +1010,11 @@ static int urbdrc_load_udevman_plugin(IWTSPlugin* pPlugin, const char* name, RDP strcpy(fullname, name); strcat(fullname, "_udevman"); entry = (PFREERDP_URBDRC_DEVICE_ENTRY) freerdp_load_plugin(fullname, URBDRC_UDEVMAN_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) - return false; + return FALSE; entryPoints.plugin = pPlugin; entryPoints.pRegisterUDEVMAN = urbdrc_register_udevman_plugin; @@ -1023,15 +1023,15 @@ static int urbdrc_load_udevman_plugin(IWTSPlugin* pPlugin, const char* name, RDP if (entry(&entryPoints) != 0) { DEBUG_WARN("%s entry returns error.", name); - return false; + return FALSE; } - return true; + return TRUE; } static int urbdrc_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data) { - boolean ret; + BOOL ret; if (data->data[0] && (strcmp((char*)data->data[0], "urbdrc") == 0 || strstr((char*) data->data[0], "/urbdrc.") != NULL)) { @@ -1039,7 +1039,7 @@ static int urbdrc_process_plugin_data(IWTSPlugin* pPlugin, RDP_PLUGIN_DATA* data return ret; } - return true; + return TRUE; } int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) diff --git a/channels/urbdrc/client/urbdrc_main.h b/channels/urbdrc/client/urbdrc_main.h index ff71869be..5e85306e6 100644 --- a/channels/urbdrc/client/urbdrc_main.h +++ b/channels/urbdrc/client/urbdrc_main.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -72,8 +72,8 @@ struct _URBDRC_PLUGIN IUDEVMAN* udevman; USB_SEARCHMAN* searchman; - uint32 first_channel_id; - uint32 vchannel_status; + UINT32 first_channel_id; + UINT32 vchannel_status; }; #define URBDRC_UDEVMAN_EXPORT_FUNC_NAME "FreeRDPUDEVMANEntry" @@ -98,76 +98,76 @@ struct _TRANSFER_DATA URBDRC_CHANNEL_CALLBACK* callback; URBDRC_PLUGIN* urbdrc; IUDEVMAN* udevman; - uint8* pBuffer; - uint32 cbSize; - uint32 UsbDevice; + BYTE* pBuffer; + UINT32 cbSize; + UINT32 UsbDevice; }; struct _IUDEVICE { /* Transfer */ - int (*isoch_transfer) (IUDEVICE * idev, uint32 RequestId, - uint32 EndpointAddress, - uint32 TransferFlags, + int (*isoch_transfer) (IUDEVICE * idev, UINT32 RequestId, + UINT32 EndpointAddress, + UINT32 TransferFlags, int NoAck, - uint32 *ErrorCount, - uint32 *UrbdStatus, - uint32 *StartFrame, - uint32 NumberOfPackets, - uint8 *IsoPacket, - uint32 *BufferSize, - uint8 *Buffer, + UINT32 *ErrorCount, + UINT32 *UrbdStatus, + UINT32 *StartFrame, + UINT32 NumberOfPackets, + BYTE *IsoPacket, + UINT32 *BufferSize, + BYTE *Buffer, int Timeout); - int (*control_transfer) (IUDEVICE * idev, uint32 RequestId, - uint32 EndpointAddress, - uint32 TransferFlags, - uint8 bmRequestType, - uint8 Request, - uint16 Value, - uint16 Index, - uint32 *UrbdStatus, - uint32 *BufferSize, - uint8 *Buffer, - uint32 Timeout); + int (*control_transfer) (IUDEVICE * idev, UINT32 RequestId, + UINT32 EndpointAddress, + UINT32 TransferFlags, + BYTE bmRequestType, + BYTE Request, + UINT16 Value, + UINT16 Index, + UINT32 *UrbdStatus, + UINT32 *BufferSize, + BYTE *Buffer, + UINT32 Timeout); - int (*bulk_or_interrupt_transfer) (IUDEVICE * idev, uint32 RequestId, - uint32 EndpointAddress, - uint32 TransferFlags, - uint32 *UsbdStatus, - uint32 *BufferSize, - uint8 *Buffer, - uint32 Timeout); + int (*bulk_or_interrupt_transfer) (IUDEVICE * idev, UINT32 RequestId, + UINT32 EndpointAddress, + UINT32 TransferFlags, + UINT32 *UsbdStatus, + UINT32 *BufferSize, + BYTE *Buffer, + UINT32 Timeout); - int (*select_configuration) (IUDEVICE * idev, uint32 bConfigurationValue); + int (*select_configuration) (IUDEVICE * idev, UINT32 bConfigurationValue); - int (*select_interface) (IUDEVICE * idev, uint8 InterfaceNumber, - uint8 AlternateSetting); + int (*select_interface) (IUDEVICE * idev, BYTE InterfaceNumber, + BYTE AlternateSetting); - int (*control_pipe_request) (IUDEVICE * idev, uint32 RequestId, - uint32 EndpointAddress, - uint32 *UsbdStatus, + int (*control_pipe_request) (IUDEVICE * idev, UINT32 RequestId, + UINT32 EndpointAddress, + UINT32 *UsbdStatus, int command); - int (*control_query_device_text) (IUDEVICE * idev, uint32 TextType, - uint32 LocaleId, - uint32 *BufferSize, - uint8 * Buffer); + int (*control_query_device_text) (IUDEVICE * idev, UINT32 TextType, + UINT32 LocaleId, + UINT32 *BufferSize, + BYTE * Buffer); - int (*os_feature_descriptor_request) (IUDEVICE * idev, uint32 RequestId, - uint8 Recipient, - uint8 InterfaceNumber, - uint8 Ms_PageIndex, - uint16 Ms_featureDescIndex, - uint32 * UsbdStatus, - uint32 * BufferSize, - uint8* Buffer, + int (*os_feature_descriptor_request) (IUDEVICE * idev, UINT32 RequestId, + BYTE Recipient, + BYTE InterfaceNumber, + BYTE Ms_PageIndex, + UINT16 Ms_featureDescIndex, + UINT32 * UsbdStatus, + UINT32 * BufferSize, + BYTE* Buffer, int Timeout); void (*cancel_all_transfer_request) (IUDEVICE * idev); - int (*cancel_transfer_request) (IUDEVICE * idev, uint32 RequestId); + int (*cancel_transfer_request) (IUDEVICE * idev, UINT32 RequestId); int (*query_device_descriptor) (IUDEVICE * idev, int offset); @@ -189,9 +189,9 @@ struct _IUDEVICE void (*lock_fifo_isoch) (IUDEVICE * idev); void (*unlock_fifo_isoch) (IUDEVICE * idev); - int (*query_device_port_status) (IUDEVICE * idev, uint32 *UsbdStatus, - uint32 * BufferSize, - uint8 * Buffer); + int (*query_device_port_status) (IUDEVICE * idev, UINT32 *UsbdStatus, + UINT32 * BufferSize, + BYTE * Buffer); int (*request_queue_is_none) (IUDEVICE * idev); @@ -208,11 +208,11 @@ struct _IUDEVICE void (*setChannelClosed) (IUDEVICE * idev); char *(*getPath) (IUDEVICE * idev); - BASIC_DEV_STATE_DEFINED(channel_id, uint32); - BASIC_DEV_STATE_DEFINED(UsbDevice, uint32); - BASIC_DEV_STATE_DEFINED(ReqCompletion, uint32); - BASIC_DEV_STATE_DEFINED(bus_number, uint16); - BASIC_DEV_STATE_DEFINED(dev_number, uint16); + BASIC_DEV_STATE_DEFINED(channel_id, UINT32); + BASIC_DEV_STATE_DEFINED(UsbDevice, UINT32); + BASIC_DEV_STATE_DEFINED(ReqCompletion, UINT32); + BASIC_DEV_STATE_DEFINED(bus_number, UINT16); + BASIC_DEV_STATE_DEFINED(dev_number, UINT16); BASIC_DEV_STATE_DEFINED(port_number, int); BASIC_DEV_STATE_DEFINED(isoch_queue, void *); BASIC_DEV_STATE_DEFINED(MsConfig, MSUSB_CONFIG_DESCRIPTOR *); @@ -237,20 +237,20 @@ struct _IUDEVMAN int (*register_udevice) (IUDEVMAN* idevman, int bus_number, int dev_number, int UsbDevice, - uint16 idVendor, - uint16 idProduct, + UINT16 idVendor, + UINT16 idProduct, int flag); IUDEVICE *(*get_next) (IUDEVMAN *idevman); IUDEVICE *(*get_udevice_by_UsbDevice) (IUDEVMAN * idevman, - uint32 UsbDevice); + UINT32 UsbDevice); IUDEVICE *(*get_udevice_by_UsbDevice_try_again) (IUDEVMAN * idevman, - uint32 UsbDevice); + UINT32 UsbDevice); /* Extension */ - int (*check_device_exist_by_id) (IUDEVMAN * idevman, uint16 idVendor, - uint16 idProduct); + int (*check_device_exist_by_id) (IUDEVMAN * idevman, UINT16 idVendor, + UINT16 idProduct); int (*isAutoAdd) (IUDEVMAN * idevman); /* Basic state */ - BASIC_DEVMAN_STATE_DEFINED(defUsbDevice, uint32); + BASIC_DEVMAN_STATE_DEFINED(defUsbDevice, UINT32); BASIC_DEVMAN_STATE_DEFINED(device_num, int); BASIC_DEVMAN_STATE_DEFINED(sem_timeout, int); /* control semaphore or mutex lock */ diff --git a/channels/urbdrc/client/urbdrc_types.h b/channels/urbdrc/client/urbdrc_types.h index b392b9ddd..485595004 100644 --- a/channels/urbdrc/client/urbdrc_types.h +++ b/channels/urbdrc/client/urbdrc_types.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. diff --git a/channels/urbdrc/libusb/CMakeLists.txt b/channels/urbdrc/libusb/CMakeLists.txt index cd874c1c7..18d14ec8e 100644 --- a/channels/urbdrc/libusb/CMakeLists.txt +++ b/channels/urbdrc/libusb/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP cmake build script # # Copyright 2012 Atrust corp. diff --git a/channels/urbdrc/libusb/libusb_udevice.c b/channels/urbdrc/libusb/libusb_udevice.c index 81a7cd546..894cd5a2a 100644 --- a/channels/urbdrc/libusb/libusb_udevice.c +++ b/channels/urbdrc/libusb/libusb_udevice.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -58,13 +58,13 @@ static void udev_set_p_##_arg (IUDEVICE * idev, _type _t) \ typedef struct _ISO_USER_DATA ISO_USER_DATA; struct _ISO_USER_DATA { - uint8 * IsoPacket; - uint8 * output_data; + BYTE * IsoPacket; + BYTE * output_data; int iso_status; int completed; - uint32 error_count; + UINT32 error_count; int noack; - uint32 start_frame; + UINT32 start_frame; }; static int @@ -153,12 +153,12 @@ static void func_iso_callback(struct libusb_transfer *transfer) { ISO_USER_DATA * iso_user_data = (ISO_USER_DATA *) transfer->user_data; - uint8 * data = iso_user_data->IsoPacket; + BYTE * data = iso_user_data->IsoPacket; int * completed = &iso_user_data->completed; - uint32 offset = 0; - uint32 index = 0; - uint32 i, act_len; - uint8 *b; + UINT32 offset = 0; + UINT32 index = 0; + UINT32 i, act_len; + BYTE *b; *completed = 1; /* Fixme: currently fill the dummy frame number, tt needs to be @@ -170,9 +170,9 @@ func_iso_callback(struct libusb_transfer *transfer) for (i = 0; i < transfer->num_iso_packets; i++) { act_len = transfer->iso_packet_desc[i].actual_length; - data_write_uint32(data + offset, index); - data_write_uint32(data + offset + 4, act_len); - data_write_uint32(data + offset + 8, + data_write_UINT32(data + offset, index); + data_write_UINT32(data + offset + 4, act_len); + data_write_UINT32(data + offset + 8, transfer->iso_packet_desc[i].status); offset += 12; if (transfer->iso_packet_desc[i].status == USBD_STATUS_SUCCESS) @@ -215,12 +215,12 @@ func_iso_callback(struct libusb_transfer *transfer) static const LIBUSB_ENDPOINT_DESCEIPTOR* func_get_ep_desc(LIBUSB_CONFIG_DESCRIPTOR * LibusbConfig, MSUSB_CONFIG_DESCRIPTOR * MsConfig, - uint32 EndpointAddress) + UINT32 EndpointAddress) { MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces; const LIBUSB_INTERFACE * interface; const LIBUSB_ENDPOINT_DESCEIPTOR * endpoint; - uint8 alt; + BYTE alt; int inum, pnum; MsInterfaces = MsConfig->MsInterfaces; @@ -255,7 +255,7 @@ func_bulk_transfer_cb(struct libusb_transfer *transfer) static int -func_set_usbd_status(UDEVICE* pdev, uint32* status, int err_result) +func_set_usbd_status(UDEVICE* pdev, UINT32* status, int err_result) { switch (err_result) { @@ -319,8 +319,8 @@ func_set_usbd_status(UDEVICE* pdev, uint32* status, int err_result) static void -func_iso_data_init(ISO_USER_DATA * iso_user_data, uint32 numPacket, uint32 buffsize, - uint32 noAck, uint8 * isoPacket, uint8 * buffer) +func_iso_data_init(ISO_USER_DATA * iso_user_data, UINT32 numPacket, UINT32 buffsize, + UINT32 noAck, BYTE * isoPacket, BYTE * buffer) { /* init struct iso_user_data */ iso_user_data->IsoPacket = isoPacket; @@ -334,7 +334,7 @@ func_iso_data_init(ISO_USER_DATA * iso_user_data, uint32 numPacket, uint32 buffs static int -func_config_release_all_interface(LIBUSB_DEVICE_HANDLE *libusb_handle, uint32_t NumInterfaces) +func_config_release_all_interface(LIBUSB_DEVICE_HANDLE *libusb_handle, UINT32_t NumInterfaces) { int i, ret; for (i = 0; i < NumInterfaces; i++) @@ -478,7 +478,7 @@ udev_new_descript(LIBUSB_DEVICE* libusb_dev) /* Get HUB handle */ static int -udev_get_hub_handle(UDEVICE * pdev, uint16 bus_number, uint16 dev_number) +udev_get_hub_handle(UDEVICE * pdev, UINT16 bus_number, UINT16 dev_number) { struct udev *udev; struct udev_enumerate *enumerate; @@ -590,7 +590,7 @@ udev_get_hub_handle(UDEVICE * pdev, uint16 bus_number, uint16 dev_number) static int -libusb_udev_select_interface(IUDEVICE * idev, uint8 InterfaceNumber, uint8 AlternateSetting) +libusb_udev_select_interface(IUDEVICE * idev, BYTE InterfaceNumber, BYTE AlternateSetting) { MSUSB_CONFIG_DESCRIPTOR * MsConfig; MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces; @@ -638,7 +638,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE * idev, MSUSB_CONFIG_DESCRIPTOR * M const LIBUSB_INTERFACE * LibusbInterface; const LIBUSB_INTERFACE_DESCRIPTOR * LibusbAltsetting; const LIBUSB_ENDPOINT_DESCEIPTOR * LibusbEndpoint; - uint8 LibusbNumEndpoint; + BYTE LibusbNumEndpoint; int inum = 0, pnum = 0, MsOutSize = 0; LibusbConfig = pdev->LibusbConfig; @@ -746,7 +746,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE * idev, MSUSB_CONFIG_DESCRIPTOR * M | (pdev->bus_number << 24); /* count endpoint max packet size */ int max = LibusbEndpoint->wMaxPacketSize & 0x07ff; - uint8 attr = LibusbEndpoint->bmAttributes; + BYTE attr = LibusbEndpoint->bmAttributes; if ((attr & 0x3) == 1 || (attr & 0x3) == 3) { max *= (1 + ((LibusbEndpoint->wMaxPacketSize >> 11) & 3)); @@ -774,7 +774,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE * idev, MSUSB_CONFIG_DESCRIPTOR * M static int -libusb_udev_select_configuration(IUDEVICE * idev, uint32 bConfigurationValue) +libusb_udev_select_configuration(IUDEVICE * idev, UINT32 bConfigurationValue) { UDEVICE * pdev = (UDEVICE *) idev; MSUSB_CONFIG_DESCRIPTOR * MsConfig = pdev->MsConfig; @@ -815,9 +815,9 @@ libusb_udev_select_configuration(IUDEVICE * idev, uint32 bConfigurationValue) static int -libusb_udev_control_pipe_request(IUDEVICE * idev, uint32 RequestId, - uint32 EndpointAddress, - uint32 *UsbdStatus, +libusb_udev_control_pipe_request(IUDEVICE * idev, UINT32 RequestId, + UINT32 EndpointAddress, + UINT32 *UsbdStatus, int command) { UDEVICE * pdev = (UDEVICE *) idev; @@ -863,17 +863,17 @@ libusb_udev_control_pipe_request(IUDEVICE * idev, uint32 RequestId, static int -libusb_udev_control_query_device_text(IUDEVICE * idev, uint32 TextType, - uint32 LocaleId, - uint32 * BufferSize, - uint8 * Buffer) +libusb_udev_control_query_device_text(IUDEVICE * idev, UINT32 TextType, + UINT32 LocaleId, + UINT32 * BufferSize, + BYTE * Buffer) { UDEVICE * pdev = (UDEVICE *) idev; LIBUSB_DEVICE_DESCRIPTOR * devDescriptor = pdev->devDescriptor; char * strDesc = "Generic Usb String"; char deviceLocation[25]; - uint8 bus_number; - uint8 device_address; + BYTE bus_number; + BYTE device_address; int ret = 0, i = 0; switch (TextType){ @@ -914,7 +914,7 @@ libusb_udev_control_query_device_text(IUDEVICE * idev, uint32 TextType, sprintf(deviceLocation, "Port_#%04d.Hub_#%04d", device_address, bus_number); for(i=0;irequest_queue->register_request(pdev->request_queue, RequestId, NULL, 0); @@ -957,8 +957,8 @@ libusb_udev_os_feature_descriptor_request(IUDEVICE * idev, uint32 RequestId, //printf("Get ms string: result number %d", error); if (error > 0) { - uint8 bMS_Vendorcode; - data_read_uint8(ms_string_desc + 16, bMS_Vendorcode); + BYTE bMS_Vendorcode; + data_read_BYTE(ms_string_desc + 16, bMS_Vendorcode); //printf("bMS_Vendorcode:0x%x", bMS_Vendorcode); /** get os descriptor */ error = libusb_control_transfer(pdev->libusb_handle, @@ -1203,9 +1203,9 @@ libusb_udev_unlock_fifo_isoch(IUDEVICE * idev) static int -libusb_udev_query_device_port_status(IUDEVICE * idev, uint32 *UsbdStatus, - uint32 * BufferSize, - uint8 * Buffer) +libusb_udev_query_device_port_status(IUDEVICE * idev, UINT32 *UsbdStatus, + UINT32 * BufferSize, + BYTE * Buffer) { UDEVICE * pdev = (UDEVICE *) idev; int success = 0, ret; @@ -1249,22 +1249,22 @@ libusb_udev_request_queue_is_none(IUDEVICE * idev) static int -libusb_udev_isoch_transfer(IUDEVICE * idev, uint32 RequestId, uint32 EndpointAddress, - uint32 TransferFlags, +libusb_udev_isoch_transfer(IUDEVICE * idev, UINT32 RequestId, UINT32 EndpointAddress, + UINT32 TransferFlags, int NoAck, - uint32 *ErrorCount, - uint32 *UrbdStatus, - uint32 *StartFrame, - uint32 NumberOfPackets, - uint8 *IsoPacket, - uint32 *BufferSize, - uint8 *Buffer, + UINT32 *ErrorCount, + UINT32 *UrbdStatus, + UINT32 *StartFrame, + UINT32 NumberOfPackets, + BYTE *IsoPacket, + UINT32 *BufferSize, + BYTE *Buffer, int Timeout) { UDEVICE * pdev = (UDEVICE *) idev; ISO_USER_DATA iso_user_data; struct libusb_transfer * iso_transfer = NULL; - uint32 iso_packet_size; + UINT32 iso_packet_size; int error = 0, ret = 0, submit = 0; @@ -1344,16 +1344,16 @@ libusb_udev_isoch_transfer(IUDEVICE * idev, uint32 RequestId, uint32 EndpointAdd static int -libusb_udev_control_transfer(IUDEVICE * idev, uint32 RequestId, uint32 EndpointAddress, - uint32 TransferFlags, - uint8 bmRequestType, - uint8 Request, - uint16 Value, - uint16 Index, - uint32 *UrbdStatus, - uint32 *BufferSize, - uint8 *Buffer, - uint32 Timeout) +libusb_udev_control_transfer(IUDEVICE * idev, UINT32 RequestId, UINT32 EndpointAddress, + UINT32 TransferFlags, + BYTE bmRequestType, + BYTE Request, + UINT16 Value, + UINT16 Index, + UINT32 *UrbdStatus, + UINT32 *BufferSize, + BYTE *Buffer, + UINT32 Timeout) { UDEVICE * pdev = (UDEVICE *) idev; int error = 0; @@ -1381,19 +1381,19 @@ libusb_udev_control_transfer(IUDEVICE * idev, uint32 RequestId, uint32 EndpointA static int -libusb_udev_bulk_or_interrupt_transfer(IUDEVICE * idev, uint32 RequestId, - uint32 EndpointAddress, - uint32 TransferFlags, - uint32 *UsbdStatus, - uint32 *BufferSize, - uint8 *Buffer, - uint32 Timeout) +libusb_udev_bulk_or_interrupt_transfer(IUDEVICE * idev, UINT32 RequestId, + UINT32 EndpointAddress, + UINT32 TransferFlags, + UINT32 *UsbdStatus, + UINT32 *BufferSize, + BYTE *Buffer, + UINT32 Timeout) { UDEVICE * pdev = (UDEVICE *) idev; const LIBUSB_ENDPOINT_DESCEIPTOR * ep_desc; struct libusb_transfer * transfer = NULL; TRANSFER_REQUEST * request = NULL; - uint32 transfer_type; + UINT32 transfer_type; int completed = 0, ret = 0, submit = 0; int transferDir = EndpointAddress & 0x80; @@ -1601,7 +1601,7 @@ func_cancel_xact_request(TRANSFER_REQUEST *request) static int -libusb_udev_cancel_transfer_request(IUDEVICE * idev, uint32 RequestId) +libusb_udev_cancel_transfer_request(IUDEVICE * idev, UINT32 RequestId) { UDEVICE * pdev = (UDEVICE *) idev; REQUEST_QUEUE * request_queue = pdev->request_queue; @@ -1644,11 +1644,11 @@ cancel_retry: return 0; } -BASIC_STATE_FUNC_DEFINED(channel_id, uint32) -BASIC_STATE_FUNC_DEFINED(UsbDevice, uint32) -BASIC_STATE_FUNC_DEFINED(ReqCompletion, uint32) -BASIC_STATE_FUNC_DEFINED(bus_number, uint16) -BASIC_STATE_FUNC_DEFINED(dev_number, uint16) +BASIC_STATE_FUNC_DEFINED(channel_id, UINT32) +BASIC_STATE_FUNC_DEFINED(UsbDevice, UINT32) +BASIC_STATE_FUNC_DEFINED(ReqCompletion, UINT32) +BASIC_STATE_FUNC_DEFINED(bus_number, UINT16) +BASIC_STATE_FUNC_DEFINED(dev_number, UINT16) BASIC_STATE_FUNC_DEFINED(port_number, int) BASIC_STATE_FUNC_DEFINED(isoch_queue, void *) BASIC_STATE_FUNC_DEFINED(MsConfig, MSUSB_CONFIG_DESCRIPTOR *) @@ -1718,7 +1718,7 @@ udev_load_interface(UDEVICE * pdev) static IUDEVICE* -udev_init(UDEVICE* pdev, uint16 bus_number, uint16 dev_number) +udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number) { LIBUSB_DEVICE_DESCRIPTOR* devDescriptor; LIBUSB_CONFIG_DESCRIPTOR* config_temp; @@ -1829,13 +1829,13 @@ udev_init(UDEVICE* pdev, uint16 bus_number, uint16 dev_number) int -udev_new_by_id(uint16 idVendor, uint16 idProduct, IUDEVICE *** devArray) +udev_new_by_id(UINT16 idVendor, UINT16 idProduct, IUDEVICE *** devArray) { LIBUSB_DEVICE_DESCRIPTOR * descriptor; LIBUSB_DEVICE ** libusb_list; UDEVICE ** array; - uint16 bus_number; - uint16 dev_number; + UINT16 bus_number; + UINT16 dev_number; ssize_t total_device; int i, ret, num = 0; diff --git a/channels/urbdrc/libusb/libusb_udevice.h b/channels/urbdrc/libusb/libusb_udevice.h index e75dc18f1..5bf8ad529 100644 --- a/channels/urbdrc/libusb/libusb_udevice.h +++ b/channels/urbdrc/libusb/libusb_udevice.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -49,12 +49,12 @@ struct _UDEVICE void * prev; void * next; - uint32 UsbDevice; /* An unique interface ID */ - uint32 ReqCompletion; /* An unique interface ID */ - uint32 channel_id; - uint16 status; - uint16 bus_number; - uint16 dev_number; + UINT32 UsbDevice; /* An unique interface ID */ + UINT32 ReqCompletion; /* An unique interface ID */ + UINT32 channel_id; + UINT16 status; + UINT16 bus_number; + UINT16 dev_number; char path[17]; int port_number; int isCompositeDevice; @@ -77,7 +77,7 @@ typedef UDEVICE * PUDEVICE; int -udev_new_by_id(uint16_t idVendor, uint16_t idProduct, IUDEVICE ***devArray); +udev_new_by_id(UINT16_t idVendor, UINT16_t idProduct, IUDEVICE ***devArray); IUDEVICE* udev_new_by_addr(int bus_number, int dev_number); diff --git a/channels/urbdrc/libusb/libusb_udevman.c b/channels/urbdrc/libusb/libusb_udevman.c index 5e31fb66a..eafb72f43 100644 --- a/channels/urbdrc/libusb/libusb_udevman.c +++ b/channels/urbdrc/libusb/libusb_udevman.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -55,8 +55,8 @@ struct _UDEVMAN IUDEVICE* head; /* head device in linked list */ IUDEVICE* tail; /* tail device in linked list */ - uint32 defUsbDevice; - uint16 flags; + UINT32 defUsbDevice; + UINT16 flags; int device_num; int sem_timeout; @@ -125,8 +125,8 @@ udevman_get_udevice_by_addr(IUDEVMAN * idevman, int bus_number, int dev_number) static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_number, int UsbDevice, - uint16 idVendor, - uint16 idProduct, + UINT16 idVendor, + UINT16 idProduct, int flag) { UDEVMAN * udevman = (UDEVMAN *) idevman; @@ -324,7 +324,7 @@ udevman_parse_device_pid_vid (char *str, int *id1, int *id2, char sign) static int -udevman_check_device_exist_by_id(IUDEVMAN * idevman, uint16 idVendor, uint16 idProduct) +udevman_check_device_exist_by_id(IUDEVMAN * idevman, UINT16 idVendor, UINT16 idProduct) { if (libusb_open_device_with_vid_pid (NULL, idVendor, idProduct)) return 1; @@ -342,7 +342,7 @@ udevman_is_auto_add(IUDEVMAN * idevman) static IUDEVICE* -udevman_get_udevice_by_UsbDevice_try_again(IUDEVMAN * idevman, uint32 UsbDevice) +udevman_get_udevice_by_UsbDevice_try_again(IUDEVMAN * idevman, UINT32 UsbDevice) { UDEVICE * pdev; idevman->loading_lock(idevman); @@ -361,7 +361,7 @@ udevman_get_udevice_by_UsbDevice_try_again(IUDEVMAN * idevman, uint32 UsbDevice) } static IUDEVICE* -udevman_get_udevice_by_UsbDevice(IUDEVMAN * idevman, uint32 UsbDevice) +udevman_get_udevice_by_UsbDevice(IUDEVMAN * idevman, UINT32 UsbDevice) { UDEVICE * pdev; idevman->loading_lock(idevman); @@ -420,7 +420,7 @@ udevman_push_urb(IUDEVMAN * idevman) } -BASIC_STATE_FUNC_DEFINED(defUsbDevice, uint32) +BASIC_STATE_FUNC_DEFINED(defUsbDevice, UINT32) BASIC_STATE_FUNC_DEFINED(device_num, int) BASIC_STATE_FUNC_DEFINED(sem_timeout, int) @@ -474,7 +474,7 @@ int FreeRDPUDEVMANEntry(PFREERDP_URBDRC_SERVICE_ENTRY_POINTS pEntryPoints) { UDEVMAN* udevman; RDP_PLUGIN_DATA * plugin_data = pEntryPoints->plugin_data; - uint32 UsbDevice = BASE_USBDEVICE_NUM; + UINT32 UsbDevice = BASE_USBDEVICE_NUM; char * token; char * message = "id"; char hardware_id[16]; @@ -537,8 +537,8 @@ int FreeRDPUDEVMANEntry(PFREERDP_URBDRC_SERVICE_ENTRY_POINTS pEntryPoints) 0, 0, UsbDevice, - (uint16) idVendor, - (uint16) idProduct, + (UINT16) idVendor, + (UINT16) idProduct, UDEVMAN_FLAG_ADD_BY_VID_PID); } else if (udevman->flags & UDEVMAN_FLAG_ADD_BY_ADDR) diff --git a/channels/urbdrc/libusb/request_queue.c b/channels/urbdrc/libusb/request_queue.c index e7f897864..6a560156a 100644 --- a/channels/urbdrc/libusb/request_queue.c +++ b/channels/urbdrc/libusb/request_queue.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -48,9 +48,9 @@ request_queue_has_next(REQUEST_QUEUE* queue) } TRANSFER_REQUEST* -request_queue_register_request(REQUEST_QUEUE* queue, uint32 RequestId, +request_queue_register_request(REQUEST_QUEUE* queue, UINT32 RequestId, struct libusb_transfer * transfer, - uint8 endpoint) + BYTE endpoint) { TRANSFER_REQUEST* request; @@ -90,7 +90,7 @@ request_queue_rewind(REQUEST_QUEUE *queue) /* Get first*/ TRANSFER_REQUEST* -request_queue_get_request_by_endpoint(REQUEST_QUEUE *queue, uint8 ep) +request_queue_get_request_by_endpoint(REQUEST_QUEUE *queue, BYTE ep) { TRANSFER_REQUEST * request; pthread_mutex_lock(&queue->request_loading); @@ -110,7 +110,7 @@ request_queue_get_request_by_endpoint(REQUEST_QUEUE *queue, uint8 ep) } int -request_queue_unregister_request(REQUEST_QUEUE *queue, uint32 RequestId) +request_queue_unregister_request(REQUEST_QUEUE *queue, UINT32 RequestId) { TRANSFER_REQUEST *request, *request_temp; pthread_mutex_lock(&queue->request_loading); diff --git a/channels/urbdrc/libusb/request_queue.h b/channels/urbdrc/libusb/request_queue.h index 0ea275263..74fcf1169 100644 --- a/channels/urbdrc/libusb/request_queue.h +++ b/channels/urbdrc/libusb/request_queue.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -32,8 +32,8 @@ struct _TRANSFER_REQUEST void* prev; void* next; - uint32 RequestId; - uint8 endpoint; + UINT32 RequestId; + BYTE endpoint; struct libusb_transfer *transfer; int submit; }; @@ -51,11 +51,11 @@ struct _REQUEST_QUEUE /* request queue manager service */ void (*rewind) (REQUEST_QUEUE *queue); int (*has_next) (REQUEST_QUEUE* queue); - int (*unregister_request) (REQUEST_QUEUE *queue, uint32 RequestId); + int (*unregister_request) (REQUEST_QUEUE *queue, UINT32 RequestId); TRANSFER_REQUEST *(*get_next) (REQUEST_QUEUE* queue); - TRANSFER_REQUEST *(*get_request_by_ep) (REQUEST_QUEUE *queue, uint8 ep); + TRANSFER_REQUEST *(*get_request_by_ep) (REQUEST_QUEUE *queue, BYTE ep); TRANSFER_REQUEST *(*register_request) (REQUEST_QUEUE* queue, - uint32 RequestId, struct libusb_transfer * transfer, uint8 endpoint); + UINT32 RequestId, struct libusb_transfer * transfer, BYTE endpoint); }; diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 98afbbe4c..2812495b3 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP Client User Interfaces # # Copyright 2012 Marc-Andre Moreau diff --git a/client/DirectFB/CMakeLists.txt b/client/DirectFB/CMakeLists.txt index 287176422..e5975cd9f 100644 --- a/client/DirectFB/CMakeLists.txt +++ b/client/DirectFB/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP DirectFB Client # # Copyright 2012 Marc-Andre Moreau @@ -31,8 +31,9 @@ set(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set(${MODULE_PREFIX}_LIBS ${DIRECTFB_LIBRARIES}) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-channels-client) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} diff --git a/client/DirectFB/df_event.c b/client/DirectFB/df_event.c index 4c2e8f2ec..68d8d72cd 100644 --- a/client/DirectFB/df_event.c +++ b/client/DirectFB/df_event.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * DirectFB Event Handling * * Copyright 2011 Marc-Andre Moreau @@ -21,8 +21,8 @@ #include "df_event.h" -static uint8 keymap[256]; -static uint8 functionmap[128]; +static BYTE keymap[256]; +static BYTE functionmap[128]; void df_keyboard_init() { @@ -154,9 +154,9 @@ void df_keyboard_init() } -void df_send_mouse_button_event(rdpInput* input, boolean down, uint32 button, uint16 x, uint16 y) +void df_send_mouse_button_event(rdpInput* input, BOOL down, UINT32 button, UINT16 x, UINT16 y) { - uint16 flags; + UINT16 flags; flags = (down) ? PTR_FLAGS_DOWN : 0; @@ -171,14 +171,14 @@ void df_send_mouse_button_event(rdpInput* input, boolean down, uint32 button, ui input->MouseEvent(input, flags, x, y); } -void df_send_mouse_motion_event(rdpInput* input, uint16 x, uint16 y) +void df_send_mouse_motion_event(rdpInput* input, UINT16 x, UINT16 y) { input->MouseEvent(input, PTR_FLAGS_MOVE, x, y); } -void df_send_mouse_wheel_event(rdpInput* input, sint16 axisrel, uint16 x, uint16 y) +void df_send_mouse_wheel_event(rdpInput* input, INT16 axisrel, UINT16 x, UINT16 y) { - uint16 flags = PTR_FLAGS_WHEEL; + UINT16 flags = PTR_FLAGS_WHEEL; if (axisrel < 0) flags |= 0x0078; @@ -188,9 +188,9 @@ void df_send_mouse_wheel_event(rdpInput* input, sint16 axisrel, uint16 x, uint16 input->MouseEvent(input, flags, x, y); } -void df_send_keyboard_event(rdpInput* input, boolean down, uint8 keycode, uint8 function) +void df_send_keyboard_event(rdpInput* input, BOOL down, BYTE keycode, BYTE function) { - uint8 vkcode; + BYTE vkcode; RDP_SCANCODE rdp_scancode; if (keycode) @@ -205,7 +205,7 @@ void df_send_keyboard_event(rdpInput* input, boolean down, uint8 keycode, uint8 freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode); } -boolean df_event_process(freerdp* instance, DFBEvent* event) +BOOL df_event_process(freerdp* instance, DFBEvent* event) { int flags; rdpGdi* gdi; @@ -245,19 +245,19 @@ boolean df_event_process(freerdp* instance, DFBEvent* event) break; case DIET_BUTTONPRESS: - df_send_mouse_button_event(instance->input, true, input_event->button, pointer_x, pointer_y); + df_send_mouse_button_event(instance->input, TRUE, input_event->button, pointer_x, pointer_y); break; case DIET_BUTTONRELEASE: - df_send_mouse_button_event(instance->input, false, input_event->button, pointer_x, pointer_y); + df_send_mouse_button_event(instance->input, FALSE, input_event->button, pointer_x, pointer_y); break; case DIET_KEYPRESS: - df_send_keyboard_event(instance->input, true, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0)); + df_send_keyboard_event(instance->input, TRUE, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0)); break; case DIET_KEYRELEASE: - df_send_keyboard_event(instance->input, false, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0)); + df_send_keyboard_event(instance->input, FALSE, input_event->key_id - DIKI_UNKNOWN, input_event->key_symbol - DFB_FUNCTION_KEY(0)); break; case DIET_UNKNOWN: @@ -265,5 +265,5 @@ boolean df_event_process(freerdp* instance, DFBEvent* event) } } - return true; + return TRUE; } diff --git a/client/DirectFB/df_event.h b/client/DirectFB/df_event.h index ebe20cd44..02ad95625 100644 --- a/client/DirectFB/df_event.h +++ b/client/DirectFB/df_event.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * DirectFB Event Handling * * Copyright 2011 Marc-Andre Moreau @@ -23,6 +23,6 @@ #include "dfreerdp.h" void df_keyboard_init(); -boolean df_event_process(freerdp* instance, DFBEvent* event); +BOOL df_event_process(freerdp* instance, DFBEvent* event); #endif /* __DF_EVENT_H */ diff --git a/client/DirectFB/df_graphics.c b/client/DirectFB/df_graphics.c index 59ca690c9..8d138fea5 100644 --- a/client/DirectFB/df_graphics.c +++ b/client/DirectFB/df_graphics.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * DirectFB Graphical Objects * * Copyright 2011 Marc-Andre Moreau @@ -44,7 +44,7 @@ void df_Pointer_New(rdpContext* context, rdpPointer* pointer) if (result == DFB_OK) { int pitch; - uint8* point = NULL; + BYTE* point = NULL; df_pointer->xhot = pointer->xPos; df_pointer->yhot = pointer->yPos; @@ -133,6 +133,6 @@ void df_register_graphics(rdpGraphics* graphics) pointer->SetDefault = df_Pointer_SetDefault; graphics_register_pointer(graphics, pointer); - xfree(pointer); + free(pointer); } diff --git a/client/DirectFB/df_graphics.h b/client/DirectFB/df_graphics.h index fe2d5c8f1..8185b948b 100644 --- a/client/DirectFB/df_graphics.h +++ b/client/DirectFB/df_graphics.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * DirectFB Graphical Objects * * Copyright 2011 Marc-Andre Moreau diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index ae80dafd6..e960fd908 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * DirectFB Client * * Copyright 2011 Marc-Andre Moreau @@ -26,7 +26,8 @@ #include #include #include -#include +#include +#include #include @@ -85,7 +86,7 @@ void df_end_paint(rdpContext* context) dfi->primary->Blit(dfi->primary, dfi->surface, &(dfi->update_rect), dfi->update_rect.x, dfi->update_rect.y); } -boolean df_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) +BOOL df_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) { dfInfo* dfi; @@ -94,28 +95,28 @@ boolean df_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int rfds[*rcount] = (void*)(long)(dfi->read_fds); (*rcount)++; - return true; + return TRUE; } -boolean df_check_fds(freerdp* instance, fd_set* set) +BOOL df_check_fds(freerdp* instance, fd_set* set) { dfInfo* dfi; dfi = ((dfContext*) instance->context)->dfi; if (!FD_ISSET(dfi->read_fds, set)) - return true; + return TRUE; if (read(dfi->read_fds, &(dfi->event), sizeof(dfi->event)) > 0) df_event_process(instance, &(dfi->event)); - return true; + return TRUE; } -boolean df_pre_connect(freerdp* instance) +BOOL df_pre_connect(freerdp* instance) { dfInfo* dfi; - boolean bitmap_cache; + BOOL bitmap_cache; dfContext* context; rdpSettings* settings; @@ -126,30 +127,30 @@ boolean df_pre_connect(freerdp* instance) settings = instance->settings; bitmap_cache = settings->bitmap_cache; - settings->order_support[NEG_DSTBLT_INDEX] = true; - settings->order_support[NEG_PATBLT_INDEX] = true; - settings->order_support[NEG_SCRBLT_INDEX] = true; - settings->order_support[NEG_OPAQUE_RECT_INDEX] = true; - settings->order_support[NEG_DRAWNINEGRID_INDEX] = false; - settings->order_support[NEG_MULTIDSTBLT_INDEX] = false; - settings->order_support[NEG_MULTIPATBLT_INDEX] = false; - settings->order_support[NEG_MULTISCRBLT_INDEX] = false; - settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = true; - settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = false; - settings->order_support[NEG_LINETO_INDEX] = true; - settings->order_support[NEG_POLYLINE_INDEX] = true; + settings->order_support[NEG_DSTBLT_INDEX] = TRUE; + settings->order_support[NEG_PATBLT_INDEX] = TRUE; + settings->order_support[NEG_SCRBLT_INDEX] = TRUE; + settings->order_support[NEG_OPAQUE_RECT_INDEX] = TRUE; + settings->order_support[NEG_DRAWNINEGRID_INDEX] = FALSE; + settings->order_support[NEG_MULTIDSTBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTIPATBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTISCRBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = TRUE; + settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE; + settings->order_support[NEG_LINETO_INDEX] = TRUE; + settings->order_support[NEG_POLYLINE_INDEX] = TRUE; settings->order_support[NEG_MEMBLT_INDEX] = bitmap_cache; - settings->order_support[NEG_MEM3BLT_INDEX] = false; + settings->order_support[NEG_MEM3BLT_INDEX] = FALSE; settings->order_support[NEG_MEMBLT_V2_INDEX] = bitmap_cache; - settings->order_support[NEG_MEM3BLT_V2_INDEX] = false; - settings->order_support[NEG_SAVEBITMAP_INDEX] = false; - settings->order_support[NEG_GLYPH_INDEX_INDEX] = false; - settings->order_support[NEG_FAST_INDEX_INDEX] = false; - settings->order_support[NEG_FAST_GLYPH_INDEX] = false; - settings->order_support[NEG_POLYGON_SC_INDEX] = false; - settings->order_support[NEG_POLYGON_CB_INDEX] = false; - settings->order_support[NEG_ELLIPSE_SC_INDEX] = false; - settings->order_support[NEG_ELLIPSE_CB_INDEX] = false; + settings->order_support[NEG_MEM3BLT_V2_INDEX] = FALSE; + settings->order_support[NEG_SAVEBITMAP_INDEX] = FALSE; + settings->order_support[NEG_GLYPH_INDEX_INDEX] = FALSE; + settings->order_support[NEG_FAST_INDEX_INDEX] = FALSE; + settings->order_support[NEG_FAST_GLYPH_INDEX] = FALSE; + settings->order_support[NEG_POLYGON_SC_INDEX] = FALSE; + settings->order_support[NEG_POLYGON_CB_INDEX] = FALSE; + settings->order_support[NEG_ELLIPSE_SC_INDEX] = FALSE; + settings->order_support[NEG_ELLIPSE_CB_INDEX] = FALSE; dfi->clrconv = xnew(CLRCONV); dfi->clrconv->alpha = 1; @@ -158,13 +159,13 @@ boolean df_pre_connect(freerdp* instance) dfi->clrconv->palette = xnew(rdpPalette); freerdp_channels_pre_connect(instance->context->channels, instance); - - instance->context->cache = cache_new(instance->settings); - return true; + instance->context->cache = cache_new(instance->settings); + + return TRUE; } -boolean df_post_connect(freerdp* instance) +BOOL df_post_connect(freerdp* instance) { rdpGdi* gdi; dfInfo* dfi; @@ -217,21 +218,33 @@ boolean df_post_connect(freerdp* instance) freerdp_channels_post_connect(instance->context->channels, instance); - return true; + return TRUE; } static int df_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { + void* entry = NULL; rdpChannels* channels = (rdpChannels*) user_data; - printf("loading plugin %s\n", name); + entry = freerdp_channels_find_static_virtual_channel_entry(name); + + if (entry) + { + if (freerdp_channels_client_load(channels, settings, entry, plugin_data) == 0) + { + printf("loading channel %s (static)\n", name); + return 1; + } + } + + printf("loading channel %s (plugin)\n", name); freerdp_channels_load_plugin(channels, settings, name, plugin_data); return 1; } -boolean df_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint) +BOOL df_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint) { printf("Certificate details:\n"); printf("\tSubject: %s\n", subject); @@ -249,7 +262,7 @@ boolean df_verify_certificate(freerdp* instance, char* subject, char* issuer, ch if (answer == 'y' || answer == 'Y') { - return true; + return TRUE; } else if (answer == 'n' || answer == 'N') { @@ -257,17 +270,15 @@ boolean df_verify_certificate(freerdp* instance, char* subject, char* issuer, ch } } - return false; + return FALSE; } -static int -df_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) +static int df_receive_channel_data(freerdp* instance, int channelId, BYTE* data, int size, int flags, int total_size) { return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } -static void -df_process_cb_monitor_ready_event(rdpChannels* channels, freerdp* instance) +static void df_process_cb_monitor_ready_event(rdpChannels* channels, freerdp* instance) { RDP_EVENT* event; RDP_CB_FORMAT_LIST_EVENT* format_list_event; @@ -280,8 +291,7 @@ df_process_cb_monitor_ready_event(rdpChannels* channels, freerdp* instance) freerdp_channels_send_event(channels, event); } -static void -df_process_channel_event(rdpChannels* channels, freerdp* instance) +static void df_process_channel_event(rdpChannels* channels, freerdp* instance) { RDP_EVENT* event; @@ -306,7 +316,7 @@ df_process_channel_event(rdpChannels* channels, freerdp* instance) static void df_free(dfInfo* dfi) { dfi->dfb->Release(dfi->dfb); - xfree(dfi); + free(dfi); } int dfreerdp_run(freerdp* instance) @@ -340,17 +350,17 @@ int dfreerdp_run(freerdp* instance) rcount = 0; wcount = 0; - if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != true) + if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != true) + if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get channel manager file descriptor\n"); break; } - if (df_get_fds(instance, rfds, &rcount, wfds, &wcount) != true) + if (df_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get dfreerdp file descriptor\n"); break; @@ -386,17 +396,17 @@ int dfreerdp_run(freerdp* instance) } } - if (freerdp_check_fds(instance) != true) + if (freerdp_check_fds(instance) != TRUE) { printf("Failed to check FreeRDP file descriptor\n"); break; } - if (df_check_fds(instance, &rfds_set) != true) + if (df_check_fds(instance, &rfds_set) != TRUE) { printf("Failed to check dfreerdp file descriptor\n"); break; } - if (freerdp_channels_check_fds(channels, instance) != true) + if (freerdp_channels_check_fds(channels, instance) != TRUE) { printf("Failed to check channel manager file descriptor\n"); break; @@ -421,7 +431,7 @@ void* thread_func(void* param) dfreerdp_run(data->instance); - xfree(data); + free(data); pthread_detach(pthread_self()); diff --git a/client/DirectFB/dfreerdp.h b/client/DirectFB/dfreerdp.h index 785693377..6b14bf997 100644 --- a/client/DirectFB/dfreerdp.h +++ b/client/DirectFB/dfreerdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * DirectFB Client * * Copyright 2011 Marc-Andre Moreau @@ -47,8 +47,8 @@ struct df_pointer { rdpPointer pointer; IDirectFBSurface* surface; - uint32 xhot; - uint32 yhot; + UINT32 xhot; + UINT32 yhot; }; typedef struct df_pointer dfPointer; diff --git a/client/Mac/.gitignore b/client/Mac/.gitignore new file mode 100644 index 000000000..600769254 --- /dev/null +++ b/client/Mac/.gitignore @@ -0,0 +1,2 @@ +*.app + diff --git a/client/Mac/AppDelegate.m b/client/Mac/AppDelegate.m index 3b7658d80..755f02de6 100644 --- a/client/Mac/AppDelegate.m +++ b/client/Mac/AppDelegate.m @@ -10,8 +10,9 @@ @implementation AppDelegate -//@synthesize window = _window; -//@synthesize mrdpView; +@synthesize window = _window; + +@synthesize mrdpView; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { diff --git a/client/Mac/Info.plist b/client/Mac/Info.plist index 530ecb9a7..119d3fec6 100644 --- a/client/Mac/Info.plist +++ b/client/Mac/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion en CFBundleExecutable - ${EXECUTABLE_NAME} + CFBundleIconFile CFBundleIdentifier @@ -13,7 +13,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - ${PRODUCT_NAME} + CFBundlePackageType APPL CFBundleShortVersionString @@ -23,7 +23,7 @@ CFBundleVersion 1 LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright Copyright © 2012 __MyCompanyName__. All rights reserved. NSMainNibFile diff --git a/client/Mac/MRDPCursor.h b/client/Mac/MRDPCursor.h index 3430e67c8..6fd2cd580 100644 --- a/client/Mac/MRDPCursor.h +++ b/client/Mac/MRDPCursor.h @@ -14,7 +14,7 @@ { @public rdpPointer *pointer; - uint8 *cursor_data; // bitmapped pixel data + BYTE *cursor_data; // bitmapped pixel data NSBitmapImageRep *bmiRep; NSCursor *nsCursor; NSImage *nsImage; diff --git a/client/Mac/MRDPRailView.h b/client/Mac/MRDPRailView.h index 68b6f1256..d33f4628b 100644 --- a/client/Mac/MRDPRailView.h +++ b/client/Mac/MRDPRailView.h @@ -2,6 +2,7 @@ #import "freerdp/gdi/gdi.h" #import "freerdp/rail/rail.h" + #import "MRDPRailWindow.h" @interface MRDPRailView : NSView @@ -11,9 +12,9 @@ NSBitmapImageRep * bmiRep; NSPoint savedDragLocation; char * pixelData; - boolean mouseInClientArea; - boolean titleBarClicked; - boolean gestureEventInProgress; + BOOL mouseInClientArea; + BOOL titleBarClicked; + BOOL gestureEventInProgress; int width; int height; int savedWindowId; @@ -31,15 +32,15 @@ int kdcapslock; @public - boolean isMoveSizeInProgress; - boolean saveInitialDragLoc; - boolean skipMoveWindowOnce; + BOOL isMoveSizeInProgress; + BOOL saveInitialDragLoc; + BOOL skipMoveWindowOnce; int localMoveType; } @property (assign) MRDPRailWindow * mrdpRailWindow; @property (assign) int windowIndex; -@property (assign) boolean activateWindow; +@property (assign) BOOL activateWindow; - (void) windowDidMove:(NSNotification *) notification; - (void) updateDisplay; @@ -50,7 +51,7 @@ void mac_rail_MoveWindow(rdpRail *rail, rdpWindow *window); void apple_to_windowMove(NSRect * r, RAIL_WINDOW_MOVE_ORDER * windowMove); -void mac_send_rail_client_event(rdpChannels *channels, uint16 event_type, void *param); +void mac_send_rail_client_event(rdpChannels *channels, UINT16 event_type, void *param); void windows_to_apple_cords(NSRect * r); void rail_MoveWindow(rdpRail * rail, rdpWindow * window); void mac_rail_send_activate(int window_id); diff --git a/client/Mac/MRDPRailView.m b/client/Mac/MRDPRailView.m index 69e08200b..16f6f66c1 100644 --- a/client/Mac/MRDPRailView.m +++ b/client/Mac/MRDPRailView.m @@ -18,7 +18,7 @@ extern struct kkey g_keys[]; - (void) updateDisplay { - boolean moveWindow = NO; + BOOL moveWindow = NO; NSRect srcRectOuter; NSRect destRectOuter; diff --git a/client/Mac/MRDPView.h b/client/Mac/MRDPView.h index 48a3aac4d..8007c330e 100644 --- a/client/Mac/MRDPView.h +++ b/client/Mac/MRDPView.h @@ -15,7 +15,7 @@ #import "freerdp/gdi/gdi.h" #import "freerdp/graphics.h" #import "freerdp/utils/event.h" -#import "freerdp/plugins/cliprdr.h" +#import "freerdp/client/cliprdr.h" #import "freerdp/utils/args.h" #import "freerdp/rail/rail.h" #import "freerdp/rail.h" @@ -43,13 +43,13 @@ // RAIL stuff MRDPWindow *currentWindow; NSPoint savedDragLocation; - boolean mouseInClientArea; - boolean isRemoteApp; - boolean firstCreateWindow; - boolean isMoveSizeInProgress; - boolean skipResizeOnce; - boolean saveInitialDragLoc; - boolean skipMoveWindowOnce; + BOOL mouseInClientArea; + BOOL isRemoteApp; + BOOL firstCreateWindow; + BOOL isMoveSizeInProgress; + BOOL skipResizeOnce; + BOOL saveInitialDragLoc; + BOOL skipMoveWindowOnce; // store state info for some keys int kdlshift; @@ -99,8 +99,8 @@ void pointer_set(rdpContext* context, rdpPointer* pointer); void pointer_setNull(rdpContext* context); void pointer_setDefault(rdpContext* context); int rdp_connect(); -boolean mac_pre_connect(freerdp *inst); -boolean mac_post_connect(freerdp *inst); +BOOL mac_pre_connect(freerdp *inst); +BOOL mac_post_connect(freerdp *inst); void mac_context_new(freerdp *inst, rdpContext *context); void mac_context_free(freerdp *inst, rdpContext *context); void mac_set_bounds(rdpContext *context, rdpBounds *bounds); @@ -113,13 +113,13 @@ void channel_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType, CFDat int register_fds(int *fds, int count, void *inst); 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 *inst, int chan_id, uint8 *data, int size, int flags, int total_size); +int receive_channel_data(freerdp *inst, int chan_id, BYTE *data, int size, int flags, int total_size); void process_cliprdr_event(freerdp *inst, RDP_EVENT *event); void cliprdr_process_cb_format_list_event(freerdp *inst, RDP_CB_FORMAT_LIST_EVENT* event); -void cliprdr_send_data_request(freerdp *inst, uint32 format); +void cliprdr_send_data_request(freerdp *inst, UINT32 format); void cliprdr_process_cb_monitor_ready_event(freerdp* inst); void cliprdr_process_cb_data_response_event(freerdp *inst, RDP_CB_DATA_RESPONSE_EVENT *event); -void cliprdr_process_text(freerdp *inst, uint8 *data, int len); +void cliprdr_process_text(freerdp *inst, BYTE *data, int len); void cliprdr_send_supported_format_list(freerdp *inst); int register_channel_fds(int *fds, int count, void *inst); @@ -127,14 +127,14 @@ void mac_process_rail_event(freerdp *inst, RDP_EVENT *event); void mac_rail_register_callbacks(freerdp *inst, rdpRail *rail); void mac_rail_CreateWindow(rdpRail *rail, rdpWindow *window); void mac_rail_MoveWindow(rdpRail *rail, rdpWindow *window); -void mac_rail_ShowWindow(rdpRail *rail, rdpWindow *window, uint8 state); +void mac_rail_ShowWindow(rdpRail *rail, rdpWindow *window, BYTE state); void mac_rail_SetWindowText(rdpRail *rail, rdpWindow *window); 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_send_rail_client_event(rdpChannels *channels, uint16 event_type, void *param); +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); @@ -153,7 +153,7 @@ struct mac_context struct cursor { rdpPointer *pointer; - uint8 *cursor_data; // bitmapped pixel data + BYTE *cursor_data; // bitmapped pixel data void *bmiRep; // NSBitmapImageRep void *nsCursor; // NSCursor void *nsImage; // NSImage diff --git a/client/Mac/MRDPView.m b/client/Mac/MRDPView.m index 722a7d21e..f3ea097d2 100644 --- a/client/Mac/MRDPView.m +++ b/client/Mac/MRDPView.m @@ -1014,43 +1014,43 @@ int rdp_connect() * @return true if successful. false otherwise. ************************************************************************/ -boolean mac_pre_connect(freerdp *inst) +BOOL mac_pre_connect(freerdp *inst) { char *cptr; int len; int i; - inst->settings->offscreen_bitmap_cache = false; - inst->settings->glyph_cache = true; + inst->settings->offscreen_bitmap_cache = FALSE; + inst->settings->glyph_cache = TRUE; inst->settings->glyphSupportLevel = GLYPH_SUPPORT_FULL; - inst->settings->order_support[NEG_GLYPH_INDEX_INDEX] = true; - inst->settings->order_support[NEG_FAST_GLYPH_INDEX] = false; - inst->settings->order_support[NEG_FAST_INDEX_INDEX] = false; - inst->settings->order_support[NEG_SCRBLT_INDEX] = true; - inst->settings->order_support[NEG_SAVEBITMAP_INDEX] = false; + inst->settings->order_support[NEG_GLYPH_INDEX_INDEX] = TRUE; + inst->settings->order_support[NEG_FAST_GLYPH_INDEX] = FALSE; + inst->settings->order_support[NEG_FAST_INDEX_INDEX] = FALSE; + inst->settings->order_support[NEG_SCRBLT_INDEX] = TRUE; + inst->settings->order_support[NEG_SAVEBITMAP_INDEX] = FALSE; - inst->settings->bitmap_cache = true; - inst->settings->order_support[NEG_MEMBLT_INDEX] = true; - inst->settings->order_support[NEG_MEMBLT_V2_INDEX] = true; - inst->settings->order_support[NEG_MEM3BLT_INDEX] = false; - inst->settings->order_support[NEG_MEM3BLT_V2_INDEX] = false; + inst->settings->bitmap_cache = TRUE; + inst->settings->order_support[NEG_MEMBLT_INDEX] = TRUE; + inst->settings->order_support[NEG_MEMBLT_V2_INDEX] = TRUE; + inst->settings->order_support[NEG_MEM3BLT_INDEX] = FALSE; + inst->settings->order_support[NEG_MEM3BLT_V2_INDEX] = FALSE; inst->settings->bitmapCacheV2NumCells = 3; // 5; inst->settings->bitmapCacheV2CellInfo[0].numEntries = 0x78; // 600; - inst->settings->bitmapCacheV2CellInfo[0].persistent = false; + inst->settings->bitmapCacheV2CellInfo[0].persistent = FALSE; inst->settings->bitmapCacheV2CellInfo[1].numEntries = 0x78; // 600; - inst->settings->bitmapCacheV2CellInfo[1].persistent = false; + inst->settings->bitmapCacheV2CellInfo[1].persistent = FALSE; inst->settings->bitmapCacheV2CellInfo[2].numEntries = 0x150; // 2048; - inst->settings->bitmapCacheV2CellInfo[2].persistent = false; + inst->settings->bitmapCacheV2CellInfo[2].persistent = FALSE; inst->settings->bitmapCacheV2CellInfo[3].numEntries = 0; // 4096; - inst->settings->bitmapCacheV2CellInfo[3].persistent = false; + inst->settings->bitmapCacheV2CellInfo[3].persistent = FALSE; inst->settings->bitmapCacheV2CellInfo[4].numEntries = 0; // 2048; - inst->settings->bitmapCacheV2CellInfo[4].persistent = false; + inst->settings->bitmapCacheV2CellInfo[4].persistent = FALSE; - inst->settings->order_support[NEG_MULTIDSTBLT_INDEX] = false; - inst->settings->order_support[NEG_MULTIPATBLT_INDEX] = false; - inst->settings->order_support[NEG_MULTISCRBLT_INDEX] = false; - inst->settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = false; - inst->settings->order_support[NEG_POLYLINE_INDEX] = false; + inst->settings->order_support[NEG_MULTIDSTBLT_INDEX] = FALSE; + inst->settings->order_support[NEG_MULTIPATBLT_INDEX] = FALSE; + inst->settings->order_support[NEG_MULTISCRBLT_INDEX] = FALSE; + inst->settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = FALSE; + inst->settings->order_support[NEG_POLYLINE_INDEX] = FALSE; inst->settings->color_depth = 24; inst->settings->sw_gdi = 1; @@ -1070,7 +1070,7 @@ boolean mac_pre_connect(freerdp *inst) g_mrdpview->argv = malloc(sizeof(char *) * g_mrdpview->argc); if (g_mrdpview->argv == NULL) { - return false; + return FALSE; } #ifdef RUN_IN_XCODE @@ -1174,7 +1174,7 @@ boolean mac_pre_connect(freerdp *inst) // in order to achieve this, we need to modify the cmd line args entered by the user; if (g_mrdpview->isRemoteApp) { - boolean gotGeometry = NO; + BOOL gotGeometry = NO; // get dimensions of screen that has keyboard focus; // we use these dimensions when connecting to RDP server @@ -1218,13 +1218,13 @@ boolean mac_pre_connect(freerdp *inst) freerdp_parse_args(inst->settings, g_mrdpview->argc, g_mrdpview->argv, process_plugin_args, inst->context->channels, NULL, NULL); if ((strcmp(g_mrdpview->argv[1], "-h") == 0) || (strcmp(g_mrdpview->argv[1], "--help") == 0)) { [NSApp terminate:nil]; - return true; + return TRUE; } [g_mrdpview setViewSize:inst->settings->width :inst->settings->height]; freerdp_channels_pre_connect(inst->context->channels, inst); - return true; + return TRUE; } /** ********************************************************************* @@ -1238,7 +1238,7 @@ boolean mac_pre_connect(freerdp *inst) * ************************************************************************/ -boolean mac_post_connect(freerdp *inst) +BOOL mac_post_connect(freerdp *inst) { uint32 flags; rdpPointer rdp_pointer; @@ -1304,7 +1304,7 @@ boolean mac_post_connect(freerdp *inst) // we want to be notified when window resizes [[NSNotificationCenter defaultCenter] addObserver:g_mrdpview selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:nil]; - return true; + return TRUE; } /** ********************************************************************* @@ -1915,9 +1915,9 @@ void mac_process_rail_event(freerdp *inst, RDP_EVENT *event) void mac_rail_CreateWindow(rdpRail *rail, rdpWindow *window) { - boolean centerWindow = NO; - boolean moveWindow = NO; - boolean displayAsModal = NO; + BOOL centerWindow = NO; + BOOL moveWindow = NO; + BOOL displayAsModal = NO; NSMutableArray * ma = g_mrdpview->windows; // make sure window fits resolution @@ -2100,7 +2100,7 @@ void mac_process_rail_get_sysparams_event(rdpChannels *channels, RDP_EVENT *even sysparam->taskbarPos.right = 0; sysparam->taskbarPos.bottom = 0; - sysparam->dragFullWindows = false; + sysparam->dragFullWindows = FALSE; mac_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_SET_SYSPARAMS, sysparam); } diff --git a/client/Sample/CMakeLists.txt b/client/Sample/CMakeLists.txt index bebd12694..9dcfea304 100644 --- a/client/Sample/CMakeLists.txt +++ b/client/Sample/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP Sample UI cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -25,7 +25,7 @@ add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${CMAKE_DL_LIBS}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} diff --git a/client/Sample/freerdp.c b/client/Sample/freerdp.c index 76d3ca55a..070d0308d 100644 --- a/client/Sample/freerdp.c +++ b/client/Sample/freerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Test UI * * Copyright 2011 Marc-Andre Moreau @@ -34,13 +34,14 @@ #include #include #include + +#include #include #include #include #include -#include +#include #include -#include #include @@ -93,7 +94,7 @@ void tf_end_paint(rdpContext* context) return; } -int tf_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) +int tf_receive_channel_data(freerdp* instance, int channelId, BYTE* data, int size, int flags, int total_size) { return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } @@ -143,7 +144,7 @@ void tf_process_channel_event(rdpChannels* channels, freerdp* instance) } } -boolean tf_pre_connect(freerdp* instance) +BOOL tf_pre_connect(freerdp* instance) { tfInfo* tfi; tfContext* context; @@ -155,35 +156,35 @@ boolean tf_pre_connect(freerdp* instance) settings = instance->settings; - settings->order_support[NEG_DSTBLT_INDEX] = true; - settings->order_support[NEG_PATBLT_INDEX] = true; - settings->order_support[NEG_SCRBLT_INDEX] = true; - settings->order_support[NEG_OPAQUE_RECT_INDEX] = true; - settings->order_support[NEG_DRAWNINEGRID_INDEX] = true; - settings->order_support[NEG_MULTIDSTBLT_INDEX] = true; - settings->order_support[NEG_MULTIPATBLT_INDEX] = true; - settings->order_support[NEG_MULTISCRBLT_INDEX] = true; - settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = true; - settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = true; - settings->order_support[NEG_LINETO_INDEX] = true; - settings->order_support[NEG_POLYLINE_INDEX] = true; - settings->order_support[NEG_MEMBLT_INDEX] = true; - settings->order_support[NEG_MEM3BLT_INDEX] = true; - settings->order_support[NEG_SAVEBITMAP_INDEX] = true; - settings->order_support[NEG_GLYPH_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_GLYPH_INDEX] = true; - settings->order_support[NEG_POLYGON_SC_INDEX] = true; - settings->order_support[NEG_POLYGON_CB_INDEX] = true; - settings->order_support[NEG_ELLIPSE_SC_INDEX] = true; - settings->order_support[NEG_ELLIPSE_CB_INDEX] = true; + settings->order_support[NEG_DSTBLT_INDEX] = TRUE; + settings->order_support[NEG_PATBLT_INDEX] = TRUE; + settings->order_support[NEG_SCRBLT_INDEX] = TRUE; + settings->order_support[NEG_OPAQUE_RECT_INDEX] = TRUE; + settings->order_support[NEG_DRAWNINEGRID_INDEX] = TRUE; + settings->order_support[NEG_MULTIDSTBLT_INDEX] = TRUE; + settings->order_support[NEG_MULTIPATBLT_INDEX] = TRUE; + settings->order_support[NEG_MULTISCRBLT_INDEX] = TRUE; + settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = TRUE; + settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = TRUE; + settings->order_support[NEG_LINETO_INDEX] = TRUE; + settings->order_support[NEG_POLYLINE_INDEX] = TRUE; + settings->order_support[NEG_MEMBLT_INDEX] = TRUE; + settings->order_support[NEG_MEM3BLT_INDEX] = TRUE; + settings->order_support[NEG_SAVEBITMAP_INDEX] = TRUE; + settings->order_support[NEG_GLYPH_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_GLYPH_INDEX] = TRUE; + settings->order_support[NEG_POLYGON_SC_INDEX] = TRUE; + settings->order_support[NEG_POLYGON_CB_INDEX] = TRUE; + settings->order_support[NEG_ELLIPSE_SC_INDEX] = TRUE; + settings->order_support[NEG_ELLIPSE_CB_INDEX] = TRUE; freerdp_channels_pre_connect(instance->context->channels, instance); - return true; + return TRUE; } -boolean tf_post_connect(freerdp* instance) +BOOL tf_post_connect(freerdp* instance) { rdpGdi* gdi; @@ -195,7 +196,7 @@ boolean tf_post_connect(freerdp* instance) freerdp_channels_post_connect(instance->context->channels, instance); - return true; + return TRUE; } int tfreerdp_run(freerdp* instance) @@ -223,12 +224,12 @@ int tfreerdp_run(freerdp* instance) rcount = 0; wcount = 0; - if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != true) + if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); break; } - if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != true) + if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get channel manager file descriptor\n"); break; @@ -264,12 +265,12 @@ int tfreerdp_run(freerdp* instance) } } - if (freerdp_check_fds(instance) != true) + if (freerdp_check_fds(instance) != TRUE) { printf("Failed to check FreeRDP file descriptor\n"); break; } - if (freerdp_channels_check_fds(channels, instance) != true) + if (freerdp_channels_check_fds(channels, instance) != TRUE) { printf("Failed to check channel manager file descriptor\n"); break; @@ -291,7 +292,7 @@ void* thread_func(void* param) tfreerdp_run(data->instance); - xfree(data); + free(data); pthread_detach(pthread_self()); diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index 8f3a921e5..18c2cffb4 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP Windows cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -36,12 +36,10 @@ set(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} WIN32 ${${MODULE_PREFIX}_SRCS}) -if(WITH_MONOLITHIC_BUILD) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-channels-client) - if(WITH_RDPDR) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} rdpdr disk printer) - endif() +if(MONOLITHIC_BUILD) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-core @@ -55,4 +53,3 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Windows") - diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c index ca277bc2c..470429c0d 100644 --- a/client/Windows/wf_cliprdr.c +++ b/client/Windows/wf_cliprdr.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows Clipboard Redirection * * Copyright 2012 Jason Champion @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "wf_cliprdr.h" @@ -83,24 +83,24 @@ void wf_process_cliprdr_event(wfInfo* wfi, RDP_EVENT* event) } } -boolean wf_cliprdr_process_selection_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +BOOL wf_cliprdr_process_selection_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - return true; + return TRUE; } -boolean wf_cliprdr_process_selection_request(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) { - return true; + return TRUE; } -boolean wf_cliprdr_process_selection_clear(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) { - return true; + return TRUE; } -boolean wf_cliprdr_process_property_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +BOOL wf_cliprdr_process_property_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - return true; + return TRUE; } void wf_cliprdr_check_owner(wfInfo* wfi) diff --git a/client/Windows/wf_cliprdr.h b/client/Windows/wf_cliprdr.h index 99e38b63f..484c6dccf 100644 --- a/client/Windows/wf_cliprdr.h +++ b/client/Windows/wf_cliprdr.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows Clipboard Redirection * * Copyright 2012 Jason Champion @@ -24,10 +24,10 @@ void wf_cliprdr_init(wfInfo* wfi, rdpChannels* chanman); void wf_cliprdr_uninit(wfInfo* wfi); void wf_process_cliprdr_event(wfInfo* wfi, RDP_EVENT* event); -boolean wf_cliprdr_process_selection_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -boolean wf_cliprdr_process_selection_request(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -boolean wf_cliprdr_process_selection_clear(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -boolean wf_cliprdr_process_property_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); +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); +BOOL wf_cliprdr_process_property_notify(wfInfo* wfi, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); void wf_cliprdr_check_owner(wfInfo* wfi); #endif /* __WF_CLIPRDR_H */ diff --git a/client/Windows/wf_event.c b/client/Windows/wf_event.c index 48450a806..94e7ac310 100644 --- a/client/Windows/wf_event.c +++ b/client/Windows/wf_event.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Event Handling * * Copyright 2009-2011 Jay Sorg @@ -59,10 +59,10 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam) if (!wfi || !p) return 1; input = wfi->instance->input; - rdp_scancode = MAKE_RDP_SCANCODE((uint8) p->scanCode, p->flags & LLKHF_EXTENDED); + rdp_scancode = MAKE_RDP_SCANCODE((BYTE) p->scanCode, p->flags & LLKHF_EXTENDED); DEBUG_KBD("keydown %d scanCode %04X flags %02X vkCode %02X", - (wParam == WM_KEYDOWN), (uint8) p->scanCode, p->flags, p->vkCode); + (wParam == WM_KEYDOWN), (BYTE) p->scanCode, p->flags, p->vkCode); if (wfi->fs_toggle && ((p->vkCode == VK_RETURN) || (p->vkCode == VK_CANCEL)) && @@ -87,10 +87,10 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam) if (wParam == WM_KEYDOWN) { DEBUG_KBD("Pause, sent as Ctrl+NumLock"); - freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_LCONTROL); - freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_NUMLOCK); - freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_LCONTROL); - freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_NUMLOCK); + freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_LCONTROL); + freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_NUMLOCK); + freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_LCONTROL); + freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_NUMLOCK); } else { @@ -127,9 +127,9 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam int x, y, w, h; PAINTSTRUCT ps; rdpInput* input; - boolean processed; + BOOL processed; - processed = true; + processed = TRUE; ptr = GetWindowLongPtr(hWnd, GWLP_USERDATA); wfi = (wfInfo*) ptr; @@ -179,13 +179,13 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam break; default: - processed = false; + processed = FALSE; break; } } else { - processed = false; + processed = FALSE; } if (processed) diff --git a/client/Windows/wf_event.h b/client/Windows/wf_event.h index 57ada3f9c..7128af2d8 100644 --- a/client/Windows/wf_event.h +++ b/client/Windows/wf_event.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Event Handling * * Copyright 2009-2011 Jay Sorg diff --git a/client/Windows/wf_gdi.c b/client/Windows/wf_gdi.c index bcbe1c6ec..c555ac1d7 100644 --- a/client/Windows/wf_gdi.c +++ b/client/Windows/wf_gdi.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows GDI * * Copyright 2009-2011 Jay Sorg @@ -39,7 +39,7 @@ #include "wfreerdp.h" #include "wf_graphics.h" -const uint8 wf_rop2_table[] = +const BYTE wf_rop2_table[] = { R2_BLACK, /* 0 */ R2_NOTMERGEPEN, /* DPon */ @@ -59,17 +59,17 @@ const uint8 wf_rop2_table[] = R2_WHITE, /* 1 */ }; -boolean wf_set_rop2(HDC hdc, int rop2) +BOOL wf_set_rop2(HDC hdc, int rop2) { if ((rop2 < 0x01) || (rop2 > 0x10)) { printf("Unsupported ROP2: %d\n", rop2); - return false; + return FALSE; } SetROP2(hdc, wf_rop2_table[rop2 - 1]); - return true; + return TRUE; } wfBitmap* wf_glyph_new(wfInfo* wfi, GLYPH_DATA* glyph) @@ -84,19 +84,19 @@ void wf_glyph_free(wfBitmap* glyph) wf_image_free(glyph); } -uint8* wf_glyph_convert(wfInfo* wfi, int width, int height, uint8* data) +BYTE* wf_glyph_convert(wfInfo* wfi, int width, int height, BYTE* data) { int indexx; int indexy; - uint8* src; - uint8* dst; - uint8* cdata; + BYTE* src; + BYTE* dst; + BYTE* cdata; int src_bytes_per_row; int dst_bytes_per_row; src_bytes_per_row = (width + 7) / 8; dst_bytes_per_row = src_bytes_per_row + (src_bytes_per_row % 2); - cdata = (uint8 *) xmalloc(dst_bytes_per_row * height); + cdata = (BYTE *) malloc(dst_bytes_per_row * height); src = data; for (indexy = 0; indexy < height; indexy++) @@ -115,13 +115,13 @@ uint8* wf_glyph_convert(wfInfo* wfi, int width, int height, uint8* data) return cdata; } -HBRUSH wf_create_brush(wfInfo * wfi, rdpBrush* brush, uint32 color, int bpp) +HBRUSH wf_create_brush(wfInfo * wfi, rdpBrush* brush, UINT32 color, int bpp) { int i; HBRUSH br; LOGBRUSH lbr; - uint8* cdata; - uint8 ipattern[8]; + BYTE* cdata; + BYTE ipattern[8]; HBITMAP pattern = NULL; lbr.lbStyle = brush->style; @@ -235,8 +235,8 @@ void wf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) HBRUSH brush; HBRUSH org_brush; int org_bkmode; - uint32 fgcolor; - uint32 bgcolor; + UINT32 fgcolor; + UINT32 bgcolor; COLORREF org_bkcolor; COLORREF org_textcolor; wfInfo* wfi = ((wfContext*) context)->wfi; @@ -280,7 +280,7 @@ void wf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { RECT rect; HBRUSH brush; - uint32 brush_color; + UINT32 brush_color; wfInfo* wfi = ((wfContext*) context)->wfi; brush_color = freerdp_color_convert_var_bgr(opaque_rect->color, wfi->srcBpp, wfi->dstBpp, wfi->clrconv); @@ -302,7 +302,7 @@ void wf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult int i; RECT rect; HBRUSH brush; - uint32 brush_color; + UINT32 brush_color; DELTA_RECT* rectangle; wfInfo* wfi = ((wfContext*) context)->wfi; @@ -333,7 +333,7 @@ void wf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) HPEN pen; HPEN org_pen; int x, y, w, h; - uint32 pen_color; + UINT32 pen_color; wfInfo* wfi = ((wfContext*) context)->wfi; pen_color = freerdp_color_convert_bgr(line_to->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv); @@ -365,7 +365,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) int org_rop2; HPEN hpen; HPEN org_hpen; - uint32 pen_color; + UINT32 pen_color; wfInfo* wfi = ((wfContext*) context)->wfi; pen_color = freerdp_color_convert_bgr(polyline->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv); @@ -376,7 +376,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) if (polyline->numPoints > 0) { - pts = (POINT*) xmalloc(sizeof(POINT) * polyline->numPoints); + pts = (POINT*) malloc(sizeof(POINT) * polyline->numPoints); for (i = 0; i < (int) polyline->numPoints; i++) { @@ -388,7 +388,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) } Polyline(wfi->drawing->hdc, pts, polyline->numPoints); - xfree(pts); + free(pts); } SelectObject(wfi->drawing->hdc, org_hpen); @@ -466,7 +466,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits wfi->image->_bitmap.width = surface_bits_command->width; wfi->image->_bitmap.height = surface_bits_command->height; wfi->image->_bitmap.bpp = surface_bits_command->bpp; - wfi->image->_bitmap.data = (uint8*) xrealloc(wfi->image->_bitmap.data, wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); + wfi->image->_bitmap.data = (BYTE*) realloc(wfi->image->_bitmap.data, wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); freerdp_image_flip(nsc_context->bmpdata, wfi->image->_bitmap.data, wfi->image->_bitmap.width, wfi->image->_bitmap.height, 32); BitBlt(wfi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, wfi->image->hdc, 0, 0, GDI_SRCCOPY); } @@ -476,12 +476,12 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits wfi->image->_bitmap.height = surface_bits_command->height; wfi->image->_bitmap.bpp = surface_bits_command->bpp; - wfi->image->_bitmap.data = (uint8*) xrealloc(wfi->image->_bitmap.data, + wfi->image->_bitmap.data = (BYTE*) realloc(wfi->image->_bitmap.data, wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); - if ((surface_bits_command->bpp != 32) || (wfi->clrconv->alpha == true)) + if ((surface_bits_command->bpp != 32) || (wfi->clrconv->alpha == TRUE)) { - uint8* temp_image; + BYTE* temp_image; freerdp_image_convert(surface_bits_command->bitmapData, wfi->image->_bitmap.data, wfi->image->_bitmap.width, wfi->image->_bitmap.height, @@ -490,9 +490,9 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits surface_bits_command->bpp = 32; surface_bits_command->bitmapData = wfi->image->_bitmap.data; - temp_image = (uint8*) xmalloc(wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); + temp_image = (BYTE*) malloc(wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); freerdp_image_flip(wfi->image->_bitmap.data, temp_image, wfi->image->_bitmap.width, wfi->image->_bitmap.height, 32); - xfree(wfi->image->_bitmap.data); + free(wfi->image->_bitmap.data); wfi->image->_bitmap.data = temp_image; } else @@ -510,7 +510,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits } if (tile_bitmap != NULL) - xfree(tile_bitmap); + free(tile_bitmap); } void wf_gdi_register_update_callbacks(rdpUpdate* update) diff --git a/client/Windows/wf_gdi.h b/client/Windows/wf_gdi.h index df35f6d99..470f66193 100644 --- a/client/Windows/wf_gdi.h +++ b/client/Windows/wf_gdi.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows GDI * * Copyright 2009-2011 Jay Sorg @@ -25,7 +25,7 @@ #include "wfreerdp.h" void wf_invalidate_region(wfInfo* wfi, int x, int y, int width, int height); -wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data); +wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, BYTE* data); void wf_image_free(wfBitmap* image); void wf_toggle_fullscreen(wfInfo* wfi); diff --git a/client/Windows/wf_graphics.c b/client/Windows/wf_graphics.c index 6345392a1..13aee1026 100644 --- a/client/Windows/wf_graphics.c +++ b/client/Windows/wf_graphics.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows Graphical Objects * * Copyright 2010-2011 Marc-Andre Moreau @@ -27,13 +27,13 @@ #include "wf_gdi.h" #include "wf_graphics.h" -HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data, uint8** pdata) +HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, BYTE* data, BYTE** pdata) { HDC hdc; int negHeight; HBITMAP bitmap; BITMAPINFO bmi; - uint8* cdata = NULL; + BYTE* cdata = NULL; /** * See: http://msdn.microsoft.com/en-us/library/dd183376 @@ -65,13 +65,13 @@ HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data, return bitmap; } -wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data) +wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, BYTE* data) { HDC hdc; wfBitmap* image; hdc = GetDC(NULL); - image = (wfBitmap*) xmalloc(sizeof(wfBitmap)); + image = (wfBitmap*) malloc(sizeof(wfBitmap)); image->hdc = CreateCompatibleDC(hdc); image->bitmap = wf_create_dib(wfi, width, height, bpp, data, &(image->pdata)); @@ -143,24 +143,24 @@ void wf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) } void wf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, - uint8* data, int width, int height, int bpp, int length, boolean compressed, int codec_id) + BYTE* data, int width, int height, int bpp, int length, BOOL compressed, int codec_id) { - uint16 size; + UINT16 size; size = width * height * (bpp / 8); if (bitmap->data == NULL) - bitmap->data = (uint8*) xmalloc(size); + bitmap->data = (BYTE*) malloc(size); else - bitmap->data = (uint8*) xrealloc(bitmap->data, size); + bitmap->data = (BYTE*) realloc(bitmap->data, size); if (compressed) { - boolean status; + BOOL status; status = bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); - if (status != true) + if (status != TRUE) { printf("Bitmap Decompression Failed\n"); } @@ -170,12 +170,12 @@ void wf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, freerdp_image_flip(data, bitmap->data, width, height, bpp); } - bitmap->compressed = false; + bitmap->compressed = FALSE; bitmap->length = size; bitmap->bpp = bpp; } -void wf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean primary) +void wf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { wfInfo* wfi = ((wfContext*) context)->wfi; diff --git a/client/Windows/wf_graphics.h b/client/Windows/wf_graphics.h index 96dfd3513..7c3827ebb 100644 --- a/client/Windows/wf_graphics.h +++ b/client/Windows/wf_graphics.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows Graphical Objects * * Copyright 2010-2011 Marc-Andre Moreau @@ -22,8 +22,8 @@ #include "wfreerdp.h" -HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data, uint8** pdata); -wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data); +HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, BYTE* data, BYTE** pdata); +wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, BYTE* data); void wf_image_free(wfBitmap* image); void wf_register_graphics(rdpGraphics* graphics); diff --git a/client/Windows/wf_rail.c b/client/Windows/wf_rail.c index 4dac4a4fb..900be237c 100644 --- a/client/Windows/wf_rail.c +++ b/client/Windows/wf_rail.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows RAIL * * Copyright 2012 Jason Champion @@ -29,7 +29,7 @@ #include "wf_window.h" #include "wf_rail.h" -void wf_rail_paint(wfInfo* wfi, rdpRail* rail, sint32 uleft, sint32 utop, uint32 uright, uint32 ubottom) +void wf_rail_paint(wfInfo* wfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom) { } @@ -37,11 +37,11 @@ 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_client_system_command(wfInfo* wfi, UINT32 windowId, UINT16 command) { } -void wf_rail_send_activate(wfInfo* wfi, HWND window, boolean enabled) +void wf_rail_send_activate(wfInfo* wfi, HWND window, BOOL enabled) { } diff --git a/client/Windows/wf_rail.h b/client/Windows/wf_rail.h index 82683ef42..fbbdb0c08 100644 --- a/client/Windows/wf_rail.h +++ b/client/Windows/wf_rail.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows RAIL * * Copyright 2012 Jason Champion @@ -21,10 +21,10 @@ #include "wfreerdp.h" -void wf_rail_paint(wfInfo* wfi, rdpRail* rail, sint32 uleft, sint32 utop, uint32 uright, uint32 ubottom); +void wf_rail_paint(wfInfo* wfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom); 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, boolean enabled); +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_rail_adjust_position(wfInfo* wfi, rdpWindow *window); void wf_rail_end_local_move(wfInfo* wfi, rdpWindow *window); diff --git a/client/Windows/wf_window.c b/client/Windows/wf_window.c index 9dfc91b6f..d15472ea4 100644 --- a/client/Windows/wf_window.c +++ b/client/Windows/wf_window.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows RAIL * * Copyright 2012 Jason Champion diff --git a/client/Windows/wf_window.h b/client/Windows/wf_window.h index aeb54f4c6..302b990d6 100644 --- a/client/Windows/wf_window.h +++ b/client/Windows/wf_window.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows RAIL * * Copyright 2012 Jason Champion diff --git a/client/Windows/wfreerdp.c b/client/Windows/wfreerdp.c index 60aae23c2..61acdb5fd 100644 --- a/client/Windows/wfreerdp.c +++ b/client/Windows/wfreerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows Client * * Copyright 2009-2011 Jay Sorg @@ -43,6 +43,7 @@ #include #include #include +#include #include #include "wf_gdi.h" @@ -96,8 +97,8 @@ void wf_sw_end_paint(rdpContext* context) int i; rdpGdi* gdi; wfInfo* wfi; - sint32 x, y; - uint32 w, h; + INT32 x, y; + UINT32 w, h; int ninvalid; RECT update_rect; HGDI_RGN cinvalid; @@ -139,7 +140,7 @@ void wf_hw_end_paint(rdpContext* context) } -boolean wf_pre_connect(freerdp* instance) +BOOL wf_pre_connect(freerdp* instance) { int i1; wfInfo* wfi; @@ -247,9 +248,9 @@ void cpuid(unsigned info, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned #endif } -uint32 wfi_detect_cpu() +UINT32 wfi_detect_cpu() { - uint32 cpu_opt = 0; + UINT32 cpu_opt = 0; unsigned int eax, ebx, ecx, edx = 0; cpuid(1, &eax, &ebx, &ecx, &edx); @@ -262,7 +263,7 @@ uint32 wfi_detect_cpu() return cpu_opt; } -boolean wf_post_connect(freerdp* instance) +BOOL wf_post_connect(freerdp* instance) { rdpGdi* gdi; wfInfo* wfi; @@ -303,12 +304,12 @@ boolean wf_post_connect(freerdp* instance) wfi->hdc->alpha = wfi->clrconv->alpha; wfi->hdc->invert = wfi->clrconv->invert; - wfi->hdc->hwnd = (HGDI_WND) xmalloc(sizeof(GDI_WND)); + wfi->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND)); wfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0); wfi->hdc->hwnd->invalid->null = 1; wfi->hdc->hwnd->count = 32; - wfi->hdc->hwnd->cinvalid = (HGDI_RGN) xmalloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count); + wfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count); wfi->hdc->hwnd->ninvalid = 0; wfi->image = wf_image_new(wfi, 64, 64, 32, NULL); @@ -395,7 +396,7 @@ boolean wf_post_connect(freerdp* instance) return TRUE; } -boolean wf_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint) +BOOL wf_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint) { #if 0 DWORD mode; @@ -426,7 +427,7 @@ boolean wf_verify_certificate(freerdp* instance, char* subject, char* issuer, ch return TRUE; } -int wf_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) +int wf_receive_channel_data(freerdp* instance, int channelId, BYTE* data, int size, int flags, int total_size) { return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } @@ -441,21 +442,33 @@ void wf_process_channel_event(rdpChannels* channels, freerdp* instance) freerdp_event_free(event); } -boolean wf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) +BOOL wf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) { return TRUE; } -boolean wf_check_fds(freerdp* instance) +BOOL wf_check_fds(freerdp* instance) { return TRUE; } int wf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { + void* entry = NULL; rdpChannels* channels = (rdpChannels*) user_data; - printf("loading plugin %s\n", name); + entry = freerdp_channels_find_static_virtual_channel_entry(name); + + if (entry) + { + if (freerdp_channels_client_load(channels, settings, entry, plugin_data) == 0) + { + printf("loading channel %s (static)\n", name); + return 1; + } + } + + printf("loading channel %s (plugin)\n", name); freerdp_channels_load_plugin(channels, settings, name, plugin_data); return 1; @@ -637,12 +650,6 @@ static DWORD WINAPI kbd_thread_func(LPVOID lpParam) return (DWORD) NULL; } -#ifdef WITH_RDPDR -DEFINE_SVC_PLUGIN_ENTRY(rdpdr) ; -DEFINE_DEV_PLUGIN_ENTRY(disk) ; -DEFINE_DEV_PLUGIN_ENTRY(printer) ; -#endif - INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { @@ -701,12 +708,6 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine instance->context->argc = __argc; instance->context->argv = __argv; -#ifdef WITH_RDPDR - REGISTER_SVC_PLUGIN_ENTRY(rdpdr) ; - REGISTER_DEV_PLUGIN_ENTRY(disk) ; - REGISTER_DEV_PLUGIN_ENTRY(printer) ; -#endif - if (!CreateThread(NULL, 0, kbd_thread_func, NULL, 0, NULL)) printf("error creating keyboard handler thread"); diff --git a/client/Windows/wfreerdp.h b/client/Windows/wfreerdp.h index 062618019..b1c4b1fcc 100644 --- a/client/Windows/wfreerdp.h +++ b/client/Windows/wfreerdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windows Client * * Copyright 2009-2011 Jay Sorg @@ -43,7 +43,7 @@ struct wf_bitmap HDC hdc; HBITMAP bitmap; HBITMAP org_bitmap; - uint8* pdata; + BYTE* pdata; }; typedef struct wf_bitmap wfBitmap; @@ -72,8 +72,8 @@ struct wf_info HWND hwnd; HGDI_DC hdc; - uint16 srcBpp; - uint16 dstBpp; + UINT16 srcBpp; + UINT16 dstBpp; freerdp* instance; wfBitmap* primary; wfBitmap* drawing; @@ -88,7 +88,7 @@ struct wf_info RFX_CONTEXT* rfx_context; NSC_CONTEXT* nsc_context; - boolean sw_gdi; + BOOL sw_gdi; }; #endif diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 63c584f7a..26d0512ae 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP X11 Client # # Copyright 2012 Marc-Andre Moreau @@ -94,7 +94,9 @@ endif() include_directories(${CMAKE_SOURCE_DIR}/resources) -if(WITH_MONOLITHIC_BUILD) +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-channels-client) + +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} @@ -110,3 +112,4 @@ target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/X11") + diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 01a9aa844..67641fece 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Clipboard Redirection * * Copyright 2010-2011 Vic Lee @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "xf_cliprdr.h" @@ -36,7 +36,7 @@ typedef struct clipboard_format_mapping clipboardFormatMapping; struct clipboard_format_mapping { Atom target_format; - uint32 format_id; + UINT32 format_id; }; typedef struct clipboard_context clipboardContext; @@ -52,32 +52,32 @@ struct clipboard_context int num_format_mappings; /* server->client data */ - uint32* formats; + UINT32* formats; int num_formats; Atom targets[20]; int num_targets; - uint8* data; - uint32 data_format; - uint32 data_alt_format; + BYTE* data; + UINT32 data_format; + UINT32 data_alt_format; int data_length; XEvent* respond; /* client->server data */ Window owner; int request_index; - boolean sync; + BOOL sync; /* INCR mechanism */ Atom incr_atom; - boolean incr_starts; - uint8* incr_data; + BOOL incr_starts; + BYTE* incr_data; int incr_data_length; }; void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman) { int n; - uint32 id; + UINT32 id; clipboardContext* cb; cb = xnew(clipboardContext); @@ -87,7 +87,7 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman) cb->request_index = -1; cb->root_window = DefaultRootWindow(xfi->display); - cb->clipboard_atom = XInternAtom(xfi->display, "CLIPBOARD", false); + cb->clipboard_atom = XInternAtom(xfi->display, "CLIPBOARD", FALSE); if (cb->clipboard_atom == None) { @@ -95,20 +95,20 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman) } id = 1; - cb->property_atom = XInternAtom(xfi->display, "_FREERDP_CLIPRDR", false); - cb->identity_atom = XInternAtom(xfi->display, "_FREERDP_CLIPRDR_ID", false); + cb->property_atom = XInternAtom(xfi->display, "_FREERDP_CLIPRDR", FALSE); + cb->identity_atom = XInternAtom(xfi->display, "_FREERDP_CLIPRDR_ID", FALSE); XChangeProperty(xfi->display, xfi->drawable, cb->identity_atom, - XA_INTEGER, 32, PropModeReplace, (uint8*) &id, 1); + XA_INTEGER, 32, PropModeReplace, (BYTE*) &id, 1); XSelectInput(xfi->display, cb->root_window, PropertyChangeMask); n = 0; - cb->format_mappings[n].target_format = XInternAtom(xfi->display, "_FREERDP_RAW", false); + cb->format_mappings[n].target_format = XInternAtom(xfi->display, "_FREERDP_RAW", FALSE); cb->format_mappings[n].format_id = CB_FORMAT_RAW; n++; - cb->format_mappings[n].target_format = XInternAtom(xfi->display, "UTF8_STRING", false); + cb->format_mappings[n].target_format = XInternAtom(xfi->display, "UTF8_STRING", FALSE); cb->format_mappings[n].format_id = CB_FORMAT_UNICODETEXT; n++; @@ -116,31 +116,31 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman) cb->format_mappings[n].format_id = CB_FORMAT_TEXT; n++; - cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/png", false); + cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/png", FALSE); cb->format_mappings[n].format_id = CB_FORMAT_PNG; n++; - cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/jpeg", false); + cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/jpeg", FALSE); cb->format_mappings[n].format_id = CB_FORMAT_JPEG; n++; - cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/gif", false); + cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/gif", FALSE); cb->format_mappings[n].format_id = CB_FORMAT_GIF; n++; - cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/bmp", false); + cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/bmp", FALSE); cb->format_mappings[n].format_id = CB_FORMAT_DIB; n++; - cb->format_mappings[n].target_format = XInternAtom(xfi->display, "text/html", false); + cb->format_mappings[n].target_format = XInternAtom(xfi->display, "text/html", FALSE); cb->format_mappings[n].format_id = CB_FORMAT_HTML; cb->num_format_mappings = n + 1; - cb->targets[0] = XInternAtom(xfi->display, "TIMESTAMP", false); - cb->targets[1] = XInternAtom(xfi->display, "TARGETS", false); + cb->targets[0] = XInternAtom(xfi->display, "TIMESTAMP", FALSE); + cb->targets[1] = XInternAtom(xfi->display, "TARGETS", FALSE); cb->num_targets = 2; - cb->incr_atom = XInternAtom(xfi->display, "INCR", false); + cb->incr_atom = XInternAtom(xfi->display, "INCR", FALSE); } void xf_cliprdr_uninit(xfInfo* xfi) @@ -149,26 +149,26 @@ void xf_cliprdr_uninit(xfInfo* xfi) if (cb) { - xfree(cb->formats); - xfree(cb->data); - xfree(cb->respond); - xfree(cb->incr_data); - xfree(cb); + free(cb->formats); + free(cb->data); + free(cb->respond); + free(cb->incr_data); + free(cb); xfi->clipboard_context = NULL; } } -static uint8* lf2crlf(uint8* data, int* size) +static BYTE* lf2crlf(BYTE* data, int* size) { - uint8 c; - uint8* outbuf; - uint8* out; - uint8* in_end; - uint8* in; + BYTE c; + BYTE* outbuf; + BYTE* out; + BYTE* in_end; + BYTE* in; int out_size; out_size = (*size) * 2 + 1; - outbuf = (uint8*) xzalloc(out_size); + outbuf = (BYTE*) xzalloc(out_size); out = outbuf; in = data; in_end = data + (*size); @@ -193,12 +193,12 @@ static uint8* lf2crlf(uint8* data, int* size) return outbuf; } -static void crlf2lf(uint8* data, int* size) +static void crlf2lf(BYTE* data, int* size) { - uint8 c; - uint8* out; - uint8* in; - uint8* in_end; + BYTE c; + BYTE* out; + BYTE* in; + BYTE* in_end; out = data; in = data; @@ -215,9 +215,9 @@ static void crlf2lf(uint8* data, int* size) *size = out - data; } -static void be2le(uint8* data, int size) +static void be2le(BYTE* data, int size) { - uint8 c; + BYTE c; while (size >= 2) { @@ -230,11 +230,11 @@ static void be2le(uint8* data, int size) } } -static boolean xf_cliprdr_is_self_owned(xfInfo* xfi) +static BOOL xf_cliprdr_is_self_owned(xfInfo* xfi) { Atom type; - uint32 id = 0; - uint32* pid = NULL; + UINT32 id = 0; + UINT32* pid = NULL; int format, result = 0; unsigned long length, bytes_left; clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; @@ -245,7 +245,7 @@ static boolean xf_cliprdr_is_self_owned(xfInfo* xfi) { result = XGetWindowProperty(xfi->display, cb->owner, cb->identity_atom, 0, 4, 0, XA_INTEGER, - &type, &format, &length, &bytes_left, (uint8**) &pid); + &type, &format, &length, &bytes_left, (BYTE**) &pid); } if (pid) @@ -255,15 +255,15 @@ static boolean xf_cliprdr_is_self_owned(xfInfo* xfi) } if ((cb->owner == None) || (cb->owner == xfi->drawable)) - return false; + return FALSE; if (result != Success) - return false; + return FALSE; - return (id ? true : false); + return (id ? TRUE : FALSE); } -static int xf_cliprdr_select_format_by_id(clipboardContext* cb, uint32 format_id) +static int xf_cliprdr_select_format_by_id(clipboardContext* cb, UINT32 format_id) { int i; @@ -305,7 +305,7 @@ static int xf_cliprdr_select_format_by_atom(clipboardContext* cb, Atom target) static void xf_cliprdr_send_raw_format_list(xfInfo* xfi) { Atom type; - uint8* format_data; + BYTE* format_data; int format, result; unsigned long length, bytes_left; RDP_CB_FORMAT_LIST_EVENT* event; @@ -313,7 +313,7 @@ static void xf_cliprdr_send_raw_format_list(xfInfo* xfi) result = XGetWindowProperty(xfi->display, cb->root_window, cb->property_atom, 0, 3600, 0, XA_STRING, - &type, &format, &length, &bytes_left, (uint8**) &format_data); + &type, &format, &length, &bytes_left, (BYTE**) &format_data); if (result != Success) { @@ -325,7 +325,7 @@ static void xf_cliprdr_send_raw_format_list(xfInfo* xfi) event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); - event->raw_format_data = (uint8*) xmalloc(length); + event->raw_format_data = (BYTE*) malloc(length); memcpy(event->raw_format_data, format_data, length); event->raw_format_data_size = length; XFree(format_data); @@ -355,7 +355,7 @@ static void xf_cliprdr_send_supported_format_list(xfInfo* xfi) event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); - event->formats = (uint32*) xmalloc(sizeof(uint32) * cb->num_format_mappings); + event->formats = (UINT32*) malloc(sizeof(UINT32) * cb->num_format_mappings); event->num_formats = cb->num_format_mappings; for (i = 0; i < cb->num_format_mappings; i++) @@ -384,7 +384,7 @@ static void xf_cliprdr_send_format_list(xfInfo* xfi) } } -static void xf_cliprdr_send_data_request(xfInfo* xfi, uint32 format) +static void xf_cliprdr_send_data_request(xfInfo* xfi, UINT32 format) { RDP_CB_DATA_REQUEST_EVENT* event; clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; @@ -397,7 +397,7 @@ static void xf_cliprdr_send_data_request(xfInfo* xfi, uint32 format) freerdp_channels_send_event(cb->channels, (RDP_EVENT*) event); } -static void xf_cliprdr_send_data_response(xfInfo* xfi, uint8* data, int size) +static void xf_cliprdr_send_data_response(xfInfo* xfi, BYTE* data, int size) { RDP_CB_DATA_RESPONSE_EVENT* event; clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; @@ -421,7 +421,7 @@ static void xf_cliprdr_process_cb_monitor_ready_event(xfInfo* xfi) clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; xf_cliprdr_send_format_list(xfi); - cb->sync = true; + cb->sync = TRUE; } static void xf_cliprdr_process_cb_data_request_event(xfInfo* xfi, RDP_CB_DATA_REQUEST_EVENT* event) @@ -436,7 +436,7 @@ static void xf_cliprdr_process_cb_data_request_event(xfInfo* xfi, RDP_CB_DATA_RE /* CB_FORMAT_RAW */ i = 0; XChangeProperty(xfi->display, xfi->drawable, cb->property_atom, - XA_INTEGER, 32, PropModeReplace, (uint8*) &event->format, 1); + XA_INTEGER, 32, PropModeReplace, (BYTE*) &event->format, 1); } else { @@ -468,7 +468,7 @@ static void xf_cliprdr_get_requested_targets(xfInfo* xfi) int i, j; Atom atom; int format; - uint8* data = NULL; + BYTE* data = NULL; unsigned long length, bytes_left; RDP_CB_FORMAT_LIST_EVENT* event; clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; @@ -485,7 +485,7 @@ static void xf_cliprdr_get_requested_targets(xfInfo* xfi) event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); - event->formats = (uint32*) xmalloc(sizeof(uint32) * cb->num_format_mappings); + event->formats = (UINT32*) malloc(sizeof(UINT32) * cb->num_format_mappings); num = 0; for (i = 0; i < length; i++) { @@ -516,16 +516,16 @@ static void xf_cliprdr_get_requested_targets(xfInfo* xfi) } } -static uint8* xf_cliprdr_process_requested_raw(uint8* data, int* size) +static BYTE* xf_cliprdr_process_requested_raw(BYTE* data, int* size) { - uint8* outbuf; + BYTE* outbuf; - outbuf = (uint8*) xmalloc(*size); + outbuf = (BYTE*) malloc(*size); memcpy(outbuf, data, *size); return outbuf; } -static uint8* xf_cliprdr_process_requested_unicodetext(uint8* data, int* size) +static BYTE* xf_cliprdr_process_requested_unicodetext(BYTE* data, int* size) { char* inbuf; WCHAR* outbuf; @@ -533,25 +533,25 @@ static uint8* xf_cliprdr_process_requested_unicodetext(uint8* data, int* size) inbuf = (char*) lf2crlf(data, size); out_size = freerdp_AsciiToUnicodeAlloc(inbuf, &outbuf, 0); - xfree(inbuf); + free(inbuf); *size = (int) ((out_size + 1) * 2); - return (uint8*) outbuf; + return (BYTE*) outbuf; } -static uint8* xf_cliprdr_process_requested_text(uint8* data, int* size) +static BYTE* xf_cliprdr_process_requested_text(BYTE* data, int* size) { - uint8* outbuf; + BYTE* outbuf; outbuf = lf2crlf(data, size); return outbuf; } -static uint8* xf_cliprdr_process_requested_dib(uint8* data, int* size) +static BYTE* xf_cliprdr_process_requested_dib(BYTE* data, int* size) { - uint8* outbuf; + BYTE* outbuf; /* length should be at least BMP header (14) + sizeof(BITMAPINFOHEADER) */ if (*size < 54) @@ -561,29 +561,29 @@ static uint8* xf_cliprdr_process_requested_dib(uint8* data, int* size) } *size -= 14; - outbuf = (uint8*) xzalloc(*size); + outbuf = (BYTE*) xzalloc(*size); memcpy(outbuf, data + 14, *size); return outbuf; } -static uint8* xf_cliprdr_process_requested_html(uint8* data, int* size) +static BYTE* xf_cliprdr_process_requested_html(BYTE* data, int* size) { char* inbuf; - uint8* in; - uint8* outbuf; + BYTE* in; + BYTE* outbuf; char num[11]; inbuf = NULL; if (*size > 2) { - if ((uint8) data[0] == 0xFE && (uint8) data[1] == 0xFF) + if ((BYTE) data[0] == 0xFE && (BYTE) data[1] == 0xFF) { be2le(data, *size); } - if ((uint8) data[0] == 0xFF && (uint8) data[1] == 0xFE) + if ((BYTE) data[0] == 0xFF && (BYTE) data[1] == 0xFE) { freerdp_UnicodeToAsciiAlloc((WCHAR*) (data + 2), &inbuf, (*size - 2) / 2); } @@ -595,7 +595,7 @@ static uint8* xf_cliprdr_process_requested_html(uint8* data, int* size) memcpy(inbuf, data, *size); } - outbuf = (uint8*) xzalloc(*size + 200); + outbuf = (BYTE*) xzalloc(*size + 200); strcpy((char*) outbuf, "Version:0.9\r\n" "StartHTML:0000000000\r\n" @@ -603,10 +603,10 @@ static uint8* xf_cliprdr_process_requested_html(uint8* data, int* size) "StartFragment:0000000000\r\n" "EndFragment:0000000000\r\n"); - in = (uint8*) strstr((char*) inbuf, "clipboard_context; if (cb->incr_starts && has_data) @@ -691,12 +691,12 @@ static void xf_cliprdr_process_requested_data(xfInfo* xfi, boolean has_data, uin xf_cliprdr_send_format_list(xfi); } -static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) +static BOOL xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) { Atom type; int format; - uint8* data = NULL; - boolean has_data = false; + BYTE* data = NULL; + BOOL has_data = FALSE; unsigned long length, bytes_left, dummy; clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; @@ -705,7 +705,7 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) { DEBUG_X11_CLIPRDR("invalid target"); xf_cliprdr_send_null_data_response(xfi); - return false; + return FALSE; } XGetWindowProperty(xfi->display, xfi->drawable, @@ -727,15 +727,15 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) else if (type == cb->incr_atom) { DEBUG_X11("INCR started"); - cb->incr_starts = true; + cb->incr_starts = TRUE; if (cb->incr_data) { - xfree(cb->incr_data); + free(cb->incr_data); cb->incr_data = NULL; } cb->incr_data_length = 0; /* Data will be followed in PropertyNotify event */ - has_data = true; + has_data = TRUE; } else { @@ -748,7 +748,7 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) cb->incr_data_length = 0; cb->incr_starts = 0; DEBUG_X11("INCR finished"); - has_data = true; + has_data = TRUE; } else if (XGetWindowProperty(xfi->display, xfi->drawable, cb->property_atom, 0, bytes_left, 0, target, @@ -758,13 +758,13 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) { bytes_left = length * format / 8; DEBUG_X11("%d bytes", (int)bytes_left); - cb->incr_data = (uint8*) xrealloc(cb->incr_data, cb->incr_data_length + bytes_left); + cb->incr_data = (BYTE*) realloc(cb->incr_data, cb->incr_data_length + bytes_left); memcpy(cb->incr_data + cb->incr_data_length, data, bytes_left); cb->incr_data_length += bytes_left; XFree(data); data = NULL; } - has_data = true; + has_data = TRUE; } else { @@ -778,7 +778,7 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) if (data) XFree(data); - return true; + return TRUE; } static void xf_cliprdr_append_target(clipboardContext* cb, Atom target) @@ -807,7 +807,7 @@ static void xf_cliprdr_provide_targets(xfInfo* xfi, XEvent* respond) respond->xselection.requestor, respond->xselection.property, XA_ATOM, 32, PropModeReplace, - (uint8*) cb->targets, cb->num_targets); + (BYTE*) cb->targets, cb->num_targets); } } @@ -821,7 +821,7 @@ static void xf_cliprdr_provide_data(xfInfo* xfi, XEvent* respond) respond->xselection.requestor, respond->xselection.property, respond->xselection.target, 8, PropModeReplace, - (uint8*) cb->data, cb->data_length); + (BYTE*) cb->data, cb->data_length); } } @@ -832,12 +832,12 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L if (cb->data) { - xfree(cb->data); + free(cb->data); cb->data = NULL; } if (cb->formats) - xfree(cb->formats); + free(cb->formats); cb->formats = event->formats; cb->num_formats = event->num_formats; @@ -868,26 +868,26 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L XFlush(xfi->display); } -static void xf_cliprdr_process_text(clipboardContext* cb, uint8* data, int size) +static void xf_cliprdr_process_text(clipboardContext* cb, BYTE* data, int size) { - cb->data = (uint8*) xmalloc(size); + cb->data = (BYTE*) malloc(size); memcpy(cb->data, data, size); cb->data_length = size; crlf2lf(cb->data, &cb->data_length); } -static void xf_cliprdr_process_unicodetext(clipboardContext* cb, uint8* data, int size) +static void xf_cliprdr_process_unicodetext(clipboardContext* cb, BYTE* data, int size) { cb->data_length = freerdp_UnicodeToAsciiAlloc((WCHAR*) data, (CHAR**) &(cb->data), size / 2); crlf2lf(cb->data, &cb->data_length); } -static void xf_cliprdr_process_dib(clipboardContext* cb, uint8* data, int size) +static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size) { STREAM* s; - uint16 bpp; - uint32 offset; - uint32 ncolors; + UINT16 bpp; + UINT32 offset; + UINT32 ncolors; /* size should be at least sizeof(BITMAPINFOHEADER) */ if (size < 40) @@ -899,8 +899,8 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, uint8* data, int size) s = stream_new(0); stream_attach(s, data, size); stream_seek(s, 14); - stream_read_uint16(s, bpp); - stream_read_uint32(s, ncolors); + stream_read_UINT16(s, bpp); + stream_read_UINT32(s, ncolors); offset = 14 + 40 + (bpp <= 8 ? (ncolors == 0 ? (1 << bpp) : ncolors) * 4 : 0); stream_detach(s); stream_free(s); @@ -908,11 +908,11 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, uint8* data, int size) DEBUG_X11_CLIPRDR("offset=%d bpp=%d ncolors=%d", offset, bpp, ncolors); s = stream_new(14 + size); - stream_write_uint8(s, 'B'); - stream_write_uint8(s, 'M'); - stream_write_uint32(s, 14 + size); - stream_write_uint32(s, 0); - stream_write_uint32(s, offset); + stream_write_BYTE(s, 'B'); + stream_write_BYTE(s, 'M'); + stream_write_UINT32(s, 14 + size); + stream_write_UINT32(s, 0); + stream_write_UINT32(s, offset); stream_write(s, data, size); cb->data = stream_get_head(s); @@ -921,7 +921,7 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, uint8* data, int size) stream_free(s); } -static void xf_cliprdr_process_html(clipboardContext* cb, uint8* data, int size) +static void xf_cliprdr_process_html(clipboardContext* cb, BYTE* data, int size) { char* start_str; char* end_str; @@ -943,7 +943,7 @@ static void xf_cliprdr_process_html(clipboardContext* cb, uint8* data, int size) return; } - cb->data = (uint8*) xmalloc(size - start + 1); + cb->data = (BYTE*) malloc(size - start + 1); memcpy(cb->data, data + start, end - start); cb->data_length = end - start; crlf2lf(cb->data, &cb->data_length); @@ -969,7 +969,7 @@ static void xf_cliprdr_process_cb_data_response_event(xfInfo* xfi, RDP_CB_DATA_R { if (cb->data) { - xfree(cb->data); + free(cb->data); cb->data = NULL; } switch (cb->data_format) @@ -1009,7 +1009,7 @@ static void xf_cliprdr_process_cb_data_response_event(xfInfo* xfi, RDP_CB_DATA_R XSendEvent(xfi->display, cb->respond->xselection.requestor, 0, 0, cb->respond); XFlush(xfi->display); - xfree(cb->respond); + free(cb->respond); cb->respond = NULL; } @@ -1039,7 +1039,7 @@ void xf_process_cliprdr_event(xfInfo* xfi, RDP_EVENT* event) } } -boolean xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent) +BOOL xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent) { clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; @@ -1055,7 +1055,7 @@ boolean xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent) xf_cliprdr_get_requested_targets(xfi); } - return true; + return TRUE; } else { @@ -1063,16 +1063,16 @@ boolean xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent) } } -boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent) +BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent) { int i; int fmt; Atom type; - uint32 format; + UINT32 format; XEvent* respond; - uint32 alt_format; - uint8* data = NULL; - boolean delay_respond; + UINT32 alt_format; + BYTE* data = NULL; + BOOL delay_respond; unsigned long length, bytes_left; clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; @@ -1081,10 +1081,10 @@ boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent) if (xevent->xselectionrequest.owner != xfi->drawable) { DEBUG_X11_CLIPRDR("not owner"); - return false; + return FALSE; } - delay_respond = false; + delay_respond = FALSE; respond = xnew(XEvent); respond->xselection.property = None; respond->xselection.type = SelectionNotify; @@ -1149,7 +1149,7 @@ boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent) */ if (cb->data) { - xfree(cb->data); + free(cb->data); cb->data = NULL; } @@ -1157,41 +1157,41 @@ boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent) cb->respond = respond; cb->data_format = format; cb->data_alt_format = alt_format; - delay_respond = true; + delay_respond = TRUE; xf_cliprdr_send_data_request(xfi, alt_format); } } } - if (delay_respond == false) + if (delay_respond == FALSE) { XSendEvent(xfi->display, xevent->xselectionrequest.requestor, 0, 0, respond); XFlush(xfi->display); - xfree(respond); + free(respond); } - return true; + return TRUE; } -boolean xf_cliprdr_process_selection_clear(xfInfo* xfi, XEvent* xevent) +BOOL xf_cliprdr_process_selection_clear(xfInfo* xfi, XEvent* xevent) { clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; if (xf_cliprdr_is_self_owned(xfi)) - return false; + return FALSE; XDeleteProperty(xfi->display, cb->root_window, cb->property_atom); - return true; + return TRUE; } -boolean xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent) +BOOL xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent) { clipboardContext* cb = (clipboardContext*) xfi->clipboard_context; if (xevent->xproperty.atom != cb->property_atom) - return false; /* Not cliprdr-related */ + return FALSE; /* Not cliprdr-related */ if (xevent->xproperty.window == cb->root_window) { @@ -1207,7 +1207,7 @@ boolean xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent) cb->format_mappings[cb->request_index].target_format); } - return true; + return TRUE; } void xf_cliprdr_check_owner(xfInfo* xfi) diff --git a/client/X11/xf_cliprdr.h b/client/X11/xf_cliprdr.h index 2678fc31d..f5ec699b2 100644 --- a/client/X11/xf_cliprdr.h +++ b/client/X11/xf_cliprdr.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Clipboard Redirection * * Copyright 2010-2011 Vic Lee @@ -25,10 +25,10 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman); void xf_cliprdr_uninit(xfInfo* xfi); void xf_process_cliprdr_event(xfInfo* xfi, RDP_EVENT* event); -boolean xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent); -boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent); -boolean xf_cliprdr_process_selection_clear(xfInfo* xfi, XEvent* xevent); -boolean xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent); +BOOL xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent); +BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent); +BOOL xf_cliprdr_process_selection_clear(xfInfo* xfi, XEvent* xevent); +BOOL xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent); void xf_cliprdr_check_owner(xfInfo* xfi); #ifdef WITH_DEBUG_X11_CLIPRDR diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index fd3af054f..a70d9d295 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Event Handling * * Copyright 2011 Marc-Andre Moreau @@ -73,7 +73,7 @@ static const char* const X11_EVENT_STRINGS[] = }; #endif -static boolean xf_event_Expose(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_Expose(xfInfo* xfi, XEvent* event, BOOL app) { int x, y; int w, h; @@ -83,7 +83,7 @@ static boolean xf_event_Expose(xfInfo* xfi, XEvent* event, boolean app) w = event->xexpose.width; h = event->xexpose.height; - if (app != true) + if (app != TRUE) { XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc, x, y, w, h, x, y); } @@ -102,16 +102,16 @@ static boolean xf_event_Expose(xfInfo* xfi, XEvent* event, boolean app) } } - return true; + return TRUE; } -static boolean xf_event_VisibilityNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_VisibilityNotify(xfInfo* xfi, XEvent* event, BOOL app) { xfi->unobscured = event->xvisibility.state == VisibilityUnobscured; - return true; + return TRUE; } -static boolean xf_event_MotionNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_MotionNotify(xfInfo* xfi, XEvent* event, BOOL app) { rdpInput* input; int x, y; @@ -121,10 +121,10 @@ static boolean xf_event_MotionNotify(xfInfo* xfi, XEvent* event, boolean app) x = event->xmotion.x; y = event->xmotion.y; - if (xfi->mouse_motion != true) + if (xfi->mouse_motion != TRUE) { if ((event->xmotion.state & (Button1Mask | Button2Mask | Button3Mask)) == 0) - return true; + return TRUE; } if (app) @@ -132,7 +132,7 @@ static boolean xf_event_MotionNotify(xfInfo* xfi, XEvent* event, boolean app) /* make sure window exists */ if (xf_rdpWindowFromWindow(xfi, event->xmotion.window) == 0) { - return true; + return TRUE; } // Translate to desktop coordinates XTranslateCoordinates(xfi->display, event->xmotion.window, @@ -147,16 +147,16 @@ static boolean xf_event_MotionNotify(xfInfo* xfi, XEvent* event, boolean app) XSetInputFocus(xfi->display, xfi->window->handle, RevertToPointerRoot, CurrentTime); } - return true; + return TRUE; } -static boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app) { int x, y; int flags; Window childWindow; - boolean wheel; - boolean extended; + BOOL wheel; + BOOL extended; rdpInput* input; input = xfi->instance->input; @@ -164,8 +164,8 @@ static boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app) x = 0; y = 0; flags = 0; - wheel = false; - extended = false; + wheel = FALSE; + extended = FALSE; switch (event->xbutton.button) { @@ -188,19 +188,19 @@ static boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app) break; case 4: - wheel = true; + wheel = TRUE; flags = PTR_FLAGS_WHEEL | 0x0078; break; case 5: - wheel = true; + wheel = TRUE; flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088; break; case 6: // wheel left or back case 8: // back case 97: // Xming - extended = true; + extended = TRUE; x = event->xbutton.x; y = event->xbutton.y; flags = PTR_XFLAGS_DOWN | PTR_XFLAGS_BUTTON1; @@ -209,7 +209,7 @@ static boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app) case 7: // wheel right or forward case 9: // forward case 112: // Xming - extended = true; + extended = TRUE; x = event->xbutton.x; y = event->xbutton.y; flags = PTR_XFLAGS_DOWN | PTR_XFLAGS_BUTTON2; @@ -235,7 +235,7 @@ static boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app) /* make sure window exists */ if (xf_rdpWindowFromWindow(xfi, event->xbutton.window) == 0) { - return true; + return TRUE; } // Translate to desktop coordinates XTranslateCoordinates(xfi->display, event->xbutton.window, @@ -250,15 +250,15 @@ static boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app) } } - return true; + return TRUE; } -static boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app) { int x, y; int flags; Window childWindow; - boolean extended; + BOOL extended; rdpInput* input; input = xfi->instance->input; @@ -266,7 +266,7 @@ static boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app) x = 0; y = 0; flags = 0; - extended = false; + extended = FALSE; switch (event->xbutton.button) { @@ -291,7 +291,7 @@ static boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app) case 6: case 8: case 97: - extended = true; + extended = TRUE; x = event->xbutton.x; y = event->xbutton.y; flags = PTR_XFLAGS_BUTTON1; @@ -300,7 +300,7 @@ static boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app) case 7: case 9: case 112: - extended = true; + extended = TRUE; x = event->xbutton.x; y = event->xbutton.y; flags = PTR_XFLAGS_BUTTON2; @@ -318,7 +318,7 @@ static boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app) /* make sure window exists */ if (xf_rdpWindowFromWindow(xfi, event->xbutton.window) == NULL) { - return true; + return TRUE; } // Translate to desktop coordinates XTranslateCoordinates(xfi->display, event->xbutton.window, @@ -332,10 +332,10 @@ static boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app) input->MouseEvent(input, flags, x, y); } - return true; + return TRUE; } -static boolean xf_event_KeyPress(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_KeyPress(xfInfo* xfi, XEvent* event, BOOL app) { KeySym keysym; char str[256]; @@ -345,14 +345,14 @@ static boolean xf_event_KeyPress(xfInfo* xfi, XEvent* event, boolean app) xf_kbd_set_keypress(xfi, event->xkey.keycode, keysym); if (xfi->fullscreen_toggle && xf_kbd_handle_special_keys(xfi, keysym)) - return true; + return TRUE; - xf_kbd_send_key(xfi, true, event->xkey.keycode); + xf_kbd_send_key(xfi, TRUE, event->xkey.keycode); - return true; + return TRUE; } -static boolean xf_event_KeyRelease(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_KeyRelease(xfInfo* xfi, XEvent* event, BOOL app) { XEvent next_event; @@ -364,29 +364,29 @@ static boolean xf_event_KeyRelease(xfInfo* xfi, XEvent* event, boolean app) if (next_event.type == KeyPress) { if (next_event.xkey.keycode == event->xkey.keycode) - return true; + return TRUE; } } xf_kbd_unset_keypress(xfi, event->xkey.keycode); - xf_kbd_send_key(xfi, false, event->xkey.keycode); + xf_kbd_send_key(xfi, FALSE, event->xkey.keycode); - return true; + return TRUE; } -static boolean xf_event_FocusIn(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_FocusIn(xfInfo* xfi, XEvent* event, BOOL app) { if (event->xfocus.mode == NotifyGrab) - return true; + return TRUE; - xfi->focused = true; + xfi->focused = TRUE; - if (xfi->mouse_active && (app != true)) - XGrabKeyboard(xfi->display, xfi->window->handle, true, GrabModeAsync, GrabModeAsync, CurrentTime); + if (xfi->mouse_active && (app != TRUE)) + XGrabKeyboard(xfi->display, xfi->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime); if (app) { - xf_rail_send_activate(xfi, event->xany.window, true); + xf_rail_send_activate(xfi, event->xany.window, TRUE); rdpWindow* window; rdpRail* rail = ((rdpContext*) xfi->context)->rail; @@ -399,18 +399,18 @@ static boolean xf_event_FocusIn(xfInfo* xfi, XEvent* event, boolean app) } xf_kbd_focus_in(xfi); - if (app != true) + if (app != TRUE) xf_cliprdr_check_owner(xfi); - return true; + return TRUE; } -static boolean xf_event_FocusOut(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_FocusOut(xfInfo* xfi, XEvent* event, BOOL app) { if (event->xfocus.mode == NotifyUngrab) - return true; + return TRUE; - xfi->focused = false; + xfi->focused = FALSE; if (event->xfocus.mode == NotifyWhileGrabbed) XUngrabKeyboard(xfi->display, CurrentTime); @@ -418,12 +418,12 @@ static boolean xf_event_FocusOut(xfInfo* xfi, XEvent* event, boolean app) xf_kbd_clear(xfi); if (app) - xf_rail_send_activate(xfi, event->xany.window, false); + xf_rail_send_activate(xfi, event->xany.window, FALSE); - return true; + return TRUE; } -static boolean xf_event_MappingNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_MappingNotify(xfInfo* xfi, XEvent* event, BOOL app) { if (event->xmapping.request == MappingModifier) { @@ -431,10 +431,10 @@ static boolean xf_event_MappingNotify(xfInfo* xfi, XEvent* event, boolean app) xfi->modifier_map = XGetModifierMapping(xfi->display); } - return true; + return TRUE; } -static boolean xf_event_ClientMessage(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_ClientMessage(xfInfo* xfi, XEvent* event, BOOL app) { if ((event->xclient.message_type == xfi->WM_PROTOCOLS) && ((Atom) event->xclient.data.l[0] == xfi->WM_DELETE_WINDOW)) @@ -452,29 +452,29 @@ static boolean xf_event_ClientMessage(xfInfo* xfi, XEvent* event, boolean app) xf_rail_send_client_system_command(xfi, window->windowId, SC_CLOSE); } - return true; + return TRUE; } else { DEBUG_X11("Main window closed"); - return false; + return FALSE; } } - return true; + return TRUE; } -static boolean xf_event_EnterNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_EnterNotify(xfInfo* xfi, XEvent* event, BOOL app) { - if (app != true) + if (app != TRUE) { - xfi->mouse_active = true; + xfi->mouse_active = TRUE; if (xfi->fullscreen) XSetInputFocus(xfi->display, xfi->window->handle, RevertToPointerRoot, CurrentTime); if (xfi->focused) - XGrabKeyboard(xfi->display, xfi->window->handle, true, GrabModeAsync, GrabModeAsync, CurrentTime); + XGrabKeyboard(xfi->display, xfi->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime); } else { @@ -492,21 +492,21 @@ static boolean xf_event_EnterNotify(xfInfo* xfi, XEvent* event, boolean app) } } - return true; + return TRUE; } -static boolean xf_event_LeaveNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_LeaveNotify(xfInfo* xfi, XEvent* event, BOOL app) { - if (app != true) + if (app != TRUE) { - xfi->mouse_active = false; + xfi->mouse_active = FALSE; XUngrabKeyboard(xfi->display, CurrentTime); } - return true; + return TRUE; } -static boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, BOOL app) { rdpWindow* window; rdpRail* rail = ((rdpContext*) xfi->context)->rail; @@ -534,7 +534,7 @@ static boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app) xfw->bottom = xfw->top + xfw->height - 1; DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%u h=%u send_event=%d", - (uint32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom, + (UINT32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom, xfw->width, xfw->height, event->xconfigure.send_event); /* additonal checks for not in a local move and not ignoring configure to send @@ -564,18 +564,18 @@ static boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app) return True; } -static boolean xf_event_MapNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_MapNotify(xfInfo* xfi, XEvent* event, BOOL app) { RECTANGLE_16 rect; rdpWindow* window; rdpUpdate* update = xfi->instance->update; rdpRail* rail = ((rdpContext*) xfi->context)->rail; - if (app != true) + if (app != TRUE) { - if (xfi->suppress_output == true) + if (xfi->suppress_output == TRUE) { - xfi->suppress_output = false; + xfi->suppress_output = FALSE; rect.left = 0; rect.top = 0; rect.right = xfi->width; @@ -595,14 +595,14 @@ static boolean xf_event_MapNotify(xfInfo* xfi, XEvent* event, boolean app) //that is minimized back to the maximized state //xf_rail_send_client_system_command(xfi, window->windowId, SC_RESTORE); xfWindow *xfw = (xfWindow*) window->extra; - xfw->is_mapped = true; + xfw->is_mapped = TRUE; } } - return true; + return TRUE; } -static boolean xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, BOOL app) { rdpWindow* window; rdpUpdate* update = xfi->instance->update; @@ -610,11 +610,11 @@ static boolean xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, boolean app) xf_kbd_release_all_keypress(xfi); - if (app != true) + if (app != TRUE) { - if (xfi->suppress_output == false) + if (xfi->suppress_output == FALSE) { - xfi->suppress_output = true; + xfi->suppress_output = TRUE; update->SuppressOutput((rdpContext*) xfi->context, 0, NULL); } } @@ -625,68 +625,68 @@ static boolean xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, boolean app) if (window != NULL) { xfWindow *xfw = (xfWindow*) window->extra; - xfw->is_mapped = false; + xfw->is_mapped = FALSE; } } - return true; + return TRUE; } -static boolean xf_event_SelectionNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_SelectionNotify(xfInfo* xfi, XEvent* event, BOOL app) { - if (app != true) + if (app != TRUE) { if (xf_cliprdr_process_selection_notify(xfi, event)) - return true; + return TRUE; } - return true; + return TRUE; } -static boolean xf_event_SelectionRequest(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_SelectionRequest(xfInfo* xfi, XEvent* event, BOOL app) { - if (app != true) + if (app != TRUE) { if (xf_cliprdr_process_selection_request(xfi, event)) - return true; + return TRUE; } - return true; + return TRUE; } -static boolean xf_event_SelectionClear(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_SelectionClear(xfInfo* xfi, XEvent* event, BOOL app) { - if (app != true) + if (app != TRUE) { if (xf_cliprdr_process_selection_clear(xfi, event)) - return true; + return TRUE; } - return true; + return TRUE; } -static boolean xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, boolean app) +static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app) { //This section handles sending the appropriate commands to the rail server //when the window has been minimized, maximized, restored locally //ie. not using the buttons on the rail window itself - if (app == true) + if (app == TRUE) { rdpWindow* window; window = xf_rdpWindowFromWindow(xfi, event->xproperty.window); if (window == NULL) { - return true; + return TRUE; } if ((((Atom)event->xproperty.atom == xfi->_NET_WM_STATE) && (event->xproperty.state != PropertyDelete)) || (((Atom)event->xproperty.atom == xfi->WM_STATE) && (event->xproperty.state != PropertyDelete))) { - boolean status; - boolean maxVert = false; - boolean maxHorz = false; - boolean minimized = false; + BOOL status; + BOOL maxVert = FALSE; + BOOL maxHorz = FALSE; + BOOL minimized = FALSE; unsigned long nitems; unsigned long bytes; unsigned char* prop; @@ -695,20 +695,20 @@ static boolean xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, boolean app) status = xf_GetWindowProperty(xfi, event->xproperty.window, xfi->_NET_WM_STATE, 12, &nitems, &bytes, &prop); - if (status != true) { + if (status != TRUE) { DEBUG_X11_LMS("No return _NET_WM_STATE, window is not maximized"); } for (i=0;idisplay, "_NET_WM_STATE_MAXIMIZED_VERT", False)) + if ((Atom) ((UINT16 **) prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_VERT", False)) { - maxVert = true; + maxVert = TRUE; } - if ((Atom) ((uint16 **)prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False)) + if ((Atom) ((UINT16 **)prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False)) { - maxHorz = true; + maxHorz = TRUE; } } @@ -717,18 +717,18 @@ static boolean xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, boolean app) status = xf_GetWindowProperty(xfi, event->xproperty.window, xfi->WM_STATE, 1, &nitems, &bytes, &prop); - if (status != true) { + if (status != TRUE) { DEBUG_X11_LMS("No return WM_STATE, window is not minimized"); } else { //If the window is in the iconic state - if (((uint32) *prop == 3)) + if (((UINT32) *prop == 3)) { - minimized = true; + minimized = TRUE; } else - minimized = false; + minimized = FALSE; XFree(prop); } @@ -756,19 +756,19 @@ static boolean xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, boolean app) } - if (app != true) + if (app != TRUE) { if (xf_cliprdr_process_property_notify(xfi, event)) - return true; + return TRUE; } - return true; + return TRUE; } -static boolean xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*event) +static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*event) { if (! xfi->remote_app) - return false; + return FALSE; switch (xfi->window->local_move.state) { @@ -779,8 +779,8 @@ static boolean xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*e if ( (event->type == ConfigureNotify) && xfi->window->rail_ignore_configure) { DEBUG_X11_LMS("ConfigureNotify Event Ignored"); - xfi->window->rail_ignore_configure = false; - return true; + xfi->window->rail_ignore_configure = FALSE; + return TRUE; } break; @@ -817,7 +817,7 @@ static boolean xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*e break; default: // Eat any other events - return true; + return TRUE; } break; @@ -846,13 +846,13 @@ static boolean xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*e break; } - return false; + return FALSE; } -boolean xf_event_process(freerdp* instance, XEvent* event) +BOOL xf_event_process(freerdp* instance, XEvent* event) { - boolean status = true; + BOOL status = TRUE; xfInfo* xfi = ((xfContext*) instance->context)->xfi; rdpRail* rail = ((rdpContext*) xfi->context)->rail; rdpWindow* window; @@ -867,12 +867,12 @@ boolean xf_event_process(freerdp* instance, XEvent* event) xfi->window = (xfWindow *) window->extra; if (xf_event_suppress_events(xfi, window, event)) - return true; + return TRUE; } } if (event->type != MotionNotify) - DEBUG_X11("%s Event(%d): wnd=0x%04X", X11_EVENT_STRINGS[event->type], event->type, (uint32) event->xany.window); + DEBUG_X11("%s Event(%d): wnd=0x%04X", X11_EVENT_STRINGS[event->type], event->type, (UINT32) event->xany.window); switch (event->type) { diff --git a/client/X11/xf_event.h b/client/X11/xf_event.h index c6938b382..f0ef8da57 100644 --- a/client/X11/xf_event.h +++ b/client/X11/xf_event.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Event Handling * * Copyright 2011 Marc-Andre Moreau @@ -24,7 +24,7 @@ #include "xfreerdp.h" -boolean xf_event_process(freerdp* instance, XEvent* event); +BOOL xf_event_process(freerdp* instance, XEvent* event); void xf_event_SendClientEvent(xfInfo *xfi, xfWindow* window, Atom atom, unsigned int numArgs, ...); #endif /* __XF_EVENT_H */ diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c index 462465e37..d36eb6f5c 100644 --- a/client/X11/xf_gdi.c +++ b/client/X11/xf_gdi.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 GDI * * Copyright 2011 Marc-Andre Moreau @@ -34,7 +34,7 @@ #include "xf_gdi.h" -static const uint8 xf_rop2_table[] = +static const BYTE xf_rop2_table[] = { 0, GXclear, /* 0 */ @@ -55,19 +55,19 @@ static const uint8 xf_rop2_table[] = GXset /* 1 */ }; -boolean xf_set_rop2(xfInfo* xfi, int rop2) +BOOL xf_set_rop2(xfInfo* xfi, int rop2) { if ((rop2 < 0x01) || (rop2 > 0x10)) { printf("Unsupported ROP2: %d\n", rop2); - return false; + return FALSE; } XSetFunction(xfi->display, xfi->gc, xf_rop2_table[rop2]); - return true; + return TRUE; } -boolean xf_set_rop3(xfInfo* xfi, int rop3) +BOOL xf_set_rop3(xfInfo* xfi, int rop3) { int function = -1; @@ -197,18 +197,18 @@ boolean xf_set_rop3(xfInfo* xfi, int rop3) { printf("Unsupported ROP3: 0x%08X\n", rop3); XSetFunction(xfi->display, xfi->gc, GXclear); - return false; + return FALSE; } XSetFunction(xfi->display, xfi->gc, function); - return true; + return TRUE; } -Pixmap xf_brush_new(xfInfo* xfi, int width, int height, int bpp, uint8* data) +Pixmap xf_brush_new(xfInfo* xfi, int width, int height, int bpp, BYTE* data) { Pixmap bitmap; - uint8* cdata; + BYTE* cdata; XImage* image; bitmap = XCreatePixmap(xfi->display, xfi->drawable, width, height, xfi->depth); @@ -227,7 +227,7 @@ Pixmap xf_brush_new(xfInfo* xfi, int width, int height, int bpp, uint8* data) XFree(image); if (cdata != data) - xfree(cdata); + free(cdata); XFreeGC(xfi->display, gc); } @@ -235,7 +235,7 @@ Pixmap xf_brush_new(xfInfo* xfi, int width, int height, int bpp, uint8* data) return bitmap; } -Pixmap xf_mono_bitmap_new(xfInfo* xfi, int width, int height, uint8* data) +Pixmap xf_mono_bitmap_new(xfInfo* xfi, int width, int height, BYTE* data) { int scanline; XImage* image; @@ -254,7 +254,7 @@ Pixmap xf_mono_bitmap_new(xfInfo* xfi, int width, int height, uint8* data) return bitmap; } -Pixmap xf_glyph_new(xfInfo* xfi, int width, int height, uint8* data) +Pixmap xf_glyph_new(xfInfo* xfi, int width, int height, BYTE* data) { int scanline; Pixmap bitmap; @@ -316,7 +316,7 @@ void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt) if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XFillRectangle(xfi->display, xfi->drawable, xfi->gc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); @@ -331,8 +331,8 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) { Pixmap pattern; rdpBrush* brush; - uint32 foreColor; - uint32 backColor; + UINT32 foreColor; + UINT32 backColor; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; @@ -392,7 +392,7 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) { XSetFunction(xfi->display, xfi->gc, GXcopy); - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight, patblt->nLeftRect, patblt->nTopRect); @@ -415,7 +415,7 @@ void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt) if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { if (xfi->unobscured) { @@ -440,7 +440,7 @@ void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt) void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { - uint32 color; + UINT32 color; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; @@ -456,7 +456,7 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XFillRectangle(xfi->display, xfi->drawable, xfi->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); @@ -470,7 +470,7 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect) { int i; - uint32 color; + UINT32 color; DELTA_RECT* rectangle; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; @@ -491,7 +491,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XFillRectangle(xfi->display, xfi->drawable, xfi->gc, rectangle->left, rectangle->top, rectangle->width, rectangle->height); @@ -509,7 +509,7 @@ void xf_gdi_draw_nine_grid(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) { - uint32 color; + UINT32 color; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; @@ -526,7 +526,7 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) { int width, height; - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XDrawLine(xfi->display, xfi->drawable, xfi->gc, line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); @@ -555,7 +555,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) int x1, y1; int x2, y2; int npoints; - uint32 color; + UINT32 color; XPoint* points; int width, height; xfContext* context_ = (xfContext*) context; @@ -568,7 +568,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) XSetForeground(xfi->display, xfi->gc, color); npoints = polyline->numPoints + 1; - points = xmalloc(sizeof(XPoint) * npoints); + points = malloc(sizeof(XPoint) * npoints); points[0].x = polyline->xStart; points[0].y = polyline->yStart; @@ -583,7 +583,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) XDrawLines(xfi->display, xfi->drawable, xfi->gc, points, npoints, CoordModePrevious); x1 = points[0].x; @@ -608,7 +608,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) } XSetFunction(xfi->display, xfi->gc, GXcopy); - xfree(points); + free(points); } void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) @@ -625,7 +625,7 @@ void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XCopyArea(xfi->display, bitmap->pixmap, xfi->drawable, xfi->gc, memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight, @@ -642,8 +642,8 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) { rdpBrush* brush; xfBitmap* bitmap; - uint32 foreColor; - uint32 backColor; + UINT32 foreColor; + UINT32 backColor; Pixmap pattern = 0; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; @@ -694,7 +694,7 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XCopyArea(xfi->display, bitmap->pixmap, xfi->drawable, xfi->gc, mem3blt->nXSrc, mem3blt->nYSrc, mem3blt->nWidth, mem3blt->nHeight, @@ -717,14 +717,14 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc) { int i, npoints; XPoint* points; - uint32 brush_color; + UINT32 brush_color; xfInfo* xfi = ((xfContext*) context)->xfi; xf_set_rop2(xfi, polygon_sc->bRop2); brush_color = freerdp_color_convert_var(polygon_sc->brushColor, ((xfContext*)context)->settings->color_depth, xfi->bpp, xfi->clrconv); npoints = polygon_sc->numPoints + 1; - points = xmalloc(sizeof(XPoint) * npoints); + points = malloc(sizeof(XPoint) * npoints); points[0].x = polygon_sc->xStart; points[0].y = polygon_sc->yStart; @@ -763,7 +763,7 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc) } XSetFunction(xfi->display, xfi->gc, GXcopy); - xfree(points); + free(points); } void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) @@ -772,8 +772,8 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) XPoint* points; Pixmap pattern; rdpBrush* brush; - uint32 foreColor; - uint32 backColor; + UINT32 foreColor; + UINT32 backColor; xfInfo* xfi = ((xfContext*) context)->xfi; brush = &(polygon_cb->brush); @@ -782,7 +782,7 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) backColor = freerdp_color_convert_rgb(polygon_cb->backColor, ((xfContext*)context)->settings->color_depth, xfi->bpp, xfi->clrconv); npoints = polygon_cb->numPoints + 1; - points = xmalloc(sizeof(XPoint) * npoints); + points = malloc(sizeof(XPoint) * npoints); points[0].x = polygon_cb->xStart; points[0].y = polygon_cb->yStart; @@ -866,7 +866,7 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) } XSetFunction(xfi->display, xfi->gc, GXcopy); - xfree(points); + free(points); } void xf_gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc) @@ -886,7 +886,7 @@ void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surf switch (surface_frame_marker->frameAction) { case SURFACECMD_FRAMEACTION_BEGIN: - xfi->frame_begin = true; + xfi->frame_begin = TRUE; xfi->frame_x1 = 0; xfi->frame_y1 = 0; xfi->frame_x2 = 0; @@ -894,7 +894,7 @@ void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surf break; case SURFACECMD_FRAMEACTION_END: - xfi->frame_begin = false; + xfi->frame_begin = FALSE; if (xfi->frame_x2 > xfi->frame_x1 && xfi->frame_y2 > xfi->frame_y1) { XSetFunction(xfi->display, xfi->gc, GXcopy); @@ -911,9 +911,9 @@ void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surf } } -static void xf_gdi_surface_update_frame(xfInfo* xfi, uint16 tx, uint16 ty, uint16 width, uint16 height) +static void xf_gdi_surface_update_frame(xfInfo* xfi, UINT16 tx, UINT16 ty, UINT16 width, UINT16 height) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { if (xfi->frame_begin) { @@ -998,7 +998,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFillStyle(xfi->display, xfi->gc, FillSolid); - xfi->bmp_codec_nsc = (uint8*) xrealloc(xfi->bmp_codec_nsc, + xfi->bmp_codec_nsc = (BYTE*) realloc(xfi->bmp_codec_nsc, surface_bits_command->width * surface_bits_command->height * 4); freerdp_image_flip(nsc_context->bmpdata, xfi->bmp_codec_nsc, @@ -1026,7 +1026,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits /* Validate that the data received is large enough */ if( surface_bits_command->width * surface_bits_command->height * surface_bits_command->bpp / 8 <= surface_bits_command->bitmapDataLength ) { - xfi->bmp_codec_none = (uint8*) xrealloc(xfi->bmp_codec_none, + xfi->bmp_codec_none = (BYTE*) realloc(xfi->bmp_codec_none, surface_bits_command->width * surface_bits_command->height * 4); freerdp_image_flip(surface_bits_command->bitmapData, xfi->bmp_codec_none, diff --git a/client/X11/xf_gdi.h b/client/X11/xf_gdi.h index 635e5335d..2a30b8965 100644 --- a/client/X11/xf_gdi.h +++ b/client/X11/xf_gdi.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 GDI * * Copyright 2011 Marc-Andre Moreau diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index 58c94e366..f39aea11e 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Graphical Objects * * Copyright 2011 Marc-Andre Moreau @@ -38,7 +38,7 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap) { - uint8* data; + BYTE* data; Pixmap pixmap; XImage* image; xfContext* context_ = (xfContext*) context; @@ -52,7 +52,7 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap) data = freerdp_image_convert(bitmap->data, NULL, bitmap->width, bitmap->height, context_->settings->color_depth, xfi->bpp, xfi->clrconv); - if (bitmap->ephemeral != true) + if (bitmap->ephemeral != TRUE) { image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0, (char*) data, bitmap->width, bitmap->height, xfi->scanline_pad, 0); @@ -61,12 +61,12 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap) XFree(image); if (data != bitmap->data) - xfree(data); + free(data); } else { if (data != bitmap->data) - xfree(bitmap->data); + free(bitmap->data); bitmap->data = data; } @@ -102,7 +102,7 @@ void xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) XFree(image); - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc, bitmap->left, bitmap->top, width, height, bitmap->left, bitmap->top); @@ -112,24 +112,24 @@ void xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) } void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, - uint8* data, int width, int height, int bpp, int length, - boolean compressed, int codec_id) + BYTE* data, int width, int height, int bpp, int length, + BOOL compressed, int codec_id) { - uint16 size; + UINT16 size; RFX_MESSAGE* msg; - uint8* src; - uint8* dst; + BYTE* src; + BYTE* dst; int yindex; int xindex; xfInfo* xfi; - boolean status; + BOOL status; size = width * height * (bpp + 7) / 8; if (bitmap->data == NULL) - bitmap->data = (uint8*) xmalloc(size); + bitmap->data = (BYTE*) malloc(size); else - bitmap->data = (uint8*) xrealloc(bitmap->data, size); + bitmap->data = (BYTE*) realloc(bitmap->data, size); switch (codec_id) { @@ -172,7 +172,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, { status = bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); - if (status == false) + if (status == FALSE) { printf("xf_Bitmap_Decompress: Bitmap Decompression Failed\n"); } @@ -184,12 +184,12 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, break; } - bitmap->compressed = false; + bitmap->compressed = FALSE; bitmap->length = size; bitmap->bpp = bpp; } -void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean primary) +void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { xfInfo* xfi = ((xfContext*) context)->xfi; @@ -217,12 +217,12 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer) if ((pointer->andMaskData != 0) && (pointer->xorMaskData != 0)) { - freerdp_alpha_cursor_convert((uint8*) (ci.pixels), pointer->xorMaskData, pointer->andMaskData, + freerdp_alpha_cursor_convert((BYTE*) (ci.pixels), pointer->xorMaskData, pointer->andMaskData, pointer->width, pointer->height, pointer->xorBpp, xfi->clrconv); } ((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfi->display, &ci); - xfree(ci.pixels); + free(ci.pixels); } void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer) @@ -320,7 +320,7 @@ void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y) XSetStipple(xfi->display, xfi->gc, xfi->bitmap_mono); } -void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor) +void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) { xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; @@ -343,13 +343,13 @@ void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height XSetFillStyle(xfi->display, xfi->gc, FillStippled); } -void xf_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor) +void xf_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) { xfInfo* xfi = ((xfContext*) context)->xfi; if (xfi->drawing == xfi->primary) { - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc, x, y, width, height, x, y); } @@ -376,7 +376,7 @@ void xf_register_graphics(rdpGraphics* graphics) bitmap->SetSurface = xf_Bitmap_SetSurface; graphics_register_bitmap(graphics, bitmap); - xfree(bitmap); + free(bitmap); pointer = xnew(rdpPointer); pointer->size = sizeof(xfPointer); @@ -388,7 +388,7 @@ void xf_register_graphics(rdpGraphics* graphics) pointer->SetDefault = xf_Pointer_SetDefault; graphics_register_pointer(graphics, pointer); - xfree(pointer); + free(pointer); glyph = xnew(rdpGlyph); glyph->size = sizeof(xfGlyph); @@ -400,5 +400,5 @@ void xf_register_graphics(rdpGraphics* graphics) glyph->EndDraw = xf_Glyph_EndDraw; graphics_register_glyph(graphics, glyph); - xfree(glyph); + free(glyph); } diff --git a/client/X11/xf_graphics.h b/client/X11/xf_graphics.h index 14216f330..b9256a86c 100644 --- a/client/X11/xf_graphics.h +++ b/client/X11/xf_graphics.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Graphical Objects * * Copyright 2011 Marc-Andre Moreau diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 0840f5ef5..ccd927b63 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Keyboard Handling * * Copyright 2011 Marc-Andre Moreau @@ -40,10 +40,10 @@ void xf_kbd_init(xfInfo* xfi) void xf_kbd_clear(xfInfo* xfi) { - memset(xfi->pressed_keys, 0, 256 * sizeof(boolean)); + memset(xfi->pressed_keys, 0, 256 * sizeof(BOOL)); } -void xf_kbd_set_keypress(xfInfo* xfi, uint8 keycode, KeySym keysym) +void xf_kbd_set_keypress(xfInfo* xfi, BYTE keycode, KeySym keysym) { if (keycode >= 8) xfi->pressed_keys[keycode] = keysym; @@ -51,7 +51,7 @@ void xf_kbd_set_keypress(xfInfo* xfi, uint8 keycode, KeySym keysym) return; } -void xf_kbd_unset_keypress(xfInfo* xfi, uint8 keycode) +void xf_kbd_unset_keypress(xfInfo* xfi, BYTE keycode) { if (keycode >= 8) xfi->pressed_keys[keycode] = NoSymbol; @@ -69,19 +69,19 @@ void xf_kbd_release_all_keypress(xfInfo* xfi) if (xfi->pressed_keys[keycode] != NoSymbol) { rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode); - freerdp_input_send_keyboard_event_ex(xfi->instance->input, false, rdp_scancode); + freerdp_input_send_keyboard_event_ex(xfi->instance->input, FALSE, rdp_scancode); xfi->pressed_keys[keycode] = NoSymbol; } } } -boolean xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym) +BOOL xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym) { KeyCode keycode = XKeysymToKeycode(xfi->display, keysym); return (xfi->pressed_keys[keycode] == keysym); } -void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode) +void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode) { RDP_SCANCODE rdp_scancode; rdpInput* input; @@ -99,19 +99,19 @@ void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode) /* Pause without Ctrl has to be sent as Ctrl + NumLock. */ if (down) { - freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_LCONTROL); - freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_NUMLOCK); - freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_LCONTROL); - freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_NUMLOCK); + freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_LCONTROL); + freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_NUMLOCK); + freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_LCONTROL); + freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_NUMLOCK); } } else { freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode); - if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == false)) + if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == FALSE)) { - uint32 syncFlags; + UINT32 syncFlags; syncFlags = xf_kbd_get_toggle_keys_state(xfi); input->SynchronizeEvent(input, syncFlags); } @@ -122,9 +122,9 @@ int xf_kbd_read_keyboard_state(xfInfo* xfi) { int dummy; Window wdummy; - uint32 state = 0; + UINT32 state = 0; - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { XQueryPointer(xfi->display, xfi->window->handle, &wdummy, &wdummy, &dummy, &dummy, &dummy, &dummy, &state); @@ -137,14 +137,14 @@ int xf_kbd_read_keyboard_state(xfInfo* xfi) return state; } -boolean xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym) +BOOL xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym) { int offset; int modifierpos, key, keysymMask = 0; KeyCode keycode = XKeysymToKeycode(xfi->display, keysym); if (keycode == NoSymbol) - return false; + return FALSE; for (modifierpos = 0; modifierpos < 8; modifierpos++) { @@ -158,7 +158,7 @@ boolean xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym) } } - return (state & keysymMask) ? true : false; + return (state & keysymMask) ? TRUE : FALSE; } int xf_kbd_get_toggle_keys_state(xfInfo* xfi) @@ -182,7 +182,7 @@ int xf_kbd_get_toggle_keys_state(xfInfo* xfi) void xf_kbd_focus_in(xfInfo* xfi) { rdpInput* input; - uint32 syncFlags; + UINT32 syncFlags; input = xfi->instance->input; @@ -194,7 +194,7 @@ void xf_kbd_focus_in(xfInfo* xfi) input->SynchronizeEvent(input, syncFlags); } -boolean xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym) +BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym) { if (keysym == XK_Return) { @@ -203,10 +203,10 @@ boolean xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym) { /* Ctrl-Alt-Enter: toggle full screen */ xf_toggle_fullscreen(xfi); - return true; + return TRUE; } } - return false; + return FALSE; } diff --git a/client/X11/xf_keyboard.h b/client/X11/xf_keyboard.h index 2250783b9..ec90e31c6 100644 --- a/client/X11/xf_keyboard.h +++ b/client/X11/xf_keyboard.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Keyboard Handling * * Copyright 2011 Marc-Andre Moreau @@ -26,15 +26,15 @@ void xf_kbd_init(xfInfo* xfi); void xf_kbd_clear(xfInfo* xfi); -void xf_kbd_set_keypress(xfInfo* xfi, uint8 keycode, KeySym keysym); -void xf_kbd_unset_keypress(xfInfo* xfi, uint8 keycode); +void xf_kbd_set_keypress(xfInfo* xfi, BYTE keycode, KeySym keysym); +void xf_kbd_unset_keypress(xfInfo* xfi, BYTE keycode); void xf_kbd_release_all_keypress(xfInfo* xfi); -boolean xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym); -void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode); +BOOL xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym); +void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode); int xf_kbd_read_keyboard_state(xfInfo* xfi); -boolean xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym); +BOOL xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym); int xf_kbd_get_toggle_keys_state(xfInfo* xfi); void xf_kbd_focus_in(xfInfo* xfi); -boolean xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym); +BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym); #endif /* __XF_KEYBOARD_H */ diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index 14ce09ab5..8d07b7126 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Monitor Handling * * Copyright 2011 Marc-Andre Moreau @@ -35,7 +35,7 @@ /* See MSDN Section on Multiple Display Monitors: http://msdn.microsoft.com/en-us/library/dd145071 */ -boolean xf_detect_monitors(xfInfo* xfi, rdpSettings* settings) +BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings) { int i; VIRTUAL_SCREEN* vscreen; @@ -47,7 +47,7 @@ boolean xf_detect_monitors(xfInfo* xfi, rdpSettings* settings) vscreen = &xfi->vscreen; - if (xf_GetWorkArea(xfi) != true) + if (xf_GetWorkArea(xfi) != TRUE) { xfi->workArea.x = 0; xfi->workArea.y = 0; @@ -71,8 +71,8 @@ boolean xf_detect_monitors(xfInfo* xfi, rdpSettings* settings) settings->height = (xfi->workArea.height * settings->percent_screen) / 100; } - if (settings->fullscreen != true && settings->workarea != true) - return true; + if (settings->fullscreen != TRUE && settings->workarea != TRUE) + return TRUE; #ifdef WITH_XINERAMA if (XineramaQueryExtension(xfi->display, &ignored, &ignored2)) @@ -96,7 +96,7 @@ boolean xf_detect_monitors(xfInfo* xfi, rdpSettings* settings) vscreen->monitors[i].area.bottom = screen_info[i].y_org + screen_info[i].height - 1; if ((screen_info[i].x_org == 0) && (screen_info[i].y_org == 0)) - vscreen->monitors[i].primary = true; + vscreen->monitors[i].primary = TRUE; } } @@ -137,5 +137,5 @@ boolean xf_detect_monitors(xfInfo* xfi, rdpSettings* settings) settings->height = vscreen->area.bottom - vscreen->area.top + 1; } - return true; + return TRUE; } diff --git a/client/X11/xf_monitor.h b/client/X11/xf_monitor.h index d6b7d6dd8..42196f1da 100644 --- a/client/X11/xf_monitor.h +++ b/client/X11/xf_monitor.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Monitor Handling * * Copyright 2011 Marc-Andre Moreau @@ -27,7 +27,7 @@ struct _MONITOR_INFO { RECTANGLE_16 area; RECTANGLE_16 workarea; - boolean primary; + BOOL primary; }; typedef struct _MONITOR_INFO MONITOR_INFO; @@ -42,6 +42,6 @@ typedef struct _VIRTUAL_SCREEN VIRTUAL_SCREEN; #include "xfreerdp.h" -boolean xf_detect_monitors(xfInfo* xfi, rdpSettings* settings); +BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings); #endif /* __XF_MONITOR_H */ diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index daeef3196..636d2f959 100644 --- a/client/X11/xf_rail.c +++ b/client/X11/xf_rail.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 RAIL * * Copyright 2011 Marc-Andre Moreau @@ -34,9 +34,9 @@ void xf_rail_enable_remoteapp_mode(xfInfo* xfi) { - if (xfi->remote_app == false) + if (xfi->remote_app == FALSE) { - xfi->remote_app = true; + xfi->remote_app = TRUE; xfi->drawable = DefaultRootWindow(xfi->display); xf_DestroyWindow(xfi, xfi->window); xfi->window = NULL; @@ -45,23 +45,23 @@ void xf_rail_enable_remoteapp_mode(xfInfo* xfi) void xf_rail_disable_remoteapp_mode(xfInfo* xfi) { - if (xfi->remote_app == true) + if (xfi->remote_app == TRUE) { - xfi->remote_app = false; + xfi->remote_app = FALSE; xf_create_window(xfi); } } -void xf_rail_paint(xfInfo* xfi, rdpRail* rail, sint32 uleft, sint32 utop, uint32 uright, uint32 ubottom) +void xf_rail_paint(xfInfo* xfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom) { xfWindow* xfw; rdpWindow* window; - boolean intersect; - uint32 iwidth, iheight; - sint32 ileft, itop; - uint32 iright, ibottom; - sint32 wleft, wtop; - uint32 wright, wbottom; + BOOL intersect; + UINT32 iwidth, iheight; + INT32 ileft, itop; + UINT32 iright, ibottom; + INT32 wleft, wtop; + UINT32 wright, wbottom; window_list_rewind(rail->list); @@ -90,7 +90,7 @@ void xf_rail_paint(xfInfo* xfi, rdpRail* rail, sint32 uleft, sint32 utop, uint32 iwidth = iright - ileft + 1; iheight = ibottom - itop + 1; - intersect = ((iright > ileft) && (ibottom > itop)) ? true : false; + intersect = ((iright > ileft) && (ibottom > itop)) ? TRUE : FALSE; if (intersect) { @@ -162,7 +162,7 @@ static void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window) window->windowWidth, window->windowHeight); } -static void xf_rail_ShowWindow(rdpRail* rail, rdpWindow* window, uint8 state) +static void xf_rail_ShowWindow(rdpRail* rail, rdpWindow* window, BYTE state) { xfInfo* xfi; xfWindow* xfw; @@ -249,7 +249,7 @@ static void xf_on_free_rail_client_event(RDP_EVENT* event) } } -static void xf_send_rail_client_event(rdpChannels* channels, uint16 event_type, void* param) +static void xf_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param) { RDP_EVENT* out_event = NULL; void * payload = NULL; @@ -263,7 +263,7 @@ static void xf_send_rail_client_event(rdpChannels* channels, uint16 event_type, } } -void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled) +void xf_rail_send_activate(xfInfo* xfi, Window xwindow, BOOL enabled) { rdpRail* rail; rdpChannels* channels; @@ -284,7 +284,7 @@ void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled) xf_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_ACTIVATE, &activate); } -void xf_rail_send_client_system_command(xfInfo* xfi, uint32 windowId, uint16 command) +void xf_rail_send_client_system_command(xfInfo* xfi, UINT32 windowId, UINT16 command) { rdpChannels* channels; RAIL_SYSCOMMAND_ORDER syscommand; @@ -325,8 +325,8 @@ void xf_rail_adjust_position(xfInfo* xfi, rdpWindow *window) //Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY, //we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when //attempting to adjust the rail window. - uint32 offsetX = 0; - uint32 offsetY = 0; + UINT32 offsetX = 0; + UINT32 offsetY = 0; if (window->windowOffsetX < 0) offsetX = offsetX - window->windowOffsetX; @@ -348,7 +348,7 @@ void xf_rail_adjust_position(xfInfo* xfi, rdpWindow *window) DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%u h=%u" " RDP=0x%X rc={l=%d t=%d} w=%d h=%d", - (uint32) xfw->handle, window_move.left, window_move.top, + (UINT32) xfw->handle, window_move.left, window_move.top, window_move.right, window_move.bottom, xfw->width, xfw->height, window->windowId, window->windowOffsetX, window->windowOffsetY, @@ -375,15 +375,15 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window) channels = xfi->_context->channels; DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d", - (uint32) xfw->handle, + (UINT32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom, xfw->width, xfw->height); //Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY, //we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when //attempting to adjust the rail window. - uint32 offsetX = 0; - uint32 offsetY = 0; + UINT32 offsetX = 0; + UINT32 offsetY = 0; if (window->windowOffsetX < 0) offsetX = offsetX - window->windowOffsetX; @@ -453,7 +453,7 @@ void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChannels* channels, RDP sysparam->taskbarPos.right = 0; sysparam->taskbarPos.bottom = 0; - sysparam->dragFullWindows = false; + sysparam->dragFullWindows = FALSE; xf_send_rail_client_event(channels, RDP_EVENT_TYPE_RAIL_CLIENT_SET_SYSPARAMS, sysparam); } @@ -518,7 +518,7 @@ void xf_process_rail_server_minmaxinfo_event(xfInfo* xfi, rdpChannels* channels, DEBUG_X11_LMS("windowId=0x%X maxWidth=%d maxHeight=%d maxPosX=%d maxPosY=%d " "minTrackWidth=%d minTrackHeight=%d maxTrackWidth=%d maxTrackHeight=%d", minmax->windowId, minmax->maxWidth, minmax->maxHeight, - (sint16)minmax->maxPosX, (sint16)minmax->maxPosY, + (INT16)minmax->maxPosX, (INT16)minmax->maxPosY, minmax->minTrackWidth, minmax->minTrackHeight, minmax->maxTrackWidth, minmax->maxTrackHeight); @@ -562,7 +562,7 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channe DEBUG_X11_LMS("windowId=0x%X isMoveSizeStart=%d moveSizeType=%s PosX=%d PosY=%d", movesize->windowId, movesize->isMoveSizeStart, - movetype_names[movesize->moveSizeType], (sint16) movesize->posX, (sint16) movesize->posY); + movetype_names[movesize->moveSizeType], (INT16) movesize->posX, (INT16) movesize->posY); switch (movesize->moveSizeType) { diff --git a/client/X11/xf_rail.h b/client/X11/xf_rail.h index 0c66e1caa..67c24791c 100644 --- a/client/X11/xf_rail.h +++ b/client/X11/xf_rail.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 RAIL * * Copyright 2011 Marc-Andre Moreau @@ -22,10 +22,10 @@ #include "xfreerdp.h" -void xf_rail_paint(xfInfo* xfi, rdpRail* rail, sint32 uleft, sint32 utop, uint32 uright, uint32 ubottom); +void xf_rail_paint(xfInfo* xfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom); void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail); -void xf_rail_send_client_system_command(xfInfo* xfi, uint32 windowId, uint16 command); -void xf_rail_send_activate(xfInfo* xfi, Window xwindow, boolean enabled); +void xf_rail_send_client_system_command(xfInfo* xfi, UINT32 windowId, UINT16 command); +void xf_rail_send_activate(xfInfo* xfi, Window xwindow, BOOL enabled); void xf_process_rail_event(xfInfo* xfi, rdpChannels* chanman, RDP_EVENT* event); void xf_rail_adjust_position(xfInfo* xfi, rdpWindow *window); void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window); diff --git a/client/X11/xf_tsmf.c b/client/X11/xf_tsmf.c index 61e5e4382..5e59dda5b 100644 --- a/client/X11/xf_tsmf.c +++ b/client/X11/xf_tsmf.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Video Redirection * * Copyright 2010-2011 Vic Lee @@ -35,7 +35,7 @@ #include #include -#include +#include #include "xf_tsmf.h" @@ -53,7 +53,7 @@ struct xf_xv_context int xv_image_size; int xv_shmid; char* xv_shmaddr; - uint32* xv_pixfmts; + UINT32* xv_pixfmts; }; #ifdef WITH_DEBUG_XV @@ -129,7 +129,7 @@ void xf_tsmf_init(xfInfo* xfi, long xv_port) { if (strcmp(attr[i].name, "XV_COLORKEY") == 0) { - xv->xv_colorkey_atom = XInternAtom(xfi->display, "XV_COLORKEY", false); + xv->xv_colorkey_atom = XInternAtom(xfi->display, "XV_COLORKEY", FALSE); XvSetPortAttribute(xfi->display, xv->xv_port, xv->xv_colorkey_atom, attr[i].min_value + 1); break; } @@ -142,7 +142,7 @@ void xf_tsmf_init(xfInfo* xfi, long xv_port) fo = XvListImageFormats(xfi->display, xv->xv_port, &ret); if (ret > 0) { - xv->xv_pixfmts = (uint32*) xzalloc((ret + 1) * sizeof(uint32)); + xv->xv_pixfmts = (UINT32*) xzalloc((ret + 1) * sizeof(UINT32)); for (i = 0; i < ret; i++) { xv->xv_pixfmts[i] = fo[i].id; @@ -172,39 +172,39 @@ void xf_tsmf_uninit(xfInfo* xfi) } if (xv->xv_pixfmts) { - xfree(xv->xv_pixfmts); + free(xv->xv_pixfmts); xv->xv_pixfmts = NULL; } - xfree(xv); + free(xv); xfi->xv_context = NULL; } } -static boolean -xf_tsmf_is_format_supported(xfXvContext* xv, uint32 pixfmt) +static BOOL +xf_tsmf_is_format_supported(xfXvContext* xv, UINT32 pixfmt) { int i; if (!xv->xv_pixfmts) - return false; + return FALSE; for (i = 0; xv->xv_pixfmts[i]; i++) { if (xv->xv_pixfmts[i] == pixfmt) - return true; + return TRUE; } - return false; + return FALSE; } static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT* vevent) { int i; - uint8* data1; - uint8* data2; - uint32 pixfmt; - uint32 xvpixfmt; - boolean converti420yv12 = false; + BYTE* data1; + BYTE* data2; + UINT32 pixfmt; + UINT32 xvpixfmt; + BOOL converti420yv12 = FALSE; XvImage * image; int colorkey = 0; XShmSegmentInfo shminfo; @@ -247,12 +247,12 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT else if (pixfmt == RDP_PIXFMT_I420 && xf_tsmf_is_format_supported(xv, RDP_PIXFMT_YV12)) { xvpixfmt = RDP_PIXFMT_YV12; - converti420yv12 = true; + converti420yv12 = TRUE; } else if (pixfmt == RDP_PIXFMT_YV12 && xf_tsmf_is_format_supported(xv, RDP_PIXFMT_I420)) { xvpixfmt = RDP_PIXFMT_I420; - converti420yv12 = true; + converti420yv12 = TRUE; } else { @@ -276,7 +276,7 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT } shminfo.shmid = xv->xv_shmid; shminfo.shmaddr = image->data = xv->xv_shmaddr; - shminfo.readOnly = false; + shminfo.readOnly = FALSE; if (!XShmAttach(xfi->display, &shminfo)) { @@ -309,7 +309,7 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT } /* UV */ /* Conversion between I420 and YV12 is to simply swap U and V */ - if (converti420yv12 == false) + if (converti420yv12 == FALSE) { data1 = vevent->frame_data + vevent->frame_width * vevent->frame_height; data2 = vevent->frame_data + vevent->frame_width * vevent->frame_height + @@ -353,10 +353,10 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT XvShmPutImage(xfi->display, xv->xv_port, xfi->window->handle, xfi->gc, image, 0, 0, image->width, image->height, - vevent->x, vevent->y, vevent->width, vevent->height, false); + vevent->x, vevent->y, vevent->width, vevent->height, FALSE); if (xv->xv_colorkey_atom == None) XSetClipMask(xfi->display, xfi->gc, None); - XSync(xfi->display, false); + XSync(xfi->display, FALSE); XShmDetach(xfi->display, &shminfo); XFree(image); diff --git a/client/X11/xf_tsmf.h b/client/X11/xf_tsmf.h index 09083e263..7e1ca3090 100644 --- a/client/X11/xf_tsmf.h +++ b/client/X11/xf_tsmf.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Video Redirection * * Copyright 2010-2011 Vic Lee diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 899242f2b..aa6070045 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Windows * * Copyright 2011 Marc-Andre Moreau @@ -117,50 +117,50 @@ void xf_SendClientEvent(xfInfo* xfi, xfWindow* window, Atom atom, unsigned int n va_end(argp); } -void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, boolean fullscreen) +void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, BOOL fullscreen) { if (fullscreen) { - xf_SetWindowDecorations(xfi, window, false); + xf_SetWindowDecorations(xfi, window, FALSE); XMoveResizeWindow(xfi->display, window->handle, 0, 0, window->width, window->height); XMapRaised(xfi->display, window->handle); - window->fullscreen = true; + window->fullscreen = TRUE; } } /* http://tronche.com/gui/x/xlib/window-information/XGetWindowProperty.html */ -boolean xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length, - unsigned long* nitems, unsigned long* bytes, uint8** prop) +BOOL xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length, + unsigned long* nitems, unsigned long* bytes, BYTE** prop) { int status; Atom actual_type; int actual_format; if (property == None) - return false; + return FALSE; status = XGetWindowProperty(xfi->display, window, - property, 0, length, false, AnyPropertyType, + property, 0, length, FALSE, AnyPropertyType, &actual_type, &actual_format, nitems, bytes, prop); if (status != Success) - return false; + return FALSE; if (actual_type == None) { DEBUG_WARN("Property %lu does not exist", property); - return false; + return FALSE; } - return true; + return TRUE; } -boolean xf_GetCurrentDesktop(xfInfo* xfi) +BOOL xf_GetCurrentDesktop(xfInfo* xfi) { - boolean status; + BOOL status; unsigned long nitems; unsigned long bytes; unsigned char* prop; @@ -168,38 +168,38 @@ boolean xf_GetCurrentDesktop(xfInfo* xfi) status = xf_GetWindowProperty(xfi, DefaultRootWindow(xfi->display), xfi->_NET_CURRENT_DESKTOP, 1, &nitems, &bytes, &prop); - if (status != true) { - return false; + if (status != TRUE) { + return FALSE; } xfi->current_desktop = (int) *prop; - xfree(prop); + free(prop); - return true; + return TRUE; } -boolean xf_GetWorkArea(xfInfo* xfi) +BOOL xf_GetWorkArea(xfInfo* xfi) { long* plong; - boolean status; + BOOL status; unsigned long nitems; unsigned long bytes; unsigned char* prop; status = xf_GetCurrentDesktop(xfi); - if (status != true) - return false; + if (status != TRUE) + return FALSE; status = xf_GetWindowProperty(xfi, DefaultRootWindow(xfi->display), xfi->_NET_WORKAREA, 32 * 4, &nitems, &bytes, &prop); - if (status != true) - return false; + if (status != TRUE) + return FALSE; if ((xfi->current_desktop * 4 + 3) >= nitems) { - xfree(prop); - return false; + free(prop); + return FALSE; } plong = (long*) prop; @@ -208,12 +208,12 @@ boolean xf_GetWorkArea(xfInfo* xfi) xfi->workArea.y = plong[xfi->current_desktop * 4 + 1]; xfi->workArea.width = plong[xfi->current_desktop * 4 + 2]; xfi->workArea.height = plong[xfi->current_desktop * 4 + 3]; - xfree(prop); + free(prop); - return true; + return TRUE; } -void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, boolean show) +void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, BOOL show) { PropMotifWmHints hints; @@ -224,7 +224,7 @@ void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, boolean show) hints.status = 0; XChangeProperty(xfi->display, window->handle, xfi->_MOTIF_WM_HINTS, xfi->_MOTIF_WM_HINTS, 32, - PropModeReplace, (uint8*) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS); + PropModeReplace, (BYTE*) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS); } void xf_SetWindowUnlisted(xfInfo* xfi, xfWindow* window) @@ -235,10 +235,10 @@ void xf_SetWindowUnlisted(xfInfo* xfi, xfWindow* window) window_state[1] = xfi->_NET_WM_STATE_SKIP_TASKBAR; XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_STATE, - XA_ATOM, 32, PropModeReplace, (uint8*) &window_state, 2); + XA_ATOM, 32, PropModeReplace, (BYTE*) &window_state, 2); } -void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_style) +void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, UINT32 style, UINT32 ex_style) { Atom window_type; @@ -257,7 +257,7 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_st attrs.override_redirect = True; XChangeWindowAttributes(xfi->display, window->handle, CWOverrideRedirect, &attrs); - window->is_transient = true; + window->is_transient = TRUE; xf_SetWindowUnlisted(xfi, window); window_type = xfi->_NET_WM_WINDOW_TYPE_POPUP; } @@ -272,7 +272,7 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_st else if (style & WS_POPUP) { /* this includes dialogs, popups, etc, that need to be full-fledged windows */ - window->is_transient = true; + window->is_transient = TRUE; window_type = xfi->_NET_WM_WINDOW_TYPE_DIALOG; xf_SetWindowUnlisted(xfi, window); } @@ -282,7 +282,7 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_st } XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_WINDOW_TYPE, - XA_ATOM, 32, PropModeReplace, (uint8*) &window_type, 1); + XA_ATOM, 32, PropModeReplace, (BYTE*) &window_type, 1); } @@ -304,7 +304,7 @@ static void xf_SetWindowPID(xfInfo* xfi, xfWindow* window, pid_t pid) 32, PropModeReplace, (unsigned char *)&pid, 1); } -xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, boolean decorations) +xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, BOOL decorations) { xfWindow* window; XEvent xevent; @@ -319,11 +319,11 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, window->width = width; window->height = height; - window->fullscreen = false; + window->fullscreen = FALSE; window->decorations = decorations; window->local_move.state = LMS_NOT_ACTIVE; - window->is_mapped = false; - window->is_transient = false; + window->is_mapped = FALSE; + window->is_transient = FALSE; window->handle = XCreateWindow(xfi->display, RootWindowOfScreen(xfi->screen), xfi->workArea.x, xfi->workArea.y, xfi->workArea.width, xfi->workArea.height, 0, xfi->depth, InputOutput, xfi->visual, @@ -373,7 +373,7 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, input_mask |= EnterWindowMask | LeaveWindowMask; XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_ICON, XA_CARDINAL, 32, - PropModeReplace, (uint8*) xf_icon_prop, ARRAY_SIZE(xf_icon_prop)); + PropModeReplace, (BYTE*) xf_icon_prop, ARRAY_SIZE(xf_icon_prop)); if (xfi->parent_window) XReparentWindow(xfi->display, window->handle, xfi->parent_window, 0, 0); @@ -463,7 +463,7 @@ void xf_FixWindowCoordinates(xfInfo* xfi, int* x, int* y, int* width, int* heigh char rail_window_class[] = "RAIL:00000000"; -xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, uint32 id) +xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, UINT32 id) { XGCValues gcv; int input_mask; @@ -485,14 +485,14 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, /* this window need decorations the WS_EX_APPWINDOW is used to tell the client to use local decorations only sent from xrdp */ - window->decorations = (wnd->extendedStyle & WS_EX_APPWINDOW) ? true : false; - window->fullscreen = false; + window->decorations = (wnd->extendedStyle & WS_EX_APPWINDOW) ? TRUE : FALSE; + window->fullscreen = FALSE; window->window = wnd; window->local_move.state = LMS_NOT_ACTIVE; - window->is_mapped = false; - window->is_transient = false; + window->is_mapped = FALSE; + window->is_transient = FALSE; window->rail_state = 0; - window->rail_ignore_configure = false; + window->rail_ignore_configure = FALSE; window->handle = XCreateWindow(xfi->display, RootWindowOfScreen(xfi->screen), x, y, window->width, window->height, 0, xfi->depth, InputOutput, xfi->visual, @@ -500,7 +500,7 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, CWBorderPixel | CWWinGravity | CWBitGravity, &xfi->attribs); DEBUG_X11_LMS("Create window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d rdp=0x%X", - (uint32) window->handle, window->left, window->top, window->right, window->bottom, + (UINT32) window->handle, window->left, window->top, window->right, window->bottom, window->width, window->height, wnd->windowId); memset(&gcv, 0, sizeof(gcv)); @@ -511,13 +511,13 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, if (class_hints != NULL) { char* class; - class = xmalloc(sizeof(rail_window_class)); + class = malloc(sizeof(rail_window_class)); snprintf(class, sizeof(rail_window_class), "RAIL:%08X", id); class_hints->res_name = "RAIL"; class_hints->res_class = class; XSetClassHint(xfi->display, window->handle, class_hints); XFree(class_hints); - xfree(class); + free(class); } /* Set the input mode hint for the WM */ @@ -587,7 +587,7 @@ void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x, DEBUG_X11_LMS("direction=%d window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d " "RDP=0x%X rc={l=%d t=%d} w=%d h=%d mouse_x=%d mouse_y=%d", - direction, (uint32) window->handle, + direction, (UINT32) window->handle, window->left, window->top, window->right, window->bottom, window->width, window->height, window->window->windowId, window->window->windowOffsetX, window->window->windowOffsetY, @@ -620,7 +620,7 @@ void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window) DEBUG_X11_LMS("state=%d window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d " "RDP=0x%X rc={l=%d t=%d} w=%d h=%d", window->local_move.state, - (uint32) window->handle, window->left, window->top, window->right, window->bottom, + (UINT32) window->handle, window->left, window->top, window->right, window->bottom, window->width, window->height, window->window->windowId, window->window->windowOffsetX, window->window->windowOffsetY, window->window->windowWidth, window->window->windowHeight); @@ -651,13 +651,13 @@ void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window) void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height) { - boolean resize = false; + BOOL resize = FALSE; if ((width * height) < 1) return; if ((window->width != width) || (window->height != height)) - resize = true; + resize = TRUE; if (window->local_move.state == LMS_STARTING || window->local_move.state == LMS_ACTIVE) @@ -666,7 +666,7 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%u h=%u " "new rc={l=%d t=%d r=%d b=%d} w=%u h=%u" " RDP=0x%X rc={l=%d t=%d} w=%d h=%d", - (uint32) window->handle, window->left, window->top, + (UINT32) window->handle, window->left, window->top, window->right, window->bottom, window->width, window->height, x, y, x + width -1, y + height -1, width, height, window->window->windowId, @@ -688,7 +688,7 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h xf_UpdateWindowArea(xfi, window, 0, 0, width, height); } -void xf_ShowWindow(xfInfo* xfi, xfWindow* window, uint8 state) +void xf_ShowWindow(xfInfo* xfi, xfWindow* window, BYTE state) { switch (state) { @@ -731,7 +731,7 @@ void xf_ShowWindow(xfInfo* xfi, xfWindow* window, uint8 state) */ if (window->rail_state == WINDOW_SHOW_MAXIMIZED) - window->rail_ignore_configure = true; + window->rail_ignore_configure = TRUE; if (window->is_transient) @@ -754,19 +754,19 @@ void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon) int propsize; long* propdata; long* dstp; - uint32* srcp; + UINT32* srcp; - if (icon->big != true) + if (icon->big != TRUE) return; pixels = icon->entry->width * icon->entry->height; propsize = 2 + pixels; - propdata = xmalloc(propsize * sizeof(long)); + propdata = malloc(propsize * sizeof(long)); propdata[0] = icon->entry->width; propdata[1] = icon->entry->height; dstp = &(propdata[2]); - srcp = (uint32*) icon->extra; + srcp = (UINT32*) icon->extra; for (y = 0; y < icon->entry->height; y++) { @@ -777,7 +777,7 @@ void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon) } XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_ICON, XA_CARDINAL, 32, - PropModeReplace, (uint8*) propdata, propsize); + PropModeReplace, (BYTE*) propdata, propsize); XFlush(xfi->display); } @@ -790,7 +790,7 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n if (nrects == 0) return; - xrects = xmalloc(sizeof(XRectangle) * nrects); + xrects = malloc(sizeof(XRectangle) * nrects); for (i = 0; i < nrects; i++) { @@ -807,7 +807,7 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n */ #endif - xfree(xrects); + free(xrects); } void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects) @@ -818,7 +818,7 @@ void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* re if (nrects == 0) return; - xrects = xmalloc(sizeof(XRectangle) * nrects); + xrects = malloc(sizeof(XRectangle) * nrects); for (i = 0; i < nrects; i++) { @@ -835,7 +835,7 @@ void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* re */ #endif - xfree(xrects); + free(xrects); } void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height) @@ -881,21 +881,21 @@ void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, XFlush(xfi->display); } -boolean xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y) +BOOL xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y) { rdpWindow* wnd; - boolean clientArea = false; - boolean windowArea = false; + BOOL clientArea = FALSE; + BOOL windowArea = FALSE; wnd = xfw->window; if (((x > wnd->clientOffsetX) && (x < wnd->clientOffsetX + wnd->clientAreaWidth)) && ((y > wnd->clientOffsetY) && (y < wnd->clientOffsetY + wnd->clientAreaHeight))) - clientArea = true; + clientArea = TRUE; if (((x > wnd->windowOffsetX) && (x < wnd->windowOffsetX + wnd->windowWidth)) && ((y > wnd->windowOffsetY) && (y < wnd->windowOffsetY + wnd->windowHeight))) - windowArea = true; + windowArea = TRUE; return (windowArea && !(clientArea)); } @@ -917,7 +917,7 @@ void xf_DestroyWindow(xfInfo* xfi, xfWindow* window) XDestroyWindow(xfi->display, window->handle); } - xfree(window); + free(window); } rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd) diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h index 85083501a..385c02cb7 100644 --- a/client/X11/xf_window.h +++ b/client/X11/xf_window.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Windows * * Copyright 2011 Marc-Andre Moreau @@ -71,43 +71,43 @@ struct xf_window int width; int height; Window handle; - boolean fullscreen; - boolean decorations; + BOOL fullscreen; + BOOL decorations; rdpWindow* window; - boolean is_mapped; - boolean is_transient; + BOOL is_mapped; + BOOL is_transient; xfLocalMove local_move; - uint8 rail_state; - boolean rail_ignore_configure; + BYTE rail_state; + BOOL rail_ignore_configure; }; void xf_ewmhints_init(xfInfo* xfi); -boolean xf_GetCurrentDesktop(xfInfo* xfi); -boolean xf_GetWorkArea(xfInfo* xfi); +BOOL xf_GetCurrentDesktop(xfInfo* xfi); +BOOL xf_GetWorkArea(xfInfo* xfi); -void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, boolean fullscreen); -void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, boolean show); +void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, BOOL fullscreen); +void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, BOOL show); void xf_SetWindowUnlisted(xfInfo* xfi, xfWindow* window); -xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, boolean decorations); +xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, BOOL decorations); void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height); -xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, uint32 id); +xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, UINT32 id); void xf_SetWindowText(xfInfo *xfi, xfWindow* window, char *name); void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height); -void xf_ShowWindow(xfInfo* xfi, xfWindow* window, uint8 state); +void xf_ShowWindow(xfInfo* xfi, xfWindow* window, BYTE state); void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon); void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects); void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects); -void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_style); +void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, UINT32 style, UINT32 ex_style); void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height); -boolean xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y); +BOOL xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y); void xf_DestroyWindow(xfInfo* xfi, xfWindow* window); rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd); -boolean xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length, - unsigned long* nitems, unsigned long* bytes, uint8** prop); +BOOL xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length, + unsigned long* nitems, unsigned long* bytes, BYTE** prop); void xf_SetWindowMinMaxInfo(xfInfo* xfi, xfWindow* window, int maxWidth, int maxHeight, int maxPosX, int maxPosY, int minTrackWidth, int minTrackHeight, int maxTrackWidth, int maxTrackHeight); diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index a4adfd93f..2785fe9ac 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Client * * Copyright 2011 Marc-Andre Moreau @@ -55,9 +55,11 @@ #include #include #include -#include +#include +#include #include +#include #include #include "xf_gdi.h" @@ -73,7 +75,7 @@ static HANDLE g_sem; static int g_thread_count = 0; -static uint8 g_disconnect_reason = 0; +static BYTE g_disconnect_reason = 0; static long xv_port = 0; static const size_t password_size = 512; @@ -107,15 +109,15 @@ void xf_sw_end_paint(rdpContext* context) { rdpGdi* gdi; xfInfo* xfi; - sint32 x, y; - uint32 w, h; + INT32 x, y; + UINT32 w, h; xfi = ((xfContext*) context)->xfi; gdi = context->gdi; - if (xfi->remote_app != true) + if (xfi->remote_app != TRUE) { - if (xfi->complex_regions != true) + if (xfi->complex_regions != TRUE) { if (gdi->primary->hdc->hwnd->invalid->null) return; @@ -176,7 +178,7 @@ void xf_sw_desktop_resize(rdpContext* context) xfi = ((xfContext*) context)->xfi; settings = xfi->instance->settings; - if (xfi->fullscreen != true) + if (xfi->fullscreen != TRUE) { rdpGdi* gdi = context->gdi; gdi_resize(gdi, xfi->width, xfi->height); @@ -202,8 +204,8 @@ void xf_hw_begin_paint(rdpContext* context) void xf_hw_end_paint(rdpContext* context) { xfInfo* xfi; - sint32 x, y; - uint32 w, h; + INT32 x, y; + UINT32 w, h; xfi = ((xfContext*) context)->xfi; @@ -224,13 +226,13 @@ void xf_hw_end_paint(rdpContext* context) void xf_hw_desktop_resize(rdpContext* context) { xfInfo* xfi; - boolean same; + BOOL same; rdpSettings* settings; xfi = ((xfContext*) context)->xfi; settings = xfi->instance->settings; - if (xfi->fullscreen != true) + if (xfi->fullscreen != TRUE) { xfi->width = settings->width; xfi->height = settings->height; @@ -240,7 +242,7 @@ void xf_hw_desktop_resize(rdpContext* context) if (xfi->primary) { - same = (xfi->primary == xfi->drawing) ? true : false; + same = (xfi->primary == xfi->drawing) ? TRUE : FALSE; XFreePixmap(xfi->display, xfi->primary); @@ -261,17 +263,17 @@ void xf_hw_desktop_resize(rdpContext* context) } } -boolean xf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) +BOOL xf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) { xfInfo* xfi = ((xfContext*) instance->context)->xfi; rfds[*rcount] = (void*)(long)(xfi->xfds); (*rcount)++; - return true; + return TRUE; } -boolean xf_process_x_events(freerdp* instance) +BOOL xf_process_x_events(freerdp* instance) { XEvent xevent; xfInfo* xfi = ((xfContext*) instance->context)->xfi; @@ -281,11 +283,11 @@ boolean xf_process_x_events(freerdp* instance) memset(&xevent, 0, sizeof(xevent)); XNextEvent(xfi->display, &xevent); - if (xf_event_process(instance, &xevent) != true) - return false; + if (xf_event_process(instance, &xevent) != TRUE) + return FALSE; } - return true; + return TRUE; } void xf_create_window(xfInfo* xfi) @@ -309,21 +311,21 @@ void xf_create_window(xfInfo* xfi) if (xfi->instance->settings->window_title != NULL) { - win_title = xstrdup(xfi->instance->settings->window_title); + win_title = _strdup(xfi->instance->settings->window_title); } else if (xfi->instance->settings->port == 3389) { - win_title = xmalloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname)); + win_title = malloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname)); sprintf(win_title, "FreeRDP: %s", xfi->instance->settings->hostname); } else { - win_title = xmalloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname) + sizeof(":00000")); + win_title = malloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname) + sizeof(":00000")); sprintf(win_title, "FreeRDP: %s:%i", xfi->instance->settings->hostname, xfi->instance->settings->port); } xfi->window = xf_CreateDesktopWindow(xfi, win_title, width, height, xfi->decorations); - xfree(win_title); + free(win_title); if (xfi->fullscreen) xf_SetWindowFullscreen(xfi, xfi->window, xfi->fullscreen); @@ -342,14 +344,14 @@ void xf_toggle_fullscreen(xfInfo* xfi) XCopyArea(xfi->display, xfi->primary, contents, xfi->gc, 0, 0, xfi->width, xfi->height, 0, 0); XDestroyWindow(xfi->display, xfi->window->handle); - xfi->fullscreen = (xfi->fullscreen) ? false : true; + xfi->fullscreen = (xfi->fullscreen) ? FALSE : TRUE; xf_create_window(xfi); XCopyArea(xfi->display, contents, xfi->primary, xfi->gc, 0, 0, xfi->width, xfi->height, 0, 0); XFreePixmap(xfi->display, contents); } -boolean xf_get_pixmap_info(xfInfo* xfi) +BOOL xf_get_pixmap_info(xfInfo* xfi) { int i; int vi_count; @@ -389,7 +391,7 @@ boolean xf_get_pixmap_info(xfInfo* xfi) if (XGetWindowAttributes(xfi->display, RootWindowOfScreen(xfi->screen), &window_attributes) == 0) { printf("xf_get_pixmap_info: XGetWindowAttributes failed\n"); - return false; + return FALSE; } vis = XGetVisualInfo(xfi->display, VisualClassMask | VisualScreenMask, &template, &vi_count); @@ -397,7 +399,7 @@ boolean xf_get_pixmap_info(xfInfo* xfi) if (vis == NULL) { printf("xf_get_pixmap_info: XGetVisualInfo failed\n"); - return false; + return FALSE; } vi = NULL; @@ -421,7 +423,7 @@ boolean xf_get_pixmap_info(xfInfo* xfi) if (vi->red_mask & 0xFF) { - xfi->clrconv->invert = true; + xfi->clrconv->invert = TRUE; } } @@ -429,10 +431,10 @@ boolean xf_get_pixmap_info(xfInfo* xfi) if ((xfi->visual == NULL) || (xfi->scanline_pad == 0)) { - return false; + return FALSE; } - return true; + return TRUE; } static int (*_def_error_handler)(Display*, XErrorEvent*); @@ -440,7 +442,7 @@ static int (*_def_error_handler)(Display*, XErrorEvent*); int xf_error_handler(Display* d, XErrorEvent* ev) { char buf[256]; - int do_abort = true; + int do_abort = TRUE; XGetErrorText(d, ev->error_code, buf, sizeof(buf)); printf("%s", buf); @@ -450,7 +452,7 @@ int xf_error_handler(Display* d, XErrorEvent* ev) _def_error_handler(d, ev); - return false; + return FALSE; } int _xf_error_handler(Display* d, XErrorEvent* ev) @@ -472,13 +474,13 @@ int _xf_error_handler(Display* d, XErrorEvent* ev) * @param instance - pointer to the rdp_freerdp structure that contains the connection's parameters, and will * be filled with the appropriate informations. * - * @return true if successful. false otherwise. + * @return TRUE if successful. FALSE otherwise. * Can exit with error code XF_EXIT_PARSE_ARGUMENTS if there is an error in the parameters. */ -boolean xf_pre_connect(freerdp* instance) +BOOL xf_pre_connect(freerdp* instance) { xfInfo* xfi; - boolean bitmap_cache; + BOOL bitmap_cache; rdpSettings* settings; int arg_parse_result; @@ -507,34 +509,34 @@ boolean xf_pre_connect(freerdp* instance) settings->os_major_type = OSMAJORTYPE_UNIX; settings->os_minor_type = OSMINORTYPE_NATIVE_XSERVER; - settings->order_support[NEG_DSTBLT_INDEX] = true; - settings->order_support[NEG_PATBLT_INDEX] = true; - settings->order_support[NEG_SCRBLT_INDEX] = true; - settings->order_support[NEG_OPAQUE_RECT_INDEX] = true; - settings->order_support[NEG_DRAWNINEGRID_INDEX] = false; - settings->order_support[NEG_MULTIDSTBLT_INDEX] = false; - settings->order_support[NEG_MULTIPATBLT_INDEX] = false; - settings->order_support[NEG_MULTISCRBLT_INDEX] = false; - settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = true; - settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = false; - settings->order_support[NEG_LINETO_INDEX] = true; - settings->order_support[NEG_POLYLINE_INDEX] = true; + settings->order_support[NEG_DSTBLT_INDEX] = TRUE; + settings->order_support[NEG_PATBLT_INDEX] = TRUE; + settings->order_support[NEG_SCRBLT_INDEX] = TRUE; + settings->order_support[NEG_OPAQUE_RECT_INDEX] = TRUE; + settings->order_support[NEG_DRAWNINEGRID_INDEX] = FALSE; + settings->order_support[NEG_MULTIDSTBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTIPATBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTISCRBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = TRUE; + settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE; + settings->order_support[NEG_LINETO_INDEX] = TRUE; + settings->order_support[NEG_POLYLINE_INDEX] = TRUE; settings->order_support[NEG_MEMBLT_INDEX] = bitmap_cache; - settings->order_support[NEG_MEM3BLT_INDEX] = (settings->sw_gdi) ? true : false; + settings->order_support[NEG_MEM3BLT_INDEX] = (settings->sw_gdi) ? TRUE : FALSE; settings->order_support[NEG_MEMBLT_V2_INDEX] = bitmap_cache; - settings->order_support[NEG_MEM3BLT_V2_INDEX] = false; - settings->order_support[NEG_SAVEBITMAP_INDEX] = false; - settings->order_support[NEG_GLYPH_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_GLYPH_INDEX] = true; + settings->order_support[NEG_MEM3BLT_V2_INDEX] = FALSE; + settings->order_support[NEG_SAVEBITMAP_INDEX] = FALSE; + settings->order_support[NEG_GLYPH_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_GLYPH_INDEX] = TRUE; - settings->order_support[NEG_POLYGON_SC_INDEX] = (settings->sw_gdi) ? false : true; - settings->order_support[NEG_POLYGON_CB_INDEX] = (settings->sw_gdi) ? false : true; + settings->order_support[NEG_POLYGON_SC_INDEX] = (settings->sw_gdi) ? FALSE : TRUE; + settings->order_support[NEG_POLYGON_CB_INDEX] = (settings->sw_gdi) ? FALSE : TRUE; - settings->order_support[NEG_ELLIPSE_SC_INDEX] = false; - settings->order_support[NEG_ELLIPSE_CB_INDEX] = false; + settings->order_support[NEG_ELLIPSE_SC_INDEX] = FALSE; + settings->order_support[NEG_ELLIPSE_CB_INDEX] = FALSE; freerdp_channels_pre_connect(xfi->_context->channels, instance); @@ -553,7 +555,7 @@ boolean xf_pre_connect(freerdp* instance) } fprintf(stderr, "%s:%d: Authenication only. Don't connect to X.\n", __FILE__, __LINE__); /* Avoid XWindows initialization and configuration below. */ - return true; + return TRUE; } xfi->display = XOpenDisplay(NULL); @@ -562,13 +564,13 @@ boolean xf_pre_connect(freerdp* instance) { printf("xf_pre_connect: failed to open display: %s\n", XDisplayName(NULL)); printf("Please check that the $DISPLAY environment variable is properly set.\n"); - return false; + return FALSE; } if (xfi->debug) { printf("Enabling X11 debug mode.\n"); - XSynchronize(xfi->display, true); + XSynchronize(xfi->display, TRUE); _def_error_handler = XSetErrorHandler(_xf_error_handler); } @@ -607,17 +609,17 @@ boolean xf_pre_connect(freerdp* instance) xfi->big_endian = (ImageByteOrder(xfi->display) == MSBFirst); xfi->mouse_motion = settings->mouse_motion; - xfi->complex_regions = true; + xfi->complex_regions = TRUE; xfi->decorations = settings->decorations; xfi->fullscreen = settings->fullscreen; xfi->grab_keyboard = settings->grab_keyboard; - xfi->fullscreen_toggle = true; + xfi->fullscreen_toggle = TRUE; xfi->sw_gdi = settings->sw_gdi; xfi->parent_window = (Window) settings->parent_window_xid; xf_detect_monitors(xfi, settings); - return true; + return TRUE; } void cpuid(unsigned info, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx) @@ -644,10 +646,10 @@ void cpuid(unsigned info, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned #endif } -uint32 xf_detect_cpu() +UINT32 xf_detect_cpu() { unsigned int eax, ebx, ecx, edx = 0; - uint32 cpu_opt = 0; + UINT32 cpu_opt = 0; cpuid(1, &eax, &ebx, &ecx, &edx); @@ -665,10 +667,10 @@ uint32 xf_detect_cpu() * It will be called only if the connection was initialized properly, and will continue the initialization based on the * newly created connection. */ -boolean xf_post_connect(freerdp* instance) +BOOL xf_post_connect(freerdp* instance) { #ifdef WITH_SSE2 - uint32 cpu; + UINT32 cpu; #endif xfInfo* xfi; XGCValues gcv; @@ -681,15 +683,15 @@ boolean xf_post_connect(freerdp* instance) cache = instance->context->cache; channels = xfi->_context->channels; - if (xf_get_pixmap_info(xfi) != true) - return false; + if (xf_get_pixmap_info(xfi) != TRUE) + return FALSE; xf_register_graphics(instance->context->graphics); if (xfi->sw_gdi) { rdpGdi* gdi; - uint32 flags; + UINT32 flags; flags = CLRCONV_ALPHA; @@ -757,7 +759,7 @@ boolean xf_post_connect(freerdp* instance) xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0, (char*) xfi->primary_buffer, xfi->width, xfi->height, xfi->scanline_pad, 0); - xfi->bmp_codec_none = (uint8*) xmalloc(64 * 64 * 4); + xfi->bmp_codec_none = (BYTE*) malloc(64 * 64 * 4); if (xfi->sw_gdi) { @@ -774,7 +776,7 @@ boolean xf_post_connect(freerdp* instance) pointer_cache_register_callbacks(instance->update); - if (xfi->sw_gdi != true) + if (xfi->sw_gdi != TRUE) { glyph_cache_register_callbacks(instance->update); brush_cache_register_callbacks(instance->update); @@ -793,7 +795,7 @@ boolean xf_post_connect(freerdp* instance) xf_cliprdr_init(xfi, channels); - return true; + return TRUE; } /** Callback set in the rdp_freerdp structure, and used to get the user's password, @@ -804,20 +806,20 @@ boolean xf_post_connect(freerdp* instance) * @param username - unused * @param password - on return: pointer to a character string that will be filled by the password entered by the user. * Note that this character string will be allocated inside the function, and needs to be deallocated by the caller - * using xfree(), even in case this function fails. + * using free(), even in case this function fails. * @param domain - unused - * @return true if a password was successfully entered. See freerdp_passphrase_read() for more details. + * @return TRUE if a password was successfully entered. See freerdp_passphrase_read() for more details. */ -boolean xf_authenticate(freerdp* instance, char** username, char** password, char** domain) +BOOL xf_authenticate(freerdp* instance, char** username, char** password, char** domain) { // FIXME: seems this callback may be called when 'username' is not known. // But it doesn't do anything to fix it... - *password = xmalloc(password_size * sizeof(char)); + *password = malloc(password_size * sizeof(char)); if (freerdp_passphrase_read("Password: ", *password, password_size, instance->settings->from_stdin) == NULL) - return false; + return FALSE; - return true; + return TRUE; } /** Callback set in the rdp_freerdp structure, and used to make a certificate validation @@ -828,9 +830,9 @@ boolean xf_authenticate(freerdp* instance, char** username, char** password, cha * @param subject * @param issuer * @param fingerprint - * @return true if the certificate is trusted. false otherwise. + * @return TRUE if the certificate is trusted. FALSE otherwise. */ -boolean xf_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint) +BOOL xf_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint) { char answer; @@ -849,7 +851,7 @@ boolean xf_verify_certificate(freerdp* instance, char* subject, char* issuer, ch if (answer == 'y' || answer == 'Y') { - return true; + return TRUE; } else if (answer == 'n' || answer == 'N') { @@ -858,7 +860,7 @@ boolean xf_verify_certificate(freerdp* instance, char* subject, char* issuer, ch printf("\n"); } - return false; + return FALSE; } /** Used to parse xfreerdp-specific commandline parameters. @@ -890,9 +892,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v for (i = 0; layouts[i].code; i++) { printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name); - xfree(layouts[i].name); + free(layouts[i].name); } - xfree(layouts); + free(layouts); layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT); @@ -900,9 +902,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v for (i = 0; layouts[i].code; i++) { printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name); - xfree(layouts[i].name); + free(layouts[i].name); } - xfree(layouts); + free(layouts); layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME); @@ -910,9 +912,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v for (i = 0; layouts[i].code; i++) { printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name); - xfree(layouts[i].name); + free(layouts[i].name); } - xfree(layouts); + free(layouts); exit(0); } @@ -923,7 +925,7 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v } else if (strcmp("--dbg-x11", opt) == 0) { - xfi->debug = true; + xfi->debug = TRUE; argc = 1; } @@ -944,18 +946,27 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v */ int xf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data) { + void* entry = NULL; rdpChannels* channels = (rdpChannels*) user_data; - printf("loading plugin %s\n", name); + entry = freerdp_channels_find_static_virtual_channel_entry(name); + + if (entry) + { + if (freerdp_channels_client_load(channels, settings, entry, plugin_data) == 0) + { + printf("loading channel %s (static)\n", name); + return 1; + } + } + + printf("loading channel %s (plugin)\n", name); freerdp_channels_load_plugin(channels, settings, name, plugin_data); - // FIXME we should check the return code for freerdp_channels_load_plugin() - // and report any error to the caller. freerdp_parse_args() actually expect to get - // an error code when there is a loading error. - // Is it as easy as "return freerdp_channels_load_plugin()" ? + return 1; } -int xf_receive_channel_data(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size) +int xf_receive_channel_data(freerdp* instance, int channelId, BYTE* data, int size, int flags, int total_size) { return freerdp_channels_data(instance, channelId, data, size, flags, total_size); } @@ -1071,11 +1082,11 @@ void xf_free(xfInfo* xfi) { xf_window_free(xfi); - xfree(xfi->bmp_codec_none); + free(xfi->bmp_codec_none); XCloseDisplay(xfi->display); - xfree(xfi); + free(xfi); } /** Main loop for the rdp connection. @@ -1106,7 +1117,7 @@ int xfreerdp_run(freerdp* instance) memset(wfds, 0, sizeof(wfds)); memset(&timeout, 0, sizeof(struct timeval)); - boolean status = freerdp_connect(instance); + BOOL status = freerdp_connect(instance); /* Connection succeeded. --authonly ? */ if (instance->settings->authentication_only) { freerdp_disconnect(instance); @@ -1128,19 +1139,19 @@ int xfreerdp_run(freerdp* instance) rcount = 0; wcount = 0; - if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != true) + if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); ret = XF_EXIT_CONN_FAILED; break; } - if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != true) + if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get channel manager file descriptor\n"); ret = XF_EXIT_CONN_FAILED; break; } - if (xf_get_fds(instance, rfds, &rcount, wfds, &wcount) != true) + if (xf_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get xfreerdp file descriptor\n"); ret = XF_EXIT_CONN_FAILED; @@ -1185,17 +1196,17 @@ int xfreerdp_run(freerdp* instance) } } - if (freerdp_check_fds(instance) != true) + if (freerdp_check_fds(instance) != TRUE) { printf("Failed to check FreeRDP file descriptor\n"); break; } - if (xf_process_x_events(instance) != true) + if (xf_process_x_events(instance) != TRUE) { printf("Closed from X\n"); break; } - if (freerdp_channels_check_fds(channels, instance) != true) + if (freerdp_channels_check_fds(channels, instance) != TRUE) { printf("Failed to check channel manager file descriptor\n"); break; @@ -1251,7 +1262,7 @@ void* thread_func(void* param) g_disconnect_reason = xfreerdp_run(data->instance); - xfree(data); + free(data); g_thread_count--; @@ -1261,7 +1272,7 @@ void* thread_func(void* param) pthread_exit(NULL); } -static uint8 exit_code_from_disconnect_reason(uint32 reason) +static BYTE exit_code_from_disconnect_reason(UINT32 reason) { if (reason == 0 || (reason >= XF_EXIT_PARSE_ARGUMENTS && reason <= XF_EXIT_CONN_FAILED)) @@ -1310,7 +1321,7 @@ int main(int argc, char* argv[]) instance->context->argc = argc; instance->context->argv = argv; - instance->settings->sw_gdi = false; + instance->settings->sw_gdi = FALSE; data = (struct thread_data*) xzalloc(sizeof(struct thread_data)); data->instance = instance; diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index 1a2d673b4..19b739932 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Client * * Copyright 2011 Marc-Andre Moreau @@ -39,10 +39,10 @@ typedef struct xf_info xfInfo; struct xf_WorkArea { - uint32 x; - uint32 y; - uint32 width; - uint32 height; + UINT32 x; + UINT32 y; + UINT32 width; + UINT32 height; }; typedef struct xf_WorkArea xfWorkArea; @@ -101,43 +101,43 @@ struct xf_info Colormap colormap; int screen_number; int scanline_pad; - boolean big_endian; - boolean fullscreen; - boolean grab_keyboard; - boolean unobscured; - boolean decorations; - boolean debug; + BOOL big_endian; + BOOL fullscreen; + BOOL grab_keyboard; + BOOL unobscured; + BOOL decorations; + BOOL debug; xfWindow* window; xfWorkArea workArea; int current_desktop; - boolean remote_app; - boolean disconnect; + BOOL remote_app; + BOOL disconnect; HCLRCONV clrconv; Window parent_window; HGDI_DC hdc; - boolean sw_gdi; - uint8* primary_buffer; + BOOL sw_gdi; + BYTE* primary_buffer; - boolean frame_begin; - uint16 frame_x1; - uint16 frame_y1; - uint16 frame_x2; - uint16 frame_y2; + BOOL frame_begin; + UINT16 frame_x1; + UINT16 frame_y1; + UINT16 frame_x2; + UINT16 frame_y2; - boolean focused; - boolean mouse_active; - boolean mouse_motion; - boolean suppress_output; - boolean fullscreen_toggle; - uint32 keyboard_layout_id; - boolean pressed_keys[256]; + BOOL focused; + BOOL mouse_active; + BOOL mouse_motion; + BOOL suppress_output; + BOOL fullscreen_toggle; + UINT32 keyboard_layout_id; + BOOL pressed_keys[256]; XModifierKeymap* modifier_map; XSetWindowAttributes attribs; - boolean complex_regions; + BOOL complex_regions; VIRTUAL_SCREEN vscreen; - uint8* bmp_codec_none; - uint8* bmp_codec_nsc; + BYTE* bmp_codec_none; + BYTE* bmp_codec_nsc; void* rfx_context; void* nsc_context; void* xv_context; @@ -170,7 +170,7 @@ struct xf_info void xf_create_window(xfInfo* xfi); void xf_toggle_fullscreen(xfInfo* xfi); -boolean xf_post_connect(freerdp* instance); +BOOL xf_post_connect(freerdp* instance); enum XF_EXIT_CODE { diff --git a/cmake/BuildFeatureCheck.cmake b/cmake/BuildFeatureCheck.cmake index 1be71e7a9..bf71da637 100644 --- a/cmake/BuildFeatureCheck.cmake +++ b/cmake/BuildFeatureCheck.cmake @@ -16,12 +16,12 @@ # limitations under the License. #============================================================================= -# If WITH_MONOLITHIC_BUILD is used with cmake < 2.8.8 build fails -if (WITH_MONOLITHIC_BUILD) +# If MONOLITHIC_BUILD is used with cmake < 2.8.8 build fails +if (MONOLITHIC_BUILD) if(${CMAKE_VERSION} VERSION_LESS 2.8.8) - message(FATAL_ERROR "CMAKE version >= 2.8.8 required for WITH_MONOLITHIC_BUILD") + message(FATAL_ERROR "CMAKE version >= 2.8.8 required for MONOLITHIC_BUILD") endif() -endif(WITH_MONOLITHIC_BUILD) +endif(MONOLITHIC_BUILD) # GetGitRevisionDescription requires FindGit which was added in version 2.8.2 # build won't fail but GIT_REVISION is set to n/a diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index 908caddfd..9a73be55a 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -18,11 +18,12 @@ endif() option(BUILD_TESTING "Build unit tests" OFF) if(${CMAKE_VERSION} VERSION_GREATER 2.8.8) - option(WITH_MONOLITHIC_BUILD "Use monolithic build" OFF) + option(MONOLITHIC_BUILD "Use monolithic build" OFF) endif() option(WITH_CLIENT "Build client binaries" ON) option(WITH_SERVER "Build server binaries" OFF) + option(WITH_CHANNELS "Build virtual channel plugins" ON) if(WITH_CLIENT AND WITH_CHANNELS) diff --git a/config.h.in b/config.h.in index d9c4d367a..2803b468b 100644 --- a/config.h.in +++ b/config.h.in @@ -37,7 +37,7 @@ #cmakedefine WITH_WIN8 /* Plugins */ -#cmakedefine WITH_STATIC_PLUGINS +#cmakedefine STATIC_CHANNELS #cmakedefine WITH_RDPDR diff --git a/cunit/CMakeLists.txt b/cunit/CMakeLists.txt index b03f55240..8e2fc144e 100644 --- a/cunit/CMakeLists.txt +++ b/cunit/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # cunit cmake build script # # Copyright 2011 O.S. Systems Software Ltda. diff --git a/cunit/test_bitmap.c b/cunit/test_bitmap.c index b25a065ef..6759b2e95 100644 --- a/cunit/test_bitmap.c +++ b/cunit/test_bitmap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Bitmap Unit Tests * * Copyright 2011 Jay Sorg @@ -24,17 +24,17 @@ #include "test_bitmap.h" -uint8 compressed_16x1x8[] = +BYTE compressed_16x1x8[] = { 0x10 }; -uint8 decompressed_16x1x8[] = +BYTE decompressed_16x1x8[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 compressed_32x32x8[] = +BYTE compressed_32x32x8[] = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x06, 0xed, 0x06, 0x06, 0x06, 0xed, 0x06, 0x06, 0x06, 0xec, 0x6c, 0x0e, 0x0e, 0x44, 0x0e, 0x0e, 0x0e, 0x13, 0x06, 0x06, 0x06, 0xed, 0x06, 0x06, 0x06, @@ -90,7 +90,7 @@ uint8 compressed_32x32x8[] = 0x04, 0x8b, 0x04, 0x6c, 0xe6, 0x04, 0x06, 0x82, 0x00, 0x00 }; -uint8 decompressed_32x32x8[] = +BYTE decompressed_32x32x8[] = { 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x04, 0x6c, 0x04, 0x8b, 0x04, 0x6c, 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x04, 0x06, 0x00, 0x00, @@ -158,18 +158,18 @@ uint8 decompressed_32x32x8[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 compressed_16x1x16[] = +BYTE compressed_16x1x16[] = { 0x0c, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 decompressed_16x1x16[] = +BYTE decompressed_16x1x16[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 compressed_32x32x16[] = +BYTE compressed_32x32x16[] = { 0x1c, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0xef, 0x1a, 0x8a, 0xcf, 0x12, 0x4e, 0x12, 0xce, 0x09, 0xaf, 0x09, 0x8f, 0x01, 0x8f, 0x01, 0xaf, 0x09, 0xce, 0x09, @@ -268,7 +268,7 @@ uint8 compressed_32x32x16[] = 0xcf, 0x12, 0x69, 0xef, 0x1a, 0x84, 0xef, 0x1a, 0xef, 0x1a, 0x00, 0x00, 0x00, 0x00 }; -uint8 decompressed_32x32x16[] = +BYTE decompressed_32x32x16[] = { 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xef, 0x1a, 0xcf, 0x12, 0xb0, 0x12, 0x91, 0x0a, 0xb3, 0x0a, 0xb3, 0x0a, @@ -400,19 +400,19 @@ uint8 decompressed_32x32x16[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 compressed_16x1x24[] = +BYTE compressed_16x1x24[] = { 0x0c, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 decompressed_16x1x24[] = +BYTE decompressed_16x1x24[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 compressed_32x32x24[] = +BYTE compressed_32x32x24[] = { 0x84, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x38, 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x80, @@ -479,7 +479,7 @@ uint8 compressed_32x32x24[] = 0xff, 0xff, 0xff, 0xff }; -uint8 decompressed_32x32x24[] = +BYTE decompressed_32x32x24[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -675,12 +675,12 @@ uint8 decompressed_32x32x24[] = 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -uint8 compressed_16x1x32[] = +BYTE compressed_16x1x32[] = { 0x10, 0x01, 0x01, 0x01, 0x01 }; -uint8 decompressed_16x1x32[] = +BYTE decompressed_16x1x32[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -688,7 +688,7 @@ uint8 decompressed_16x1x32[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -uint8 compressed_32x32x32[] = +BYTE compressed_32x32x32[] = { 0x10, 0x02, 0x02, 0x0a, 0xbb, 0x22, 0x8e, 0xf6, 0xb9, 0x91, 0x91, 0xa9, 0xf5, 0xaa, 0x3c, 0x00, 0x08, 0xf9, 0x5e, 0xd1, 0x59, 0x8f, 0xf7, 0xb8, 0x90, 0x90, 0xa8, 0xf4, 0xab, 0x59, 0xa3, 0x8c, @@ -866,7 +866,7 @@ uint8 compressed_32x32x32[] = 0xcf, 0xb5, 0xb3, 0xc7, 0xd3, 0xc1, 0x85, 0x31, 0x03, 0x00 }; -uint8 decompressed_32x32x32[] = +BYTE decompressed_32x32x32[] = { 0x7a, 0x5f, 0x1d, 0x00, 0x7a, 0x5f, 0x1d, 0x00, 0x7a, 0x5f, 0x1d, 0x00, 0x7a, 0x5f, 0x1d, 0x00, 0x7a, 0x5f, 0x1d, 0x00, 0x7a, 0x5f, 0x1d, 0x00, 0x7a, 0x5f, 0x1d, 0x00, 0x7a, 0x5f, 0x1d, 0x00, @@ -1149,14 +1149,14 @@ void test_bitmap(void) { struct btest { - uint8 decompressed_16x1x8[16 * 1 * 1]; - uint8 decompressed_32x32x8[32 * 32 * 1]; - uint8 decompressed_16x1x16[16 * 1 * 2]; - uint8 decompressed_32x32x16[32 * 32 * 2]; - uint8 decompressed_16x1x24[16 * 1 * 3]; - uint8 decompressed_32x32x24[32 * 32 * 3]; - uint8 decompressed_16x1x32[16 * 1 * 4]; - uint8 decompressed_32x32x32[32 * 32 * 4]; + BYTE decompressed_16x1x8[16 * 1 * 1]; + BYTE decompressed_32x32x8[32 * 32 * 1]; + BYTE decompressed_16x1x16[16 * 1 * 2]; + BYTE decompressed_32x32x16[32 * 32 * 2]; + BYTE decompressed_16x1x24[16 * 1 * 3]; + BYTE decompressed_32x32x24[32 * 32 * 3]; + BYTE decompressed_16x1x32[16 * 1 * 4]; + BYTE decompressed_32x32x32[32 * 32 * 4]; }; struct btest* t; int width; @@ -1172,7 +1172,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_16x1x8); decomp_size = sizeof(decompressed_16x1x8); CU_ASSERT(bitmap_decompress(compressed_16x1x8, t->decompressed_16x1x8, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_16x1x8, decompressed_16x1x8, decomp_size) == 0); @@ -1182,7 +1182,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_32x32x8); decomp_size = sizeof(decompressed_32x32x8); CU_ASSERT(bitmap_decompress(compressed_32x32x8, t->decompressed_32x32x8, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_32x32x8, decompressed_32x32x8, decomp_size) == 0); @@ -1192,7 +1192,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_16x1x16); decomp_size = sizeof(decompressed_16x1x16); CU_ASSERT(bitmap_decompress(compressed_16x1x16, t->decompressed_16x1x16, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_16x1x16, decompressed_16x1x16, decomp_size) == 0); @@ -1202,7 +1202,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_32x32x16); decomp_size = sizeof(decompressed_32x32x16); CU_ASSERT(bitmap_decompress(compressed_32x32x16, t->decompressed_32x32x16, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_32x32x16, decompressed_32x32x16, decomp_size) == 0); @@ -1212,7 +1212,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_16x1x24); decomp_size = sizeof(decompressed_16x1x24); CU_ASSERT(bitmap_decompress(compressed_16x1x24, t->decompressed_16x1x24, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_16x1x24, decompressed_16x1x24, decomp_size) == 0); @@ -1222,7 +1222,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_32x32x24); decomp_size = sizeof(decompressed_32x32x24); CU_ASSERT(bitmap_decompress(compressed_32x32x24, t->decompressed_32x32x24, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_32x32x24, decompressed_32x32x24, decomp_size) == 0); @@ -1232,7 +1232,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_16x1x32); decomp_size = sizeof(decompressed_16x1x32); CU_ASSERT(bitmap_decompress(compressed_16x1x32, t->decompressed_16x1x32, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_16x1x32, decompressed_16x1x32, decomp_size) == 0); @@ -1242,7 +1242,7 @@ void test_bitmap(void) comp_size = sizeof(compressed_32x32x32); decomp_size = sizeof(decompressed_32x32x32); CU_ASSERT(bitmap_decompress(compressed_32x32x32, t->decompressed_32x32x32, - width, height, comp_size, bpp, bpp) == true); + width, height, comp_size, bpp, bpp) == TRUE); CU_ASSERT(memcmp(t->decompressed_32x32x32, decompressed_32x32x32, decomp_size) == 0); diff --git a/cunit/test_bitmap.h b/cunit/test_bitmap.h index 3705e0930..cddf24f11 100644 --- a/cunit/test_bitmap.h +++ b/cunit/test_bitmap.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Bitmap Unit Tests * * Copyright 2011 Jay Sorg diff --git a/cunit/test_cliprdr.c b/cunit/test_cliprdr.c index 26cf6f0f8..727d28681 100644 --- a/cunit/test_cliprdr.c +++ b/cunit/test_cliprdr.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel Unit Tests * * Copyright 2011 Vic Lee @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "test_cliprdr.h" @@ -51,18 +51,18 @@ int add_cliprdr_suite(void) return 0; } -static const uint8 test_clip_caps_data[] = +static const BYTE test_clip_caps_data[] = { "\x07\x00\x00\x00\x10\x00\x00\x00\x01\x00\x00\x00\x01\x00\x0C\x00" "\x02\x00\x00\x00\x0E\x00\x00\x00" }; -static const uint8 test_monitor_ready_data[] = +static const BYTE test_monitor_ready_data[] = { "\x01\x00\x00\x00\x00\x00\x00\x00" }; -static const uint8 test_format_list_data[] = +static const BYTE test_format_list_data[] = { "\x02\x00\x00\x00\x48\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" @@ -71,23 +71,23 @@ static const uint8 test_format_list_data[] = "\x6D\x00\x61\x00\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }; -static const uint8 test_format_list_response_data[] = +static const BYTE test_format_list_response_data[] = { "\x03\x00\x01\x00\x00\x00\x00\x00" }; -static const uint8 test_data_request_data[] = +static const BYTE test_data_request_data[] = { "\x04\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00" }; -static const uint8 test_data_response_data[] = +static const BYTE test_data_response_data[] = { "\x05\x00\x01\x00\x18\x00\x00\x00\x68\x00\x65\x00\x6C\x00\x6C\x00" "\x6F\x00\x20\x00\x77\x00\x6F\x00\x72\x00\x6c\x00\x64\x00\x00\x00" }; -static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, int data_size) +static int test_rdp_channel_data(freerdp* instance, int chan_id, BYTE* data, int data_size) { printf("chan_id %d data_size %d\n", chan_id, data_size); freerdp_hexdump(data, data_size); @@ -143,7 +143,7 @@ void test_cliprdr(void) event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, event_process_callback, NULL); format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event; format_list_event->num_formats = 2; - format_list_event->formats = (uint32*) xmalloc(sizeof(uint32) * 2); + format_list_event->formats = (UINT32*) malloc(sizeof(UINT32) * 2); format_list_event->formats[0] = CB_FORMAT_TEXT; format_list_event->formats[1] = CB_FORMAT_HTML; event_processed = 0; @@ -199,7 +199,7 @@ void test_cliprdr(void) /* UI sends data response event to cliprdr */ event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_DATA_RESPONSE, event_process_callback, NULL); data_response_event = (RDP_CB_DATA_RESPONSE_EVENT*)event; - data_response_event->data = (uint8*)xmalloc(6); + data_response_event->data = (BYTE*)malloc(6); strcpy((char*)data_response_event->data, "hello"); data_response_event->size = 6; event_processed = 0; diff --git a/cunit/test_cliprdr.h b/cunit/test_cliprdr.h index f1a5509ca..724be9ec3 100644 --- a/cunit/test_cliprdr.h +++ b/cunit/test_cliprdr.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel Unit Tests * * Copyright 2011 Vic Lee diff --git a/cunit/test_color.c b/cunit/test_color.c index d353b6b68..4a3a7978b 100644 --- a/cunit/test_color.c +++ b/cunit/test_color.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Color Conversion Unit Tests * * Copyright 2010 Marc-Andre Moreau @@ -53,7 +53,7 @@ int add_color_suite(void) void test_color_GetRGB32(void) { int r, g, b; - uint32 rgb32 = 0x00AABBCC; + UINT32 rgb32 = 0x00AABBCC; GetRGB32(r, g, b, rgb32); CU_ASSERT(r == 0xAA); @@ -64,7 +64,7 @@ void test_color_GetRGB32(void) void test_color_GetBGR32(void) { int r, g, b; - uint32 bgr32 = 0x00CCBBAA; + UINT32 bgr32 = 0x00CCBBAA; GetBGR32(r, g, b, bgr32); CU_ASSERT(r == 0xAA); @@ -83,7 +83,7 @@ void test_color_GetRGB_565(void) */ int r, g, b; - uint16 rgb16 = 0xAE7D; + UINT16 rgb16 = 0xAE7D; GetRGB_565(r, g, b, rgb16); CU_ASSERT(r == 0x15); @@ -103,7 +103,7 @@ void test_color_GetRGB16(void) */ int r, g, b; - uint16 rgb16 = 0xAE7D; + UINT16 rgb16 = 0xAE7D; GetRGB16(r, g, b, rgb16); CU_ASSERT(r == 0xAD); @@ -122,7 +122,7 @@ void test_color_GetBGR_565(void) */ int r, g, b; - uint16 bgr16 = 0xEE75; + UINT16 bgr16 = 0xEE75; GetBGR_565(r, g, b, bgr16); CU_ASSERT(r == 0x15); @@ -142,7 +142,7 @@ void test_color_GetBGR16(void) */ int r, g, b; - uint16 bgr16 = 0xEE75; + UINT16 bgr16 = 0xEE75; GetBGR16(r, g, b, bgr16); CU_ASSERT(r == 0xAD); diff --git a/cunit/test_color.h b/cunit/test_color.h index 227146ec9..6b6a6a5cc 100644 --- a/cunit/test_color.h +++ b/cunit/test_color.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Color Conversion Unit Tests * * Copyright 2010 Marc-Andre Moreau diff --git a/cunit/test_drdynvc.c b/cunit/test_drdynvc.c index f46a7ac1e..3de60d864 100644 --- a/cunit/test_drdynvc.c +++ b/cunit/test_drdynvc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel Unit Tests * * Copyright 2011 Vic Lee @@ -50,14 +50,14 @@ int add_drdynvc_suite(void) return 0; } -static const uint8 test_capability_request_data[] = +static const BYTE test_capability_request_data[] = { "\x58\x00\x02\x00\x33\x33\x11\x11\x3D\x0A\xA7\x04" }; static int data_received = 0; -static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, int data_size) +static int test_rdp_channel_data(freerdp* instance, int chan_id, BYTE* data, int data_size) { printf("chan_id %d data_size %d\n", chan_id, data_size); freerdp_hexdump(data, data_size); diff --git a/cunit/test_drdynvc.h b/cunit/test_drdynvc.h index 67e075461..7c6a1676f 100644 --- a/cunit/test_drdynvc.h +++ b/cunit/test_drdynvc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel Unit Tests * * Copyright 2011 Vic Lee diff --git a/cunit/test_freerdp.c b/cunit/test_freerdp.c index dc178de85..46b8bedbe 100644 --- a/cunit/test_freerdp.c +++ b/cunit/test_freerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Unit Tests * * Copyright 2010 Marc-Andre Moreau @@ -63,11 +63,11 @@ void dump_data(unsigned char * p, int len, int width, char* name) printf("\n"); } -void assert_stream(STREAM* s, uint8* data, int length, const char* func, int line) +void assert_stream(STREAM* s, BYTE* data, int length, const char* func, int line) { int i; int actual_length; - uint8* actual_data; + BYTE* actual_data; actual_data = s->data; actual_length = stream_get_length(s); @@ -104,7 +104,7 @@ void assert_stream(STREAM* s, uint8* data, int length, const char* func, int lin } } -typedef boolean (*pInitTestSuite)(void); +typedef BOOL (*pInitTestSuite)(void); struct _test_suite { diff --git a/cunit/test_freerdp.h b/cunit/test_freerdp.h index d9d223043..7a537f443 100644 --- a/cunit/test_freerdp.h +++ b/cunit/test_freerdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Unit Tests * * Copyright 2010 Marc-Andre Moreau @@ -38,6 +38,6 @@ } void dump_data(unsigned char * p, int len, int width, char* name); -void assert_stream(STREAM* s, uint8* data, int length, const char* func, int line); +void assert_stream(STREAM* s, BYTE* data, int length, const char* func, int line); #define ASSERT_STREAM(_s, _data, _length) assert_stream(_s, _data, _length, __FUNCTION__, __LINE__) diff --git a/cunit/test_gcc.c b/cunit/test_gcc.c index 1b86d4b0e..dcf307f3d 100644 --- a/cunit/test_gcc.c +++ b/cunit/test_gcc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.124 Generic Conference Control (GCC) Unit Tests * * Copyright 2011 Marc-Andre Moreau @@ -48,7 +48,7 @@ int add_gcc_suite(void) return 0; } -uint8 gcc_user_data[284] = +BYTE gcc_user_data[284] = "\x01\xc0\xd8\x00\x04\x00\x08\x00\x00\x05\x00\x04\x01\xCA\x03\xAA" "\x09\x04\x00\x00\xCE\x0E\x00\x00\x45\x00\x4c\x00\x54\x00\x4f\x00" "\x4e\x00\x53\x00\x2d\x00\x44\x00\x45\x00\x56\x00\x32\x00\x00\x00" @@ -68,7 +68,7 @@ uint8 gcc_user_data[284] = "\x00\x00\x80\x80\x63\x6c\x69\x70\x72\x64\x72\x00\x00\x00\xA0\xC0" "\x72\x64\x70\x73\x6e\x64\x00\x00\x00\x00\x00\xc0"; -uint8 gcc_conference_create_request_expected[307] = +BYTE gcc_conference_create_request_expected[307] = "\x00\x05\x00\x14\x7C\x00\x01\x81\x2A\x00\x08\x00\x10\x00\x01\xC0" "\x00\x44\x75\x63\x61\x81\x1c\x01\xc0\xd8\x00\x04\x00\x08\x00\x00" "\x05\x00\x04\x01\xCA\x03\xAA\x09\x04\x00\x00\xCE\x0E\x00\x00\x45" @@ -102,10 +102,10 @@ void test_gcc_write_conference_create_request(void) s = stream_new(sizeof(gcc_conference_create_request_expected)); gcc_write_conference_create_request(s, &user_data); - ASSERT_STREAM(s, (uint8*) gcc_conference_create_request_expected, sizeof(gcc_conference_create_request_expected)); + ASSERT_STREAM(s, (BYTE*) gcc_conference_create_request_expected, sizeof(gcc_conference_create_request_expected)); } -uint8 gcc_client_core_data_expected[216] = +BYTE gcc_client_core_data_expected[216] = "\x01\xc0\xd8\x00\x04\x00\x08\x00\x00\x05\x00\x04\x01\xCA\x03\xAA" "\x09\x04\x00\x00\xCE\x0E\x00\x00\x45\x00\x4c\x00\x54\x00\x4f\x00" "\x4e\x00\x53\x00\x2d\x00\x44\x00\x45\x00\x56\x00\x32\x00\x00\x00" @@ -142,10 +142,10 @@ void test_gcc_write_client_core_data(void) gcc_write_client_core_data(s, settings); - ASSERT_STREAM(s, (uint8*) gcc_client_core_data_expected, sizeof(gcc_client_core_data_expected)); + ASSERT_STREAM(s, (BYTE*) gcc_client_core_data_expected, sizeof(gcc_client_core_data_expected)); } -uint8 gcc_client_security_data_expected[12] = +BYTE gcc_client_security_data_expected[12] = "\x02\xC0\x0C\x00\x1B\x00\x00\x00\x00\x00\x00\x00"; void test_gcc_write_client_security_data(void) @@ -165,10 +165,10 @@ void test_gcc_write_client_security_data(void) gcc_write_client_security_data(s, settings); - ASSERT_STREAM(s, (uint8*) gcc_client_security_data_expected, sizeof(gcc_client_security_data_expected)); + ASSERT_STREAM(s, (BYTE*) gcc_client_security_data_expected, sizeof(gcc_client_security_data_expected)); } -uint8 gcc_client_cluster_data_expected[12] = +BYTE gcc_client_cluster_data_expected[12] = "\x04\xC0\x0C\x00\x0D\x00\x00\x00\x00\x00\x00\x00"; void test_gcc_write_client_cluster_data(void) @@ -181,10 +181,10 @@ void test_gcc_write_client_cluster_data(void) gcc_write_client_cluster_data(s, settings); - ASSERT_STREAM(s, (uint8*) gcc_client_cluster_data_expected, sizeof(gcc_client_cluster_data_expected)); + ASSERT_STREAM(s, (BYTE*) gcc_client_cluster_data_expected, sizeof(gcc_client_cluster_data_expected)); } -uint8 gcc_client_network_data_expected[44] = +BYTE gcc_client_network_data_expected[44] = "\x03\xC0\x2C\x00\x03\x00\x00\x00\x72\x64\x70\x64\x72\x00\x00\x00" "\x00\x00\x80\x80\x63\x6c\x69\x70\x72\x64\x72\x00\x00\x00\xA0\xC0" "\x72\x64\x70\x73\x6e\x64\x00\x00\x00\x00\x00\xc0"; @@ -211,5 +211,5 @@ void test_gcc_write_client_network_data(void) gcc_write_client_network_data(s, settings); - ASSERT_STREAM(s, (uint8*) gcc_client_network_data_expected, sizeof(gcc_client_network_data_expected)); + ASSERT_STREAM(s, (BYTE*) gcc_client_network_data_expected, sizeof(gcc_client_network_data_expected)); } diff --git a/cunit/test_gcc.h b/cunit/test_gcc.h index 2ddce03ff..3bdf99f37 100644 --- a/cunit/test_gcc.h +++ b/cunit/test_gcc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.124 Generic Conference Control (GCC) Unit Tests * * Copyright 2011 Marc-Andre Moreau diff --git a/cunit/test_gdi.c b/cunit/test_gdi.c index fe598fa71..49937cb9d 100644 --- a/cunit/test_gdi.c +++ b/cunit/test_gdi.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Unit Tests * * Copyright 2010 Marc-Andre Moreau @@ -1162,7 +1162,7 @@ unsigned char polygon_case_2[256] = int CompareBitmaps(HGDI_BITMAP hBmp1, HGDI_BITMAP hBmp2) { int x, y; - uint8 *p1, *p2; + BYTE *p1, *p2; int minw = (hBmp1->width < hBmp2->width) ? hBmp1->width : hBmp2->width; int minh = (hBmp1->height < hBmp2->height) ? hBmp1->height : hBmp2->height; @@ -1285,13 +1285,13 @@ void test_gdi_CreateBitmap(void) int bpp; int width; int height; - uint8* data; + BYTE* data; HGDI_BITMAP hBitmap; bpp = 32; width = 32; height = 16; - data = (uint8*) malloc(width * height * 4); + data = (BYTE*) malloc(width * height * 4); hBitmap = gdi_CreateBitmap(width, height, bpp, data); CU_ASSERT(hBitmap->objectType == GDIOBJECT_BITMAP); @@ -1481,7 +1481,7 @@ void test_gdi_LineTo(void) { HGDI_DC hdc; HGDI_PEN pen; - uint8* data; + BYTE* data; HGDI_BITMAP hBmp; HGDI_BITMAP hBmp_LineTo_1; HGDI_BITMAP hBmp_LineTo_2; @@ -1533,88 +1533,88 @@ void test_gdi_LineTo(void) clrconv->invert = 0; clrconv->palette = hPalette; - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_1, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_1, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_1 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_2, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_2, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_2 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_3, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_3, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_3 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_4, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_4, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_4 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_5, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_5, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_5 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_5, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_5, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_5 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_6, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_6, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_6 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_7, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_7, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_7 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_8, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_8, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_8 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_9, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_9, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_9 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_10, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_10, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_10 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_case_11, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_11, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_11 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_BLACK, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_BLACK, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_BLACK = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_NOTMERGEPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTMERGEPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_NOTMERGEPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_MASKNOTPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MASKNOTPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_MASKNOTPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_NOTCOPYPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTCOPYPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_NOTCOPYPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_MASKPENNOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MASKPENNOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_MASKPENNOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_NOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_NOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_XORPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_XORPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_XORPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_NOTMASKPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTMASKPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_NOTMASKPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_MASKPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MASKPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_MASKPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_NOTXORPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTXORPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_NOTXORPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_NOP, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOP, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_NOP = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_MERGENOTPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MERGENOTPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_MERGENOTPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_COPYPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_COPYPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_COPYPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_MERGEPENNOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MERGEPENNOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_MERGEPENNOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_MERGEPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MERGEPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_MERGEPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) line_to_R2_WHITE, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_WHITE, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_LineTo_R2_WHITE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); /* Test Case 1: (0,0) -> (15, 15) */ @@ -1823,7 +1823,7 @@ void test_gdi_Ellipse(void) { HGDI_DC hdc; HGDI_PEN pen; - uint8* data; + BYTE* data; HGDI_BITMAP hBmp; HGDI_BITMAP hBmp_Ellipse_1; HGDI_BITMAP hBmp_Ellipse_2; @@ -1851,13 +1851,13 @@ void test_gdi_Ellipse(void) clrconv->invert = 0; clrconv->palette = hPalette; - data = (uint8*) freerdp_image_convert((uint8*) ellipse_case_1, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) ellipse_case_1, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_Ellipse_1 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) ellipse_case_2, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) ellipse_case_2, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_Ellipse_2 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) ellipse_case_3, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) ellipse_case_3, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_Ellipse_3 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); /* Test Case 1: (0,0) -> (16, 16) */ @@ -1964,7 +1964,7 @@ void test_gdi_FillRect(void) void test_gdi_BitBlt_32bpp(void) { - uint8* data; + BYTE* data; HGDI_DC hdcSrc; HGDI_DC hdcDst; HGDI_BRUSH hBrush; @@ -2009,64 +2009,64 @@ void test_gdi_BitBlt_32bpp(void) clrconv->invert = 0; clrconv->palette = hPalette; - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); @@ -2218,7 +2218,7 @@ void test_gdi_BitBlt_32bpp(void) void test_gdi_BitBlt_16bpp(void) { - uint8* data; + BYTE* data; HGDI_DC hdcSrc; HGDI_DC hdcDst; HGDI_BRUSH hBrush; @@ -2263,64 +2263,64 @@ void test_gdi_BitBlt_16bpp(void) clrconv->invert = 0; clrconv->palette = hPalette; - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); @@ -2472,7 +2472,7 @@ void test_gdi_BitBlt_16bpp(void) void test_gdi_BitBlt_8bpp(void) { - uint8* data; + BYTE* data; HGDI_DC hdcSrc; HGDI_DC hdcDst; HGDI_BRUSH hBrush; @@ -2517,64 +2517,64 @@ void test_gdi_BitBlt_8bpp(void) clrconv->invert = 0; clrconv->palette = hPalette; - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); - data = (uint8*) freerdp_image_convert((uint8*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); + data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); diff --git a/cunit/test_gdi.h b/cunit/test_gdi.h index 14e0fd1cd..65187524a 100644 --- a/cunit/test_gdi.h +++ b/cunit/test_gdi.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Unit Tests * * Copyright 2010 Marc-Andre Moreau diff --git a/cunit/test_license.c b/cunit/test_license.c index 997ad6c63..f19b3259a 100644 --- a/cunit/test_license.c +++ b/cunit/test_license.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Licensing Unit Tests * * Copyright 2011 Marc-Andre Moreau @@ -55,7 +55,7 @@ int add_license_suite(void) /* Server License Request (2200 bytes) */ -uint8 server_license_request[2200] = +BYTE server_license_request[2200] = "\x01\x03\x98\x08\x84\xef\xae\x20\xb1\xd5\x9e\x36\x49\x1a\xe8\x2e" "\x0a\x99\x89\xac\x49\xa6\x47\x4f\x33\x9b\x5a\xb9\x95\x03\xa6\xc6" "\xc2\x3c\x3f\x61\x00\x00\x06\x00\x2c\x00\x00\x00\x4d\x00\x69\x00" @@ -197,7 +197,7 @@ uint8 server_license_request[2200] = /* Client New License Request (341 bytes) */ -uint8 client_new_license_request[341] = +BYTE client_new_license_request[341] = "\x13\x83\x55\x01\x01\x00\x00\x00\x00\x00\x01\x04\xdc\x73\xa0\xc8" "\x69\x25\x6b\x18\xaf\x0b\x94\x7a\xa9\xa5\x20\xaf\x8b\xbc\x0d\xcc" "\xa3\x95\xb7\xb9\xeb\x81\x5d\xbe\x0a\x10\x9c\xd8\x02\x00\x08\x01" @@ -223,21 +223,21 @@ uint8 client_new_license_request[341] = /* Server Platform Challenge (38 bytes) */ -uint8 server_platform_challenge[38] = +BYTE server_platform_challenge[38] = "\x02\x03\x26\x00\xff\xff\xff\xff\x50\xf7\x0a\x00\x46\x37\x85\x54" "\x8e\xc5\x91\x34\x97\x5d\x78\x94\xad\x3b\x81\xda\x88\x18\x56\x0f" "\x3a\xd1\xf1\x03\xef\x35"; /* Client Platform Challenge Response (66 bytes) */ -uint8 client_platform_challenge_response[66] = +BYTE client_platform_challenge_response[66] = "\x15\x83\x42\x00\x01\x00\x12\x00\xfa\xb4\xe8\x24\xcf\x56\xb2\x4e" "\x80\x02\xbd\xb6\x61\xfc\xdf\xe9\x6c\x44\x01\x00\x14\x00\xf8\xb5" "\xe8\x25\x3d\x0f\x3f\x70\x1d\xda\x60\x19\x16\xfe\x73\x1a\x45\x7e" "\x02\x71\x38\x23\x62\x5d\x10\x8b\x93\xc3\xf1\xe4\x67\x1f\x4a\xb6" "\x00\x0a"; -uint8 license_server_modulus[256] = +BYTE license_server_modulus[256] = "\x88\xad\x7c\x8f\x8b\x82\x76\x5a\xbd\x8f\x6f\x62\x18\xe1\xd9\xaa" "\x41\xfd\xed\x68\x01\xc6\x34\x35\xb0\x29\x04\xca\x4a\x4a\x1c\x7e" "\x80\x14\xf7\x8e\x77\xb8\x25\xff\x16\x47\x6f\xbd\xe2\x34\x3d\x2e" @@ -255,9 +255,9 @@ uint8 license_server_modulus[256] = "\x6a\x9d\x7d\xde\xae\xf9\xe6\xaf\x57\xae\xb9\x01\x96\x5d\xe0\x4d" "\xcd\xed\xc8\xd7\xf3\x01\x03\x38\x10\xbe\x7c\x42\x67\x01\xa7\x23"; -uint8 license_server_exponent[4] = "\x00\x01\x00\x01"; +BYTE license_server_exponent[4] = "\x00\x01\x00\x01"; -uint8 terminal_server_modulus[256] = +BYTE terminal_server_modulus[256] = "\xc8\x90\x6b\xf0\xc6\x58\x81\xa6\x89\x1c\x0e\xf2\xf6\xd9\x82\x12" "\x71\xa5\x6e\x51\xdb\xe0\x32\x66\xaa\x91\x77\x0e\x88\xab\x44\xb7" "\xd3\x97\xda\x78\x8f\x0e\x44\x26\x46\x7f\x16\xd4\xc6\x63\xeb\xca" @@ -275,22 +275,22 @@ uint8 terminal_server_modulus[256] = "\x88\x1f\xb4\x35\x0f\x7c\xc0\x75\x17\xc6\x67\xdd\x48\x80\xcb\x0a" "\xbe\x9d\xf6\x93\x60\x65\x34\xeb\x97\xaf\x65\x6d\xdf\xbf\x6f\x5b"; -uint8 terminal_server_exponent[4] = "\x00\x01\x00\x01"; +BYTE terminal_server_exponent[4] = "\x00\x01\x00\x01"; -uint8 client_random[32] = +BYTE client_random[32] = "\xdc\x73\xa0\xc8\x69\x25\x6b\x18\xaf\x0b\x94\x7a\xa9\xa5\x20\xaf" "\x8b\xbc\x0d\xcc\xa3\x95\xb7\xb9\xeb\x81\x5d\xbe\x0a\x10\x9c\xd8"; -uint8 server_random[32] = +BYTE server_random[32] = "\x84\xef\xae\x20\xb1\xd5\x9e\x36\x49\x1a\xe8\x2e\x0a\x99\x89\xac" "\x49\xa6\x47\x4f\x33\x9b\x5a\xb9\x95\x03\xa6\xc6\xc2\x3c\x3f\x61"; -uint8 premaster_secret[48] = +BYTE premaster_secret[48] = "\xcf\x7a\xdb\xcb\xfb\x0e\x15\x23\x87\x1c\x84\x81\xba\x9d\x4e\x15" "\xbb\xd2\x56\xbd\xd8\xf7\xf3\x16\xcc\x35\x3b\xe1\x93\x42\x78\xdd" "\x92\x9a\xe4\x7a\xe2\x99\xd4\x73\xb1\xaa\x6f\x55\x94\x3b\xc9\xbc"; -uint8 encrypted_premaster_secret[264] = +BYTE encrypted_premaster_secret[264] = "\xda\x9c\x5d\xa6\x68\x9d\xa3\x90\x67\x24\xf3\x3a\xea\xa1\xe2\x68" "\xad\x12\xf5\xf6\x0b\x7a\xac\x92\xb1\x69\x6f\x42\x55\x8a\xa0\xe2" "\x9b\x2c\xd0\xc7\xee\x33\x6c\x47\x79\xc3\x1e\xbf\x03\x8b\x95\x70" @@ -309,7 +309,7 @@ uint8 encrypted_premaster_secret[264] = "\x09\x83\x0b\xbc\x3d\x3e\x05\x47\x65\x96\x31\x8c\x6b\xc5\xe6\xa0" "\x00\x00\x00\x00\x00\x00\x00\x00"; -uint8 platform_challenge[10] = "\x54\x00\x45\x00\x53\x00\x54\x00\x00\x00"; +BYTE platform_challenge[10] = "\x54\x00\x45\x00\x53\x00\x54\x00\x00\x00"; void test_license(void) { @@ -374,44 +374,44 @@ void test_license(void) license_read_platform_challenge_packet(license, s); } -uint8 test_client_random[32] = +BYTE test_client_random[32] = "\xdc\x73\xa0\xc8\x69\x25\x6b\x18\xaf\x0b\x94\x7a\xa9\xa5\x20\xaf" "\x8b\xbc\x0d\xcc\xa3\x95\xb7\xb9\xeb\x81\x5d\xbe\x0a\x10\x9c\xd8"; -uint8 test_server_random[32] = +BYTE test_server_random[32] = "\x16\x7e\xf8\x71\x48\x16\x1a\x4f\xa5\x2c\xcd\x73\x63\x60\xa6\xc3" "\xb9\x19\x1b\x4b\x6b\xb2\x0a\xb8\xec\xf1\x8d\x95\x4e\xa8\x21\xc5"; -uint8 test_premaster_secret[48] = +BYTE test_premaster_secret[48] = "\xcf\x7a\xdb\xcb\xfb\x0e\x15\x23\x87\x1c\x84\x81\xba\x9d\x4e\x15" "\xbb\xd2\x56\xbd\xd8\xf7\xf3\x16\xcc\x35\x3b\xe1\x93\x42\x78\xdd" "\x92\x9a\xe4\x7a\xe2\x99\xd4\x73\xb1\xaa\x6f\x55\x94\x3b\xc9\xbc"; -uint8 test_modulus[64] = +BYTE test_modulus[64] = "\x23\xc9\xec\x0e\x9f\x1e\x0e\x1a\x78\xaf\xa5\x14\xd4\xf5\x45\xe4" "\x04\x6e\xf4\x01\xe9\xdf\x45\xd1\xc2\xae\xf4\x7f\xd3\xb9\xcb\xf3" "\x1a\x23\xa1\x0d\x4b\xd4\xd1\x4a\xd2\xd1\xc9\x7c\xab\x24\x8b\xb1" "\x5a\x93\xca\x34\x44\x17\xb5\xe4\xfe\xf7\x9a\xaa\x72\x0d\x41\x95"; -uint8 test_exponent[4] = "\x01\x00\x01\x00"; +BYTE test_exponent[4] = "\x01\x00\x01\x00"; -uint8 test_master_secret[48] = +BYTE test_master_secret[48] = "\xbe\x51\xee\x63\x23\x90\xd0\xf4\x3a\xce\x3a\x37\x65\xc3\xdd\xcf" "\xed\xf0\xc8\x19\xed\x77\x33\x4e\xfd\x2b\x7d\x5a\xe2\xca\xf3\x0a" "\xf1\x16\xe5\x0c\x78\x59\x7e\xd4\x4b\x57\xce\x17\x60\x3a\x5a\xb3"; -uint8 test_session_key_blob[48] = +BYTE test_session_key_blob[48] = "\x07\x4f\xa0\x2e\xee\xc4\x5a\x46\x21\x8c\xae\x01\x45\x02\x26\xe4" "\x54\x6b\x59\x10\xcc\x5b\xd1\x96\xd0\x5c\xeb\xc2\x96\x9b\x44\x7b" "\x1c\xd9\x66\xb1\x9e\x24\xaa\x60\x4f\x89\xd1\x4e\xf8\xb9\x55\x3b"; -uint8 test_mac_salt_key[16] = +BYTE test_mac_salt_key[16] = "\x07\x4f\xa0\x2e\xee\xc4\x5a\x46\x21\x8c\xae\x01\x45\x02\x26\xe4"; -uint8 test_licensing_encryption_key[16] = +BYTE test_licensing_encryption_key[16] = "\xf3\xb1\xe0\x3b\xfe\xb4\xf2\xc5\x28\xa9\x48\xcd\x90\xf1\x93\xe5"; -uint8 test_encrypted_premaster_secret[64] = +BYTE test_encrypted_premaster_secret[64] = "\x6b\xbc\x77\x9f\x20\x0c\x98\x39\xc1\x85\x77\xc8\x19\x87\xd8\x82" "\x93\xbd\x21\x69\x5f\x87\xe0\xd6\x4e\xad\x5e\x23\x13\x80\x8c\x63" "\x3e\xd6\x6e\x60\xc9\x40\xe9\x86\x08\x8c\xd5\xaa\xa9\x54\xfe\x27" @@ -468,10 +468,10 @@ void test_license_encrypt_premaster_secret(void) ASSERT_STREAM(s, test_encrypted_premaster_secret, sizeof(test_encrypted_premaster_secret)); } -uint8 test_encrypted_platform_challenge[10] = +BYTE test_encrypted_platform_challenge[10] = "\x84\x0a\x42\x50\xad\x5e\xc1\x29\x30\xbd"; -uint8 test_platform_challenge[10] = +BYTE test_platform_challenge[10] = "\x54\x00\x45\x00\x53\x00\x54\x00\x00\x00"; void test_license_decrypt_platform_challenge(void) @@ -483,7 +483,7 @@ void test_license_decrypt_platform_challenge(void) sizeof(test_licensing_encryption_key)); license->encrypted_platform_challenge->data = - (uint8*) xmalloc(sizeof(test_encrypted_platform_challenge)); + (BYTE*) malloc(sizeof(test_encrypted_platform_challenge)); license->encrypted_platform_challenge->length = sizeof(test_encrypted_platform_challenge); diff --git a/cunit/test_license.h b/cunit/test_license.h index 83e6f12bb..1c6e8027c 100644 --- a/cunit/test_license.h +++ b/cunit/test_license.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Licensing Unit Tests * * Copyright 2011 Marc-Andre Moreau diff --git a/cunit/test_mcs.c b/cunit/test_mcs.c index eac0d0580..6f1fd6e0d 100644 --- a/cunit/test_mcs.c +++ b/cunit/test_mcs.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.125 Multipoint Communication Service (MCS) Protocol Unit Tests * * Copyright 2011 Marc-Andre Moreau @@ -44,7 +44,7 @@ int add_mcs_suite(void) return 0; } -uint8 gcc_CCrq[307] = +BYTE gcc_CCrq[307] = "\x00\x05\x00\x14\x7C\x00\x01\x81\x2A\x00\x08\x00\x10\x00\x01\xC0" "\x00\x44\x75\x63\x61\x81\x1c\x01\xc0\xd8\x00\x04\x00\x08\x00\x00" "\x05\x00\x04\x01\xCA\x03\xAA\x09\x04\x00\x00\xCE\x0E\x00\x00\x45" @@ -66,7 +66,7 @@ uint8 gcc_CCrq[307] = "\x64\x72\x00\x00\x00\xA0\xC0\x72\x64\x70\x73\x6e\x64\x00\x00\x00" "\x00\x00\xc0"; -uint8 mcs_connect_initial_expected[409] = +BYTE mcs_connect_initial_expected[409] = "\x7F\x65\x82\x01\x94\x04\x01\x01\x04\x01\x01\x01\x01\xFF\x30\x19" "\x02\x01\x22\x02\x01\x02\x02\x01\x00\x02\x01\x01\x02\x01\x00\x02" "\x01\x01\x02\x02\xFF\xFF\x02\x01\x02\x30\x19\x02\x01\x01\x02\x01" @@ -109,7 +109,7 @@ void test_mcs_write_connect_initial(void) s = stream_new(512); mcs_write_connect_initial(s, mcs, user_data); - ASSERT_STREAM(s, (uint8*) mcs_connect_initial_expected, sizeof(mcs_connect_initial_expected)); + ASSERT_STREAM(s, (BYTE*) mcs_connect_initial_expected, sizeof(mcs_connect_initial_expected)); stream_free(s); } diff --git a/cunit/test_mcs.h b/cunit/test_mcs.h index 60d42956c..94307c35d 100644 --- a/cunit/test_mcs.h +++ b/cunit/test_mcs.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.125 Multipoint Communication Service (MCS) Protocol Unit Tests * * Copyright 2011 Marc-Andre Moreau diff --git a/cunit/test_mppc.c b/cunit/test_mppc.c index 177792385..9c361c604 100644 --- a/cunit/test_mppc.c +++ b/cunit/test_mppc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Microsoft Point to Point Compression (MPPC) Unit Tests * * Copyright 2011 Laxmikant Rashinkar @@ -24,7 +24,7 @@ #include "rdp.h" #include "test_mppc.h" -uint8_t compressed_rd5[] = +BYTE_t compressed_rd5[] = { 0x24, 0x02, 0x03, 0x09, 0x00, 0x20, 0x0c, 0x05, 0x10, 0x01, 0x40, 0x0a, 0xbf, 0xdf, 0xc3, 0x20, 0x80, 0x00, 0x1f, 0x0a, 0x00, 0x00, 0x07, 0x43, 0x4e, 0x00, 0x68, 0x02, 0x00, 0x22, 0x00, 0x34, @@ -206,7 +206,7 @@ uint8_t compressed_rd5[] = 0x7f, 0x52, 0x00 }; -uint8_t decompressed_rd5[] = +BYTE_t decompressed_rd5[] = { 0x24, 0x02, 0x03, 0x09, 0x00, 0x20, 0x0c, 0x05, 0x10, 0x01, 0x40, 0x0a, 0xff, 0xff, 0x0c, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x0d, 0x38, 0x01, 0xc0, 0x10, 0x01, 0x10, @@ -636,8 +636,8 @@ int add_mppc_suite(void) void test_mppc(void) { struct rdp_mppc_dec* rmppc; - uint32_t roff; - uint32_t rlen; + UINT32_t roff; + UINT32_t rlen; long int dur; struct timeval start_time; @@ -650,7 +650,7 @@ void test_mppc(void) /* uncompress data */ CU_ASSERT(decompress_rdp_5(rmppc, compressed_rd5, sizeof(compressed_rd5), - PACKET_COMPRESSED, &roff, &rlen) == true); + PACKET_COMPRESSED, &roff, &rlen) == TRUE); /* get end time */ gettimeofday(&end_time, NULL); diff --git a/cunit/test_mppc.h b/cunit/test_mppc.h index 9059dbb2f..a01b67236 100644 --- a/cunit/test_mppc.h +++ b/cunit/test_mppc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Microsoft Point to Point compression (MPPC) Unit Tests * * Copyright 2011 Laxmikant Rashinkar diff --git a/cunit/test_mppc_enc.c b/cunit/test_mppc_enc.c index de79e064e..fe49c0117 100644 --- a/cunit/test_mppc_enc.c +++ b/cunit/test_mppc_enc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Microsoft Point to Point Compression (MPPC) Unit Tests * * Copyright 2012 Laxmikant Rashinkar @@ -494,8 +494,8 @@ void test_mppc_enc(void) /* needed by decoder */ struct rdp_mppc_dec* rmppc; - uint32 roff; - uint32 rlen; + UINT32 roff; + UINT32 rlen; /* required for timing the test */ struct timeval start_time; @@ -525,13 +525,13 @@ void test_mppc_enc(void) block_num++; total += bytes_read; DLOG(("block_num=%d\n", block_num)); - CU_ASSERT(compress_rdp(enc, (uint8*) buf, bytes_read) != false); + CU_ASSERT(compress_rdp(enc, (BYTE*) buf, bytes_read) != FALSE); if (enc->flags & PACKET_COMPRESSED) { DLOG(("%d bytes compressed to %d\n", bytes_read, enc->bytes_in_opb)); clen += enc->bytes_in_opb; - CU_ASSERT(decompress_rdp_5(rmppc, (uint8 *) enc->outputBuffer, - enc->bytes_in_opb, enc->flags, &roff, &rlen) != false); + CU_ASSERT(decompress_rdp_5(rmppc, (BYTE *) enc->outputBuffer, + enc->bytes_in_opb, enc->flags, &roff, &rlen) != FALSE); CU_ASSERT(bytes_read == rlen); CU_ASSERT(memcmp(buf, &rmppc->history_buf[roff], rlen) == 0); } @@ -561,11 +561,11 @@ void test_mppc_enc(void) /* save starting time */ gettimeofday(&start_time, NULL); - CU_ASSERT(compress_rdp(enc, (uint8*) decompressed_rd5_data, data_len) != false); + CU_ASSERT(compress_rdp(enc, (BYTE*) decompressed_rd5_data, data_len) != FALSE); if (enc->flags & PACKET_COMPRESSED) { - CU_ASSERT(decompress_rdp_5(rmppc, (uint8 *) enc->outputBuffer, - enc->bytes_in_opb, enc->flags, &roff, &rlen) != false); + CU_ASSERT(decompress_rdp_5(rmppc, (BYTE *) enc->outputBuffer, + enc->bytes_in_opb, enc->flags, &roff, &rlen) != FALSE); CU_ASSERT(data_len == rlen); CU_ASSERT(memcmp(decompressed_rd5_data, &rmppc->history_buf[roff], rlen) == 0); } diff --git a/cunit/test_mppc_enc.h b/cunit/test_mppc_enc.h index 90da265dc..34e6d9d8d 100644 --- a/cunit/test_mppc_enc.h +++ b/cunit/test_mppc_enc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Microsoft Point to Point compression (MPPC) Unit Tests * * Copyright 2012 Laxmikant Rashinkar diff --git a/cunit/test_nsc.c b/cunit/test_nsc.c index 97ea25eb6..915d7b692 100644 --- a/cunit/test_nsc.c +++ b/cunit/test_nsc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Library Unit Tests * * Copyright 2012 Vic Lee @@ -34,7 +34,7 @@ #include "test_nsc.h" -static const uint8 nsc_data[] = +static const BYTE nsc_data[] = { 0x71, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x63, 0x63, 0x01, 0x64, 0x64, 0x00, 0x63, 0x63, 0x02, 0x64, 0x64, 0x00, @@ -48,7 +48,7 @@ static const uint8 nsc_data[] = 0x37, 0x37, 0x06, 0x37, 0x37, 0x37, 0x37, 0xff, 0xff, 0x90, 0xff, 0xff, 0xff, 0xff }; -static const uint8 nsc_stress_data[] = +static const BYTE nsc_stress_data[] = { 0xec, 0x04, 0x00, 0x00, 0xfb, 0x04, 0x00, 0x00, 0x74, 0x03, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00 , 0x03, 0x00, 0x00, 0x00, 0x94, 0x94, 0x0f, 0xa2, 0xb2, 0x8e, 0x61, 0x62, 0x82, 0x9b, 0xa8, 0xb0 @@ -273,7 +273,7 @@ static const uint8 nsc_stress_data[] = , 0x00, 0x00, 0xff, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uint8 rgb_scanline_data[] = +static const BYTE rgb_scanline_data[] = { 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, @@ -337,11 +337,11 @@ void test_nsc_decode(void) context = nsc_context_new(); nsc_context_set_cpu_opt(context, CPU_SSE2); - nsc_process_message(context, 32, 15, 10, (uint8*) nsc_data, sizeof(nsc_data)); + nsc_process_message(context, 32, 15, 10, (BYTE*) nsc_data, sizeof(nsc_data)); /*freerdp_hexdump(context->bmpdata, 15 * 10 * 4);*/ for (i = 0; i < 30000; i++) { - nsc_process_message(context, 32, 54, 44, (uint8*) nsc_stress_data, sizeof(nsc_stress_data)); + nsc_process_message(context, 32, 54, 44, (BYTE*) nsc_stress_data, sizeof(nsc_stress_data)); } nsc_context_free(context); } @@ -349,11 +349,11 @@ void test_nsc_decode(void) void test_nsc_encode(void) { int i; - uint8* rgb_data; + BYTE* rgb_data; STREAM* enc_stream; NSC_CONTEXT* context; - rgb_data = (uint8 *) malloc(64 * 64 * 3); + rgb_data = (BYTE *) malloc(64 * 64 * 3); for (i = 0; i < 64; i++) memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3); diff --git a/cunit/test_nsc.h b/cunit/test_nsc.h index 6f4f867dc..0d8dba90a 100644 --- a/cunit/test_nsc.h +++ b/cunit/test_nsc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Library Unit Tests * * Copyright 2012 Vic Lee diff --git a/cunit/test_ntlm.c b/cunit/test_ntlm.c index ff6d9095d..7f70bfc3b 100644 --- a/cunit/test_ntlm.c +++ b/cunit/test_ntlm.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * NTLM Security Package Unit Tests * * Copyright 2011-2012 Marc-Andre Moreau @@ -75,7 +75,7 @@ void test_ntlm_compute_ntlm_hash(void) context = ntlm_ContextNew(); ntlm_set_password(context, password); - ntlm_compute_ntlm_hash((uint16*) &password, ntlm_hash); + ntlm_compute_ntlm_hash((UINT16*) &password, ntlm_hash); ntlm_hash_good = 1; @@ -272,8 +272,8 @@ void test_ntlm_generate_client_signing_key(void) int i; NTLM_CONTEXT* ntlm; int client_signing_key_good; - uint8 exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; - uint8 expected_client_signing_key[16] = "\xbf\x5e\x42\x76\x55\x68\x38\x97\x45\xd3\xb4\x9f\x5e\x2f\xbc\x89"; + BYTE exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; + BYTE expected_client_signing_key[16] = "\xbf\x5e\x42\x76\x55\x68\x38\x97\x45\xd3\xb4\x9f\x5e\x2f\xbc\x89"; ntlm = ntlm_client_new(); memcpy(ntlm->exported_session_key, exported_session_key, sizeof(exported_session_key)); @@ -296,8 +296,8 @@ void test_ntlm_generate_server_signing_key(void) int i; NTLM_CONTEXT* ntlm; int server_signing_key_good; - uint8 exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; - uint8 expected_server_signing_key[16] = "\x9b\x3b\x64\x89\xda\x84\x52\x17\xd5\xc2\x6e\x90\x16\x3b\x42\x11"; + BYTE exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; + BYTE expected_server_signing_key[16] = "\x9b\x3b\x64\x89\xda\x84\x52\x17\xd5\xc2\x6e\x90\x16\x3b\x42\x11"; ntlm = ntlm_client_new(); memcpy(ntlm->exported_session_key, exported_session_key, sizeof(exported_session_key)); @@ -320,8 +320,8 @@ void test_ntlm_generate_client_sealing_key(void) int i; NTLM_CONTEXT* ntlm; int client_sealing_key_good; - uint8 exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; - uint8 expected_client_sealing_key[16] = "\xca\x41\xcd\x08\x48\x07\x22\x6e\x0d\x84\xc3\x88\xa5\x07\xa9\x73"; + BYTE exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; + BYTE expected_client_sealing_key[16] = "\xca\x41\xcd\x08\x48\x07\x22\x6e\x0d\x84\xc3\x88\xa5\x07\xa9\x73"; ntlm = ntlm_client_new(); memcpy(ntlm->exported_session_key, exported_session_key, sizeof(exported_session_key)); @@ -344,8 +344,8 @@ void test_ntlm_generate_server_sealing_key(void) int i; NTLM_CONTEXT* ntlm; int server_sealing_key_good; - uint8 exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; - uint8 expected_server_sealing_key[16] = "\x14\xb7\x1d\x06\x2c\x68\x2e\xad\x4b\x0e\x95\x23\x70\x91\x98\x90"; + BYTE exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; + BYTE expected_server_sealing_key[16] = "\x14\xb7\x1d\x06\x2c\x68\x2e\xad\x4b\x0e\x95\x23\x70\x91\x98\x90"; ntlm = ntlm_client_new(); memcpy(ntlm->exported_session_key, exported_session_key, sizeof(exported_session_key)); @@ -368,9 +368,9 @@ void test_ntlm_encrypt_random_session_key(void) int i; NTLM_CONTEXT* ntlm; int encrypted_random_session_key_good; - uint8 key_exchange_key[16] = "\x6e\xf1\x6b\x79\x88\xf2\x3d\x7e\x54\x2a\x1a\x38\x4e\xa0\x6b\x52"; - uint8 exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; - uint8 expected_encrypted_random_session_key[16] = "\xb1\xd2\x45\x42\x0f\x37\x9a\x0e\xe0\xce\x77\x40\x10\x8a\xda\xba"; + BYTE key_exchange_key[16] = "\x6e\xf1\x6b\x79\x88\xf2\x3d\x7e\x54\x2a\x1a\x38\x4e\xa0\x6b\x52"; + BYTE exported_session_key[16] = "\x89\x90\x0d\x5d\x2c\x53\x2b\x36\x31\xcc\x1a\x46\xce\xa9\x34\xf1"; + BYTE expected_encrypted_random_session_key[16] = "\xb1\xd2\x45\x42\x0f\x37\x9a\x0e\xe0\xce\x77\x40\x10\x8a\xda\xba"; ntlm = ntlm_client_new(); memcpy(ntlm->key_exchange_key, key_exchange_key, 16); @@ -395,15 +395,15 @@ void test_ntlm_compute_message_integrity_check(void) int i; NTLM_CONTEXT* ntlm; int message_integrity_check_good; - uint8 exported_session_key[16] = "\xfd\x35\x59\x39\x23\x81\x29\xcd\xb8\x1c\x11\x04\xd7\x54\x4f\xd4"; - uint8 expected_message_integrity_check[16] = "\x81\x37\x56\xcf\x19\x76\x71\xf2\xc0\x3f\x95\x87\xe3\x30\xe6\x9b"; + BYTE exported_session_key[16] = "\xfd\x35\x59\x39\x23\x81\x29\xcd\xb8\x1c\x11\x04\xd7\x54\x4f\xd4"; + BYTE expected_message_integrity_check[16] = "\x81\x37\x56\xcf\x19\x76\x71\xf2\xc0\x3f\x95\x87\xe3\x30\xe6\x9b"; - uint8 negotiate_message_data[40] = + BYTE negotiate_message_data[40] = "\x4e\x54\x4c\x4d\x53\x53\x50\x00\x01\x00\x00\x00\xb7\x82\x08\xe2" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x06\x01\xb0\x1d\x00\x00\x00\x0f"; - uint8 challenge_message_data[278] = + BYTE challenge_message_data[278] = "\x4e\x54\x4c\x4d\x53\x53\x50\x00\x02\x00\x00\x00\x16\x00\x16\x00" "\x38\x00\x00\x00\x35\x82\x89\xe2\xed\x75\x9b\x8d\x1c\x2e\x3e\xc8" "\x00\x00\x00\x00\x00\x00\x00\x00\xc8\x00\xc8\x00\x4e\x00\x00\x00" @@ -423,7 +423,7 @@ void test_ntlm_compute_message_integrity_check(void) "\x2e\x00\x63\x00\x78\x00\x07\x00\x08\x00\xd1\x12\x78\x10\xde\xd2" "\xcb\x01\x00\x00\x00\x00"; - uint8 authenticate_message_data[504] = + BYTE authenticate_message_data[504] = "\x4e\x54\x4c\x4d\x53\x53\x50\x00\x03\x00\x00\x00\x18\x00\x18\x00" "\x98\x00\x00\x00\x38\x01\x38\x01\xb0\x00\x00\x00\x16\x00\x16\x00" "\x58\x00\x00\x00\x1a\x00\x1a\x00\x6e\x00\x00\x00\x10\x00\x10\x00" @@ -485,22 +485,22 @@ void test_ntlm_compute_message_integrity_check(void) void test_ntlm_encrypt_message(void) { int i; - uint8* p; + BYTE* p; NTLM_CONTEXT* ntlm; rdpBlob public_key; rdpBlob ts_credentials; rdpBlob encrypted_public_key; rdpBlob encrypted_ts_credentials; - uint8 public_key_signature[16]; - uint8 ts_credentials_signature[16]; + BYTE public_key_signature[16]; + BYTE ts_credentials_signature[16]; int encrypted_public_key_good; int public_key_signature_good; int encrypted_ts_credentials_good; int ts_credentials_signature_good; - uint8 client_signing_key[16] = "\xbf\x5e\x42\x76\x55\x68\x38\x97\x45\xd3\xb4\x9f\x5e\x2f\xbc\x89"; - uint8 client_sealing_key[16] = "\xca\x41\xcd\x08\x48\x07\x22\x6e\x0d\x84\xc3\x88\xa5\x07\xa9\x73"; + BYTE client_signing_key[16] = "\xbf\x5e\x42\x76\x55\x68\x38\x97\x45\xd3\xb4\x9f\x5e\x2f\xbc\x89"; + BYTE client_sealing_key[16] = "\xca\x41\xcd\x08\x48\x07\x22\x6e\x0d\x84\xc3\x88\xa5\x07\xa9\x73"; - uint8 public_key_data[270] = + BYTE public_key_data[270] = "\x30\x82\x01\x0a\x02\x82\x01\x01\x00\xc2\x1c\x54\xaf\x07\xf1\x16" "\x97\xc3\x0f\x6b\xa6\x33\x2e\xdd\x1e\xe4\xb2\x9c\xe4\x12\x7f\xda" "\x58\x21\xc0\x68\xe6\xd3\xf5\x20\x1c\xba\x06\x64\x7d\x7f\x44\xb5" @@ -519,7 +519,7 @@ void test_ntlm_encrypt_message(void) "\x1b\xbc\x0b\x47\x66\x16\x3a\x7b\x6d\x8e\xcf\x55\xe8\x8c\x8a\xfe" "\x24\xce\x19\x99\xc3\x5a\xe5\xc2\xf3\x02\x03\x01\x00\x01"; - uint8 expected_encrypted_public_key[270] = + BYTE expected_encrypted_public_key[270] = "\x27\x29\x73\xa9\xfa\x46\x17\x3c\x74\x14\x45\x2a\xd1\xe2\x92\xa1" "\xc6\x0a\x30\xd4\xcc\xe0\x92\xf6\xb3\x20\xb3\xa0\xf1\x38\xb1\xf4" "\xe5\x96\xdf\xa1\x65\x5b\xd6\x0c\x2a\x86\x99\xcc\x72\x80\xbd\xe9" @@ -538,24 +538,24 @@ void test_ntlm_encrypt_message(void) "\xfb\xc9\xfc\x89\xaa\x5d\x25\x49\xc8\x6e\x86\xee\xc2\xce\xc4\x8e" "\x85\x9f\xe8\x30\xb3\x86\x11\xd5\xb8\x34\x4a\xe0\x03\xe5"; - uint8 expected_public_key_signature[16] = + BYTE expected_public_key_signature[16] = "\x01\x00\x00\x00\x91\x5e\xb0\x6e\x72\x82\x53\xae\x00\x00\x00\x00"; - uint8 ts_credentials_data[65] = + BYTE ts_credentials_data[65] = "\x30\x3f\xa0\x03\x02\x01\x01\xa1\x38\x04\x36\x30\x34\xa0\x0a\x04" "\x08\x77\x00\x69\x00\x6e\x00\x37\x00\xa1\x12\x04\x10\x75\x00\x73" "\x00\x65\x00\x72\x00\x6e\x00\x61\x00\x6d\x00\x65\x00\xa2\x12\x04" "\x10\x70\x00\x61\x00\x73\x00\x73\x00\x77\x00\x6f\x00\x72\x00\x64" "\x00"; - uint8 expected_encrypted_ts_credentials[65] = + BYTE expected_encrypted_ts_credentials[65] = "\xa8\x85\x7d\x11\xef\x92\xa0\xd6\xff\xee\xa1\xae\x6d\xc5\x2e\x4e" "\x65\x50\x28\x93\x75\x30\xe1\xc3\x37\xeb\xac\x1f\xdd\xf3\xe0\x92" "\xf6\x21\xbc\x8f\xa8\xd4\xe0\x5a\xa6\xff\xda\x09\x50\x24\x0d\x8f" "\x8f\xf4\x92\xfe\x49\x2a\x13\x52\xa6\x52\x75\x50\x8d\x3e\xe9\x6b" "\x57"; - uint8 expected_ts_credentials_signature[16] = + BYTE expected_ts_credentials_signature[16] = "\x01\x00\x00\x00\xb3\x2c\x3b\xa1\x36\xf6\x55\x71\x01\x00\x00\x00"; public_key.data = public_key_data; @@ -568,7 +568,7 @@ void test_ntlm_encrypt_message(void) ntlm_encrypt_message(ntlm, &public_key, &encrypted_public_key, public_key_signature); - p = (uint8*) encrypted_public_key.data; + p = (BYTE*) encrypted_public_key.data; encrypted_public_key_good = 1; for (i = 0; i < encrypted_public_key.length; i++) @@ -594,7 +594,7 @@ void test_ntlm_encrypt_message(void) ntlm_encrypt_message(ntlm, &ts_credentials, &encrypted_ts_credentials, ts_credentials_signature); - p = (uint8*) encrypted_ts_credentials.data; + p = (BYTE*) encrypted_ts_credentials.data; encrypted_ts_credentials_good = 1; for (i = 0; i < encrypted_ts_credentials.length; i++) @@ -619,15 +619,15 @@ void test_ntlm_encrypt_message(void) void test_ntlm_decrypt_message(void) { int i; - uint8* p; + BYTE* p; NTLM_CONTEXT* ntlm; rdpBlob public_key; rdpBlob encrypted_public_key; int public_key_good; - uint8 server_signing_key[16] = "\x9b\x3b\x64\x89\xda\x84\x52\x17\xd5\xc2\x6e\x90\x16\x3b\x42\x11"; - uint8 server_sealing_key[16] = "\x14\xb7\x1d\x06\x2c\x68\x2e\xad\x4b\x0e\x95\x23\x70\x91\x98\x90"; + BYTE server_signing_key[16] = "\x9b\x3b\x64\x89\xda\x84\x52\x17\xd5\xc2\x6e\x90\x16\x3b\x42\x11"; + BYTE server_sealing_key[16] = "\x14\xb7\x1d\x06\x2c\x68\x2e\xad\x4b\x0e\x95\x23\x70\x91\x98\x90"; - uint8 encrypted_public_key_data[270] = + BYTE encrypted_public_key_data[270] = "\xc7\x51\xf4\x71\xd3\x9f\xb6\x50\xbe\xa8\xf6\x20\x77\xa1\xfc\xdd" "\x8e\x02\xf0\xa4\x6b\xba\x3f\x9d\x65\x9d\xab\x4a\x95\xc9\xb4\x38" "\x03\x87\x04\xb1\xfe\x42\xec\xfa\xfc\xaa\x85\xf1\x31\x2d\x26\xcf" @@ -646,7 +646,7 @@ void test_ntlm_decrypt_message(void) "\xcd\x43\x3a\xce\x40\x74\xe1\x34\x81\xe3\x94\x47\x6f\x49\x01\xf8" "\xb5\xfc\xd0\x75\x80\xc6\x35\xac\xc0\xfd\x1b\xb5\xa2\xd3"; - uint8 expected_public_key[270] = + BYTE expected_public_key[270] = "\x31\x82\x01\x0a\x02\x82\x01\x01\x00\xc2\x1c\x54\xaf\x07\xf1\x16" "\x97\xc3\x0f\x6b\xa6\x33\x2e\xdd\x1e\xe4\xb2\x9c\xe4\x12\x7f\xda" "\x58\x21\xc0\x68\xe6\xd3\xf5\x20\x1c\xba\x06\x64\x7d\x7f\x44\xb5" @@ -665,7 +665,7 @@ void test_ntlm_decrypt_message(void) "\x1b\xbc\x0b\x47\x66\x16\x3a\x7b\x6d\x8e\xcf\x55\xe8\x8c\x8a\xfe" "\x24\xce\x19\x99\xc3\x5a\xe5\xc2\xf3\x02\x03\x01\x00\x01"; - uint8 public_key_signature[16] = + BYTE public_key_signature[16] = "\x01\x00\x00\x00\xc9\x88\xfc\xf1\x11\x68\x2c\x72\x00\x00\x00\x00"; encrypted_public_key.data = encrypted_public_key_data; @@ -678,7 +678,7 @@ void test_ntlm_decrypt_message(void) ntlm_decrypt_message(ntlm, &encrypted_public_key, &public_key, public_key_signature); - p = (uint8*) public_key.data; + p = (BYTE*) public_key.data; public_key_good = 1; for (i = 0; i < public_key.length; i++) diff --git a/cunit/test_ntlm.h b/cunit/test_ntlm.h index 7ea8cae66..348f3ee29 100644 --- a/cunit/test_ntlm.h +++ b/cunit/test_ntlm.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * NTLM Security Package Unit Tests * * Copyright 2011-2012 Marc-Andre Moreau diff --git a/cunit/test_orders.c b/cunit/test_orders.c index 34eb4632c..63ee2cec5 100644 --- a/cunit/test_orders.c +++ b/cunit/test_orders.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Drawing Orders Unit Tests * * Copyright 2011 Marc-Andre Moreau @@ -69,7 +69,7 @@ int add_orders_suite(void) return 0; } -uint8 dstblt_order[] = "\x48\x00\x37\x01"; +BYTE dstblt_order[] = "\x48\x00\x37\x01"; void test_read_dstblt_order(void) { @@ -94,7 +94,7 @@ void test_read_dstblt_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(dstblt_order) - 1)); } -uint8 patblt_order[] = "\x1a\x00\xc3\x01\x0d\x00\x0d\x00\xf0\xff\xff\x00\x5b\xef\x00\x81"; +BYTE patblt_order[] = "\x1a\x00\xc3\x01\x0d\x00\x0d\x00\xf0\xff\xff\x00\x5b\xef\x00\x81"; void test_read_patblt_order(void) { @@ -124,7 +124,7 @@ void test_read_patblt_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(patblt_order) - 1)); } -uint8 scrblt_order[] = "\x07\x00\xa1\x01\xf1\x00\xcc\x2f\x01\x8e\x00"; +BYTE scrblt_order[] = "\x07\x00\xa1\x01\xf1\x00\xcc\x2f\x01\x8e\x00"; void test_read_scrblt_order(void) { @@ -151,7 +151,7 @@ void test_read_scrblt_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(scrblt_order) - 1)); } -uint8 opaque_rect_order[] = "\x00\x04\x00\x03\x73\x02\x06"; +BYTE opaque_rect_order[] = "\x00\x04\x00\x03\x73\x02\x06"; void test_read_opaque_rect_order(void) { @@ -176,7 +176,7 @@ void test_read_opaque_rect_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(opaque_rect_order) - 1)); } -uint8 draw_nine_grid_order[] = "\xfb\xf9\x0d\x00"; +BYTE draw_nine_grid_order[] = "\xfb\xf9\x0d\x00"; void test_read_draw_nine_grid_order(void) { @@ -188,7 +188,7 @@ void test_read_draw_nine_grid_order(void) memset(orderInfo, 0, sizeof(ORDER_INFO)); orderInfo->fieldFlags = 0x1C; - orderInfo->deltaCoordinates = true; + orderInfo->deltaCoordinates = TRUE; memset(&draw_nine_grid, 0, sizeof(DRAW_NINE_GRID_ORDER)); draw_nine_grid.srcRight = 38; @@ -206,7 +206,7 @@ void test_read_draw_nine_grid_order(void) } -uint8 multi_opaque_rect_order[] = +BYTE multi_opaque_rect_order[] = "\x87\x01\x1c\x01\xf1\x00\x12\x00\x5c\xef\x04\x16\x00\x08\x40\x81" "\x87\x81\x1c\x80\xf1\x01\x01\x01\x10\x80\xf0\x01\x10\xff\x10\x10" "\x80\xf1\x01"; @@ -256,7 +256,7 @@ void test_read_multi_opaque_rect_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(multi_opaque_rect_order) - 1)); } -uint8 line_to_order[] = "\x03\xb1\x0e\xa6\x5b\xef\x00"; +BYTE line_to_order[] = "\x03\xb1\x0e\xa6\x5b\xef\x00"; void test_read_line_to_order(void) { @@ -268,7 +268,7 @@ void test_read_line_to_order(void) memset(orderInfo, 0, sizeof(ORDER_INFO)); orderInfo->fieldFlags = 0x021E; - orderInfo->deltaCoordinates = true; + orderInfo->deltaCoordinates = TRUE; memset(&line_to, 0, sizeof(LINE_TO_ORDER)); line_to.nXStart = 826; @@ -291,7 +291,7 @@ void test_read_line_to_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(line_to_order) - 1)); } -uint8 polyline_order[] = +BYTE polyline_order[] = "\xf8\x01\xb8\x02\x00\xc0\x00\x20\x6c\x00\x00\x00\x00\x00\x04\x00" "\x00\xff\x7e\x76\xff\x41\x6c\xff\x24\x62\xff\x2b\x59\xff\x55\x51" "\xff\x9c\x49\x73\x43\x80\x4d\xff\xbe\x80\x99\xff\xba\x80\xcd\xff" @@ -360,12 +360,12 @@ void test_read_polyline_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(polyline_order) - 1)); } -uint8 glyph_index_order_1[] = +BYTE glyph_index_order_1[] = "\x6a\x02\x27\x38\x00\x39\x07\x3a\x06\x3b\x07\x3c\x06\x3d\x06\x18" "\x04\x1f\x06\x17\x02\x14\x04\x1b\x06\x19\x06\x45\x05\x18\x06\x1f" "\x06\x1f\x02\x14\x02\x46\x06\xff\x15\x24"; -uint8 glyph_index_order_2[] = +BYTE glyph_index_order_2[] = "\x00\xff\xff\xff\x0c\x02\x6e\x01\x4d\x02\x7b\x01\x09\x02\x6e\x01" "\xf6\x02\x7b\x01\x0c\x02\x79\x01\x03\xfe\x04\x00"; @@ -379,7 +379,7 @@ void test_read_glyph_index_order(void) memset(orderInfo, 0, sizeof(ORDER_INFO)); orderInfo->fieldFlags = 0x200100; - orderInfo->deltaCoordinates = true; + orderInfo->deltaCoordinates = TRUE; memset(&glyph_index, 0, sizeof(GLYPH_INDEX_ORDER)); @@ -393,7 +393,7 @@ void test_read_glyph_index_order(void) memset(orderInfo, 0, sizeof(ORDER_INFO)); orderInfo->fieldFlags = 0x383FE8; - orderInfo->deltaCoordinates = true; + orderInfo->deltaCoordinates = TRUE; memset(&glyph_index, 0, sizeof(GLYPH_INDEX_ORDER)); @@ -415,7 +415,7 @@ void test_read_glyph_index_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(glyph_index_order_2) - 1)); } -uint8 fast_index_order[] = +BYTE fast_index_order[] = "\x07\x00\x03\xff\xff\x00\x74\x3b\x00\x0e\x00\x71\x00\x42\x00\x7e" "\x00\x00\x80\x7c\x00\x15\x00\x00\x01\x06\x02\x04\x03\x08\x05\x09" "\x06\x06\x06\x06\x07\x06\x08\x02\xff\x00\x12"; @@ -453,7 +453,7 @@ void test_read_fast_index_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(fast_index_order) - 1)); } -uint8 fast_glyph_order[] = +BYTE fast_glyph_order[] = "\x06\x00\x03\xff\xff\x00\x8b\x00\xb1\x00\x93\x00\xbe\x00\x0d\x00" "\xfe\x7f\x00\x80\x00\x80\xbb\x00\x13\x00\x01\x4a\x06\x0a\x80\x80" "\x80\xb8\xc4\x84\x84\x84\x84\x84\x00\x00\x68\x00"; @@ -489,7 +489,7 @@ void test_read_fast_glyph_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(fast_glyph_order) - 1)); } -uint8 polygon_cb_order[] = +BYTE polygon_cb_order[] = "\xea\x00\x46\x01\x0d\x01\x08\x00\x00\x04\x03\x81\x08\x03\x05\x88" "\x09\x26\x09\x77"; @@ -523,12 +523,12 @@ void test_read_polygon_cb_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(polygon_cb_order) - 1)); } -uint8 cache_bitmap_order[] = "\x00\x00\x10\x01\x08\x01\x00\x00\x00\x10"; +BYTE cache_bitmap_order[] = "\x00\x00\x10\x01\x08\x01\x00\x00\x00\x10"; void test_read_cache_bitmap_order(void) { STREAM _s, *s; - uint16 extraFlags; + UINT16 extraFlags; CACHE_BITMAP_ORDER cache_bitmap; s = &_s; @@ -537,7 +537,7 @@ void test_read_cache_bitmap_order(void) memset(&cache_bitmap, 0, sizeof(CACHE_BITMAP_ORDER)); - update_read_cache_bitmap_order(s, &cache_bitmap, true, extraFlags); + update_read_cache_bitmap_order(s, &cache_bitmap, TRUE, extraFlags); CU_ASSERT(cache_bitmap.cacheId == 0); CU_ASSERT(cache_bitmap.bitmapWidth == 16); @@ -549,7 +549,7 @@ void test_read_cache_bitmap_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(cache_bitmap_order) - 1)); } -uint8 cache_bitmap_v2_order[] = +BYTE cache_bitmap_v2_order[] = "\x20\x40\xdc\xff\xff\x85\xff\xff\x99\xd6\x99\xd6\x99\xd6\x99\xd6" "\x06\x8b\x99\xd6\x99\xd6\x99\xd6\x10\x84\x08\x42\x08\x42\x10\x84" "\x99\xd6\x99\xd6\x99\xd6\x99\xd6\x06\x84\x99\xd6\x99\xd6\x99\xd6" @@ -569,7 +569,7 @@ uint8 cache_bitmap_v2_order[] = void test_read_cache_bitmap_v2_order(void) { STREAM _s, *s; - uint16 extraFlags; + UINT16 extraFlags; CACHE_BITMAP_V2_ORDER cache_bitmap_v2; s = &_s; @@ -578,7 +578,7 @@ void test_read_cache_bitmap_v2_order(void) memset(&cache_bitmap_v2, 0, sizeof(CACHE_BITMAP_V2_ORDER)); - update_read_cache_bitmap_v2_order(s, &cache_bitmap_v2, true, extraFlags); + update_read_cache_bitmap_v2_order(s, &cache_bitmap_v2, TRUE, extraFlags); CU_ASSERT(cache_bitmap_v2.cacheId == 1); CU_ASSERT(cache_bitmap_v2.bitmapBpp == 16); @@ -591,7 +591,7 @@ void test_read_cache_bitmap_v2_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(cache_bitmap_v2_order) - 1)); } -uint8 cache_bitmap_v3_order[] = +BYTE cache_bitmap_v3_order[] = "\xff\x7f\x35\x50\xec\xbc\x74\x52\x65\xb7\x20\x00\x00\x00\x05\x00" "\x02\x00\x28\x00\x00\x00\x5b\x4f\x45\xff\x5b\x4f\x45\xff\x5b\x4f" "\x45\xff\x5b\x4f\x45\xff\x5b\x4f\x45\xff\x5b\x50\x45\xff\x5b\x50" @@ -600,7 +600,7 @@ uint8 cache_bitmap_v3_order[] = void test_read_cache_bitmap_v3_order(void) { STREAM _s, *s; - uint16 extraFlags; + UINT16 extraFlags; CACHE_BITMAP_V3_ORDER cache_bitmap_v3; s = &_s; @@ -609,7 +609,7 @@ void test_read_cache_bitmap_v3_order(void) memset(&cache_bitmap_v3, 0, sizeof(CACHE_BITMAP_V3_ORDER)); - update_read_cache_bitmap_v3_order(s, &cache_bitmap_v3, true, extraFlags); + update_read_cache_bitmap_v3_order(s, &cache_bitmap_v3, TRUE, extraFlags); CU_ASSERT(cache_bitmap_v3.cacheIndex == 32767); CU_ASSERT(cache_bitmap_v3.key1 == 0xBCEC5035); @@ -625,7 +625,7 @@ void test_read_cache_bitmap_v3_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(cache_bitmap_v3_order) - 1)); } -uint8 cache_brush_order[] = "\x00\x01\x08\x08\x81\x08\xaa\x55\xaa\x55\xaa\x55\xaa\x55"; +BYTE cache_brush_order[] = "\x00\x01\x08\x08\x81\x08\xaa\x55\xaa\x55\xaa\x55\xaa\x55"; void test_read_cache_brush_order(void) { @@ -649,7 +649,7 @@ void test_read_cache_brush_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(cache_brush_order) - 1)); } -uint8 create_offscreen_bitmap_order[] = "\x00\x80\x60\x01\x10\x00\x01\x00\x02\x00"; +BYTE create_offscreen_bitmap_order[] = "\x00\x80\x60\x01\x10\x00\x01\x00\x02\x00"; void test_read_create_offscreen_bitmap_order(void) { @@ -665,7 +665,7 @@ void test_read_create_offscreen_bitmap_order(void) deleteList = &(create_offscreen_bitmap.deleteList); deleteList->cIndices = 0; deleteList->sIndices = 16; - deleteList->indices = malloc(sizeof(uint16) * deleteList->sIndices); + deleteList->indices = malloc(sizeof(UINT16) * deleteList->sIndices); update_read_create_offscreen_bitmap_order(s, &create_offscreen_bitmap); @@ -677,7 +677,7 @@ void test_read_create_offscreen_bitmap_order(void) CU_ASSERT(stream_get_length(s) == (sizeof(create_offscreen_bitmap_order) - 1)); } -uint8 switch_surface_order[] = "\xff\xff"; +BYTE switch_surface_order[] = "\xff\xff"; void test_read_switch_surface_order(void) { @@ -700,7 +700,7 @@ int opaque_rect_count; int polyline_count; int patblt_count; -uint8 orders_update_1[] = +BYTE orders_update_1[] = "\x00\x00\x33\xd0\x07\x00\x80\xba\x0d\x0a\x7f\x1e\x2c\x4d\x00\x36" "\x02\xd3\x00\x47\x00\x4d\x00\xf0\x01\x87\x00\xc2\xdc\xff\x05\x7f" "\x0f\x67\x01\x90\x01\x8e\x01\xa5\x01\x67\x01\x90\x01\x28\x00\x16" @@ -710,7 +710,7 @@ uint8 orders_update_1[] = "\x03\x15\x0f\xf0\x65\x01\x15\xfe\x65\x01\xb0\xfd\x1d\x16\x01\xf0" "\xff\xff\x01\x01\x7a"; -uint8 orders_update_2[] = +BYTE orders_update_2[] = "\x00\x00\x45\x62\x03\x00\x93\x14\x55\x01\x50\xff\xff\xff\x55\x01" "\x50\x01\x01\x01\x55\x01\x50\xff\xff\xff\x16\x00\x17\x00\xea\x03" "\xea\x03\x02\x00\x85\x02\x16\x00\x02\x00\x00\x00\x03\x00\x14\xb2"; diff --git a/cunit/test_orders.h b/cunit/test_orders.h index eb7fb2936..861e6b4c7 100644 --- a/cunit/test_orders.h +++ b/cunit/test_orders.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Drawing Orders Unit Tests * * Copyright 2011 Marc-Andre Moreau diff --git a/cunit/test_pcap.c b/cunit/test_pcap.c index 4255f04d6..1b2711ff5 100644 --- a/cunit/test_pcap.c +++ b/cunit/test_pcap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * pcap File Format Unit Tests * * Copyright 2011 Marc-Andre Moreau @@ -42,14 +42,14 @@ int add_pcap_suite(void) return 0; } -uint8 test_packet_1[16] = +BYTE test_packet_1[16] = "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"; -uint8 test_packet_2[32] = +BYTE test_packet_2[32] = "\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB" "\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB"; -uint8 test_packet_3[64] = +BYTE test_packet_3[64] = "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC" "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC" "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC" @@ -58,7 +58,7 @@ uint8 test_packet_3[64] = typedef struct { void* data; - uint32 length; + UINT32 length; } test_packet; void test_pcap(void) @@ -74,7 +74,7 @@ void test_pcap(void) packets[2].data = test_packet_3; packets[2].length = sizeof(test_packet_3); - pcap = pcap_open("/tmp/test.pcap", true); + pcap = pcap_open("/tmp/test.pcap", TRUE); pcap_add_record(pcap, test_packet_1, sizeof(test_packet_1)); pcap_flush(pcap); pcap_add_record(pcap, test_packet_2, sizeof(test_packet_2)); @@ -82,7 +82,7 @@ void test_pcap(void) pcap_add_record(pcap, test_packet_3, sizeof(test_packet_3)); pcap_close(pcap); - pcap = pcap_open("/tmp/test.pcap", false); + pcap = pcap_open("/tmp/test.pcap", FALSE); int i = 0; while (pcap_has_next_record(pcap)) diff --git a/cunit/test_pcap.h b/cunit/test_pcap.h index f506edcaa..b9d78b820 100644 --- a/cunit/test_pcap.h +++ b/cunit/test_pcap.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * pcap File Format Unit Tests * * Copyright 2011 Marc-Andre Moreau diff --git a/cunit/test_rail.c b/cunit/test_rail.c index 1c363b3cc..f3fe4123f 100644 --- a/cunit/test_rail.c +++ b/cunit/test_rail.c @@ -1,5 +1,5 @@ /* - FreeRDP: A Remote Desktop Protocol client. + FreeRDP: A Remote Desktop Protocol Implementation RAIL(TS RemoteApp) Virtual Channel Unit Tests Copyright 2011 Vic Lee @@ -67,12 +67,12 @@ int add_rail_suite(void) } -static uint8 client_handshake[] = +static BYTE client_handshake[] = { 0x05, 0x00, 0x08, 0x00, 0xb0, 0x1d, 0x00, 0x00 }; -static uint8 client_info_pdu[] = +static BYTE client_info_pdu[] = { 0x0b, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00 }; @@ -82,7 +82,7 @@ static uint8 client_info_pdu[] = // WorkingDir: f:\windows\system32 // Arguments: www.bing.com -static uint8 client_execute_pdu[] = +static BYTE client_execute_pdu[] = { 0x01,0x00,0x5e,0x00,0x08,0x00,0x14,0x00,0x26,0x00,0x18,0x00,0x7c,0x00, 0x7c,0x00,0x69,0x00,0x65,0x00,0x78,0x00,0x70,0x00,0x6c,0x00,0x6f,0x00, @@ -93,7 +93,7 @@ static uint8 client_execute_pdu[] = 0x67,0x00,0x2e,0x00,0x63,0x00,0x6f,0x00,0x6d,0x00 }; -static uint8 client_activate_pdu[] = +static BYTE client_activate_pdu[] = { 0x02,0x00, 0x09,0x00, @@ -103,7 +103,7 @@ static uint8 client_activate_pdu[] = -static uint8 client_sysparam_highcontrast_pdu[] = +static BYTE client_sysparam_highcontrast_pdu[] = { 0x03,0x00, 0x12,0x00, @@ -115,7 +115,7 @@ static uint8 client_sysparam_highcontrast_pdu[] = }; -static uint8 client_sysparam_taskbarpos_pdu[] = +static BYTE client_sysparam_taskbarpos_pdu[] = { 0x03,0x00, 0x10,0x00, @@ -126,42 +126,42 @@ static uint8 client_sysparam_taskbarpos_pdu[] = 0xc2,0x03 // 0x03c2 }; -static uint8 client_sysparam_mousebuttonswap_pdu[] = +static BYTE client_sysparam_mousebuttonswap_pdu[] = { 0x03,0x00, 0x09,0x00, 0x21,0x00,0x00,0x00, // SPI_SETMOUSEBUTTONSWAP -0x00 // false +0x00 // FALSE }; -static uint8 client_sysparam_keyboardpref_pdu[] = +static BYTE client_sysparam_keyboardpref_pdu[] = { 0x03,0x00, 0x09,0x00, 0x45,0x00,0x00,0x00, // SPI_SETKEYBOARDPREF -0x00 // false +0x00 // FALSE }; -static uint8 client_sysparam_dragfullwindow_pdu[] = +static BYTE client_sysparam_dragfullwindow_pdu[] = { 0x03,0x00, 0x09,0x00, 0x25,0x00,0x00,0x00, // SPI_SETDRAGFULLWINDOWS -0x01 // true +0x01 // TRUE }; -static uint8 client_sysparam_keyboardcues_pdu[] = +static BYTE client_sysparam_keyboardcues_pdu[] = { 0x03,0x00, 0x09,0x00, 0x0b,0x10,0x00,0x00, //SPI_SETKEYBOARDCUES -0x00 // false +0x00 // FALSE }; -static uint8 client_sysparam_setworkarea_pdu[] = +static BYTE client_sysparam_setworkarea_pdu[] = { 0x03,0x00, 0x10,0x00, @@ -172,7 +172,7 @@ static uint8 client_sysparam_setworkarea_pdu[] = 0x9a,0x03 // 0x039a }; -static uint8 client_syscommand_pdu[] = +static BYTE client_syscommand_pdu[] = { 0x04,0x00, 0x0a,0x00, @@ -180,7 +180,7 @@ static uint8 client_syscommand_pdu[] = 0x20,0xf0 }; -static uint8 client_notify_pdu[] = +static BYTE client_notify_pdu[] = { 0x06,0x00, 0x10,0x00, @@ -189,7 +189,7 @@ static uint8 client_notify_pdu[] = 0x04,0x02,0x00,0x00 }; -static uint8 client_windowmove_pdu[] = +static BYTE client_windowmove_pdu[] = { 0x08,0x00, 0x10,0x00, @@ -200,7 +200,7 @@ static uint8 client_windowmove_pdu[] = 0x88,0x01 }; -static uint8 client_system_menu_pdu[] = +static BYTE client_system_menu_pdu[] = { 0x0c,0x00, 0x0c,0x00, @@ -209,35 +209,35 @@ static uint8 client_system_menu_pdu[] = 0x4a,0x02 }; -static uint8 client_langbar_pdu[] = +static BYTE client_langbar_pdu[] = { 0x0D,0x00,0x08,0x00,0x01,0x00,0x00,0x00 }; -static uint8 client_get_app_id_req_pdu[] = +static BYTE client_get_app_id_req_pdu[] = { 0x0E,0x00,0x08,0x00,0x52,0x00,0x02,0x00 }; -static uint8 server_handshake[] = +static BYTE server_handshake[] = { 0x05, 0x00, 0x08, 0x00, 0xb0, 0x1d, 0x00, 0x00 }; -static uint8 server_exec_result_pdu[] = +static BYTE server_exec_result_pdu[] = { 0x80,0x00,0x24,0x00,0x08,0x00,0x03,0x00,0x15,0x00,0x00,0x00,0x00,0x00, 0x14,0x00,0x7c,0x00,0x7c,0x00,0x57,0x00,0x72,0x00,0x6f,0x00,0x6e,0x00, 0x67,0x00,0x41,0x00,0x70,0x00,0x70,0x00 }; -static uint8 server_exec_result_exe_or_file[] = +static BYTE server_exec_result_exe_or_file[] = { 0x7c,0x00,0x7c,0x00,0x57,0x00,0x72,0x00,0x6f,0x00,0x6e,0x00, 0x67,0x00,0x41,0x00,0x70,0x00,0x70,0x00 }; -static uint8 server_sysparam1_pdu[] = +static BYTE server_sysparam1_pdu[] = { 0x03,0x00, 0x09,0x00, @@ -245,7 +245,7 @@ static uint8 server_sysparam1_pdu[] = 0x00 }; -static uint8 server_sysparam2_pdu[] = +static BYTE server_sysparam2_pdu[] = { 0x03,0x00, 0x09,0x00, @@ -253,31 +253,31 @@ static uint8 server_sysparam2_pdu[] = 0x00 }; -static uint8 server_localmovesize_start_pdu[] = +static BYTE server_localmovesize_start_pdu[] = { 0x09,0x00,0x10,0x00,0x8e,0x00,0x07,0x00,0x01,0x00,0x09,0x00,0x7e,0x01, 0x0a,0x00 }; -static uint8 server_localmovesize_stop_pdu[] = +static BYTE server_localmovesize_stop_pdu[] = { 0x09,0x00,0x10,0x00,0x8e,0x00,0x07,0x00,0x00,0x00,0x09,0x00,0xa6,0x00, 0x44,0x00 }; -static uint8 server_minmaxinfo_pdu[] = +static BYTE server_minmaxinfo_pdu[] = { 0x0a,0x00,0x18,0x00,0x8e,0x00,0x07,0x00,0x08,0x04,0xd6,0x02,0x00,0x00, 0x00,0x00,0x70,0x00,0x1b,0x00,0x0c,0x04,0x0c,0x03 }; -static uint8 server_langbar_pdu[] = +static BYTE server_langbar_pdu[] = { 0x0D,0x00,0x08,0x00,0x01,0x00,0x00,0x00 }; -static uint8 server_app_get_resp_pdu[] = +static BYTE server_app_get_resp_pdu[] = { 0x0F,0x00,0x08,0x02,0x52,0x00,0x02,0x00,0x6d,0x00,0x69,0x00,0x63,0x00, 0x72,0x00,0x6f,0x00,0x73,0x00,0x6f,0x00,0x66,0x00,0x74,0x00,0x2e,0x00, @@ -328,7 +328,7 @@ static uint8 server_app_get_resp_pdu[] = 0x00,0x00,0x00,0x00,0x00,0x00 }; -static uint8 server_app_get_resp_app_id[] = +static BYTE server_app_get_resp_app_id[] = { 0x6d,0x00,0x69,0x00,0x63,0x00,0x72,0x00,0x6f,0x00,0x73,0x00,0x6f,0x00, 0x66,0x00,0x74,0x00,0x2e,0x00,0x77,0x00,0x69,0x00,0x6e,0x6f,0x00,0x77, @@ -411,7 +411,7 @@ typedef struct typedef struct { RAIL_ORDERS order_info; - uint32 event_type; + UINT32 event_type; } RAIL_EVENT; @@ -459,7 +459,7 @@ int stream_equal_dump(void * dataS, size_t sizeS, void * data, size_t size) for (i=0; i < size; i++) { - if (((uint8*)dataS)[i] != ((uint8*)data)[i]) + if (((BYTE*)dataS)[i] != ((BYTE*)data)[i]) { printf("----------------- stream_equal_dump -----------------\n"); printf("Stream and dump have different content from %d offset.\n", (int) i); @@ -486,7 +486,7 @@ static void test_on_free_rail_client_event(RDP_EVENT* event) //----------------------------------------------------------------------------- static void send_ui_event2plugin( rdpChannels* chan_man, - uint16 event_type, + UINT16 event_type, void * data ) { @@ -533,7 +533,7 @@ static void save_dump(void* data, size_t size) } //----------------------------------------------------------------------------- static int emulate_client_send_channel_data( - freerdp* freerdp, int channelId, uint8* data, int size + freerdp* freerdp, int channelId, BYTE* data, int size ) { static int counter = 0; @@ -717,16 +717,16 @@ void test_rail_plugin(void) param.out_rail_orders.sysparam.taskbarPos.bottom = 0x03c2; param.out_rail_orders.sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP; - param.out_rail_orders.sysparam.mouseButtonSwap = false; + param.out_rail_orders.sysparam.mouseButtonSwap = FALSE; param.out_rail_orders.sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF; - param.out_rail_orders.sysparam.keyboardPref = false; + param.out_rail_orders.sysparam.keyboardPref = FALSE; param.out_rail_orders.sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS; - param.out_rail_orders.sysparam.dragFullWindows = true; + param.out_rail_orders.sysparam.dragFullWindows = TRUE; param.out_rail_orders.sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES; - param.out_rail_orders.sysparam.keyboardCues = false; + param.out_rail_orders.sysparam.keyboardCues = FALSE; param.out_rail_orders.sysparam.params |= SPI_MASK_SET_WORK_AREA; param.out_rail_orders.sysparam.workArea.left = 0; @@ -744,7 +744,7 @@ void test_rail_plugin(void) send_ui_event2plugin(chan_man, RDP_EVENT_TYPE_RAIL_CLIENT_EXEC_REMOTE_APP, ¶m.plugin_data); - param.out_rail_orders.activate.enabled = true; + param.out_rail_orders.activate.enabled = TRUE; param.out_rail_orders.activate.windowId = 0x0007008e; send_ui_event2plugin(chan_man, RDP_EVENT_TYPE_RAIL_CLIENT_ACTIVATE, ¶m.out_rail_orders.activate); @@ -829,18 +829,18 @@ void test_rail_plugin(void) ); CU_ASSERT(en > 2 && ee[ 2].event_type == RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_SYSPARAM && - ee[ 2].order_info.sysparam.setScreenSaveSecure == false + ee[ 2].order_info.sysparam.setScreenSaveSecure == FALSE ); CU_ASSERT(en > 3 && ee[ 3].event_type == RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_SYSPARAM && - ee[ 3].order_info.sysparam.setScreenSaveActive == false + ee[ 3].order_info.sysparam.setScreenSaveActive == FALSE ); CU_ASSERT(en > 4 && ee[ 4].event_type == RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_LOCALMOVESIZE && ee[ 4].order_info.localmovesize.windowId == 0x0007008e && - ee[ 4].order_info.localmovesize.isMoveSizeStart == true && + ee[ 4].order_info.localmovesize.isMoveSizeStart == TRUE && ee[ 4].order_info.localmovesize.moveSizeType == RAIL_WMSZ_MOVE && ee[ 4].order_info.localmovesize.posX == 0x017e && ee[ 4].order_info.localmovesize.posY == 0x000a @@ -849,7 +849,7 @@ void test_rail_plugin(void) CU_ASSERT(en > 5 && ee[ 5].event_type == RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_LOCALMOVESIZE && ee[ 5].order_info.localmovesize.windowId == 0x0007008e && - ee[ 5].order_info.localmovesize.isMoveSizeStart == false && + ee[ 5].order_info.localmovesize.isMoveSizeStart == FALSE && ee[ 5].order_info.localmovesize.moveSizeType == RAIL_WMSZ_MOVE && ee[ 5].order_info.localmovesize.posX == 0x00a6 && ee[ 5].order_info.localmovesize.posY == 0x0044 diff --git a/cunit/test_rail.h b/cunit/test_rail.h index a39d18e60..c56161632 100644 --- a/cunit/test_rail.h +++ b/cunit/test_rail.h @@ -1,5 +1,5 @@ /* - FreeRDP: A Remote Desktop Protocol client. + FreeRDP: A Remote Desktop Protocol Implementation RAIL(TS RemoteApp) Virtual Channel Unit Tests Copyright 2011 Roman Barabanov diff --git a/cunit/test_rfx.c b/cunit/test_rfx.c index b361cc900..f42ead986 100644 --- a/cunit/test_rfx.c +++ b/cunit/test_rfx.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library Unit Tests * * Copyright 2011 Vic Lee @@ -41,7 +41,7 @@ #include "test_rfx.h" -static const uint8 y_data[] = +static const BYTE y_data[] = { 0x19, 0x82, 0x1d, 0x10, 0x62, 0x9d, 0x28, 0x85, 0x2c, 0xa2, 0x14, 0xb2, 0x88, 0x52, 0xca, 0x21, 0x4b, 0x28, 0x85, 0x2c, 0xa2, 0x14, 0xb2, 0x88, 0x52, 0xca, 0x21, 0x4b, 0x28, @@ -64,7 +64,7 @@ static const uint8 y_data[] = 0x4d, 0x43, 0x46, 0xd7, 0xe9, 0xe2, 0x20, 0x30, 0x00 }; -static const uint8 cb_data[] = +static const BYTE cb_data[] = { 0x1b, 0x04, 0x7f, 0x04, 0x31, 0x5f, 0xc2, 0x94, 0xaf, 0x05, 0x29, 0x5e, 0x0a, 0x52, 0xbc, 0x14, 0xa5, 0x78, 0x29, 0x25, 0x78, 0x29, 0x25, @@ -89,7 +89,7 @@ static const uint8 cb_data[] = 0x77, 0x82, 0xbc, 0x00, 0x18, 0x00 }; -static const uint8 cr_data[] = +static const BYTE cr_data[] = { 0x1b, 0xfc, 0x11, 0xc1, 0x0f, 0x4a, 0xc1, 0x4f, 0x4a, 0xc1, 0x4f, 0x4a, 0xa1, 0x4d, 0x95, 0x42, 0x9e, 0x95, 0x42, 0x9e, 0x95, 0x42, 0x9b, 0x2a, 0x85, 0x3d, @@ -120,7 +120,7 @@ static const unsigned int test_quantization_values[] = 6, 6, 6, 6, 7, 7, 8, 8, 8, 9 }; -static const uint8 rgb_scanline_data[] = +static const BYTE rgb_scanline_data[] = { 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, @@ -157,7 +157,7 @@ static const uint8 rgb_scanline_data[] = 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF }; -static uint8* rgb_data; +static BYTE* rgb_data; int init_rfx_suite(void) { @@ -188,25 +188,25 @@ int add_rfx_suite(void) void test_bitstream(void) { - uint16 b; + UINT16 b; RFX_BITSTREAM* bs; bs = xnew(RFX_BITSTREAM); - rfx_bitstream_attach(bs, (uint8*) y_data, sizeof(y_data)); + rfx_bitstream_attach(bs, (BYTE*) y_data, sizeof(y_data)); while (!rfx_bitstream_eos(bs)) { rfx_bitstream_get_bits(bs, 3, b); (void) b; //printf("%u ", b); } - xfree(bs); + free(bs); //printf("\n"); } void test_bitstream_enc(void) { - uint8 buffer[10]; + BYTE buffer[10]; RFX_BITSTREAM* bs; int i; @@ -221,14 +221,14 @@ void test_bitstream_enc(void) { printf("%X ", buffer[i]); }*/ - xfree(bs); + free(bs); //printf("\n"); } -static sint16 buffer[4096]; +static INT16 buffer[4096]; -void dump_buffer(sint16* buf, int n) +void dump_buffer(INT16* buf, int n) { int i; @@ -274,7 +274,7 @@ void test_dwt(void) } /* Dump a .ppm image. */ -static void dump_ppm_image(uint8* image_buf) +static void dump_ppm_image(BYTE* image_buf) { static int frame_id = 0; char buf[100]; @@ -295,7 +295,7 @@ static void dump_ppm_image(uint8* image_buf) void test_decode(void) { RFX_CONTEXT* context; - uint8 decode_buffer[4096 * 3]; + BYTE decode_buffer[4096 * 3]; STREAM* s; s = stream_new(sizeof(y_data) + sizeof(cb_data) + sizeof(cr_data)); @@ -324,9 +324,9 @@ void test_encode(void) STREAM* enc_stream; int y_size, cb_size, cr_size; int i; - uint8 decode_buffer[4096 * 3]; + BYTE decode_buffer[4096 * 3]; - rgb_data = (uint8 *) malloc(64 * 64 * 3); + rgb_data = (BYTE *) malloc(64 * 64 * 3); for (i = 0; i < 64; i++) memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3); //freerdp_hexdump(rgb_data, 64 * 64 * 3); @@ -371,7 +371,7 @@ void test_message(void) RFX_RECT rect = {0, 0, 100, 80}; RFX_MESSAGE * message; - rgb_data = (uint8 *) malloc(100 * 80 * 3); + rgb_data = (BYTE *) malloc(100 * 80 * 3); for (i = 0; i < 80; i++) memcpy(rgb_data + i * 100 * 3, rgb_scanline_data, 100 * 3); diff --git a/cunit/test_rfx.h b/cunit/test_rfx.h index 0f95969fa..d44a94457 100644 --- a/cunit/test_rfx.h +++ b/cunit/test_rfx.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library Unit Tests * * Copyright 2011 Vic Lee diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index ae8acdede..d50abfa5b 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # include headers cmake build script # # Copyright 2011 O.S. Systems Software Ltda. @@ -21,14 +21,14 @@ file(GLOB FREERDP_HEADERS "freerdp/*.h") install(FILES ${FREERDP_HEADERS} DESTINATION include/freerdp) install(DIRECTORY freerdp/cache DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") -install(DIRECTORY freerdp/channels DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") install(DIRECTORY freerdp/codec DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") install(DIRECTORY freerdp/crypto DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") install(DIRECTORY freerdp/gdi DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") install(DIRECTORY freerdp/locale DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") -install(DIRECTORY freerdp/plugins DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") install(DIRECTORY freerdp/rail DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") -install(DIRECTORY freerdp/server DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") install(DIRECTORY freerdp/utils DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") +install(DIRECTORY freerdp/client DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") +install(DIRECTORY freerdp/server DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") +install(DIRECTORY freerdp/channels DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") diff --git a/include/freerdp/altsec.h b/include/freerdp/altsec.h index 08da67539..0eb67cbb5 100644 --- a/include/freerdp/altsec.h +++ b/include/freerdp/altsec.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Alternate Secondary Drawing Orders Interface API * * Copyright 2011 Marc-Andre Moreau @@ -38,130 +38,130 @@ struct _OFFSCREEN_DELETE_LIST { - uint32 sIndices; - uint32 cIndices; - uint16* indices; + UINT32 sIndices; + UINT32 cIndices; + UINT16* indices; }; typedef struct _OFFSCREEN_DELETE_LIST OFFSCREEN_DELETE_LIST; struct _CREATE_OFFSCREEN_BITMAP_ORDER { - uint32 id; - uint32 cx; - uint32 cy; + UINT32 id; + UINT32 cx; + UINT32 cy; OFFSCREEN_DELETE_LIST deleteList; }; typedef struct _CREATE_OFFSCREEN_BITMAP_ORDER CREATE_OFFSCREEN_BITMAP_ORDER; struct _SWITCH_SURFACE_ORDER { - uint32 bitmapId; + UINT32 bitmapId; }; typedef struct _SWITCH_SURFACE_ORDER SWITCH_SURFACE_ORDER; struct _NINE_GRID_BITMAP_INFO { - uint32 flFlags; - uint32 ulLeftWidth; - uint32 ulRightWidth; - uint32 ulTopHeight; - uint32 ulBottomHeight; - uint32 crTransparent; + UINT32 flFlags; + UINT32 ulLeftWidth; + UINT32 ulRightWidth; + UINT32 ulTopHeight; + UINT32 ulBottomHeight; + UINT32 crTransparent; }; typedef struct _NINE_GRID_BITMAP_INFO NINE_GRID_BITMAP_INFO; struct _CREATE_NINE_GRID_BITMAP_ORDER { - uint32 bitmapBpp; - uint32 bitmapId; - uint32 cx; - uint32 cy; + UINT32 bitmapBpp; + UINT32 bitmapId; + UINT32 cx; + UINT32 cy; NINE_GRID_BITMAP_INFO nineGridInfo; }; typedef struct _CREATE_NINE_GRID_BITMAP_ORDER CREATE_NINE_GRID_BITMAP_ORDER; struct _FRAME_MARKER_ORDER { - uint32 action; + UINT32 action; }; typedef struct _FRAME_MARKER_ORDER FRAME_MARKER_ORDER; struct _STREAM_BITMAP_FIRST_ORDER { - uint32 bitmapFlags; - uint32 bitmapBpp; - uint32 bitmapType; - uint32 bitmapWidth; - uint32 bitmapHeight; - uint32 bitmapSize; - uint32 bitmapBlockSize; - uint8* bitmapBlock; + UINT32 bitmapFlags; + UINT32 bitmapBpp; + UINT32 bitmapType; + UINT32 bitmapWidth; + UINT32 bitmapHeight; + UINT32 bitmapSize; + UINT32 bitmapBlockSize; + BYTE* bitmapBlock; }; typedef struct _STREAM_BITMAP_FIRST_ORDER STREAM_BITMAP_FIRST_ORDER; struct _STREAM_BITMAP_NEXT_ORDER { - uint32 bitmapFlags; - uint32 bitmapType; - uint32 bitmapBlockSize; - uint8* bitmapBlock; + UINT32 bitmapFlags; + UINT32 bitmapType; + UINT32 bitmapBlockSize; + BYTE* bitmapBlock; }; typedef struct _STREAM_BITMAP_NEXT_ORDER STREAM_BITMAP_NEXT_ORDER; struct _DRAW_GDIPLUS_FIRST_ORDER { - uint32 cbSize; - uint32 cbTotalSize; - uint32 cbTotalEmfSize; - uint8* emfRecords; + UINT32 cbSize; + UINT32 cbTotalSize; + UINT32 cbTotalEmfSize; + BYTE* emfRecords; }; typedef struct _DRAW_GDIPLUS_FIRST_ORDER DRAW_GDIPLUS_FIRST_ORDER; struct _DRAW_GDIPLUS_NEXT_ORDER { - uint32 cbSize; - uint8* emfRecords; + UINT32 cbSize; + BYTE* emfRecords; }; typedef struct _DRAW_GDIPLUS_NEXT_ORDER DRAW_GDIPLUS_NEXT_ORDER; struct _DRAW_GDIPLUS_END_ORDER { - uint32 cbSize; - uint32 cbTotalSize; - uint32 cbTotalEmfSize; - uint8* emfRecords; + UINT32 cbSize; + UINT32 cbTotalSize; + UINT32 cbTotalEmfSize; + BYTE* emfRecords; }; typedef struct _DRAW_GDIPLUS_END_ORDER DRAW_GDIPLUS_END_ORDER; struct _DRAW_GDIPLUS_CACHE_FIRST_ORDER { - uint32 flags; - uint32 cacheType; - uint32 cacheIndex; - uint32 cbSize; - uint32 cbTotalSize; - uint8* emfRecords; + UINT32 flags; + UINT32 cacheType; + UINT32 cacheIndex; + UINT32 cbSize; + UINT32 cbTotalSize; + BYTE* emfRecords; }; typedef struct _DRAW_GDIPLUS_CACHE_FIRST_ORDER DRAW_GDIPLUS_CACHE_FIRST_ORDER; struct _DRAW_GDIPLUS_CACHE_NEXT_ORDER { - uint32 flags; - uint32 cacheType; - uint32 cacheIndex; - uint32 cbSize; - uint8* emfRecords; + UINT32 flags; + UINT32 cacheType; + UINT32 cacheIndex; + UINT32 cbSize; + BYTE* emfRecords; }; typedef struct _DRAW_GDIPLUS_CACHE_NEXT_ORDER DRAW_GDIPLUS_CACHE_NEXT_ORDER; struct _DRAW_GDIPLUS_CACHE_END_ORDER { - uint32 flags; - uint32 cacheType; - uint32 cacheIndex; - uint32 cbSize; - uint32 cbTotalSize; - uint8* emfRecords; + UINT32 flags; + UINT32 cacheType; + UINT32 cacheIndex; + UINT32 cbSize; + UINT32 cbTotalSize; + BYTE* emfRecords; }; typedef struct _DRAW_GDIPLUS_CACHE_END_ORDER DRAW_GDIPLUS_CACHE_END_ORDER; @@ -181,7 +181,7 @@ typedef void (*pDrawGdiPlusCacheEnd)(rdpContext* context, DRAW_GDIPLUS_CACHE_END struct rdp_altsec_update { rdpContext* context; /* 0 */ - uint32 paddingA[16 - 1]; /* 1 */ + UINT32 paddingA[16 - 1]; /* 1 */ pCreateOffscreenBitmap CreateOffscreenBitmap; /* 16 */ pSwitchSurface SwitchSurface; /* 17 */ @@ -195,7 +195,7 @@ struct rdp_altsec_update pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst; /* 25 */ pDrawGdiPlusCacheNext DrawGdiPlusCacheNext; /* 26 */ pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; /* 27 */ - uint32 paddingB[32 - 28]; /* 28 */ + UINT32 paddingB[32 - 28]; /* 28 */ /* internal */ diff --git a/include/freerdp/api.h b/include/freerdp/api.h index 4bb44159a..5804715f6 100644 --- a/include/freerdp/api.h +++ b/include/freerdp/api.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Interface * * Copyright 2009-2011 Jay Sorg diff --git a/include/freerdp/cache/bitmap.h b/include/freerdp/cache/bitmap.h index 5455b1fc8..742184ab8 100644 --- a/include/freerdp/cache/bitmap.h +++ b/include/freerdp/cache/bitmap.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Bitmap Cache V2 * * Copyright 2011 Marc-Andre Moreau @@ -33,7 +33,7 @@ typedef struct rdp_bitmap_cache rdpBitmapCache; struct _BITMAP_V2_CELL { - uint32 number; + UINT32 number; rdpBitmap** entries; }; @@ -45,11 +45,11 @@ struct rdp_bitmap_cache pCacheBitmapV2 CacheBitmapV2; /* 3 */ pCacheBitmapV3 CacheBitmapV3; /* 4 */ pBitmapUpdate BitmapUpdate; /* 5 */ - uint32 paddingA[16 - 6]; /* 6 */ + UINT32 paddingA[16 - 6]; /* 6 */ - uint32 maxCells; /* 16 */ + UINT32 maxCells; /* 16 */ BITMAP_V2_CELL* cells; /* 17 */ - uint32 paddingB[32 - 18]; /* 18 */ + UINT32 paddingB[32 - 18]; /* 18 */ /* internal */ @@ -59,8 +59,8 @@ struct rdp_bitmap_cache rdpSettings* settings; }; -FREERDP_API rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmap_cache, uint32 id, uint32 index); -FREERDP_API void bitmap_cache_put(rdpBitmapCache* bitmap_cache, uint32 id, uint32 index, rdpBitmap* bitmap); +FREERDP_API rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmap_cache, UINT32 id, UINT32 index); +FREERDP_API void bitmap_cache_put(rdpBitmapCache* bitmap_cache, UINT32 id, UINT32 index, rdpBitmap* bitmap); FREERDP_API void bitmap_cache_register_callbacks(rdpUpdate* update); diff --git a/include/freerdp/cache/brush.h b/include/freerdp/cache/brush.h index 8349d11b2..046fce0e0 100644 --- a/include/freerdp/cache/brush.h +++ b/include/freerdp/cache/brush.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Brush Cache * * Copyright 2011 Marc-Andre Moreau @@ -33,7 +33,7 @@ typedef struct rdp_brush_cache rdpBrushCache; struct _BRUSH_ENTRY { - uint32 bpp; + UINT32 bpp; void* entry; }; @@ -43,21 +43,21 @@ struct rdp_brush_cache pCacheBrush CacheBrush; /* 1 */ pPolygonSC PolygonSC; /* 2 */ pPolygonCB PolygonCB; /* 3 */ - uint32 paddingA[16 - 4]; /* 4 */ + UINT32 paddingA[16 - 4]; /* 4 */ - uint32 maxEntries; /* 16 */ - uint32 maxMonoEntries; /* 17 */ + UINT32 maxEntries; /* 16 */ + UINT32 maxMonoEntries; /* 17 */ BRUSH_ENTRY* entries; /* 18 */ BRUSH_ENTRY* monoEntries; /* 19 */ - uint32 paddingB[32 - 20]; /* 20 */ + UINT32 paddingB[32 - 20]; /* 20 */ /* internal */ rdpSettings* settings; }; -FREERDP_API void* brush_cache_get(rdpBrushCache* brush, uint32 index, uint32* bpp); -FREERDP_API void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp); +FREERDP_API void* brush_cache_get(rdpBrushCache* brush, UINT32 index, UINT32* bpp); +FREERDP_API void brush_cache_put(rdpBrushCache* brush, UINT32 index, void* entry, UINT32 bpp); FREERDP_API void brush_cache_register_callbacks(rdpUpdate* update); diff --git a/include/freerdp/cache/cache.h b/include/freerdp/cache/cache.h index 6aa436032..5a794e9f5 100644 --- a/include/freerdp/cache/cache.h +++ b/include/freerdp/cache/cache.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Caches * * Copyright 2011 Marc-Andre Moreau diff --git a/include/freerdp/cache/glyph.h b/include/freerdp/cache/glyph.h index 7f0c1065a..5468ea0d7 100644 --- a/include/freerdp/cache/glyph.h +++ b/include/freerdp/cache/glyph.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Glyph Cache * * Copyright 2011 Marc-Andre Moreau @@ -34,15 +34,15 @@ typedef struct rdp_glyph_cache rdpGlyphCache; struct _GLYPH_CACHE { - uint32 number; - uint32 maxCellSize; + UINT32 number; + UINT32 maxCellSize; rdpGlyph** entries; }; struct _FRAGMENT_CACHE_ENTRY { void* fragment; - uint32 size; + UINT32 size; }; struct _FRAGMENT_CACHE @@ -59,11 +59,11 @@ struct rdp_glyph_cache rdpSettings* settings; }; -FREERDP_API rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, uint32 id, uint32 index); -FREERDP_API void glyph_cache_put(rdpGlyphCache* glyph_cache, uint32 id, uint32 index, rdpGlyph* entry); +FREERDP_API rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, UINT32 id, UINT32 index); +FREERDP_API void glyph_cache_put(rdpGlyphCache* glyph_cache, UINT32 id, UINT32 index, rdpGlyph* entry); -FREERDP_API void* glyph_cache_fragment_get(rdpGlyphCache* glyph, uint32 index, uint32* count); -FREERDP_API void glyph_cache_fragment_put(rdpGlyphCache* glyph, uint32 index, uint32 count, void* entry); +FREERDP_API void* glyph_cache_fragment_get(rdpGlyphCache* glyph, UINT32 index, UINT32* count); +FREERDP_API void glyph_cache_fragment_put(rdpGlyphCache* glyph, UINT32 index, UINT32 count, void* entry); FREERDP_API void glyph_cache_register_callbacks(rdpUpdate* update); diff --git a/include/freerdp/cache/nine_grid.h b/include/freerdp/cache/nine_grid.h index 55d2a2b13..eab363c42 100644 --- a/include/freerdp/cache/nine_grid.h +++ b/include/freerdp/cache/nine_grid.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * NineGrid Cache * * Copyright 2012 Marc-Andre Moreau @@ -40,20 +40,20 @@ struct rdp_nine_grid_cache { pDrawNineGrid DrawNineGrid; /* 0 */ pMultiDrawNineGrid MultiDrawNineGrid; /* 1 */ - uint32 paddingA[16 - 2]; /* 2 */ + UINT32 paddingA[16 - 2]; /* 2 */ - uint32 maxEntries; /* 16 */ - uint32 maxSize; /* 17 */ + UINT32 maxEntries; /* 16 */ + UINT32 maxSize; /* 17 */ NINE_GRID_ENTRY* entries; /* 18 */ - uint32 paddingB[32 - 19]; /* 19 */ + UINT32 paddingB[32 - 19]; /* 19 */ /* internal */ rdpSettings* settings; }; -FREERDP_API void* nine_grid_cache_get(rdpNineGridCache* nine_grid, uint32 index); -FREERDP_API void nine_grid_cache_put(rdpNineGridCache* nine_grid, uint32 index, void* entry); +FREERDP_API void* nine_grid_cache_get(rdpNineGridCache* nine_grid, UINT32 index); +FREERDP_API void nine_grid_cache_put(rdpNineGridCache* nine_grid, UINT32 index, void* entry); FREERDP_API void nine_grid_cache_register_callbacks(rdpUpdate* update); diff --git a/include/freerdp/cache/offscreen.h b/include/freerdp/cache/offscreen.h index 286bcf102..046b93a5d 100644 --- a/include/freerdp/cache/offscreen.h +++ b/include/freerdp/cache/offscreen.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Offscreen Bitmap Cache * * Copyright 2011 Marc-Andre Moreau @@ -32,10 +32,10 @@ typedef struct rdp_offscreen_cache rdpOffscreenCache; struct rdp_offscreen_cache { - uint32 maxSize; /* 0 */ - uint32 maxEntries; /* 1 */ + UINT32 maxSize; /* 0 */ + UINT32 maxEntries; /* 1 */ rdpBitmap** entries; /* 2 */ - uint32 currentSurface; /* 3 */ + UINT32 currentSurface; /* 3 */ /* internal */ @@ -43,9 +43,9 @@ struct rdp_offscreen_cache rdpSettings* settings; }; -FREERDP_API rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreen_cache, uint32 index); -FREERDP_API void offscreen_cache_put(rdpOffscreenCache* offscreen_cache, uint32 index, rdpBitmap* bitmap); -FREERDP_API void offscreen_cache_delete(rdpOffscreenCache* offscreen, uint32 index); +FREERDP_API rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreen_cache, UINT32 index); +FREERDP_API void offscreen_cache_put(rdpOffscreenCache* offscreen_cache, UINT32 index, rdpBitmap* bitmap); +FREERDP_API void offscreen_cache_delete(rdpOffscreenCache* offscreen, UINT32 index); FREERDP_API void offscreen_cache_register_callbacks(rdpUpdate* update); diff --git a/include/freerdp/cache/palette.h b/include/freerdp/cache/palette.h index d30e9cff4..25779d59a 100644 --- a/include/freerdp/cache/palette.h +++ b/include/freerdp/cache/palette.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Palette (Color Table) Cache * * Copyright 2011 Marc-Andre Moreau @@ -38,7 +38,7 @@ struct _PALETTE_TABLE_ENTRY struct rdp_palette_cache { - uint32 maxEntries; /* 0 */ + UINT32 maxEntries; /* 0 */ PALETTE_TABLE_ENTRY* entries; /* 1 */ /* internal */ @@ -46,8 +46,8 @@ struct rdp_palette_cache rdpSettings* settings; }; -FREERDP_API void* palette_cache_get(rdpPaletteCache* palette, uint32 index); -FREERDP_API void palette_cache_put(rdpPaletteCache* palette, uint32 index, void* entry); +FREERDP_API void* palette_cache_get(rdpPaletteCache* palette, UINT32 index); +FREERDP_API void palette_cache_put(rdpPaletteCache* palette, UINT32 index, void* entry); FREERDP_API void palette_cache_register_callbacks(rdpUpdate* update); diff --git a/include/freerdp/cache/pointer.h b/include/freerdp/cache/pointer.h index 5351c9b5e..2813b0f7e 100644 --- a/include/freerdp/cache/pointer.h +++ b/include/freerdp/cache/pointer.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Pointer Cache * * Copyright 2011 Marc-Andre Moreau @@ -33,7 +33,7 @@ typedef struct rdp_pointer_cache rdpPointerCache; struct rdp_pointer_cache { - uint32 cacheSize; /* 0 */ + UINT32 cacheSize; /* 0 */ rdpPointer** entries; /* 1 */ /* internal */ @@ -42,8 +42,8 @@ struct rdp_pointer_cache rdpSettings* settings; }; -FREERDP_API rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, uint32 index); -FREERDP_API void pointer_cache_put(rdpPointerCache* pointer_cache, uint32 index, rdpPointer* pointer); +FREERDP_API rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, UINT32 index); +FREERDP_API void pointer_cache_put(rdpPointerCache* pointer_cache, UINT32 index, rdpPointer* pointer); FREERDP_API void pointer_cache_register_callbacks(rdpUpdate* update); diff --git a/include/freerdp/channels/channels.h b/include/freerdp/channels/channels.h index 8bc3a3974..61f0f4d5a 100644 --- a/include/freerdp/channels/channels.h +++ b/include/freerdp/channels/channels.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Virtual Channel Manager * * Copyright 2009-2011 Jay Sorg @@ -33,6 +33,8 @@ FREERDP_API int freerdp_channels_global_init(void); FREERDP_API int freerdp_channels_global_uninit(void); FREERDP_API rdpChannels* freerdp_channels_new(void); FREERDP_API void freerdp_channels_free(rdpChannels* channels); +FREERDP_API int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, + void* entry, void* data); FREERDP_API int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, const char* name, void* data); FREERDP_API int freerdp_channels_pre_connect(rdpChannels* channels, freerdp* instance); @@ -40,9 +42,9 @@ FREERDP_API int freerdp_channels_post_connect(rdpChannels* channels, freerdp* in FREERDP_API int freerdp_channels_data(freerdp* instance, int channel_id, void* data, int data_size, int flags, int total_size); FREERDP_API int freerdp_channels_send_event(rdpChannels* channels, RDP_EVENT* event); -FREERDP_API boolean freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds, +FREERDP_API BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds, int* read_count, void** write_fds, int* write_count); -FREERDP_API boolean freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance); +FREERDP_API BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance); FREERDP_API RDP_EVENT* freerdp_channels_pop_event(rdpChannels* channels); FREERDP_API void freerdp_channels_close(rdpChannels* channels, freerdp* instance); diff --git a/channels/rdpdr/client/rdpdr_constants.h b/include/freerdp/channels/rdpdr.h similarity index 89% rename from channels/rdpdr/client/rdpdr_constants.h rename to include/freerdp/channels/rdpdr.h index ceb2f6cfe..01de5f07e 100644 --- a/channels/rdpdr/client/rdpdr_constants.h +++ b/include/freerdp/channels/rdpdr.h @@ -1,9 +1,9 @@ /** - * FreeRDP: A Remote Desktop Protocol client. - * File System Virtual Channel + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel * - * Copyright 2010-2011 Marc-Andre Moreau * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,17 @@ * limitations under the License. */ -#ifndef __RDPDR_CONSTANTS_H -#define __RDPDR_CONSTANTS_H +#ifndef FREERDP_CHANNEL_RDPDR_H +#define FREERDP_CHANNEL_RDPDR_H + +#include +#include +#include +#include + +#include +#include +#include /* RDPDR_HEADER.Component */ enum RDPDR_CTYP @@ -456,4 +465,66 @@ enum FILE_FS_INFORMATION_CLASS FileFsMaximumInformation }; -#endif /* __RDPDR_CONSTANTS_H */ +typedef struct _DEVICE DEVICE; +typedef struct _IRP IRP; +typedef struct _DEVMAN DEVMAN; + +typedef void (*pcIRPRequest)(DEVICE* device, IRP* irp); +typedef void (*pcFreeDevice)(DEVICE* device); + +struct _DEVICE +{ + UINT32 id; + + UINT32 type; + char* name; + STREAM* data; + + pcIRPRequest IRPRequest; + pcFreeDevice Free; +}; + +typedef void (*pcIRPResponse)(IRP* irp); + +struct _IRP +{ + SLIST_ENTRY ItemEntry; + + DEVICE* device; + DEVMAN* devman; + UINT32 FileId; + UINT32 CompletionId; + UINT32 MajorFunction; + UINT32 MinorFunction; + STREAM* input; + + UINT32 IoStatus; + STREAM* output; + + pcIRPResponse Complete; + pcIRPResponse Discard; +}; + +struct _DEVMAN +{ + rdpSvcPlugin* plugin; + UINT32 id_sequence; + LIST* devices; +}; + +typedef void (*pcRegisterDevice)(DEVMAN* devman, DEVICE* device); + +struct _DEVICE_SERVICE_ENTRY_POINTS +{ + DEVMAN* devman; + + pcRegisterDevice RegisterDevice; + RDP_PLUGIN_DATA* plugin_data; +}; +typedef struct _DEVICE_SERVICE_ENTRY_POINTS DEVICE_SERVICE_ENTRY_POINTS; +typedef DEVICE_SERVICE_ENTRY_POINTS* PDEVICE_SERVICE_ENTRY_POINTS; + +typedef int (*PDEVICE_SERVICE_ENTRY)(PDEVICE_SERVICE_ENTRY_POINTS); + +#endif /* FREERDP_CHANNEL_RDPDR_H */ + diff --git a/include/freerdp/channels/rdpsnd.h b/include/freerdp/channels/rdpsnd.h index f54e2fb18..da59c5e07 100644 --- a/include/freerdp/channels/rdpsnd.h +++ b/include/freerdp/channels/rdpsnd.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Audio Virtual Channel Types * * Copyright 2012 Vic Lee @@ -17,22 +17,23 @@ * limitations under the License. */ -#ifndef __FREERDP_RDPSND_H -#define __FREERDP_RDPSND_H +#ifndef FREERDP_CHANNEL_RDPSND_H +#define FREERDP_CHANNEL_RDPSND_H #include #include typedef struct rdpsnd_format rdpsndFormat; + struct rdpsnd_format { - uint16 wFormatTag; - uint16 nChannels; - uint32 nSamplesPerSec; - uint16 nBlockAlign; - uint16 wBitsPerSample; - uint16 cbSize; - uint8* data; + UINT16 wFormatTag; + UINT16 nChannels; + UINT32 nSamplesPerSec; + UINT16 nBlockAlign; + UINT16 wBitsPerSample; + UINT16 cbSize; + BYTE* data; }; #define SNDC_CLOSE 1 @@ -56,4 +57,5 @@ struct rdpsnd_format #define MEDIUM_QUALITY 0x0001 #define HIGH_QUALITY 0x0002 -#endif +#endif /* FREERDP_CHANNEL_RDPSND_H */ + diff --git a/include/freerdp/channels/wtsvc.h b/include/freerdp/channels/wtsvc.h index 8862415fc..4af365f48 100644 --- a/include/freerdp/channels/wtsvc.h +++ b/include/freerdp/channels/wtsvc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Server Virtual Channel Interface * * Copyright 2011-2012 Vic Lee @@ -53,7 +53,7 @@ FREERDP_API WTSVirtualChannelManager* WTSCreateVirtualChannelManager(freerdp_pee FREERDP_API void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm); FREERDP_API void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm, void** fds, int* fds_count); -FREERDP_API boolean WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm); +FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm); /** * Opens a static or dynamic virtual channel and return the handle. If the @@ -68,7 +68,7 @@ FREERDP_API boolean WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChanne FREERDP_API void* WTSVirtualChannelOpenEx( /* __in */ WTSVirtualChannelManager* vcm, /* __in */ const char* pVirtualName, - /* __in */ uint32 flags); + /* __in */ UINT32 flags); /** * Returns information about a specified virtual channel. @@ -76,11 +76,11 @@ FREERDP_API void* WTSVirtualChannelOpenEx( * Servers use this function to gain access to a virtual channel file handle * that can be used for asynchronous I/O. */ -FREERDP_API boolean WTSVirtualChannelQuery( +FREERDP_API BOOL WTSVirtualChannelQuery( /* __in */ void* hChannelHandle, /* __in */ WTS_VIRTUAL_CLASS WtsVirtualClass, /* __out */ void** ppBuffer, - /* __out */ uint32* pBytesReturned); + /* __out */ UINT32* pBytesReturned); /** * Frees memory allocated by WTSVirtualChannelQuery @@ -95,36 +95,36 @@ FREERDP_API void WTSFreeMemory( * * This function will always return a complete channel data packet, i.e. chunks * are already assembled. If BufferSize argument is smaller than the packet - * size, it will set the desired size in pBytesRead and return false. The + * size, it will set the desired size in pBytesRead and return FALSE. The * caller should allocate a large enough buffer and call this function again. - * Returning false with pBytesRead set to zero indicates an error has occurred. + * Returning FALSE with pBytesRead set to zero indicates an error has occurred. * If no pending packet to be read, it will set pBytesRead to zero and return - * true. + * TRUE. * * TimeOut is not supported, and this function will always return immediately. * The caller should use the file handle returned by WTSVirtualChannelQuery to * determine whether a packet has arrived. */ -FREERDP_API boolean WTSVirtualChannelRead( +FREERDP_API BOOL WTSVirtualChannelRead( /* __in */ void* hChannelHandle, - /* __in */ uint32 TimeOut, - /* __out */ uint8* Buffer, - /* __in */ uint32 BufferSize, - /* __out */ uint32* pBytesRead); + /* __in */ UINT32 TimeOut, + /* __out */ BYTE* Buffer, + /* __in */ UINT32 BufferSize, + /* __out */ UINT32* pBytesRead); /** * Writes data to the server end of a virtual channel. */ -FREERDP_API boolean WTSVirtualChannelWrite( +FREERDP_API BOOL WTSVirtualChannelWrite( /* __in */ void* hChannelHandle, - /* __in */ uint8* Buffer, - /* __in */ uint32 Length, - /* __out */ uint32* pBytesWritten); + /* __in */ BYTE* Buffer, + /* __in */ UINT32 Length, + /* __out */ UINT32* pBytesWritten); /** * Closes an open virtual channel handle. */ -FREERDP_API boolean WTSVirtualChannelClose( +FREERDP_API BOOL WTSVirtualChannelClose( /* __in */ void* hChannelHandle); #endif /* __FREERDP_WTSVC_H */ diff --git a/include/freerdp/client/channels.h b/include/freerdp/client/channels.h new file mode 100644 index 000000000..824ed40e3 --- /dev/null +++ b/include/freerdp/client/channels.h @@ -0,0 +1,30 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Client Channels + * + * Copyright 2012 Marc-Andre Moreau + * + * 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_CHANNELS_CLIENT +#define FREERDP_CHANNELS_CLIENT + +#include + +FREERDP_API void* freerdp_channels_find_static_virtual_channel_entry(const char* name); +FREERDP_API void* freerdp_channels_find_static_device_service_entry(const char* name); +FREERDP_API void* freerdp_channels_find_static_entry(const char* name, const char* entry); + +#endif /* FREERDP_CHANNELS_CLIENT */ + diff --git a/include/freerdp/plugins/cliprdr.h b/include/freerdp/client/cliprdr.h similarity index 89% rename from include/freerdp/plugins/cliprdr.h rename to include/freerdp/client/cliprdr.h index 2890a4ba9..5896029df 100644 --- a/include/freerdp/plugins/cliprdr.h +++ b/include/freerdp/client/cliprdr.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Clipboard Virtual Channel Types * * Copyright 2011 Vic Lee @@ -49,25 +49,25 @@ typedef RDP_EVENT RDP_CB_MONITOR_READY_EVENT; struct _RDP_CB_FORMAT_LIST_EVENT { RDP_EVENT event; - uint32* formats; - uint16 num_formats; - uint8* raw_format_data; - uint32 raw_format_data_size; + UINT32* formats; + UINT16 num_formats; + BYTE* raw_format_data; + UINT32 raw_format_data_size; }; typedef struct _RDP_CB_FORMAT_LIST_EVENT RDP_CB_FORMAT_LIST_EVENT; struct _RDP_CB_DATA_REQUEST_EVENT { RDP_EVENT event; - uint32 format; + UINT32 format; }; typedef struct _RDP_CB_DATA_REQUEST_EVENT RDP_CB_DATA_REQUEST_EVENT; struct _RDP_CB_DATA_RESPONSE_EVENT { RDP_EVENT event; - uint8* data; - uint32 size; + BYTE* data; + UINT32 size; }; typedef struct _RDP_CB_DATA_RESPONSE_EVENT RDP_CB_DATA_RESPONSE_EVENT; diff --git a/include/freerdp/plugins/tsmf.h b/include/freerdp/client/tsmf.h similarity index 81% rename from include/freerdp/plugins/tsmf.h rename to include/freerdp/client/tsmf.h index 6df4964b3..56775b483 100644 --- a/include/freerdp/plugins/tsmf.h +++ b/include/freerdp/client/tsmf.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Multimedia Redirection Virtual Channel Types * * Copyright 2011 Vic Lee @@ -32,16 +32,16 @@ enum RDP_EVENT_TYPE_TSMF struct _RDP_VIDEO_FRAME_EVENT { RDP_EVENT event; - uint8* frame_data; - uint32 frame_size; - uint32 frame_pixfmt; - sint16 frame_width; - sint16 frame_height; - sint16 x; - sint16 y; - sint16 width; - sint16 height; - uint16 num_visible_rects; + BYTE* frame_data; + UINT32 frame_size; + UINT32 frame_pixfmt; + INT16 frame_width; + INT16 frame_height; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + UINT16 num_visible_rects; RDP_RECT* visible_rects; }; typedef struct _RDP_VIDEO_FRAME_EVENT RDP_VIDEO_FRAME_EVENT; @@ -49,10 +49,10 @@ typedef struct _RDP_VIDEO_FRAME_EVENT RDP_VIDEO_FRAME_EVENT; struct _RDP_REDRAW_EVENT { RDP_EVENT event; - sint16 x; - sint16 y; - sint16 width; - sint16 height; + INT16 x; + INT16 y; + INT16 width; + INT16 height; }; typedef struct _RDP_REDRAW_EVENT RDP_REDRAW_EVENT; diff --git a/include/freerdp/codec/bitmap.h b/include/freerdp/codec/bitmap.h index d09c495bc..a58195db4 100644 --- a/include/freerdp/codec/bitmap.h +++ b/include/freerdp/codec/bitmap.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Compressed Bitmap * * Copyright 2011 Jay Sorg @@ -23,6 +23,6 @@ #include #include -FREERDP_API boolean bitmap_decompress(uint8* srcData, uint8* dstData, int width, int height, int size, int srcBpp, int dstBpp); +FREERDP_API BOOL bitmap_decompress(BYTE* srcData, BYTE* dstData, int width, int height, int size, int srcBpp, int dstBpp); #endif /* __BITMAP_H */ diff --git a/include/freerdp/codec/color.h b/include/freerdp/codec/color.h index 14f305899..0a0ef90bf 100644 --- a/include/freerdp/codec/color.h +++ b/include/freerdp/codec/color.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Color Conversion Routines * * Copyright 2010 Marc-Andre Moreau @@ -235,26 +235,26 @@ typedef CLRCONV* HCLRCONV; #define IBPP(_bpp) (((_bpp + 1)/ 8) % 5) -typedef uint8* (*p_freerdp_image_convert)(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv); +typedef BYTE* (*p_freerdp_image_convert)(BYTE* srcData, BYTE* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint8* freerdp_image_convert(uint8* srcData, uint8 *dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint8* freerdp_glyph_convert(int width, int height, uint8* data); -FREERDP_API void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height); -FREERDP_API uint8* freerdp_image_flip(uint8* srcData, uint8* dstData, int width, int height, int bpp); -FREERDP_API uint8* freerdp_icon_convert(uint8* srcData, uint8* dstData, uint8* mask, int width, int height, int bpp, HCLRCONV clrconv); -FREERDP_API uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int srcBpp, int dstBpp, uint32 bgcolor, uint32 fgcolor, HCLRCONV clrconv); -FREERDP_API void freerdp_alpha_cursor_convert(uint8* alphaData, uint8* xorMask, uint8* andMask, int width, int height, int bpp, HCLRCONV clrconv); -FREERDP_API void freerdp_image_swap_color_order(uint8* data, int width, int height); +FREERDP_API BYTE* freerdp_image_convert(BYTE* srcData, BYTE *dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API BYTE* freerdp_glyph_convert(int width, int height, BYTE* data); +FREERDP_API void freerdp_bitmap_flip(BYTE * src, BYTE * dst, int scanLineSz, int height); +FREERDP_API BYTE* freerdp_image_flip(BYTE* srcData, BYTE* dstData, int width, int height, int bpp); +FREERDP_API BYTE* freerdp_icon_convert(BYTE* srcData, BYTE* dstData, BYTE* mask, int width, int height, int bpp, HCLRCONV clrconv); +FREERDP_API BYTE* freerdp_mono_image_convert(BYTE* srcData, int width, int height, int srcBpp, int dstBpp, UINT32 bgcolor, UINT32 fgcolor, HCLRCONV clrconv); +FREERDP_API void freerdp_alpha_cursor_convert(BYTE* alphaData, BYTE* xorMask, BYTE* andMask, int width, int height, int bpp, HCLRCONV clrconv); +FREERDP_API void freerdp_image_swap_color_order(BYTE* data, int width, int height); -FREERDP_API uint32 freerdp_color_convert_var(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint32 freerdp_color_convert_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint32 freerdp_color_convert_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint32 freerdp_color_convert_rgb_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint32 freerdp_color_convert_bgr_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API uint32 freerdp_color_convert_var_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API UINT32 freerdp_color_convert_var(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API UINT32 freerdp_color_convert_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API UINT32 freerdp_color_convert_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API UINT32 freerdp_color_convert_rgb_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API UINT32 freerdp_color_convert_bgr_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API UINT32 freerdp_color_convert_var_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); +FREERDP_API UINT32 freerdp_color_convert_var_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); -FREERDP_API HCLRCONV freerdp_clrconv_new(uint32 flags); +FREERDP_API HCLRCONV freerdp_clrconv_new(UINT32 flags); FREERDP_API void freerdp_clrconv_free(HCLRCONV clrconv); #ifdef __cplusplus diff --git a/include/freerdp/codec/jpeg.h b/include/freerdp/codec/jpeg.h index 36540d922..fdbe549ad 100644 --- a/include/freerdp/codec/jpeg.h +++ b/include/freerdp/codec/jpeg.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Compressed Bitmap * * Copyright 2012 Jay Sorg @@ -22,7 +22,7 @@ #include -boolean -jpeg_decompress(uint8* input, uint8* output, int width, int height, int size, int bpp); +BOOL +jpeg_decompress(BYTE* input, BYTE* output, int width, int height, int size, int bpp); #endif /* __BITMAP_H */ diff --git a/include/freerdp/codec/mppc_dec.h b/include/freerdp/codec/mppc_dec.h index 14fae4be6..aab792638 100644 --- a/include/freerdp/codec/mppc_dec.h +++ b/include/freerdp/codec/mppc_dec.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Implements Microsoft Point to Point Compression (MPPC) protocol * * Copyright 2011 Laxmikant Rashinkar @@ -39,17 +39,17 @@ struct rdp_mppc_dec { - uint8* history_buf; - uint16* offset_cache; - uint8* history_buf_end; - uint8* history_ptr; + BYTE* history_buf; + UINT16* offset_cache; + BYTE* history_buf_end; + BYTE* history_ptr; }; -FREERDP_API int decompress_rdp(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen); -FREERDP_API int decompress_rdp_4(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen); -FREERDP_API int decompress_rdp_5(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen); -FREERDP_API int decompress_rdp_6(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen); -FREERDP_API int decompress_rdp_61(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen); +FREERDP_API int decompress_rdp(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen); +FREERDP_API int decompress_rdp_4(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen); +FREERDP_API int decompress_rdp_5(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen); +FREERDP_API int decompress_rdp_6(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen); +FREERDP_API int decompress_rdp_61(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen); FREERDP_API struct rdp_mppc_dec* mppc_dec_new(void); FREERDP_API void mppc_dec_free(struct rdp_mppc_dec* dec); diff --git a/include/freerdp/codec/mppc_enc.h b/include/freerdp/codec/mppc_enc.h index e0014c010..f039c7b55 100644 --- a/include/freerdp/codec/mppc_enc.h +++ b/include/freerdp/codec/mppc_enc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Implements Microsoft Point to Point Compression (MPPC) protocol * * Copyright 2012 Laxmikant Rashinkar @@ -39,12 +39,12 @@ struct rdp_mppc_enc int flags; /* PACKET_COMPRESSED, PACKET_AT_FRONT, PACKET_FLUSHED etc */ int flagsHold; int first_pkt; /* this is the first pkt passing through enc */ - uint16* hash_table; + UINT16* hash_table; }; -FREERDP_API boolean compress_rdp(struct rdp_mppc_enc* enc, uint8* srcData, int len); -FREERDP_API boolean compress_rdp_4(struct rdp_mppc_enc* enc, uint8* srcData, int len); -FREERDP_API boolean compress_rdp_5(struct rdp_mppc_enc* enc, uint8* srcData, int len); +FREERDP_API BOOL compress_rdp(struct rdp_mppc_enc* enc, BYTE* srcData, int len); +FREERDP_API BOOL compress_rdp_4(struct rdp_mppc_enc* enc, BYTE* srcData, int len); +FREERDP_API BOOL compress_rdp_5(struct rdp_mppc_enc* enc, BYTE* srcData, int len); FREERDP_API struct rdp_mppc_enc* mppc_enc_new(int protocol_type); FREERDP_API void mppc_enc_free(struct rdp_mppc_enc* enc); diff --git a/include/freerdp/codec/nsc.h b/include/freerdp/codec/nsc.h index 9912da00f..ef22d3649 100644 --- a/include/freerdp/codec/nsc.h +++ b/include/freerdp/codec/nsc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Codec * * Copyright 2011 Samsung, Author Jiten Pathy @@ -33,11 +33,11 @@ extern "C" { /* NSCODEC_BITMAP_STREAM */ struct _NSC_STREAM { - uint32 PlaneByteCount[4]; - uint8 ColorLossLevel; - uint8 ChromaSubSamplingLevel; - uint16 Reserved; - uint8* Planes; + UINT32 PlaneByteCount[4]; + BYTE ColorLossLevel; + BYTE ChromaSubSamplingLevel; + UINT16 Reserved; + BYTE* Planes; }; typedef struct _NSC_STREAM NSC_STREAM; @@ -46,31 +46,31 @@ typedef struct _NSC_CONTEXT_PRIV NSC_CONTEXT_PRIV; typedef struct _NSC_CONTEXT NSC_CONTEXT; struct _NSC_CONTEXT { - uint32 OrgByteCount[4]; /* original byte length of luma, chroma orange, chroma green, alpha variable in order */ + UINT32 OrgByteCount[4]; /* original byte length of luma, chroma orange, chroma green, alpha variable in order */ NSC_STREAM nsc_stream; - uint16 bpp; - uint16 width; - uint16 height; - uint8* bmpdata; /* final argb values in little endian order */ - uint32 bmpdata_length; /* the maximum length of the buffer that bmpdata points to */ + UINT16 bpp; + UINT16 width; + UINT16 height; + BYTE* bmpdata; /* final argb values in little endian order */ + UINT32 bmpdata_length; /* the maximum length of the buffer that bmpdata points to */ RDP_PIXEL_FORMAT pixel_format; /* color palette allocated by the application */ - const uint8* palette; + const BYTE* palette; void (*decode)(NSC_CONTEXT* context); - void (*encode)(NSC_CONTEXT* context, uint8* bmpdata, int rowstride); + void (*encode)(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride); NSC_CONTEXT_PRIV* priv; }; FREERDP_API NSC_CONTEXT* nsc_context_new(void); -FREERDP_API void nsc_context_set_cpu_opt(NSC_CONTEXT* context, uint32 cpu_opt); +FREERDP_API void nsc_context_set_cpu_opt(NSC_CONTEXT* context, UINT32 cpu_opt); FREERDP_API void nsc_context_set_pixel_format(NSC_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format); -FREERDP_API void nsc_process_message(NSC_CONTEXT* context, uint16 bpp, - uint16 width, uint16 height, uint8* data, uint32 length); +FREERDP_API void nsc_process_message(NSC_CONTEXT* context, UINT16 bpp, + UINT16 width, UINT16 height, BYTE* data, UINT32 length); FREERDP_API void nsc_compose_message(NSC_CONTEXT* context, STREAM* s, - uint8* bmpdata, int width, int height, int rowstride); + BYTE* bmpdata, int width, int height, int rowstride); FREERDP_API void nsc_context_free(NSC_CONTEXT* context); #ifdef __cplusplus diff --git a/include/freerdp/codec/rfx.h b/include/freerdp/codec/rfx.h index 084693be1..1c5a4bcc0 100644 --- a/include/freerdp/codec/rfx.h +++ b/include/freerdp/codec/rfx.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec * * Copyright 2011 Vic Lee @@ -38,18 +38,18 @@ typedef enum _RLGR_MODE RLGR_MODE; struct _RFX_RECT { - uint16 x; - uint16 y; - uint16 width; - uint16 height; + UINT16 x; + UINT16 y; + UINT16 width; + UINT16 height; }; typedef struct _RFX_RECT RFX_RECT; struct _RFX_TILE { - uint16 x; - uint16 y; - uint8* data; + UINT16 x; + UINT16 y; + BYTE* data; }; typedef struct _RFX_TILE RFX_TILE; @@ -59,7 +59,7 @@ struct _RFX_MESSAGE * The rects array represents the updated region of the frame. The UI * requires to clip drawing destination base on the union of the rects. */ - uint16 num_rects; + UINT16 num_rects; RFX_RECT* rects; /** @@ -68,7 +68,7 @@ struct _RFX_MESSAGE * rects described above) are valid. Pixels outside of the region may * contain arbitrary data. */ - uint16 num_tiles; + UINT16 num_tiles; RFX_TILE** tiles; }; typedef struct _RFX_MESSAGE RFX_MESSAGE; @@ -77,36 +77,36 @@ typedef struct _RFX_CONTEXT_PRIV RFX_CONTEXT_PRIV; struct _RFX_CONTEXT { - uint16 flags; - uint16 properties; - uint16 width; - uint16 height; + UINT16 flags; + UINT16 properties; + UINT16 width; + UINT16 height; RLGR_MODE mode; - uint32 version; - uint32 codec_id; - uint32 codec_version; + UINT32 version; + UINT32 codec_id; + UINT32 codec_version; RDP_PIXEL_FORMAT pixel_format; - uint8 bits_per_pixel; + BYTE bits_per_pixel; /* color palette allocated by the application */ - const uint8* palette; + const BYTE* palette; /* temporary data within a frame */ - uint32 frame_idx; - boolean header_processed; - uint8 num_quants; - uint32* quants; - uint8 quant_idx_y; - uint8 quant_idx_cb; - uint8 quant_idx_cr; + UINT32 frame_idx; + BOOL header_processed; + BYTE num_quants; + UINT32* quants; + BYTE quant_idx_y; + BYTE quant_idx_cb; + BYTE quant_idx_cr; /* routines */ - void (*decode_ycbcr_to_rgb)(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf); - void (*encode_rgb_to_ycbcr)(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf); - void (*quantization_decode)(sint16* buffer, const uint32* quantization_values); - void (*quantization_encode)(sint16* buffer, const uint32* quantization_values); - void (*dwt_2d_decode)(sint16* buffer, sint16* dwt_buffer); - void (*dwt_2d_encode)(sint16* buffer, sint16* dwt_buffer); + void (*decode_ycbcr_to_rgb)(INT16* y_r_buf, INT16* cb_g_buf, INT16* cr_b_buf); + void (*encode_rgb_to_ycbcr)(INT16* y_r_buf, INT16* cb_g_buf, INT16* cr_b_buf); + void (*quantization_decode)(INT16* buffer, const UINT32* quantization_values); + void (*quantization_encode)(INT16* buffer, const UINT32* quantization_values); + void (*dwt_2d_decode)(INT16* buffer, INT16* dwt_buffer); + void (*dwt_2d_encode)(INT16* buffer, INT16* dwt_buffer); /* private definitions */ RFX_CONTEXT_PRIV* priv; @@ -115,20 +115,20 @@ typedef struct _RFX_CONTEXT RFX_CONTEXT; FREERDP_API RFX_CONTEXT* rfx_context_new(void); FREERDP_API void rfx_context_free(RFX_CONTEXT* context); -FREERDP_API void rfx_context_set_cpu_opt(RFX_CONTEXT* context, uint32 cpu_opt); +FREERDP_API void rfx_context_set_cpu_opt(RFX_CONTEXT* context, UINT32 cpu_opt); FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format); FREERDP_API void rfx_context_reset(RFX_CONTEXT* context); -FREERDP_API RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, uint8* data, uint32 length); -FREERDP_API uint16 rfx_message_get_tile_count(RFX_MESSAGE* message); +FREERDP_API RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, BYTE* data, UINT32 length); +FREERDP_API UINT16 rfx_message_get_tile_count(RFX_MESSAGE* message); FREERDP_API RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, int index); -FREERDP_API uint16 rfx_message_get_rect_count(RFX_MESSAGE* message); +FREERDP_API UINT16 rfx_message_get_rect_count(RFX_MESSAGE* message); FREERDP_API RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, int index); FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message); FREERDP_API void rfx_compose_message_header(RFX_CONTEXT* context, STREAM* s); FREERDP_API void rfx_compose_message(RFX_CONTEXT* context, STREAM* s, - const RFX_RECT* rects, int num_rects, uint8* image_data, int width, int height, int rowstride); + const RFX_RECT* rects, int num_rects, BYTE* image_data, int width, int height, int rowstride); #ifdef __cplusplus } diff --git a/include/freerdp/config.h.in b/include/freerdp/config.h.in index 7042956aa..d9bc6b162 100644 --- a/include/freerdp/config.h.in +++ b/include/freerdp/config.h.in @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * config.h definitions for installable headers * * Copyright 2012 Marc-Andre Moreau diff --git a/include/freerdp/constants.h b/include/freerdp/constants.h index c9bcf67c7..ccf6ff1a6 100644 --- a/include/freerdp/constants.h +++ b/include/freerdp/constants.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Constants * * Copyright 2011 Marc-Andre Moreau diff --git a/include/freerdp/crypto/ber.h b/include/freerdp/crypto/ber.h index 482398297..ab028c3db 100644 --- a/include/freerdp/crypto/ber.h +++ b/include/freerdp/crypto/ber.h @@ -55,30 +55,30 @@ FREERDP_API void ber_read_length(STREAM* s, int* length); FREERDP_API int ber_write_length(STREAM* s, int length); FREERDP_API int _ber_skip_length(int length); FREERDP_API int ber_get_content_length(int length); -FREERDP_API boolean ber_read_universal_tag(STREAM* s, uint8 tag, boolean pc); -FREERDP_API void ber_write_universal_tag(STREAM* s, uint8 tag, boolean pc); -FREERDP_API boolean ber_read_application_tag(STREAM* s, uint8 tag, int* length); -FREERDP_API void ber_write_application_tag(STREAM* s, uint8 tag, int length); -FREERDP_API boolean ber_read_application_tag(STREAM* s, uint8 tag, int* length); -FREERDP_API boolean ber_read_enumerated(STREAM* s, uint8* enumerated, uint8 count); -FREERDP_API void ber_write_enumerated(STREAM* s, uint8 enumerated, uint8 count); -FREERDP_API boolean ber_read_contextual_tag(STREAM* s, uint8 tag, int* length, boolean pc); -FREERDP_API int ber_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc); +FREERDP_API BOOL ber_read_universal_tag(STREAM* s, BYTE tag, BOOL pc); +FREERDP_API void ber_write_universal_tag(STREAM* s, BYTE tag, BOOL pc); +FREERDP_API BOOL ber_read_application_tag(STREAM* s, BYTE tag, int* length); +FREERDP_API void ber_write_application_tag(STREAM* s, BYTE tag, int length); +FREERDP_API BOOL ber_read_application_tag(STREAM* s, BYTE tag, int* length); +FREERDP_API BOOL ber_read_enumerated(STREAM* s, BYTE* enumerated, BYTE count); +FREERDP_API void ber_write_enumerated(STREAM* s, BYTE enumerated, BYTE count); +FREERDP_API BOOL ber_read_contextual_tag(STREAM* s, BYTE tag, int* length, BOOL pc); +FREERDP_API int ber_write_contextual_tag(STREAM* s, BYTE tag, int length, BOOL pc); FREERDP_API int ber_skip_contextual_tag(int length); -FREERDP_API boolean ber_read_sequence_tag(STREAM* s, int* length); +FREERDP_API BOOL ber_read_sequence_tag(STREAM* s, int* length); FREERDP_API int ber_write_sequence_tag(STREAM* s, int length); FREERDP_API int ber_skip_sequence(int length); FREERDP_API int ber_skip_sequence_tag(int length); -FREERDP_API boolean ber_read_bit_string(STREAM* s, int* length, uint8* padding); -FREERDP_API void ber_write_octet_string(STREAM* s, const uint8* oct_str, int length); -FREERDP_API boolean ber_read_octet_string_tag(STREAM* s, int* length); +FREERDP_API BOOL ber_read_bit_string(STREAM* s, int* length, BYTE* padding); +FREERDP_API void ber_write_octet_string(STREAM* s, const BYTE* oct_str, int length); +FREERDP_API BOOL ber_read_octet_string_tag(STREAM* s, int* length); FREERDP_API int ber_write_octet_string_tag(STREAM* s, int length); FREERDP_API int ber_skip_octet_string(int length); -FREERDP_API boolean ber_read_boolean(STREAM* s, boolean* value); -FREERDP_API void ber_write_boolean(STREAM* s, boolean value); -FREERDP_API boolean ber_read_integer(STREAM* s, uint32* value); -FREERDP_API int ber_write_integer(STREAM* s, uint32 value); -FREERDP_API boolean ber_read_integer_length(STREAM* s, int* length); -FREERDP_API int ber_skip_integer(uint32 value); +FREERDP_API BOOL ber_read_BOOL(STREAM* s, BOOL* value); +FREERDP_API void ber_write_BOOL(STREAM* s, BOOL value); +FREERDP_API BOOL ber_read_integer(STREAM* s, UINT32* value); +FREERDP_API int ber_write_integer(STREAM* s, UINT32 value); +FREERDP_API BOOL ber_read_integer_length(STREAM* s, int* length); +FREERDP_API int ber_skip_integer(UINT32 value); #endif /* FREERDP_CRYPTO_BER_H */ diff --git a/include/freerdp/crypto/crypto.h b/include/freerdp/crypto/crypto.h index e57431f77..91e0eae33 100644 --- a/include/freerdp/crypto/crypto.h +++ b/include/freerdp/crypto/crypto.h @@ -80,43 +80,43 @@ struct crypto_cert_struct typedef struct crypto_sha1_struct* CryptoSha1; FREERDP_API CryptoSha1 crypto_sha1_init(void); -FREERDP_API void crypto_sha1_update(CryptoSha1 sha1, const uint8* data, uint32 length); -FREERDP_API void crypto_sha1_final(CryptoSha1 sha1, uint8* out_data); +FREERDP_API void crypto_sha1_update(CryptoSha1 sha1, const BYTE* data, UINT32 length); +FREERDP_API void crypto_sha1_final(CryptoSha1 sha1, BYTE* out_data); #define CRYPTO_MD5_DIGEST_LENGTH MD5_DIGEST_LENGTH typedef struct crypto_md5_struct* CryptoMd5; FREERDP_API CryptoMd5 crypto_md5_init(void); -FREERDP_API void crypto_md5_update(CryptoMd5 md5, const uint8* data, uint32 length); -FREERDP_API void crypto_md5_final(CryptoMd5 md5, uint8* out_data); +FREERDP_API void crypto_md5_update(CryptoMd5 md5, const BYTE* data, UINT32 length); +FREERDP_API void crypto_md5_final(CryptoMd5 md5, BYTE* out_data); typedef struct crypto_rc4_struct* CryptoRc4; -FREERDP_API CryptoRc4 crypto_rc4_init(const uint8* key, uint32 length); -FREERDP_API void crypto_rc4(CryptoRc4 rc4, uint32 length, const uint8* in_data, uint8* out_data); +FREERDP_API CryptoRc4 crypto_rc4_init(const BYTE* key, UINT32 length); +FREERDP_API void crypto_rc4(CryptoRc4 rc4, UINT32 length, const BYTE* in_data, BYTE* out_data); FREERDP_API void crypto_rc4_free(CryptoRc4 rc4); typedef struct crypto_des3_struct* CryptoDes3; -FREERDP_API CryptoDes3 crypto_des3_encrypt_init(const uint8* key, const uint8* ivec); -FREERDP_API CryptoDes3 crypto_des3_decrypt_init(const uint8* key, const uint8* ivec); -FREERDP_API void crypto_des3_encrypt(CryptoDes3 des3, uint32 length, const uint8 *in_data, uint8 *out_data); -FREERDP_API void crypto_des3_decrypt(CryptoDes3 des3, uint32 length, const uint8 *in_data, uint8* out_data); +FREERDP_API CryptoDes3 crypto_des3_encrypt_init(const BYTE* key, const BYTE* ivec); +FREERDP_API CryptoDes3 crypto_des3_decrypt_init(const BYTE* key, const BYTE* ivec); +FREERDP_API void crypto_des3_encrypt(CryptoDes3 des3, UINT32 length, const BYTE *in_data, BYTE *out_data); +FREERDP_API void crypto_des3_decrypt(CryptoDes3 des3, UINT32 length, const BYTE *in_data, BYTE* out_data); FREERDP_API void crypto_des3_free(CryptoDes3 des3); typedef struct crypto_hmac_struct* CryptoHmac; FREERDP_API CryptoHmac crypto_hmac_new(void); -FREERDP_API void crypto_hmac_sha1_init(CryptoHmac hmac, const uint8 *data, uint32 length); -FREERDP_API void crypto_hmac_update(CryptoHmac hmac, const uint8 *data, uint32 length); -FREERDP_API void crypto_hmac_final(CryptoHmac hmac, uint8 *out_data, uint32 length); +FREERDP_API void crypto_hmac_sha1_init(CryptoHmac hmac, const BYTE *data, UINT32 length); +FREERDP_API void crypto_hmac_update(CryptoHmac hmac, const BYTE *data, UINT32 length); +FREERDP_API void crypto_hmac_final(CryptoHmac hmac, BYTE *out_data, UINT32 length); FREERDP_API void crypto_hmac_free(CryptoHmac hmac); typedef struct crypto_cert_struct* CryptoCert; #include -FREERDP_API CryptoCert crypto_cert_read(uint8* data, uint32 length); +FREERDP_API CryptoCert crypto_cert_read(BYTE* data, UINT32 length); FREERDP_API char* crypto_cert_fingerprint(X509* xcert); FREERDP_API char* crypto_cert_subject(X509* xcert); FREERDP_API char* crypto_cert_subject_common_name(X509* xcert, int* length); @@ -125,23 +125,23 @@ FREERDP_API char* crypto_cert_issuer(X509* xcert); FREERDP_API void crypto_cert_print_info(X509* xcert); FREERDP_API void crypto_cert_free(CryptoCert cert); -FREERDP_API boolean x509_verify_certificate(CryptoCert cert, char* certificate_store_path); +FREERDP_API BOOL x509_verify_certificate(CryptoCert cert, char* certificate_store_path); FREERDP_API rdpCertificateData* crypto_get_certificate_data(X509* xcert, char* hostname); -FREERDP_API boolean crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* PublicKeyLength); +FREERDP_API BOOL crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* PublicKeyLength); #define TSSK_KEY_LENGTH 64 -extern const uint8 tssk_modulus[]; -extern const uint8 tssk_privateExponent[]; -extern const uint8 tssk_exponent[]; +extern const BYTE tssk_modulus[]; +extern const BYTE tssk_privateExponent[]; +extern const BYTE tssk_exponent[]; -FREERDP_API void crypto_rsa_public_encrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, uint8* output); -FREERDP_API void crypto_rsa_public_decrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, uint8* output); -FREERDP_API void crypto_rsa_private_encrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* private_exponent, uint8* output); -FREERDP_API void crypto_rsa_private_decrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* private_exponent, uint8* output); -FREERDP_API void crypto_reverse(uint8* data, int length); -FREERDP_API void crypto_nonce(uint8* nonce, int size); +FREERDP_API void crypto_rsa_public_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output); +FREERDP_API void crypto_rsa_public_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output); +FREERDP_API void crypto_rsa_private_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output); +FREERDP_API void crypto_rsa_private_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output); +FREERDP_API void crypto_reverse(BYTE* data, int length); +FREERDP_API void crypto_nonce(BYTE* nonce, int size); -FREERDP_API char* crypto_base64_encode(uint8* data, int length); -FREERDP_API void crypto_base64_decode(uint8* enc_data, int length, uint8** dec_data, int* res_length); +FREERDP_API char* crypto_base64_encode(BYTE* data, int length); +FREERDP_API void crypto_base64_decode(BYTE* enc_data, int length, BYTE** dec_data, int* res_length); #endif /* FREERDP_CRYPTO_H */ diff --git a/include/freerdp/crypto/der.h b/include/freerdp/crypto/der.h index 1902f93cb..f7758e5aa 100644 --- a/include/freerdp/crypto/der.h +++ b/include/freerdp/crypto/der.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * ASN.1 Basic Encoding Rules (DER) * * Copyright 2011 Samsung, Author Jiten Pathy @@ -30,7 +30,7 @@ FREERDP_API int der_skip_octet_string(int length); FREERDP_API int der_skip_sequence_tag(int length); FREERDP_API int der_write_sequence_tag(STREAM* s, int length); FREERDP_API int der_skip_contextual_tag(int length); -FREERDP_API int der_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc); -FREERDP_API void der_write_octet_string(STREAM* s, uint8* oct_str, int length); +FREERDP_API int der_write_contextual_tag(STREAM* s, BYTE tag, int length, BOOL pc); +FREERDP_API void der_write_octet_string(STREAM* s, BYTE* oct_str, int length); #endif /* FREERDP_CRYPTO_DER_H */ diff --git a/include/freerdp/crypto/er.h b/include/freerdp/crypto/er.h index 82fd67b69..bbbcc83b8 100644 --- a/include/freerdp/crypto/er.h +++ b/include/freerdp/crypto/er.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * ASN.1 Encoding Rules (BER/DER common functions) * * Copyright 2011 Marc-Andre Moreau @@ -55,34 +55,34 @@ #define ER_PC(_pc) (_pc ? ER_CONSTRUCT : ER_PRIMITIVE) FREERDP_API void er_read_length(STREAM* s, int* length); -FREERDP_API int er_write_length(STREAM* s, int length, boolean flag); +FREERDP_API int er_write_length(STREAM* s, int length, BOOL flag); FREERDP_API int _er_skip_length(int length); FREERDP_API int er_get_content_length(int length); -FREERDP_API boolean er_read_universal_tag(STREAM* s, uint8 tag, boolean pc); -FREERDP_API void er_write_universal_tag(STREAM* s, uint8 tag, boolean pc); -FREERDP_API boolean er_read_application_tag(STREAM* s, uint8 tag, int* length); -FREERDP_API void er_write_application_tag(STREAM* s, uint8 tag, int length, boolean flag); -FREERDP_API boolean er_read_application_tag(STREAM* s, uint8 tag, int* length); -FREERDP_API boolean er_read_enumerated(STREAM* s, uint8* enumerated, uint8 count); -FREERDP_API void er_write_enumerated(STREAM* s, uint8 enumerated, uint8 count, boolean flag); -FREERDP_API boolean er_read_contextual_tag(STREAM* s, uint8 tag, int* length, boolean pc); -FREERDP_API int er_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc, boolean flag); +FREERDP_API BOOL er_read_universal_tag(STREAM* s, BYTE tag, BOOL pc); +FREERDP_API void er_write_universal_tag(STREAM* s, BYTE tag, BOOL pc); +FREERDP_API BOOL er_read_application_tag(STREAM* s, BYTE tag, int* length); +FREERDP_API void er_write_application_tag(STREAM* s, BYTE tag, int length, BOOL flag); +FREERDP_API BOOL er_read_application_tag(STREAM* s, BYTE tag, int* length); +FREERDP_API BOOL er_read_enumerated(STREAM* s, BYTE* enumerated, BYTE count); +FREERDP_API void er_write_enumerated(STREAM* s, BYTE enumerated, BYTE count, BOOL flag); +FREERDP_API BOOL er_read_contextual_tag(STREAM* s, BYTE tag, int* length, BOOL pc); +FREERDP_API int er_write_contextual_tag(STREAM* s, BYTE tag, int length, BOOL pc, BOOL flag); FREERDP_API int er_skip_contextual_tag(int length); -FREERDP_API boolean er_read_sequence_tag(STREAM* s, int* length); -FREERDP_API int er_write_sequence_tag(STREAM* s, int length, boolean flag); +FREERDP_API BOOL er_read_sequence_tag(STREAM* s, int* length); +FREERDP_API int er_write_sequence_tag(STREAM* s, int length, BOOL flag); FREERDP_API int er_skip_sequence(int length); FREERDP_API int er_skip_sequence_tag(int length); -FREERDP_API boolean er_read_bit_string(STREAM* s, int* length, uint8* padding); -FREERDP_API boolean er_write_bit_string_tag(STREAM* s, uint32 length, uint8 padding, boolean flag); -FREERDP_API boolean er_read_octet_string(STREAM* s, int* length); -FREERDP_API void er_write_octet_string(STREAM* s, uint8* oct_str, int length, boolean flag); -FREERDP_API int er_write_octet_string_tag(STREAM* s, int length, boolean flag); +FREERDP_API BOOL er_read_bit_string(STREAM* s, int* length, BYTE* padding); +FREERDP_API BOOL er_write_bit_string_tag(STREAM* s, UINT32 length, BYTE padding, BOOL flag); +FREERDP_API BOOL er_read_octet_string(STREAM* s, int* length); +FREERDP_API void er_write_octet_string(STREAM* s, BYTE* oct_str, int length, BOOL flag); +FREERDP_API int er_write_octet_string_tag(STREAM* s, int length, BOOL flag); FREERDP_API int er_skip_octet_string(int length); -FREERDP_API boolean er_read_boolean(STREAM* s, boolean* value); -FREERDP_API void er_write_boolean(STREAM* s, boolean value); -FREERDP_API boolean er_read_integer(STREAM* s, uint32* value); -FREERDP_API int er_write_integer(STREAM* s, sint32 value); -FREERDP_API boolean er_read_integer_length(STREAM* s, int* length); -FREERDP_API int er_skip_integer(sint32 value); +FREERDP_API BOOL er_read_BOOL(STREAM* s, BOOL* value); +FREERDP_API void er_write_BOOL(STREAM* s, BOOL value); +FREERDP_API BOOL er_read_integer(STREAM* s, UINT32* value); +FREERDP_API int er_write_integer(STREAM* s, INT32 value); +FREERDP_API BOOL er_read_integer_length(STREAM* s, int* length); +FREERDP_API int er_skip_integer(INT32 value); #endif /* FREERDP_CRYPTO_ER_H */ diff --git a/include/freerdp/crypto/nla.h b/include/freerdp/crypto/nla.h index 7e0a08b93..6e1434664 100644 --- a/include/freerdp/crypto/nla.h +++ b/include/freerdp/crypto/nla.h @@ -36,7 +36,7 @@ typedef struct rdp_credssp rdpCredssp; struct rdp_credssp { rdpTls* tls; - boolean server; + BOOL server; int send_seq_num; int recv_seq_num; freerdp* instance; diff --git a/include/freerdp/crypto/per.h b/include/freerdp/crypto/per.h index 07aa7e605..479784c2d 100644 --- a/include/freerdp/crypto/per.h +++ b/include/freerdp/crypto/per.h @@ -23,27 +23,27 @@ #include #include -FREERDP_API boolean per_read_length(STREAM* s, uint16* length); +FREERDP_API BOOL per_read_length(STREAM* s, UINT16* length); FREERDP_API void per_write_length(STREAM* s, int length); -FREERDP_API boolean per_read_choice(STREAM* s, uint8* choice); -FREERDP_API void per_write_choice(STREAM* s, uint8 choice); -FREERDP_API boolean per_read_selection(STREAM* s, uint8* selection); -FREERDP_API void per_write_selection(STREAM* s, uint8 selection); -FREERDP_API boolean per_read_number_of_sets(STREAM* s, uint8* number); -FREERDP_API void per_write_number_of_sets(STREAM* s, uint8 number); -FREERDP_API boolean per_read_padding(STREAM* s, int length); +FREERDP_API BOOL per_read_choice(STREAM* s, BYTE* choice); +FREERDP_API void per_write_choice(STREAM* s, BYTE choice); +FREERDP_API BOOL per_read_selection(STREAM* s, BYTE* selection); +FREERDP_API void per_write_selection(STREAM* s, BYTE selection); +FREERDP_API BOOL per_read_number_of_sets(STREAM* s, BYTE* number); +FREERDP_API void per_write_number_of_sets(STREAM* s, BYTE number); +FREERDP_API BOOL per_read_padding(STREAM* s, int length); FREERDP_API void per_write_padding(STREAM* s, int length); -FREERDP_API boolean per_read_integer(STREAM* s, uint32* integer); -FREERDP_API boolean per_read_integer16(STREAM* s, uint16* integer, uint16 min); -FREERDP_API void per_write_integer(STREAM* s, uint32 integer); -FREERDP_API void per_write_integer16(STREAM* s, uint16 integer, uint16 min); -FREERDP_API boolean per_read_enumerated(STREAM* s, uint8* enumerated, uint8 count); -FREERDP_API void per_write_enumerated(STREAM* s, uint8 enumerated, uint8 count); -FREERDP_API void per_write_object_identifier(STREAM* s, uint8 oid[6]); -FREERDP_API boolean per_read_object_identifier(STREAM* s, uint8 oid[6]); -FREERDP_API boolean per_read_octet_string(STREAM* s, uint8* oct_str, int length, int min); -FREERDP_API void per_write_octet_string(STREAM* s, uint8* oct_str, int length, int min); -FREERDP_API boolean per_read_numeric_string(STREAM* s, int min); -FREERDP_API void per_write_numeric_string(STREAM* s, uint8* num_str, int length, int min); +FREERDP_API BOOL per_read_integer(STREAM* s, UINT32* integer); +FREERDP_API BOOL per_read_integer16(STREAM* s, UINT16* integer, UINT16 min); +FREERDP_API void per_write_integer(STREAM* s, UINT32 integer); +FREERDP_API void per_write_integer16(STREAM* s, UINT16 integer, UINT16 min); +FREERDP_API BOOL per_read_enumerated(STREAM* s, BYTE* enumerated, BYTE count); +FREERDP_API void per_write_enumerated(STREAM* s, BYTE enumerated, BYTE count); +FREERDP_API void per_write_object_identifier(STREAM* s, BYTE oid[6]); +FREERDP_API BOOL per_read_object_identifier(STREAM* s, BYTE oid[6]); +FREERDP_API BOOL per_read_octet_string(STREAM* s, BYTE* oct_str, int length, int min); +FREERDP_API void per_write_octet_string(STREAM* s, BYTE* oct_str, int length, int min); +FREERDP_API BOOL per_read_numeric_string(STREAM* s, int min); +FREERDP_API void per_write_numeric_string(STREAM* s, BYTE* num_str, int length, int min); #endif /* FREERDP_CRYPTO_PER_H */ diff --git a/include/freerdp/crypto/tls.h b/include/freerdp/crypto/tls.h index c271202e2..949f60ae1 100644 --- a/include/freerdp/crypto/tls.h +++ b/include/freerdp/crypto/tls.h @@ -43,21 +43,21 @@ struct rdp_tls rdpCertificateStore* certificate_store; }; -FREERDP_API boolean tls_connect(rdpTls* tls); -FREERDP_API boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_file); -FREERDP_API boolean tls_disconnect(rdpTls* tls); +FREERDP_API BOOL tls_connect(rdpTls* tls); +FREERDP_API BOOL tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_file); +FREERDP_API BOOL tls_disconnect(rdpTls* tls); -FREERDP_API int tls_read(rdpTls* tls, uint8* data, int length); -FREERDP_API int tls_write(rdpTls* tls, uint8* data, int length); +FREERDP_API int tls_read(rdpTls* tls, BYTE* data, int length); +FREERDP_API int tls_write(rdpTls* tls, BYTE* data, int length); -FREERDP_API int tls_read_all(rdpTls* tls, uint8* data, int length); -FREERDP_API int tls_write_all(rdpTls* tls, uint8* data, int length); +FREERDP_API int tls_read_all(rdpTls* tls, BYTE* data, int length); +FREERDP_API int tls_write_all(rdpTls* tls, BYTE* data, int length); -FREERDP_API boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname); +FREERDP_API BOOL tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname); FREERDP_API void tls_print_certificate_error(char* hostname, char* fingerprint); FREERDP_API void tls_print_certificate_name_mismatch_error(char* hostname, char* common_name, char** alt_names, int alt_names_count); -FREERDP_API boolean tls_print_error(char* func, SSL* connection, int value); +FREERDP_API BOOL tls_print_error(char* func, SSL* connection, int value); FREERDP_API rdpTls* tls_new(rdpSettings* settings); FREERDP_API void tls_free(rdpTls* tls); diff --git a/include/freerdp/dvc.h b/include/freerdp/dvc.h index 98a382ae7..1835e4928 100644 --- a/include/freerdp/dvc.h +++ b/include/freerdp/dvc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Dynamic Virtual Channel Interface * * Copyright 2010-2011 Vic Lee @@ -72,8 +72,8 @@ struct _IWTSVirtualChannel { /* Starts a write request on the channel. */ int (*Write) (IWTSVirtualChannel* pChannel, - uint32 cbSize, - uint8* pBuffer, + UINT32 cbSize, + BYTE* pBuffer, void* pReserved); /* Closes the channel. */ int (*Close) (IWTSVirtualChannel* pChannel); @@ -85,7 +85,7 @@ struct _IWTSVirtualChannelManager endpoint, or creates a static channel. */ int (*CreateListener) (IWTSVirtualChannelManager* pChannelMgr, const char* pszChannelName, - uint32 ulFlags, + UINT32 ulFlags, IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener); /* Push a virtual channel event. @@ -93,9 +93,9 @@ struct _IWTSVirtualChannelManager int (*PushEvent) (IWTSVirtualChannelManager* pChannelMgr, RDP_EVENT* pEvent); /* Find the channel or ID to send data to a specific endpoint. */ - uint32 (*GetChannelId) (IWTSVirtualChannel * channel); + UINT32 (*GetChannelId) (IWTSVirtualChannel * channel); IWTSVirtualChannel* (*FindChannelById) (IWTSVirtualChannelManager* pChannelMgr, - uint32 ChannelId); + UINT32 ChannelId); }; struct _IWTSPlugin @@ -110,7 +110,7 @@ struct _IWTSPlugin /* Notifies the plug-in that the Remote Desktop Connection (RDC) client has disconnected from the RD Session Host server. */ int (*Disconnected) (IWTSPlugin* pPlugin, - uint32 dwDisconnectCode); + UINT32 dwDisconnectCode); /* Notifies the plug-in that the Remote Desktop Connection (RDC) client has terminated. */ int (*Terminated) (IWTSPlugin* pPlugin); @@ -122,7 +122,7 @@ struct _IWTSListenerCallback the associated listener. */ int (*OnNewChannelConnection) (IWTSListenerCallback* pListenerCallback, IWTSVirtualChannel* pChannel, - uint8* Data, + BYTE* Data, int* pbAccept, IWTSVirtualChannelCallback** ppCallback); }; @@ -131,8 +131,8 @@ struct _IWTSVirtualChannelCallback { /* Notifies the user about data that is being received. */ int (*OnDataReceived) (IWTSVirtualChannelCallback* pChannelCallback, - uint32 cbSize, - uint8* pBuffer); + UINT32 cbSize, + BYTE* pBuffer); /* Notifies the user that the channel has been closed. */ int (*OnClose) (IWTSVirtualChannelCallback* pChannelCallback); }; diff --git a/include/freerdp/errorcodes.h b/include/freerdp/errorcodes.h index 826dfdc77..b907b83f7 100644 --- a/include/freerdp/errorcodes.h +++ b/include/freerdp/errorcodes.h @@ -13,7 +13,7 @@ extern "C" { #endif /** -* This static variable holds an error code if the return value from connect is false. +* This static variable holds an error code if the return value from connect is FALSE. * This variable is always set to 0 in the beginning of the connect sequence. * The returned code can be used to inform the user of the detailed connect error. * The value can hold one of the defined error codes below OR an error according to errno diff --git a/include/freerdp/extension.h b/include/freerdp/extension.h index 17c845603..382273d50 100644 --- a/include/freerdp/extension.h +++ b/include/freerdp/extension.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Extensions * * Copyright 2010-2011 Vic Lee @@ -35,11 +35,11 @@ struct rdp_ext_plugin int (*uninit) (rdpExtPlugin* plugin, freerdp* instance); }; -typedef uint32 (FREERDP_CC* PFREERDP_EXTENSION_HOOK)(rdpExtPlugin* plugin, freerdp* instance); +typedef UINT32 (FREERDP_CC* PFREERDP_EXTENSION_HOOK)(rdpExtPlugin* plugin, freerdp* instance); -typedef uint32 (FREERDP_CC* PREGISTEREXTENSION)(rdpExtPlugin* plugin); -typedef uint32 (FREERDP_CC* PREGISTERPRECONNECTHOOK)(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook); -typedef uint32 (FREERDP_CC* PREGISTERPOSTCONNECTHOOK)(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook); +typedef UINT32 (FREERDP_CC* PREGISTEREXTENSION)(rdpExtPlugin* plugin); +typedef UINT32 (FREERDP_CC* PREGISTERPRECONNECTHOOK)(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook); +typedef UINT32 (FREERDP_CC* PREGISTERPOSTCONNECTHOOK)(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook); struct _FREERDP_EXTENSION_ENTRY_POINTS { diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index 8644495b5..2397ecc00 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Interface * * Copyright 2009-2011 Jay Sorg @@ -48,14 +48,14 @@ extern "C" { typedef void (*pContextNew)(freerdp* instance, rdpContext* context); typedef void (*pContextFree)(freerdp* instance, rdpContext* context); -typedef boolean (*pPreConnect)(freerdp* instance); -typedef boolean (*pPostConnect)(freerdp* instance); -typedef boolean (*pAuthenticate)(freerdp* instance, char** username, char** password, char** domain); -typedef boolean (*pVerifyCertificate)(freerdp* instance, char* subject, char* issuer, char* fingerprint); -typedef boolean (*pVerifyChangedCertificate)(freerdp* instance, char* subject, char* issuer, char* new_fingerprint, char* old_fingerprint); +typedef BOOL (*pPreConnect)(freerdp* instance); +typedef BOOL (*pPostConnect)(freerdp* instance); +typedef BOOL (*pAuthenticate)(freerdp* instance, char** username, char** password, char** domain); +typedef BOOL (*pVerifyCertificate)(freerdp* instance, char* subject, char* issuer, char* fingerprint); +typedef BOOL (*pVerifyChangedCertificate)(freerdp* instance, char* subject, char* issuer, char* new_fingerprint, char* old_fingerprint); -typedef int (*pSendChannelData)(freerdp* instance, int channelId, uint8* data, int size); -typedef int (*pReceiveChannelData)(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size); +typedef int (*pSendChannelData)(freerdp* instance, int channelId, BYTE* data, int size); +typedef int (*pReceiveChannelData)(freerdp* instance, int channelId, BYTE* data, int size, int flags, int total_size); /** * Defines the context for a given instance of RDP connection. @@ -72,7 +72,7 @@ struct rdp_context Pointer to the client peer. This is set by a call to freerdp_peer_context_new() during peer initialization. This field is used only on the server side. */ - uint32 paddingA[16 - 2]; /* 2 */ + UINT32 paddingA[16 - 2]; /* 2 */ int argc; /**< (offset 16) Number of arguments given to the program at launch time. @@ -82,7 +82,7 @@ struct rdp_context List of arguments given to the program at launch time. Used to keep this data available and used later on, typically just before connection initialization. @see freerdp_parse_args() */ - uint32 paddingB[32 - 18]; /* 18 */ + UINT32 paddingB[32 - 18]; /* 18 */ rdpRdp* rdp; /**< (offset 32) Pointer to a rdp_rdp structure used to keep the connection's parameters. @@ -96,7 +96,7 @@ struct rdp_context rdpCache* cache; /* 35 */ rdpChannels* channels; /* 36 */ rdpGraphics* graphics; /* 37 */ - uint32 paddingC[64 - 38]; /* 38 */ + UINT32 paddingC[64 - 38]; /* 38 */ }; /** Defines the options for a given instance of RDP connection. @@ -115,7 +115,7 @@ struct rdp_freerdp rdpContext field first, and any additional content following it. Can be allocated by a call to freerdp_context_new(). Must be dealocated by a call to freerdp_context_free() before deallocating the current instance. */ - uint32 paddingA[16 - 1]; /* 1 */ + UINT32 paddingA[16 - 1]; /* 1 */ rdpInput* input; /* (offset 16) Input handle for the connection. @@ -126,7 +126,7 @@ struct rdp_freerdp rdpSettings* settings; /**< (offset 18) Pointer to a rdpSettings structure. Will be used to maintain the required RDP settings. Will be initialized by a call to freerdp_context_new() */ - uint32 paddingB[32 - 19]; /* 19 */ + UINT32 paddingB[32 - 19]; /* 19 */ size_t context_size; /* (offset 32) Specifies the size of the 'context' field. freerdp_context_new() will use this size to allocate the context buffer. @@ -146,7 +146,7 @@ struct rdp_freerdp Callback for context deallocation Can be set before calling freerdp_context_free() to have it executed before deallocation. Must be set to NULL if not needed. */ - uint32 paddingC[48 - 35]; /* 35 */ + UINT32 paddingC[48 - 35]; /* 35 */ pPreConnect PreConnect; /**< (offset 48) Callback for pre-connect operations. @@ -167,8 +167,8 @@ struct rdp_freerdp pVerifyChangedCertificate VerifyChangedCertificate; /**< (offset 52) Callback for changed certificate validation. Used when a certificate differs from stored fingerprint. - If returns true, the new fingerprint will be trusted and old thrown out. */ - uint32 paddingD[64 - 51]; /* 51 */ + If returns TRUE, the new fingerprint will be trusted and old thrown out. */ + UINT32 paddingD[64 - 51]; /* 51 */ pSendChannelData SendChannelData; /* (offset 64) Callback for sending data to a channel. @@ -178,20 +178,20 @@ struct rdp_freerdp Callback for receiving data from a channel. This is called by freerdp_channel_process() (if not NULL). Clients will typically use a function that calls freerdp_channels_data() to perform the needed tasks. */ - uint32 paddingE[80 - 66]; /* 66 */ + UINT32 paddingE[80 - 66]; /* 66 */ }; FREERDP_API void freerdp_context_new(freerdp* instance); FREERDP_API void freerdp_context_free(freerdp* instance); -FREERDP_API boolean freerdp_connect(freerdp* instance); -FREERDP_API boolean freerdp_shall_disconnect(freerdp* instance); -FREERDP_API boolean freerdp_disconnect(freerdp* instance); +FREERDP_API BOOL freerdp_connect(freerdp* instance); +FREERDP_API BOOL freerdp_shall_disconnect(freerdp* instance); +FREERDP_API BOOL freerdp_disconnect(freerdp* instance); -FREERDP_API boolean freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount); -FREERDP_API boolean freerdp_check_fds(freerdp* instance); +FREERDP_API BOOL freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount); +FREERDP_API BOOL freerdp_check_fds(freerdp* instance); -FREERDP_API uint32 freerdp_error_info(freerdp* instance); +FREERDP_API UINT32 freerdp_error_info(freerdp* instance); FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision); diff --git a/include/freerdp/gdi/16bpp.h b/include/freerdp/gdi/16bpp.h index 5e0b76777..0594a4989 100644 --- a/include/freerdp/gdi/16bpp.h +++ b/include/freerdp/gdi/16bpp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI 16bpp Internal Buffer Routines * * Copyright 2010-2011 Marc-Andre Moreau @@ -23,7 +23,7 @@ typedef int (*pLineTo_16bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); -FREERDP_API uint16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color); +FREERDP_API UINT16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color); FREERDP_API int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); FREERDP_API int BitBlt_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); diff --git a/include/freerdp/gdi/32bpp.h b/include/freerdp/gdi/32bpp.h index a843b6172..cacc05346 100644 --- a/include/freerdp/gdi/32bpp.h +++ b/include/freerdp/gdi/32bpp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI 32bpp Internal Buffer Routines * * Copyright 2010-2011 Marc-Andre Moreau @@ -23,7 +23,7 @@ typedef int (*pLineTo_32bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); -FREERDP_API uint32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color); +FREERDP_API UINT32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color); FREERDP_API int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); FREERDP_API int BitBlt_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); diff --git a/include/freerdp/gdi/8bpp.h b/include/freerdp/gdi/8bpp.h index cd944dcc1..6ee9e8e7b 100644 --- a/include/freerdp/gdi/8bpp.h +++ b/include/freerdp/gdi/8bpp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI 8bpp Internal Buffer Routines * * Copyright 2010-2011 Marc-Andre Moreau @@ -23,7 +23,7 @@ typedef int (*pLineTo_8bpp)(HGDI_DC hdc, int nXEnd, int nYEnd); -FREERDP_API uint8 gdi_get_color_8bpp(HGDI_DC hdc, GDI_COLOR color); +FREERDP_API BYTE gdi_get_color_8bpp(HGDI_DC hdc, GDI_COLOR color); FREERDP_API int FillRect_8bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr); FREERDP_API int BitBlt_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); diff --git a/include/freerdp/gdi/bitmap.h b/include/freerdp/gdi/bitmap.h index 75a9dee0e..4422e820c 100644 --- a/include/freerdp/gdi/bitmap.h +++ b/include/freerdp/gdi/bitmap.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Bitmap Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -25,16 +25,16 @@ FREERDP_API GDI_COLOR gdi_GetPixel(HGDI_DC hdc, int nXPos, int nYPos); FREERDP_API GDI_COLOR gdi_SetPixel(HGDI_DC hdc, int X, int Y, GDI_COLOR crColor); -FREERDP_API uint8 gdi_GetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y); -FREERDP_API uint16 gdi_GetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y); -FREERDP_API uint32 gdi_GetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y); -FREERDP_API uint8* gdi_GetPointer_8bpp(HGDI_BITMAP hBmp, int X, int Y); -FREERDP_API uint16* gdi_GetPointer_16bpp(HGDI_BITMAP hBmp, int X, int Y); -FREERDP_API uint32* gdi_GetPointer_32bpp(HGDI_BITMAP hBmp, int X, int Y); -FREERDP_API void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, uint8 pixel); -FREERDP_API void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, uint16 pixel); -FREERDP_API void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, uint32 pixel); -FREERDP_API HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, uint8* data); +FREERDP_API BYTE gdi_GetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y); +FREERDP_API UINT16 gdi_GetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y); +FREERDP_API UINT32 gdi_GetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y); +FREERDP_API BYTE* gdi_GetPointer_8bpp(HGDI_BITMAP hBmp, int X, int Y); +FREERDP_API UINT16* gdi_GetPointer_16bpp(HGDI_BITMAP hBmp, int X, int Y); +FREERDP_API UINT32* gdi_GetPointer_32bpp(HGDI_BITMAP hBmp, int X, int Y); +FREERDP_API void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, BYTE pixel); +FREERDP_API void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, UINT16 pixel); +FREERDP_API void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, UINT32 pixel); +FREERDP_API HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, BYTE* data); FREERDP_API HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight); FREERDP_API int gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop); diff --git a/include/freerdp/gdi/brush.h b/include/freerdp/gdi/brush.h index 505505906..56214911a 100644 --- a/include/freerdp/gdi/brush.h +++ b/include/freerdp/gdi/brush.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Brush Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/gdi/clipping.h b/include/freerdp/gdi/clipping.h index 88fede0a2..58fe22bce 100644 --- a/include/freerdp/gdi/clipping.h +++ b/include/freerdp/gdi/clipping.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Clipping Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/gdi/dc.h b/include/freerdp/gdi/dc.h index 83fa1152e..1da89e83e 100644 --- a/include/freerdp/gdi/dc.h +++ b/include/freerdp/gdi/dc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Device Context Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/gdi/drawing.h b/include/freerdp/gdi/drawing.h index 7447450c8..5c1e78ec6 100644 --- a/include/freerdp/gdi/drawing.h +++ b/include/freerdp/gdi/drawing.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Drawing Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/gdi/gdi.h b/include/freerdp/gdi/gdi.h index 03acd9052..84f2da0cd 100644 --- a/include/freerdp/gdi/gdi.h +++ b/include/freerdp/gdi/gdi.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Library * * Copyright 2010-2011 Marc-Andre Moreau @@ -116,7 +116,7 @@ struct _GDIOBJECT { - uint8 objectType; + BYTE objectType; }; typedef struct _GDIOBJECT GDIOBJECT; typedef GDIOBJECT* HGDIOBJECT; @@ -127,7 +127,7 @@ typedef GDI_COLOR* LPGDI_COLOR; struct _GDI_RECT { - uint8 objectType; + BYTE objectType; int left; int top; int right; @@ -138,7 +138,7 @@ typedef GDI_RECT* HGDI_RECT; struct _GDI_RGN { - uint8 objectType; + BYTE objectType; int x; /* left */ int y; /* top */ int w; /* width */ @@ -150,20 +150,20 @@ typedef GDI_RGN* HGDI_RGN; struct _GDI_BITMAP { - uint8 objectType; + BYTE objectType; int bytesPerPixel; int bitsPerPixel; int width; int height; int scanline; - uint8* data; + BYTE* data; }; typedef struct _GDI_BITMAP GDI_BITMAP; typedef GDI_BITMAP* HGDI_BITMAP; struct _GDI_PEN { - uint8 objectType; + BYTE objectType; int style; int width; int posX; @@ -175,15 +175,15 @@ typedef GDI_PEN* HGDI_PEN; struct _GDI_PALETTEENTRY { - uint8 red; - uint8 green; - uint8 blue; + BYTE red; + BYTE green; + BYTE blue; }; typedef struct _GDI_PALETTEENTRY GDI_PALETTEENTRY; struct _GDI_PALETTE { - uint16 count; + UINT16 count; GDI_PALETTEENTRY *entries; }; typedef struct _GDI_PALETTE GDI_PALETTE; @@ -199,7 +199,7 @@ typedef GDI_POINT* HGDI_POINT; struct _GDI_BRUSH { - uint8 objectType; + BYTE objectType; int style; HGDI_BITMAP pattern; GDI_COLOR color; @@ -273,7 +273,7 @@ struct rdp_gdi HCLRCONV clrconv; gdiBitmap* primary; gdiBitmap* drawing; - uint8* primary_buffer; + BYTE* primary_buffer; GDI_COLOR textColor; void* rfx_context; void* nsc_context; @@ -281,13 +281,13 @@ struct rdp_gdi gdiBitmap* image; }; -FREERDP_API uint32 gdi_rop3_code(uint8 code); -FREERDP_API uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y); -FREERDP_API uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y); -FREERDP_API int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width); +FREERDP_API UINT32 gdi_rop3_code(BYTE code); +FREERDP_API BYTE* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y); +FREERDP_API BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y); +FREERDP_API int gdi_is_mono_pixel_set(BYTE* data, int x, int y, int width); FREERDP_API void gdi_resize(rdpGdi* gdi, int width, int height); -FREERDP_API int gdi_init(freerdp* instance, uint32 flags, uint8* buffer); +FREERDP_API int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer); FREERDP_API void gdi_free(freerdp* instance); #ifdef WITH_DEBUG_GDI diff --git a/include/freerdp/gdi/line.h b/include/freerdp/gdi/line.h index 35a19fa62..e8664c180 100644 --- a/include/freerdp/gdi/line.h +++ b/include/freerdp/gdi/line.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Line Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/gdi/palette.h b/include/freerdp/gdi/palette.h index d07a8d0b5..b7a4c8813 100644 --- a/include/freerdp/gdi/palette.h +++ b/include/freerdp/gdi/palette.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Palette Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/gdi/pen.h b/include/freerdp/gdi/pen.h index c34773402..20e7030ca 100644 --- a/include/freerdp/gdi/pen.h +++ b/include/freerdp/gdi/pen.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Pen Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -24,8 +24,8 @@ #include FREERDP_API HGDI_PEN gdi_CreatePen(int fnPenStyle, int nWidth, int crColor); -FREERDP_API uint8 gdi_GetPenColor_8bpp(HGDI_PEN pen); -FREERDP_API uint16 gdi_GetPenColor_16bpp(HGDI_PEN pen); -FREERDP_API uint32 gdi_GetPenColor_32bpp(HGDI_PEN pen); +FREERDP_API BYTE gdi_GetPenColor_8bpp(HGDI_PEN pen); +FREERDP_API UINT16 gdi_GetPenColor_16bpp(HGDI_PEN pen); +FREERDP_API UINT32 gdi_GetPenColor_32bpp(HGDI_PEN pen); #endif /* __GDI_PEN_H */ diff --git a/include/freerdp/gdi/region.h b/include/freerdp/gdi/region.h index 09b2129e8..53bfc37b7 100644 --- a/include/freerdp/gdi/region.h +++ b/include/freerdp/gdi/region.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Region Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/gdi/shape.h b/include/freerdp/gdi/shape.h index 4ec28e687..427c7d8cc 100644 --- a/include/freerdp/gdi/shape.h +++ b/include/freerdp/gdi/shape.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Shape Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/include/freerdp/graphics.h b/include/freerdp/graphics.h index 578feae3b..cba782343 100644 --- a/include/freerdp/graphics.h +++ b/include/freerdp/graphics.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Graphical Objects * * Copyright 2011 Marc-Andre Moreau @@ -35,9 +35,9 @@ typedef void (*pBitmap_New)(rdpContext* context, rdpBitmap* bitmap); typedef void (*pBitmap_Free)(rdpContext* context, rdpBitmap* bitmap); typedef void (*pBitmap_Paint)(rdpContext* context, rdpBitmap* bitmap); typedef void (*pBitmap_Decompress)(rdpContext* context, rdpBitmap* bitmap, - uint8* data, int width, int height, int bpp, int length, - boolean compressed, int codec_id); -typedef void (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, boolean primary); + BYTE* data, int width, int height, int bpp, int length, + BOOL compressed, int codec_id); +typedef void (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, BOOL primary); struct rdp_bitmap { @@ -47,23 +47,23 @@ struct rdp_bitmap pBitmap_Paint Paint; /* 3 */ pBitmap_Decompress Decompress; /* 4 */ pBitmap_SetSurface SetSurface; /* 5 */ - uint32 paddingA[16 - 6]; /* 6 */ + UINT32 paddingA[16 - 6]; /* 6 */ - uint32 left; /* 16 */ - uint32 top; /* 17 */ - uint32 right; /* 18 */ - uint32 bottom; /* 19 */ - uint32 width; /* 20 */ - uint32 height; /* 21 */ - uint32 bpp; /* 22 */ - uint32 flags; /* 23 */ - uint32 length; /* 24 */ - uint8* data; /* 25 */ - uint32 paddingB[32 - 26]; /* 26 */ + UINT32 left; /* 16 */ + UINT32 top; /* 17 */ + UINT32 right; /* 18 */ + UINT32 bottom; /* 19 */ + UINT32 width; /* 20 */ + UINT32 height; /* 21 */ + UINT32 bpp; /* 22 */ + UINT32 flags; /* 23 */ + UINT32 length; /* 24 */ + BYTE* data; /* 25 */ + UINT32 paddingB[32 - 26]; /* 26 */ - boolean compressed; /* 32 */ - boolean ephemeral; /* 33 */ - uint32 paddingC[64 - 34]; /* 34 */ + BOOL compressed; /* 32 */ + BOOL ephemeral; /* 33 */ + UINT32 paddingC[64 - 34]; /* 34 */ }; FREERDP_API rdpBitmap* Bitmap_Alloc(rdpContext* context); @@ -71,11 +71,11 @@ FREERDP_API void Bitmap_New(rdpContext* context, rdpBitmap* bitmap); FREERDP_API void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap); FREERDP_API void Bitmap_Register(rdpContext* context, rdpBitmap* bitmap); FREERDP_API void Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, - uint8* data, int width, int height, int bpp, int length, boolean compressed); + BYTE* data, int width, int height, int bpp, int length, BOOL compressed); FREERDP_API void Bitmap_SetRectangle(rdpContext* context, rdpBitmap* bitmap, - uint16 left, uint16 top, uint16 right, uint16 bottom); -FREERDP_API void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, uint16 width, uint16 height); -FREERDP_API void Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean primary); + UINT16 left, UINT16 top, UINT16 right, UINT16 bottom); +FREERDP_API void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, UINT16 width, UINT16 height); +FREERDP_API void Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary); /* Pointer Class */ @@ -93,18 +93,18 @@ struct rdp_pointer pPointer_Set Set; /* 3 */ pPointer_SetNull SetNull; /* 4*/ pPointer_SetDefault SetDefault; /* 5 */ - uint32 paddingA[16 - 6]; /* 6 */ + UINT32 paddingA[16 - 6]; /* 6 */ - uint32 xPos; /* 16 */ - uint32 yPos; /* 17 */ - uint32 width; /* 18 */ - uint32 height; /* 19 */ - uint32 xorBpp; /* 20 */ - uint32 lengthAndMask; /* 21 */ - uint32 lengthXorMask; /* 22 */ - uint8* xorMaskData; /* 23 */ - uint8* andMaskData; /* 24 */ - uint32 paddingB[32 - 25]; /* 25 */ + UINT32 xPos; /* 16 */ + UINT32 yPos; /* 17 */ + UINT32 width; /* 18 */ + UINT32 height; /* 19 */ + UINT32 xorBpp; /* 20 */ + UINT32 lengthAndMask; /* 21 */ + UINT32 lengthXorMask; /* 22 */ + BYTE* xorMaskData; /* 23 */ + BYTE* andMaskData; /* 24 */ + UINT32 paddingB[32 - 25]; /* 25 */ }; FREERDP_API rdpPointer* Pointer_Alloc(rdpContext* context); @@ -119,8 +119,8 @@ FREERDP_API void Pointer_SetDefault(rdpContext* context); typedef void (*pGlyph_New)(rdpContext* context, rdpGlyph* glyph); typedef void (*pGlyph_Free)(rdpContext* context, rdpGlyph* glyph); typedef void (*pGlyph_Draw)(rdpContext* context, rdpGlyph* glyph, int x, int y); -typedef void (*pGlyph_BeginDraw)(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor); -typedef void (*pGlyph_EndDraw)(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor); +typedef void (*pGlyph_BeginDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor); +typedef void (*pGlyph_EndDraw)(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor); struct rdp_glyph { @@ -130,23 +130,23 @@ struct rdp_glyph pGlyph_Draw Draw; /* 3 */ pGlyph_BeginDraw BeginDraw; /* 4 */ pGlyph_EndDraw EndDraw; /* 5 */ - uint32 paddingA[16 - 6]; /* 6 */ + UINT32 paddingA[16 - 6]; /* 6 */ - sint32 x; /* 16 */ - sint32 y; /* 17 */ - uint32 cx; /* 18 */ - uint32 cy; /* 19 */ - uint32 cb; /* 20 */ - uint8* aj; /* 21 */ - uint32 paddingB[32 - 22]; /* 22 */ + INT32 x; /* 16 */ + INT32 y; /* 17 */ + UINT32 cx; /* 18 */ + UINT32 cy; /* 19 */ + UINT32 cb; /* 20 */ + BYTE* aj; /* 21 */ + UINT32 paddingB[32 - 22]; /* 22 */ }; FREERDP_API rdpGlyph* Glyph_Alloc(rdpContext* context); FREERDP_API void Glyph_New(rdpContext* context, rdpGlyph* glyph); FREERDP_API void Glyph_Free(rdpContext* context, rdpGlyph* glyph); FREERDP_API void Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y); -FREERDP_API void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor); -FREERDP_API void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor); +FREERDP_API void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor); +FREERDP_API void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor); /* Graphics Module */ @@ -156,7 +156,7 @@ struct rdp_graphics rdpBitmap* Bitmap_Prototype; /* 1 */ rdpPointer* Pointer_Prototype; /* 2 */ rdpGlyph* Glyph_Prototype; /* 3 */ - uint32 paddingA[16 - 4]; /* 4 */ + UINT32 paddingA[16 - 4]; /* 4 */ }; FREERDP_API void graphics_register_bitmap(rdpGraphics* graphics, rdpBitmap* bitmap); diff --git a/include/freerdp/input.h b/include/freerdp/input.h index d4cbf849e..09f75da72 100644 --- a/include/freerdp/input.h +++ b/include/freerdp/input.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Input Interface API * * Copyright 2011 Marc-Andre Moreau @@ -54,31 +54,31 @@ typedef struct rdp_input rdpInput; #define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4 -typedef void (*pSynchronizeEvent)(rdpInput* input, uint32 flags); -typedef void (*pKeyboardEvent)(rdpInput* input, uint16 flags, uint16 code); -typedef void (*pUnicodeKeyboardEvent)(rdpInput* input, uint16 flags, uint16 code); -typedef void (*pMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y); -typedef void (*pExtendedMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y); +typedef void (*pSynchronizeEvent)(rdpInput* input, UINT32 flags); +typedef void (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code); +typedef void (*pUnicodeKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code); +typedef void (*pMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); +typedef void (*pExtendedMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); struct rdp_input { rdpContext* context; /* 0 */ void* param1; /* 1 */ - uint32 paddingA[16 - 2]; /* 2 */ + UINT32 paddingA[16 - 2]; /* 2 */ pSynchronizeEvent SynchronizeEvent; /* 16 */ pKeyboardEvent KeyboardEvent; /* 17 */ pUnicodeKeyboardEvent UnicodeKeyboardEvent; /* 18 */ pMouseEvent MouseEvent; /* 19 */ pExtendedMouseEvent ExtendedMouseEvent; /* 20 */ - uint32 paddingB[32 - 21]; /* 21 */ + UINT32 paddingB[32 - 21]; /* 21 */ }; -FREERDP_API void freerdp_input_send_synchronize_event(rdpInput* input, uint32 flags); -FREERDP_API void freerdp_input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -FREERDP_API void freerdp_input_send_keyboard_event_ex(rdpInput* input, boolean down, uint32 rdp_scancode); -FREERDP_API void freerdp_input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -FREERDP_API void freerdp_input_send_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); -FREERDP_API void freerdp_input_send_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); +FREERDP_API void freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags); +FREERDP_API void freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +FREERDP_API void freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode); +FREERDP_API void freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +FREERDP_API void freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); +FREERDP_API void freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); #endif /* __INPUT_API_H */ diff --git a/include/freerdp/listener.h b/include/freerdp/listener.h index e007cc620..4c16b3a0f 100644 --- a/include/freerdp/listener.h +++ b/include/freerdp/listener.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Listener * * Copyright 2011 Vic Lee @@ -31,10 +31,10 @@ typedef struct rdp_freerdp_listener freerdp_listener; extern "C" { #endif -typedef boolean (*psListenerOpen)(freerdp_listener* instance, const char* bind_address, uint16 port); -typedef boolean (*psListenerOpenLocal)(freerdp_listener* instance, const char* path); -typedef boolean (*psListenerGetFileDescriptor)(freerdp_listener* instance, void** rfds, int* rcount); -typedef boolean (*psListenerCheckFileDescriptor)(freerdp_listener* instance); +typedef BOOL (*psListenerOpen)(freerdp_listener* instance, const char* bind_address, UINT16 port); +typedef BOOL (*psListenerOpenLocal)(freerdp_listener* instance, const char* path); +typedef BOOL (*psListenerGetFileDescriptor)(freerdp_listener* instance, void** rfds, int* rcount); +typedef BOOL (*psListenerCheckFileDescriptor)(freerdp_listener* instance); typedef void (*psListenerClose)(freerdp_listener* instance); typedef void (*psPeerAccepted)(freerdp_listener* instance, freerdp_peer* client); diff --git a/include/freerdp/locale/keyboard.h b/include/freerdp/locale/keyboard.h index 3daeee602..5cbc12070 100644 --- a/include/freerdp/locale/keyboard.h +++ b/include/freerdp/locale/keyboard.h @@ -31,7 +31,7 @@ struct _RDP_KEYBOARD_LAYOUT { - uint32 code; /* Keyboard layout code */ + UINT32 code; /* Keyboard layout code */ char* name; /* Keyboard layout name */ }; typedef struct _RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT; @@ -198,11 +198,11 @@ typedef struct _RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT; #define KBD_TYPE_NOKIA_9140 0x00000006 /* Nokia 9140 and similar keyboards */ #define KBD_TYPE_JAPANESE 0x00000007 /* Japanese keyboard */ -FREERDP_API uint32 freerdp_keyboard_init(uint32 keyboardLayoutId); -FREERDP_API RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(uint32 types); -FREERDP_API const char* freerdp_keyboard_get_layout_name_from_id(uint32 keyboardLayoutId); -FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode); -FREERDP_API uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boolean extended); -FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode); +FREERDP_API UINT32 freerdp_keyboard_init(UINT32 keyboardLayoutId); +FREERDP_API RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(UINT32 types); +FREERDP_API const char* freerdp_keyboard_get_layout_name_from_id(UINT32 keyboardLayoutId); +FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(UINT32 keycode); +FREERDP_API UINT32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(UINT32 scancode, BOOL extended); +FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(UINT32 vkcode); #endif /* __FREERDP_LOCALE_KEYBOARD_H */ diff --git a/include/freerdp/locale/locale.h b/include/freerdp/locale/locale.h index 7853d2806..ed27d3b05 100644 --- a/include/freerdp/locale/locale.h +++ b/include/freerdp/locale/locale.h @@ -230,8 +230,8 @@ #define YORUBA 0x046A #define ZULU 0x0435 -FREERDP_API uint32 freerdp_get_system_locale_id(); -FREERDP_API uint32 freerdp_detect_keyboard_layout_from_system_locale(); -FREERDP_API const char* freerdp_get_system_locale_name_from_id(uint32 localeId); +FREERDP_API UINT32 freerdp_get_system_locale_id(); +FREERDP_API UINT32 freerdp_detect_keyboard_layout_from_system_locale(); +FREERDP_API const char* freerdp_get_system_locale_name_from_id(UINT32 localeId); #endif /* __FREERDP_LOCALE_H */ diff --git a/include/freerdp/locale/vkcodes.h b/include/freerdp/locale/vkcodes.h index 7e30cdfbb..9e1ae6679 100644 --- a/include/freerdp/locale/vkcodes.h +++ b/include/freerdp/locale/vkcodes.h @@ -303,7 +303,7 @@ #define VK_PA1 0xFD /* PA1 key */ #define VK_OEM_CLEAR 0xFE /* Clear key */ -FREERDP_API const char* freerdp_keyboard_get_virtual_key_code_name(uint32 vkcode); -FREERDP_API uint32 freerdp_keyboard_get_virtual_key_code_from_name(const char* vkcode_name); +FREERDP_API const char* freerdp_keyboard_get_virtual_key_code_name(UINT32 vkcode); +FREERDP_API UINT32 freerdp_keyboard_get_virtual_key_code_from_name(const char* vkcode_name); #endif /* __FREERDP_VIRTUAL_KEY_CODES_H */ diff --git a/include/freerdp/peer.h b/include/freerdp/peer.h index 635bd4e38..470df19d7 100644 --- a/include/freerdp/peer.h +++ b/include/freerdp/peer.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Peer * * Copyright 2011 Vic Lee @@ -31,18 +31,18 @@ typedef void (*psPeerContextNew)(freerdp_peer* client, rdpContext* context); typedef void (*psPeerContextFree)(freerdp_peer* client, rdpContext* context); -typedef boolean (*psPeerInitialize)(freerdp_peer* client); -typedef boolean (*psPeerGetFileDescriptor)(freerdp_peer* client, void** rfds, int* rcount); -typedef boolean (*psPeerCheckFileDescriptor)(freerdp_peer* client); -typedef boolean (*psPeerClose)(freerdp_peer* client); +typedef BOOL (*psPeerInitialize)(freerdp_peer* client); +typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* client, void** rfds, int* rcount); +typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* client); +typedef BOOL (*psPeerClose)(freerdp_peer* client); typedef void (*psPeerDisconnect)(freerdp_peer* client); -typedef boolean (*psPeerCapabilities)(freerdp_peer* client); -typedef boolean (*psPeerPostConnect)(freerdp_peer* client); -typedef boolean (*psPeerActivate)(freerdp_peer* client); -typedef boolean (*psPeerLogon)(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identity, boolean automatic); +typedef BOOL (*psPeerCapabilities)(freerdp_peer* client); +typedef BOOL (*psPeerPostConnect)(freerdp_peer* client); +typedef BOOL (*psPeerActivate)(freerdp_peer* client); +typedef BOOL (*psPeerLogon)(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identity, BOOL automatic); -typedef int (*psPeerSendChannelData)(freerdp_peer* client, int channelId, uint8* data, int size); -typedef int (*psPeerReceiveChannelData)(freerdp_peer* client, int channelId, uint8* data, int size, int flags, int total_size); +typedef int (*psPeerSendChannelData)(freerdp_peer* client, int channelId, BYTE* data, int size); +typedef int (*psPeerReceiveChannelData)(freerdp_peer* client, int channelId, BYTE* data, int size, int flags, int total_size); struct rdp_freerdp_peer { @@ -72,11 +72,11 @@ struct rdp_freerdp_peer psPeerSendChannelData SendChannelData; psPeerReceiveChannelData ReceiveChannelData; - uint32 ack_frame_id; - boolean local; - boolean connected; - boolean activated; - boolean authenticated; + UINT32 ack_frame_id; + BOOL local; + BOOL connected; + BOOL activated; + BOOL authenticated; SEC_WINNT_AUTH_IDENTITY identity; }; diff --git a/include/freerdp/pointer.h b/include/freerdp/pointer.h index b8170fe06..d1688bd96 100644 --- a/include/freerdp/pointer.h +++ b/include/freerdp/pointer.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Pointer Updates Interface API * * Copyright 2011 Marc-Andre Moreau @@ -33,41 +33,41 @@ struct _POINTER_POSITION_UPDATE { - uint32 xPos; - uint32 yPos; + UINT32 xPos; + UINT32 yPos; }; typedef struct _POINTER_POSITION_UPDATE POINTER_POSITION_UPDATE; struct _POINTER_SYSTEM_UPDATE { - uint32 type; + UINT32 type; }; typedef struct _POINTER_SYSTEM_UPDATE POINTER_SYSTEM_UPDATE; struct _POINTER_COLOR_UPDATE { - uint32 cacheIndex; - uint32 xPos; - uint32 yPos; - uint32 width; - uint32 height; - uint32 lengthAndMask; - uint32 lengthXorMask; - uint8* xorMaskData; - uint8* andMaskData; + UINT32 cacheIndex; + UINT32 xPos; + UINT32 yPos; + UINT32 width; + UINT32 height; + UINT32 lengthAndMask; + UINT32 lengthXorMask; + BYTE* xorMaskData; + BYTE* andMaskData; }; typedef struct _POINTER_COLOR_UPDATE POINTER_COLOR_UPDATE; struct _POINTER_NEW_UPDATE { - uint32 xorBpp; + UINT32 xorBpp; POINTER_COLOR_UPDATE colorPtrAttr; }; typedef struct _POINTER_NEW_UPDATE POINTER_NEW_UPDATE; struct _POINTER_CACHED_UPDATE { - uint32 cacheIndex; + UINT32 cacheIndex; }; typedef struct _POINTER_CACHED_UPDATE POINTER_CACHED_UPDATE; @@ -80,14 +80,14 @@ typedef void (*pPointerCached)(rdpContext* context, POINTER_CACHED_UPDATE* point struct rdp_pointer_update { rdpContext* context; /* 0 */ - uint32 paddingA[16 - 1]; /* 1 */ + UINT32 paddingA[16 - 1]; /* 1 */ pPointerPosition PointerPosition; /* 16 */ pPointerSystem PointerSystem; /* 17 */ pPointerColor PointerColor; /* 18 */ pPointerNew PointerNew; /* 19 */ pPointerCached PointerCached; /* 20 */ - uint32 paddingB[32 - 21]; /* 21 */ + UINT32 paddingB[32 - 21]; /* 21 */ /* internal */ diff --git a/include/freerdp/primary.h b/include/freerdp/primary.h index 903b9319d..ee3f71ab8 100644 --- a/include/freerdp/primary.h +++ b/include/freerdp/primary.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Primary Drawing Orders Interface API * * Copyright 2011 Marc-Andre Moreau @@ -27,391 +27,391 @@ struct rdp_bounds { - sint32 left; - sint32 top; - sint32 right; - sint32 bottom; + INT32 left; + INT32 top; + INT32 right; + INT32 bottom; }; typedef struct rdp_bounds rdpBounds; struct rdp_brush { - uint32 x; - uint32 y; - uint32 bpp; - uint32 style; - uint32 hatch; - uint32 index; - uint8* data; - uint8 p8x8[8]; + UINT32 x; + UINT32 y; + UINT32 bpp; + UINT32 style; + UINT32 hatch; + UINT32 index; + BYTE* data; + BYTE p8x8[8]; }; typedef struct rdp_brush rdpBrush; struct _ORDER_INFO { - uint32 orderType; - uint32 fieldFlags; + UINT32 orderType; + UINT32 fieldFlags; rdpBounds bounds; - sint32 deltaBoundLeft; - sint32 deltaBoundTop; - sint32 deltaBoundRight; - sint32 deltaBoundBottom; - boolean deltaCoordinates; + INT32 deltaBoundLeft; + INT32 deltaBoundTop; + INT32 deltaBoundRight; + INT32 deltaBoundBottom; + BOOL deltaCoordinates; }; typedef struct _ORDER_INFO ORDER_INFO; struct _DSTBLT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; }; typedef struct _DSTBLT_ORDER DSTBLT_ORDER; struct _PATBLT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; - uint32 backColor; - uint32 foreColor; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + UINT32 backColor; + UINT32 foreColor; rdpBrush brush; }; typedef struct _PATBLT_ORDER PATBLT_ORDER; struct _SCRBLT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; - sint32 nXSrc; - sint32 nYSrc; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; }; typedef struct _SCRBLT_ORDER SCRBLT_ORDER; struct _OPAQUE_RECT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 color; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 color; }; typedef struct _OPAQUE_RECT_ORDER OPAQUE_RECT_ORDER; struct _DRAW_NINE_GRID_ORDER { - sint32 srcLeft; - sint32 srcTop; - sint32 srcRight; - sint32 srcBottom; - uint32 bitmapId; + INT32 srcLeft; + INT32 srcTop; + INT32 srcRight; + INT32 srcBottom; + UINT32 bitmapId; }; typedef struct _DRAW_NINE_GRID_ORDER DRAW_NINE_GRID_ORDER; struct _DELTA_RECT { - sint32 left; - sint32 top; - sint32 width; - sint32 height; + INT32 left; + INT32 top; + INT32 width; + INT32 height; }; typedef struct _DELTA_RECT DELTA_RECT; struct _MULTI_DSTBLT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; - uint32 numRectangles; - uint32 cbData; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + UINT32 numRectangles; + UINT32 cbData; DELTA_RECT rectangles[45]; }; typedef struct _MULTI_DSTBLT_ORDER MULTI_DSTBLT_ORDER; struct _MULTI_PATBLT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; - uint32 backColor; - uint32 foreColor; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + UINT32 backColor; + UINT32 foreColor; rdpBrush brush; - uint32 numRectangles; - uint32 cbData; + UINT32 numRectangles; + UINT32 cbData; DELTA_RECT rectangles[45]; }; typedef struct _MULTI_PATBLT_ORDER MULTI_PATBLT_ORDER; struct _MULTI_SCRBLT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; - sint32 nXSrc; - sint32 nYSrc; - uint32 numRectangles; - uint32 cbData; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; + UINT32 numRectangles; + UINT32 cbData; DELTA_RECT rectangles[45]; }; typedef struct _MULTI_SCRBLT_ORDER MULTI_SCRBLT_ORDER; struct _MULTI_OPAQUE_RECT_ORDER { - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 color; - uint32 numRectangles; - uint32 cbData; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 color; + UINT32 numRectangles; + UINT32 cbData; DELTA_RECT rectangles[45]; }; typedef struct _MULTI_OPAQUE_RECT_ORDER MULTI_OPAQUE_RECT_ORDER; struct _MULTI_DRAW_NINE_GRID_ORDER { - sint32 srcLeft; - sint32 srcTop; - sint32 srcRight; - sint32 srcBottom; - uint32 bitmapId; - uint32 nDeltaEntries; - uint32 cbData; - uint8* codeDeltaList; + INT32 srcLeft; + INT32 srcTop; + INT32 srcRight; + INT32 srcBottom; + UINT32 bitmapId; + UINT32 nDeltaEntries; + UINT32 cbData; + BYTE* codeDeltaList; }; typedef struct _MULTI_DRAW_NINE_GRID_ORDER MULTI_DRAW_NINE_GRID_ORDER; struct _LINE_TO_ORDER { - uint32 backMode; - sint32 nXStart; - sint32 nYStart; - sint32 nXEnd; - sint32 nYEnd; - uint32 backColor; - uint32 bRop2; - uint32 penStyle; - uint32 penWidth; - uint32 penColor; + UINT32 backMode; + INT32 nXStart; + INT32 nYStart; + INT32 nXEnd; + INT32 nYEnd; + UINT32 backColor; + UINT32 bRop2; + UINT32 penStyle; + UINT32 penWidth; + UINT32 penColor; }; typedef struct _LINE_TO_ORDER LINE_TO_ORDER; struct _DELTA_POINT { - sint32 x; - sint32 y; + INT32 x; + INT32 y; }; typedef struct _DELTA_POINT DELTA_POINT; struct _POLYLINE_ORDER { - sint32 xStart; - sint32 yStart; - uint32 bRop2; - uint32 penColor; - uint32 numPoints; - uint32 cbData; + INT32 xStart; + INT32 yStart; + UINT32 bRop2; + UINT32 penColor; + UINT32 numPoints; + UINT32 cbData; DELTA_POINT* points; }; typedef struct _POLYLINE_ORDER POLYLINE_ORDER; struct _MEMBLT_ORDER { - uint32 cacheId; - uint32 colorIndex; - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; - sint32 nXSrc; - sint32 nYSrc; - uint32 cacheIndex; + UINT32 cacheId; + UINT32 colorIndex; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; + UINT32 cacheIndex; rdpBitmap* bitmap; }; typedef struct _MEMBLT_ORDER MEMBLT_ORDER; struct _MEM3BLT_ORDER { - uint32 cacheId; - uint32 colorIndex; - sint32 nLeftRect; - sint32 nTopRect; - sint32 nWidth; - sint32 nHeight; - uint32 bRop; - sint32 nXSrc; - sint32 nYSrc; - uint32 backColor; - uint32 foreColor; + UINT32 cacheId; + UINT32 colorIndex; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; + UINT32 backColor; + UINT32 foreColor; rdpBrush brush; - uint32 cacheIndex; + UINT32 cacheIndex; rdpBitmap* bitmap; }; typedef struct _MEM3BLT_ORDER MEM3BLT_ORDER; struct _SAVE_BITMAP_ORDER { - uint32 savedBitmapPosition; - sint32 nLeftRect; - sint32 nTopRect; - sint32 nRightRect; - sint32 nBottomRect; - uint32 operation; + UINT32 savedBitmapPosition; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nRightRect; + INT32 nBottomRect; + UINT32 operation; }; typedef struct _SAVE_BITMAP_ORDER SAVE_BITMAP_ORDER; struct _GLYPH_FRAGMENT_INDEX { - uint32 index; - uint32 delta; + UINT32 index; + UINT32 delta; }; typedef struct _GLYPH_FRAGMENT_INDEX GLYPH_FRAGMENT_INDEX; struct _GLYPH_FRAGMENT { - uint32 operation; - uint32 index; - uint32 size; - uint32 nindices; + UINT32 operation; + UINT32 index; + UINT32 size; + UINT32 nindices; GLYPH_FRAGMENT_INDEX* indices; }; typedef struct _GLYPH_FRAGMENT GLYPH_FRAGMENT; struct _GLYPH_INDEX_ORDER { - uint32 cacheId; - uint32 flAccel; - uint32 ulCharInc; - uint32 fOpRedundant; - uint32 backColor; - uint32 foreColor; - sint32 bkLeft; - sint32 bkTop; - sint32 bkRight; - sint32 bkBottom; - sint32 opLeft; - sint32 opTop; - sint32 opRight; - sint32 opBottom; + UINT32 cacheId; + UINT32 flAccel; + UINT32 ulCharInc; + UINT32 fOpRedundant; + UINT32 backColor; + UINT32 foreColor; + INT32 bkLeft; + INT32 bkTop; + INT32 bkRight; + INT32 bkBottom; + INT32 opLeft; + INT32 opTop; + INT32 opRight; + INT32 opBottom; rdpBrush brush; - sint32 x; - sint32 y; - uint32 cbData; - uint8 data[256]; + INT32 x; + INT32 y; + UINT32 cbData; + BYTE data[256]; }; typedef struct _GLYPH_INDEX_ORDER GLYPH_INDEX_ORDER; struct _FAST_INDEX_ORDER { - uint32 cacheId; - uint32 flAccel; - uint32 ulCharInc; - uint32 backColor; - uint32 foreColor; - sint32 bkLeft; - sint32 bkTop; - sint32 bkRight; - sint32 bkBottom; - sint32 opLeft; - sint32 opTop; - sint32 opRight; - sint32 opBottom; - boolean opaqueRect; - sint32 x; - sint32 y; - uint32 cbData; - uint8 data[256]; + UINT32 cacheId; + UINT32 flAccel; + UINT32 ulCharInc; + UINT32 backColor; + UINT32 foreColor; + INT32 bkLeft; + INT32 bkTop; + INT32 bkRight; + INT32 bkBottom; + INT32 opLeft; + INT32 opTop; + INT32 opRight; + INT32 opBottom; + BOOL opaqueRect; + INT32 x; + INT32 y; + UINT32 cbData; + BYTE data[256]; }; typedef struct _FAST_INDEX_ORDER FAST_INDEX_ORDER; struct _FAST_GLYPH_ORDER { - uint32 cacheId; - uint32 flAccel; - uint32 ulCharInc; - uint32 backColor; - uint32 foreColor; - sint32 bkLeft; - sint32 bkTop; - sint32 bkRight; - sint32 bkBottom; - sint32 opLeft; - sint32 opTop; - sint32 opRight; - sint32 opBottom; - sint32 x; - sint32 y; - uint32 cbData; - uint8 data[256]; + UINT32 cacheId; + UINT32 flAccel; + UINT32 ulCharInc; + UINT32 backColor; + UINT32 foreColor; + INT32 bkLeft; + INT32 bkTop; + INT32 bkRight; + INT32 bkBottom; + INT32 opLeft; + INT32 opTop; + INT32 opRight; + INT32 opBottom; + INT32 x; + INT32 y; + UINT32 cbData; + BYTE data[256]; void* glyph_data; }; typedef struct _FAST_GLYPH_ORDER FAST_GLYPH_ORDER; struct _POLYGON_SC_ORDER { - sint32 xStart; - sint32 yStart; - uint32 bRop2; - uint32 fillMode; - uint32 brushColor; - uint32 numPoints; - uint32 cbData; + INT32 xStart; + INT32 yStart; + UINT32 bRop2; + UINT32 fillMode; + UINT32 brushColor; + UINT32 numPoints; + UINT32 cbData; DELTA_POINT* points; }; typedef struct _POLYGON_SC_ORDER POLYGON_SC_ORDER; struct _POLYGON_CB_ORDER { - sint32 xStart; - sint32 yStart; - uint32 bRop2; - uint32 backMode; - uint32 fillMode; - uint32 backColor; - uint32 foreColor; + INT32 xStart; + INT32 yStart; + UINT32 bRop2; + UINT32 backMode; + UINT32 fillMode; + UINT32 backColor; + UINT32 foreColor; rdpBrush brush; - uint32 numPoints; - uint32 cbData; + UINT32 numPoints; + UINT32 cbData; DELTA_POINT* points; }; typedef struct _POLYGON_CB_ORDER POLYGON_CB_ORDER; struct _ELLIPSE_SC_ORDER { - sint32 leftRect; - sint32 topRect; - sint32 rightRect; - sint32 bottomRect; - uint32 bRop2; - uint32 fillMode; - uint32 color; + INT32 leftRect; + INT32 topRect; + INT32 rightRect; + INT32 bottomRect; + UINT32 bRop2; + UINT32 fillMode; + UINT32 color; }; typedef struct _ELLIPSE_SC_ORDER ELLIPSE_SC_ORDER; struct _ELLIPSE_CB_ORDER { - sint32 leftRect; - sint32 topRect; - sint32 rightRect; - sint32 bottomRect; - uint32 bRop2; - uint32 fillMode; - uint32 backColor; - uint32 foreColor; + INT32 leftRect; + INT32 topRect; + INT32 rightRect; + INT32 bottomRect; + UINT32 bRop2; + UINT32 fillMode; + UINT32 backColor; + UINT32 foreColor; rdpBrush brush; }; typedef struct _ELLIPSE_CB_ORDER ELLIPSE_CB_ORDER; @@ -442,7 +442,7 @@ typedef void (*pEllipseCB)(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb); struct rdp_primary_update { rdpContext* context; /* 0 */ - uint32 paddingA[16 - 1]; /* 1 */ + UINT32 paddingA[16 - 1]; /* 1 */ pDstBlt DstBlt; /* 16 */ pPatBlt PatBlt; /* 17 */ @@ -466,7 +466,7 @@ struct rdp_primary_update pPolygonCB PolygonCB; /* 35 */ pEllipseSC EllipseSC; /* 36 */ pEllipseCB EllipseCB; /* 37 */ - uint32 paddingB[48 - 38]; /* 38 */ + UINT32 paddingB[48 - 38]; /* 38 */ /* internal */ diff --git a/include/freerdp/rail.h b/include/freerdp/rail.h index 6ac2b4c2b..19876a828 100644 --- a/include/freerdp/rail.h +++ b/include/freerdp/rail.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) * * Copyright 2011 Marc-Andre Moreau @@ -152,15 +152,15 @@ enum SPI_MASK struct _RAIL_UNICODE_STRING { - uint16 length; - uint8* string; + UINT16 length; + BYTE* string; }; typedef struct _RAIL_UNICODE_STRING RAIL_UNICODE_STRING; struct _HIGH_CONTRAST { - uint32 flags; - uint32 colorSchemeLength; + UINT32 flags; + UINT32 colorSchemeLength; RAIL_UNICODE_STRING colorScheme; }; typedef struct _HIGH_CONTRAST HIGH_CONTRAST; @@ -169,19 +169,19 @@ typedef struct _HIGH_CONTRAST HIGH_CONTRAST; struct _RAIL_HANDSHAKE_ORDER { - uint32 buildNumber; + UINT32 buildNumber; }; typedef struct _RAIL_HANDSHAKE_ORDER RAIL_HANDSHAKE_ORDER; struct _RAIL_CLIENT_STATUS_ORDER { - uint32 flags; + UINT32 flags; }; typedef struct _RAIL_CLIENT_STATUS_ORDER RAIL_CLIENT_STATUS_ORDER; struct _RAIL_EXEC_ORDER { - uint16 flags; + UINT16 flags; RAIL_UNICODE_STRING exeOrFile; RAIL_UNICODE_STRING workingDir; RAIL_UNICODE_STRING arguments; @@ -190,111 +190,111 @@ typedef struct _RAIL_EXEC_ORDER RAIL_EXEC_ORDER; struct _RAIL_EXEC_RESULT_ORDER { - uint16 flags; - uint16 execResult; - uint32 rawResult; + UINT16 flags; + UINT16 execResult; + UINT32 rawResult; RAIL_UNICODE_STRING exeOrFile; }; typedef struct _RAIL_EXEC_RESULT_ORDER RAIL_EXEC_RESULT_ORDER; struct _RAIL_SYSPARAM_ORDER { - uint32 param; - uint32 params; - boolean dragFullWindows; - boolean keyboardCues; - boolean keyboardPref; - boolean mouseButtonSwap; + UINT32 param; + UINT32 params; + BOOL dragFullWindows; + BOOL keyboardCues; + BOOL keyboardPref; + BOOL mouseButtonSwap; RECTANGLE_16 workArea; RECTANGLE_16 displayChange; RECTANGLE_16 taskbarPos; HIGH_CONTRAST highContrast; - boolean setScreenSaveActive; - boolean setScreenSaveSecure; + BOOL setScreenSaveActive; + BOOL setScreenSaveSecure; }; typedef struct _RAIL_SYSPARAM_ORDER RAIL_SYSPARAM_ORDER; struct _RAIL_ACTIVATE_ORDER { - uint32 windowId; - boolean enabled; + UINT32 windowId; + BOOL enabled; }; typedef struct _RAIL_ACTIVATE_ORDER RAIL_ACTIVATE_ORDER; struct _RAIL_SYSMENU_ORDER { - uint32 windowId; - uint16 left; - uint16 top; + UINT32 windowId; + UINT16 left; + UINT16 top; }; typedef struct _RAIL_SYSMENU_ORDER RAIL_SYSMENU_ORDER; struct _RAIL_SYSCOMMAND_ORDER { - uint32 windowId; - uint16 command; + UINT32 windowId; + UINT16 command; }; typedef struct _RAIL_SYSCOMMAND_ORDER RAIL_SYSCOMMAND_ORDER; struct _RAIL_NOTIFY_EVENT_ORDER { - uint32 windowId; - uint32 notifyIconId; - uint32 message; + UINT32 windowId; + UINT32 notifyIconId; + UINT32 message; }; typedef struct _RAIL_NOTIFY_EVENT_ORDER RAIL_NOTIFY_EVENT_ORDER; struct _RAIL_MINMAXINFO_ORDER { - uint32 windowId; - uint16 maxWidth; - uint16 maxHeight; - uint16 maxPosX; - uint16 maxPosY; - uint16 minTrackWidth; - uint16 minTrackHeight; - uint16 maxTrackWidth; - uint16 maxTrackHeight; + UINT32 windowId; + UINT16 maxWidth; + UINT16 maxHeight; + UINT16 maxPosX; + UINT16 maxPosY; + UINT16 minTrackWidth; + UINT16 minTrackHeight; + UINT16 maxTrackWidth; + UINT16 maxTrackHeight; }; typedef struct _RAIL_MINMAXINFO_ORDER RAIL_MINMAXINFO_ORDER; struct _RAIL_LOCALMOVESIZE_ORDER { - uint32 windowId; - boolean isMoveSizeStart; - uint16 moveSizeType; - uint16 posX; - uint16 posY; + UINT32 windowId; + BOOL isMoveSizeStart; + UINT16 moveSizeType; + UINT16 posX; + UINT16 posY; }; typedef struct _RAIL_LOCALMOVESIZE_ORDER RAIL_LOCALMOVESIZE_ORDER; struct _RAIL_WINDOWMOVE_ORDER { - uint32 windowId; - uint16 left; - uint16 top; - uint16 right; - uint16 bottom; + UINT32 windowId; + UINT16 left; + UINT16 top; + UINT16 right; + UINT16 bottom; }; typedef struct _RAIL_WINDOWMOVE_ORDER RAIL_WINDOW_MOVE_ORDER; struct _RAIL_GET_APPID_REQ_ORDER { - uint32 windowId; + UINT32 windowId; }; typedef struct _RAIL_GET_APPID_REQ_ORDER RAIL_GET_APPID_REQ_ORDER; struct _RAIL_GET_APPID_RESP_ORDER { - uint32 windowId; + UINT32 windowId; RAIL_UNICODE_STRING applicationId; - uint8 applicationIdBuffer[512]; + BYTE applicationIdBuffer[512]; }; typedef struct _RAIL_GET_APPID_RESP_ORDER RAIL_GET_APPID_RESP_ORDER; struct _RAIL_LANGBARINFO_ORDER { - uint32 languageBarStatus; + UINT32 languageBarStatus; }; typedef struct _RAIL_LANGBARINFO_ORDER RAIL_LANGBAR_INFO_ORDER; diff --git a/include/freerdp/rail/icon.h b/include/freerdp/rail/icon.h index 448434be8..e5e91427f 100644 --- a/include/freerdp/rail/icon.h +++ b/include/freerdp/rail/icon.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Window Icon Cache * * Copyright 2011 Marc-Andre Moreau @@ -34,7 +34,7 @@ typedef struct rdp_icon_cache rdpIconCache; struct rdp_icon { ICON_INFO* entry; - boolean big; + BOOL big; void* extra; }; @@ -47,13 +47,13 @@ typedef struct _WINDOW_ICON_CACHE WINDOW_ICON_CACHE; struct rdp_icon_cache { rdpRail* rail; - uint8 numCaches; - uint16 numCacheEntries; + BYTE numCaches; + UINT16 numCacheEntries; WINDOW_ICON_CACHE* caches; }; -ICON_INFO* icon_cache_get(rdpIconCache* cache, uint8 id, uint16 index, void** extra); -void icon_cache_put(rdpIconCache* cache, uint8 id, uint16 index, ICON_INFO* entry, void* extra); +ICON_INFO* icon_cache_get(rdpIconCache* cache, BYTE id, UINT16 index, void** extra); +void icon_cache_put(rdpIconCache* cache, BYTE id, UINT16 index, ICON_INFO* entry, void* extra); rdpIconCache* icon_cache_new(rdpRail* rail); void icon_cache_free(rdpIconCache* cache); diff --git a/include/freerdp/rail/rail.h b/include/freerdp/rail/rail.h index 7ffe15f62..cf5944ec9 100644 --- a/include/freerdp/rail/rail.h +++ b/include/freerdp/rail/rail.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) * * Copyright 2011 Marc-Andre Moreau @@ -35,7 +35,7 @@ typedef void (*railCreateWindow)(rdpRail* rail, rdpWindow* window); typedef void (*railDestroyWindow)(rdpRail* rail, rdpWindow* window); typedef void (*railMoveWindow)(rdpRail* rail, rdpWindow* window); -typedef void (*railShowWindow)(rdpRail* rail, rdpWindow* window, uint8 state); +typedef void (*railShowWindow)(rdpRail* rail, rdpWindow* window, BYTE state); typedef void (*railSetWindowText)(rdpRail* rail, rdpWindow* window); typedef void (*railSetWindowIcon)(rdpRail* rail, rdpWindow* window, rdpIcon* icon); typedef void (*railSetWindowRects)(rdpRail* rail, rdpWindow* window); diff --git a/include/freerdp/rail/window.h b/include/freerdp/rail/window.h index 7f32615b4..21a3befb5 100644 --- a/include/freerdp/rail/window.h +++ b/include/freerdp/rail/window.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RAIL Windows * * Copyright 2011 Marc-Andre Moreau @@ -38,32 +38,32 @@ struct rdp_window char* title; rdpIcon* bigIcon; rdpIcon* smallIcon; - uint32 fieldFlags; + UINT32 fieldFlags; rdpWindow* prev; rdpWindow* next; - uint32 windowId; - uint32 ownerWindowId; - uint32 style; - uint32 extendedStyle; - uint8 showState; + UINT32 windowId; + UINT32 ownerWindowId; + UINT32 style; + UINT32 extendedStyle; + BYTE showState; RAIL_UNICODE_STRING titleInfo; - uint32 clientOffsetX; - uint32 clientOffsetY; - uint32 clientAreaWidth; - uint32 clientAreaHeight; - uint8 RPContent; - uint32 rootParentHandle; - sint32 windowOffsetX; - sint32 windowOffsetY; - uint32 windowClientDeltaX; - uint32 windowClientDeltaY; - uint32 windowWidth; - uint32 windowHeight; - uint16 numWindowRects; + UINT32 clientOffsetX; + UINT32 clientOffsetY; + UINT32 clientAreaWidth; + UINT32 clientAreaHeight; + BYTE RPContent; + UINT32 rootParentHandle; + INT32 windowOffsetX; + INT32 windowOffsetY; + UINT32 windowClientDeltaX; + UINT32 windowClientDeltaY; + UINT32 windowWidth; + UINT32 windowHeight; + UINT16 numWindowRects; RECTANGLE_16* windowRects; - uint32 visibleOffsetX; - uint32 visibleOffsetY; - uint16 numVisibilityRects; + UINT32 visibleOffsetX; + UINT32 visibleOffsetY; + UINT16 numVisibilityRects; RECTANGLE_16* visibilityRects; }; diff --git a/include/freerdp/rail/window_list.h b/include/freerdp/rail/window_list.h index 57da47c11..89b89016c 100644 --- a/include/freerdp/rail/window_list.h +++ b/include/freerdp/rail/window_list.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RAIL Window List * * Copyright 2011 Marc-Andre Moreau @@ -39,10 +39,10 @@ struct rdp_window_list }; FREERDP_API void window_list_rewind(rdpWindowList* list); -FREERDP_API boolean window_list_has_next(rdpWindowList* list); +FREERDP_API BOOL window_list_has_next(rdpWindowList* list); FREERDP_API rdpWindow* window_list_get_next(rdpWindowList* list); -FREERDP_API rdpWindow* window_list_get_by_id(rdpWindowList* list, uint32 windowId); +FREERDP_API rdpWindow* window_list_get_by_id(rdpWindowList* list, UINT32 windowId); FREERDP_API rdpWindow* window_list_get_by_extra_id(rdpWindowList* list, void* extraId); FREERDP_API void window_list_create(rdpWindowList* list, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state); diff --git a/include/freerdp/scancode.h b/include/freerdp/scancode.h index 6da0bfe21..2cad570ed 100644 --- a/include/freerdp/scancode.h +++ b/include/freerdp/scancode.h @@ -27,159 +27,159 @@ * The extended flag is for all practical an important 9th bit with a strange encoding - not just a modifier. */ -typedef uint32 RDP_SCANCODE; /* Our own representation of a RDP protocol scancode */ -#define RDP_SCANCODE_CODE(_rdp_scancode) ((uint8)(_rdp_scancode & 0xFF)) -#define RDP_SCANCODE_EXTENDED(_rdp_scancode) (((_rdp_scancode) & 0x100) ? true : false) +typedef UINT32 RDP_SCANCODE; /* Our own representation of a RDP protocol scancode */ +#define RDP_SCANCODE_CODE(_rdp_scancode) ((BYTE)(_rdp_scancode & 0xFF)) +#define RDP_SCANCODE_EXTENDED(_rdp_scancode) (((_rdp_scancode) & 0x100) ? TRUE : FALSE) #define MAKE_RDP_SCANCODE(_code, _extended) (((_code) & 0xFF) | ((_extended) ? 0x100 : 0)) /* Defines for known RDP_SCANCODE protocol values. * Mostly the same as the PKBDLLHOOKSTRUCT scanCode, "A hardware scan code for the key", @msdn{ms644967}. * Based @msdn{ms894073} US, @msdn{ms894072} UK, @msdn{ms892472} */ -#define RDP_SCANCODE_UNKNOWN MAKE_RDP_SCANCODE(0x00, false) +#define RDP_SCANCODE_UNKNOWN MAKE_RDP_SCANCODE(0x00, FALSE) -#define RDP_SCANCODE_ESCAPE MAKE_RDP_SCANCODE(0x01, false) /* VK_ESCAPE */ -#define RDP_SCANCODE_KEY_1 MAKE_RDP_SCANCODE(0x02, false) /* VK_KEY_1 */ -#define RDP_SCANCODE_KEY_2 MAKE_RDP_SCANCODE(0x03, false) /* VK_KEY_2 */ -#define RDP_SCANCODE_KEY_3 MAKE_RDP_SCANCODE(0x04, false) /* VK_KEY_3 */ -#define RDP_SCANCODE_KEY_4 MAKE_RDP_SCANCODE(0x05, false) /* VK_KEY_4 */ -#define RDP_SCANCODE_KEY_5 MAKE_RDP_SCANCODE(0x06, false) /* VK_KEY_5 */ -#define RDP_SCANCODE_KEY_6 MAKE_RDP_SCANCODE(0x07, false) /* VK_KEY_6 */ -#define RDP_SCANCODE_KEY_7 MAKE_RDP_SCANCODE(0x08, false) /* VK_KEY_7 */ -#define RDP_SCANCODE_KEY_8 MAKE_RDP_SCANCODE(0x09, false) /* VK_KEY_8 */ -#define RDP_SCANCODE_KEY_9 MAKE_RDP_SCANCODE(0x0A, false) /* VK_KEY_9 */ -#define RDP_SCANCODE_KEY_0 MAKE_RDP_SCANCODE(0x0B, false) /* VK_KEY_0 */ -#define RDP_SCANCODE_OEM_MINUS MAKE_RDP_SCANCODE(0x0C, false) /* VK_OEM_MINUS */ -#define RDP_SCANCODE_OEM_PLUS MAKE_RDP_SCANCODE(0x0D, false) /* VK_OEM_PLUS */ -#define RDP_SCANCODE_BACKSPACE MAKE_RDP_SCANCODE(0x0E, false) /* VK_BACK Backspace */ -#define RDP_SCANCODE_TAB MAKE_RDP_SCANCODE(0x0F, false) /* VK_TAB */ -#define RDP_SCANCODE_KEY_Q MAKE_RDP_SCANCODE(0x10, false) /* VK_KEY_Q */ -#define RDP_SCANCODE_KEY_W MAKE_RDP_SCANCODE(0x11, false) /* VK_KEY_W */ -#define RDP_SCANCODE_KEY_E MAKE_RDP_SCANCODE(0x12, false) /* VK_KEY_E */ -#define RDP_SCANCODE_KEY_R MAKE_RDP_SCANCODE(0x13, false) /* VK_KEY_R */ -#define RDP_SCANCODE_KEY_T MAKE_RDP_SCANCODE(0x14, false) /* VK_KEY_T */ -#define RDP_SCANCODE_KEY_Y MAKE_RDP_SCANCODE(0x15, false) /* VK_KEY_Y */ -#define RDP_SCANCODE_KEY_U MAKE_RDP_SCANCODE(0x16, false) /* VK_KEY_U */ -#define RDP_SCANCODE_KEY_I MAKE_RDP_SCANCODE(0x17, false) /* VK_KEY_I */ -#define RDP_SCANCODE_KEY_O MAKE_RDP_SCANCODE(0x18, false) /* VK_KEY_O */ -#define RDP_SCANCODE_KEY_P MAKE_RDP_SCANCODE(0x19, false) /* VK_KEY_P */ -#define RDP_SCANCODE_OEM_4 MAKE_RDP_SCANCODE(0x1A, false) /* VK_OEM_4 '[' on US */ -#define RDP_SCANCODE_OEM_6 MAKE_RDP_SCANCODE(0x1B, false) /* VK_OEM_6 ']' on US */ -#define RDP_SCANCODE_RETURN MAKE_RDP_SCANCODE(0x1C, false) /* VK_RETURN Normal Enter */ -#define RDP_SCANCODE_LCONTROL MAKE_RDP_SCANCODE(0x1D, false) /* VK_LCONTROL */ -#define RDP_SCANCODE_KEY_A MAKE_RDP_SCANCODE(0x1E, false) /* VK_KEY_A */ -#define RDP_SCANCODE_KEY_S MAKE_RDP_SCANCODE(0x1F, false) /* VK_KEY_S */ -#define RDP_SCANCODE_KEY_D MAKE_RDP_SCANCODE(0x20, false) /* VK_KEY_D */ -#define RDP_SCANCODE_KEY_F MAKE_RDP_SCANCODE(0x21, false) /* VK_KEY_F */ -#define RDP_SCANCODE_KEY_G MAKE_RDP_SCANCODE(0x22, false) /* VK_KEY_G */ -#define RDP_SCANCODE_KEY_H MAKE_RDP_SCANCODE(0x23, false) /* VK_KEY_H */ -#define RDP_SCANCODE_KEY_J MAKE_RDP_SCANCODE(0x24, false) /* VK_KEY_J */ -#define RDP_SCANCODE_KEY_K MAKE_RDP_SCANCODE(0x25, false) /* VK_KEY_K */ -#define RDP_SCANCODE_KEY_L MAKE_RDP_SCANCODE(0x26, false) /* VK_KEY_L */ -#define RDP_SCANCODE_OEM_1 MAKE_RDP_SCANCODE(0x27, false) /* VK_OEM_1 ';' on US */ -#define RDP_SCANCODE_OEM_7 MAKE_RDP_SCANCODE(0x28, false) /* VK_OEM_7 "'" on US */ -#define RDP_SCANCODE_OEM_3 MAKE_RDP_SCANCODE(0x29, false) /* VK_OEM_3 Top left, '`' on US, JP DBE_SBCSCHAR */ -#define RDP_SCANCODE_LSHIFT MAKE_RDP_SCANCODE(0x2A, false) /* VK_LSHIFT */ -#define RDP_SCANCODE_OEM_5 MAKE_RDP_SCANCODE(0x2B, false) /* VK_OEM_5 Next to Enter, '\' on US */ -#define RDP_SCANCODE_KEY_Z MAKE_RDP_SCANCODE(0x2C, false) /* VK_KEY_Z */ -#define RDP_SCANCODE_KEY_X MAKE_RDP_SCANCODE(0x2D, false) /* VK_KEY_X */ -#define RDP_SCANCODE_KEY_C MAKE_RDP_SCANCODE(0x2E, false) /* VK_KEY_C */ -#define RDP_SCANCODE_KEY_V MAKE_RDP_SCANCODE(0x2F, false) /* VK_KEY_V */ -#define RDP_SCANCODE_KEY_B MAKE_RDP_SCANCODE(0x30, false) /* VK_KEY_B */ -#define RDP_SCANCODE_KEY_N MAKE_RDP_SCANCODE(0x31, false) /* VK_KEY_N */ -#define RDP_SCANCODE_KEY_M MAKE_RDP_SCANCODE(0x32, false) /* VK_KEY_M */ -#define RDP_SCANCODE_OEM_COMMA MAKE_RDP_SCANCODE(0x33, false) /* VK_OEM_COMMA */ -#define RDP_SCANCODE_OEM_PERIOD MAKE_RDP_SCANCODE(0x34, false) /* VK_OEM_PERIOD */ -#define RDP_SCANCODE_OEM_2 MAKE_RDP_SCANCODE(0x35, false) /* VK_OEM_2 '/' on US */ -#define RDP_SCANCODE_RSHIFT MAKE_RDP_SCANCODE(0x36, false) /* VK_RSHIFT */ -#define RDP_SCANCODE_MULTIPLY MAKE_RDP_SCANCODE(0x37, false) /* VK_MULTIPLY Numerical */ -#define RDP_SCANCODE_LMENU MAKE_RDP_SCANCODE(0x38, false) /* VK_LMENU Left 'Alt' key */ -#define RDP_SCANCODE_SPACE MAKE_RDP_SCANCODE(0x39, false) /* VK_SPACE */ -#define RDP_SCANCODE_CAPSLOCK MAKE_RDP_SCANCODE(0x3A, false) /* VK_CAPITAL 'Caps Lock', JP DBE_ALPHANUMERIC */ -#define RDP_SCANCODE_F1 MAKE_RDP_SCANCODE(0x3B, false) /* VK_F1 */ -#define RDP_SCANCODE_F2 MAKE_RDP_SCANCODE(0x3C, false) /* VK_F2 */ -#define RDP_SCANCODE_F3 MAKE_RDP_SCANCODE(0x3D, false) /* VK_F3 */ -#define RDP_SCANCODE_F4 MAKE_RDP_SCANCODE(0x3E, false) /* VK_F4 */ -#define RDP_SCANCODE_F5 MAKE_RDP_SCANCODE(0x3F, false) /* VK_F5 */ -#define RDP_SCANCODE_F6 MAKE_RDP_SCANCODE(0x40, false) /* VK_F6 */ -#define RDP_SCANCODE_F7 MAKE_RDP_SCANCODE(0x41, false) /* VK_F7 */ -#define RDP_SCANCODE_F8 MAKE_RDP_SCANCODE(0x42, false) /* VK_F8 */ -#define RDP_SCANCODE_F9 MAKE_RDP_SCANCODE(0x43, false) /* VK_F9 */ -#define RDP_SCANCODE_F10 MAKE_RDP_SCANCODE(0x44, false) /* VK_F10 */ -#define RDP_SCANCODE_NUMLOCK MAKE_RDP_SCANCODE(0x45, false) /* VK_NUMLOCK */ /* Note: when this seems to appear in PKBDLLHOOKSTRUCT it means Pause which must be sent as Ctrl + NumLock */ -#define RDP_SCANCODE_SCROLLLOCK MAKE_RDP_SCANCODE(0x46, false) /* VK_SCROLL 'Scroll Lock', JP OEM_SCROLL */ -#define RDP_SCANCODE_NUMPAD7 MAKE_RDP_SCANCODE(0x47, false) /* VK_NUMPAD7 */ -#define RDP_SCANCODE_NUMPAD8 MAKE_RDP_SCANCODE(0x48, false) /* VK_NUMPAD8 */ -#define RDP_SCANCODE_NUMPAD9 MAKE_RDP_SCANCODE(0x49, false) /* VK_NUMPAD9 */ -#define RDP_SCANCODE_SUBTRACT MAKE_RDP_SCANCODE(0x4A, false) /* VK_SUBTRACT */ -#define RDP_SCANCODE_NUMPAD4 MAKE_RDP_SCANCODE(0x4B, false) /* VK_NUMPAD4 */ -#define RDP_SCANCODE_NUMPAD5 MAKE_RDP_SCANCODE(0x4C, false) /* VK_NUMPAD5 */ -#define RDP_SCANCODE_NUMPAD6 MAKE_RDP_SCANCODE(0x4D, false) /* VK_NUMPAD6 */ -#define RDP_SCANCODE_ADD MAKE_RDP_SCANCODE(0x4E, false) /* VK_ADD */ -#define RDP_SCANCODE_NUMPAD1 MAKE_RDP_SCANCODE(0x4F, false) /* VK_NUMPAD1 */ -#define RDP_SCANCODE_NUMPAD2 MAKE_RDP_SCANCODE(0x50, false) /* VK_NUMPAD2 */ -#define RDP_SCANCODE_NUMPAD3 MAKE_RDP_SCANCODE(0x51, false) /* VK_NUMPAD3 */ -#define RDP_SCANCODE_NUMPAD0 MAKE_RDP_SCANCODE(0x52, false) /* VK_NUMPAD0 */ -#define RDP_SCANCODE_DECIMAL MAKE_RDP_SCANCODE(0x53, false) /* VK_DECIMAL Numerical, '.' on US */ -#define RDP_SCANCODE_SYSREQ MAKE_RDP_SCANCODE(0x54, false) /* Sys Req */ -#define RDP_SCANCODE_OEM_102 MAKE_RDP_SCANCODE(0x56, false) /* VK_OEM_102 Lower left '\' on US */ -#define RDP_SCANCODE_F11 MAKE_RDP_SCANCODE(0x57, false) /* VK_F11 */ -#define RDP_SCANCODE_F12 MAKE_RDP_SCANCODE(0x58, false) /* VK_F12 */ -#define RDP_SCANCODE_SLEEP MAKE_RDP_SCANCODE(0x5F, false) /* VK_SLEEP OEM_8 on FR (undocumented?) */ -#define RDP_SCANCODE_ZOOM MAKE_RDP_SCANCODE(0x62, false) /* VK_ZOOM (undocumented?) */ -#define RDP_SCANCODE_HELP MAKE_RDP_SCANCODE(0x63, false) /* VK_HELP (undocumented?) */ +#define RDP_SCANCODE_ESCAPE MAKE_RDP_SCANCODE(0x01, FALSE) /* VK_ESCAPE */ +#define RDP_SCANCODE_KEY_1 MAKE_RDP_SCANCODE(0x02, FALSE) /* VK_KEY_1 */ +#define RDP_SCANCODE_KEY_2 MAKE_RDP_SCANCODE(0x03, FALSE) /* VK_KEY_2 */ +#define RDP_SCANCODE_KEY_3 MAKE_RDP_SCANCODE(0x04, FALSE) /* VK_KEY_3 */ +#define RDP_SCANCODE_KEY_4 MAKE_RDP_SCANCODE(0x05, FALSE) /* VK_KEY_4 */ +#define RDP_SCANCODE_KEY_5 MAKE_RDP_SCANCODE(0x06, FALSE) /* VK_KEY_5 */ +#define RDP_SCANCODE_KEY_6 MAKE_RDP_SCANCODE(0x07, FALSE) /* VK_KEY_6 */ +#define RDP_SCANCODE_KEY_7 MAKE_RDP_SCANCODE(0x08, FALSE) /* VK_KEY_7 */ +#define RDP_SCANCODE_KEY_8 MAKE_RDP_SCANCODE(0x09, FALSE) /* VK_KEY_8 */ +#define RDP_SCANCODE_KEY_9 MAKE_RDP_SCANCODE(0x0A, FALSE) /* VK_KEY_9 */ +#define RDP_SCANCODE_KEY_0 MAKE_RDP_SCANCODE(0x0B, FALSE) /* VK_KEY_0 */ +#define RDP_SCANCODE_OEM_MINUS MAKE_RDP_SCANCODE(0x0C, FALSE) /* VK_OEM_MINUS */ +#define RDP_SCANCODE_OEM_PLUS MAKE_RDP_SCANCODE(0x0D, FALSE) /* VK_OEM_PLUS */ +#define RDP_SCANCODE_BACKSPACE MAKE_RDP_SCANCODE(0x0E, FALSE) /* VK_BACK Backspace */ +#define RDP_SCANCODE_TAB MAKE_RDP_SCANCODE(0x0F, FALSE) /* VK_TAB */ +#define RDP_SCANCODE_KEY_Q MAKE_RDP_SCANCODE(0x10, FALSE) /* VK_KEY_Q */ +#define RDP_SCANCODE_KEY_W MAKE_RDP_SCANCODE(0x11, FALSE) /* VK_KEY_W */ +#define RDP_SCANCODE_KEY_E MAKE_RDP_SCANCODE(0x12, FALSE) /* VK_KEY_E */ +#define RDP_SCANCODE_KEY_R MAKE_RDP_SCANCODE(0x13, FALSE) /* VK_KEY_R */ +#define RDP_SCANCODE_KEY_T MAKE_RDP_SCANCODE(0x14, FALSE) /* VK_KEY_T */ +#define RDP_SCANCODE_KEY_Y MAKE_RDP_SCANCODE(0x15, FALSE) /* VK_KEY_Y */ +#define RDP_SCANCODE_KEY_U MAKE_RDP_SCANCODE(0x16, FALSE) /* VK_KEY_U */ +#define RDP_SCANCODE_KEY_I MAKE_RDP_SCANCODE(0x17, FALSE) /* VK_KEY_I */ +#define RDP_SCANCODE_KEY_O MAKE_RDP_SCANCODE(0x18, FALSE) /* VK_KEY_O */ +#define RDP_SCANCODE_KEY_P MAKE_RDP_SCANCODE(0x19, FALSE) /* VK_KEY_P */ +#define RDP_SCANCODE_OEM_4 MAKE_RDP_SCANCODE(0x1A, FALSE) /* VK_OEM_4 '[' on US */ +#define RDP_SCANCODE_OEM_6 MAKE_RDP_SCANCODE(0x1B, FALSE) /* VK_OEM_6 ']' on US */ +#define RDP_SCANCODE_RETURN MAKE_RDP_SCANCODE(0x1C, FALSE) /* VK_RETURN Normal Enter */ +#define RDP_SCANCODE_LCONTROL MAKE_RDP_SCANCODE(0x1D, FALSE) /* VK_LCONTROL */ +#define RDP_SCANCODE_KEY_A MAKE_RDP_SCANCODE(0x1E, FALSE) /* VK_KEY_A */ +#define RDP_SCANCODE_KEY_S MAKE_RDP_SCANCODE(0x1F, FALSE) /* VK_KEY_S */ +#define RDP_SCANCODE_KEY_D MAKE_RDP_SCANCODE(0x20, FALSE) /* VK_KEY_D */ +#define RDP_SCANCODE_KEY_F MAKE_RDP_SCANCODE(0x21, FALSE) /* VK_KEY_F */ +#define RDP_SCANCODE_KEY_G MAKE_RDP_SCANCODE(0x22, FALSE) /* VK_KEY_G */ +#define RDP_SCANCODE_KEY_H MAKE_RDP_SCANCODE(0x23, FALSE) /* VK_KEY_H */ +#define RDP_SCANCODE_KEY_J MAKE_RDP_SCANCODE(0x24, FALSE) /* VK_KEY_J */ +#define RDP_SCANCODE_KEY_K MAKE_RDP_SCANCODE(0x25, FALSE) /* VK_KEY_K */ +#define RDP_SCANCODE_KEY_L MAKE_RDP_SCANCODE(0x26, FALSE) /* VK_KEY_L */ +#define RDP_SCANCODE_OEM_1 MAKE_RDP_SCANCODE(0x27, FALSE) /* VK_OEM_1 ';' on US */ +#define RDP_SCANCODE_OEM_7 MAKE_RDP_SCANCODE(0x28, FALSE) /* VK_OEM_7 "'" on US */ +#define RDP_SCANCODE_OEM_3 MAKE_RDP_SCANCODE(0x29, FALSE) /* VK_OEM_3 Top left, '`' on US, JP DBE_SBCSCHAR */ +#define RDP_SCANCODE_LSHIFT MAKE_RDP_SCANCODE(0x2A, FALSE) /* VK_LSHIFT */ +#define RDP_SCANCODE_OEM_5 MAKE_RDP_SCANCODE(0x2B, FALSE) /* VK_OEM_5 Next to Enter, '\' on US */ +#define RDP_SCANCODE_KEY_Z MAKE_RDP_SCANCODE(0x2C, FALSE) /* VK_KEY_Z */ +#define RDP_SCANCODE_KEY_X MAKE_RDP_SCANCODE(0x2D, FALSE) /* VK_KEY_X */ +#define RDP_SCANCODE_KEY_C MAKE_RDP_SCANCODE(0x2E, FALSE) /* VK_KEY_C */ +#define RDP_SCANCODE_KEY_V MAKE_RDP_SCANCODE(0x2F, FALSE) /* VK_KEY_V */ +#define RDP_SCANCODE_KEY_B MAKE_RDP_SCANCODE(0x30, FALSE) /* VK_KEY_B */ +#define RDP_SCANCODE_KEY_N MAKE_RDP_SCANCODE(0x31, FALSE) /* VK_KEY_N */ +#define RDP_SCANCODE_KEY_M MAKE_RDP_SCANCODE(0x32, FALSE) /* VK_KEY_M */ +#define RDP_SCANCODE_OEM_COMMA MAKE_RDP_SCANCODE(0x33, FALSE) /* VK_OEM_COMMA */ +#define RDP_SCANCODE_OEM_PERIOD MAKE_RDP_SCANCODE(0x34, FALSE) /* VK_OEM_PERIOD */ +#define RDP_SCANCODE_OEM_2 MAKE_RDP_SCANCODE(0x35, FALSE) /* VK_OEM_2 '/' on US */ +#define RDP_SCANCODE_RSHIFT MAKE_RDP_SCANCODE(0x36, FALSE) /* VK_RSHIFT */ +#define RDP_SCANCODE_MULTIPLY MAKE_RDP_SCANCODE(0x37, FALSE) /* VK_MULTIPLY Numerical */ +#define RDP_SCANCODE_LMENU MAKE_RDP_SCANCODE(0x38, FALSE) /* VK_LMENU Left 'Alt' key */ +#define RDP_SCANCODE_SPACE MAKE_RDP_SCANCODE(0x39, FALSE) /* VK_SPACE */ +#define RDP_SCANCODE_CAPSLOCK MAKE_RDP_SCANCODE(0x3A, FALSE) /* VK_CAPITAL 'Caps Lock', JP DBE_ALPHANUMERIC */ +#define RDP_SCANCODE_F1 MAKE_RDP_SCANCODE(0x3B, FALSE) /* VK_F1 */ +#define RDP_SCANCODE_F2 MAKE_RDP_SCANCODE(0x3C, FALSE) /* VK_F2 */ +#define RDP_SCANCODE_F3 MAKE_RDP_SCANCODE(0x3D, FALSE) /* VK_F3 */ +#define RDP_SCANCODE_F4 MAKE_RDP_SCANCODE(0x3E, FALSE) /* VK_F4 */ +#define RDP_SCANCODE_F5 MAKE_RDP_SCANCODE(0x3F, FALSE) /* VK_F5 */ +#define RDP_SCANCODE_F6 MAKE_RDP_SCANCODE(0x40, FALSE) /* VK_F6 */ +#define RDP_SCANCODE_F7 MAKE_RDP_SCANCODE(0x41, FALSE) /* VK_F7 */ +#define RDP_SCANCODE_F8 MAKE_RDP_SCANCODE(0x42, FALSE) /* VK_F8 */ +#define RDP_SCANCODE_F9 MAKE_RDP_SCANCODE(0x43, FALSE) /* VK_F9 */ +#define RDP_SCANCODE_F10 MAKE_RDP_SCANCODE(0x44, FALSE) /* VK_F10 */ +#define RDP_SCANCODE_NUMLOCK MAKE_RDP_SCANCODE(0x45, FALSE) /* VK_NUMLOCK */ /* Note: when this seems to appear in PKBDLLHOOKSTRUCT it means Pause which must be sent as Ctrl + NumLock */ +#define RDP_SCANCODE_SCROLLLOCK MAKE_RDP_SCANCODE(0x46, FALSE) /* VK_SCROLL 'Scroll Lock', JP OEM_SCROLL */ +#define RDP_SCANCODE_NUMPAD7 MAKE_RDP_SCANCODE(0x47, FALSE) /* VK_NUMPAD7 */ +#define RDP_SCANCODE_NUMPAD8 MAKE_RDP_SCANCODE(0x48, FALSE) /* VK_NUMPAD8 */ +#define RDP_SCANCODE_NUMPAD9 MAKE_RDP_SCANCODE(0x49, FALSE) /* VK_NUMPAD9 */ +#define RDP_SCANCODE_SUBTRACT MAKE_RDP_SCANCODE(0x4A, FALSE) /* VK_SUBTRACT */ +#define RDP_SCANCODE_NUMPAD4 MAKE_RDP_SCANCODE(0x4B, FALSE) /* VK_NUMPAD4 */ +#define RDP_SCANCODE_NUMPAD5 MAKE_RDP_SCANCODE(0x4C, FALSE) /* VK_NUMPAD5 */ +#define RDP_SCANCODE_NUMPAD6 MAKE_RDP_SCANCODE(0x4D, FALSE) /* VK_NUMPAD6 */ +#define RDP_SCANCODE_ADD MAKE_RDP_SCANCODE(0x4E, FALSE) /* VK_ADD */ +#define RDP_SCANCODE_NUMPAD1 MAKE_RDP_SCANCODE(0x4F, FALSE) /* VK_NUMPAD1 */ +#define RDP_SCANCODE_NUMPAD2 MAKE_RDP_SCANCODE(0x50, FALSE) /* VK_NUMPAD2 */ +#define RDP_SCANCODE_NUMPAD3 MAKE_RDP_SCANCODE(0x51, FALSE) /* VK_NUMPAD3 */ +#define RDP_SCANCODE_NUMPAD0 MAKE_RDP_SCANCODE(0x52, FALSE) /* VK_NUMPAD0 */ +#define RDP_SCANCODE_DECIMAL MAKE_RDP_SCANCODE(0x53, FALSE) /* VK_DECIMAL Numerical, '.' on US */ +#define RDP_SCANCODE_SYSREQ MAKE_RDP_SCANCODE(0x54, FALSE) /* Sys Req */ +#define RDP_SCANCODE_OEM_102 MAKE_RDP_SCANCODE(0x56, FALSE) /* VK_OEM_102 Lower left '\' on US */ +#define RDP_SCANCODE_F11 MAKE_RDP_SCANCODE(0x57, FALSE) /* VK_F11 */ +#define RDP_SCANCODE_F12 MAKE_RDP_SCANCODE(0x58, FALSE) /* VK_F12 */ +#define RDP_SCANCODE_SLEEP MAKE_RDP_SCANCODE(0x5F, FALSE) /* VK_SLEEP OEM_8 on FR (undocumented?) */ +#define RDP_SCANCODE_ZOOM MAKE_RDP_SCANCODE(0x62, FALSE) /* VK_ZOOM (undocumented?) */ +#define RDP_SCANCODE_HELP MAKE_RDP_SCANCODE(0x63, FALSE) /* VK_HELP (undocumented?) */ -#define RDP_SCANCODE_F13 MAKE_RDP_SCANCODE(0x64, false) /* VK_F13 */ /* JP agree, should 0x7d according to ms894073 */ -#define RDP_SCANCODE_F14 MAKE_RDP_SCANCODE(0x65, false) /* VK_F14 */ -#define RDP_SCANCODE_F15 MAKE_RDP_SCANCODE(0x66, false) /* VK_F15 */ -#define RDP_SCANCODE_F16 MAKE_RDP_SCANCODE(0x67, false) /* VK_F16 */ -#define RDP_SCANCODE_F17 MAKE_RDP_SCANCODE(0x68, false) /* VK_F17 */ -#define RDP_SCANCODE_F18 MAKE_RDP_SCANCODE(0x69, false) /* VK_F18 */ -#define RDP_SCANCODE_F19 MAKE_RDP_SCANCODE(0x6A, false) /* VK_F19 */ -#define RDP_SCANCODE_F20 MAKE_RDP_SCANCODE(0x6B, false) /* VK_F20 */ -#define RDP_SCANCODE_F21 MAKE_RDP_SCANCODE(0x6C, false) /* VK_F21 */ -#define RDP_SCANCODE_F22 MAKE_RDP_SCANCODE(0x6D, false) /* VK_F22 */ -#define RDP_SCANCODE_F23 MAKE_RDP_SCANCODE(0x6E, false) /* VK_F23 */ /* JP agree */ -#define RDP_SCANCODE_F24 MAKE_RDP_SCANCODE(0x6F, false) /* VK_F24 */ /* 0x87 according to ms894073 */ +#define RDP_SCANCODE_F13 MAKE_RDP_SCANCODE(0x64, FALSE) /* VK_F13 */ /* JP agree, should 0x7d according to ms894073 */ +#define RDP_SCANCODE_F14 MAKE_RDP_SCANCODE(0x65, FALSE) /* VK_F14 */ +#define RDP_SCANCODE_F15 MAKE_RDP_SCANCODE(0x66, FALSE) /* VK_F15 */ +#define RDP_SCANCODE_F16 MAKE_RDP_SCANCODE(0x67, FALSE) /* VK_F16 */ +#define RDP_SCANCODE_F17 MAKE_RDP_SCANCODE(0x68, FALSE) /* VK_F17 */ +#define RDP_SCANCODE_F18 MAKE_RDP_SCANCODE(0x69, FALSE) /* VK_F18 */ +#define RDP_SCANCODE_F19 MAKE_RDP_SCANCODE(0x6A, FALSE) /* VK_F19 */ +#define RDP_SCANCODE_F20 MAKE_RDP_SCANCODE(0x6B, FALSE) /* VK_F20 */ +#define RDP_SCANCODE_F21 MAKE_RDP_SCANCODE(0x6C, FALSE) /* VK_F21 */ +#define RDP_SCANCODE_F22 MAKE_RDP_SCANCODE(0x6D, FALSE) /* VK_F22 */ +#define RDP_SCANCODE_F23 MAKE_RDP_SCANCODE(0x6E, FALSE) /* VK_F23 */ /* JP agree */ +#define RDP_SCANCODE_F24 MAKE_RDP_SCANCODE(0x6F, FALSE) /* VK_F24 */ /* 0x87 according to ms894073 */ -#define RDP_SCANCODE_HIRAGANA MAKE_RDP_SCANCODE(0x70, false) /* JP DBE_HIRAGANA */ -#define RDP_SCANCODE_HANJA_KANJI MAKE_RDP_SCANCODE(0x71, false) /* VK_HANJA / VK_KANJI (undocumented?) */ -#define RDP_SCANCODE_KANA_HANGUL MAKE_RDP_SCANCODE(0x72, false) /* VK_KANA / VK_HANGUL (undocumented?) */ -#define RDP_SCANCODE_ABNT_C1 MAKE_RDP_SCANCODE(0x73, false) /* VK_ABNT_C1 JP OEM_102 */ -#define RDP_SCANCODE_F24_JP MAKE_RDP_SCANCODE(0x76, false) /* JP F24 */ -#define RDP_SCANCODE_CONVERT_JP MAKE_RDP_SCANCODE(0x79, false) /* JP CONVERT */ -#define RDP_SCANCODE_NONCONVERT_JP MAKE_RDP_SCANCODE(0x7B, false) /* JP NONCONVERT */ -#define RDP_SCANCODE_TAB_JP MAKE_RDP_SCANCODE(0x7C, false) /* JP TAB */ -#define RDP_SCANCODE_BACKSLASH_JP MAKE_RDP_SCANCODE(0x7D, false) /* JP OEM_5 ('\') */ -#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, false) /* VK_ABNT_C2, JP */ -#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, false) /* JP OEM_PA2 */ +#define RDP_SCANCODE_HIRAGANA MAKE_RDP_SCANCODE(0x70, FALSE) /* JP DBE_HIRAGANA */ +#define RDP_SCANCODE_HANJA_KANJI MAKE_RDP_SCANCODE(0x71, FALSE) /* VK_HANJA / VK_KANJI (undocumented?) */ +#define RDP_SCANCODE_KANA_HANGUL MAKE_RDP_SCANCODE(0x72, FALSE) /* VK_KANA / VK_HANGUL (undocumented?) */ +#define RDP_SCANCODE_ABNT_C1 MAKE_RDP_SCANCODE(0x73, FALSE) /* VK_ABNT_C1 JP OEM_102 */ +#define RDP_SCANCODE_F24_JP MAKE_RDP_SCANCODE(0x76, FALSE) /* JP F24 */ +#define RDP_SCANCODE_CONVERT_JP MAKE_RDP_SCANCODE(0x79, FALSE) /* JP CONVERT */ +#define RDP_SCANCODE_NONCONVERT_JP MAKE_RDP_SCANCODE(0x7B, FALSE) /* JP NONCONVERT */ +#define RDP_SCANCODE_TAB_JP MAKE_RDP_SCANCODE(0x7C, FALSE) /* JP TAB */ +#define RDP_SCANCODE_BACKSLASH_JP MAKE_RDP_SCANCODE(0x7D, FALSE) /* JP OEM_5 ('\') */ +#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, FALSE) /* VK_ABNT_C2, JP */ +#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, FALSE) /* JP OEM_PA2 */ -#define RDP_SCANCODE_RETURN_KP MAKE_RDP_SCANCODE(0x1C, true) /* not RDP_SCANCODE_RETURN Numerical Enter */ -#define RDP_SCANCODE_RCONTROL MAKE_RDP_SCANCODE(0x1D, true) /* VK_RCONTROL */ -#define RDP_SCANCODE_DIVIDE MAKE_RDP_SCANCODE(0x35, true) /* VK_DIVIDE Numerical */ -#define RDP_SCANCODE_PRINTSCREEN MAKE_RDP_SCANCODE(0x37, true) /* VK_EXECUTE/VK_PRINT/VK_SNAPSHOT Print Screen */ -#define RDP_SCANCODE_RMENU MAKE_RDP_SCANCODE(0x38, true) /* VK_RMENU Right 'Alt' / 'Alt Gr' */ -#define RDP_SCANCODE_PAUSE MAKE_RDP_SCANCODE(0x46, true) /* VK_PAUSE Pause / Break (Slightly special handling) */ -#define RDP_SCANCODE_HOME MAKE_RDP_SCANCODE(0x47, true) /* VK_HOME */ -#define RDP_SCANCODE_UP MAKE_RDP_SCANCODE(0x48, true) /* VK_UP */ -#define RDP_SCANCODE_PRIOR MAKE_RDP_SCANCODE(0x49, true) /* VK_PRIOR 'Page Up' */ -#define RDP_SCANCODE_LEFT MAKE_RDP_SCANCODE(0x4B, true) /* VK_LEFT */ -#define RDP_SCANCODE_RIGHT MAKE_RDP_SCANCODE(0x4D, true) /* VK_RIGHT */ -#define RDP_SCANCODE_END MAKE_RDP_SCANCODE(0x4F, true) /* VK_END */ -#define RDP_SCANCODE_DOWN MAKE_RDP_SCANCODE(0x50, true) /* VK_DOWN */ -#define RDP_SCANCODE_NEXT MAKE_RDP_SCANCODE(0x51, true) /* VK_NEXT 'Page Down' */ -#define RDP_SCANCODE_INSERT MAKE_RDP_SCANCODE(0x52, true) /* VK_INSERT */ -#define RDP_SCANCODE_DELETE MAKE_RDP_SCANCODE(0x53, true) /* VK_DELETE */ -#define RDP_SCANCODE_NULL MAKE_RDP_SCANCODE(0x54, true) /* <00> */ -#define RDP_SCANCODE_HELP2 MAKE_RDP_SCANCODE(0x56, true) /* Help - documented, different from VK_HELP */ -#define RDP_SCANCODE_LWIN MAKE_RDP_SCANCODE(0x5B, true) /* VK_LWIN */ -#define RDP_SCANCODE_RWIN MAKE_RDP_SCANCODE(0x5C, true) /* VK_RWIN */ -#define RDP_SCANCODE_APPS MAKE_RDP_SCANCODE(0x5D, true) /* VK_APPS Application */ -#define RDP_SCANCODE_POWER_JP MAKE_RDP_SCANCODE(0x5E, true) /* JP POWER */ -#define RDP_SCANCODE_SLEEP_JP MAKE_RDP_SCANCODE(0x5F, true) /* JP SLEEP */ +#define RDP_SCANCODE_RETURN_KP MAKE_RDP_SCANCODE(0x1C, TRUE) /* not RDP_SCANCODE_RETURN Numerical Enter */ +#define RDP_SCANCODE_RCONTROL MAKE_RDP_SCANCODE(0x1D, TRUE) /* VK_RCONTROL */ +#define RDP_SCANCODE_DIVIDE MAKE_RDP_SCANCODE(0x35, TRUE) /* VK_DIVIDE Numerical */ +#define RDP_SCANCODE_PRINTSCREEN MAKE_RDP_SCANCODE(0x37, TRUE) /* VK_EXECUTE/VK_PRINT/VK_SNAPSHOT Print Screen */ +#define RDP_SCANCODE_RMENU MAKE_RDP_SCANCODE(0x38, TRUE) /* VK_RMENU Right 'Alt' / 'Alt Gr' */ +#define RDP_SCANCODE_PAUSE MAKE_RDP_SCANCODE(0x46, TRUE) /* VK_PAUSE Pause / Break (Slightly special handling) */ +#define RDP_SCANCODE_HOME MAKE_RDP_SCANCODE(0x47, TRUE) /* VK_HOME */ +#define RDP_SCANCODE_UP MAKE_RDP_SCANCODE(0x48, TRUE) /* VK_UP */ +#define RDP_SCANCODE_PRIOR MAKE_RDP_SCANCODE(0x49, TRUE) /* VK_PRIOR 'Page Up' */ +#define RDP_SCANCODE_LEFT MAKE_RDP_SCANCODE(0x4B, TRUE) /* VK_LEFT */ +#define RDP_SCANCODE_RIGHT MAKE_RDP_SCANCODE(0x4D, TRUE) /* VK_RIGHT */ +#define RDP_SCANCODE_END MAKE_RDP_SCANCODE(0x4F, TRUE) /* VK_END */ +#define RDP_SCANCODE_DOWN MAKE_RDP_SCANCODE(0x50, TRUE) /* VK_DOWN */ +#define RDP_SCANCODE_NEXT MAKE_RDP_SCANCODE(0x51, TRUE) /* VK_NEXT 'Page Down' */ +#define RDP_SCANCODE_INSERT MAKE_RDP_SCANCODE(0x52, TRUE) /* VK_INSERT */ +#define RDP_SCANCODE_DELETE MAKE_RDP_SCANCODE(0x53, TRUE) /* VK_DELETE */ +#define RDP_SCANCODE_NULL MAKE_RDP_SCANCODE(0x54, TRUE) /* <00> */ +#define RDP_SCANCODE_HELP2 MAKE_RDP_SCANCODE(0x56, TRUE) /* Help - documented, different from VK_HELP */ +#define RDP_SCANCODE_LWIN MAKE_RDP_SCANCODE(0x5B, TRUE) /* VK_LWIN */ +#define RDP_SCANCODE_RWIN MAKE_RDP_SCANCODE(0x5C, TRUE) /* VK_RWIN */ +#define RDP_SCANCODE_APPS MAKE_RDP_SCANCODE(0x5D, TRUE) /* VK_APPS Application */ +#define RDP_SCANCODE_POWER_JP MAKE_RDP_SCANCODE(0x5E, TRUE) /* JP POWER */ +#define RDP_SCANCODE_SLEEP_JP MAKE_RDP_SCANCODE(0x5F, TRUE) /* JP SLEEP */ /* _not_ valid scancode, but this is what a windows PKBDLLHOOKSTRUCT for NumLock contains */ -#define RDP_SCANCODE_NUMLOCK_EXTENDED MAKE_RDP_SCANCODE(0x45, true) /* should be RDP_SCANCODE_NUMLOCK */ -#define RDP_SCANCODE_RSHIFT_EXTENDED MAKE_RDP_SCANCODE(0x36, true) /* should be RDP_SCANCODE_RSHIFT */ +#define RDP_SCANCODE_NUMLOCK_EXTENDED MAKE_RDP_SCANCODE(0x45, TRUE) /* should be RDP_SCANCODE_NUMLOCK */ +#define RDP_SCANCODE_RSHIFT_EXTENDED MAKE_RDP_SCANCODE(0x36, TRUE) /* should be RDP_SCANCODE_RSHIFT */ #endif /* __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H */ diff --git a/include/freerdp/secondary.h b/include/freerdp/secondary.h index 5bf09b082..5f64bbb30 100644 --- a/include/freerdp/secondary.h +++ b/include/freerdp/secondary.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Secondary Drawing Orders Interface API * * Copyright 2011 Marc-Andre Moreau @@ -68,121 +68,121 @@ struct _CACHE_BITMAP_ORDER { - uint32 cacheId; - uint32 bitmapBpp; - uint32 bitmapWidth; - uint32 bitmapHeight; - uint32 bitmapLength; - uint32 cacheIndex; - boolean compressed; - uint8 bitmapComprHdr[8]; - uint8* bitmapDataStream; + UINT32 cacheId; + UINT32 bitmapBpp; + UINT32 bitmapWidth; + UINT32 bitmapHeight; + UINT32 bitmapLength; + UINT32 cacheIndex; + BOOL compressed; + BYTE bitmapComprHdr[8]; + BYTE* bitmapDataStream; }; typedef struct _CACHE_BITMAP_ORDER CACHE_BITMAP_ORDER; struct _CACHE_BITMAP_V2_ORDER { - uint32 cacheId; - uint32 flags; - uint32 key1; - uint32 key2; - uint32 bitmapBpp; - uint32 bitmapWidth; - uint32 bitmapHeight; - uint32 bitmapLength; - uint32 cacheIndex; - boolean compressed; - uint32 cbCompFirstRowSize; - uint32 cbCompMainBodySize; - uint32 cbScanWidth; - uint32 cbUncompressedSize; - uint8* bitmapDataStream; + UINT32 cacheId; + UINT32 flags; + UINT32 key1; + UINT32 key2; + UINT32 bitmapBpp; + UINT32 bitmapWidth; + UINT32 bitmapHeight; + UINT32 bitmapLength; + UINT32 cacheIndex; + BOOL compressed; + UINT32 cbCompFirstRowSize; + UINT32 cbCompMainBodySize; + UINT32 cbScanWidth; + UINT32 cbUncompressedSize; + BYTE* bitmapDataStream; }; typedef struct _CACHE_BITMAP_V2_ORDER CACHE_BITMAP_V2_ORDER; struct _BITMAP_DATA_EX { - uint32 bpp; - uint32 codecID; - uint32 width; - uint32 height; - uint32 length; - uint8* data; + UINT32 bpp; + UINT32 codecID; + UINT32 width; + UINT32 height; + UINT32 length; + BYTE* data; }; typedef struct _BITMAP_DATA_EX BITMAP_DATA_EX; struct _CACHE_BITMAP_V3_ORDER { - uint32 cacheId; - uint32 bpp; - uint32 flags; - uint32 cacheIndex; - uint32 key1; - uint32 key2; + UINT32 cacheId; + UINT32 bpp; + UINT32 flags; + UINT32 cacheIndex; + UINT32 key1; + UINT32 key2; BITMAP_DATA_EX bitmapData; }; typedef struct _CACHE_BITMAP_V3_ORDER CACHE_BITMAP_V3_ORDER; struct _CACHE_COLOR_TABLE_ORDER { - uint32 cacheIndex; - uint32 numberColors; - uint32* colorTable; + UINT32 cacheIndex; + UINT32 numberColors; + UINT32* colorTable; }; typedef struct _CACHE_COLOR_TABLE_ORDER CACHE_COLOR_TABLE_ORDER; struct _GLYPH_DATA { - uint32 cacheIndex; - sint32 x; - sint32 y; - uint32 cx; - uint32 cy; - uint32 cb; - uint8* aj; + UINT32 cacheIndex; + INT32 x; + INT32 y; + UINT32 cx; + UINT32 cy; + UINT32 cb; + BYTE* aj; }; typedef struct _GLYPH_DATA GLYPH_DATA; struct _CACHE_GLYPH_ORDER { - uint32 cacheId; - uint32 cGlyphs; + UINT32 cacheId; + UINT32 cGlyphs; GLYPH_DATA* glyphData[255]; - uint8* unicodeCharacters; + BYTE* unicodeCharacters; }; typedef struct _CACHE_GLYPH_ORDER CACHE_GLYPH_ORDER; struct _GLYPH_DATA_V2 { - uint32 cacheIndex; - sint32 x; - sint32 y; - uint32 cx; - uint32 cy; - uint32 cb; - uint8* aj; + UINT32 cacheIndex; + INT32 x; + INT32 y; + UINT32 cx; + UINT32 cy; + UINT32 cb; + BYTE* aj; }; typedef struct _GLYPH_DATA_V2 GLYPH_DATA_V2; struct _CACHE_GLYPH_V2_ORDER { - uint32 cacheId; - uint32 flags; - uint32 cGlyphs; + UINT32 cacheId; + UINT32 flags; + UINT32 cGlyphs; GLYPH_DATA_V2* glyphData[255]; - uint8* unicodeCharacters; + BYTE* unicodeCharacters; }; typedef struct _CACHE_GLYPH_V2_ORDER CACHE_GLYPH_V2_ORDER; struct _CACHE_BRUSH_ORDER { - uint32 index; - uint32 bpp; - uint32 cx; - uint32 cy; - uint32 style; - uint32 length; - uint8* data; + UINT32 index; + UINT32 bpp; + UINT32 cx; + UINT32 cy; + UINT32 style; + UINT32 length; + BYTE* data; }; typedef struct _CACHE_BRUSH_ORDER CACHE_BRUSH_ORDER; @@ -197,7 +197,7 @@ typedef void (*pCacheBrush)(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush_ struct rdp_secondary_update { rdpContext* context; /* 0 */ - uint32 paddingA[16 - 1]; /* 1 */ + UINT32 paddingA[16 - 1]; /* 1 */ pCacheBitmap CacheBitmap; /* 16 */ pCacheBitmapV2 CacheBitmapV2; /* 17 */ @@ -206,11 +206,11 @@ struct rdp_secondary_update pCacheGlyph CacheGlyph; /* 20 */ pCacheGlyphV2 CacheGlyphV2; /* 21 */ pCacheBrush CacheBrush; /* 22 */ - uint32 paddingE[32 - 23]; /* 23 */ + UINT32 paddingE[32 - 23]; /* 23 */ /* internal */ - boolean glyph_v2; + BOOL glyph_v2; CACHE_BITMAP_ORDER cache_bitmap_order; CACHE_BITMAP_V2_ORDER cache_bitmap_v2_order; CACHE_BITMAP_V3_ORDER cache_bitmap_v3_order; diff --git a/include/freerdp/server/audin.h b/include/freerdp/server/audin.h index a022efbfd..758e9ca05 100644 --- a/include/freerdp/server/audin.h +++ b/include/freerdp/server/audin.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Server Audio Input Virtual Channel * * Copyright 2012 Vic Lee @@ -26,11 +26,11 @@ typedef struct _audin_server_context audin_server_context; typedef void (*psAudinServerSelectFormat)(audin_server_context* context, int client_format_index); -typedef boolean (*psAudinServerOpen)(audin_server_context* context); -typedef boolean (*psAudinServerClose)(audin_server_context* context); +typedef BOOL (*psAudinServerOpen)(audin_server_context* context); +typedef BOOL (*psAudinServerClose)(audin_server_context* context); typedef void (*psAudinServerOpening)(audin_server_context* context); -typedef void (*psAudinServerOpenResult)(audin_server_context* context, uint32 result); +typedef void (*psAudinServerOpenResult)(audin_server_context* context, UINT32 result); typedef void (*psAudinServerReceiveSamples)(audin_server_context* context, const void* buf, int nframes); struct _audin_server_context diff --git a/include/freerdp/server/rdpsnd.h b/include/freerdp/server/rdpsnd.h index 5c9c056ef..1042ce288 100644 --- a/include/freerdp/server/rdpsnd.h +++ b/include/freerdp/server/rdpsnd.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Server Audio Virtual Channel * * Copyright 2012 Vic Lee @@ -25,11 +25,11 @@ typedef struct _rdpsnd_server_context rdpsnd_server_context; -typedef boolean (*psRdpsndServerInitialize)(rdpsnd_server_context* context); +typedef BOOL (*psRdpsndServerInitialize)(rdpsnd_server_context* context); typedef void (*psRdpsndServerSelectFormat)(rdpsnd_server_context* context, int client_format_index); -typedef boolean (*psRdpsndServerSendSamples)(rdpsnd_server_context* context, const void* buf, int nframes); -typedef boolean (*psRdpsndServerSetVolume)(rdpsnd_server_context* context, int left, int right); -typedef boolean (*psRdpsndServerClose)(rdpsnd_server_context* context); +typedef BOOL (*psRdpsndServerSendSamples)(rdpsnd_server_context* context, const void* buf, int nframes); +typedef BOOL (*psRdpsndServerSetVolume)(rdpsnd_server_context* context, int left, int right); +typedef BOOL (*psRdpsndServerClose)(rdpsnd_server_context* context); typedef void (*psRdpsndServerActivated)(rdpsnd_server_context* context); diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 2baffa7b8..710522398 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Settings * * Copyright 2009-2011 Jay Sorg @@ -99,59 +99,59 @@ /* SYSTEM_TIME */ typedef struct { - uint16 wYear; - uint16 wMonth; - uint16 wDayOfWeek; - uint16 wDay; - uint16 wHour; - uint16 wMinute; - uint16 wSecond; - uint16 wMilliseconds; + UINT16 wYear; + UINT16 wMonth; + UINT16 wDayOfWeek; + UINT16 wDay; + UINT16 wHour; + UINT16 wMinute; + UINT16 wSecond; + UINT16 wMilliseconds; } SYSTEM_TIME; /* TIME_ZONE_INFORMATION */ struct _TIME_ZONE_INFO { - uint32 bias; + UINT32 bias; char standardName[32]; SYSTEM_TIME standardDate; - uint32 standardBias; + UINT32 standardBias; char daylightName[32]; SYSTEM_TIME daylightDate; - uint32 daylightBias; + UINT32 daylightBias; }; typedef struct _TIME_ZONE_INFO TIME_ZONE_INFO; /* ARC_CS_PRIVATE_PACKET */ typedef struct { - uint32 cbLen; - uint32 version; - uint32 logonId; - uint8 securityVerifier[16]; + UINT32 cbLen; + UINT32 version; + UINT32 logonId; + BYTE securityVerifier[16]; } ARC_CS_PRIVATE_PACKET; /* ARC_SC_PRIVATE_PACKET */ typedef struct { - uint32 cbLen; - uint32 version; - uint32 logonId; - uint8 arcRandomBits[16]; + UINT32 cbLen; + UINT32 version; + UINT32 logonId; + BYTE arcRandomBits[16]; } ARC_SC_PRIVATE_PACKET; /* Certificates */ struct rdp_CertBlob { - uint32 length; - uint8* data; + UINT32 length; + BYTE* data; }; typedef struct rdp_CertBlob rdpCertBlob; struct rdp_X509CertChain { - uint32 count; + UINT32 count; rdpCertBlob* array; }; typedef struct rdp_X509CertChain rdpX509CertChain; @@ -160,7 +160,7 @@ struct rdp_CertInfo { BYTE* Modulus; DWORD ModulusLength; - uint8 exponent[4]; + BYTE exponent[4]; }; typedef struct rdp_CertInfo rdpCertInfo; @@ -177,7 +177,7 @@ struct rdp_key DWORD ModulusLength; BYTE* PrivateExponent; DWORD PrivateExponentLength; - uint8 exponent[4]; + BYTE exponent[4]; }; typedef struct rdp_key rdpKey; @@ -188,7 +188,7 @@ struct rdp_channel char name[8]; /* ui sets */ int options; /* ui sets */ int channel_id; /* core sets */ - boolean joined; /* client has joined the channel */ + BOOL joined; /* client has joined the channel */ void* handle; /* just for ui */ }; typedef struct rdp_channel rdpChannel; @@ -205,15 +205,15 @@ struct rdp_ext_set struct _BITMAP_CACHE_CELL_INFO { - uint16 numEntries; - uint16 maxSize; + UINT16 numEntries; + UINT16 maxSize; }; typedef struct _BITMAP_CACHE_CELL_INFO BITMAP_CACHE_CELL_INFO; struct _BITMAP_CACHE_V2_CELL_INFO { - uint32 numEntries; - boolean persistent; + UINT32 numEntries; + BOOL persistent; }; typedef struct _BITMAP_CACHE_V2_CELL_INFO BITMAP_CACHE_V2_CELL_INFO; @@ -221,8 +221,8 @@ typedef struct _BITMAP_CACHE_V2_CELL_INFO BITMAP_CACHE_V2_CELL_INFO; struct _GLYPH_CACHE_DEFINITION { - uint16 cacheEntries; - uint16 cacheMaximumCellSize; + UINT16 cacheEntries; + UINT16 cacheMaximumCellSize; }; typedef struct _GLYPH_CACHE_DEFINITION GLYPH_CACHE_DEFINITION; @@ -252,30 +252,30 @@ struct rdp_monitor struct rdp_settings { ALIGN64 void* instance; /* 0 */ - uint64 paddingA[16 - 1]; /* 1 */ + UINT64 paddingA[16 - 1]; /* 1 */ /* Core Protocol Parameters */ - ALIGN64 uint32 width; /* 16 */ - ALIGN64 uint32 height; /* 17 */ - ALIGN64 uint32 rdp_version; /* 18 */ - ALIGN64 uint32 color_depth; /* 19 */ - ALIGN64 uint32 kbd_layout; /* 20 */ - ALIGN64 uint32 kbd_type; /* 21 */ - ALIGN64 uint32 kbd_subtype; /* 22 */ - ALIGN64 uint32 kbd_fn_keys; /* 23 */ - ALIGN64 uint32 client_build; /* 24 */ - ALIGN64 uint32 requested_protocols; /* 25 */ - ALIGN64 uint32 selected_protocol; /* 26 */ - ALIGN64 uint32 encryption_method; /* 27 */ - ALIGN64 uint32 encryption_level; /* 28 */ - ALIGN64 boolean authentication; /* 29 */ - ALIGN64 uint32 negotiationFlags; /* 30 */ - ALIGN64 boolean security_layer_negotiation; /* 31 */ - uint64 paddingB[48 - 32]; /* 32 */ + ALIGN64 UINT32 width; /* 16 */ + ALIGN64 UINT32 height; /* 17 */ + ALIGN64 UINT32 rdp_version; /* 18 */ + ALIGN64 UINT32 color_depth; /* 19 */ + ALIGN64 UINT32 kbd_layout; /* 20 */ + ALIGN64 UINT32 kbd_type; /* 21 */ + ALIGN64 UINT32 kbd_subtype; /* 22 */ + ALIGN64 UINT32 kbd_fn_keys; /* 23 */ + ALIGN64 UINT32 client_build; /* 24 */ + ALIGN64 UINT32 requested_protocols; /* 25 */ + ALIGN64 UINT32 selected_protocol; /* 26 */ + ALIGN64 UINT32 encryption_method; /* 27 */ + ALIGN64 UINT32 encryption_level; /* 28 */ + ALIGN64 BOOL authentication; /* 29 */ + ALIGN64 UINT32 negotiationFlags; /* 30 */ + ALIGN64 BOOL security_layer_negotiation; /* 31 */ + UINT64 paddingB[48 - 32]; /* 32 */ /* Connection Settings */ - ALIGN64 uint32 port; /* 48 */ - ALIGN64 boolean ipv6; /* 49 */ + ALIGN64 UINT32 port; /* 48 */ + ALIGN64 BOOL ipv6; /* 49 */ ALIGN64 char* hostname; /* 50 */ ALIGN64 char* username; /* 51 */ ALIGN64 char* password; /* 52 */ @@ -284,101 +284,101 @@ struct rdp_settings ALIGN64 char* directory; /* 55 */ ALIGN64 char* ip_address; /* 56 */ ALIGN64 char* client_dir; /* 57 */ - ALIGN64 boolean autologon; /* 58 */ - ALIGN64 boolean compression; /* 59 */ - ALIGN64 uint32 performance_flags; /* 60 */ + ALIGN64 BOOL autologon; /* 58 */ + ALIGN64 BOOL compression; /* 59 */ + ALIGN64 UINT32 performance_flags; /* 60 */ ALIGN64 BYTE* password_cookie; /* 61 */ ALIGN64 DWORD password_cookie_length; /* 62 */ ALIGN64 char* kerberos_kdc; /* 63 */ ALIGN64 char* kerberos_realm; /* 64 */ - ALIGN64 boolean ts_gateway; /* 65 */ + ALIGN64 BOOL ts_gateway; /* 65 */ ALIGN64 char* tsg_hostname; /* 66 */ ALIGN64 char* tsg_username; /* 67 */ ALIGN64 char* tsg_password; /* 68 */ - ALIGN64 boolean local; /* 69 */ - ALIGN64 boolean authentication_only; /* 70 */ - ALIGN64 boolean from_stdin; /* 71 */ - ALIGN64 boolean send_preconnection_pdu; /* 72 */ - ALIGN64 uint32 preconnection_id; /* 73 */ + ALIGN64 BOOL local; /* 69 */ + ALIGN64 BOOL authentication_only; /* 70 */ + ALIGN64 BOOL from_stdin; /* 71 */ + ALIGN64 BOOL send_preconnection_pdu; /* 72 */ + ALIGN64 UINT32 preconnection_id; /* 73 */ ALIGN64 char* preconnection_blob; /* 74 */ - uint64 paddingC[80 - 75]; /* 75 */ + UINT64 paddingC[80 - 75]; /* 75 */ /* User Interface Parameters */ - ALIGN64 boolean sw_gdi; /* 80 */ - ALIGN64 boolean workarea; /* 81 */ - ALIGN64 boolean fullscreen; /* 82 */ - ALIGN64 boolean grab_keyboard; /* 83 */ - ALIGN64 boolean decorations; /* 84 */ - ALIGN64 uint32 percent_screen; /* 85 */ - ALIGN64 boolean mouse_motion; /* 86 */ + ALIGN64 BOOL sw_gdi; /* 80 */ + ALIGN64 BOOL workarea; /* 81 */ + ALIGN64 BOOL fullscreen; /* 82 */ + ALIGN64 BOOL grab_keyboard; /* 83 */ + ALIGN64 BOOL decorations; /* 84 */ + ALIGN64 UINT32 percent_screen; /* 85 */ + ALIGN64 BOOL mouse_motion; /* 86 */ ALIGN64 char* window_title; /* 87 */ - ALIGN64 uint64 parent_window_xid; /* 88 */ - uint64 paddingD[112 - 89]; /* 89 */ + ALIGN64 UINT64 parent_window_xid; /* 88 */ + UINT64 paddingD[112 - 89]; /* 89 */ /* Internal Parameters */ ALIGN64 char* home_path; /* 112 */ - ALIGN64 uint32 share_id; /* 113 */ - ALIGN64 uint32 pdu_source; /* 114 */ + ALIGN64 UINT32 share_id; /* 113 */ + ALIGN64 UINT32 pdu_source; /* 114 */ ALIGN64 void* unused115; /* 115 */ - ALIGN64 boolean server_mode; /* 116 */ + ALIGN64 BOOL server_mode; /* 116 */ ALIGN64 char* config_path; /* 117 */ ALIGN64 char* current_path; /* 118 */ ALIGN64 char* development_path; /* 119 */ - ALIGN64 boolean development_mode; /* 120 */ - uint64 paddingE[144 - 121]; /* 121 */ + ALIGN64 BOOL development_mode; /* 120 */ + UINT64 paddingE[144 - 121]; /* 121 */ /* Security */ - ALIGN64 boolean encryption; /* 144 */ - ALIGN64 boolean tls_security; /* 145 */ - ALIGN64 boolean nla_security; /* 146 */ - ALIGN64 boolean rdp_security; /* 147 */ - ALIGN64 uint32 ntlm_version; /* 148 */ - ALIGN64 boolean salted_checksum; /* 149 */ - uint64 paddingF[160 - 150]; /* 150 */ + ALIGN64 BOOL encryption; /* 144 */ + ALIGN64 BOOL tls_security; /* 145 */ + ALIGN64 BOOL nla_security; /* 146 */ + ALIGN64 BOOL rdp_security; /* 147 */ + ALIGN64 UINT32 ntlm_version; /* 148 */ + ALIGN64 BOOL salted_checksum; /* 149 */ + UINT64 paddingF[160 - 150]; /* 150 */ /* Session */ - ALIGN64 boolean console_audio; /* 160 */ - ALIGN64 boolean console_session; /* 161 */ - ALIGN64 uint32 redirected_session_id; /* 162 */ - ALIGN64 boolean audio_playback; /* 163 */ - ALIGN64 boolean audio_capture; /* 164 */ - uint64 paddingG[176 - 165]; /* 165 */ + ALIGN64 BOOL console_audio; /* 160 */ + ALIGN64 BOOL console_session; /* 161 */ + ALIGN64 UINT32 redirected_session_id; /* 162 */ + ALIGN64 BOOL audio_playback; /* 163 */ + ALIGN64 BOOL audio_capture; /* 164 */ + UINT64 paddingG[176 - 165]; /* 165 */ /* Output Control */ - ALIGN64 boolean refresh_rect; /* 176 */ - ALIGN64 boolean suppress_output; /* 177 */ - ALIGN64 boolean desktop_resize; /* 178 */ - uint64 paddingH[192 - 179]; /* 179 */ + ALIGN64 BOOL refresh_rect; /* 176 */ + ALIGN64 BOOL suppress_output; /* 177 */ + ALIGN64 BOOL desktop_resize; /* 178 */ + UINT64 paddingH[192 - 179]; /* 179 */ /* Reconnection */ - ALIGN64 boolean auto_reconnection; /* 192 */ + ALIGN64 BOOL auto_reconnection; /* 192 */ ALIGN64 ARC_CS_PRIVATE_PACKET* client_auto_reconnect_cookie; /* 193 */ ALIGN64 ARC_SC_PRIVATE_PACKET* server_auto_reconnect_cookie; /* 194 */ - uint64 paddingI[208 - 195]; /* 195 */ + UINT64 paddingI[208 - 195]; /* 195 */ /* Time Zone */ ALIGN64 TIME_ZONE_INFO* client_time_zone; /* 208 */ - uint64 paddingJ[216 - 209]; /* 209 */ + UINT64 paddingJ[216 - 209]; /* 209 */ /* Capabilities */ - ALIGN64 uint32 os_major_type; /* 216 */ - ALIGN64 uint32 os_minor_type; /* 217 */ - ALIGN64 uint32 vc_chunk_size; /* 218 */ - ALIGN64 boolean sound_beeps; /* 219 */ - ALIGN64 boolean smooth_fonts; /* 220 */ - ALIGN64 boolean frame_marker; /* 221 */ - ALIGN64 boolean fastpath_input; /* 222 */ - ALIGN64 boolean fastpath_output; /* 223 */ - ALIGN64 uint8* received_caps; /* 224 */ - ALIGN64 uint8* order_support; /* 225 */ - ALIGN64 boolean surface_commands; /* 226 */ - ALIGN64 boolean disable_wallpaper; /* 227 */ - ALIGN64 boolean disable_full_window_drag; /* 228 */ - ALIGN64 boolean disable_menu_animations; /* 229 */ - ALIGN64 boolean disable_theming; /* 230 */ - ALIGN64 uint32 connection_type; /* 231 */ - ALIGN64 uint32 multifrag_max_request_size; /* 232 */ - uint64 paddingK[248 - 233]; /* 233 */ + ALIGN64 UINT32 os_major_type; /* 216 */ + ALIGN64 UINT32 os_minor_type; /* 217 */ + ALIGN64 UINT32 vc_chunk_size; /* 218 */ + ALIGN64 BOOL sound_beeps; /* 219 */ + ALIGN64 BOOL smooth_fonts; /* 220 */ + ALIGN64 BOOL frame_marker; /* 221 */ + ALIGN64 BOOL fastpath_input; /* 222 */ + ALIGN64 BOOL fastpath_output; /* 223 */ + ALIGN64 BYTE* received_caps; /* 224 */ + ALIGN64 BYTE* order_support; /* 225 */ + ALIGN64 BOOL surface_commands; /* 226 */ + ALIGN64 BOOL disable_wallpaper; /* 227 */ + ALIGN64 BOOL disable_full_window_drag; /* 228 */ + ALIGN64 BOOL disable_menu_animations; /* 229 */ + ALIGN64 BOOL disable_theming; /* 230 */ + ALIGN64 UINT32 connection_type; /* 231 */ + ALIGN64 UINT32 multifrag_max_request_size; /* 232 */ + UINT64 paddingK[248 - 233]; /* 233 */ /* Certificate */ ALIGN64 char* cert_file; /* 248 */ @@ -389,82 +389,82 @@ struct rdp_settings ALIGN64 DWORD server_random_length; /* 253 */ ALIGN64 BYTE* server_certificate; /* 254 */ ALIGN64 DWORD server_certificate_length; /* 255 */ - ALIGN64 boolean ignore_certificate; /* 256 */ + ALIGN64 BOOL ignore_certificate; /* 256 */ ALIGN64 rdpCertificate* server_cert; /* 257 */ ALIGN64 char* rdp_key_file; /* 258 */ ALIGN64 rdpKey* server_key; /* 259 */ ALIGN64 char* certificate_name; /* 260 */ - uint64 paddingL[280 - 261]; /* 261 */ + UINT64 paddingL[280 - 261]; /* 261 */ /* Codecs */ - ALIGN64 boolean rfx_codec; /* 280 */ - ALIGN64 boolean ns_codec; /* 281 */ - ALIGN64 uint32 rfx_codec_id; /* 282 */ - ALIGN64 uint32 ns_codec_id; /* 283 */ - ALIGN64 uint32 rfx_codec_mode; /* 284 */ - ALIGN64 boolean frame_acknowledge; /* 285 */ - ALIGN64 boolean jpeg_codec; /* 286 */ - ALIGN64 uint32 jpeg_codec_id; /* 287 */ - ALIGN64 uint32 jpeg_quality; /* 288 */ - ALIGN64 uint32 v3_codec_id; /* 289 */ - ALIGN64 boolean rfx_codec_only; /* 290 */ - uint64 paddingM[296 - 291]; /* 291 */ + ALIGN64 BOOL rfx_codec; /* 280 */ + ALIGN64 BOOL ns_codec; /* 281 */ + ALIGN64 UINT32 rfx_codec_id; /* 282 */ + ALIGN64 UINT32 ns_codec_id; /* 283 */ + ALIGN64 UINT32 rfx_codec_mode; /* 284 */ + ALIGN64 BOOL frame_acknowledge; /* 285 */ + ALIGN64 BOOL jpeg_codec; /* 286 */ + ALIGN64 UINT32 jpeg_codec_id; /* 287 */ + ALIGN64 UINT32 jpeg_quality; /* 288 */ + ALIGN64 UINT32 v3_codec_id; /* 289 */ + ALIGN64 BOOL rfx_codec_only; /* 290 */ + UINT64 paddingM[296 - 291]; /* 291 */ /* Recording */ - ALIGN64 boolean dump_rfx; /* 296 */ - ALIGN64 boolean play_rfx; /* 297 */ + ALIGN64 BOOL dump_rfx; /* 296 */ + ALIGN64 BOOL play_rfx; /* 297 */ ALIGN64 char* dump_rfx_file; /* 298 */ ALIGN64 char* play_rfx_file; /* 299 */ - uint64 paddingN[312 - 300]; /* 300 */ + UINT64 paddingN[312 - 300]; /* 300 */ /* RemoteApp */ - ALIGN64 boolean remote_app; /* 312 */ - ALIGN64 uint32 num_icon_caches; /* 313 */ - ALIGN64 uint32 num_icon_cache_entries; /* 314 */ - ALIGN64 boolean rail_langbar_supported; /* 315 */ - uint64 paddingO[320 - 316]; /* 316 */ + ALIGN64 BOOL remote_app; /* 312 */ + ALIGN64 UINT32 num_icon_caches; /* 313 */ + ALIGN64 UINT32 num_icon_cache_entries; /* 314 */ + ALIGN64 BOOL rail_langbar_supported; /* 315 */ + UINT64 paddingO[320 - 316]; /* 316 */ /* Pointer */ - ALIGN64 boolean large_pointer; /* 320 */ - ALIGN64 boolean color_pointer; /* 321 */ - ALIGN64 uint32 pointer_cache_size; /* 322 */ - uint64 paddingP[328 - 323]; /* 323 */ + ALIGN64 BOOL large_pointer; /* 320 */ + ALIGN64 BOOL color_pointer; /* 321 */ + ALIGN64 UINT32 pointer_cache_size; /* 322 */ + UINT64 paddingP[328 - 323]; /* 323 */ /* Bitmap Cache */ - ALIGN64 boolean bitmap_cache; /* 328 */ - ALIGN64 boolean bitmap_cache_v3; /* 329 */ - ALIGN64 boolean persistent_bitmap_cache; /* 330 */ - ALIGN64 uint32 bitmapCacheV2NumCells; /* 331 */ + ALIGN64 BOOL bitmap_cache; /* 328 */ + ALIGN64 BOOL bitmap_cache_v3; /* 329 */ + ALIGN64 BOOL persistent_bitmap_cache; /* 330 */ + ALIGN64 UINT32 bitmapCacheV2NumCells; /* 331 */ ALIGN64 BITMAP_CACHE_V2_CELL_INFO* bitmapCacheV2CellInfo; /* 332 */ - uint64 paddingQ[344 - 333]; /* 333 */ + UINT64 paddingQ[344 - 333]; /* 333 */ /* Offscreen Bitmap Cache */ - ALIGN64 boolean offscreen_bitmap_cache; /* 344 */ - ALIGN64 uint32 offscreen_bitmap_cache_size; /* 345 */ - ALIGN64 uint32 offscreen_bitmap_cache_entries; /* 346 */ - uint64 paddingR[352 - 347]; /* 347 */ + ALIGN64 BOOL offscreen_bitmap_cache; /* 344 */ + ALIGN64 UINT32 offscreen_bitmap_cache_size; /* 345 */ + ALIGN64 UINT32 offscreen_bitmap_cache_entries; /* 346 */ + UINT64 paddingR[352 - 347]; /* 347 */ /* Glyph Cache */ - ALIGN64 boolean glyph_cache; /* 352 */ - ALIGN64 uint32 glyphSupportLevel; /* 353 */ + ALIGN64 BOOL glyph_cache; /* 352 */ + ALIGN64 UINT32 glyphSupportLevel; /* 353 */ ALIGN64 GLYPH_CACHE_DEFINITION* glyphCache; /* 354 */ ALIGN64 GLYPH_CACHE_DEFINITION* fragCache; /* 355 */ - uint64 paddingS[360 - 356]; /* 356 */ + UINT64 paddingS[360 - 356]; /* 356 */ /* Draw Nine Grid */ - ALIGN64 boolean draw_nine_grid; /* 360 */ - ALIGN64 uint32 draw_nine_grid_cache_size; /* 361 */ - ALIGN64 uint32 draw_nine_grid_cache_entries; /* 362 */ - uint64 paddingT[368 - 363]; /* 363 */ + ALIGN64 BOOL draw_nine_grid; /* 360 */ + ALIGN64 UINT32 draw_nine_grid_cache_size; /* 361 */ + ALIGN64 UINT32 draw_nine_grid_cache_entries; /* 362 */ + UINT64 paddingT[368 - 363]; /* 363 */ /* Draw GDI+ */ - ALIGN64 boolean draw_gdi_plus; /* 368 */ - ALIGN64 boolean draw_gdi_plus_cache; /* 369 */ - uint64 paddingU[376 - 370]; /* 370 */ + ALIGN64 BOOL draw_gdi_plus; /* 368 */ + ALIGN64 BOOL draw_gdi_plus_cache; /* 369 */ + UINT64 paddingU[376 - 370]; /* 370 */ /* Desktop Composition */ - ALIGN64 boolean desktop_composition; /* 376 */ - uint64 paddingV[384 - 377]; /* 377 */ + ALIGN64 BOOL desktop_composition; /* 376 */ + UINT64 paddingV[384 - 377]; /* 377 */ /* Channels */ ALIGN64 int num_channels; diff --git a/include/freerdp/svc.h b/include/freerdp/svc.h index 1c3e347cf..3f16412a4 100644 --- a/include/freerdp/svc.h +++ b/include/freerdp/svc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Static Virtual Channel Interface * * Copyright 2009-2011 Jay Sorg @@ -36,19 +36,19 @@ struct _CHANNEL_DEF { char name[CHANNEL_NAME_LEN + 1]; - uint32 options; + UINT32 options; }; typedef struct _CHANNEL_DEF CHANNEL_DEF; typedef CHANNEL_DEF* PCHANNEL_DEF; typedef CHANNEL_DEF** PPCHANNEL_DEF; typedef void (FREERDP_CC * PCHANNEL_INIT_EVENT_FN)(void* pInitHandle, - uint32 event, void* pData, uint32 dataLength); + UINT32 event, void* pData, UINT32 dataLength); -typedef void (FREERDP_CC * PCHANNEL_OPEN_EVENT_FN)(uint32 openHandle, - uint32 event, void* pData, uint32 dataLength, - uint32 totalLength, uint32 dataFlags); +typedef void (FREERDP_CC * PCHANNEL_OPEN_EVENT_FN)(UINT32 openHandle, + UINT32 event, void* pData, UINT32 dataLength, + UINT32 totalLength, UINT32 dataFlags); #define CHANNEL_RC_OK 0 #define CHANNEL_RC_ALREADY_INITIALIZED 1 @@ -71,24 +71,24 @@ typedef void (FREERDP_CC * PCHANNEL_OPEN_EVENT_FN)(uint32 openHandle, #define VIRTUAL_CHANNEL_VERSION_WIN2000 1 -typedef uint32 (FREERDP_CC * PVIRTUALCHANNELINIT)(void** ppInitHandle, - PCHANNEL_DEF pChannel, int channelCount, uint32 versionRequested, +typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELINIT)(void** ppInitHandle, + PCHANNEL_DEF pChannel, int channelCount, UINT32 versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc); -typedef uint32 (FREERDP_CC * PVIRTUALCHANNELOPEN)(void* pInitHandle, - uint32* pOpenHandle, char* pChannelName, +typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELOPEN)(void* pInitHandle, + UINT32* pOpenHandle, char* pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc); -typedef uint32 (FREERDP_CC * PVIRTUALCHANNELCLOSE)(uint32 openHandle); +typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELCLOSE)(UINT32 openHandle); -typedef uint32 (FREERDP_CC * PVIRTUALCHANNELWRITE)(uint32 openHandle, - void* pData, uint32 dataLength, void* pUserData); +typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELWRITE)(UINT32 openHandle, + void* pData, UINT32 dataLength, void* pUserData); -typedef uint32 (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(uint32 openHandle, +typedef UINT32 (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(UINT32 openHandle, RDP_EVENT* event); struct _CHANNEL_ENTRY_POINTS { - uint32 cbSize; - uint32 protocolVersion; + UINT32 cbSize; + UINT32 protocolVersion; PVIRTUALCHANNELINIT pVirtualChannelInit; PVIRTUALCHANNELOPEN pVirtualChannelOpen; PVIRTUALCHANNELCLOSE pVirtualChannelClose; @@ -101,8 +101,8 @@ typedef int (FREERDP_CC * PVIRTUALCHANNELENTRY)(PCHANNEL_ENTRY_POINTS pEntryPoin struct _CHANNEL_ENTRY_POINTS_EX { - uint32 cbSize; - uint32 protocolVersion; + UINT32 cbSize; + UINT32 protocolVersion; PVIRTUALCHANNELINIT pVirtualChannelInit; PVIRTUALCHANNELOPEN pVirtualChannelOpen; PVIRTUALCHANNELCLOSE pVirtualChannelClose; diff --git a/include/freerdp/types.h b/include/freerdp/types.h index 3b12a68c6..a685993be 100644 --- a/include/freerdp/types.h +++ b/include/freerdp/types.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Type Definitions * * Copyright 2009-2011 Jay Sorg @@ -25,92 +25,6 @@ #include -#ifdef _WIN32 -#include -#endif - -#ifdef FREERDP_HAVE_LIMITS_H -#include -#endif - -#ifdef FREERDP_HAVE_STDINT_H -#include -#endif - -#ifdef FREERDP_HAVE_INTTYPES_H - -#include -typedef uint8_t uint8; -typedef int8_t sint8; -typedef uint16_t uint16; -typedef int16_t sint16; -typedef uint32_t uint32; -typedef int32_t sint32; -typedef uint64_t uint64; -typedef int64_t sint64; - -#else - -typedef unsigned char uint8; -typedef signed char sint8; -typedef unsigned short uint16; -typedef signed short sint16; -typedef unsigned int uint32; -typedef signed int sint32; -#ifdef _WIN32 -typedef unsigned __int64 uint64; -typedef signed __int64 sint64; -#else -typedef unsigned long long uint64; -typedef signed long long sint64; -#endif - -#endif /* HAVE_INTTYPES_H */ - -#ifdef FREERDP_HAVE_STDBOOL_H - -#include - -#ifdef _WIN32 -#define boolean BOOLEAN -#else -typedef int boolean; -#endif - -#else - -#ifndef __cplusplus - -#ifndef __bool_true_false_are_defined -#define __bool_true_false_are_defined 1 - -#define true 1 -#define false 0 - -#ifdef _WIN32 -#define boolean BOOLEAN -#else -typedef int boolean; -#endif - -#endif /* __bool_true_false_are_defined */ - -#else /* ifdef __cplusplus */ - -#ifndef true -#define true 1 -#endif - -#ifndef false -#define false 0 -#endif - -typedef int boolean; - -#endif /* __cplusplus */ - -#endif /* FREERDP_HAVE_STDBOOL_H */ - #ifndef MIN #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #endif @@ -123,36 +37,36 @@ typedef int boolean; typedef struct { - uint32 time_low; - uint16 time_mid; - uint16 time_hi_and_version; - uint8 clock_seq_hi_and_reserved; - uint8 clock_seq_low; - uint8 node[6]; + UINT32 time_low; + UINT16 time_mid; + UINT16 time_hi_and_version; + BYTE clock_seq_hi_and_reserved; + BYTE clock_seq_low; + BYTE node[6]; } uuid; struct _RDP_PLUGIN_DATA { - uint16 size; + UINT16 size; void* data[4]; }; typedef struct _RDP_PLUGIN_DATA RDP_PLUGIN_DATA; struct _RDP_RECT { - sint16 x; - sint16 y; - sint16 width; - sint16 height; + INT16 x; + INT16 y; + INT16 width; + INT16 height; }; typedef struct _RDP_RECT RDP_RECT; struct _RECTANGLE_16 { - uint16 left; - uint16 top; - uint16 right; - uint16 bottom; + UINT16 left; + UINT16 top; + UINT16 right; + UINT16 bottom; }; typedef struct _RECTANGLE_16 RECTANGLE_16; @@ -163,8 +77,8 @@ typedef void (*RDP_EVENT_CALLBACK) (RDP_EVENT* event); struct _RDP_EVENT { - uint16 event_class; - uint16 event_type; + UINT16 event_class; + UINT16 event_type; RDP_EVENT_CALLBACK on_event_free_callback; void* user_data; }; diff --git a/include/freerdp/update.h b/include/freerdp/update.h index 40bfc9e42..f4a0eaed6 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Update Interface API * * Copyright 2011 Marc-Andre Moreau @@ -39,28 +39,28 @@ typedef struct rdp_update rdpUpdate; struct _BITMAP_DATA { - uint32 destLeft; - uint32 destTop; - uint32 destRight; - uint32 destBottom; - uint32 width; - uint32 height; - uint32 bitsPerPixel; - uint32 flags; - uint32 bitmapLength; - uint32 cbCompFirstRowSize; - uint32 cbCompMainBodySize; - uint32 cbScanWidth; - uint32 cbUncompressedSize; - uint8* bitmapDataStream; - boolean compressed; + UINT32 destLeft; + UINT32 destTop; + UINT32 destRight; + UINT32 destBottom; + UINT32 width; + UINT32 height; + UINT32 bitsPerPixel; + UINT32 flags; + UINT32 bitmapLength; + UINT32 cbCompFirstRowSize; + UINT32 cbCompMainBodySize; + UINT32 cbScanWidth; + UINT32 cbUncompressedSize; + BYTE* bitmapDataStream; + BOOL compressed; }; typedef struct _BITMAP_DATA BITMAP_DATA; struct _BITMAP_UPDATE { - uint32 count; - uint32 number; + UINT32 count; + UINT32 number; BITMAP_DATA* rectangles; }; typedef struct _BITMAP_UPDATE BITMAP_UPDATE; @@ -69,22 +69,22 @@ typedef struct _BITMAP_UPDATE BITMAP_UPDATE; struct _PALETTE_ENTRY { - uint8 red; - uint8 green; - uint8 blue; + BYTE red; + BYTE green; + BYTE blue; }; typedef struct _PALETTE_ENTRY PALETTE_ENTRY; struct _PALETTE_UPDATE { - uint32 number; + UINT32 number; PALETTE_ENTRY entries[256]; }; typedef struct _PALETTE_UPDATE PALETTE_UPDATE; struct rdp_palette { - uint32 count; + UINT32 count; PALETTE_ENTRY* entries; }; typedef struct rdp_palette rdpPalette; @@ -93,8 +93,8 @@ typedef struct rdp_palette rdpPalette; struct _PLAY_SOUND_UPDATE { - uint32 duration; - uint32 frequency; + UINT32 duration; + UINT32 frequency; }; typedef struct _PLAY_SOUND_UPDATE PLAY_SOUND_UPDATE; @@ -102,24 +102,24 @@ typedef struct _PLAY_SOUND_UPDATE PLAY_SOUND_UPDATE; struct _SURFACE_BITS_COMMAND { - uint32 cmdType; - uint32 destLeft; - uint32 destTop; - uint32 destRight; - uint32 destBottom; - uint32 bpp; - uint32 codecID; - uint32 width; - uint32 height; - uint32 bitmapDataLength; - uint8* bitmapData; + UINT32 cmdType; + UINT32 destLeft; + UINT32 destTop; + UINT32 destRight; + UINT32 destBottom; + UINT32 bpp; + UINT32 codecID; + UINT32 width; + UINT32 height; + UINT32 bitmapDataLength; + BYTE* bitmapData; }; typedef struct _SURFACE_BITS_COMMAND SURFACE_BITS_COMMAND; struct _SURFACE_FRAME_MARKER { - uint32 frameAction; - uint32 frameId; + UINT32 frameAction; + UINT32 frameId; }; typedef struct _SURFACE_FRAME_MARKER SURFACE_FRAME_MARKER; @@ -141,8 +141,8 @@ typedef void (*pBitmapUpdate)(rdpContext* context, BITMAP_UPDATE* bitmap); typedef void (*pPalette)(rdpContext* context, PALETTE_UPDATE* palette); typedef void (*pPlaySound)(rdpContext* context, PLAY_SOUND_UPDATE* play_sound); -typedef void (*pRefreshRect)(rdpContext* context, uint8 count, RECTANGLE_16* areas); -typedef void (*pSuppressOutput)(rdpContext* context, uint8 allow, RECTANGLE_16* area); +typedef void (*pRefreshRect)(rdpContext* context, BYTE count, RECTANGLE_16* areas); +typedef void (*pSuppressOutput)(rdpContext* context, BYTE allow, RECTANGLE_16* area); typedef void (*pSurfaceCommand)(rdpContext* context, STREAM* s); typedef void (*pSurfaceBits)(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_command); @@ -151,7 +151,7 @@ typedef void (*pSurfaceFrameMarker)(rdpContext* context, SURFACE_FRAME_MARKER* s struct rdp_update { rdpContext* context; /* 0 */ - uint32 paddingA[16 - 1]; /* 1 */ + UINT32 paddingA[16 - 1]; /* 1 */ pBeginPaint BeginPaint; /* 16 */ pEndPaint EndPaint; /* 17 */ @@ -161,28 +161,28 @@ struct rdp_update pBitmapUpdate BitmapUpdate; /* 21 */ pPalette Palette; /* 22 */ pPlaySound PlaySound; /* 23 */ - uint32 paddingB[32 - 24]; /* 24 */ + UINT32 paddingB[32 - 24]; /* 24 */ rdpPointerUpdate* pointer; /* 32 */ rdpPrimaryUpdate* primary; /* 33 */ rdpSecondaryUpdate* secondary; /* 34 */ rdpAltSecUpdate* altsec; /* 35 */ rdpWindowUpdate* window; /* 36 */ - uint32 paddingC[48 - 37]; /* 37 */ + UINT32 paddingC[48 - 37]; /* 37 */ pRefreshRect RefreshRect; /* 48 */ pSuppressOutput SuppressOutput; /* 49 */ - uint32 paddingD[64 - 50]; /* 50 */ + UINT32 paddingD[64 - 50]; /* 50 */ pSurfaceCommand SurfaceCommand; /* 64 */ pSurfaceBits SurfaceBits; /* 65 */ pSurfaceFrameMarker SurfaceFrameMarker; /* 66 */ - uint32 paddingE[80 - 67]; /* 67 */ + UINT32 paddingE[80 - 67]; /* 67 */ /* internal */ - boolean dump_rfx; - boolean play_rfx; + BOOL dump_rfx; + BOOL play_rfx; rdpPcap* pcap_rfx; BITMAP_UPDATE bitmap_update; diff --git a/include/freerdp/utils/args.h b/include/freerdp/utils/args.h index 87155ade7..4da73759b 100644 --- a/include/freerdp/utils/args.h +++ b/include/freerdp/utils/args.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Arguments Parsing * * Copyright 2011 Vic Lee diff --git a/include/freerdp/utils/bitmap.h b/include/freerdp/utils/bitmap.h index cb09474e3..a891be785 100644 --- a/include/freerdp/utils/bitmap.h +++ b/include/freerdp/utils/bitmap.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Bitmap File Format Utils * * Copyright 2011 Marc-Andre Moreau diff --git a/include/freerdp/utils/debug.h b/include/freerdp/utils/debug.h index dfdbe533a..388767fed 100644 --- a/include/freerdp/utils/debug.h +++ b/include/freerdp/utils/debug.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Debug Utils * * Copyright 2011 Marc-Andre Moreau diff --git a/include/freerdp/utils/dsp.h b/include/freerdp/utils/dsp.h index 835956ac8..dc7eca162 100644 --- a/include/freerdp/utils/dsp.h +++ b/include/freerdp/utils/dsp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Digital Sound Processing * * Copyright 2010-2011 Vic Lee @@ -26,15 +26,15 @@ union _ADPCM { struct { - sint16 last_sample[2]; - sint16 last_step[2]; + INT16 last_sample[2]; + INT16 last_step[2]; } ima; struct { - uint8 predictor[2]; - sint32 delta[2]; - sint32 sample1[2]; - sint32 sample2[2]; + BYTE predictor[2]; + INT32 delta[2]; + INT32 sample1[2]; + INT32 sample2[2]; } ms; }; typedef union _ADPCM ADPCM; @@ -42,31 +42,31 @@ typedef union _ADPCM ADPCM; typedef struct _FREERDP_DSP_CONTEXT FREERDP_DSP_CONTEXT; struct _FREERDP_DSP_CONTEXT { - uint8* resampled_buffer; - uint32 resampled_size; - uint32 resampled_frames; - uint32 resampled_maxlength; + BYTE* resampled_buffer; + UINT32 resampled_size; + UINT32 resampled_frames; + UINT32 resampled_maxlength; - uint8* adpcm_buffer; - uint32 adpcm_size; - uint32 adpcm_maxlength; + BYTE* adpcm_buffer; + UINT32 adpcm_size; + UINT32 adpcm_maxlength; ADPCM adpcm; void (*resample)(FREERDP_DSP_CONTEXT* context, - const uint8* src, int bytes_per_sample, - uint32 schan, uint32 srate, int sframes, - uint32 rchan, uint32 rrate); + const BYTE* src, int bytes_per_sample, + UINT32 schan, UINT32 srate, int sframes, + UINT32 rchan, UINT32 rrate); void (*decode_ima_adpcm)(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size); + const BYTE* src, int size, int channels, int block_size); void (*encode_ima_adpcm)(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size); + const BYTE* src, int size, int channels, int block_size); void (*decode_ms_adpcm)(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size); + const BYTE* src, int size, int channels, int block_size); void (*encode_ms_adpcm)(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size); + const BYTE* src, int size, int channels, int block_size); }; FREERDP_API FREERDP_DSP_CONTEXT* freerdp_dsp_context_new(void); diff --git a/include/freerdp/utils/event.h b/include/freerdp/utils/event.h index e0650d203..bf69d5d5c 100644 --- a/include/freerdp/utils/event.h +++ b/include/freerdp/utils/event.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Events * * Copyright 2011 Vic Lee @@ -23,7 +23,7 @@ #include #include -FREERDP_API RDP_EVENT* freerdp_event_new(uint16 event_class, uint16 event_type, +FREERDP_API RDP_EVENT* freerdp_event_new(UINT16 event_class, UINT16 event_type, RDP_EVENT_CALLBACK on_event_free_callback, void* user_data); FREERDP_API void freerdp_event_free(RDP_EVENT* event); diff --git a/include/freerdp/utils/file.h b/include/freerdp/utils/file.h index 7922a9d46..9eee16248 100644 --- a/include/freerdp/utils/file.h +++ b/include/freerdp/utils/file.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * File Utils * * Copyright 2011 Marc-Andre Moreau @@ -25,15 +25,15 @@ #include FREERDP_API void freerdp_mkdir(char* path); -FREERDP_API boolean freerdp_check_file_exists(char* file); +FREERDP_API BOOL freerdp_check_file_exists(char* file); FREERDP_API char* freerdp_get_home_path(rdpSettings* settings); FREERDP_API char* freerdp_get_config_path(rdpSettings* settings); FREERDP_API char* freerdp_get_current_path(rdpSettings* settings); FREERDP_API char* freerdp_construct_path(char* base_path, char* relative_path); FREERDP_API char* freerdp_append_shared_library_suffix(char* file_path); FREERDP_API char* freerdp_get_parent_path(char* base_path, int depth); -FREERDP_API boolean freerdp_path_contains_separator(char* path); -FREERDP_API boolean freerdp_detect_development_mode(rdpSettings* settings); +FREERDP_API BOOL freerdp_path_contains_separator(char* path); +FREERDP_API BOOL freerdp_detect_development_mode(rdpSettings* settings); FREERDP_API void freerdp_detect_paths(rdpSettings* settings); #endif /* __FILE_UTILS_H */ diff --git a/include/freerdp/utils/hexdump.h b/include/freerdp/utils/hexdump.h index 4b0363b95..7485f117e 100644 --- a/include/freerdp/utils/hexdump.h +++ b/include/freerdp/utils/hexdump.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Hex Dump Utils * * Copyright 2011 Marc-Andre Moreau @@ -24,6 +24,6 @@ #define FREERDP_HEXDUMP_LINE_LENGTH 16 -FREERDP_API void freerdp_hexdump(uint8* data, int length); +FREERDP_API void freerdp_hexdump(BYTE* data, int length); #endif /* __UTILS_HEXDUMP_H */ diff --git a/include/freerdp/utils/list.h b/include/freerdp/utils/list.h index de53a100a..ca28e1408 100644 --- a/include/freerdp/utils/list.h +++ b/include/freerdp/utils/list.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Double-linked List Utils * * Copyright 2011 Vic Lee diff --git a/include/freerdp/utils/load_plugin.h b/include/freerdp/utils/load_plugin.h index 6ba2a292d..0cd24a149 100644 --- a/include/freerdp/utils/load_plugin.h +++ b/include/freerdp/utils/load_plugin.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Plugin Loading Utils * * Copyright 2011 Vic Lee @@ -25,11 +25,11 @@ FREERDP_API void* freerdp_open_library(const char* file); FREERDP_API void* freerdp_get_library_symbol(void* library, const char* name); -FREERDP_API boolean freerdp_close_library(void* library); +FREERDP_API BOOL freerdp_close_library(void* library); FREERDP_API void* freerdp_load_library_symbol(const char* file, const char* name); FREERDP_API void* freerdp_load_plugin(const char* name, const char* entry_name); FREERDP_API void* freerdp_load_channel_plugin(rdpSettings* settings, const char* name, const char* entry_name); -FREERDP_API boolean freerdp_register_static_plugin(const char* name, const char* entry_name, void* entry_addr); +FREERDP_API BOOL freerdp_register_static_plugin(const char* name, const char* entry_name, void* entry_addr); FREERDP_API void* freerdp_load_static_plugin(const char* name, const char* entry_name); #endif /* __LOAD_PLUGIN_UTILS_H */ diff --git a/include/freerdp/utils/memory.h b/include/freerdp/utils/memory.h index 0bc548fa1..27f08e75f 100644 --- a/include/freerdp/utils/memory.h +++ b/include/freerdp/utils/memory.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Memory Utils * * Copyright 2009-2011 Jay Sorg @@ -23,15 +23,10 @@ #include #include #include + #include -FREERDP_API void* xmalloc(size_t size); FREERDP_API void* xzalloc(size_t size); -FREERDP_API void* xrealloc(void* ptr, size_t size); -FREERDP_API void xfree(void* ptr); -FREERDP_API char* xstrdup(const char* str); -FREERDP_API char* xstrtoup(const char* str); -FREERDP_API wchar_t* xwcsdup(const wchar_t* wstr); #define xnew(_type) (_type*)xzalloc(sizeof(_type)) diff --git a/include/freerdp/utils/msusb.h b/include/freerdp/utils/msusb.h index 7948d4ece..7df24bd95 100644 --- a/include/freerdp/utils/msusb.h +++ b/include/freerdp/utils/msusb.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -29,52 +29,52 @@ #define zfree(p) do { if (p != NULL) {free(p); p = NULL;} } while (0) /* Data maintenance helper only used in URBDRC */ -#define data_read_uint8(_p, _v) do { _v = \ - *((uint8 *) (_p)); \ +#define data_read_BYTE(_p, _v) do { _v = \ + *((BYTE *) (_p)); \ } while (0) -#define data_read_uint16(_p, _v) do { _v = \ - ((uint16) (*((uint8 *) (_p)))) + \ - ((uint16) (*(((uint8 *) (_p)) + 1)) << 8); \ +#define data_read_UINT16(_p, _v) do { _v = \ + ((UINT16) (*((BYTE *) (_p)))) + \ + ((UINT16) (*(((BYTE *) (_p)) + 1)) << 8); \ } while (0) -#define data_read_uint32(_p, _v) do { _v = \ - (uint32) (*((uint8 *) (_p))) + \ - ((uint32) (*(((uint8 *) (_p)) + 1)) << 8) + \ - ((uint32) (*(((uint8 *) (_p)) + 2)) << 16) + \ - ((uint32) (*(((uint8 *) (_p)) + 3)) << 24); \ +#define data_read_UINT32(_p, _v) do { _v = \ + (UINT32) (*((BYTE *) (_p))) + \ + ((UINT32) (*(((BYTE *) (_p)) + 1)) << 8) + \ + ((UINT32) (*(((BYTE *) (_p)) + 2)) << 16) + \ + ((UINT32) (*(((BYTE *) (_p)) + 3)) << 24); \ } while (0) -#define data_read_uint64(_p, _v) do { _v = \ - (uint64) (*((uint8 *) (_p))) + \ - ((uint64) (*(((uint8 *) (_p)) + 1)) << 8) + \ - ((uint64) (*(((uint8 *) (_p)) + 2)) << 16) + \ - ((uint64) (*(((uint8 *) (_p)) + 3)) << 24) + \ - ((uint64) (*(((uint8 *) (_p)) + 4)) << 32) + \ - ((uint64) (*(((uint8 *) (_p)) + 5)) << 40) + \ - ((uint64) (*(((uint8 *) (_p)) + 6)) << 48) + \ - ((uint64) (*(((uint8 *) (_p)) + 7)) << 56); \ +#define data_read_UINT64(_p, _v) do { _v = \ + (UINT64) (*((BYTE *) (_p))) + \ + ((UINT64) (*(((BYTE *) (_p)) + 1)) << 8) + \ + ((UINT64) (*(((BYTE *) (_p)) + 2)) << 16) + \ + ((UINT64) (*(((BYTE *) (_p)) + 3)) << 24) + \ + ((UINT64) (*(((BYTE *) (_p)) + 4)) << 32) + \ + ((UINT64) (*(((BYTE *) (_p)) + 5)) << 40) + \ + ((UINT64) (*(((BYTE *) (_p)) + 6)) << 48) + \ + ((UINT64) (*(((BYTE *) (_p)) + 7)) << 56); \ } while (0) -#define data_write_uint8(_p, _v) do { \ - *((uint8 *) _p) = (uint8) (_v); \ +#define data_write_BYTE(_p, _v) do { \ + *((BYTE *) _p) = (BYTE) (_v); \ } while (0) -#define data_write_uint16(_p, _v) do { \ - *((uint8 *) _p) = (uint8) (((uint16) (_v)) & 0xff); \ - *(((uint8 *) _p) + 1) = (uint8) ((((uint16) (_v)) >> 8) & 0xff); \ +#define data_write_UINT16(_p, _v) do { \ + *((BYTE *) _p) = (BYTE) (((UINT16) (_v)) & 0xff); \ + *(((BYTE *) _p) + 1) = (BYTE) ((((UINT16) (_v)) >> 8) & 0xff); \ } while (0) -#define data_write_uint32(_p, _v) do { \ - *((uint8 *) _p) = (uint8) (((uint32) (_v)) & 0xff); \ - *(((uint8 *) _p) + 1) = (uint8) ((((uint32) (_v)) >> 8) & 0xff); \ - *(((uint8 *) _p) + 2) = (uint8) ((((uint32) (_v)) >> 16) & 0xff); \ - *(((uint8 *) _p) + 3) = (uint8) ((((uint32) (_v)) >> 24) & 0xff); \ +#define data_write_UINT32(_p, _v) do { \ + *((BYTE *) _p) = (BYTE) (((UINT32) (_v)) & 0xff); \ + *(((BYTE *) _p) + 1) = (BYTE) ((((UINT32) (_v)) >> 8) & 0xff); \ + *(((BYTE *) _p) + 2) = (BYTE) ((((UINT32) (_v)) >> 16) & 0xff); \ + *(((BYTE *) _p) + 3) = (BYTE) ((((UINT32) (_v)) >> 24) & 0xff); \ } while (0) -#define data_write_uint64(_p, _v) do { \ - *((uint8 *) _p) = (uint8) (((uint64) (_v)) & 0xff); \ - *(((uint8 *) _p) + 1) = (uint8) ((((uint64) (_v)) >> 8) & 0xff); \ - *(((uint8 *) _p) + 2) = (uint8) ((((uint64) (_v)) >> 16) & 0xff); \ - *(((uint8 *) _p) + 3) = (uint8) ((((uint64) (_v)) >> 24) & 0xff); \ - *(((uint8 *) _p) + 4) = (uint8) ((((uint64) (_v)) >> 32) & 0xff); \ - *(((uint8 *) _p) + 5) = (uint8) ((((uint64) (_v)) >> 40) & 0xff); \ - *(((uint8 *) _p) + 6) = (uint8) ((((uint64) (_v)) >> 48) & 0xff); \ - *(((uint8 *) _p) + 7) = (uint8) ((((uint64) (_v)) >> 56) & 0xff); \ +#define data_write_UINT64(_p, _v) do { \ + *((BYTE *) _p) = (BYTE) (((UINT64) (_v)) & 0xff); \ + *(((BYTE *) _p) + 1) = (BYTE) ((((UINT64) (_v)) >> 8) & 0xff); \ + *(((BYTE *) _p) + 2) = (BYTE) ((((UINT64) (_v)) >> 16) & 0xff); \ + *(((BYTE *) _p) + 3) = (BYTE) ((((UINT64) (_v)) >> 24) & 0xff); \ + *(((BYTE *) _p) + 4) = (BYTE) ((((UINT64) (_v)) >> 32) & 0xff); \ + *(((BYTE *) _p) + 5) = (BYTE) ((((UINT64) (_v)) >> 40) & 0xff); \ + *(((BYTE *) _p) + 6) = (BYTE) ((((UINT64) (_v)) >> 48) & 0xff); \ + *(((BYTE *) _p) + 7) = (BYTE) ((((UINT64) (_v)) >> 56) & 0xff); \ } while (0) typedef struct _MSUSB_INTERFACE_DESCRIPTOR MSUSB_INTERFACE_DESCRIPTOR; @@ -83,55 +83,55 @@ typedef struct _MSUSB_CONFIG_DESCRIPTOR MSUSB_CONFIG_DESCRIPTOR; struct _MSUSB_PIPE_DESCRIPTOR { - uint16 MaximumPacketSize; - uint32 MaximumTransferSize; - uint32 PipeFlags; - uint32 PipeHandle; - uint8 bEndpointAddress; - uint8 bInterval; - uint8 PipeType; + UINT16 MaximumPacketSize; + UINT32 MaximumTransferSize; + UINT32 PipeFlags; + UINT32 PipeHandle; + BYTE bEndpointAddress; + BYTE bInterval; + BYTE PipeType; int InitCompleted; } __attribute__((packed)); struct _MSUSB_INTERFACE_DESCRIPTOR { - uint16 Length; - uint16 NumberOfPipesExpected; - uint8 InterfaceNumber; - uint8 AlternateSetting; - uint32 NumberOfPipes; - uint32 InterfaceHandle; - uint8 bInterfaceClass; - uint8 bInterfaceSubClass; - uint8 bInterfaceProtocol; + UINT16 Length; + UINT16 NumberOfPipesExpected; + BYTE InterfaceNumber; + BYTE AlternateSetting; + UINT32 NumberOfPipes; + UINT32 InterfaceHandle; + BYTE bInterfaceClass; + BYTE bInterfaceSubClass; + BYTE bInterfaceProtocol; MSUSB_PIPE_DESCRIPTOR ** MsPipes; int InitCompleted; } __attribute__((packed)); struct _MSUSB_CONFIG_DESCRIPTOR { - uint16 wTotalLength; - uint8 bConfigurationValue; - uint32 ConfigurationHandle; - uint32 NumInterfaces; + UINT16 wTotalLength; + BYTE bConfigurationValue; + UINT32 ConfigurationHandle; + UINT32 NumInterfaces; MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces; int InitCompleted; int MsOutSize; } __attribute__((packed)); /* MSUSB_PIPE exported functions */ -void msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, MSUSB_PIPE_DESCRIPTOR** NewMsPipes, uint32 NewNumberOfPipes); +void msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, MSUSB_PIPE_DESCRIPTOR** NewMsPipes, UINT32 NewNumberOfPipes); /* MSUSB_INTERFACE exported functions */ -void msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR* MsConfig, uint8 InterfaceNumber, MSUSB_INTERFACE_DESCRIPTOR* NewMsInterface); -MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_read(uint8* data, uint32 data_size, int* offset); -int msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, uint8* data, int* offset); +void msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR* MsConfig, BYTE InterfaceNumber, MSUSB_INTERFACE_DESCRIPTOR* NewMsInterface); +MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_read(BYTE* data, UINT32 data_size, int* offset); +int msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, BYTE* data, int* offset); /* MSUSB_CONFIG exported functions */ MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_new(); void msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR* MsConfig); -MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_read(uint8* data, uint32 data_size, uint32 NumInterfaces); -int msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR* MsConfg, uint8* data, int * offset); +MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_read(BYTE* data, UINT32 data_size, UINT32 NumInterfaces); +int msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR* MsConfg, BYTE* data, int * offset); void msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR* MsConfg); #endif diff --git a/include/freerdp/utils/passphrase.h b/include/freerdp/utils/passphrase.h index 9dd5e15fd..2ca687a65 100644 --- a/include/freerdp/utils/passphrase.h +++ b/include/freerdp/utils/passphrase.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Passphrase Handling Utils * * Copyright 2011 Shea Levy diff --git a/include/freerdp/utils/pcap.h b/include/freerdp/utils/pcap.h index 147b1f380..ccc8c8cb9 100644 --- a/include/freerdp/utils/pcap.h +++ b/include/freerdp/utils/pcap.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * pcap File Format Utils * * Copyright 2011 Marc-Andre Moreau @@ -25,22 +25,22 @@ struct _pcap_header { - uint32 magic_number; /* magic number */ - uint16 version_major; /* major version number */ - uint16 version_minor; /* minor version number */ - sint32 thiszone; /* GMT to local correction */ - uint32 sigfigs; /* accuracy of timestamps */ - uint32 snaplen; /* max length of captured packets, in octets */ - uint32 network; /* data link type */ + UINT32 magic_number; /* magic number */ + UINT16 version_major; /* major version number */ + UINT16 version_minor; /* minor version number */ + INT32 thiszone; /* GMT to local correction */ + UINT32 sigfigs; /* accuracy of timestamps */ + UINT32 snaplen; /* max length of captured packets, in octets */ + UINT32 network; /* data link type */ }; typedef struct _pcap_header pcap_header; struct _pcap_record_header { - uint32 ts_sec; /* timestamp seconds */ - uint32 ts_usec; /* timestamp microseconds */ - uint32 incl_len; /* number of octets of packet saved in file */ - uint32 orig_len; /* actual length of packet */ + UINT32 ts_sec; /* timestamp seconds */ + UINT32 ts_usec; /* timestamp microseconds */ + UINT32 incl_len; /* number of octets of packet saved in file */ + UINT32 orig_len; /* actual length of packet */ }; typedef struct _pcap_record_header pcap_record_header; @@ -50,7 +50,7 @@ struct _pcap_record { pcap_record_header header; void* data; - uint32 length; + UINT32 length; pcap_record* next; }; @@ -58,7 +58,7 @@ struct rdp_pcap { FILE* fp; char* name; - boolean write; + BOOL write; int file_size; int record_count; pcap_header header; @@ -68,14 +68,14 @@ struct rdp_pcap }; typedef struct rdp_pcap rdpPcap; -FREERDP_API rdpPcap* pcap_open(char* name, boolean write); +FREERDP_API rdpPcap* pcap_open(char* name, BOOL write); FREERDP_API void pcap_close(rdpPcap* pcap); -FREERDP_API void pcap_add_record(rdpPcap* pcap, void* data, uint32 length); -FREERDP_API boolean pcap_has_next_record(rdpPcap* pcap); -FREERDP_API boolean pcap_get_next_record(rdpPcap* pcap, pcap_record* record); -FREERDP_API boolean pcap_get_next_record_header(rdpPcap* pcap, pcap_record* record); -FREERDP_API boolean pcap_get_next_record_content(rdpPcap* pcap, pcap_record* record); +FREERDP_API void pcap_add_record(rdpPcap* pcap, void* data, UINT32 length); +FREERDP_API BOOL pcap_has_next_record(rdpPcap* pcap); +FREERDP_API BOOL pcap_get_next_record(rdpPcap* pcap, pcap_record* record); +FREERDP_API BOOL pcap_get_next_record_header(rdpPcap* pcap, pcap_record* record); +FREERDP_API BOOL pcap_get_next_record_content(rdpPcap* pcap, pcap_record* record); FREERDP_API void pcap_flush(rdpPcap* pcap); #endif /* __UTILS_PCAP_H */ diff --git a/include/freerdp/utils/print.h b/include/freerdp/utils/print.h index c338412b2..8c35b62ae 100644 --- a/include/freerdp/utils/print.h +++ b/include/freerdp/utils/print.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Print Utils * * Copyright 2011 Marc-Andre Moreau diff --git a/include/freerdp/utils/profiler.h b/include/freerdp/utils/profiler.h index bdeccdd1b..b7fb6983e 100644 --- a/include/freerdp/utils/profiler.h +++ b/include/freerdp/utils/profiler.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Profiler Utils * * Copyright 2011 Stephen Erisman diff --git a/include/freerdp/utils/rail.h b/include/freerdp/utils/rail.h index 0db550b4c..d37e3de35 100644 --- a/include/freerdp/utils/rail.h +++ b/include/freerdp/utils/rail.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) Utils * * Copyright 2011 Marc-Andre Moreau @@ -24,12 +24,12 @@ #include #include -FREERDP_API void rail_unicode_string_alloc(RAIL_UNICODE_STRING* unicode_string, uint16 cbString); +FREERDP_API void rail_unicode_string_alloc(RAIL_UNICODE_STRING* unicode_string, UINT16 cbString); FREERDP_API void rail_unicode_string_free(RAIL_UNICODE_STRING* unicode_string); FREERDP_API void rail_read_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string); FREERDP_API void rail_write_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string); FREERDP_API void rail_write_unicode_string_value(STREAM* s, RAIL_UNICODE_STRING* unicode_string); -FREERDP_API void* rail_clone_order(uint32 event_type, void* order); -FREERDP_API void rail_free_cloned_order(uint32 event_type, void* order); +FREERDP_API void* rail_clone_order(UINT32 event_type, void* order); +FREERDP_API void rail_free_cloned_order(UINT32 event_type, void* order); #endif /* __RAIL_UTILS_H */ diff --git a/include/freerdp/utils/signal.h b/include/freerdp/utils/signal.h index eb54c3f7d..5891bb00c 100644 --- a/include/freerdp/utils/signal.h +++ b/include/freerdp/utils/signal.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Signal handling * * Copyright 2011 Shea Levy diff --git a/include/freerdp/utils/sleep.h b/include/freerdp/utils/sleep.h index a3650cc1d..807a9a2f2 100644 --- a/include/freerdp/utils/sleep.h +++ b/include/freerdp/utils/sleep.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Sleep Utils * * Copyright 2011 Marc-Andre Moreau @@ -23,7 +23,7 @@ #include #include -FREERDP_API void freerdp_sleep(uint32 seconds); -FREERDP_API void freerdp_usleep(uint32 useconds); +FREERDP_API void freerdp_sleep(UINT32 seconds); +FREERDP_API void freerdp_usleep(UINT32 useconds); #endif /* __SLEEP_UTILS_H */ diff --git a/include/freerdp/utils/stopwatch.h b/include/freerdp/utils/stopwatch.h index 58d7be5e1..1ee50471b 100644 --- a/include/freerdp/utils/stopwatch.h +++ b/include/freerdp/utils/stopwatch.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Stopwatch Utils * * Copyright 2011 Stephen Erisman @@ -42,6 +42,6 @@ FREERDP_API void stopwatch_stop(STOPWATCH* stopwatch); FREERDP_API void stopwatch_reset(STOPWATCH* stopwatch); FREERDP_API double stopwatch_get_elapsed_time_in_seconds(STOPWATCH* stopwatch); -FREERDP_API void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, uint32* sec, uint32* usec); +FREERDP_API void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, UINT32* sec, UINT32* usec); #endif /* __UTILS_STOPWATCH_H */ diff --git a/include/freerdp/utils/stream.h b/include/freerdp/utils/stream.h index f6944de63..626ce3120 100644 --- a/include/freerdp/utils/stream.h +++ b/include/freerdp/utils/stream.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Stream Utils * * Copyright 2009-2011 Jay Sorg @@ -28,8 +28,8 @@ struct _STREAM { int size; - uint8* p; - uint8* data; + BYTE* p; + BYTE* data; }; typedef struct _STREAM STREAM; @@ -62,51 +62,51 @@ FREERDP_API void stream_extend(STREAM* stream, int request_size); #define stream_get_size(_s) (_s->size) #define stream_get_left(_s) (_s->size - (_s->p - _s->data)) -#define stream_read_uint8(_s, _v) do { _v = *_s->p++; } while (0) -#define stream_read_uint16(_s, _v) do { _v = \ - (uint16)(*_s->p) + \ - (uint16)(((uint16)(*(_s->p + 1))) << 8); \ +#define stream_read_BYTE(_s, _v) do { _v = *_s->p++; } while (0) +#define stream_read_UINT16(_s, _v) do { _v = \ + (UINT16)(*_s->p) + \ + (UINT16)(((UINT16)(*(_s->p + 1))) << 8); \ _s->p += 2; } while (0) -#define stream_read_uint32(_s, _v) do { _v = \ - (uint32)(*_s->p) + \ - (((uint32)(*(_s->p + 1))) << 8) + \ - (((uint32)(*(_s->p + 2))) << 16) + \ - (((uint32)(*(_s->p + 3))) << 24); \ +#define stream_read_UINT32(_s, _v) do { _v = \ + (UINT32)(*_s->p) + \ + (((UINT32)(*(_s->p + 1))) << 8) + \ + (((UINT32)(*(_s->p + 2))) << 16) + \ + (((UINT32)(*(_s->p + 3))) << 24); \ _s->p += 4; } while (0) -#define stream_read_uint64(_s, _v) do { _v = \ - (uint64)(*_s->p) + \ - (((uint64)(*(_s->p + 1))) << 8) + \ - (((uint64)(*(_s->p + 2))) << 16) + \ - (((uint64)(*(_s->p + 3))) << 24) + \ - (((uint64)(*(_s->p + 4))) << 32) + \ - (((uint64)(*(_s->p + 5))) << 40) + \ - (((uint64)(*(_s->p + 6))) << 48) + \ - (((uint64)(*(_s->p + 7))) << 56); \ +#define stream_read_UINT64(_s, _v) do { _v = \ + (UINT64)(*_s->p) + \ + (((UINT64)(*(_s->p + 1))) << 8) + \ + (((UINT64)(*(_s->p + 2))) << 16) + \ + (((UINT64)(*(_s->p + 3))) << 24) + \ + (((UINT64)(*(_s->p + 4))) << 32) + \ + (((UINT64)(*(_s->p + 5))) << 40) + \ + (((UINT64)(*(_s->p + 6))) << 48) + \ + (((UINT64)(*(_s->p + 7))) << 56); \ _s->p += 8; } while (0) #define stream_read(_s, _b, _n) do { \ memcpy(_b, (_s->p), (_n)); \ _s->p += (_n); \ } while (0) -#define stream_write_uint8(_s, _v) do { \ - *_s->p++ = (uint8)(_v); } while (0) -#define stream_write_uint16(_s, _v) do { \ +#define stream_write_BYTE(_s, _v) do { \ + *_s->p++ = (BYTE)(_v); } while (0) +#define stream_write_UINT16(_s, _v) do { \ *_s->p++ = (_v) & 0xFF; \ *_s->p++ = ((_v) >> 8) & 0xFF; } while (0) -#define stream_write_uint32(_s, _v) do { \ +#define stream_write_UINT32(_s, _v) do { \ *_s->p++ = (_v) & 0xFF; \ *_s->p++ = ((_v) >> 8) & 0xFF; \ *_s->p++ = ((_v) >> 16) & 0xFF; \ *_s->p++ = ((_v) >> 24) & 0xFF; } while (0) -#define stream_write_uint64(_s, _v) do { \ - *_s->p++ = (uint64)(_v) & 0xFF; \ - *_s->p++ = ((uint64)(_v) >> 8) & 0xFF; \ - *_s->p++ = ((uint64)(_v) >> 16) & 0xFF; \ - *_s->p++ = ((uint64)(_v) >> 24) & 0xFF; \ - *_s->p++ = ((uint64)(_v) >> 32) & 0xFF; \ - *_s->p++ = ((uint64)(_v) >> 40) & 0xFF; \ - *_s->p++ = ((uint64)(_v) >> 48) & 0xFF; \ - *_s->p++ = ((uint64)(_v) >> 56) & 0xFF; } while (0) +#define stream_write_UINT64(_s, _v) do { \ + *_s->p++ = (UINT64)(_v) & 0xFF; \ + *_s->p++ = ((UINT64)(_v) >> 8) & 0xFF; \ + *_s->p++ = ((UINT64)(_v) >> 16) & 0xFF; \ + *_s->p++ = ((UINT64)(_v) >> 24) & 0xFF; \ + *_s->p++ = ((UINT64)(_v) >> 32) & 0xFF; \ + *_s->p++ = ((UINT64)(_v) >> 40) & 0xFF; \ + *_s->p++ = ((UINT64)(_v) >> 48) & 0xFF; \ + *_s->p++ = ((UINT64)(_v) >> 56) & 0xFF; } while (0) #define stream_write(_s, _b, _n) do { \ memcpy(_s->p, (_b), (_n)); \ _s->p += (_n); \ @@ -120,50 +120,50 @@ FREERDP_API void stream_extend(STREAM* stream, int request_size); _s->p += (_n); \ } while (0) -#define stream_peek_uint8(_s, _v) do { _v = *_s->p; } while (0) -#define stream_peek_uint16(_s, _v) do { _v = \ - (uint16)(*_s->p) + \ - (((uint16)(*(_s->p + 1))) << 8); \ +#define stream_peek_BYTE(_s, _v) do { _v = *_s->p; } while (0) +#define stream_peek_UINT16(_s, _v) do { _v = \ + (UINT16)(*_s->p) + \ + (((UINT16)(*(_s->p + 1))) << 8); \ } while (0) -#define stream_peek_uint32(_s, _v) do { _v = \ - (uint32)(*_s->p) + \ - (((uint32)(*(_s->p + 1))) << 8) + \ - (((uint32)(*(_s->p + 2))) << 16) + \ - (((uint32)(*(_s->p + 3))) << 24); \ +#define stream_peek_UINT32(_s, _v) do { _v = \ + (UINT32)(*_s->p) + \ + (((UINT32)(*(_s->p + 1))) << 8) + \ + (((UINT32)(*(_s->p + 2))) << 16) + \ + (((UINT32)(*(_s->p + 3))) << 24); \ } while (0) -#define stream_peek_uint64(_s, _v) do { _v = \ - (uint64)(*_s->p) + \ - (((uint64)(*(_s->p + 1))) << 8) + \ - (((uint64)(*(_s->p + 2))) << 16) + \ - (((uint64)(*(_s->p + 3))) << 24) + \ - (((uint64)(*(_s->p + 4))) << 32) + \ - (((uint64)(*(_s->p + 5))) << 40) + \ - (((uint64)(*(_s->p + 6))) << 48) + \ - (((uint64)(*(_s->p + 7))) << 56); \ +#define stream_peek_UINT64(_s, _v) do { _v = \ + (UINT64)(*_s->p) + \ + (((UINT64)(*(_s->p + 1))) << 8) + \ + (((UINT64)(*(_s->p + 2))) << 16) + \ + (((UINT64)(*(_s->p + 3))) << 24) + \ + (((UINT64)(*(_s->p + 4))) << 32) + \ + (((UINT64)(*(_s->p + 5))) << 40) + \ + (((UINT64)(*(_s->p + 6))) << 48) + \ + (((UINT64)(*(_s->p + 7))) << 56); \ } while (0) -#define stream_seek_uint8(_s) stream_seek(_s, 1) -#define stream_seek_uint16(_s) stream_seek(_s, 2) -#define stream_seek_uint32(_s) stream_seek(_s, 4) -#define stream_seek_uint64(_s) stream_seek(_s, 8) +#define stream_seek_BYTE(_s) stream_seek(_s, 1) +#define stream_seek_UINT16(_s) stream_seek(_s, 2) +#define stream_seek_UINT32(_s) stream_seek(_s, 4) +#define stream_seek_UINT64(_s) stream_seek(_s, 8) -#define stream_read_uint16_be(_s, _v) do { _v = \ - (((uint16)(*_s->p)) << 8) + \ - (uint16)(*(_s->p + 1)); \ +#define stream_read_UINT16_be(_s, _v) do { _v = \ + (((UINT16)(*_s->p)) << 8) + \ + (UINT16)(*(_s->p + 1)); \ _s->p += 2; } while (0) -#define stream_read_uint32_be(_s, _v) do { _v = \ - (((uint32)(*(_s->p))) << 24) + \ - (((uint32)(*(_s->p + 1))) << 16) + \ - (((uint32)(*(_s->p + 2))) << 8) + \ - (((uint32)(*(_s->p + 3)))); \ +#define stream_read_UINT32_be(_s, _v) do { _v = \ + (((UINT32)(*(_s->p))) << 24) + \ + (((UINT32)(*(_s->p + 1))) << 16) + \ + (((UINT32)(*(_s->p + 2))) << 8) + \ + (((UINT32)(*(_s->p + 3)))); \ _s->p += 4; } while (0) -#define stream_write_uint16_be(_s, _v) do { \ +#define stream_write_UINT16_be(_s, _v) do { \ *_s->p++ = ((_v) >> 8) & 0xFF; \ *_s->p++ = (_v) & 0xFF; } while (0) -#define stream_write_uint32_be(_s, _v) do { \ - stream_write_uint16_be(_s, ((_v) >> 16 & 0xFFFF)); \ - stream_write_uint16_be(_s, ((_v) & 0xFFFF)); \ +#define stream_write_UINT32_be(_s, _v) do { \ + stream_write_UINT16_be(_s, ((_v) >> 16 & 0xFFFF)); \ + stream_write_UINT16_be(_s, ((_v) & 0xFFFF)); \ } while (0) #define stream_copy(_dst, _src, _n) do { \ diff --git a/include/freerdp/utils/string.h b/include/freerdp/utils/string.h index 4a67d0ea6..48b65d70a 100644 --- a/include/freerdp/utils/string.h +++ b/include/freerdp/utils/string.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * String Utils * * Copyright 2011 Marc-Andre Moreau @@ -28,7 +28,7 @@ struct rdp_string { char* ascii; char* unicode; - uint32 length; + UINT32 length; }; typedef struct rdp_string rdpString; diff --git a/include/freerdp/utils/svc_plugin.h b/include/freerdp/utils/svc_plugin.h index 7c2a06131..005c6874d 100644 --- a/include/freerdp/utils/svc_plugin.h +++ b/include/freerdp/utils/svc_plugin.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Static Virtual Channel Interface * * Copyright 2009-2011 Jay Sorg @@ -60,7 +60,7 @@ FREERDP_API int svc_plugin_send_event(rdpSvcPlugin* plugin, RDP_EVENT* event); #define DEBUG_SVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) #endif -#ifdef WITH_STATIC_PLUGINS +#ifdef STATIC_CHANNELS #define DEFINE_SVC_PLUGIN_ENTRY(_prefix) int _prefix##_entry(PCHANNEL_ENTRY_POINTS pEntryPoints) #define DEFINE_DEV_PLUGIN_ENTRY(_prefix) int _prefix##_entry(PCHANNEL_ENTRY_POINTS pEntryPoints) #define REGISTER_SVC_PLUGIN_ENTRY(_prefix) freerdp_register_static_plugin(#_prefix, "VirtualChannelEntry", _prefix##_entry) diff --git a/include/freerdp/utils/tcp.h b/include/freerdp/utils/tcp.h index 5626c12eb..6517ad425 100644 --- a/include/freerdp/utils/tcp.h +++ b/include/freerdp/utils/tcp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * TCP Utils * * Copyright 2012 Marc-Andre Moreau @@ -24,11 +24,11 @@ #include FREERDP_API int freerdp_tcp_connect(const char* hostname, int port); -FREERDP_API int freerdp_tcp_read(int sockfd, uint8* data, int length); -FREERDP_API int freerdp_tcp_write(int sockfd, uint8* data, int length); +FREERDP_API int freerdp_tcp_read(int sockfd, BYTE* data, int length); +FREERDP_API int freerdp_tcp_write(int sockfd, BYTE* data, int length); FREERDP_API int freerdp_tcp_disconnect(int sockfd); -FREERDP_API int freerdp_tcp_set_no_delay(int sockfd, boolean no_delay); +FREERDP_API int freerdp_tcp_set_no_delay(int sockfd, BOOL no_delay); FREERDP_API int freerdp_wsa_startup(); FREERDP_API int freerdp_wsa_cleanup(); diff --git a/include/freerdp/utils/thread.h b/include/freerdp/utils/thread.h index 16ef39e2b..d8af74021 100644 --- a/include/freerdp/utils/thread.h +++ b/include/freerdp/utils/thread.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Thread Utils * * Copyright 2011 Vic Lee diff --git a/include/freerdp/utils/time.h b/include/freerdp/utils/time.h index 2b676c9f1..99230ca1a 100644 --- a/include/freerdp/utils/time.h +++ b/include/freerdp/utils/time.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Time Utils * * Copyright 2012 Marc-Andre Moreau @@ -30,9 +30,9 @@ #include #include -FREERDP_API uint64 freerdp_windows_gmtime(); -FREERDP_API uint64 freerdp_get_windows_time_from_unix_time(time_t unix_time); -FREERDP_API time_t freerdp_get_unix_time_from_windows_time(uint64 windows_time); +FREERDP_API UINT64 freerdp_windows_gmtime(); +FREERDP_API UINT64 freerdp_get_windows_time_from_unix_time(time_t unix_time); +FREERDP_API time_t freerdp_get_unix_time_from_windows_time(UINT64 windows_time); FREERDP_API time_t freerdp_get_unix_time_from_generalized_time(const char* generalized_time); #endif /* FREERDP_TIME_UTILS_H */ diff --git a/include/freerdp/utils/uds.h b/include/freerdp/utils/uds.h index ea0c781b1..2a1a9d0c7 100644 --- a/include/freerdp/utils/uds.h +++ b/include/freerdp/utils/uds.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Unix Domain Socket Utils * * Copyright 2012 Vic Lee diff --git a/include/freerdp/utils/unicode.h b/include/freerdp/utils/unicode.h index 81cece1f5..3907af8d4 100644 --- a/include/freerdp/utils/unicode.h +++ b/include/freerdp/utils/unicode.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Unicode Utils * * Copyright 2011 Marc-Andre Moreau diff --git a/include/freerdp/utils/wait_obj.h b/include/freerdp/utils/wait_obj.h index a202a25df..5bd8e3d5a 100644 --- a/include/freerdp/utils/wait_obj.h +++ b/include/freerdp/utils/wait_obj.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Virtual Channel Manager * * Copyright 2009-2011 Jay Sorg diff --git a/include/freerdp/window.h b/include/freerdp/window.h index 3338e1757..c02d2febf 100644 --- a/include/freerdp/window.h +++ b/include/freerdp/window.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Window Alternate Secondary Drawing Orders Interface API * * Copyright 2011 Marc-Andre Moreau @@ -122,39 +122,39 @@ struct _WINDOW_ORDER_INFO { - uint32 windowId; - uint32 fieldFlags; - uint32 notifyIconId; + UINT32 windowId; + UINT32 fieldFlags; + UINT32 notifyIconId; }; typedef struct _WINDOW_ORDER_INFO WINDOW_ORDER_INFO; struct _ICON_INFO { - uint32 cacheEntry; - uint32 cacheId; - uint32 bpp; - uint32 width; - uint32 height; - uint32 cbColorTable; - uint32 cbBitsMask; - uint32 cbBitsColor; - uint8* bitsMask; - uint8* colorTable; - uint8* bitsColor; + UINT32 cacheEntry; + UINT32 cacheId; + UINT32 bpp; + UINT32 width; + UINT32 height; + UINT32 cbColorTable; + UINT32 cbBitsMask; + UINT32 cbBitsColor; + BYTE* bitsMask; + BYTE* colorTable; + BYTE* bitsColor; }; typedef struct _ICON_INFO ICON_INFO; struct _CACHED_ICON_INFO { - uint32 cacheEntry; - uint32 cacheId; + UINT32 cacheEntry; + UINT32 cacheId; }; typedef struct _CACHED_ICON_INFO CACHED_ICON_INFO; struct _NOTIFY_ICON_INFOTIP { - uint32 timeout; - uint32 flags; + UINT32 timeout; + UINT32 flags; RAIL_UNICODE_STRING text; RAIL_UNICODE_STRING title; }; @@ -162,28 +162,28 @@ typedef struct _NOTIFY_ICON_INFOTIP NOTIFY_ICON_INFOTIP; struct _WINDOW_STATE_ORDER { - uint32 ownerWindowId; - uint32 style; - uint32 extendedStyle; - uint32 showState; + UINT32 ownerWindowId; + UINT32 style; + UINT32 extendedStyle; + UINT32 showState; RAIL_UNICODE_STRING titleInfo; - uint32 clientOffsetX; - uint32 clientOffsetY; - uint32 clientAreaWidth; - uint32 clientAreaHeight; - uint32 RPContent; - uint32 rootParentHandle; - uint32 windowOffsetX; - uint32 windowOffsetY; - uint32 windowClientDeltaX; - uint32 windowClientDeltaY; - uint32 windowWidth; - uint32 windowHeight; - uint32 numWindowRects; + UINT32 clientOffsetX; + UINT32 clientOffsetY; + UINT32 clientAreaWidth; + UINT32 clientAreaHeight; + UINT32 RPContent; + UINT32 rootParentHandle; + UINT32 windowOffsetX; + UINT32 windowOffsetY; + UINT32 windowClientDeltaX; + UINT32 windowClientDeltaY; + UINT32 windowWidth; + UINT32 windowHeight; + UINT32 numWindowRects; RECTANGLE_16* windowRects; - uint32 visibleOffsetX; - uint32 visibleOffsetY; - uint32 numVisibilityRects; + UINT32 visibleOffsetX; + UINT32 visibleOffsetY; + UINT32 numVisibilityRects; RECTANGLE_16* visibilityRects; }; typedef struct _WINDOW_STATE_ORDER WINDOW_STATE_ORDER; @@ -202,10 +202,10 @@ typedef struct _WINDOW_CACHED_ICON_ORDER WINDOW_CACHED_ICON_ORDER; struct _NOTIFY_ICON_STATE_ORDER { - uint32 version; + UINT32 version; RAIL_UNICODE_STRING toolTip; NOTIFY_ICON_INFOTIP infoTip; - uint32 state; + UINT32 state; ICON_INFO icon; CACHED_ICON_INFO cachedIcon; }; @@ -213,9 +213,9 @@ typedef struct _NOTIFY_ICON_STATE_ORDER NOTIFY_ICON_STATE_ORDER; struct _MONITORED_DESKTOP_ORDER { - uint32 activeWindowId; - uint32 numWindowIds; - uint32* windowIds; + UINT32 activeWindowId; + UINT32 numWindowIds; + UINT32* windowIds; }; typedef struct _MONITORED_DESKTOP_ORDER MONITORED_DESKTOP_ORDER; @@ -233,7 +233,7 @@ typedef void (*pNonMonitoredDesktop)(rdpContext* context, WINDOW_ORDER_INFO* ord struct rdp_window_update { rdpContext* context; /* 0 */ - uint32 paddingA[16 - 1]; /* 1 */ + UINT32 paddingA[16 - 1]; /* 1 */ pWindowCreate WindowCreate; /* 16 */ pWindowUpdate WindowUpdate; /* 17 */ @@ -245,7 +245,7 @@ struct rdp_window_update pNotifyIconDelete NotifyIconDelete; /* 23 */ pMonitoredDesktop MonitoredDesktop; /* 24 */ pNonMonitoredDesktop NonMonitoredDesktop; /* 25 */ - uint32 paddingB[32 - 26]; /* 26 */ + UINT32 paddingB[32 - 26]; /* 26 */ /* internal */ diff --git a/keymaps/CMakeLists.txt b/keymaps/CMakeLists.txt index 281052a53..75a6806a0 100644 --- a/keymaps/CMakeLists.txt +++ b/keymaps/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # keymaps cmake build script # # Copyright 2011 O.S. Systems Software Ltda. diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index 20a46bc9b..c6ddfc2e6 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,36 +15,41 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(WITH_MONOLITHIC_BUILD) +set(MODULE_NAME "freerdp") +set(MODULE_PREFIX "FREERDP") + +if(MONOLITHIC_BUILD) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -add_subdirectory(utils) -add_subdirectory(gdi) -add_subdirectory(rail) -add_subdirectory(cache) -add_subdirectory(codec) -add_subdirectory(crypto) -add_subdirectory(channels) -add_subdirectory(locale) -add_subdirectory(core) +set(${MODULE_PREFIX}_SUBMODULES + utils + gdi + rail + cache + codec + crypto + channels + locale + core) -if(WITH_MONOLITHIC_BUILD) - add_library(freerdp - $ - $ - $ - $ - $ - $ - $ - $ - $) +foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) + add_subdirectory(${${MODULE_PREFIX}_SUBMODULE}) +endforeach() + +if(MONOLITHIC_BUILD) - set_target_properties(freerdp PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") + foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) + set(${MODULE_PREFIX}_OBJECTS ${${MODULE_PREFIX}_OBJECTS} "$") + endforeach() - target_link_libraries(freerdp ${FREERDP_LIBS}) - install(TARGETS freerdp DESTINATION ${CMAKE_INSTALL_LIBDIR}) + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_OBJECTS}) + + set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") + + target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") endif() - - diff --git a/libfreerdp/cache/CMakeLists.txt b/libfreerdp/cache/CMakeLists.txt index 0cc624659..f0d726452 100644 --- a/libfreerdp/cache/CMakeLists.txt +++ b/libfreerdp/cache/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-cache cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -28,7 +28,7 @@ set(${MODULE_PREFIX}_SRCS glyph.c cache.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -36,7 +36,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} @@ -47,4 +47,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/cache/bitmap.c b/libfreerdp/cache/bitmap.c index 0d52c2f8d..708a316aa 100644 --- a/libfreerdp/cache/bitmap.c +++ b/libfreerdp/cache/bitmap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Bitmap Cache V2 * * Copyright 2011 Marc-Andre Moreau @@ -38,7 +38,7 @@ void update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) if (memblt->cacheId == 0xFF) bitmap = offscreen_cache_get(cache->offscreen, memblt->cacheIndex); else - bitmap = bitmap_cache_get(cache->bitmap, (uint8) memblt->cacheId, memblt->cacheIndex); + bitmap = bitmap_cache_get(cache->bitmap, (BYTE) memblt->cacheId, memblt->cacheIndex); memblt->bitmap = bitmap; IFCALL(cache->bitmap->MemBlt, context, memblt); @@ -46,7 +46,7 @@ void update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) { - uint8 style; + BYTE style; rdpBitmap* bitmap; rdpCache* cache = context->cache; rdpBrush* brush = &mem3blt->brush; @@ -54,7 +54,7 @@ void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) if (mem3blt->cacheId == 0xFF) bitmap = offscreen_cache_get(cache->offscreen, mem3blt->cacheIndex); else - bitmap = bitmap_cache_get(cache->bitmap, (uint8) mem3blt->cacheId, mem3blt->cacheIndex); + bitmap = bitmap_cache_get(cache->bitmap, (BYTE) mem3blt->cacheId, mem3blt->cacheIndex); style = brush->style; @@ -144,7 +144,7 @@ void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cach bitmap->Decompress(context, bitmap, bitmapData->data, bitmap->width, bitmap->height, - bitmapData->bpp, bitmapData->length, true, + bitmapData->bpp, bitmapData->length, TRUE, bitmapData->codecID); bitmap->New(context, bitmap); @@ -162,14 +162,14 @@ void update_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap_update) int i; rdpBitmap* bitmap; BITMAP_DATA* bitmap_data; - boolean reused = true; + BOOL reused = TRUE; rdpCache* cache = context->cache; if (cache->bitmap->bitmap == NULL) { cache->bitmap->bitmap = Bitmap_Alloc(context); - cache->bitmap->bitmap->ephemeral = true; - reused = false; + cache->bitmap->bitmap->ephemeral = TRUE; + reused = FALSE; } bitmap = cache->bitmap->bitmap; @@ -196,7 +196,7 @@ void update_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap_update) if (reused) bitmap->Free(context, bitmap); else - reused = true; + reused = TRUE; bitmap->New(context, bitmap); @@ -204,7 +204,7 @@ void update_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap_update) } } -rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmap_cache, uint32 id, uint32 index) +rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmap_cache, UINT32 id, UINT32 index) { rdpBitmap* bitmap; @@ -229,7 +229,7 @@ rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmap_cache, uint32 id, uint32 inde return bitmap; } -void bitmap_cache_put(rdpBitmapCache* bitmap_cache, uint32 id, uint32 index, rdpBitmap* bitmap) +void bitmap_cache_put(rdpBitmapCache* bitmap_cache, UINT32 id, UINT32 index, rdpBitmap* bitmap) { if (id > bitmap_cache->maxCells) { @@ -282,18 +282,18 @@ rdpBitmapCache* bitmap_cache_new(rdpSettings* settings) bitmap_cache->maxCells = 5; - settings->bitmap_cache = false; + settings->bitmap_cache = FALSE; settings->bitmapCacheV2NumCells = 5; settings->bitmapCacheV2CellInfo[0].numEntries = 600; - settings->bitmapCacheV2CellInfo[0].persistent = false; + settings->bitmapCacheV2CellInfo[0].persistent = FALSE; settings->bitmapCacheV2CellInfo[1].numEntries = 600; - settings->bitmapCacheV2CellInfo[1].persistent = false; + settings->bitmapCacheV2CellInfo[1].persistent = FALSE; settings->bitmapCacheV2CellInfo[2].numEntries = 2048; - settings->bitmapCacheV2CellInfo[2].persistent = false; + settings->bitmapCacheV2CellInfo[2].persistent = FALSE; settings->bitmapCacheV2CellInfo[3].numEntries = 4096; - settings->bitmapCacheV2CellInfo[3].persistent = false; + settings->bitmapCacheV2CellInfo[3].persistent = FALSE; settings->bitmapCacheV2CellInfo[4].numEntries = 2048; - settings->bitmapCacheV2CellInfo[4].persistent = false; + settings->bitmapCacheV2CellInfo[4].persistent = FALSE; bitmap_cache->cells = (BITMAP_V2_CELL*) xzalloc(sizeof(BITMAP_V2_CELL) * bitmap_cache->maxCells); @@ -327,13 +327,13 @@ void bitmap_cache_free(rdpBitmapCache* bitmap_cache) } } - xfree(bitmap_cache->cells[i].entries); + free(bitmap_cache->cells[i].entries); } if (bitmap_cache->bitmap != NULL) Bitmap_Free(bitmap_cache->context, bitmap_cache->bitmap); - xfree(bitmap_cache->cells); - xfree(bitmap_cache); + free(bitmap_cache->cells); + free(bitmap_cache); } } diff --git a/libfreerdp/cache/brush.c b/libfreerdp/cache/brush.c index 30cebd588..f3fd4fbb2 100644 --- a/libfreerdp/cache/brush.c +++ b/libfreerdp/cache/brush.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Brush Cache * * Copyright 2011 Marc-Andre Moreau @@ -32,7 +32,7 @@ void update_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) { - uint8 style; + BYTE style; rdpBrush* brush = &patblt->brush; rdpCache* cache = context->cache; @@ -56,7 +56,7 @@ void update_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc) void update_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) { - uint8 style; + BYTE style; rdpBrush* brush = &polygon_cb->brush; rdpCache* cache = context->cache; @@ -78,7 +78,7 @@ void update_gdi_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush) brush_cache_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp); } -void* brush_cache_get(rdpBrushCache* brush, uint32 index, uint32* bpp) +void* brush_cache_get(rdpBrushCache* brush, UINT32 index, UINT32* bpp) { void* entry; @@ -114,7 +114,7 @@ void* brush_cache_get(rdpBrushCache* brush, uint32 index, uint32* bpp) return entry; } -void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp) +void brush_cache_put(rdpBrushCache* brush, UINT32 index, void* entry, UINT32 bpp) { void* prevEntry; @@ -129,7 +129,7 @@ void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp prevEntry = brush->monoEntries[index].entry; if (prevEntry != NULL) - xfree(prevEntry); + free(prevEntry); brush->monoEntries[index].bpp = bpp; brush->monoEntries[index].entry = entry; @@ -145,7 +145,7 @@ void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp prevEntry = brush->entries[index].entry; if (prevEntry != NULL) - xfree(prevEntry); + free(prevEntry); brush->entries[index].bpp = bpp; brush->entries[index].entry = entry; @@ -197,10 +197,10 @@ void brush_cache_free(rdpBrushCache* brush) for (i = 0; i < (int) brush->maxEntries; i++) { if (brush->entries[i].entry != NULL) - xfree(brush->entries[i].entry); + free(brush->entries[i].entry); } - xfree(brush->entries); + free(brush->entries); } if (brush->monoEntries != NULL) @@ -208,12 +208,12 @@ void brush_cache_free(rdpBrushCache* brush) for (i = 0; i < (int) brush->maxMonoEntries; i++) { if (brush->monoEntries[i].entry != NULL) - xfree(brush->monoEntries[i].entry); + free(brush->monoEntries[i].entry); } - xfree(brush->monoEntries); + free(brush->monoEntries); } - xfree(brush); + free(brush); } } diff --git a/libfreerdp/cache/cache.c b/libfreerdp/cache/cache.c index 19a5ae337..f2f1a4a70 100644 --- a/libfreerdp/cache/cache.c +++ b/libfreerdp/cache/cache.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Caches * * Copyright 2011 Marc-Andre Moreau @@ -58,6 +58,6 @@ void cache_free(rdpCache* cache) offscreen_cache_free(cache->offscreen); palette_cache_free(cache->palette); nine_grid_cache_free(cache->nine_grid); - xfree(cache); + free(cache); } } diff --git a/libfreerdp/cache/glyph.c b/libfreerdp/cache/glyph.c index 052afdbc3..eff5573c8 100644 --- a/libfreerdp/cache/glyph.c +++ b/libfreerdp/cache/glyph.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Glyph Cache * * Copyright 2011 Marc-Andre Moreau @@ -29,12 +29,12 @@ #include -void update_process_glyph(rdpContext* context, uint8* data, int* index, - int* x, int* y, uint32 cacheId, uint32 ulCharInc, uint32 flAccel) +void update_process_glyph(rdpContext* context, BYTE* data, int* index, + int* x, int* y, UINT32 cacheId, UINT32 ulCharInc, UINT32 flAccel) { int offset; rdpGlyph* glyph; - uint32 cacheIndex; + UINT32 cacheIndex; rdpGraphics* graphics; rdpGlyphCache* glyph_cache; @@ -72,15 +72,15 @@ void update_process_glyph(rdpContext* context, uint8* data, int* index, } } -void update_process_glyph_fragments(rdpContext* context, uint8* data, uint32 length, - uint32 cacheId, uint32 ulCharInc, uint32 flAccel, uint32 bgcolor, uint32 fgcolor, int x, int y, +void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 length, + UINT32 cacheId, UINT32 ulCharInc, UINT32 flAccel, UINT32 bgcolor, UINT32 fgcolor, int x, int y, int bkX, int bkY, int bkWidth, int bkHeight, int opX, int opY, int opWidth, int opHeight) { int n; - uint32 id; - uint32 size; + UINT32 id; + UINT32 size; int index = 0; - uint8* fragments; + BYTE* fragments; rdpGraphics* graphics; rdpGlyphCache* glyph_cache; @@ -106,7 +106,7 @@ void update_process_glyph_fragments(rdpContext* context, uint8* data, uint32 len } id = data[index + 1]; - fragments = (uint8*) glyph_cache_fragment_get(glyph_cache, id, &size); + fragments = (BYTE*) glyph_cache_fragment_get(glyph_cache, id, &size); if (fragments != NULL) { @@ -143,7 +143,7 @@ void update_process_glyph_fragments(rdpContext* context, uint8* data, uint32 len id = data[index + 1]; size = data[index + 2]; - fragments = (uint8*) xmalloc(size); + fragments = (BYTE*) malloc(size); memcpy(fragments, data, size); glyph_cache_fragment_put(glyph_cache, id, size, fragments); @@ -183,8 +183,8 @@ void update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index) void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fast_index) { - sint32 opLeft, opTop, opRight, opBottom; - sint32 x, y; + INT32 opLeft, opTop, opRight, opBottom; + INT32 x, y; rdpGlyphCache* glyph_cache; glyph_cache = context->cache->glyph; @@ -198,7 +198,7 @@ void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fast_index) if (opBottom == -32768) { - uint8 flags = (uint8) (opTop & 0x0F); + BYTE flags = (BYTE) (opTop & 0x0F); if (flags & 0x01) opBottom = fast_index->bkBottom; @@ -233,12 +233,12 @@ void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fast_index) void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph) { - sint32 opLeft, opTop, opRight, opBottom; - sint32 x, y; + INT32 opLeft, opTop, opRight, opBottom; + INT32 x, y; GLYPH_DATA_V2* glyph_data; rdpGlyph* glyph; rdpCache* cache = context->cache; - uint8 text_data[2]; + BYTE text_data[2]; opLeft = fast_glyph->opLeft; opTop = fast_glyph->opTop; @@ -249,7 +249,7 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph) if (opBottom == -32768) { - uint8 flags = (uint8) (opTop & 0x0F); + BYTE flags = (BYTE) (opTop & 0x0F); if (flags & 0x01) opBottom = fast_glyph->bkBottom; @@ -286,7 +286,7 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph) glyph->cb = glyph_data->cb; Glyph_New(context, glyph); glyph_cache_put(cache->glyph, fast_glyph->cacheId, fast_glyph->data[0], glyph); - xfree(fast_glyph->glyph_data); + free(fast_glyph->glyph_data); fast_glyph->glyph_data = NULL; } @@ -326,7 +326,7 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph) glyph_cache_put(cache->glyph, cache_glyph->cacheId, glyph_data->cacheIndex, glyph); cache_glyph->glyphData[i] = NULL; - xfree(glyph_data); + free(glyph_data); } } @@ -354,11 +354,11 @@ void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_ glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph); cache_glyph_v2->glyphData[i] = NULL; - xfree(glyph_data); + free(glyph_data); } } -rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, uint32 id, uint32 index) +rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, UINT32 id, UINT32 index) { rdpGlyph* glyph; @@ -384,7 +384,7 @@ rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, uint32 id, uint32 index) return glyph; } -void glyph_cache_put(rdpGlyphCache* glyph_cache, uint32 id, uint32 index, rdpGlyph* glyph) +void glyph_cache_put(rdpGlyphCache* glyph_cache, UINT32 id, UINT32 index, rdpGlyph* glyph) { rdpGlyph* prevGlyph; @@ -405,19 +405,19 @@ void glyph_cache_put(rdpGlyphCache* glyph_cache, uint32 id, uint32 index, rdpGly if (prevGlyph != NULL) { Glyph_Free(glyph_cache->context, prevGlyph); - xfree(prevGlyph->aj); - xfree(prevGlyph); + free(prevGlyph->aj); + free(prevGlyph); } glyph_cache->glyphCache[id].entries[index] = glyph; } -void* glyph_cache_fragment_get(rdpGlyphCache* glyph_cache, uint32 index, uint32* size) +void* glyph_cache_fragment_get(rdpGlyphCache* glyph_cache, UINT32 index, UINT32* size) { void* fragment; fragment = glyph_cache->fragCache.entries[index].fragment; - *size = (uint8) glyph_cache->fragCache.entries[index].size; + *size = (BYTE) glyph_cache->fragCache.entries[index].size; if (fragment == NULL) { @@ -427,7 +427,7 @@ void* glyph_cache_fragment_get(rdpGlyphCache* glyph_cache, uint32 index, uint32* return fragment; } -void glyph_cache_fragment_put(rdpGlyphCache* glyph_cache, uint32 index, uint32 size, void* fragment) +void glyph_cache_fragment_put(rdpGlyphCache* glyph_cache, UINT32 index, UINT32 size, void* fragment) { void* prevFragment; @@ -438,7 +438,7 @@ void glyph_cache_fragment_put(rdpGlyphCache* glyph_cache, uint32 index, uint32 s if (prevFragment != NULL) { - xfree(prevFragment); + free(prevFragment); } } @@ -500,20 +500,20 @@ void glyph_cache_free(rdpGlyphCache* glyph_cache) if (glyph != NULL) { Glyph_Free(glyph_cache->context, glyph); - xfree(glyph->aj); - xfree(glyph); + free(glyph->aj); + free(glyph); } } - xfree(glyph_cache->glyphCache[i].entries); + free(glyph_cache->glyphCache[i].entries); } for (i = 0; i < 255; i++) { fragment = glyph_cache->fragCache.entries[i].fragment; - xfree(fragment); + free(fragment); } - xfree(glyph_cache->fragCache.entries); - xfree(glyph_cache); + free(glyph_cache->fragCache.entries); + free(glyph_cache); } } diff --git a/libfreerdp/cache/nine_grid.c b/libfreerdp/cache/nine_grid.c index 7c89d40c2..17b225074 100644 --- a/libfreerdp/cache/nine_grid.c +++ b/libfreerdp/cache/nine_grid.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * NineGrid Cache * * Copyright 2012 Marc-Andre Moreau @@ -53,7 +53,7 @@ void nine_grid_cache_register_callbacks(rdpUpdate* update) update->primary->MultiDrawNineGrid = update_gdi_multi_draw_nine_grid; } -void* nine_grid_cache_get(rdpNineGridCache* nine_grid, uint32 index) +void* nine_grid_cache_get(rdpNineGridCache* nine_grid, UINT32 index) { void* entry; @@ -74,7 +74,7 @@ void* nine_grid_cache_get(rdpNineGridCache* nine_grid, uint32 index) return entry; } -void nine_grid_cache_put(rdpNineGridCache* nine_grid, uint32 index, void* entry) +void nine_grid_cache_put(rdpNineGridCache* nine_grid, UINT32 index, void* entry) { void* prevEntry; @@ -87,7 +87,7 @@ void nine_grid_cache_put(rdpNineGridCache* nine_grid, uint32 index, void* entry) prevEntry = nine_grid->entries[index].entry; if (prevEntry != NULL) - xfree(prevEntry); + free(prevEntry); nine_grid->entries[index].entry = entry; } @@ -125,12 +125,12 @@ void nine_grid_cache_free(rdpNineGridCache* nine_grid) for (i = 0; i < (int) nine_grid->maxEntries; i++) { if (nine_grid->entries[i].entry != NULL) - xfree(nine_grid->entries[i].entry); + free(nine_grid->entries[i].entry); } - xfree(nine_grid->entries); + free(nine_grid->entries); } - xfree(nine_grid); + free(nine_grid); } } diff --git a/libfreerdp/cache/offscreen.c b/libfreerdp/cache/offscreen.c index 132a8d5ad..6a6ba494c 100644 --- a/libfreerdp/cache/offscreen.c +++ b/libfreerdp/cache/offscreen.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Offscreen Bitmap Cache * * Copyright 2011 Marc-Andre Moreau @@ -31,7 +31,7 @@ void update_gdi_create_offscreen_bitmap(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap) { int i; - uint16 index; + UINT16 index; rdpBitmap* bitmap; rdpCache* cache = context->cache; @@ -46,7 +46,7 @@ void update_gdi_create_offscreen_bitmap(rdpContext* context, CREATE_OFFSCREEN_BI offscreen_cache_put(cache->offscreen, create_offscreen_bitmap->id, bitmap); if(cache->offscreen->currentSurface == create_offscreen_bitmap->id) - Bitmap_SetSurface(context, bitmap, false); + Bitmap_SetSurface(context, bitmap, FALSE); for (i = 0; i < (int) create_offscreen_bitmap->deleteList.cIndices; i++) { @@ -61,19 +61,19 @@ void update_gdi_switch_surface(rdpContext* context, SWITCH_SURFACE_ORDER* switch if (switch_surface->bitmapId == SCREEN_BITMAP_SURFACE) { - Bitmap_SetSurface(context, NULL, true); + Bitmap_SetSurface(context, NULL, TRUE); } else { rdpBitmap* bitmap; bitmap = offscreen_cache_get(cache->offscreen, switch_surface->bitmapId); - Bitmap_SetSurface(context, bitmap, false); + Bitmap_SetSurface(context, bitmap, FALSE); } cache->offscreen->currentSurface = switch_surface->bitmapId; } -rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreen_cache, uint32 index) +rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreen_cache, UINT32 index) { rdpBitmap* bitmap; @@ -94,7 +94,7 @@ rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreen_cache, uint32 index) return bitmap; } -void offscreen_cache_put(rdpOffscreenCache* offscreen, uint32 index, rdpBitmap* bitmap) +void offscreen_cache_put(rdpOffscreenCache* offscreen, UINT32 index, rdpBitmap* bitmap) { if (index >= offscreen->maxEntries) { @@ -106,7 +106,7 @@ void offscreen_cache_put(rdpOffscreenCache* offscreen, uint32 index, rdpBitmap* offscreen->entries[index] = bitmap; } -void offscreen_cache_delete(rdpOffscreenCache* offscreen, uint32 index) +void offscreen_cache_delete(rdpOffscreenCache* offscreen, UINT32 index) { rdpBitmap* prevBitmap; @@ -169,7 +169,7 @@ void offscreen_cache_free(rdpOffscreenCache* offscreen_cache) Bitmap_Free(offscreen_cache->update->context, bitmap); } - xfree(offscreen_cache->entries); - xfree(offscreen_cache); + free(offscreen_cache->entries); + free(offscreen_cache); } } diff --git a/libfreerdp/cache/palette.c b/libfreerdp/cache/palette.c index e73765cd9..9d093bf26 100644 --- a/libfreerdp/cache/palette.c +++ b/libfreerdp/cache/palette.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Palette (Color Table) Cache * * Copyright 2011 Marc-Andre Moreau @@ -34,7 +34,7 @@ void update_gdi_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* palette_cache_put(cache->palette, cache_color_table->cacheIndex, (void*) cache_color_table->colorTable); } -void* palette_cache_get(rdpPaletteCache* palette_cache, uint32 index) +void* palette_cache_get(rdpPaletteCache* palette_cache, UINT32 index) { void* entry; @@ -55,7 +55,7 @@ void* palette_cache_get(rdpPaletteCache* palette_cache, uint32 index) return entry; } -void palette_cache_put(rdpPaletteCache* palette_cache, uint32 index, void* entry) +void palette_cache_put(rdpPaletteCache* palette_cache, UINT32 index, void* entry) { if (index >= palette_cache->maxEntries) { @@ -91,8 +91,8 @@ void palette_cache_free(rdpPaletteCache* palette_cache) { if (palette_cache != NULL) { - xfree(palette_cache->entries); - xfree(palette_cache); + free(palette_cache->entries); + free(palette_cache); } } diff --git a/libfreerdp/cache/pointer.c b/libfreerdp/cache/pointer.c index c396bdce8..7dcc84436 100644 --- a/libfreerdp/cache/pointer.c +++ b/libfreerdp/cache/pointer.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Glyph Cache * * Copyright 2011 Marc-Andre Moreau @@ -111,7 +111,7 @@ void update_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_c Pointer_Set(context, pointer); } -rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, uint32 index) +rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, UINT32 index) { rdpPointer* pointer; @@ -126,7 +126,7 @@ rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, uint32 index) return pointer; } -void pointer_cache_put(rdpPointerCache* pointer_cache, uint32 index, rdpPointer* pointer) +void pointer_cache_put(rdpPointerCache* pointer_cache, UINT32 index, rdpPointer* pointer) { rdpPointer* prevPointer; @@ -187,7 +187,7 @@ void pointer_cache_free(rdpPointerCache* pointer_cache) Pointer_Free(pointer_cache->update->context, pointer); } - xfree(pointer_cache->entries); - xfree(pointer_cache); + free(pointer_cache->entries); + free(pointer_cache); } } diff --git a/libfreerdp/channels/CMakeLists.txt b/libfreerdp/channels/CMakeLists.txt index 9861f10f6..a95637bfc 100644 --- a/libfreerdp/channels/CMakeLists.txt +++ b/libfreerdp/channels/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-channels cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -24,7 +24,7 @@ set(${MODULE_PREFIX}_SRCS wtsvc.c wtsvc.h) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -32,7 +32,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() @@ -48,4 +48,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/channels/libchannels.c b/libfreerdp/channels/libchannels.c index 2644c4e94..a0bf51ccc 100644 --- a/libfreerdp/channels/libchannels.c +++ b/libfreerdp/channels/libchannels.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Virtual Channel Manager * * Copyright 2009-2011 Jay Sorg @@ -139,6 +139,7 @@ static rdpChannels* g_init_channels; /* The list of all channel managers. */ typedef struct rdp_channels_list rdpChannelsList; + struct rdp_channels_list { rdpChannels* channels; @@ -284,8 +285,8 @@ static rdpChannel* freerdp_channels_find_channel_by_name(rdpChannels* channels, * according to MS docs * only called from main thread */ -static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF pChannel, - int channelCount, uint32 versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc) +static UINT32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF pChannel, + int channelCount, UINT32 versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc) { int index; rdpChannels* channels; @@ -296,7 +297,7 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF if (ppInitHandle == NULL) { - DEBUG_CHANNELS("error bad pphan"); + DEBUG_CHANNELS("error bad init handle"); return CHANNEL_RC_BAD_INIT_HANDLE; } @@ -387,7 +388,7 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF * can be called from any thread * thread safe because no 2 threads can have the same channel name registered */ -static uint32 FREERDP_CC MyVirtualChannelOpen(void* pInitHandle, uint32* pOpenHandle, +static UINT32 FREERDP_CC MyVirtualChannelOpen(void* pInitHandle, UINT32* pOpenHandle, char* pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc) { int index; @@ -441,7 +442,7 @@ static uint32 FREERDP_CC MyVirtualChannelOpen(void* pInitHandle, uint32* pOpenHa * can be called from any thread * thread safe because no 2 threads can have the same openHandle */ -static uint32 FREERDP_CC MyVirtualChannelClose(uint32 openHandle) +static UINT32 FREERDP_CC MyVirtualChannelClose(UINT32 openHandle) { int index; rdpChannels* channels; @@ -471,7 +472,7 @@ static uint32 FREERDP_CC MyVirtualChannelClose(uint32 openHandle) } /* can be called from any thread */ -static uint32 FREERDP_CC MyVirtualChannelWrite(uint32 openHandle, void* pData, uint32 dataLength, void* pUserData) +static UINT32 FREERDP_CC MyVirtualChannelWrite(UINT32 openHandle, void* pData, UINT32 dataLength, void* pUserData) { int index; SYNC_DATA* item; @@ -532,7 +533,7 @@ static uint32 FREERDP_CC MyVirtualChannelWrite(uint32 openHandle, void* pData, u return CHANNEL_RC_OK; } -static uint32 FREERDP_CC MyVirtualChannelEventPush(uint32 openHandle, RDP_EVENT* event) +static UINT32 FREERDP_CC MyVirtualChannelEventPush(UINT32 openHandle, RDP_EVENT* event) { int index; rdpChannels* channels; @@ -662,26 +663,20 @@ void freerdp_channels_free(rdpChannels* channels) prev->next = list->next; else g_channels_list = list->next; - xfree(list); + free(list); } ReleaseMutex(g_mutex_list); - xfree(channels); + free(channels); } -/** - * this is called when processing the command line parameters - * called only from main thread - */ -int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, const char* name, void* data) +int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, void* entry, void* data) { - int ok; + int status; struct lib_data* lib; CHANNEL_ENTRY_POINTS_EX ep; - DEBUG_CHANNELS("%s", name); - if (channels->num_libs_data + 1 >= CHANNEL_MAX_COUNT) { DEBUG_CHANNELS("too many channels"); @@ -689,14 +684,7 @@ int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, c } lib = channels->libs_data + channels->num_libs_data; - lib->entry = (PVIRTUALCHANNELENTRY) freerdp_load_plugin(name, CHANNEL_EXPORT_FUNC_NAME); - //lib->entry = (PVIRTUALCHANNELENTRY) freerdp_load_channel_plugin(settings, name, CHANNEL_EXPORT_FUNC_NAME); - - if (lib->entry == NULL) - { - DEBUG_CHANNELS("failed to find export function"); - return 1; - } + lib->entry = (PVIRTUALCHANNELENTRY) entry; ep.cbSize = sizeof(ep); ep.protocolVersion = VIRTUAL_CHANNEL_VERSION_WIN2000; @@ -714,7 +702,7 @@ int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, c WaitForSingleObject(g_mutex_init, INFINITE); g_init_channels = channels; - ok = lib->entry((PCHANNEL_ENTRY_POINTS) &ep); + status = lib->entry((PCHANNEL_ENTRY_POINTS) &ep); g_init_channels = NULL; ReleaseMutex(g_mutex_init); @@ -723,7 +711,7 @@ int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, c channels->settings = 0; channels->can_call_init = 0; - if (!ok) + if (!status) { DEBUG_CHANNELS("export function call failed"); return 1; @@ -732,6 +720,27 @@ int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, c return 0; } +/** + * this is called when processing the command line parameters + * called only from main thread + */ +int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, const char* name, void* data) +{ + void* entry; + + DEBUG_CHANNELS("%s", name); + + entry = (PVIRTUALCHANNELENTRY) freerdp_load_plugin(name, CHANNEL_EXPORT_FUNC_NAME); + + if (entry == NULL) + { + DEBUG_CHANNELS("failed to find export function"); + return 1; + } + + return freerdp_channels_client_load(channels, settings, entry, data); +} + /** * go through and inform all the libraries that we are initialized * called only from main thread @@ -932,24 +941,25 @@ static void freerdp_channels_process_sync(rdpChannels* channels, freerdp* instan lchannel_data->open_event_proc(lchannel_data->open_handle, CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, sizeof(void*), sizeof(void*), 0); } - xfree(item); + + _aligned_free(item); } } /** * called only from main thread */ -boolean freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds, +BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds, int* read_count, void** write_fds, int* write_count) { wait_obj_get_fds(channels->signal, read_fds, read_count); - return true; + return TRUE; } /** * called only from main thread */ -boolean freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance) +BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance) { if (wait_obj_is_set(channels->signal)) { @@ -957,7 +967,7 @@ boolean freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance) freerdp_channels_process_sync(channels, instance); } - return true; + return TRUE; } RDP_EVENT* freerdp_channels_pop_event(rdpChannels* channels) diff --git a/libfreerdp/channels/libchannels.h b/libfreerdp/channels/libchannels.h index f34bdeed8..bc0b51804 100644 --- a/libfreerdp/channels/libchannels.h +++ b/libfreerdp/channels/libchannels.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Virtual Channel Manager * * Copyright 2009-2011 Jay Sorg diff --git a/libfreerdp/channels/wtsvc.c b/libfreerdp/channels/wtsvc.c index b4f9b3e5d..877a7d3fb 100644 --- a/libfreerdp/channels/wtsvc.c +++ b/libfreerdp/channels/wtsvc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Server Virtual Channel Interface * * Copyright 2011-2012 Vic Lee @@ -40,18 +40,18 @@ typedef struct wts_data_item { - uint16 channel_id; - uint8* buffer; - uint32 length; + UINT16 channel_id; + BYTE* buffer; + UINT32 length; } wts_data_item; static void wts_data_item_free(wts_data_item* item) { - xfree(item->buffer); - xfree(item); + free(item->buffer); + free(item); } -static rdpPeerChannel* wts_get_dvc_channel_by_id(WTSVirtualChannelManager* vcm, uint32 ChannelId) +static rdpPeerChannel* wts_get_dvc_channel_by_id(WTSVirtualChannelManager* vcm, UINT32 ChannelId) { LIST_ITEM* item; rdpPeerChannel* channel = NULL; @@ -67,13 +67,13 @@ static rdpPeerChannel* wts_get_dvc_channel_by_id(WTSVirtualChannelManager* vcm, return channel; } -static void wts_queue_receive_data(rdpPeerChannel* channel, const uint8* buffer, uint32 length) +static void wts_queue_receive_data(rdpPeerChannel* channel, const BYTE* buffer, UINT32 length) { wts_data_item* item; item = xnew(wts_data_item); item->length = length; - item->buffer = xmalloc(length); + item->buffer = malloc(length); memcpy(item->buffer, buffer, length); WaitForSingleObject(channel->mutex, INFINITE); @@ -98,55 +98,55 @@ static void wts_queue_send_item(rdpPeerChannel* channel, wts_data_item* item) wait_obj_set(vcm->send_event); } -static int wts_read_variable_uint(STREAM* s, int cbLen, uint32 *val) +static int wts_read_variable_uint(STREAM* s, int cbLen, UINT32 *val) { switch (cbLen) { case 0: if (stream_get_left(s) < 1) return 0; - stream_read_uint8(s, *val); + stream_read_BYTE(s, *val); return 1; case 1: if (stream_get_left(s) < 2) return 0; - stream_read_uint16(s, *val); + stream_read_UINT16(s, *val); return 2; default: if (stream_get_left(s) < 4) return 0; - stream_read_uint32(s, *val); + stream_read_UINT32(s, *val); return 4; } } -static void wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, uint32 length) +static void wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, UINT32 length) { - uint16 Version; + UINT16 Version; if (length < 3) return; - stream_seek_uint8(channel->receive_data); /* Pad (1 byte) */ - stream_read_uint16(channel->receive_data, Version); + stream_seek_BYTE(channel->receive_data); /* Pad (1 byte) */ + stream_read_UINT16(channel->receive_data, Version); DEBUG_DVC("Version: %d", Version); 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, STREAM* s, UINT32 length) { - uint32 CreationStatus; + UINT32 CreationStatus; if (length < 4) return; - stream_read_uint32(s, CreationStatus); + stream_read_UINT32(s, CreationStatus); - if ((sint32) CreationStatus < 0) + if ((INT32) CreationStatus < 0) { - DEBUG_DVC("ChannelId %d creation failed (%d)", channel->channel_id, (sint32)CreationStatus); + DEBUG_DVC("ChannelId %d creation failed (%d)", channel->channel_id, (INT32)CreationStatus); channel->dvc_open_state = DVC_OPEN_STATE_FAILED; } else @@ -157,7 +157,7 @@ static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, STREAM* s, wait_obj_set(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, STREAM* s, int cbLen, UINT32 length) { int value; @@ -176,7 +176,7 @@ 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, STREAM* s, UINT32 length) { if (channel->dvc_total_length > 0) { @@ -209,12 +209,12 @@ static void wts_read_drdynvc_close_response(rdpPeerChannel* channel) static void wts_read_drdynvc_pdu(rdpPeerChannel* channel) { - uint32 length; + UINT32 length; int value; int Cmd; int Sp; int cbChId; - uint32 ChannelId; + UINT32 ChannelId; rdpPeerChannel* dvc; length = stream_get_pos(channel->receive_data); @@ -223,7 +223,7 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel) return; stream_set_pos(channel->receive_data, 0); - stream_read_uint8(channel->receive_data, value); + stream_read_BYTE(channel->receive_data, value); length--; Cmd = (value & 0xf0) >> 4; @@ -282,43 +282,43 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel) } } -static int wts_write_variable_uint(STREAM* stream, uint32 val) +static int wts_write_variable_uint(STREAM* stream, UINT32 val) { int cb; if (val <= 0xFF) { cb = 0; - stream_write_uint8(stream, val); + stream_write_BYTE(stream, val); } else if (val <= 0xFFFF) { cb = 1; - stream_write_uint16(stream, val); + stream_write_UINT16(stream, val); } else { cb = 3; - stream_write_uint32(stream, val); + stream_write_UINT32(stream, val); } return cb; } -static void wts_write_drdynvc_header(STREAM *s, uint8 Cmd, uint32 ChannelId) +static void wts_write_drdynvc_header(STREAM *s, BYTE Cmd, UINT32 ChannelId) { - uint8* bm; + BYTE* bm; int cbChId; stream_get_mark(s, bm); - stream_seek_uint8(s); + stream_seek_BYTE(s); cbChId = wts_write_variable_uint(s, 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(STREAM *s, UINT32 ChannelId, const char *ChannelName) { - uint32 len; + UINT32 len; wts_write_drdynvc_header(s, CREATE_REQUEST_PDU, ChannelId); len = strlen(ChannelName) + 1; @@ -326,7 +326,7 @@ static void wts_write_drdynvc_create_request(STREAM *s, uint32 ChannelId, const stream_write(s, ChannelName, len); } -static void WTSProcessChannelData(rdpPeerChannel* channel, int channelId, uint8* data, int size, int flags, int total_size) +static void WTSProcessChannelData(rdpPeerChannel* channel, int channelId, BYTE* data, int size, int flags, int total_size) { if (flags & CHANNEL_FLAG_FIRST) { @@ -354,10 +354,10 @@ static void WTSProcessChannelData(rdpPeerChannel* channel, int channelId, uint8* } } -static int WTSReceiveChannelData(freerdp_peer* client, int channelId, uint8* data, int size, int flags, int total_size) +static int WTSReceiveChannelData(freerdp_peer* client, int channelId, BYTE* data, int size, int flags, int total_size) { int i; - boolean result = false; + BOOL result = FALSE; rdpPeerChannel* channel; for (i = 0; i < client->settings->num_channels; i++) @@ -372,7 +372,7 @@ static int WTSReceiveChannelData(freerdp_peer* client, int channelId, uint8* dat if (channel != NULL) { WTSProcessChannelData(channel, channelId, data, size, flags, total_size); - result = true; + result = TRUE; } } @@ -429,7 +429,7 @@ void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm) list_free(vcm->send_queue); CloseHandle(vcm->mutex); - xfree(vcm); + free(vcm); } } @@ -444,12 +444,12 @@ void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm, } } -boolean WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm) +BOOL WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm) { - boolean result = true; + BOOL result = TRUE; wts_data_item* item; rdpPeerChannel* channel; - uint32 dynvc_caps; + UINT32 dynvc_caps; if (vcm->drdynvc_state == DRDYNVC_STATE_NONE && vcm->client->activated) { @@ -462,7 +462,7 @@ boolean WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vc { vcm->drdynvc_channel = channel; dynvc_caps = 0x00010050; /* DYNVC_CAPS_VERSION1 (4 bytes) */ - WTSVirtualChannelWrite(channel, (uint8*) &dynvc_caps, sizeof(dynvc_caps), NULL); + WTSVirtualChannelWrite(channel, (BYTE*) &dynvc_caps, sizeof(dynvc_caps), NULL); } } @@ -472,14 +472,14 @@ boolean WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vc while ((item = (wts_data_item*) list_dequeue(vcm->send_queue)) != NULL) { - if (vcm->client->SendChannelData(vcm->client, item->channel_id, item->buffer, item->length) == false) + if (vcm->client->SendChannelData(vcm->client, item->channel_id, item->buffer, item->length) == FALSE) { - result = false; + result = FALSE; } wts_data_item_free(item); - if (result == false) + if (result == FALSE) break; } @@ -491,7 +491,7 @@ boolean WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vc void* WTSVirtualChannelOpenEx( /* __in */ WTSVirtualChannelManager* vcm, /* __in */ const char* pVirtualName, - /* __in */ uint32 flags) + /* __in */ UINT32 flags) { int i; int len; @@ -569,55 +569,55 @@ void* WTSVirtualChannelOpenEx( return channel; } -boolean WTSVirtualChannelQuery( +BOOL WTSVirtualChannelQuery( /* __in */ void* hChannelHandle, /* __in */ WTS_VIRTUAL_CLASS WtsVirtualClass, /* __out */ void** ppBuffer, - /* __out */ uint32* pBytesReturned) + /* __out */ UINT32* pBytesReturned) { - boolean bval; + BOOL bval; void* fds[10]; int fds_count = 0; - boolean result = false; + BOOL result = FALSE; rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle; switch (WtsVirtualClass) { case WTSVirtualFileHandle: wait_obj_get_fds(channel->receive_event, fds, &fds_count); - *ppBuffer = xmalloc(sizeof(void*)); + *ppBuffer = malloc(sizeof(void*)); memcpy(*ppBuffer, &fds[0], sizeof(void*)); *pBytesReturned = sizeof(void*); - result = true; + result = TRUE; break; case WTSVirtualChannelReady: if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC) { - bval = true; - result = true; + bval = TRUE; + result = TRUE; } else { switch (channel->dvc_open_state) { case DVC_OPEN_STATE_NONE: - bval = false; - result = true; + bval = FALSE; + result = TRUE; break; case DVC_OPEN_STATE_SUCCEEDED: - bval = true; - result = true; + bval = TRUE; + result = TRUE; break; default: - bval = false; - result = false; + bval = FALSE; + result = FALSE; break; } } - *ppBuffer = xmalloc(sizeof(boolean)); - memcpy(*ppBuffer, &bval, sizeof(boolean)); - *pBytesReturned = sizeof(boolean); + *ppBuffer = malloc(sizeof(BOOL)); + memcpy(*ppBuffer, &bval, sizeof(BOOL)); + *pBytesReturned = sizeof(BOOL); break; default: @@ -629,15 +629,15 @@ boolean WTSVirtualChannelQuery( void WTSFreeMemory( /* __in */ void* pMemory) { - xfree(pMemory); + free(pMemory); } -boolean WTSVirtualChannelRead( +BOOL WTSVirtualChannelRead( /* __in */ void* hChannelHandle, - /* __in */ uint32 TimeOut, - /* __out */ uint8* Buffer, - /* __in */ uint32 BufferSize, - /* __out */ uint32* pBytesRead) + /* __in */ UINT32 TimeOut, + /* __out */ BYTE* Buffer, + /* __in */ UINT32 BufferSize, + /* __out */ UINT32* pBytesRead) { wts_data_item* item; rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle; @@ -648,13 +648,13 @@ boolean WTSVirtualChannelRead( { wait_obj_clear(channel->receive_event); *pBytesRead = 0; - return true; + return TRUE; } *pBytesRead = item->length; if (item->length > BufferSize) - return false; + return FALSE; /* remove the first element (same as what we just peek) */ WaitForSingleObject(channel->mutex, INFINITE); @@ -668,14 +668,14 @@ boolean WTSVirtualChannelRead( memcpy(Buffer, item->buffer, item->length); wts_data_item_free(item) ; - return true; + return TRUE; } -boolean WTSVirtualChannelWrite( +BOOL WTSVirtualChannelWrite( /* __in */ void* hChannelHandle, - /* __in */ uint8* Buffer, - /* __in */ uint32 Length, - /* __out */ uint32* pBytesWritten) + /* __in */ BYTE* Buffer, + /* __in */ UINT32 Length, + /* __out */ UINT32* pBytesWritten) { rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle; wts_data_item* item; @@ -683,15 +683,15 @@ boolean WTSVirtualChannelWrite( int cbLen; int cbChId; int first; - uint32 written; + UINT32 written; if (channel == NULL) - return false; + return FALSE; if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC) { item = xnew(wts_data_item); - item->buffer = xmalloc(Length); + item->buffer = malloc(Length); item->length = Length; memcpy(item->buffer, Buffer, Length); @@ -700,23 +700,23 @@ boolean WTSVirtualChannelWrite( else if (channel->vcm->drdynvc_channel == NULL || channel->vcm->drdynvc_state != DRDYNVC_STATE_READY) { DEBUG_DVC("drdynvc not ready"); - return false; + return FALSE; } else { s = stream_new(0); - first = true; + first = TRUE; while (Length > 0) { item = xnew(wts_data_item); - item->buffer = xmalloc(channel->client->settings->vc_chunk_size); + item->buffer = malloc(channel->client->settings->vc_chunk_size); stream_attach(s, item->buffer, channel->client->settings->vc_chunk_size); - stream_seek_uint8(s); + stream_seek_BYTE(s); cbChId = wts_write_variable_uint(s, channel->channel_id); - if (first && (Length > (uint32) stream_get_left(s))) + if (first && (Length > (UINT32) stream_get_left(s))) { cbLen = wts_write_variable_uint(s, Length); item->buffer[0] = (DATA_FIRST_PDU << 4) | (cbLen << 2) | cbChId; @@ -726,7 +726,7 @@ boolean WTSVirtualChannelWrite( item->buffer[0] = (DATA_PDU << 4) | cbChId; } - first = false; + first = FALSE; written = stream_get_left(s); if (written > Length) @@ -746,10 +746,10 @@ boolean WTSVirtualChannelWrite( if (pBytesWritten != NULL) *pBytesWritten = Length; - return true; + return TRUE; } -boolean WTSVirtualChannelClose( +BOOL WTSVirtualChannelClose( /* __in */ void* hChannelHandle) { STREAM* s; @@ -800,8 +800,8 @@ boolean WTSVirtualChannelClose( if (channel->mutex) CloseHandle(channel->mutex); - xfree(channel); + free(channel); } - return true; + return TRUE; } diff --git a/libfreerdp/channels/wtsvc.h b/libfreerdp/channels/wtsvc.h index f1e47f6ba..b452a6ee8 100644 --- a/libfreerdp/channels/wtsvc.h +++ b/libfreerdp/channels/wtsvc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Server Virtual Channel Interface * * Copyright 2011-2012 Vic Lee @@ -61,17 +61,17 @@ struct rdp_peer_channel { WTSVirtualChannelManager* vcm; freerdp_peer* client; - uint32 channel_id; - uint16 channel_type; - uint16 index; + UINT32 channel_id; + UINT16 channel_type; + UINT16 index; STREAM* receive_data; struct wait_obj* receive_event; LIST* receive_queue; HANDLE mutex; - uint8 dvc_open_state; - uint32 dvc_total_length; + BYTE dvc_open_state; + UINT32 dvc_total_length; }; struct WTSVirtualChannelManager @@ -82,8 +82,8 @@ struct WTSVirtualChannelManager HANDLE mutex; rdpPeerChannel* drdynvc_channel; - uint8 drdynvc_state; - uint32 dvc_channel_id_seq; + BYTE drdynvc_state; + UINT32 dvc_channel_id_seq; LIST* dvc_channel_list; }; diff --git a/libfreerdp/codec/CMakeLists.txt b/libfreerdp/codec/CMakeLists.txt index a404535d6..b83d6d3b8 100644 --- a/libfreerdp/codec/CMakeLists.txt +++ b/libfreerdp/codec/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-codec cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -78,7 +78,7 @@ if(WITH_JPEG) set(FREERDP_JPEG_LIBS jpeg) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -89,7 +89,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} set(${MODULE_PREFIX}_LIBS ${FREERDP_JPEG_LIBS}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} @@ -99,4 +99,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/codec/bitmap.c b/libfreerdp/codec/bitmap.c index 31152b160..0a7b91b20 100644 --- a/libfreerdp/codec/bitmap.c +++ b/libfreerdp/codec/bitmap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Compressed Bitmap * * Copyright 2011 Jay Sorg @@ -58,28 +58,28 @@ #define BLACK_PIXEL 0x000000 #define WHITE_PIXEL 0xFFFFFF -typedef uint32 PIXEL; +typedef UINT32 PIXEL; -static const uint8 g_MaskBit0 = 0x01; /* Least significant bit */ -static const uint8 g_MaskBit1 = 0x02; -static const uint8 g_MaskBit2 = 0x04; -static const uint8 g_MaskBit3 = 0x08; -static const uint8 g_MaskBit4 = 0x10; -static const uint8 g_MaskBit5 = 0x20; -static const uint8 g_MaskBit6 = 0x40; -static const uint8 g_MaskBit7 = 0x80; /* Most significant bit */ +static const BYTE g_MaskBit0 = 0x01; /* Least significant bit */ +static const BYTE g_MaskBit1 = 0x02; +static const BYTE g_MaskBit2 = 0x04; +static const BYTE g_MaskBit3 = 0x08; +static const BYTE g_MaskBit4 = 0x10; +static const BYTE g_MaskBit5 = 0x20; +static const BYTE g_MaskBit6 = 0x40; +static const BYTE g_MaskBit7 = 0x80; /* Most significant bit */ -static const uint8 g_MaskSpecialFgBg1 = 0x03; -static const uint8 g_MaskSpecialFgBg2 = 0x05; +static const BYTE g_MaskSpecialFgBg1 = 0x03; +static const BYTE g_MaskSpecialFgBg2 = 0x05; -static const uint8 g_MaskRegularRunLength = 0x1F; -static const uint8 g_MaskLiteRunLength = 0x0F; +static const BYTE g_MaskRegularRunLength = 0x1F; +static const BYTE g_MaskLiteRunLength = 0x0F; /** * Reads the supplied order header and extracts the compression * order code ID. */ -static uint32 ExtractCodeId(uint8 bOrderHdr) +static UINT32 ExtractCodeId(BYTE bOrderHdr) { int code; @@ -115,10 +115,10 @@ static uint32 ExtractCodeId(uint8 bOrderHdr) /** * Extract the run length of a compression order. */ -static uint32 ExtractRunLength(uint32 code, uint8* pbOrderHdr, uint32* advance) +static UINT32 ExtractRunLength(UINT32 code, BYTE* pbOrderHdr, UINT32* advance) { - uint32 runLength; - uint32 ladvance; + UINT32 runLength; + UINT32 ladvance; ladvance = 1; runLength = 0; @@ -178,7 +178,7 @@ static uint32 ExtractRunLength(uint32 code, uint8* pbOrderHdr, uint32* advance) case MEGA_MEGA_FGBG_IMAGE: case MEGA_MEGA_SET_FGBG_IMAGE: case MEGA_MEGA_COLOR_IMAGE: - runLength = ((uint16) pbOrderHdr[1]) | ((uint16) (pbOrderHdr[2] << 8)); + runLength = ((UINT16) pbOrderHdr[1]) | ((UINT16) (pbOrderHdr[2] << 8)); ladvance += 2; break; } @@ -198,7 +198,7 @@ static uint32 ExtractRunLength(uint32 code, uint8* pbOrderHdr, uint32* advance) #undef WRITEFIRSTLINEFGBGIMAGE #undef RLEDECOMPRESS #undef RLEEXTRA -#define DESTWRITEPIXEL(_buf, _pix) (_buf)[0] = (uint8)(_pix) +#define DESTWRITEPIXEL(_buf, _pix) (_buf)[0] = (BYTE)(_pix) #define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0] #define SRCREADPIXEL(_pix, _buf) _pix = (_buf)[0] #define DESTNEXTPIXEL(_buf) _buf += 1 @@ -218,9 +218,9 @@ static uint32 ExtractRunLength(uint32 code, uint8* pbOrderHdr, uint32* advance) #undef WRITEFIRSTLINEFGBGIMAGE #undef RLEDECOMPRESS #undef RLEEXTRA -#define DESTWRITEPIXEL(_buf, _pix) ((uint16*)(_buf))[0] = (uint16)(_pix) -#define DESTREADPIXEL(_pix, _buf) _pix = ((uint16*)(_buf))[0] -#define SRCREADPIXEL(_pix, _buf) _pix = ((uint16*)(_buf))[0] +#define DESTWRITEPIXEL(_buf, _pix) ((UINT16*)(_buf))[0] = (UINT16)(_pix) +#define DESTREADPIXEL(_pix, _buf) _pix = ((UINT16*)(_buf))[0] +#define SRCREADPIXEL(_pix, _buf) _pix = ((UINT16*)(_buf))[0] #define DESTNEXTPIXEL(_buf) _buf += 2 #define SRCNEXTPIXEL(_buf) _buf += 2 #define WRITEFGBGIMAGE WriteFgBgImage16to16 @@ -238,8 +238,8 @@ static uint32 ExtractRunLength(uint32 code, uint8* pbOrderHdr, uint32* advance) #undef WRITEFIRSTLINEFGBGIMAGE #undef RLEDECOMPRESS #undef RLEEXTRA -#define DESTWRITEPIXEL(_buf, _pix) do { (_buf)[0] = (uint8)(_pix); \ - (_buf)[1] = (uint8)((_pix) >> 8); (_buf)[2] = (uint8)((_pix) >> 16); } while (0) +#define DESTWRITEPIXEL(_buf, _pix) do { (_buf)[0] = (BYTE)(_pix); \ + (_buf)[1] = (BYTE)((_pix) >> 8); (_buf)[2] = (BYTE)((_pix) >> 16); } while (0) #define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8) | \ ((_buf)[2] << 16) #define SRCREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8) | \ @@ -258,7 +258,7 @@ static uint32 ExtractRunLength(uint32 code, uint8* pbOrderHdr, uint32* advance) * decompress an RLE color plane * RDP6_BITMAP_STREAM */ -static int process_rle_plane(uint8* in, int width, int height, uint8* out, int size) +static int process_rle_plane(BYTE* in, int width, int height, BYTE* out, int size) { int indexw; int indexh; @@ -268,10 +268,10 @@ static int process_rle_plane(uint8* in, int width, int height, uint8* out, int s int color; int x; int revcode; - uint8* last_line; - uint8* this_line; - uint8* org_in; - uint8* org_out; + BYTE* last_line; + BYTE* this_line; + BYTE* org_in; + BYTE* org_out; org_in = in; org_out = out; @@ -365,7 +365,7 @@ static int process_rle_plane(uint8* in, int width, int height, uint8* out, int s /** * process a raw color plane */ -static int process_raw_plane(uint8* srcData, int width, int height, uint8* dstData, int size) +static int process_raw_plane(BYTE* srcData, int width, int height, BYTE* dstData, int size) { int x, y; @@ -384,7 +384,7 @@ static int process_raw_plane(uint8* srcData, int width, int height, uint8* dstDa * 4 byte bitmap decompress * RDP6_BITMAP_STREAM */ -static boolean bitmap_decompress4(uint8* srcData, uint8* dstData, int width, int height, int size) +static BOOL bitmap_decompress4(BYTE* srcData, BYTE* dstData, int width, int height, int size) { int RLE; int code; @@ -432,54 +432,54 @@ static boolean bitmap_decompress4(uint8* srcData, uint8* dstData, int width, int total_processed += bytes_processed + 1; } - return (size == total_processed) ? true : false; + return (size == total_processed) ? TRUE : FALSE; } /** * bitmap decompression routine */ -boolean bitmap_decompress(uint8* srcData, uint8* dstData, int width, int height, int size, int srcBpp, int dstBpp) +BOOL bitmap_decompress(BYTE* srcData, BYTE* dstData, int width, int height, int size, int srcBpp, int dstBpp) { - uint8 * TmpBfr; + BYTE * TmpBfr; if (srcBpp == 16 && dstBpp == 16) { - TmpBfr = (uint8*) xmalloc(width * height * 2); + TmpBfr = (BYTE*) malloc(width * height * 2); RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); - xfree(TmpBfr); + free(TmpBfr); } else if (srcBpp == 32 && dstBpp == 32) { if (!bitmap_decompress4(srcData, dstData, width, height, size)) - return false; + return FALSE; } else if (srcBpp == 15 && dstBpp == 15) { - TmpBfr = (uint8*) xmalloc(width * height * 2); + TmpBfr = (BYTE*) malloc(width * height * 2); RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); - xfree(TmpBfr); + free(TmpBfr); } else if (srcBpp == 8 && dstBpp == 8) { - TmpBfr = (uint8*) xmalloc(width * height); + TmpBfr = (BYTE*) malloc(width * height); RleDecompress8to8(srcData, size, TmpBfr, width, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width, height); - xfree(TmpBfr); + free(TmpBfr); } else if (srcBpp == 24 && dstBpp == 24) { - TmpBfr = (uint8*) xmalloc(width * height * 3); + TmpBfr = (BYTE*) malloc(width * height * 3); RleDecompress24to24(srcData, size, TmpBfr, width * 3, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 3, height); - xfree(TmpBfr); + free(TmpBfr); } else { - return false; + return FALSE; } - return true; + return TRUE; } diff --git a/libfreerdp/codec/color.c b/libfreerdp/codec/color.c index 82cd7adf8..42aa4e5e7 100644 --- a/libfreerdp/codec/color.c +++ b/libfreerdp/codec/color.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Color Conversion Routines * * Copyright 2010 Marc-Andre Moreau @@ -30,12 +30,12 @@ #include #include -int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp) +int freerdp_get_pixel(BYTE * data, int x, int y, int width, int height, int bpp) { int start; int shift; - uint16 *src16; - uint32 *src32; + UINT16 *src16; + UINT32 *src32; int red, green, blue; switch (bpp) @@ -49,7 +49,7 @@ int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp return data[y * width + x]; case 15: case 16: - src16 = (uint16*) data; + src16 = (UINT16*) data; return src16[y * width + x]; case 24: data += y * width * 3; @@ -59,7 +59,7 @@ int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp blue = data[2]; return RGB24(red, green, blue); case 32: - src32 = (uint32*) data; + src32 = (UINT32*) data; return src32[y * width + x]; default: break; @@ -68,7 +68,7 @@ int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp return 0; } -void freerdp_set_pixel(uint8* data, int x, int y, int width, int height, int bpp, int pixel) +void freerdp_set_pixel(BYTE* data, int x, int y, int width, int height, int bpp, int pixel) { int start; int shift; @@ -91,7 +91,7 @@ void freerdp_set_pixel(uint8* data, int x, int y, int width, int height, int bpp } } -static INLINE void freerdp_color_split_rgb(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv) +static INLINE void freerdp_color_split_rgb(UINT32* color, int bpp, BYTE* red, BYTE* green, BYTE* blue, BYTE* alpha, HCLRCONV clrconv) { *red = *green = *blue = 0; *alpha = (clrconv->alpha) ? 0xFF : 0x00; @@ -142,7 +142,7 @@ static INLINE void freerdp_color_split_rgb(uint32* color, int bpp, uint8* red, u } } -static INLINE void freerdp_color_split_bgr(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv) +static INLINE void freerdp_color_split_bgr(UINT32* color, int bpp, BYTE* red, BYTE* green, BYTE* blue, BYTE* alpha, HCLRCONV clrconv) { *red = *green = *blue = 0; *alpha = (clrconv->alpha) ? 0xFF : 0x00; @@ -193,7 +193,7 @@ static INLINE void freerdp_color_split_bgr(uint32* color, int bpp, uint8* red, u } } -static INLINE void freerdp_color_make_rgb(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv) +static INLINE void freerdp_color_make_rgb(UINT32* color, int bpp, BYTE* red, BYTE* green, BYTE* blue, BYTE* alpha, HCLRCONV clrconv) { switch (bpp) { @@ -234,7 +234,7 @@ static INLINE void freerdp_color_make_rgb(uint32* color, int bpp, uint8* red, ui } } -static INLINE void freerdp_color_make_bgr(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv) +static INLINE void freerdp_color_make_bgr(UINT32* color, int bpp, BYTE* red, BYTE* green, BYTE* blue, BYTE* alpha, HCLRCONV clrconv) { switch (bpp) { @@ -275,13 +275,13 @@ static INLINE void freerdp_color_make_bgr(uint32* color, int bpp, uint8* red, ui } } -uint32 freerdp_color_convert_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) +UINT32 freerdp_color_convert_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) { - uint8 red = 0; - uint8 green = 0; - uint8 blue = 0; - uint8 alpha = 0xFF; - uint32 dstColor = 0; + BYTE red = 0; + BYTE green = 0; + BYTE blue = 0; + BYTE alpha = 0xFF; + UINT32 dstColor = 0; freerdp_color_split_rgb(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv); freerdp_color_make_rgb(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv); @@ -289,13 +289,13 @@ uint32 freerdp_color_convert_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCO return dstColor; } -uint32 freerdp_color_convert_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) +UINT32 freerdp_color_convert_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) { - uint8 red = 0; - uint8 green = 0; - uint8 blue = 0; - uint8 alpha = 0xFF; - uint32 dstColor = 0; + BYTE red = 0; + BYTE green = 0; + BYTE blue = 0; + BYTE alpha = 0xFF; + UINT32 dstColor = 0; freerdp_color_split_bgr(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv); freerdp_color_make_bgr(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv); @@ -303,13 +303,13 @@ uint32 freerdp_color_convert_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCO return dstColor; } -uint32 freerdp_color_convert_rgb_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) +UINT32 freerdp_color_convert_rgb_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) { - uint8 red = 0; - uint8 green = 0; - uint8 blue = 0; - uint8 alpha = 0xFF; - uint32 dstColor = 0; + BYTE red = 0; + BYTE green = 0; + BYTE blue = 0; + BYTE alpha = 0xFF; + UINT32 dstColor = 0; freerdp_color_split_rgb(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv); freerdp_color_make_bgr(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv); @@ -317,13 +317,13 @@ uint32 freerdp_color_convert_rgb_bgr(uint32 srcColor, int srcBpp, int dstBpp, HC return dstColor; } -uint32 freerdp_color_convert_bgr_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) +UINT32 freerdp_color_convert_bgr_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) { - uint8 red = 0; - uint8 green = 0; - uint8 blue = 0; - uint8 alpha = 0xFF; - uint32 dstColor = 0; + BYTE red = 0; + BYTE green = 0; + BYTE blue = 0; + BYTE alpha = 0xFF; + UINT32 dstColor = 0; freerdp_color_split_bgr(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv); freerdp_color_make_rgb(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv); @@ -331,7 +331,7 @@ uint32 freerdp_color_convert_bgr_rgb(uint32 srcColor, int srcBpp, int dstBpp, HC return dstColor; } -uint32 freerdp_color_convert_var(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) +UINT32 freerdp_color_convert_var(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) { if (clrconv->invert) return freerdp_color_convert_var_bgr(srcColor, srcBpp, dstBpp, clrconv); @@ -339,7 +339,7 @@ uint32 freerdp_color_convert_var(uint32 srcColor, int srcBpp, int dstBpp, HCLRCO return freerdp_color_convert_var_rgb(srcColor, srcBpp, dstBpp, clrconv); } -uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) +UINT32 freerdp_color_convert_var_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) { if (srcBpp > 16) return freerdp_color_convert_bgr_rgb(srcColor, srcBpp, dstBpp, clrconv); @@ -347,7 +347,7 @@ uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HC return freerdp_color_convert_rgb(srcColor, srcBpp, dstBpp, clrconv); } -uint32 freerdp_color_convert_var_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) +UINT32 freerdp_color_convert_var_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) { if (srcBpp > 16) return freerdp_color_convert_bgr(srcColor, srcBpp, dstBpp, clrconv); @@ -355,21 +355,21 @@ uint32 freerdp_color_convert_var_bgr(uint32 srcColor, int srcBpp, int dstBpp, HC return freerdp_color_convert_rgb_bgr(srcColor, srcBpp, dstBpp, clrconv); } -uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) +BYTE* freerdp_image_convert_8bpp(BYTE* srcData, BYTE* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) { int i; - uint8 red; - uint8 green; - uint8 blue; - uint32 pixel; - uint8 *src8; - uint16 *dst16; - uint32 *dst32; + BYTE red; + BYTE green; + BYTE blue; + UINT32 pixel; + BYTE *src8; + UINT16 *dst16; + UINT32 *dst32; if (dstBpp == 8) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height); + dstData = (BYTE*) malloc(width * height); memcpy(dstData, srcData, width * height); return dstData; @@ -377,9 +377,9 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int else if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555)) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (BYTE*) malloc(width * height * 2); - dst16 = (uint16 *) dstData; + dst16 = (UINT16 *) dstData; for (i = width * height; i > 0; i--) { pixel = *srcData; @@ -396,9 +396,9 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int else if (dstBpp == 16) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (BYTE*) malloc(width * height * 2); - dst16 = (uint16 *) dstData; + dst16 = (UINT16 *) dstData; for (i = width * height; i > 0; i--) { pixel = *srcData; @@ -415,10 +415,10 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int else if (dstBpp == 32) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (BYTE*) malloc(width * height * 4); - src8 = (uint8*) srcData; - dst32 = (uint32*) dstData; + src8 = (BYTE*) srcData; + dst32 = (UINT32*) dstData; for (i = width * height; i > 0; i--) { pixel = *src8; @@ -436,21 +436,21 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int return srcData; } -uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) +BYTE* freerdp_image_convert_15bpp(BYTE* srcData, BYTE* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) { int i; - uint8 red; - uint8 green; - uint8 blue; - uint32 pixel; - uint16 *src16; - uint16 *dst16; - uint32 *dst32; + BYTE red; + BYTE green; + BYTE blue; + UINT32 pixel; + UINT16 *src16; + UINT16 *dst16; + UINT32 *dst32; if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555)) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (BYTE*) malloc(width * height * 2); memcpy(dstData, srcData, width * height * 2); @@ -459,10 +459,10 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in else if (dstBpp == 32) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (BYTE*) malloc(width * height * 4); - src16 = (uint16 *) srcData; - dst32 = (uint32 *) dstData; + src16 = (UINT16 *) srcData; + dst32 = (UINT32 *) dstData; for (i = width * height; i > 0; i--) { pixel = *src16; @@ -477,10 +477,10 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in else if (dstBpp == 16) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (BYTE*) malloc(width * height * 2); - src16 = (uint16 *) srcData; - dst16 = (uint16 *) dstData; + src16 = (UINT16 *) srcData; + dst16 = (UINT16 *) dstData; for (i = width * height; i > 0; i--) { pixel = *src16; @@ -497,7 +497,7 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in return srcData; } -uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) +BYTE* freerdp_image_convert_16bpp(BYTE* srcData, BYTE* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) { if (srcBpp == 15) return freerdp_image_convert_15bpp(srcData, dstData, width, height, srcBpp, dstBpp, clrconv); @@ -505,14 +505,14 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in if (dstBpp == 16) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (BYTE*) malloc(width * height * 2); if (clrconv->rgb555) { int i; - uint8 red, green, blue; - uint16* src16 = (uint16 *) srcData; - uint16* dst16 = (uint16 *) dstData; + BYTE red, green, blue; + UINT16* src16 = (UINT16 *) srcData; + UINT16* dst16 = (UINT16 *) dstData; for (i = width * height; i > 0; i--) { @@ -533,15 +533,15 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in else if (dstBpp == 24) { int i; - uint8 *dst8; - uint16 *src16; - uint8 red, green, blue; + BYTE *dst8; + UINT16 *src16; + BYTE red, green, blue; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 3); + dstData = (BYTE*) malloc(width * height * 3); - dst8 = (uint8*) dstData; - src16 = (uint16*) srcData; + dst8 = (BYTE*) dstData; + src16 = (UINT16*) srcData; for (i = width * height; i > 0; i--) { @@ -566,16 +566,16 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in else if (dstBpp == 32) { int i; - uint32 pixel; - uint16* src16; - uint32* dst32; - uint8 red, green, blue; + UINT32 pixel; + UINT16* src16; + UINT32* dst32; + BYTE red, green, blue; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (BYTE*) malloc(width * height * 4); - src16 = (uint16*) srcData; - dst32 = (uint32*) dstData; + src16 = (UINT16*) srcData; + dst32 = (UINT32*) dstData; for (i = width * height; i > 0; i--) { @@ -592,15 +592,15 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in return srcData; } -uint8* freerdp_image_convert_24bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) +BYTE* freerdp_image_convert_24bpp(BYTE* srcData, BYTE* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) { int i; if (dstBpp == 32) { - uint8 *dstp; + BYTE *dstp; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (BYTE*) malloc(width * height * 4); dstp = dstData; for (i = width * height; i > 0; i--) @@ -616,20 +616,20 @@ uint8* freerdp_image_convert_24bpp(uint8* srcData, uint8* dstData, int width, in return srcData; } -uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) +BYTE* freerdp_image_convert_32bpp(BYTE* srcData, BYTE* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) { if (dstBpp == 16) { int index; - uint16 *dst16; - uint32 *src32; - uint8 red, green, blue; + UINT16 *dst16; + UINT32 *src32; + BYTE red, green, blue; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (BYTE*) malloc(width * height * 2); - dst16 = (uint16*) dstData; - src32 = (uint32*) srcData; + dst16 = (UINT16*) dstData; + src32 = (UINT32*) srcData; for (index = 0; index < width * height; index++) { @@ -642,12 +642,12 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in } else if (dstBpp == 24) { - uint8 *dstp; + BYTE *dstp; int index; - uint8 red, green, blue; + BYTE red, green, blue; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 3); + dstData = (BYTE*) malloc(width * height * 3); dstp = dstData; for (index = 0; index < width * height; index++) @@ -678,10 +678,10 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in if (clrconv->alpha) { int x, y; - uint8 *dstp; + BYTE *dstp; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (BYTE*) malloc(width * height * 4); memcpy(dstData, srcData, width * height * 4); @@ -699,7 +699,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in else { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (BYTE*) malloc(width * height * 4); memcpy(dstData, srcData, width * height * 4); } @@ -719,7 +719,7 @@ p_freerdp_image_convert freerdp_image_convert_[5] = freerdp_image_convert_32bpp }; -uint8* freerdp_image_convert(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) +BYTE* freerdp_image_convert(BYTE* srcData, BYTE* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv) { p_freerdp_image_convert _p_freerdp_image_convert = freerdp_image_convert_[IBPP(srcBpp)]; @@ -729,23 +729,23 @@ uint8* freerdp_image_convert(uint8* srcData, uint8* dstData, int width, int heig return 0; } -void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height) +void freerdp_bitmap_flip(BYTE * src, BYTE * dst, int scanLineSz, int height) { int i; - uint8 * bottomLine = dst + (scanLineSz * (height - 1)); - uint8 * topLine = src; + BYTE * bottomLine = dst + (scanLineSz * (height - 1)); + BYTE * topLine = src; /* Special processing if called for flip-in-place. */ if (src == dst) { /* Allocate a scanline buffer. - * (FIXME: xmalloc / xfree below should be replaced by "get/put + * (FIXME: malloc / xfree below should be replaced by "get/put * scanline buffer from a pool/Q of fixed buffers" to reuse * fixed size buffers (of max scanline size (or adaptative?) ) * -- would be much faster). */ - uint8 * tmpBfr = xmalloc(scanLineSz); + BYTE * tmpBfr = malloc(scanLineSz); int half = height / 2; /* Flip buffer in place by line permutations through the temp * scan line buffer. @@ -765,7 +765,7 @@ void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height) bottomLine -= scanLineSz; height--; } - xfree(tmpBfr); + free(tmpBfr); } /* Flip from source buffer to destination buffer. */ else @@ -781,24 +781,24 @@ void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height) } -uint8* freerdp_image_flip(uint8* srcData, uint8* dstData, int width, int height, int bpp) +BYTE* freerdp_image_flip(BYTE* srcData, BYTE* dstData, int width, int height, int bpp) { int scanline; scanline = width * ((bpp + 7) / 8); if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * ((bpp + 7) / 8)); + dstData = (BYTE*) malloc(width * height * ((bpp + 7) / 8)); freerdp_bitmap_flip(srcData, dstData, scanline, height); return dstData; } -uint8* freerdp_icon_convert(uint8* srcData, uint8* dstData, uint8* mask, int width, int height, int bpp, HCLRCONV clrconv) +BYTE* freerdp_icon_convert(BYTE* srcData, BYTE* dstData, BYTE* mask, int width, int height, int bpp, HCLRCONV clrconv) { - uint8* data; - uint8 bmask; - uint32* icon; + BYTE* data; + BYTE bmask; + UINT32* icon; int x, y, bit; int maskIndex; @@ -816,7 +816,7 @@ uint8* freerdp_icon_convert(uint8* srcData, uint8* dstData, uint8* mask, int wid if (bpp < 32) { maskIndex = 0; - icon = (uint32*) dstData; + icon = (UINT32*) dstData; for (y = 0; y < height; y++) { @@ -847,12 +847,12 @@ uint8* freerdp_icon_convert(uint8* srcData, uint8* dstData, uint8* mask, int wid return dstData; } -uint8* freerdp_glyph_convert(int width, int height, uint8* data) +BYTE* freerdp_glyph_convert(int width, int height, BYTE* data) { int x, y; - uint8 *srcp; - uint8 *dstp; - uint8 *dstData; + BYTE *srcp; + BYTE *dstp; + BYTE *dstData; int scanline; /* @@ -862,7 +862,7 @@ uint8* freerdp_glyph_convert(int width, int height, uint8* data) */ scanline = (width + 7) / 8; - dstData = (uint8*) xmalloc(width * height); + dstData = (BYTE*) malloc(width * height); memset(dstData, 0, width * height); dstp = dstData; @@ -884,16 +884,16 @@ uint8* freerdp_glyph_convert(int width, int height, uint8* data) return dstData; } -uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int srcBpp, int dstBpp, uint32 bgcolor, uint32 fgcolor, HCLRCONV clrconv) +BYTE* freerdp_mono_image_convert(BYTE* srcData, int width, int height, int srcBpp, int dstBpp, UINT32 bgcolor, UINT32 fgcolor, HCLRCONV clrconv) { int index; - uint16* dst16; - uint32* dst32; - uint8* dstData; - uint8 bitMask; + UINT16* dst16; + UINT32* dst32; + BYTE* dstData; + BYTE bitMask; int bitIndex; - uint8 redBg, greenBg, blueBg; - uint8 redFg, greenFg, blueFg; + BYTE redBg, greenBg, blueBg; + BYTE redFg, greenFg, blueFg; switch (srcBpp) { @@ -946,8 +946,8 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src } } - dstData = (uint8*) xmalloc(width * height * 2); - dst16 = (uint16*) dstData; + dstData = (BYTE*) malloc(width * height * 2); + dst16 = (UINT16*) dstData; for (index = height; index > 0; index--) { @@ -971,8 +971,8 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src } else if (dstBpp == 32) { - dstData = (uint8*) xmalloc(width * height * 4); - dst32 = (uint32*) dstData; + dstData = (BYTE*) malloc(width * height * 4); + dst32 = (UINT32*) dstData; for (index = height; index > 0; index--) { @@ -999,7 +999,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src return srcData; } -void freerdp_alpha_cursor_convert(uint8* alphaData, uint8* xorMask, uint8* andMask, int width, int height, int bpp, HCLRCONV clrconv) +void freerdp_alpha_cursor_convert(BYTE* alphaData, BYTE* xorMask, BYTE* andMask, int width, int height, int bpp, HCLRCONV clrconv) { int xpixel; int apixel; @@ -1034,13 +1034,13 @@ void freerdp_alpha_cursor_convert(uint8* alphaData, uint8* xorMask, uint8* andMa } } -void freerdp_image_swap_color_order(uint8* data, int width, int height) +void freerdp_image_swap_color_order(BYTE* data, int width, int height) { int x, y; - uint32* pixel; - uint8 a, r, g, b; + UINT32* pixel; + BYTE a, r, g, b; - pixel = (uint32*) data; + pixel = (UINT32*) data; for (y = 0; y < height; y++) { @@ -1053,13 +1053,13 @@ void freerdp_image_swap_color_order(uint8* data, int width, int height) } } -HCLRCONV freerdp_clrconv_new(uint32 flags) +HCLRCONV freerdp_clrconv_new(UINT32 flags) { HCLRCONV clrconv = xnew(CLRCONV); - clrconv->alpha = (flags & CLRCONV_ALPHA) ? true : false; - clrconv->invert = (flags & CLRCONV_INVERT) ? true : false; - clrconv->rgb555 = (flags & CLRCONV_RGB555) ? true : false; + clrconv->alpha = (flags & CLRCONV_ALPHA) ? TRUE : FALSE; + clrconv->invert = (flags & CLRCONV_INVERT) ? TRUE : FALSE; + clrconv->rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE; clrconv->palette = xnew(rdpPalette); return clrconv; @@ -1070,8 +1070,8 @@ void freerdp_clrconv_free(HCLRCONV clrconv) if (clrconv != NULL) { if (clrconv->palette != NULL) - xfree(clrconv->palette); + free(clrconv->palette); - xfree(clrconv); + free(clrconv); } } diff --git a/libfreerdp/codec/include/bitmap.c b/libfreerdp/codec/include/bitmap.c index 23f021a1a..8e923f151 100644 --- a/libfreerdp/codec/include/bitmap.c +++ b/libfreerdp/codec/include/bitmap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RLE Compressed Bitmap Stream * * Copyright 2011 Jay Sorg @@ -22,8 +22,8 @@ /** * Write a foreground/background image to a destination buffer. */ -static uint8* WRITEFGBGIMAGE(uint8* pbDest, uint32 rowDelta, - uint8 bitmask, PIXEL fgPel, uint32 cBits) +static BYTE* WRITEFGBGIMAGE(BYTE* pbDest, UINT32 rowDelta, + BYTE bitmask, PIXEL fgPel, UINT32 cBits) { PIXEL xorPixel; @@ -142,8 +142,8 @@ static uint8* WRITEFGBGIMAGE(uint8* pbDest, uint32 rowDelta, * Write a foreground/background image to a destination buffer * for the first line of compressed data. */ -static uint8* WRITEFIRSTLINEFGBGIMAGE(uint8* pbDest, uint8 bitmask, - PIXEL fgPel, uint32 cBits) +static BYTE* WRITEFIRSTLINEFGBGIMAGE(BYTE* pbDest, BYTE bitmask, + PIXEL fgPel, UINT32 cBits) { if (bitmask & g_MaskBit0) { @@ -251,25 +251,25 @@ static uint8* WRITEFIRSTLINEFGBGIMAGE(uint8* pbDest, uint8 bitmask, /** * Decompress an RLE compressed bitmap. */ -void RLEDECOMPRESS(uint8* pbSrcBuffer, uint32 cbSrcBuffer, uint8* pbDestBuffer, - uint32 rowDelta, uint32 width, uint32 height) +void RLEDECOMPRESS(BYTE* pbSrcBuffer, UINT32 cbSrcBuffer, BYTE* pbDestBuffer, + UINT32 rowDelta, UINT32 width, UINT32 height) { - uint8* pbSrc = pbSrcBuffer; - uint8* pbEnd = pbSrcBuffer + cbSrcBuffer; - uint8* pbDest = pbDestBuffer; + BYTE* pbSrc = pbSrcBuffer; + BYTE* pbEnd = pbSrcBuffer + cbSrcBuffer; + BYTE* pbDest = pbDestBuffer; PIXEL temp; PIXEL fgPel = WHITE_PIXEL; - boolean fInsertFgPel = false; - boolean fFirstLine = true; + BOOL fInsertFgPel = FALSE; + BOOL fFirstLine = TRUE; - uint8 bitmask; + BYTE bitmask; PIXEL pixelA, pixelB; - uint32 runLength; - uint32 code; + UINT32 runLength; + UINT32 code; - uint32 advance; + UINT32 advance; RLEEXTRA @@ -278,10 +278,10 @@ void RLEDECOMPRESS(uint8* pbSrcBuffer, uint32 cbSrcBuffer, uint8* pbDestBuffer, /* Watch out for the end of the first scanline. */ if (fFirstLine) { - if ((uint32)(pbDest - pbDestBuffer) >= rowDelta) + if ((UINT32)(pbDest - pbDestBuffer) >= rowDelta) { - fFirstLine = false; - fInsertFgPel = false; + fFirstLine = FALSE; + fInsertFgPel = FALSE; } } @@ -344,13 +344,13 @@ void RLEDECOMPRESS(uint8* pbSrcBuffer, uint32 cbSrcBuffer, uint8* pbDestBuffer, } } /* A follow-on background run order will need a foreground pel inserted. */ - fInsertFgPel = true; + fInsertFgPel = TRUE; continue; } /* For any of the other run-types a follow-on background run order does not need a foreground pel inserted. */ - fInsertFgPel = false; + fInsertFgPel = FALSE; switch (code) { diff --git a/libfreerdp/codec/jpeg.c b/libfreerdp/codec/jpeg.c index 89c7b3a00..ddd7c3e72 100644 --- a/libfreerdp/codec/jpeg.c +++ b/libfreerdp/codec/jpeg.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Compressed jpeg * * Copyright 2012 Jay Sorg @@ -44,7 +44,7 @@ static void my_init_source(j_decompress_ptr cinfo) } /*****************************************************************************/ -static boolean my_fill_input_buffer(j_decompress_ptr cinfo) +static BOOL my_fill_input_buffer(j_decompress_ptr cinfo) { struct mydata_decomp* md; @@ -60,7 +60,7 @@ static void my_skip_input_data(j_decompress_ptr cinfo, long num_bytes) } /*****************************************************************************/ -static boolean my_resync_to_restart(j_decompress_ptr cinfo, int desired) +static BOOL my_resync_to_restart(j_decompress_ptr cinfo, int desired) { return 1; } @@ -123,8 +123,8 @@ do_decompress(char* comp_data, int comp_data_bytes, } /* jpeg decompress */ -boolean -jpeg_decompress(uint8 * input, uint8 * output, int width, int height, int size, int bpp) +BOOL +jpeg_decompress(BYTE * input, BYTE * output, int width, int height, int size, int bpp) { int lwidth; int lheight; @@ -150,8 +150,8 @@ jpeg_decompress(uint8 * input, uint8 * output, int width, int height, int size, #else -boolean -jpeg_decompress(uint8 * input, uint8 * output, int width, int height, int size, int bpp) +BOOL +jpeg_decompress(BYTE * input, BYTE * output, int width, int height, int size, int bpp) { return 0; } diff --git a/libfreerdp/codec/mppc_dec.c b/libfreerdp/codec/mppc_dec.c index b1d378b77..e02862526 100644 --- a/libfreerdp/codec/mppc_dec.c +++ b/libfreerdp/codec/mppc_dec.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Implements Microsoft Point to Point Compression (MPPC) protocol * * Copyright 2011 Laxmikant Rashinkar @@ -30,72 +30,72 @@ #include -static uint8 HuffLenLEC[] = { +static BYTE HuffLenLEC[] = { 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x8, 0x9, 0x9, 0xa, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0x9, 0xa, 0x9, 0xa, 0x9, 0x9, 0x9, 0xa, 0xa, 0x9, 0xa, 0x9, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x8, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x7, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xd, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xb, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0xa, 0x8, 0x9, 0x9, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0xa, 0xa, 0xa, 0x9, 0x9, 0x8, 0x7, 0xd, 0xd, 0x7, 0x7, 0xa, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x5, 0x6, 0x6, 0x6, 0x5, 0x6, 0x5, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x8, 0x5, 0x6, 0x7, 0x7 }; -static uint16 HuffIndexLEC[512] = { +static UINT16 HuffIndexLEC[512] = { 0x007b, 0xff1f, 0xff0d, 0xfe27, 0xfe00, 0xff05, 0xff17, 0xfe68, 0x00c5, 0xfe07, 0xff13, 0xfec0, 0xff08, 0xfe18, 0xff1b, 0xfeb3, 0xfe03, 0x00a2, 0xfe42, 0xff10, 0xfe0b, 0xfe02, 0xfe91, 0xff19, 0xfe80, 0x00e9, 0xfe3a, 0xff15, 0xfe12, 0x0057, 0xfed7, 0xff1d, 0xff0e, 0xfe35, 0xfe69, 0xff22, 0xff18, 0xfe7a, 0xfe01, 0xff23, 0xff14, 0xfef4, 0xfeb4, 0xfe09, 0xff1c, 0xfec4, 0xff09, 0xfe60, 0xfe70, 0xff12, 0xfe05, 0xfe92, 0xfea1, 0xff1a, 0xfe0f, 0xff07, 0xfe56, 0xff16, 0xff02, 0xfed8, 0xfee8, 0xff1e, 0xfe1d, 0x003b, 0xffff, 0xff06, 0xffff, 0xfe71, 0xfe89, 0xffff, 0xffff, 0xfe2c, 0xfe2b, 0xfe20, 0xffff, 0xfebb, 0xfecf, 0xfe08, 0xffff, 0xfee0, 0xfe0d, 0xffff, 0xfe99, 0xffff, 0xfe04, 0xfeaa, 0xfe49, 0xffff, 0xfe17, 0xfe61, 0xfedf, 0xffff, 0xfeff, 0xfef6, 0xfe4c, 0xffff, 0xffff, 0xfe87, 0xffff, 0xff24, 0xffff, 0xfe3c, 0xfe72, 0xffff, 0xffff, 0xfece, 0xffff, 0xfefe, 0xffff, 0xfe23, 0xfebc, 0xfe0a, 0xfea9, 0xffff, 0xfe11, 0xffff, 0xfe82, 0xffff, 0xfe06, 0xfe9a, 0xfef5, 0xffff, 0xfe22, 0xfe4d, 0xfe5f, 0xffff, 0xff03, 0xfee1, 0xffff, 0xfeca, 0xfecc, 0xffff, 0xfe19, 0xffff, 0xfeb7, 0xffff, 0xffff, 0xfe83, 0xfe29, 0xffff, 0xffff, 0xffff, 0xfe6c, 0xffff, 0xfeed, 0xffff, 0xffff, 0xfe46, 0xfe5c, 0xfe15, 0xffff, 0xfedb, 0xfea6, 0xffff, 0xffff, 0xfe44, 0xffff, 0xfe0c, 0xffff, 0xfe95, 0xfefc, 0xffff, 0xffff, 0xfeb8, 0x16c9, 0xffff, 0xfef0, 0xffff, 0xfe38, 0xffff, 0xffff, 0xfe6d, 0xfe7e, 0xffff, 0xffff, 0xffff, 0xffff, 0xfe5b, 0xfedc, 0xffff, 0xffff, 0xfeec, 0xfe47, 0xfe1f, 0xffff, 0xfe7f, 0xfe96, 0xffff, 0xffff, 0xfea5, 0xffff, 0xfe10, 0xfe40, 0xfe32, 0xfebf, 0xffff, 0xffff, 0xfed4, 0xfef1, 0xffff, 0xffff, 0xffff, 0xfe75, 0xffff, 0xffff, 0xfe8d, 0xfe31, 0xffff, 0xfe65, 0xfe1b, 0xffff, 0xfee4, 0xfefb, 0xffff, 0xffff, 0xfe52, 0xffff, 0xfe0e, 0xffff, 0xfe9d, 0xfeaf, 0xffff, 0xffff, 0xfe51, 0xfed3, 0xffff, 0xff20, 0xffff, 0xfe2f, 0xffff, 0xffff, 0xfec1, 0xfe8c, 0xffff, 0xffff, 0xffff, 0xfe3f, 0xffff, 0xffff, 0xfe76, 0xffff, 0xfefa, 0xfe53, 0xfe25, 0xffff, 0xfe64, 0xfee5, 0xffff, 0xffff, 0xfeae, 0xffff, 0xfe13, 0xffff, 0xfe88, 0xfe9e, 0xffff, 0xfe43, 0xffff, 0xffff, 0xfea4, 0xfe93, 0xffff, 0xffff, 0xffff, 0xfe3d, 0xffff, 0xffff, 0xfeeb, 0xfed9, 0xffff, 0xfe14, 0xfe5a, 0xffff, 0xfe28, 0xfe7d, 0xffff, 0xffff, 0xfe6a, 0xffff, 0xffff, 0xff01, 0xfec6, 0xfec8, 0xffff, 0xffff, 0xfeb5, 0xffff, 0xffff, 0xffff, 0xfe94, 0xfe78, 0xffff, 0xffff, 0xffff, 0xfea3, 0xffff, 0xffff, 0xfeda, 0xfe58, 0xffff, 0xfe1e, 0xfe45, 0xfeea, 0xffff, 0xfe6b, 0xffff, 0xffff, 0xfe37, 0xffff, 0xffff, 0xffff, 0xfe7c, 0xfeb6, 0xffff, 0xffff, 0xfef8, 0xffff, 0xffff, 0xffff, 0xfec7, 0xfe9b, 0xffff, 0xffff, 0xffff, 0xfe50, 0xffff, 0xffff, 0xfead, 0xfee2, 0xffff, 0xfe1a, 0xfe63, 0xfe4e, 0xffff, 0xffff, 0xfef9, 0xffff, 0xfe73, 0xffff, 0xffff, 0xffff, 0xfe30, 0xfe8b, 0xffff, 0xffff, 0xfebd, 0xfe2e, 0x0100, 0xffff, 0xfeee, 0xfed2, 0xffff, 0xffff, 0xffff, 0xfeac, 0xffff, 0xffff, 0xfe9c, 0xfe84, 0xffff, 0xfe24, 0xfe4f, 0xfef7, 0xffff, 0xffff, 0xfee3, 0xfe62, 0xffff, 0xffff, 0xffff, 0xffff, 0xfe8a, 0xfe74, 0xffff, 0xffff, 0xfe3e, 0xffff, 0xffff, 0xffff, 0xfed1, 0xfebe, 0xffff, 0xffff, 0xfe2d, 0xffff, 0xfe4a, 0xfef3, 0xffff, 0xffff, 0xfedd, 0xfe5e, 0xfe16, 0xffff, 0xfe48, 0xfea8, 0xffff, 0xfeab, 0xfe97, 0xffff, 0xffff, 0xfed0, 0xffff, 0xffff, 0xfecd, 0xfeb9, 0xffff, 0xffff, 0xffff, 0xfe2a, 0xffff, 0xffff, 0xfe86, 0xfe6e, 0xffff, 0xffff, 0xffff, 0xfede, 0xffff, 0xffff, 0xfe5d, 0xfe4b, 0xfe21, 0xffff, 0xfeef, 0xfe98, 0xffff, 0xffff, 0xfe81, 0xffff, 0xffff, 0xffff, 0xfea7, 0xffff, 0xfeba, 0xfefd, 0xffff, 0xffff, 0xffff, 0xfecb, 0xffff, 0xffff, 0xfe6f, 0xfe39, 0xffff, 0xffff, 0xffff, 0xfe85, 0xffff, 0x010c, 0xfee6, 0xfe67, 0xfe1c, 0xffff, 0xfe54, 0xfeb2, 0xffff, 0xffff, 0xfe9f, 0xffff, 0xffff, 0xffff, 0xfe59, 0xfeb1, 0xffff, 0xfec2, 0xffff, 0xffff, 0xfe36, 0xfef2, 0xffff, 0xffff, 0xfed6, 0xfe77, 0xffff, 0xffff, 0xffff, 0xfe33, 0xffff, 0xffff, 0xfe8f, 0xfe55, 0xfe26, 0x010a, 0xff04, 0xfee7, 0xffff, 0x0121, 0xfe66, 0xffff, 0xffff, 0xffff, 0xfeb0, 0xfea0, 0xffff, 0x010f, 0xfe90, 0xffff, 0xffff, 0xfed5, 0xffff, 0xffff, 0xfec3, 0xfe34, 0xffff, 0xffff, 0xffff, 0xfe8e, 0xffff, 0x0111, 0xfe79, 0xfe41, 0x010b }; -static uint16 LECHTab[] = {511, 0, 508, 448, 494, 347, 486, 482}; +static UINT16 LECHTab[] = {511, 0, 508, 448, 494, 347, 486, 482}; -static uint8 HuffLenLOM[] = { +static BYTE HuffLenLOM[] = { 0x4, 0x2, 0x3, 0x4, 0x3, 0x4, 0x4, 0x5, 0x4, 0x5, 0x5, 0x6, 0x6, 0x7, 0x7, 0x8, 0x7, 0x8, 0x8, 0x9, 0x9, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9 }; -static uint16 HuffIndexLOM[] = { +static UINT16 HuffIndexLOM[] = { 0xfe1, 0xfe0, 0xfe2, 0xfe8, 0xe, 0xfe5, 0xfe4, 0xfea, 0xff1, 0xfe3, 0x15, 0xfe7, 0xfef, 0x46, 0xff0, 0xfed, 0xfff, 0xff7, 0xffb, 0x19, 0xffd, 0xff4, 0x12c, 0xfeb, 0xffe, 0xff6, 0xffa, 0x89, 0xffc, 0xff3, 0xff8, 0xff2 }; -static uint8 LOMHTab[] = {0, 4, 10, 19}; +static BYTE LOMHTab[] = {0, 4, 10, 19}; -static uint8 CopyOffsetBitsLUT[] = { +static BYTE CopyOffsetBitsLUT[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15 }; -static uint32 CopyOffsetBaseLUT[] = { +static UINT32 CopyOffsetBaseLUT[] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153, 65537 }; -static uint8 LOMBitsLUT[] = { +static BYTE LOMBitsLUT[] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 6, 6, 8, 8, 14, 14 }; -static uint16 LOMBaseLUT[] = { +static UINT16 LOMBaseLUT[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 22, 26, 30, 34, 42, 50, 58, 66, 82, 98, 114, 130, 194, 258, 514, 2, 2 }; -uint16 LEChash(uint16 key) +UINT16 LEChash(UINT16 key) { return ((key & 0x1ff) ^ (key >> 9) ^ (key >> 4) ^ (key >> 7)); } -uint16 LOMhash(uint16 key) +UINT16 LOMhash(UINT16 key) { return ((key & 0x1f) ^ (key >> 5) ^ (key >> 9)); } -uint16 miniLEChash(uint16 key) +UINT16 miniLEChash(UINT16 key) { - uint16 h; + UINT16 h; h = ((((key >> 8) ^ (key & 0xff)) >> 2) & 0xf); if(key >> 9) h = ~h; return (h % 12); } -uint8 miniLOMhash(uint16 key) +BYTE miniLOMhash(UINT16 key) { - uint8 h; + BYTE h; h = (key >> 4) & 0xf; return ((h ^ (h >> 2) ^ (h >> 3)) & 0x3); } -uint16 getLECindex(uint16 huff) +UINT16 getLECindex(UINT16 huff) { - uint16 h = HuffIndexLEC[LEChash(huff)]; + UINT16 h = HuffIndexLEC[LEChash(huff)]; if((h ^ huff) >> 9) return h & 0x1ff; else return HuffIndexLEC[LECHTab[miniLEChash(huff)]]; } -uint16 getLOMindex(uint16 huff) +UINT16 getLOMindex(UINT16 huff) { - uint16 h = HuffIndexLOM[LOMhash(huff)]; + UINT16 h = HuffIndexLOM[LOMhash(huff)]; if((h ^ huff) >> 5) { return h & 0x1f; @@ -104,7 +104,7 @@ uint16 getLOMindex(uint16 huff) return HuffIndexLOM[LOMHTab[miniLOMhash(huff)]]; } -uint32 transposebits(uint32 x) +UINT32 transposebits(UINT32 x) { x = ((x & 0x55555555) << 1) | ((x >> 1) & 0x55555555); x = ((x & 0x33333333) << 2) | ((x >> 2) & 0x33333333); @@ -119,16 +119,16 @@ uint32 transposebits(uint32 x) } #define cache_add(_s, _x) do { \ - *((uint32*)((_s)+2)) <<= 16; \ - *((uint32*)((_s)+2)) |= (*((uint32*)(_s)) >> 16); \ - *((uint32*)(_s)) = (*((uint32*)(_s)) << 16) | (_x); } while(0) + *((UINT32*)((_s)+2)) <<= 16; \ + *((UINT32*)((_s)+2)) |= (*((UINT32*)(_s)) >> 16); \ + *((UINT32*)(_s)) = (*((UINT32*)(_s)) << 16) | (_x); } while(0) #define cache_swap(_s, _i) do { \ - uint16 t = *(_s); \ + UINT16 t = *(_s); \ *(_s) = *((_s) + (_i)); \ *((_s) + (_i)) = t; } while(0) -int decompress_rdp(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen) +int decompress_rdp(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen) { int type = ctype & 0x0f; @@ -152,7 +152,7 @@ int decompress_rdp(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, ui default: printf("mppc.c: invalid RDP compression code 0x%2.2x\n", type); - return false; + return FALSE; } } @@ -169,27 +169,27 @@ int decompress_rdp(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, ui * @return True on success, False on failure */ -int decompress_rdp_4(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen) +int decompress_rdp_4(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen) { - uint8* history_buf; /* uncompressed data goes here */ - uint8* history_ptr; /* points to next free slot in history_buf */ - uint32 d32; /* we process 4 compressed bytes at a time */ - uint16 copy_offset; /* location to copy data from */ - uint16 lom; /* length of match */ - uint8* src_ptr; /* used while copying compressed data */ - uint8* cptr; /* points to next byte in cbuf */ - uint8 cur_byte; /* last byte fetched from cbuf */ + BYTE* history_buf; /* uncompressed data goes here */ + BYTE* history_ptr; /* points to next free slot in history_buf */ + UINT32 d32; /* we process 4 compressed bytes at a time */ + UINT16 copy_offset; /* location to copy data from */ + UINT16 lom; /* length of match */ + BYTE* src_ptr; /* used while copying compressed data */ + BYTE* cptr; /* points to next byte in cbuf */ + BYTE cur_byte; /* last byte fetched from cbuf */ int bits_left; /* bits left in d34 for processing */ int cur_bits_left; /* bits left in cur_byte for processing */ int tmp; - uint32 i32; + UINT32 i32; printf("decompress_rdp_4:\n"); if ((dec == NULL) || (dec->history_buf == NULL)) { printf("decompress_rdp_4: null\n"); - return false; + return FALSE; } src_ptr = 0; @@ -232,7 +232,7 @@ int decompress_rdp_4(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, history_ptr += len; *rlen = history_ptr - dec->history_ptr; dec->history_ptr = history_ptr; - return true; + return TRUE; } /* load initial data */ @@ -583,7 +583,7 @@ int decompress_rdp_4(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, dec->history_ptr = history_ptr; - return true; + return TRUE; } /** @@ -599,25 +599,25 @@ int decompress_rdp_4(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, * @return True on success, False on failure */ -int decompress_rdp_5(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen) +int decompress_rdp_5(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen) { - uint8* history_buf; /* uncompressed data goes here */ - uint8* history_ptr; /* points to next free slot in bistory_buf */ - uint32 d32; /* we process 4 compressed bytes at a time */ - uint16 copy_offset; /* location to copy data from */ - uint16 lom; /* length of match */ - uint8* src_ptr; /* used while copying compressed data */ - uint8* cptr; /* points to next byte in cbuf */ - uint8 cur_byte; /* last byte fetched from cbuf */ + BYTE* history_buf; /* uncompressed data goes here */ + BYTE* history_ptr; /* points to next free slot in bistory_buf */ + UINT32 d32; /* we process 4 compressed bytes at a time */ + UINT16 copy_offset; /* location to copy data from */ + UINT16 lom; /* length of match */ + BYTE* src_ptr; /* used while copying compressed data */ + BYTE* cptr; /* points to next byte in cbuf */ + BYTE cur_byte; /* last byte fetched from cbuf */ int bits_left; /* bits left in d32 for processing */ int cur_bits_left; /* bits left in cur_byte for processing */ int tmp; - uint32 i32; + UINT32 i32; if ((dec == NULL) || (dec->history_buf == NULL)) { printf("decompress_rdp_5: null\n"); - return false; + return FALSE; } src_ptr = 0; @@ -660,7 +660,7 @@ int decompress_rdp_5(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, history_ptr += len; *rlen = history_ptr - dec->history_ptr; dec->history_ptr = history_ptr; - return true; + return TRUE; } /* load initial data */ @@ -1047,7 +1047,7 @@ int decompress_rdp_5(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, dec->history_ptr = history_ptr; - return true; + return TRUE; } /** @@ -1063,27 +1063,27 @@ int decompress_rdp_5(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, * @return True on success, False on failure */ -int decompress_rdp_6(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen) +int decompress_rdp_6(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen) { - uint8* history_buf; /* uncompressed data goes here */ - uint16* offset_cache; /* Copy Offset cache */ - uint8* history_ptr; /* points to next free slot in bistory_buf */ - uint32 d32; /* we process 4 compressed bytes at a time */ - uint16 copy_offset; /* location to copy data from */ - uint16 lom; /* length of match */ - uint16 LUTIndex; /* LookUp table Index */ - uint8* src_ptr; /* used while copying compressed data */ - uint8* cptr; /* points to next byte in cbuf */ - uint8 cur_byte; /* last byte fetched from cbuf */ + BYTE* history_buf; /* uncompressed data goes here */ + UINT16* offset_cache; /* Copy Offset cache */ + BYTE* history_ptr; /* points to next free slot in bistory_buf */ + UINT32 d32; /* we process 4 compressed bytes at a time */ + UINT16 copy_offset; /* location to copy data from */ + UINT16 lom; /* length of match */ + UINT16 LUTIndex; /* LookUp table Index */ + BYTE* src_ptr; /* used while copying compressed data */ + BYTE* cptr; /* points to next byte in cbuf */ + BYTE cur_byte; /* last byte fetched from cbuf */ int bits_left; /* bits left in d32 for processing */ int cur_bits_left; /* bits left in cur_byte for processing */ int tmp, i; - uint32 i32; + UINT32 i32; if ((dec == NULL) || (dec->history_buf == NULL)) { printf("decompress_rdp_6: null\n"); - return false; + return FALSE; } src_ptr = 0; @@ -1131,7 +1131,7 @@ int decompress_rdp_6(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, history_ptr += len; *rlen = history_ptr - dec->history_ptr; dec->history_ptr = history_ptr; - return true; + return TRUE; } /* load initial data */ @@ -1180,7 +1180,7 @@ int decompress_rdp_6(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, d32 <<= i; bits_left -= i; if(i32 < 256) - *history_ptr++ = (uint8)i32; + *history_ptr++ = (BYTE)i32; else if(i32 > 256 && i32 < 289) { LUTIndex = i32 - 257; @@ -1382,7 +1382,7 @@ int decompress_rdp_6(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, dec->history_ptr = history_ptr; - return true; + return TRUE; } /** @@ -1398,9 +1398,9 @@ int decompress_rdp_6(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, * @return True on success, False on failure */ -int decompress_rdp_61(struct rdp_mppc_dec* dec, uint8* cbuf, int len, int ctype, uint32* roff, uint32* rlen) +int decompress_rdp_61(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen) { - return false; + return FALSE; } /** @@ -1414,19 +1414,19 @@ struct rdp_mppc_dec* mppc_dec_new(void) { struct rdp_mppc_dec* ptr; - ptr = (struct rdp_mppc_dec*) xmalloc(sizeof(struct rdp_mppc_dec)); + ptr = (struct rdp_mppc_dec*) malloc(sizeof(struct rdp_mppc_dec)); if (!ptr) { printf("mppc_new(): system out of memory\n"); return NULL; } - ptr->history_buf = (uint8 *) xzalloc(RDP6_HISTORY_BUF_SIZE); - ptr->offset_cache = (uint16 *) xzalloc(RDP6_OFFSET_CACHE_SIZE); + ptr->history_buf = (BYTE *) xzalloc(RDP6_HISTORY_BUF_SIZE); + ptr->offset_cache = (UINT16 *) xzalloc(RDP6_OFFSET_CACHE_SIZE); if (!ptr->history_buf) { printf("mppc_new(): system out of memory\n"); - xfree(ptr); + free(ptr); return NULL; } @@ -1450,14 +1450,14 @@ void mppc_dec_free(struct rdp_mppc_dec* dec) if (dec->history_buf) { - xfree(dec->history_buf); + free(dec->history_buf); dec->history_buf = NULL; dec->history_ptr = NULL; } if (dec->offset_cache) { - xfree(dec->offset_cache); + free(dec->offset_cache); dec->offset_cache = NULL; } - xfree(dec); + free(dec); } diff --git a/libfreerdp/codec/mppc_enc.c b/libfreerdp/codec/mppc_enc.c index b8264fb83..8e6238afc 100644 --- a/libfreerdp/codec/mppc_enc.c +++ b/libfreerdp/codec/mppc_enc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Implements Microsoft Point to Point Compression (MPPC) protocol * * Copyright 2012 Laxmikant Rashinkar @@ -41,7 +41,7 @@ #define CRC(crcval, newchar) crcval = (crcval >> 8) ^ crc_table[(crcval ^ newchar) & 0x00ff] /* CRC16 defs */ -static const uint16 crc_table[256] = +static const UINT16 crc_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, @@ -444,30 +444,30 @@ struct rdp_mppc_enc* mppc_enc_new(int protocol_type) enc->buf_len = RDP_50_HIST_BUF_LEN; break; default: - xfree(enc); + free(enc); return NULL; } enc->first_pkt = 1; enc->historyBuffer = (char*) xzalloc(enc->buf_len); if (enc->historyBuffer == NULL) { - xfree(enc); + free(enc); return NULL; } enc->outputBufferPlus = (char*) xzalloc(enc->buf_len + 64); if (enc->outputBufferPlus == NULL) { - xfree(enc->historyBuffer); - xfree(enc); + free(enc->historyBuffer); + free(enc); return NULL; } enc->outputBuffer = enc->outputBufferPlus + 64; - enc->hash_table = (uint16*) xzalloc(enc->buf_len * 2); + enc->hash_table = (UINT16*) xzalloc(enc->buf_len * 2); if (enc->hash_table == NULL) { - xfree(enc->historyBuffer); - xfree(enc->outputBufferPlus); - xfree(enc); + free(enc->historyBuffer); + free(enc->outputBufferPlus); + free(enc); return NULL; } return enc; @@ -483,10 +483,10 @@ void mppc_enc_free(struct rdp_mppc_enc* enc) { if (enc == NULL) return; - xfree(enc->historyBuffer); - xfree(enc->outputBufferPlus); - xfree(enc->hash_table); - xfree(enc); + free(enc->historyBuffer); + free(enc->outputBufferPlus); + free(enc->hash_table); + free(enc); } /** @@ -496,13 +496,13 @@ void mppc_enc_free(struct rdp_mppc_enc* enc) * @param srcData uncompressed data * @param len length of srcData * - * @return true on success, false on failure + * @return TRUE on success, FALSE on failure */ -boolean compress_rdp(struct rdp_mppc_enc* enc, uint8* srcData, int len) +BOOL compress_rdp(struct rdp_mppc_enc* enc, BYTE* srcData, int len) { if ((enc == NULL) || (srcData == NULL) || (len <= 0) || (len > enc->buf_len)) - return false; + return FALSE; switch (enc->protocol_type) { case PROTO_RDP_40: @@ -512,7 +512,7 @@ boolean compress_rdp(struct rdp_mppc_enc* enc, uint8* srcData, int len) return compress_rdp_5(enc, srcData, len); break; } - return false; + return FALSE; } /** @@ -522,13 +522,13 @@ boolean compress_rdp(struct rdp_mppc_enc* enc, uint8* srcData, int len) * @param srcData uncompressed data * @param len length of srcData * - * @return true on success, false on failure + * @return TRUE on success, FALSE on failure */ -boolean compress_rdp_4(struct rdp_mppc_enc* enc, uint8* srcData, int len) +BOOL compress_rdp_4(struct rdp_mppc_enc* enc, BYTE* srcData, int len) { /* RDP 4.0 encoding not yet implemented */ - return false; + return FALSE; } /** @@ -538,10 +538,10 @@ boolean compress_rdp_4(struct rdp_mppc_enc* enc, uint8* srcData, int len) * @param srcData uncompressed data * @param len length of srcData * - * @return true on success, false on failure + * @return TRUE on success, FALSE on failure */ -boolean compress_rdp_5(struct rdp_mppc_enc* enc, uint8* srcData, int len) +BOOL compress_rdp_5(struct rdp_mppc_enc* enc, BYTE* srcData, int len) { char* outputBuffer; /* points to enc->outputBuffer */ char* hptr_end; /* points to end of history data */ @@ -551,23 +551,23 @@ boolean compress_rdp_5(struct rdp_mppc_enc* enc, uint8* srcData, int len) char* cptr2; int opb_index; /* index into outputBuffer */ int bits_left; /* unused bits in current byte in outputBuffer */ - uint32 copy_offset; /* pattern match starts here... */ - uint32 lom; /* ...and matches this many bytes */ + UINT32 copy_offset; /* pattern match starts here... */ + UINT32 lom; /* ...and matches this many bytes */ int last_crc_index; /* don't compute CRC beyond this index */ - uint16 *hash_table; /* hash table for pattern matching */ + UINT16 *hash_table; /* hash table for pattern matching */ - uint32 i; - uint32 j; - uint32 k; - uint32 x; - uint8 data; - uint16 data16; - uint32 historyOffset; - uint16 crc; - uint32 ctr; - uint32 saved_ctr; - uint32 data_end; - uint8 byte_val; + UINT32 i; + UINT32 j; + UINT32 k; + UINT32 x; + BYTE data; + UINT16 data16; + UINT32 historyOffset; + UINT16 crc; + UINT32 ctr; + UINT32 saved_ctr; + UINT32 data_end; + BYTE byte_val; crc = 0; opb_index = 0; @@ -980,7 +980,7 @@ boolean compress_rdp_5(struct rdp_mppc_enc* enc, uint8* srcData, int len) memset(hash_table, 0, enc->buf_len * 2); enc->flagsHold |= PACKET_FLUSHED; enc->first_pkt = 1; - return true; + return TRUE; } else if (opb_index + 1 > len) { @@ -990,7 +990,7 @@ boolean compress_rdp_5(struct rdp_mppc_enc* enc, uint8* srcData, int len) memset(hash_table, 0, enc->buf_len * 2); enc->flagsHold |= PACKET_FLUSHED; enc->first_pkt = 1; - return true; + return TRUE; } /* if bits_left != 8, increment opb_index, which is zero indexed */ @@ -1006,7 +1006,7 @@ boolean compress_rdp_5(struct rdp_mppc_enc* enc, uint8* srcData, int len) memset(hash_table, 0, enc->buf_len * 2); enc->flagsHold |= PACKET_FLUSHED; enc->first_pkt = 1; - return true; + return TRUE; } enc->flags |= PACKET_COMPRESSED; enc->bytes_in_opb = opb_index; @@ -1015,5 +1015,5 @@ boolean compress_rdp_5(struct rdp_mppc_enc* enc, uint8* srcData, int len) enc->flagsHold = 0; DLOG(("\n")); - return true; + return TRUE; } diff --git a/libfreerdp/codec/nsc.c b/libfreerdp/codec/nsc.c index 4ce27529d..c76e2a20a 100644 --- a/libfreerdp/codec/nsc.c +++ b/libfreerdp/codec/nsc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Codec * * Copyright 2011 Samsung, Author Jiten Pathy @@ -45,21 +45,21 @@ static void nsc_decode(NSC_CONTEXT* context) { - uint16 x; - uint16 y; - uint16 rw; - uint8 shift; - uint8* yplane; - uint8* coplane; - uint8* cgplane; - uint8* aplane; - sint16 y_val; - sint16 co_val; - sint16 cg_val; - sint16 r_val; - sint16 g_val; - sint16 b_val; - uint8* bmpdata; + UINT16 x; + UINT16 y; + UINT16 rw; + BYTE shift; + BYTE* yplane; + BYTE* coplane; + BYTE* cgplane; + BYTE* aplane; + INT16 y_val; + INT16 co_val; + INT16 cg_val; + INT16 r_val; + INT16 g_val; + INT16 b_val; + BYTE* bmpdata; bmpdata = context->bmpdata; rw = ROUND_UP_TO(context->width, 8); @@ -82,9 +82,9 @@ static void nsc_decode(NSC_CONTEXT* context) aplane = context->priv->plane_buf[3] + y * context->width; /* A */ for (x = 0; x < context->width; x++) { - y_val = (sint16) *yplane; - co_val = (sint16) (sint8) (*coplane << shift); - cg_val = (sint16) (sint8) (*cgplane << shift); + y_val = (INT16) *yplane; + co_val = (INT16) (INT8) (*coplane << shift); + cg_val = (INT16) (INT8) (*cgplane << shift); r_val = y_val + co_val - cg_val; g_val = y_val + cg_val; b_val = y_val - co_val - cg_val; @@ -100,11 +100,11 @@ static void nsc_decode(NSC_CONTEXT* context) } } -static void nsc_rle_decode(uint8* in, uint8* out, uint32 origsz) +static void nsc_rle_decode(BYTE* in, BYTE* out, UINT32 origsz) { - uint32 len; - uint32 left; - uint8 value; + UINT32 len; + UINT32 left; + BYTE value; left = origsz; while (left > 4) @@ -121,13 +121,13 @@ static void nsc_rle_decode(uint8* in, uint8* out, uint32 origsz) in++; if (*in < 0xFF) { - len = (uint32) *in++; + len = (UINT32) *in++; len += 2; } else { in++; - len = *((uint32*) in); + len = *((UINT32*) in); in += 4; } memset(out, value, len); @@ -141,15 +141,15 @@ static void nsc_rle_decode(uint8* in, uint8* out, uint32 origsz) } } - *((uint32*)out) = *((uint32*)in); + *((UINT32*)out) = *((UINT32*)in); } static void nsc_rle_decompress_data(NSC_CONTEXT* context) { - uint16 i; - uint8* rle; - uint32 origsize; - uint32 planesize; + UINT16 i; + BYTE* rle; + UINT32 origsize; + UINT32 planesize; rle = context->nsc_stream.Planes; @@ -174,10 +174,10 @@ static void nsc_stream_initialize(NSC_CONTEXT* context, STREAM* s) int i; for (i = 0; i < 4; i++) - stream_read_uint32(s, context->nsc_stream.PlaneByteCount[i]); + stream_read_UINT32(s, context->nsc_stream.PlaneByteCount[i]); - stream_read_uint8(s, context->nsc_stream.ColorLossLevel); - stream_read_uint8(s, context->nsc_stream.ChromaSubSamplingLevel); + stream_read_BYTE(s, context->nsc_stream.ColorLossLevel); + stream_read_BYTE(s, context->nsc_stream.ChromaSubSamplingLevel); stream_seek(s, 2); context->nsc_stream.Planes = stream_get_tail(s); @@ -186,9 +186,9 @@ static void nsc_stream_initialize(NSC_CONTEXT* context, STREAM* s) static void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s) { int i; - uint32 length; - uint32 tempWidth; - uint32 tempHeight; + UINT32 length; + UINT32 tempWidth; + UINT32 tempHeight; nsc_stream_initialize(context, s); length = context->width * context->height * 4; @@ -199,7 +199,7 @@ static void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s) } else if (length > context->bmpdata_length) { - context->bmpdata = xrealloc(context->bmpdata, length + 16); + context->bmpdata = realloc(context->bmpdata, length + 16); context->bmpdata_length = length; } @@ -210,7 +210,7 @@ static void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s) if (length > context->priv->plane_buf_length) { for (i = 0; i < 4; i++) - context->priv->plane_buf[i] = (uint8*) xrealloc(context->priv->plane_buf[i], length); + context->priv->plane_buf[i] = (BYTE*) realloc(context->priv->plane_buf[i], length); context->priv->plane_buf_length = length; } @@ -244,10 +244,10 @@ void nsc_context_free(NSC_CONTEXT* context) for (i = 0; i < 4; i++) { if (context->priv->plane_buf[i]) - xfree(context->priv->plane_buf[i]); + free(context->priv->plane_buf[i]); } if (context->bmpdata) - xfree(context->bmpdata); + free(context->bmpdata); nsc_profiler_print(context); PROFILER_FREE(context->priv->prof_nsc_rle_decompress_data); @@ -255,8 +255,8 @@ void nsc_context_free(NSC_CONTEXT* context) PROFILER_FREE(context->priv->prof_nsc_rle_compress_data); PROFILER_FREE(context->priv->prof_nsc_encode); - xfree(context->priv); - xfree(context); + free(context->priv); + free(context); } NSC_CONTEXT* nsc_context_new(void) @@ -281,7 +281,7 @@ NSC_CONTEXT* nsc_context_new(void) return nsc_context; } -void nsc_context_set_cpu_opt(NSC_CONTEXT* context, uint32 cpu_opt) +void nsc_context_set_cpu_opt(NSC_CONTEXT* context, UINT32 cpu_opt) { if (cpu_opt) NSC_INIT_SIMD(context); @@ -316,8 +316,8 @@ void nsc_context_set_pixel_format(NSC_CONTEXT* context, RDP_PIXEL_FORMAT pixel_f } } -void nsc_process_message(NSC_CONTEXT* context, uint16 bpp, - uint16 width, uint16 height, uint8* data, uint32 length) +void nsc_process_message(NSC_CONTEXT* context, UINT16 bpp, + UINT16 width, UINT16 height, BYTE* data, UINT32 length) { STREAM* s; diff --git a/libfreerdp/codec/nsc_encode.c b/libfreerdp/codec/nsc_encode.c index 50a9c5bce..68f5f4c39 100644 --- a/libfreerdp/codec/nsc_encode.c +++ b/libfreerdp/codec/nsc_encode.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Encoder * * Copyright 2012 Vic Lee @@ -37,9 +37,9 @@ static void nsc_context_initialize_encode(NSC_CONTEXT* context) { int i; - uint32 length; - uint32 tempWidth; - uint32 tempHeight; + UINT32 length; + UINT32 tempWidth; + UINT32 tempHeight; tempWidth = ROUND_UP_TO(context->width, 8); tempHeight = ROUND_UP_TO(context->height, 2); @@ -48,7 +48,7 @@ static void nsc_context_initialize_encode(NSC_CONTEXT* context) if (length > context->priv->plane_buf_length) { for (i = 0; i < 5; i++) - context->priv->plane_buf[i] = (uint8*) xrealloc(context->priv->plane_buf[i], length); + context->priv->plane_buf[i] = (BYTE*) realloc(context->priv->plane_buf[i], length); context->priv->plane_buf_length = length; } @@ -68,23 +68,23 @@ static void nsc_context_initialize_encode(NSC_CONTEXT* context) } } -static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, uint8* bmpdata, int rowstride) +static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride) { - uint16 x; - uint16 y; - uint16 rw; - uint8 ccl; - uint8* src; - uint8* yplane; - uint8* coplane; - uint8* cgplane; - uint8* aplane; - sint16 r_val; - sint16 g_val; - sint16 b_val; - uint8 a_val; - uint32 tempWidth; - uint32 tempHeight; + UINT16 x; + UINT16 y; + UINT16 rw; + BYTE ccl; + BYTE* src; + BYTE* yplane; + BYTE* coplane; + BYTE* cgplane; + BYTE* aplane; + INT16 r_val; + INT16 g_val; + INT16 b_val; + BYTE a_val; + UINT32 tempWidth; + UINT32 tempHeight; tempWidth = ROUND_UP_TO(context->width, 8); tempHeight = ROUND_UP_TO(context->height, 2); @@ -131,23 +131,23 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, uint8* bmpdata, int a_val = 0xFF; break; case RDP_PIXEL_FORMAT_B5G6R5_LE: - b_val = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); - g_val = (sint16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); - r_val = (sint16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); + b_val = (INT16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); + g_val = (INT16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); + r_val = (INT16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); a_val = 0xFF; src += 2; break; case RDP_PIXEL_FORMAT_R5G6B5_LE: - r_val = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); - g_val = (sint16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); - b_val = (sint16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); + r_val = (INT16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); + g_val = (INT16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); + b_val = (INT16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); a_val = 0xFF; src += 2; break; case RDP_PIXEL_FORMAT_P4_PLANER: { int shift; - uint8 idx; + BYTE idx; shift = (7 - (x % 8)); idx = ((*src) >> shift) & 1; @@ -155,9 +155,9 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, uint8* bmpdata, int idx |= (((*(src + 2)) >> shift) & 1) << 2; idx |= (((*(src + 3)) >> shift) & 1) << 3; idx *= 3; - r_val = (sint16) context->palette[idx]; - g_val = (sint16) context->palette[idx + 1]; - b_val = (sint16) context->palette[idx + 2]; + r_val = (INT16) context->palette[idx]; + g_val = (INT16) context->palette[idx + 1]; + b_val = (INT16) context->palette[idx + 2]; if (shift == 0) src += 4; } @@ -167,9 +167,9 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, uint8* bmpdata, int { int idx = (*src) * 3; - r_val = (sint16) context->palette[idx]; - g_val = (sint16) context->palette[idx + 1]; - b_val = (sint16) context->palette[idx + 2]; + r_val = (INT16) context->palette[idx]; + g_val = (INT16) context->palette[idx + 1]; + b_val = (INT16) context->palette[idx + 2]; src++; } a_val = 0xFF; @@ -178,10 +178,10 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, uint8* bmpdata, int r_val = g_val = b_val = a_val = 0; break; } - *yplane++ = (uint8) ((r_val >> 2) + (g_val >> 1) + (b_val >> 2)); + *yplane++ = (BYTE) ((r_val >> 2) + (g_val >> 1) + (b_val >> 2)); /* Perform color loss reduction here */ - *coplane++ = (uint8) ((r_val - b_val) >> ccl); - *cgplane++ = (uint8) ((-(r_val >> 1) + g_val - (b_val >> 1)) >> ccl); + *coplane++ = (BYTE) ((r_val - b_val) >> ccl); + *cgplane++ = (BYTE) ((-(r_val >> 1) + g_val - (b_val >> 1)) >> ccl); *aplane++ = a_val; } if (context->nsc_stream.ChromaSubSamplingLevel > 0 && (x % 2) == 1) @@ -201,16 +201,16 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, uint8* bmpdata, int static void nsc_encode_subsampling(NSC_CONTEXT* context) { - uint16 x; - uint16 y; - uint8* co_dst; - uint8* cg_dst; - sint8* co_src0; - sint8* co_src1; - sint8* cg_src0; - sint8* cg_src1; - uint32 tempWidth; - uint32 tempHeight; + UINT16 x; + UINT16 y; + BYTE* co_dst; + BYTE* cg_dst; + INT8* co_src0; + INT8* co_src1; + INT8* cg_src0; + INT8* cg_src1; + UINT32 tempWidth; + UINT32 tempHeight; tempWidth = ROUND_UP_TO(context->width, 8); tempHeight = ROUND_UP_TO(context->height, 2); @@ -219,16 +219,16 @@ static void nsc_encode_subsampling(NSC_CONTEXT* context) { co_dst = context->priv->plane_buf[1] + y * (tempWidth >> 1); cg_dst = context->priv->plane_buf[2] + y * (tempWidth >> 1); - co_src0 = (sint8*) context->priv->plane_buf[1] + (y << 1) * tempWidth; + co_src0 = (INT8*) context->priv->plane_buf[1] + (y << 1) * tempWidth; co_src1 = co_src0 + tempWidth; - cg_src0 = (sint8*) context->priv->plane_buf[2] + (y << 1) * tempWidth; + cg_src0 = (INT8*) context->priv->plane_buf[2] + (y << 1) * tempWidth; cg_src1 = cg_src0 + tempWidth; for (x = 0; x < tempWidth >> 1; x++) { - *co_dst++ = (uint8) (((sint16) *co_src0 + (sint16) *(co_src0 + 1) + - (sint16) *co_src1 + (sint16) *(co_src1 + 1)) >> 2); - *cg_dst++ = (uint8) (((sint16) *cg_src0 + (sint16) *(cg_src0 + 1) + - (sint16) *cg_src1 + (sint16) *(cg_src1 + 1)) >> 2); + *co_dst++ = (BYTE) (((INT16) *co_src0 + (INT16) *(co_src0 + 1) + + (INT16) *co_src1 + (INT16) *(co_src1 + 1)) >> 2); + *cg_dst++ = (BYTE) (((INT16) *cg_src0 + (INT16) *(cg_src0 + 1) + + (INT16) *cg_src1 + (INT16) *(cg_src1 + 1)) >> 2); co_src0 += 2; co_src1 += 2; cg_src0 += 2; @@ -237,7 +237,7 @@ static void nsc_encode_subsampling(NSC_CONTEXT* context) } } -void nsc_encode(NSC_CONTEXT* context, uint8* bmpdata, int rowstride) +void nsc_encode(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride) { nsc_encode_argb_to_aycocg(context, bmpdata, rowstride); if (context->nsc_stream.ChromaSubSamplingLevel > 0) @@ -246,11 +246,11 @@ void nsc_encode(NSC_CONTEXT* context, uint8* bmpdata, int rowstride) } } -static uint32 nsc_rle_encode(uint8* in, uint8* out, uint32 origsz) +static UINT32 nsc_rle_encode(BYTE* in, BYTE* out, UINT32 origsz) { - uint32 left; - uint32 runlength = 1; - uint32 planesize = 0; + UINT32 left; + UINT32 runlength = 1; + UINT32 planesize = 0; left = origsz; /** @@ -302,10 +302,10 @@ static uint32 nsc_rle_encode(uint8* in, uint8* out, uint32 origsz) static void nsc_rle_compress_data(NSC_CONTEXT* context) { - uint16 i; - uint8* rle; - uint32 origsize; - uint32 planesize; + UINT16 i; + BYTE* rle; + UINT32 origsize; + UINT32 planesize; rle = context->nsc_stream.Planes; @@ -331,7 +331,7 @@ static void nsc_rle_compress_data(NSC_CONTEXT* context) } void nsc_compose_message(NSC_CONTEXT* context, STREAM* s, - uint8* bmpdata, int width, int height, int rowstride) + BYTE* bmpdata, int width, int height, int rowstride) { int i; @@ -351,13 +351,13 @@ void nsc_compose_message(NSC_CONTEXT* context, STREAM* s, /* Assemble the NSCodec message into stream */ stream_check_size(s, 20); - stream_write_uint32(s, context->nsc_stream.PlaneByteCount[0]); /* LumaPlaneByteCount (4 bytes) */ - stream_write_uint32(s, context->nsc_stream.PlaneByteCount[1]); /* OrangeChromaPlaneByteCount (4 bytes) */ - stream_write_uint32(s, context->nsc_stream.PlaneByteCount[2]); /* GreenChromaPlaneByteCount (4 bytes) */ - stream_write_uint32(s, context->nsc_stream.PlaneByteCount[3]); /* AlphaPlaneByteCount (4 bytes) */ - stream_write_uint8(s, context->nsc_stream.ColorLossLevel); /* ColorLossLevel (1 byte) */ - stream_write_uint8(s, context->nsc_stream.ChromaSubSamplingLevel); /* ChromaSubsamplingLevel (1 byte) */ - stream_write_uint16(s, 0); /* Reserved (2 bytes) */ + stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[0]); /* LumaPlaneByteCount (4 bytes) */ + stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[1]); /* OrangeChromaPlaneByteCount (4 bytes) */ + stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[2]); /* GreenChromaPlaneByteCount (4 bytes) */ + stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[3]); /* AlphaPlaneByteCount (4 bytes) */ + stream_write_BYTE(s, context->nsc_stream.ColorLossLevel); /* ColorLossLevel (1 byte) */ + stream_write_BYTE(s, context->nsc_stream.ChromaSubSamplingLevel); /* ChromaSubsamplingLevel (1 byte) */ + stream_write_UINT16(s, 0); /* Reserved (2 bytes) */ for (i = 0; i < 4; i++) { diff --git a/libfreerdp/codec/nsc_encode.h b/libfreerdp/codec/nsc_encode.h index 10b1bfc02..f4c320197 100644 --- a/libfreerdp/codec/nsc_encode.h +++ b/libfreerdp/codec/nsc_encode.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Encoder * * Copyright 2012 Vic Lee @@ -20,6 +20,6 @@ #ifndef __NSC_ENCODE_H #define __NSC_ENCODE_H -void nsc_encode(NSC_CONTEXT* context, uint8* bmpdata, int rowstride); +void nsc_encode(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride); #endif diff --git a/libfreerdp/codec/nsc_sse2.c b/libfreerdp/codec/nsc_sse2.c index 04868b11e..f1a033fc4 100644 --- a/libfreerdp/codec/nsc_sse2.c +++ b/libfreerdp/codec/nsc_sse2.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Library - SSE2 Optimizations * * Copyright 2012 Vic Lee @@ -31,17 +31,17 @@ #include "nsc_types.h" #include "nsc_sse2.h" -static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context, uint8* bmpdata, int rowstride) +static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride) { - uint16 x; - uint16 y; - uint16 rw; - uint8 ccl; - uint8* src; - uint8* yplane; - uint8* coplane; - uint8* cgplane; - uint8* aplane; + UINT16 x; + UINT16 y; + UINT16 rw; + BYTE ccl; + BYTE* src; + BYTE* yplane; + BYTE* coplane; + BYTE* cgplane; + BYTE* aplane; __m128i r_val; __m128i g_val; __m128i b_val; @@ -49,8 +49,8 @@ static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context, uint8* bmpdata, __m128i y_val; __m128i co_val; __m128i cg_val; - uint32 tempWidth; - uint32 tempHeight; + UINT32 tempWidth; + UINT32 tempHeight; tempWidth = ROUND_UP_TO(context->width, 8); tempHeight = ROUND_UP_TO(context->height, 2); @@ -165,7 +165,7 @@ static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context, uint8* bmpdata, case RDP_PIXEL_FORMAT_P4_PLANER: { int shift; - uint8 idx[8]; + BYTE idx[8]; for (shift = 7; shift >= 0; shift--) { @@ -283,16 +283,16 @@ static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context, uint8* bmpdata, static void nsc_encode_subsampling_sse2(NSC_CONTEXT* context) { - uint16 x; - uint16 y; - uint8* co_dst; - uint8* cg_dst; - sint8* co_src0; - sint8* co_src1; - sint8* cg_src0; - sint8* cg_src1; - uint32 tempWidth; - uint32 tempHeight; + UINT16 x; + UINT16 y; + BYTE* co_dst; + BYTE* cg_dst; + INT8* co_src0; + INT8* co_src1; + INT8* cg_src0; + INT8* cg_src1; + UINT32 tempWidth; + UINT32 tempHeight; __m128i t; __m128i val; __m128i mask = _mm_set1_epi16(0xFF); @@ -304,9 +304,9 @@ static void nsc_encode_subsampling_sse2(NSC_CONTEXT* context) { co_dst = context->priv->plane_buf[1] + y * (tempWidth >> 1); cg_dst = context->priv->plane_buf[2] + y * (tempWidth >> 1); - co_src0 = (sint8*) context->priv->plane_buf[1] + (y << 1) * tempWidth; + co_src0 = (INT8*) context->priv->plane_buf[1] + (y << 1) * tempWidth; co_src1 = co_src0 + tempWidth; - cg_src0 = (sint8*) context->priv->plane_buf[2] + (y << 1) * tempWidth; + cg_src0 = (INT8*) context->priv->plane_buf[2] + (y << 1) * tempWidth; cg_src1 = cg_src0 + tempWidth; for (x = 0; x < tempWidth >> 1; x += 8) { @@ -333,7 +333,7 @@ static void nsc_encode_subsampling_sse2(NSC_CONTEXT* context) } } -static void nsc_encode_sse2(NSC_CONTEXT* context, uint8* bmpdata, int rowstride) +static void nsc_encode_sse2(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride) { nsc_encode_argb_to_aycocg_sse2(context, bmpdata, rowstride); if (context->nsc_stream.ChromaSubSamplingLevel > 0) diff --git a/libfreerdp/codec/nsc_sse2.h b/libfreerdp/codec/nsc_sse2.h index 1c0b632b4..f665dd148 100644 --- a/libfreerdp/codec/nsc_sse2.h +++ b/libfreerdp/codec/nsc_sse2.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Library - SSE2 Optimizations * * Copyright 2012 Vic Lee diff --git a/libfreerdp/codec/nsc_types.h b/libfreerdp/codec/nsc_types.h index 3982a9bfb..060b89daa 100644 --- a/libfreerdp/codec/nsc_types.h +++ b/libfreerdp/codec/nsc_types.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * NSCodec Library * * Copyright 2011 Samsung, Author Jiten Pathy @@ -33,8 +33,8 @@ struct _NSC_CONTEXT_PRIV { - uint8* plane_buf[5]; /* Decompressed Plane Buffers in the respective order */ - uint32 plane_buf_length; /* Lengths of each plane buffer */ + BYTE* plane_buf[5]; /* Decompressed Plane Buffers in the respective order */ + UINT32 plane_buf_length; /* Lengths of each plane buffer */ /* profilers */ PROFILER_DEFINE(prof_nsc_rle_decompress_data); diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index b3ed3ca99..a1d4af335 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library * * Copyright 2011 Vic Lee @@ -64,7 +64,7 @@ * The order of the values are: * LL3, LH3, HL3, HH3, LH2, HL2, HH2, LH1, HL1, HH1 */ -static const uint32 rfx_default_quantization_values[] = +static const UINT32 rfx_default_quantization_values[] = { 6, 6, 6, 6, 7, 7, 8, 8, 8, 9 }; @@ -148,11 +148,11 @@ RFX_CONTEXT* rfx_context_new(void) rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_B8G8R8A8); /* align buffers to 16 byte boundary (needed for SSE/SSE2 instructions) */ - context->priv->y_r_buffer = (sint16*)(((uintptr_t)context->priv->y_r_mem + 16) & ~ 0x0F); - context->priv->cb_g_buffer = (sint16*)(((uintptr_t)context->priv->cb_g_mem + 16) & ~ 0x0F); - context->priv->cr_b_buffer = (sint16*)(((uintptr_t)context->priv->cr_b_mem + 16) & ~ 0x0F); + context->priv->y_r_buffer = (INT16*)(((uintptr_t)context->priv->y_r_mem + 16) & ~ 0x0F); + context->priv->cb_g_buffer = (INT16*)(((uintptr_t)context->priv->cb_g_mem + 16) & ~ 0x0F); + context->priv->cr_b_buffer = (INT16*)(((uintptr_t)context->priv->cr_b_mem + 16) & ~ 0x0F); - context->priv->dwt_buffer = (sint16*)(((uintptr_t)context->priv->dwt_mem + 16) & ~ 0x0F); + context->priv->dwt_buffer = (INT16*)(((uintptr_t)context->priv->dwt_mem + 16) & ~ 0x0F); /* create profilers for default decoding routines */ rfx_profiler_create(context); @@ -168,7 +168,7 @@ RFX_CONTEXT* rfx_context_new(void) return context; } -void rfx_context_set_cpu_opt(RFX_CONTEXT* context, uint32 cpu_opt) +void rfx_context_set_cpu_opt(RFX_CONTEXT* context, UINT32 cpu_opt) { /* enable SIMD CPU acceleration if detected */ if (cpu_opt & CPU_SSE2) @@ -177,15 +177,15 @@ void rfx_context_set_cpu_opt(RFX_CONTEXT* context, uint32 cpu_opt) void rfx_context_free(RFX_CONTEXT* context) { - xfree(context->quants); + free(context->quants); rfx_pool_free(context->priv->pool); rfx_profiler_print(context); rfx_profiler_free(context); - xfree(context->priv); - xfree(context); + free(context->priv); + free(context); } void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format) @@ -219,16 +219,16 @@ void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_f void rfx_context_reset(RFX_CONTEXT* context) { - context->header_processed = false; + context->header_processed = FALSE; context->frame_idx = 0; } static void rfx_process_message_sync(RFX_CONTEXT* context, STREAM* s) { - uint32 magic; + UINT32 magic; /* RFX_SYNC */ - stream_read_uint32(s, magic); /* magic (4 bytes), 0xCACCACCA */ + stream_read_UINT32(s, magic); /* magic (4 bytes), 0xCACCACCA */ if (magic != WF_MAGIC) { @@ -236,7 +236,7 @@ static void rfx_process_message_sync(RFX_CONTEXT* context, STREAM* s) return; } - stream_read_uint16(s, context->version); /* version (2 bytes), WF_VERSION_1_0 (0x0100) */ + stream_read_UINT16(s, context->version); /* version (2 bytes), WF_VERSION_1_0 (0x0100) */ if (context->version != WF_VERSION_1_0) { @@ -249,9 +249,9 @@ static void rfx_process_message_sync(RFX_CONTEXT* context, STREAM* s) static void rfx_process_message_codec_versions(RFX_CONTEXT* context, STREAM* s) { - uint8 numCodecs; + BYTE numCodecs; - stream_read_uint8(s, numCodecs); /* numCodecs (1 byte), must be set to 0x01 */ + stream_read_BYTE(s, numCodecs); /* numCodecs (1 byte), must be set to 0x01 */ if (numCodecs != 1) { @@ -260,18 +260,18 @@ static void rfx_process_message_codec_versions(RFX_CONTEXT* context, STREAM* s) } /* RFX_CODEC_VERSIONT */ - stream_read_uint8(s, context->codec_id); /* codecId (1 byte) */ - stream_read_uint8(s, context->codec_version); /* version (2 bytes) */ + stream_read_BYTE(s, context->codec_id); /* codecId (1 byte) */ + stream_read_BYTE(s, context->codec_version); /* version (2 bytes) */ DEBUG_RFX("id %d version 0x%X.", context->codec_id, context->codec_version); } static void rfx_process_message_channels(RFX_CONTEXT* context, STREAM* s) { - uint8 channelId; - uint8 numChannels; + BYTE channelId; + BYTE numChannels; - stream_read_uint8(s, numChannels); /* numChannels (1 byte), must bet set to 0x01 */ + stream_read_BYTE(s, numChannels); /* numChannels (1 byte), must bet set to 0x01 */ /* In RDVH sessions, numChannels will represent the number of virtual monitors * configured and does not always be set to 0x01 as [MS-RDPRFX] said. @@ -283,9 +283,9 @@ static void rfx_process_message_channels(RFX_CONTEXT* context, STREAM* s) } /* RFX_CHANNELT */ - stream_read_uint8(s, channelId); /* channelId (1 byte) */ - stream_read_uint16(s, context->width); /* width (2 bytes) */ - stream_read_uint16(s, context->height); /* height (2 bytes) */ + stream_read_BYTE(s, channelId); /* channelId (1 byte) */ + stream_read_UINT16(s, context->width); /* width (2 bytes) */ + stream_read_UINT16(s, context->height); /* height (2 bytes) */ /* Now, only the first monitor can be used, therefore the other channels will be ignored. */ stream_seek(s, 5 * (numChannels - 1)); @@ -296,13 +296,13 @@ static void rfx_process_message_channels(RFX_CONTEXT* context, STREAM* s) static void rfx_process_message_context(RFX_CONTEXT* context, STREAM* s) { - uint8 ctxId; - uint16 tileSize; - uint16 properties; + BYTE ctxId; + UINT16 tileSize; + UINT16 properties; - stream_read_uint8(s, ctxId); /* ctxId (1 byte), must be set to 0x00 */ - stream_read_uint16(s, tileSize); /* tileSize (2 bytes), must be set to CT_TILE_64x64 (0x0040) */ - stream_read_uint16(s, properties); /* properties (2 bytes) */ + stream_read_BYTE(s, ctxId); /* ctxId (1 byte), must be set to 0x00 */ + stream_read_UINT16(s, tileSize); /* tileSize (2 bytes), must be set to CT_TILE_64x64 (0x0040) */ + stream_read_UINT16(s, properties); /* properties (2 bytes) */ DEBUG_RFX("ctxId %d tileSize %d properties 0x%X.", ctxId, tileSize, properties); @@ -334,11 +334,11 @@ static void rfx_process_message_context(RFX_CONTEXT* context, STREAM* s) static void rfx_process_message_frame_begin(RFX_CONTEXT* context, RFX_MESSAGE* message, STREAM* s) { - uint32 frameIdx; - uint16 numRegions; + UINT32 frameIdx; + UINT16 numRegions; - stream_read_uint32(s, frameIdx); /* frameIdx (4 bytes), if codec is in video mode, must be ignored */ - stream_read_uint16(s, numRegions); /* numRegions (2 bytes) */ + stream_read_UINT32(s, frameIdx); /* frameIdx (4 bytes), if codec is in video mode, must be ignored */ + stream_read_UINT16(s, numRegions); /* numRegions (2 bytes) */ DEBUG_RFX("RFX_FRAME_BEGIN: frameIdx:%d numRegions:%d", frameIdx, numRegions); } @@ -352,8 +352,8 @@ static void rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag { int i; - stream_seek_uint8(s); /* regionFlags (1 byte) */ - stream_read_uint16(s, message->num_rects); /* numRects (2 bytes) */ + stream_seek_BYTE(s); /* regionFlags (1 byte) */ + stream_read_UINT16(s, message->num_rects); /* numRects (2 bytes) */ if (message->num_rects < 1) { @@ -362,18 +362,18 @@ static void rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag } if (message->rects != NULL) - message->rects = (RFX_RECT*) xrealloc(message->rects, message->num_rects * sizeof(RFX_RECT)); + message->rects = (RFX_RECT*) realloc(message->rects, message->num_rects * sizeof(RFX_RECT)); else - message->rects = (RFX_RECT*) xmalloc(message->num_rects * sizeof(RFX_RECT)); + message->rects = (RFX_RECT*) malloc(message->num_rects * sizeof(RFX_RECT)); /* rects */ for (i = 0; i < message->num_rects; i++) { /* RFX_RECT */ - stream_read_uint16(s, message->rects[i].x); /* x (2 bytes) */ - stream_read_uint16(s, message->rects[i].y); /* y (2 bytes) */ - stream_read_uint16(s, message->rects[i].width); /* width (2 bytes) */ - stream_read_uint16(s, message->rects[i].height); /* height (2 bytes) */ + stream_read_UINT16(s, message->rects[i].x); /* x (2 bytes) */ + stream_read_UINT16(s, message->rects[i].y); /* y (2 bytes) */ + stream_read_UINT16(s, message->rects[i].width); /* width (2 bytes) */ + stream_read_UINT16(s, message->rects[i].height); /* height (2 bytes) */ DEBUG_RFX("rect %d (%d %d %d %d).", i, message->rects[i].x, message->rects[i].y, message->rects[i].width, message->rects[i].height); @@ -382,21 +382,21 @@ static void rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag static void rfx_process_message_tile(RFX_CONTEXT* context, RFX_TILE* tile, STREAM* s) { - uint8 quantIdxY; - uint8 quantIdxCb; - uint8 quantIdxCr; - uint16 xIdx, yIdx; - uint16 YLen, CbLen, CrLen; + BYTE quantIdxY; + BYTE quantIdxCb; + BYTE quantIdxCr; + UINT16 xIdx, yIdx; + UINT16 YLen, CbLen, CrLen; /* RFX_TILE */ - stream_read_uint8(s, quantIdxY); /* quantIdxY (1 byte) */ - stream_read_uint8(s, quantIdxCb); /* quantIdxCb (1 byte) */ - stream_read_uint8(s, quantIdxCr); /* quantIdxCr (1 byte) */ - stream_read_uint16(s, xIdx); /* xIdx (2 bytes) */ - stream_read_uint16(s, yIdx); /* yIdx (2 bytes) */ - stream_read_uint16(s, YLen); /* YLen (2 bytes) */ - stream_read_uint16(s, CbLen); /* CbLen (2 bytes) */ - stream_read_uint16(s, CrLen); /* CrLen (2 bytes) */ + stream_read_BYTE(s, quantIdxY); /* quantIdxY (1 byte) */ + stream_read_BYTE(s, quantIdxCb); /* quantIdxCb (1 byte) */ + stream_read_BYTE(s, quantIdxCr); /* quantIdxCr (1 byte) */ + stream_read_UINT16(s, xIdx); /* xIdx (2 bytes) */ + stream_read_UINT16(s, yIdx); /* yIdx (2 bytes) */ + stream_read_UINT16(s, YLen); /* YLen (2 bytes) */ + stream_read_UINT16(s, CbLen); /* CbLen (2 bytes) */ + stream_read_UINT16(s, CrLen); /* CrLen (2 bytes) */ DEBUG_RFX("quantIdxY:%d quantIdxCb:%d quantIdxCr:%d xIdx:%d yIdx:%d YLen:%d CbLen:%d CrLen:%d", quantIdxY, quantIdxCb, quantIdxCr, xIdx, yIdx, YLen, CbLen, CrLen); @@ -414,15 +414,15 @@ static void rfx_process_message_tile(RFX_CONTEXT* context, RFX_TILE* tile, STREA static void rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* message, STREAM* s) { int i; - uint16 subtype; - uint32 blockLen; - uint32 blockType; - uint32 tilesDataSize; - uint32* quants; - uint8 quant; + UINT16 subtype; + UINT32 blockLen; + UINT32 blockType; + UINT32 tilesDataSize; + UINT32* quants; + BYTE quant; int pos; - stream_read_uint16(s, subtype); /* subtype (2 bytes) must be set to CBT_TILESET (0xCAC2) */ + stream_read_UINT16(s, subtype); /* subtype (2 bytes) must be set to CBT_TILESET (0xCAC2) */ if (subtype != CBT_TILESET) { @@ -430,11 +430,11 @@ static void rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa return; } - stream_seek_uint16(s); /* idx (2 bytes), must be set to 0x0000 */ - stream_seek_uint16(s); /* properties (2 bytes) */ + stream_seek_UINT16(s); /* idx (2 bytes), must be set to 0x0000 */ + stream_seek_UINT16(s); /* properties (2 bytes) */ - stream_read_uint8(s, context->num_quants); /* numQuant (1 byte) */ - stream_seek_uint8(s); /* tileSize (1 byte), must be set to 0x40 */ + stream_read_BYTE(s, context->num_quants); /* numQuant (1 byte) */ + stream_seek_BYTE(s); /* tileSize (1 byte), must be set to 0x40 */ if (context->num_quants < 1) { @@ -442,7 +442,7 @@ static void rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa return; } - stream_read_uint16(s, message->num_tiles); /* numTiles (2 bytes) */ + stream_read_UINT16(s, message->num_tiles); /* numTiles (2 bytes) */ if (message->num_tiles < 1) { @@ -450,31 +450,31 @@ static void rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa return; } - stream_read_uint32(s, tilesDataSize); /* tilesDataSize (4 bytes) */ + stream_read_UINT32(s, tilesDataSize); /* tilesDataSize (4 bytes) */ if (context->quants != NULL) - context->quants = (uint32*) xrealloc((void*) context->quants, context->num_quants * 10 * sizeof(uint32)); + context->quants = (UINT32*) realloc((void*) context->quants, context->num_quants * 10 * sizeof(UINT32)); else - context->quants = (uint32*) xmalloc(context->num_quants * 10 * sizeof(uint32)); + context->quants = (UINT32*) malloc(context->num_quants * 10 * sizeof(UINT32)); quants = context->quants; /* quantVals */ for (i = 0; i < context->num_quants; i++) { /* RFX_CODEC_QUANT */ - stream_read_uint8(s, quant); + stream_read_BYTE(s, quant); *quants++ = (quant & 0x0F); *quants++ = (quant >> 4); - stream_read_uint8(s, quant); + stream_read_BYTE(s, quant); *quants++ = (quant & 0x0F); *quants++ = (quant >> 4); - stream_read_uint8(s, quant); + stream_read_BYTE(s, quant); *quants++ = (quant & 0x0F); *quants++ = (quant >> 4); - stream_read_uint8(s, quant); + stream_read_BYTE(s, quant); *quants++ = (quant & 0x0F); *quants++ = (quant >> 4); - stream_read_uint8(s, quant); + stream_read_BYTE(s, quant); *quants++ = (quant & 0x0F); *quants++ = (quant >> 4); @@ -492,8 +492,8 @@ static void rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa for (i = 0; i < message->num_tiles; i++) { /* RFX_TILE */ - stream_read_uint16(s, blockType); /* blockType (2 bytes), must be set to CBT_TILE (0xCAC3) */ - stream_read_uint32(s, blockLen); /* blockLen (4 bytes) */ + stream_read_UINT16(s, blockType); /* blockType (2 bytes), must be set to CBT_TILE (0xCAC3) */ + stream_read_UINT32(s, blockLen); /* blockLen (4 bytes) */ pos = stream_get_pos(s) - 6 + blockLen; @@ -509,12 +509,12 @@ static void rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa } } -RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, uint8* data, uint32 length) +RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, BYTE* data, UINT32 length) { int pos; STREAM* s; - uint32 blockLen; - uint32 blockType; + UINT32 blockLen; + UINT32 blockType; RFX_MESSAGE* message; s = stream_new(0); @@ -524,8 +524,8 @@ RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, uint8* data, uint32 lengt while (stream_get_left(s) > 6) { /* RFX_BLOCKT */ - stream_read_uint16(s, blockType); /* blockType (2 bytes) */ - stream_read_uint32(s, blockLen); /* blockLen (4 bytes) */ + stream_read_UINT16(s, blockType); /* blockType (2 bytes) */ + stream_read_UINT32(s, blockLen); /* blockLen (4 bytes) */ DEBUG_RFX("blockType 0x%X blockLen %d", blockType, blockLen); @@ -593,7 +593,7 @@ RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, uint8* data, uint32 lengt return message; } -uint16 rfx_message_get_tile_count(RFX_MESSAGE* message) +UINT16 rfx_message_get_tile_count(RFX_MESSAGE* message) { return message->num_tiles; } @@ -603,7 +603,7 @@ RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, int index) return message->tiles[index]; } -uint16 rfx_message_get_rect_count(RFX_MESSAGE* message) +UINT16 rfx_message_get_rect_count(RFX_MESSAGE* message) { return message->num_rects; } @@ -617,55 +617,55 @@ void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message) { if (message != NULL) { - xfree(message->rects); + free(message->rects); if (message->tiles != NULL) { rfx_pool_put_tiles(context->priv->pool, message->tiles, message->num_tiles); - xfree(message->tiles); + free(message->tiles); } - xfree(message); + free(message); } } static void rfx_compose_message_sync(RFX_CONTEXT* context, STREAM* s) { - stream_write_uint16(s, WBT_SYNC); /* BlockT.blockType */ - stream_write_uint32(s, 12); /* BlockT.blockLen */ - stream_write_uint32(s, WF_MAGIC); /* magic */ - stream_write_uint16(s, WF_VERSION_1_0); /* version */ + stream_write_UINT16(s, WBT_SYNC); /* BlockT.blockType */ + stream_write_UINT32(s, 12); /* BlockT.blockLen */ + stream_write_UINT32(s, WF_MAGIC); /* magic */ + stream_write_UINT16(s, WF_VERSION_1_0); /* version */ } static void rfx_compose_message_codec_versions(RFX_CONTEXT* context, STREAM* s) { - stream_write_uint16(s, WBT_CODEC_VERSIONS); /* BlockT.blockType */ - stream_write_uint32(s, 10); /* BlockT.blockLen */ - stream_write_uint8(s, 1); /* numCodecs */ - stream_write_uint8(s, 1); /* codecs.codecId */ - stream_write_uint16(s, WF_VERSION_1_0); /* codecs.version */ + stream_write_UINT16(s, WBT_CODEC_VERSIONS); /* BlockT.blockType */ + stream_write_UINT32(s, 10); /* BlockT.blockLen */ + stream_write_BYTE(s, 1); /* numCodecs */ + stream_write_BYTE(s, 1); /* codecs.codecId */ + stream_write_UINT16(s, WF_VERSION_1_0); /* codecs.version */ } static void rfx_compose_message_channels(RFX_CONTEXT* context, STREAM* s) { - stream_write_uint16(s, WBT_CHANNELS); /* BlockT.blockType */ - stream_write_uint32(s, 12); /* BlockT.blockLen */ - stream_write_uint8(s, 1); /* numChannels */ - stream_write_uint8(s, 0); /* Channel.channelId */ - stream_write_uint16(s, context->width); /* Channel.width */ - stream_write_uint16(s, context->height); /* Channel.height */ + stream_write_UINT16(s, WBT_CHANNELS); /* BlockT.blockType */ + stream_write_UINT32(s, 12); /* BlockT.blockLen */ + stream_write_BYTE(s, 1); /* numChannels */ + stream_write_BYTE(s, 0); /* Channel.channelId */ + stream_write_UINT16(s, context->width); /* Channel.width */ + stream_write_UINT16(s, context->height); /* Channel.height */ } static void rfx_compose_message_context(RFX_CONTEXT* context, STREAM* s) { - uint16 properties; + UINT16 properties; - stream_write_uint16(s, WBT_CONTEXT); /* CodecChannelT.blockType */ - stream_write_uint32(s, 13); /* CodecChannelT.blockLen */ - stream_write_uint8(s, 1); /* CodecChannelT.codecId */ - stream_write_uint8(s, 0); /* CodecChannelT.channelId */ - stream_write_uint8(s, 0); /* ctxId */ - stream_write_uint16(s, CT_TILE_64x64); /* tileSize */ + stream_write_UINT16(s, WBT_CONTEXT); /* CodecChannelT.blockType */ + stream_write_UINT32(s, 13); /* CodecChannelT.blockLen */ + stream_write_BYTE(s, 1); /* CodecChannelT.codecId */ + stream_write_BYTE(s, 0); /* CodecChannelT.channelId */ + stream_write_BYTE(s, 0); /* ctxId */ + stream_write_UINT16(s, CT_TILE_64x64); /* tileSize */ /* properties */ properties = context->flags; /* flags */ @@ -673,7 +673,7 @@ static void rfx_compose_message_context(RFX_CONTEXT* context, STREAM* s) properties |= (CLW_XFORM_DWT_53_A << 5); /* xft */ properties |= ((context->mode == RLGR1 ? CLW_ENTROPY_RLGR1 : CLW_ENTROPY_RLGR3) << 9); /* et */ properties |= (SCALAR_QUANTIZATION << 13); /* qt */ - stream_write_uint16(s, properties); + stream_write_UINT16(s, properties); /* properties in tilesets: note that this has different format from the one in TS_RFX_CONTEXT */ properties = 1; /* lt */ @@ -694,19 +694,19 @@ void rfx_compose_message_header(RFX_CONTEXT* context, STREAM* s) rfx_compose_message_codec_versions(context, s); rfx_compose_message_channels(context, s); - context->header_processed = true; + context->header_processed = TRUE; } static void rfx_compose_message_frame_begin(RFX_CONTEXT* context, STREAM* s) { stream_check_size(s, 14); - stream_write_uint16(s, WBT_FRAME_BEGIN); /* CodecChannelT.blockType */ - stream_write_uint32(s, 14); /* CodecChannelT.blockLen */ - stream_write_uint8(s, 1); /* CodecChannelT.codecId */ - stream_write_uint8(s, 0); /* CodecChannelT.channelId */ - stream_write_uint32(s, context->frame_idx); /* frameIdx */ - stream_write_uint16(s, 1); /* numRegions */ + stream_write_UINT16(s, WBT_FRAME_BEGIN); /* CodecChannelT.blockType */ + stream_write_UINT32(s, 14); /* CodecChannelT.blockLen */ + stream_write_BYTE(s, 1); /* CodecChannelT.codecId */ + stream_write_BYTE(s, 0); /* CodecChannelT.channelId */ + stream_write_UINT32(s, context->frame_idx); /* frameIdx */ + stream_write_UINT16(s, 1); /* numRegions */ context->frame_idx++; } @@ -720,28 +720,28 @@ static void rfx_compose_message_region(RFX_CONTEXT* context, STREAM* s, size = 15 + num_rects * 8; stream_check_size(s, size); - stream_write_uint16(s, WBT_REGION); /* CodecChannelT.blockType */ - stream_write_uint32(s, size); /* set CodecChannelT.blockLen later */ - stream_write_uint8(s, 1); /* CodecChannelT.codecId */ - stream_write_uint8(s, 0); /* CodecChannelT.channelId */ - stream_write_uint8(s, 1); /* regionFlags */ - stream_write_uint16(s, num_rects); /* numRects */ + stream_write_UINT16(s, WBT_REGION); /* CodecChannelT.blockType */ + stream_write_UINT32(s, size); /* set CodecChannelT.blockLen later */ + stream_write_BYTE(s, 1); /* CodecChannelT.codecId */ + stream_write_BYTE(s, 0); /* CodecChannelT.channelId */ + stream_write_BYTE(s, 1); /* regionFlags */ + stream_write_UINT16(s, num_rects); /* numRects */ for (i = 0; i < num_rects; i++) { - stream_write_uint16(s, rects[i].x); - stream_write_uint16(s, rects[i].y); - stream_write_uint16(s, rects[i].width); - stream_write_uint16(s, rects[i].height); + stream_write_UINT16(s, rects[i].x); + stream_write_UINT16(s, rects[i].y); + stream_write_UINT16(s, rects[i].width); + stream_write_UINT16(s, rects[i].height); } - stream_write_uint16(s, CBT_REGION); /* regionType */ - stream_write_uint16(s, 1); /* numTilesets */ + stream_write_UINT16(s, CBT_REGION); /* regionType */ + stream_write_UINT16(s, 1); /* numTilesets */ } static void rfx_compose_message_tile(RFX_CONTEXT* context, STREAM* s, - uint8* tile_data, int tile_width, int tile_height, int rowstride, - const uint32* quantVals, int quantIdxY, int quantIdxCb, int quantIdxCr, + BYTE* tile_data, int tile_width, int tile_height, int rowstride, + const UINT32* quantVals, int quantIdxY, int quantIdxCb, int quantIdxCr, int xIdx, int yIdx) { int YLen = 0; @@ -752,13 +752,13 @@ static void rfx_compose_message_tile(RFX_CONTEXT* context, STREAM* s, stream_check_size(s, 19); start_pos = stream_get_pos(s); - stream_write_uint16(s, CBT_TILE); /* BlockT.blockType */ - stream_seek_uint32(s); /* set BlockT.blockLen later */ - stream_write_uint8(s, quantIdxY); - stream_write_uint8(s, quantIdxCb); - stream_write_uint8(s, quantIdxCr); - stream_write_uint16(s, xIdx); - stream_write_uint16(s, yIdx); + stream_write_UINT16(s, CBT_TILE); /* BlockT.blockType */ + stream_seek_UINT32(s); /* set BlockT.blockLen later */ + stream_write_BYTE(s, quantIdxY); + stream_write_BYTE(s, quantIdxCb); + stream_write_BYTE(s, quantIdxCr); + stream_write_UINT16(s, xIdx); + stream_write_UINT16(s, yIdx); stream_seek(s, 6); /* YLen, CbLen, CrLen */ @@ -772,24 +772,24 @@ static void rfx_compose_message_tile(RFX_CONTEXT* context, STREAM* s, end_pos = stream_get_pos(s); stream_set_pos(s, start_pos + 2); - stream_write_uint32(s, 19 + YLen + CbLen + CrLen); /* BlockT.blockLen */ + stream_write_UINT32(s, 19 + YLen + CbLen + CrLen); /* BlockT.blockLen */ stream_set_pos(s, start_pos + 13); - stream_write_uint16(s, YLen); - stream_write_uint16(s, CbLen); - stream_write_uint16(s, CrLen); + stream_write_UINT16(s, YLen); + stream_write_UINT16(s, CbLen); + stream_write_UINT16(s, CrLen); stream_set_pos(s, end_pos); } static void rfx_compose_message_tileset(RFX_CONTEXT* context, STREAM* s, - uint8* image_data, int width, int height, int rowstride) + BYTE* image_data, int width, int height, int rowstride) { int size; int start_pos, end_pos; int i; int numQuants; - const uint32* quantVals; - const uint32* quantValsPtr; + const UINT32* quantVals; + const UINT32* quantValsPtr; int quantIdxY; int quantIdxCb; int quantIdxCr; @@ -825,22 +825,22 @@ static void rfx_compose_message_tileset(RFX_CONTEXT* context, STREAM* s, stream_check_size(s, size); start_pos = stream_get_pos(s); - stream_write_uint16(s, WBT_EXTENSION); /* CodecChannelT.blockType */ - stream_seek_uint32(s); /* set CodecChannelT.blockLen later */ - stream_write_uint8(s, 1); /* CodecChannelT.codecId */ - stream_write_uint8(s, 0); /* CodecChannelT.channelId */ - stream_write_uint16(s, CBT_TILESET); /* subtype */ - stream_write_uint16(s, 0); /* idx */ - stream_write_uint16(s, context->properties); /* properties */ - stream_write_uint8(s, numQuants); /* numQuants */ - stream_write_uint8(s, 0x40); /* tileSize */ - stream_write_uint16(s, numTiles); /* numTiles */ - stream_seek_uint32(s); /* set tilesDataSize later */ + stream_write_UINT16(s, WBT_EXTENSION); /* CodecChannelT.blockType */ + stream_seek_UINT32(s); /* set CodecChannelT.blockLen later */ + stream_write_BYTE(s, 1); /* CodecChannelT.codecId */ + stream_write_BYTE(s, 0); /* CodecChannelT.channelId */ + stream_write_UINT16(s, CBT_TILESET); /* subtype */ + stream_write_UINT16(s, 0); /* idx */ + stream_write_UINT16(s, context->properties); /* properties */ + stream_write_BYTE(s, numQuants); /* numQuants */ + stream_write_BYTE(s, 0x40); /* tileSize */ + stream_write_UINT16(s, numTiles); /* numTiles */ + stream_seek_UINT32(s); /* set tilesDataSize later */ quantValsPtr = quantVals; for (i = 0; i < numQuants * 5; i++) { - stream_write_uint8(s, quantValsPtr[0] + (quantValsPtr[1] << 4)); + stream_write_BYTE(s, quantValsPtr[0] + (quantValsPtr[1] << 4)); quantValsPtr += 2; } @@ -863,9 +863,9 @@ static void rfx_compose_message_tileset(RFX_CONTEXT* context, STREAM* s, end_pos = stream_get_pos(s); stream_set_pos(s, start_pos + 2); - stream_write_uint32(s, size); /* CodecChannelT.blockLen */ + stream_write_UINT32(s, size); /* CodecChannelT.blockLen */ stream_set_pos(s, start_pos + 18); - stream_write_uint32(s, tilesDataSize); + stream_write_UINT32(s, tilesDataSize); stream_set_pos(s, end_pos); } @@ -874,14 +874,14 @@ static void rfx_compose_message_frame_end(RFX_CONTEXT* context, STREAM* s) { stream_check_size(s, 8); - stream_write_uint16(s, WBT_FRAME_END); /* CodecChannelT.blockType */ - stream_write_uint32(s, 8); /* CodecChannelT.blockLen */ - stream_write_uint8(s, 1); /* CodecChannelT.codecId */ - stream_write_uint8(s, 0); /* CodecChannelT.channelId */ + stream_write_UINT16(s, WBT_FRAME_END); /* CodecChannelT.blockType */ + stream_write_UINT32(s, 8); /* CodecChannelT.blockLen */ + stream_write_BYTE(s, 1); /* CodecChannelT.codecId */ + stream_write_BYTE(s, 0); /* CodecChannelT.channelId */ } static void rfx_compose_message_data(RFX_CONTEXT* context, STREAM* s, - const RFX_RECT* rects, int num_rects, uint8* image_data, int width, int height, int rowstride) + const RFX_RECT* rects, int num_rects, BYTE* image_data, int width, int height, int rowstride) { rfx_compose_message_frame_begin(context, s); rfx_compose_message_region(context, s, rects, num_rects); @@ -890,7 +890,7 @@ static void rfx_compose_message_data(RFX_CONTEXT* context, STREAM* s, } FREERDP_API void rfx_compose_message(RFX_CONTEXT* context, STREAM* s, - const RFX_RECT* rects, int num_rects, uint8* image_data, int width, int height, int rowstride) + const RFX_RECT* rects, int num_rects, BYTE* image_data, int width, int height, int rowstride) { /* Only the first frame should send the RemoteFX header */ if (context->frame_idx == 0 && !context->header_processed) diff --git a/libfreerdp/codec/rfx_bitstream.h b/libfreerdp/codec/rfx_bitstream.h index d487a19d7..bb03d399f 100644 --- a/libfreerdp/codec/rfx_bitstream.h +++ b/libfreerdp/codec/rfx_bitstream.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Bit Stream * * Copyright 2011 Vic Lee @@ -24,7 +24,7 @@ struct _RFX_BITSTREAM { - uint8* buffer; + BYTE* buffer; int nbytes; int byte_pos; int bits_left; @@ -32,7 +32,7 @@ struct _RFX_BITSTREAM typedef struct _RFX_BITSTREAM RFX_BITSTREAM; #define rfx_bitstream_attach(bs, _buffer, _nbytes) do { \ - bs->buffer = (uint8*) (_buffer); \ + bs->buffer = (BYTE*) (_buffer); \ bs->nbytes = (_nbytes); \ bs->byte_pos = 0; \ bs->bits_left = 8; } while (0) @@ -40,7 +40,7 @@ typedef struct _RFX_BITSTREAM RFX_BITSTREAM; #define rfx_bitstream_get_bits(bs, _nbits, _r) do { \ int nbits = _nbits; \ int b; \ - uint16 n = 0; \ + UINT16 n = 0; \ while (bs->byte_pos < bs->nbytes && nbits > 0) \ { \ b = nbits; \ @@ -60,7 +60,7 @@ typedef struct _RFX_BITSTREAM RFX_BITSTREAM; _r = n; } while (0) #define rfx_bitstream_put_bits(bs, _bits, _nbits) do { \ - uint16 bits = (_bits); \ + UINT16 bits = (_bits); \ int nbits = (_nbits); \ int b; \ while (bs->byte_pos < bs->nbytes && nbits > 0) \ diff --git a/libfreerdp/codec/rfx_constants.h b/libfreerdp/codec/rfx_constants.h index bf1288635..248210199 100644 --- a/libfreerdp/codec/rfx_constants.h +++ b/libfreerdp/codec/rfx_constants.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - API Header * * Copyright 2011 Vic Lee diff --git a/libfreerdp/codec/rfx_decode.c b/libfreerdp/codec/rfx_decode.c index 8a8f1de43..2d7774590 100644 --- a/libfreerdp/codec/rfx_decode.c +++ b/libfreerdp/codec/rfx_decode.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Decode * * Copyright 2011 Vic Lee @@ -36,13 +36,13 @@ #include "rfx_decode.h" -static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, - RDP_PIXEL_FORMAT pixel_format, uint8* dst_buf) +static void rfx_decode_format_rgb(INT16* r_buf, INT16* g_buf, INT16* b_buf, + RDP_PIXEL_FORMAT pixel_format, BYTE* dst_buf) { - sint16* r = r_buf; - sint16* g = g_buf; - sint16* b = b_buf; - uint8* dst = dst_buf; + INT16* r = r_buf; + INT16* g = g_buf; + INT16* b = b_buf; + BYTE* dst = dst_buf; int i; switch (pixel_format) @@ -50,35 +50,35 @@ static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, case RDP_PIXEL_FORMAT_B8G8R8A8: for (i = 0; i < 4096; i++) { - *dst++ = (uint8) (*b++); - *dst++ = (uint8) (*g++); - *dst++ = (uint8) (*r++); + *dst++ = (BYTE) (*b++); + *dst++ = (BYTE) (*g++); + *dst++ = (BYTE) (*r++); *dst++ = 0xFF; } break; case RDP_PIXEL_FORMAT_R8G8B8A8: for (i = 0; i < 4096; i++) { - *dst++ = (uint8) (*r++); - *dst++ = (uint8) (*g++); - *dst++ = (uint8) (*b++); + *dst++ = (BYTE) (*r++); + *dst++ = (BYTE) (*g++); + *dst++ = (BYTE) (*b++); *dst++ = 0xFF; } break; case RDP_PIXEL_FORMAT_B8G8R8: for (i = 0; i < 4096; i++) { - *dst++ = (uint8) (*b++); - *dst++ = (uint8) (*g++); - *dst++ = (uint8) (*r++); + *dst++ = (BYTE) (*b++); + *dst++ = (BYTE) (*g++); + *dst++ = (BYTE) (*r++); } break; case RDP_PIXEL_FORMAT_R8G8B8: for (i = 0; i < 4096; i++) { - *dst++ = (uint8) (*r++); - *dst++ = (uint8) (*g++); - *dst++ = (uint8) (*b++); + *dst++ = (BYTE) (*r++); + *dst++ = (BYTE) (*g++); + *dst++ = (BYTE) (*b++); } break; default: @@ -88,11 +88,11 @@ static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, #define MINMAX(_v,_l,_h) ((_v) < (_l) ? (_l) : ((_v) > (_h) ? (_h) : (_v))) -void rfx_decode_ycbcr_to_rgb(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf) +void rfx_decode_ycbcr_to_rgb(INT16* y_r_buf, INT16* cb_g_buf, INT16* cr_b_buf) { - /* sint32 is used intentionally because we calculate with shifted factors! */ - sint32 y, cb, cr; - sint32 r, g, b; + /* INT32 is used intentionally because we calculate with shifted factors! */ + INT32 y, cb, cr; + INT32 r, g, b; int i; /** @@ -101,7 +101,7 @@ void rfx_decode_ycbcr_to_rgb(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf * 1 sign bit + 10 integer bits + 5 fractional bits * * However only 7 integer bits will be actually used since the value range is [-128.0, 127.0]. - * In other words, the decoded coeffectients is scaled by << 5 when intepreted as sint16. + * In other words, the decoded coeffectients is scaled by << 5 when intepreted as INT16. * It was scaled in the quantization phase, so we must scale it back here. */ for (i = 0; i < 4096; i++) @@ -149,8 +149,8 @@ void rfx_decode_ycbcr_to_rgb(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf } } -static void rfx_decode_component(RFX_CONTEXT* context, const uint32* quantization_values, - const uint8* data, int size, sint16* buffer) +static void rfx_decode_component(RFX_CONTEXT* context, const UINT32* quantization_values, + const BYTE* data, int size, INT16* buffer) { PROFILER_ENTER(context->priv->prof_rfx_decode_component); @@ -174,9 +174,9 @@ static void rfx_decode_component(RFX_CONTEXT* context, const uint32* quantizatio } void rfx_decode_rgb(RFX_CONTEXT* context, STREAM* data_in, - int y_size, const uint32 * y_quants, - int cb_size, const uint32 * cb_quants, - int cr_size, const uint32 * cr_quants, uint8* rgb_buffer) + int y_size, const UINT32 * y_quants, + int cb_size, const UINT32 * cb_quants, + int cr_size, const UINT32 * cr_quants, BYTE* rgb_buffer) { PROFILER_ENTER(context->priv->prof_rfx_decode_rgb); diff --git a/libfreerdp/codec/rfx_decode.h b/libfreerdp/codec/rfx_decode.h index 874ad2eac..7a19b7bb2 100644 --- a/libfreerdp/codec/rfx_decode.h +++ b/libfreerdp/codec/rfx_decode.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Decode * * Copyright 2011 Vic Lee @@ -22,12 +22,12 @@ #include -void rfx_decode_ycbcr_to_rgb(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf); +void rfx_decode_ycbcr_to_rgb(INT16* y_r_buf, INT16* cb_g_buf, INT16* cr_b_buf); void rfx_decode_rgb(RFX_CONTEXT* context, STREAM* data_in, - int y_size, const uint32 * y_quants, - int cb_size, const uint32 * cb_quants, - int cr_size, const uint32 * cr_quants, uint8* rgb_buffer); + int y_size, const UINT32 * y_quants, + int cb_size, const UINT32 * cb_quants, + int cr_size, const UINT32 * cr_quants, BYTE* rgb_buffer); #endif /* __RFX_DECODE_H */ diff --git a/libfreerdp/codec/rfx_differential.c b/libfreerdp/codec/rfx_differential.c index ba972b6ee..e80aa98f3 100644 --- a/libfreerdp/codec/rfx_differential.c +++ b/libfreerdp/codec/rfx_differential.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Differential Encoding * * Copyright 2011 Vic Lee @@ -27,10 +27,10 @@ #include "rfx_differential.h" -void rfx_differential_decode(sint16* buffer, int buffer_size) +void rfx_differential_decode(INT16* buffer, int buffer_size) { - sint16* src; - sint16* dst; + INT16* src; + INT16* dst; for (src = buffer, dst = buffer + 1; buffer_size > 1; src++, dst++, buffer_size--) { @@ -38,10 +38,10 @@ void rfx_differential_decode(sint16* buffer, int buffer_size) } } -void rfx_differential_encode(sint16* buffer, int buffer_size) +void rfx_differential_encode(INT16* buffer, int buffer_size) { - sint16 n1, n2; - sint16* dst; + INT16 n1, n2; + INT16* dst; for (n1 = *buffer, dst = buffer + 1; buffer_size > 1; dst++, buffer_size--) { diff --git a/libfreerdp/codec/rfx_differential.h b/libfreerdp/codec/rfx_differential.h index 58b08b9c7..3f6dbf623 100644 --- a/libfreerdp/codec/rfx_differential.h +++ b/libfreerdp/codec/rfx_differential.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Differential Encoding * * Copyright 2011 Vic Lee @@ -22,7 +22,7 @@ #include -void rfx_differential_decode(sint16* buffer, int buffer_size); -void rfx_differential_encode(sint16* buffer, int buffer_size); +void rfx_differential_decode(INT16* buffer, int buffer_size); +void rfx_differential_encode(INT16* buffer, int buffer_size); #endif /* __RFX_DIFFERENTIAL_H */ diff --git a/libfreerdp/codec/rfx_dwt.c b/libfreerdp/codec/rfx_dwt.c index 97df63bd7..0b8448b9e 100644 --- a/libfreerdp/codec/rfx_dwt.c +++ b/libfreerdp/codec/rfx_dwt.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - DWT * * Copyright 2011 Vic Lee @@ -27,11 +27,11 @@ #include "rfx_dwt.h" -static void rfx_dwt_2d_decode_block(sint16* buffer, sint16* idwt, int subband_width) +static void rfx_dwt_2d_decode_block(INT16* buffer, INT16* idwt, int subband_width) { - sint16 *dst, *l, *h; - sint16 *l_dst, *h_dst; - sint16 *hl, *lh, *hh, *ll; + INT16 *dst, *l, *h; + INT16 *l_dst, *h_dst; + INT16 *hl, *lh, *hh, *ll; int total_width; int x, y; int n; @@ -108,18 +108,18 @@ static void rfx_dwt_2d_decode_block(sint16* buffer, sint16* idwt, int subband_wi } } -void rfx_dwt_2d_decode(sint16* buffer, sint16* dwt_buffer) +void rfx_dwt_2d_decode(INT16* buffer, INT16* dwt_buffer) { rfx_dwt_2d_decode_block(buffer + 3840, dwt_buffer, 8); rfx_dwt_2d_decode_block(buffer + 3072, dwt_buffer, 16); rfx_dwt_2d_decode_block(buffer, dwt_buffer, 32); } -static void rfx_dwt_2d_encode_block(sint16* buffer, sint16* dwt, int subband_width) +static void rfx_dwt_2d_encode_block(INT16* buffer, INT16* dwt, int subband_width) { - sint16 *src, *l, *h; - sint16 *l_src, *h_src; - sint16 *hl, *lh, *hh, *ll; + INT16 *src, *l, *h; + INT16 *l_src, *h_src; + INT16 *hl, *lh, *hh, *ll; int total_width; int x, y; int n; @@ -190,7 +190,7 @@ static void rfx_dwt_2d_encode_block(sint16* buffer, sint16* dwt, int subband_wid } } -void rfx_dwt_2d_encode(sint16* buffer, sint16* dwt_buffer) +void rfx_dwt_2d_encode(INT16* buffer, INT16* dwt_buffer) { rfx_dwt_2d_encode_block(buffer, dwt_buffer, 32); rfx_dwt_2d_encode_block(buffer + 3072, dwt_buffer, 16); diff --git a/libfreerdp/codec/rfx_dwt.h b/libfreerdp/codec/rfx_dwt.h index cfdc4bc16..bf57d0186 100644 --- a/libfreerdp/codec/rfx_dwt.h +++ b/libfreerdp/codec/rfx_dwt.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - DWT * * Copyright 2011 Vic Lee @@ -22,7 +22,7 @@ #include -void rfx_dwt_2d_decode(sint16* buffer, sint16* dwt_buffer); -void rfx_dwt_2d_encode(sint16* buffer, sint16* dwt_buffer); +void rfx_dwt_2d_decode(INT16* buffer, INT16* dwt_buffer); +void rfx_dwt_2d_encode(INT16* buffer, INT16* dwt_buffer); #endif /* __RFX_DWT_H */ diff --git a/libfreerdp/codec/rfx_encode.c b/libfreerdp/codec/rfx_encode.c index d454f1558..8e511eac0 100644 --- a/libfreerdp/codec/rfx_encode.c +++ b/libfreerdp/codec/rfx_encode.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Encode * * Copyright 2011 Vic Lee @@ -36,15 +36,15 @@ #define MINMAX(_v,_l,_h) ((_v) < (_l) ? (_l) : ((_v) > (_h) ? (_h) : (_v))) -static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, int rowstride, - RDP_PIXEL_FORMAT pixel_format, const uint8* palette, sint16* r_buf, sint16* g_buf, sint16* b_buf) +static void rfx_encode_format_rgb(const BYTE* rgb_data, int width, int height, int rowstride, + RDP_PIXEL_FORMAT pixel_format, const BYTE* palette, INT16* r_buf, INT16* g_buf, INT16* b_buf) { int x, y; int x_exceed; int y_exceed; - const uint8* src; - sint16 r, g, b; - sint16 *r_last, *g_last, *b_last; + const BYTE* src; + INT16 r, g, b; + INT16 *r_last, *g_last, *b_last; x_exceed = 64 - width; y_exceed = 64 - height; @@ -58,52 +58,52 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, case RDP_PIXEL_FORMAT_B8G8R8A8: for (x = 0; x < width; x++) { - *b_buf++ = (sint16) (*src++); - *g_buf++ = (sint16) (*src++); - *r_buf++ = (sint16) (*src++); + *b_buf++ = (INT16) (*src++); + *g_buf++ = (INT16) (*src++); + *r_buf++ = (INT16) (*src++); src++; } break; case RDP_PIXEL_FORMAT_R8G8B8A8: for (x = 0; x < width; x++) { - *r_buf++ = (sint16) (*src++); - *g_buf++ = (sint16) (*src++); - *b_buf++ = (sint16) (*src++); + *r_buf++ = (INT16) (*src++); + *g_buf++ = (INT16) (*src++); + *b_buf++ = (INT16) (*src++); src++; } break; case RDP_PIXEL_FORMAT_B8G8R8: for (x = 0; x < width; x++) { - *b_buf++ = (sint16) (*src++); - *g_buf++ = (sint16) (*src++); - *r_buf++ = (sint16) (*src++); + *b_buf++ = (INT16) (*src++); + *g_buf++ = (INT16) (*src++); + *r_buf++ = (INT16) (*src++); } break; case RDP_PIXEL_FORMAT_R8G8B8: for (x = 0; x < width; x++) { - *r_buf++ = (sint16) (*src++); - *g_buf++ = (sint16) (*src++); - *b_buf++ = (sint16) (*src++); + *r_buf++ = (INT16) (*src++); + *g_buf++ = (INT16) (*src++); + *b_buf++ = (INT16) (*src++); } break; case RDP_PIXEL_FORMAT_B5G6R5_LE: for (x = 0; x < width; x++) { - *b_buf++ = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); - *g_buf++ = (sint16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); - *r_buf++ = (sint16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); + *b_buf++ = (INT16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); + *g_buf++ = (INT16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); + *r_buf++ = (INT16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); src += 2; } break; case RDP_PIXEL_FORMAT_R5G6B5_LE: for (x = 0; x < width; x++) { - *r_buf++ = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); - *g_buf++ = (sint16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); - *b_buf++ = (sint16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); + *r_buf++ = (INT16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); + *g_buf++ = (INT16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3)); + *b_buf++ = (INT16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07)); src += 2; } break; @@ -113,7 +113,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, for (x = 0; x < width; x++) { int shift; - uint8 idx; + BYTE idx; shift = (7 - (x % 8)); idx = ((*src) >> shift) & 1; @@ -121,9 +121,9 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, idx |= (((*(src + 2)) >> shift) & 1) << 2; idx |= (((*(src + 3)) >> shift) & 1) << 3; idx *= 3; - *r_buf++ = (sint16) palette[idx]; - *g_buf++ = (sint16) palette[idx + 1]; - *b_buf++ = (sint16) palette[idx + 2]; + *r_buf++ = (INT16) palette[idx]; + *g_buf++ = (INT16) palette[idx + 1]; + *b_buf++ = (INT16) palette[idx + 2]; if (shift == 0) src += 4; } @@ -135,9 +135,9 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, { int idx = (*src) * 3; - *r_buf++ = (sint16) palette[idx]; - *g_buf++ = (sint16) palette[idx + 1]; - *b_buf++ = (sint16) palette[idx + 2]; + *r_buf++ = (INT16) palette[idx]; + *g_buf++ = (INT16) palette[idx + 1]; + *b_buf++ = (INT16) palette[idx + 2]; src++; } break; @@ -169,9 +169,9 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, while (y_exceed > 0) { - memcpy(r_buf, r_last, 64 * sizeof(sint16)); - memcpy(g_buf, g_last, 64 * sizeof(sint16)); - memcpy(b_buf, b_last, 64 * sizeof(sint16)); + memcpy(r_buf, r_last, 64 * sizeof(INT16)); + memcpy(g_buf, g_last, 64 * sizeof(INT16)); + memcpy(b_buf, b_last, 64 * sizeof(INT16)); r_buf += 64; g_buf += 64; b_buf += 64; @@ -180,12 +180,12 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, } } -void rfx_encode_rgb_to_ycbcr(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf) +void rfx_encode_rgb_to_ycbcr(INT16* y_r_buf, INT16* cb_g_buf, INT16* cr_b_buf) { - /* sint32 is used intentionally because we calculate with shifted factors! */ + /* INT32 is used intentionally because we calculate with shifted factors! */ int i; - sint32 r, g, b; - sint32 y, cb, cr; + INT32 r, g, b; + INT32 y, cb, cr; /** * The encoded YCbCr coefficients are represented as 11.5 fixed-point numbers: @@ -193,7 +193,7 @@ void rfx_encode_rgb_to_ycbcr(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf * 1 sign bit + 10 integer bits + 5 fractional bits * * However only 7 integer bits will be actually used since the value range is [-128.0, 127.0]. - * In other words, the encoded coefficients is scaled by << 5 when interpreted as sint16. + * In other words, the encoded coefficients is scaled by << 5 when interpreted as INT16. * It will be scaled down to original during the quantization phase. */ for (i = 0; i < 4096; i++) @@ -222,8 +222,8 @@ void rfx_encode_rgb_to_ycbcr(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf } } -static void rfx_encode_component(RFX_CONTEXT* context, const uint32* quantization_values, - sint16* data, uint8* buffer, int buffer_size, int* size) +static void rfx_encode_component(RFX_CONTEXT* context, const UINT32* quantization_values, + INT16* data, BYTE* buffer, int buffer_size, int* size) { PROFILER_ENTER(context->priv->prof_rfx_encode_component); @@ -246,13 +246,13 @@ static void rfx_encode_component(RFX_CONTEXT* context, const uint32* quantizatio PROFILER_EXIT(context->priv->prof_rfx_encode_component); } -void rfx_encode_rgb(RFX_CONTEXT* context, const uint8* rgb_data, int width, int height, int rowstride, - const uint32* y_quants, const uint32* cb_quants, const uint32* cr_quants, +void rfx_encode_rgb(RFX_CONTEXT* context, const BYTE* rgb_data, int width, int height, int rowstride, + const UINT32* y_quants, const UINT32* cb_quants, const UINT32* cr_quants, STREAM* data_out, int* y_size, int* cb_size, int* cr_size) { - sint16* y_r_buffer = context->priv->y_r_buffer; - sint16* cb_g_buffer = context->priv->cb_g_buffer; - sint16* cr_b_buffer = context->priv->cr_b_buffer; + INT16* y_r_buffer = context->priv->y_r_buffer; + INT16* cb_g_buffer = context->priv->cb_g_buffer; + INT16* cr_b_buffer = context->priv->cr_b_buffer; PROFILER_ENTER(context->priv->prof_rfx_encode_rgb); diff --git a/libfreerdp/codec/rfx_encode.h b/libfreerdp/codec/rfx_encode.h index 6fa1e9596..56220e838 100644 --- a/libfreerdp/codec/rfx_encode.h +++ b/libfreerdp/codec/rfx_encode.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Encode * * Copyright 2011 Vic Lee @@ -22,10 +22,10 @@ #include -void rfx_encode_rgb_to_ycbcr(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf); +void rfx_encode_rgb_to_ycbcr(INT16* y_r_buf, INT16* cb_g_buf, INT16* cr_b_buf); -void rfx_encode_rgb(RFX_CONTEXT* context, const uint8* rgb_data, int width, int height, int rowstride, - const uint32* y_quants, const uint32* cb_quants, const uint32* cr_quants, +void rfx_encode_rgb(RFX_CONTEXT* context, const BYTE* rgb_data, int width, int height, int rowstride, + const UINT32* y_quants, const UINT32* cb_quants, const UINT32* cr_quants, STREAM* data_out, int* y_size, int* cb_size, int* cr_size); #endif diff --git a/libfreerdp/codec/rfx_neon.c b/libfreerdp/codec/rfx_neon.c index 1cbd7b7b7..fc84440c4 100644 --- a/libfreerdp/codec/rfx_neon.c +++ b/libfreerdp/codec/rfx_neon.c @@ -1,5 +1,5 @@ /* - FreeRDP: A Remote Desktop Protocol client. + FreeRDP: A Remote Desktop Protocol Implementation RemoteFX Codec Library - NEON Optimizations Copyright 2011 Martin Fleisz @@ -36,7 +36,7 @@ #endif -void rfx_decode_YCbCr_to_RGB_NEON(sint16 * y_r_buffer, sint16 * cb_g_buffer, sint16 * cr_b_buffer) +void rfx_decode_YCbCr_to_RGB_NEON(INT16 * y_r_buffer, INT16 * cb_g_buffer, INT16 * cr_b_buffer) { int16x8_t zero = vdupq_n_s16(0); int16x8_t max = vdupq_n_s16(255); @@ -49,10 +49,10 @@ void rfx_decode_YCbCr_to_RGB_NEON(sint16 * y_r_buffer, sint16 * cb_g_buffer, sin int i; for (i = 0; i < 4096 / 8; i++) { - int16x8_t y = vld1q_s16((sint16*)&y_r_buf[i]); + int16x8_t y = vld1q_s16((INT16*)&y_r_buf[i]); y = vaddq_s16(y, y_add); - int16x8_t cr = vld1q_s16((sint16*)&cr_b_buf[i]); + int16x8_t cr = vld1q_s16((INT16*)&cr_b_buf[i]); // r = between((y + cr + (cr >> 2) + (cr >> 3) + (cr >> 5)), 0, 255); int16x8_t r = vaddq_s16(y, cr); @@ -60,10 +60,10 @@ void rfx_decode_YCbCr_to_RGB_NEON(sint16 * y_r_buffer, sint16 * cb_g_buffer, sin r = vaddq_s16(r, vshrq_n_s16(cr, 3)); r = vaddq_s16(r, vshrq_n_s16(cr, 5)); r = vminq_s16(vmaxq_s16(r, zero), max); - vst1q_s16((sint16*)&y_r_buf[i], r); + vst1q_s16((INT16*)&y_r_buf[i], r); // cb = cb_g_buf[i]; - int16x8_t cb = vld1q_s16((sint16*)&cb_g_buf[i]); + int16x8_t cb = vld1q_s16((INT16*)&cb_g_buf[i]); // g = between(y - (cb >> 2) - (cb >> 4) - (cb >> 5) - (cr >> 1) - (cr >> 3) - (cr >> 4) - (cr >> 5), 0, 255); int16x8_t g = vsubq_s16(y, vshrq_n_s16(cb, 2)); @@ -74,7 +74,7 @@ void rfx_decode_YCbCr_to_RGB_NEON(sint16 * y_r_buffer, sint16 * cb_g_buffer, sin g = vsubq_s16(g, vshrq_n_s16(cr, 4)); g = vsubq_s16(g, vshrq_n_s16(cr, 5)); g = vminq_s16(vmaxq_s16(g, zero), max); - vst1q_s16((sint16*)&cb_g_buf[i], g); + vst1q_s16((INT16*)&cb_g_buf[i], g); // b = between((y + cb + (cb >> 1) + (cb >> 2) + (cb >> 6)), 0, 255); int16x8_t b = vaddq_s16(y, cb); @@ -82,13 +82,13 @@ void rfx_decode_YCbCr_to_RGB_NEON(sint16 * y_r_buffer, sint16 * cb_g_buffer, sin b = vaddq_s16(b, vshrq_n_s16(cb, 2)); b = vaddq_s16(b, vshrq_n_s16(cb, 6)); b = vminq_s16(vmaxq_s16(b, zero), max); - vst1q_s16((sint16*)&cr_b_buf[i], b); + vst1q_s16((INT16*)&cr_b_buf[i], b); } } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_quantization_decode_block_NEON(sint16 * buffer, const int buffer_size, const uint32 factor) +rfx_quantization_decode_block_NEON(INT16 * buffer, const int buffer_size, const UINT32 factor) { if (factor <= 6) return; @@ -98,16 +98,16 @@ rfx_quantization_decode_block_NEON(sint16 * buffer, const int buffer_size, const do { - int16x8_t val = vld1q_s16((sint16*)buf); + int16x8_t val = vld1q_s16((INT16*)buf); val = vshlq_s16(val, quantFactors); - vst1q_s16((sint16*)buf, val); + vst1q_s16((INT16*)buf, val); buf++; } while(buf < buf_end); } void -rfx_quantization_decode_NEON(sint16 * buffer, const uint32 * quantization_values) +rfx_quantization_decode_NEON(INT16 * buffer, const UINT32 * quantization_values) { rfx_quantization_decode_block_NEON(buffer, 1024, quantization_values[8]); /* HL1 */ rfx_quantization_decode_block_NEON(buffer + 1024, 1024, quantization_values[7]); /* LH1 */ @@ -124,12 +124,12 @@ rfx_quantization_decode_NEON(sint16 * buffer, const uint32 * quantization_values static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_decode_block_horiz_NEON(sint16 * l, sint16 * h, sint16 * dst, int subband_width) +rfx_dwt_2d_decode_block_horiz_NEON(INT16 * l, INT16 * h, INT16 * dst, int subband_width) { int y, n; - sint16 * l_ptr = l; - sint16 * h_ptr = h; - sint16 * dst_ptr = dst; + INT16 * l_ptr = l; + INT16 * h_ptr = h; + INT16 * dst_ptr = dst; for (y = 0; y < subband_width; y++) { @@ -195,12 +195,12 @@ rfx_dwt_2d_decode_block_horiz_NEON(sint16 * l, sint16 * h, sint16 * dst, int sub } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_decode_block_vert_NEON(sint16 * l, sint16 * h, sint16 * dst, int subband_width) +rfx_dwt_2d_decode_block_vert_NEON(INT16 * l, INT16 * h, INT16 * dst, int subband_width) { int x, n; - sint16 * l_ptr = l; - sint16 * h_ptr = h; - sint16 * dst_ptr = dst; + INT16 * l_ptr = l; + INT16 * h_ptr = h; + INT16 * dst_ptr = dst; int total_width = subband_width + subband_width; @@ -269,10 +269,10 @@ rfx_dwt_2d_decode_block_vert_NEON(sint16 * l, sint16 * h, sint16 * dst, int subb } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_decode_block_NEON(sint16 * buffer, sint16 * idwt, int subband_width) +rfx_dwt_2d_decode_block_NEON(INT16 * buffer, INT16 * idwt, int subband_width) { - sint16 * hl, * lh, * hh, * ll; - sint16 * l_dst, * h_dst; + INT16 * hl, * lh, * hh, * ll; + INT16 * l_dst, * h_dst; /* Inverse DWT in horizontal direction, results in 2 sub-bands in L, H order in tmp buffer idwt. */ /* The 4 sub-bands are stored in HL(0), LH(1), HH(2), LL(3) order. */ @@ -296,7 +296,7 @@ rfx_dwt_2d_decode_block_NEON(sint16 * buffer, sint16 * idwt, int subband_width) } void -rfx_dwt_2d_decode_NEON(sint16 * buffer, sint16 * dwt_buffer) +rfx_dwt_2d_decode_NEON(INT16 * buffer, INT16 * dwt_buffer) { rfx_dwt_2d_decode_block_NEON(buffer + 3840, dwt_buffer, 8); rfx_dwt_2d_decode_block_NEON(buffer + 3072, dwt_buffer, 16); @@ -314,7 +314,7 @@ int isNeonSupported() return 0; } - uint64_t features = android_getCpuFeatures(); + UINT64_t features = android_getCpuFeatures(); if ((features & ANDROID_CPU_ARM_FEATURE_ARMv7)) { if (features & ANDROID_CPU_ARM_FEATURE_NEON) diff --git a/libfreerdp/codec/rfx_neon.h b/libfreerdp/codec/rfx_neon.h index 28dbc36f1..4ec15b281 100644 --- a/libfreerdp/codec/rfx_neon.h +++ b/libfreerdp/codec/rfx_neon.h @@ -1,5 +1,5 @@ /* - FreeRDP: A Remote Desktop Protocol client. + FreeRDP: A Remote Desktop Protocol Implementation RemoteFX Codec Library - NEON Optimizations Copyright 2011 Martin Fleisz diff --git a/libfreerdp/codec/rfx_pool.c b/libfreerdp/codec/rfx_pool.c index 47e6065b6..7032a2593 100644 --- a/libfreerdp/codec/rfx_pool.c +++ b/libfreerdp/codec/rfx_pool.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Memory Pool * * Copyright 2011 Marc-Andre Moreau @@ -53,14 +53,14 @@ void rfx_pool_free(RFX_POOL* pool) if (tile != NULL) { if (tile->data != NULL) - xfree(tile->data); + free(tile->data); - xfree(tile); + free(tile); } } - xfree(pool->tiles); - xfree(pool); + free(pool->tiles); + free(pool); } void rfx_pool_put_tile(RFX_POOL* pool, RFX_TILE* tile) @@ -68,7 +68,7 @@ void rfx_pool_put_tile(RFX_POOL* pool, RFX_TILE* tile) if (pool->count >= pool->size) { pool->size *= 2; - pool->tiles = (RFX_TILE**) xrealloc((void*) pool->tiles, sizeof(RFX_TILE*) * pool->size); + pool->tiles = (RFX_TILE**) realloc((void*) pool->tiles, sizeof(RFX_TILE*) * pool->size); } pool->tiles[(pool->count)++] = tile; @@ -81,7 +81,7 @@ RFX_TILE* rfx_pool_get_tile(RFX_POOL* pool) if (pool->count < 1) { tile = xnew(RFX_TILE); - tile->data = (uint8*) xmalloc(4096 * 4); /* 64x64 * 4 */ + tile->data = (BYTE*) malloc(4096 * 4); /* 64x64 * 4 */ } else { @@ -106,7 +106,7 @@ RFX_TILE** rfx_pool_get_tiles(RFX_POOL* pool, int count) int i; RFX_TILE** tiles; - tiles = (RFX_TILE**) xmalloc(sizeof(RFX_TILE*) * count); + tiles = (RFX_TILE**) malloc(sizeof(RFX_TILE*) * count); for (i = 0; i < count; i++) { diff --git a/libfreerdp/codec/rfx_pool.h b/libfreerdp/codec/rfx_pool.h index 4f1ff81f8..787a32627 100644 --- a/libfreerdp/codec/rfx_pool.h +++ b/libfreerdp/codec/rfx_pool.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Memory Pool * * Copyright 2011 Marc-Andre Moreau diff --git a/libfreerdp/codec/rfx_quantization.c b/libfreerdp/codec/rfx_quantization.c index 81adb20f6..a25a8dabe 100644 --- a/libfreerdp/codec/rfx_quantization.c +++ b/libfreerdp/codec/rfx_quantization.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Quantization * * Copyright 2011 Vic Lee @@ -23,9 +23,9 @@ #include "rfx_quantization.h" -static void rfx_quantization_decode_block(sint16* buffer, int buffer_size, uint32 factor) +static void rfx_quantization_decode_block(INT16* buffer, int buffer_size, UINT32 factor) { - sint16* dst; + INT16* dst; if (factor == 0) return; @@ -36,7 +36,7 @@ static void rfx_quantization_decode_block(sint16* buffer, int buffer_size, uint3 } } -void rfx_quantization_decode(sint16* buffer, const uint32* quantization_values) +void rfx_quantization_decode(INT16* buffer, const UINT32* quantization_values) { /* Scale the values so that they are represented as 11.5 fixed-point number */ rfx_quantization_decode_block(buffer, 4096, 5); @@ -53,10 +53,10 @@ void rfx_quantization_decode(sint16* buffer, const uint32* quantization_values) rfx_quantization_decode_block(buffer + 4032, 64, quantization_values[0] - 6); /* LL3 */ } -static void rfx_quantization_encode_block(sint16* buffer, int buffer_size, uint32 factor) +static void rfx_quantization_encode_block(INT16* buffer, int buffer_size, UINT32 factor) { - sint16* dst; - sint16 half; + INT16* dst; + INT16 half; if (factor == 0) return; @@ -68,7 +68,7 @@ static void rfx_quantization_encode_block(sint16* buffer, int buffer_size, uint3 } } -void rfx_quantization_encode(sint16* buffer, const uint32* quantization_values) +void rfx_quantization_encode(INT16* buffer, const UINT32* quantization_values) { rfx_quantization_encode_block(buffer, 1024, quantization_values[8] - 6); /* HL1 */ rfx_quantization_encode_block(buffer + 1024, 1024, quantization_values[7] - 6); /* LH1 */ diff --git a/libfreerdp/codec/rfx_quantization.h b/libfreerdp/codec/rfx_quantization.h index 9fbfa5143..b10aa729f 100644 --- a/libfreerdp/codec/rfx_quantization.h +++ b/libfreerdp/codec/rfx_quantization.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - Quantization * * Copyright 2011 Vic Lee @@ -22,7 +22,7 @@ #include -void rfx_quantization_decode(sint16* buffer, const uint32* quantization_values); -void rfx_quantization_encode(sint16* buffer, const uint32* quantization_values); +void rfx_quantization_decode(INT16* buffer, const UINT32* quantization_values); +void rfx_quantization_encode(INT16* buffer, const UINT32* quantization_values); #endif /* __RFX_QUANTIZATION_H */ diff --git a/libfreerdp/codec/rfx_rlgr.c b/libfreerdp/codec/rfx_rlgr.c index 7e92c475d..c2ef38765 100644 --- a/libfreerdp/codec/rfx_rlgr.c +++ b/libfreerdp/codec/rfx_rlgr.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - RLGR * * Copyright 2011 Vic Lee @@ -63,7 +63,7 @@ nZeroesWritten = buffer_size; \ if (nZeroesWritten > 0) \ { \ - memset(dst, 0, nZeroesWritten * sizeof(sint16)); \ + memset(dst, 0, nZeroesWritten * sizeof(INT16)); \ dst += nZeroesWritten; \ } \ buffer_size -= (nZeroes); \ @@ -72,7 +72,7 @@ /* Returns the least number of bits required to represent a given value */ #define GetMinBits(_val, _nbits) \ { \ - uint32 _v = _val; \ + UINT32 _v = _val; \ _nbits = 0; \ while (_v) \ { \ @@ -82,7 +82,7 @@ } /* Converts from (2 * magnitude - sign) to integer */ -#define GetIntFrom2MagSign(twoMs) (((twoMs) & 1) ? -1 * (sint16)(((twoMs) + 1) >> 1) : (sint16)((twoMs) >> 1)) +#define GetIntFrom2MagSign(twoMs) (((twoMs) & 1) ? -1 * (INT16)(((twoMs) + 1) >> 1) : (INT16)((twoMs) >> 1)) /* * Update the passed parameter and clamp it to the range [0, KPMAX] @@ -121,18 +121,18 @@ UpdateParam(*krp, vk, *kr); /* at 1, no change! */ \ } -int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* buffer, int buffer_size) +int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* data, int data_size, INT16* buffer, int buffer_size) { int k; int kp; int kr; int krp; - uint16 r; - sint16* dst; + UINT16 r; + INT16* dst; RFX_BITSTREAM* bs; int vk; - uint16 mag16; + UINT16 mag16; bs = xnew(RFX_BITSTREAM); rfx_bitstream_attach(bs, data, data_size); @@ -150,7 +150,7 @@ int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* bu if (k) { int mag; - uint32 sign; + UINT32 sign; /* RL MODE */ while (!rfx_bitstream_eos(bs)) @@ -179,14 +179,14 @@ int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* bu } else { - uint32 mag; - uint32 nIdx; - uint32 val1; - uint32 val2; + UINT32 mag; + UINT32 nIdx; + UINT32 val1; + UINT32 val2; /* GR (GOLOMB-RICE) MODE */ GetGRCode(&krp, &kr, vk, mag16) /* values coded are 2 * magnitude - sign */ - mag = (uint32) mag16; + mag = (UINT32) mag16; if (mode == RLGR1) { @@ -234,7 +234,7 @@ int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* bu } } - xfree(bs); + free(bs); return (dst - buffer); } @@ -259,7 +259,7 @@ int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* bu /* Emit a bit (0 or 1), count number of times, to the output bitstream */ #define OutputBit(count, bit) \ { \ - uint16 _b = (bit ? 0xFFFF : 0); \ + UINT16 _b = (bit ? 0xFFFF : 0); \ int _c = (count); \ for (; _c > 0; _c -= 16) \ rfx_bitstream_put_bits(bs, _b, (_c > 16 ? 16 : _c)); \ @@ -271,13 +271,13 @@ int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* bu /* Outputs the Golomb/Rice encoding of a non-negative integer */ #define CodeGR(krp, val) rfx_rlgr_code_gr(bs, krp, val) -static void rfx_rlgr_code_gr(RFX_BITSTREAM* bs, int* krp, uint32 val) +static void rfx_rlgr_code_gr(RFX_BITSTREAM* bs, int* krp, UINT32 val) { int kr = *krp >> LSGR; /* unary part of GR code */ - uint32 vk = (val) >> kr; + UINT32 vk = (val) >> kr; OutputBit(vk, 1); OutputBit(1, 0); @@ -298,7 +298,7 @@ static void rfx_rlgr_code_gr(RFX_BITSTREAM* bs, int* krp, uint32 val) } } -int rfx_rlgr_encode(RLGR_MODE mode, const sint16* data, int data_size, uint8* buffer, int buffer_size) +int rfx_rlgr_encode(RLGR_MODE mode, const INT16* data, int data_size, BYTE* buffer, int buffer_size) { int k; int kp; @@ -371,7 +371,7 @@ int rfx_rlgr_encode(RLGR_MODE mode, const sint16* data, int data_size, uint8* bu if (mode == RLGR1) { - uint32 twoMs; + UINT32 twoMs; /* RLGR1 variant */ @@ -394,10 +394,10 @@ int rfx_rlgr_encode(RLGR_MODE mode, const sint16* data, int data_size, uint8* bu } else /* mode == RLGR3 */ { - uint32 twoMs1; - uint32 twoMs2; - uint32 sum2Ms; - uint32 nIdx; + UINT32 twoMs1; + UINT32 twoMs2; + UINT32 sum2Ms; + UINT32 nIdx; /* RLGR3 variant */ @@ -431,7 +431,7 @@ int rfx_rlgr_encode(RLGR_MODE mode, const sint16* data, int data_size, uint8* bu } processed_size = rfx_bitstream_get_processed_bytes(bs); - xfree(bs); + free(bs); return processed_size; } diff --git a/libfreerdp/codec/rfx_rlgr.h b/libfreerdp/codec/rfx_rlgr.h index b470bd5a8..07fa895f6 100644 --- a/libfreerdp/codec/rfx_rlgr.h +++ b/libfreerdp/codec/rfx_rlgr.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - RLGR * * Copyright 2011 Vic Lee @@ -22,7 +22,7 @@ #include -int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* buffer, int buffer_size); -int rfx_rlgr_encode(RLGR_MODE mode, const sint16* data, int data_size, uint8* buffer, int buffer_size); +int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* data, int data_size, INT16* buffer, int buffer_size); +int rfx_rlgr_encode(RLGR_MODE mode, const INT16* data, int data_size, BYTE* buffer, int buffer_size); #endif /* __RFX_RLGR_H */ diff --git a/libfreerdp/codec/rfx_sse2.c b/libfreerdp/codec/rfx_sse2.c index b9cc9fa04..ac2376d28 100644 --- a/libfreerdp/codec/rfx_sse2.c +++ b/libfreerdp/codec/rfx_sse2.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - SSE2 Optimizations * * Copyright 2011 Stephen Erisman @@ -52,7 +52,7 @@ _mm_prefetch_buffer(char * buffer, int num_bytes) } } -static void rfx_decode_ycbcr_to_rgb_sse2(sint16* y_r_buffer, sint16* cb_g_buffer, sint16* cr_b_buffer) +static void rfx_decode_ycbcr_to_rgb_sse2(INT16* y_r_buffer, INT16* cb_g_buffer, INT16* cr_b_buffer) { __m128i zero = _mm_setzero_si128(); __m128i max = _mm_set1_epi16(255); @@ -76,13 +76,13 @@ static void rfx_decode_ycbcr_to_rgb_sse2(sint16* y_r_buffer, sint16* cb_g_buffer __m128i b_cb = _mm_set1_epi16(28999); // 1.770 << 14 __m128i c4096 = _mm_set1_epi16(4096); - for (i = 0; i < (4096 * sizeof(sint16) / sizeof(__m128i)); i += (CACHE_LINE_BYTES / sizeof(__m128i))) + for (i = 0; i < (4096 * sizeof(INT16) / sizeof(__m128i)); i += (CACHE_LINE_BYTES / sizeof(__m128i))) { _mm_prefetch((char*)(&y_r_buf[i]), _MM_HINT_NTA); _mm_prefetch((char*)(&cb_g_buf[i]), _MM_HINT_NTA); _mm_prefetch((char*)(&cr_b_buf[i]), _MM_HINT_NTA); } - for (i = 0; i < (4096 * sizeof(sint16) / sizeof(__m128i)); i++) + for (i = 0; i < (4096 * sizeof(INT16) / sizeof(__m128i)); i++) { /* In order to use SSE2 signed 16-bit integer multiplication we need to convert @@ -135,7 +135,7 @@ static void rfx_decode_ycbcr_to_rgb_sse2(sint16* y_r_buffer, sint16* cb_g_buffer } /* The encodec YCbCr coeffectients are represented as 11.5 fixed-point numbers. See rfx_encode.c */ -static void rfx_encode_rgb_to_ycbcr_sse2(sint16* y_r_buffer, sint16* cb_g_buffer, sint16* cr_b_buffer) +static void rfx_encode_rgb_to_ycbcr_sse2(INT16* y_r_buffer, INT16* cb_g_buffer, INT16* cr_b_buffer) { __m128i min = _mm_set1_epi16(-128 << 5); __m128i max = _mm_set1_epi16(127 << 5); @@ -163,13 +163,13 @@ static void rfx_encode_rgb_to_ycbcr_sse2(sint16* y_r_buffer, sint16* cb_g_buffer int i; - for (i = 0; i < (4096 * sizeof(sint16) / sizeof(__m128i)); i += (CACHE_LINE_BYTES / sizeof(__m128i))) + for (i = 0; i < (4096 * sizeof(INT16) / sizeof(__m128i)); i += (CACHE_LINE_BYTES / sizeof(__m128i))) { _mm_prefetch((char*)(&y_r_buf[i]), _MM_HINT_NTA); _mm_prefetch((char*)(&cb_g_buf[i]), _MM_HINT_NTA); _mm_prefetch((char*)(&cr_b_buf[i]), _MM_HINT_NTA); } - for (i = 0; i < (4096 * sizeof(sint16) / sizeof(__m128i)); i++) + for (i = 0; i < (4096 * sizeof(INT16) / sizeof(__m128i)); i++) { /* In order to use SSE2 signed 16-bit integer multiplication we need to convert @@ -225,7 +225,7 @@ static void rfx_encode_rgb_to_ycbcr_sse2(sint16* y_r_buffer, sint16* cb_g_buffer } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_quantization_decode_block_sse2(sint16* buffer, const int buffer_size, const uint32 factor) +rfx_quantization_decode_block_sse2(INT16* buffer, const int buffer_size, const UINT32 factor) { __m128i a; __m128i * ptr = (__m128i*) buffer; @@ -244,9 +244,9 @@ rfx_quantization_decode_block_sse2(sint16* buffer, const int buffer_size, const } while(ptr < buf_end); } -static void rfx_quantization_decode_sse2(sint16* buffer, const uint32* quantization_values) +static void rfx_quantization_decode_sse2(INT16* buffer, const UINT32* quantization_values) { - _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(sint16)); + _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(INT16)); rfx_quantization_decode_block_sse2(buffer, 4096, 5); @@ -263,7 +263,7 @@ static void rfx_quantization_decode_sse2(sint16* buffer, const uint32* quantizat } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_quantization_encode_block_sse2(sint16* buffer, const int buffer_size, const uint32 factor) +rfx_quantization_encode_block_sse2(INT16* buffer, const int buffer_size, const UINT32 factor) { __m128i a; __m128i* ptr = (__m128i*) buffer; @@ -285,9 +285,9 @@ rfx_quantization_encode_block_sse2(sint16* buffer, const int buffer_size, const } while(ptr < buf_end); } -static void rfx_quantization_encode_sse2(sint16* buffer, const uint32* quantization_values) +static void rfx_quantization_encode_sse2(INT16* buffer, const UINT32* quantization_values) { - _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(sint16)); + _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(INT16)); rfx_quantization_encode_block_sse2(buffer, 1024, quantization_values[8] - 6); /* HL1 */ rfx_quantization_encode_block_sse2(buffer + 1024, 1024, quantization_values[7] - 6); /* LH1 */ @@ -304,12 +304,12 @@ static void rfx_quantization_encode_sse2(sint16* buffer, const uint32* quantizat } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_decode_block_horiz_sse2(sint16* l, sint16* h, sint16* dst, int subband_width) +rfx_dwt_2d_decode_block_horiz_sse2(INT16* l, INT16* h, INT16* dst, int subband_width) { int y, n; - sint16* l_ptr = l; - sint16* h_ptr = h; - sint16* dst_ptr = dst; + INT16* l_ptr = l; + INT16* h_ptr = h; + INT16* dst_ptr = dst; int first; int last; __m128i l_n; @@ -388,12 +388,12 @@ rfx_dwt_2d_decode_block_horiz_sse2(sint16* l, sint16* h, sint16* dst, int subban } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_decode_block_vert_sse2(sint16* l, sint16* h, sint16* dst, int subband_width) +rfx_dwt_2d_decode_block_vert_sse2(INT16* l, INT16* h, INT16* dst, int subband_width) { int x, n; - sint16* l_ptr = l; - sint16* h_ptr = h; - sint16* dst_ptr = dst; + INT16* l_ptr = l; + INT16* h_ptr = h; + INT16* dst_ptr = dst; __m128i l_n; __m128i h_n; __m128i tmp_n; @@ -469,12 +469,12 @@ rfx_dwt_2d_decode_block_vert_sse2(sint16* l, sint16* h, sint16* dst, int subband } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_decode_block_sse2(sint16* buffer, sint16* idwt, int subband_width) +rfx_dwt_2d_decode_block_sse2(INT16* buffer, INT16* idwt, int subband_width) { - sint16 *hl, *lh, *hh, *ll; - sint16 *l_dst, *h_dst; + INT16 *hl, *lh, *hh, *ll; + INT16 *l_dst, *h_dst; - _mm_prefetch_buffer((char*) idwt, subband_width * 4 * sizeof(sint16)); + _mm_prefetch_buffer((char*) idwt, subband_width * 4 * sizeof(INT16)); /* Inverse DWT in horizontal direction, results in 2 sub-bands in L, H order in tmp buffer idwt. */ /* The 4 sub-bands are stored in HL(0), LH(1), HH(2), LL(3) order. */ @@ -497,9 +497,9 @@ rfx_dwt_2d_decode_block_sse2(sint16* buffer, sint16* idwt, int subband_width) rfx_dwt_2d_decode_block_vert_sse2(l_dst, h_dst, buffer, subband_width); } -static void rfx_dwt_2d_decode_sse2(sint16* buffer, sint16* dwt_buffer) +static void rfx_dwt_2d_decode_sse2(INT16* buffer, INT16* dwt_buffer) { - _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(sint16)); + _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(INT16)); rfx_dwt_2d_decode_block_sse2(buffer + 3840, dwt_buffer, 8); rfx_dwt_2d_decode_block_sse2(buffer + 3072, dwt_buffer, 16); @@ -507,7 +507,7 @@ static void rfx_dwt_2d_decode_sse2(sint16* buffer, sint16* dwt_buffer) } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_encode_block_vert_sse2(sint16* src, sint16* l, sint16* h, int subband_width) +rfx_dwt_2d_encode_block_vert_sse2(INT16* src, INT16* l, INT16* h, int subband_width) { int total_width; int x; @@ -563,7 +563,7 @@ rfx_dwt_2d_encode_block_vert_sse2(sint16* src, sint16* l, sint16* h, int subband } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_encode_block_horiz_sse2(sint16* src, sint16* l, sint16* h, int subband_width) +rfx_dwt_2d_encode_block_horiz_sse2(INT16* src, INT16* l, INT16* h, int subband_width) { int y; int n; @@ -617,12 +617,12 @@ rfx_dwt_2d_encode_block_horiz_sse2(sint16* src, sint16* l, sint16* h, int subban } static __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -rfx_dwt_2d_encode_block_sse2(sint16* buffer, sint16* dwt, int subband_width) +rfx_dwt_2d_encode_block_sse2(INT16* buffer, INT16* dwt, int subband_width) { - sint16 *hl, *lh, *hh, *ll; - sint16 *l_src, *h_src; + INT16 *hl, *lh, *hh, *ll; + INT16 *l_src, *h_src; - _mm_prefetch_buffer((char*) dwt, subband_width * 4 * sizeof(sint16)); + _mm_prefetch_buffer((char*) dwt, subband_width * 4 * sizeof(INT16)); /* DWT in vertical direction, results in 2 sub-bands in L, H order in tmp buffer dwt. */ @@ -645,9 +645,9 @@ rfx_dwt_2d_encode_block_sse2(sint16* buffer, sint16* dwt, int subband_width) rfx_dwt_2d_encode_block_horiz_sse2(h_src, lh, hh, subband_width); } -static void rfx_dwt_2d_encode_sse2(sint16* buffer, sint16* dwt_buffer) +static void rfx_dwt_2d_encode_sse2(INT16* buffer, INT16* dwt_buffer) { - _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(sint16)); + _mm_prefetch_buffer((char*) buffer, 4096 * sizeof(INT16)); rfx_dwt_2d_encode_block_sse2(buffer, dwt_buffer, 32); rfx_dwt_2d_encode_block_sse2(buffer + 3072, dwt_buffer, 16); diff --git a/libfreerdp/codec/rfx_sse2.h b/libfreerdp/codec/rfx_sse2.h index b9a9a2a56..2fc14fd47 100644 --- a/libfreerdp/codec/rfx_sse2.h +++ b/libfreerdp/codec/rfx_sse2.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library - SSE2 Optimizations * * Copyright 2011 Stephen Erisman diff --git a/libfreerdp/codec/rfx_types.h b/libfreerdp/codec/rfx_types.h index dd3f739ef..223cbf9cd 100644 --- a/libfreerdp/codec/rfx_types.h +++ b/libfreerdp/codec/rfx_types.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX Codec Library * * Copyright 2011 Vic Lee @@ -41,17 +41,17 @@ struct _RFX_CONTEXT_PRIV RFX_POOL* pool; /* memory pool */ - sint16 y_r_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */ - sint16 cb_g_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */ - sint16 cr_b_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */ + INT16 y_r_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */ + INT16 cb_g_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */ + INT16 cr_b_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */ - sint16* y_r_buffer; - sint16* cb_g_buffer; - sint16* cr_b_buffer; + INT16* y_r_buffer; + INT16* cb_g_buffer; + INT16* cr_b_buffer; - sint16 dwt_mem[32 * 32 * 2 * 2 + 8]; /* maximum sub-band width is 32 */ + INT16 dwt_mem[32 * 32 * 2 * 2 + 8]; /* maximum sub-band width is 32 */ - sint16* dwt_buffer; + INT16* dwt_buffer; /* profilers */ PROFILER_DEFINE(prof_rfx_decode_rgb); diff --git a/libfreerdp/core/CMakeLists.txt b/libfreerdp/core/CMakeLists.txt index 14467460a..d1187517d 100644 --- a/libfreerdp/core/CMakeLists.txt +++ b/libfreerdp/core/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-core cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -92,7 +92,7 @@ set(${MODULE_PREFIX}_SRCS peer.c peer.h) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -100,16 +100,14 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS winpr) else() set(${MODULE_PREFIX}_LIBS + winpr-registry winpr-utils - winpr-sspi) - - if(NOT WIN32) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-registry) - endif() + winpr-sspi + winpr-crt) endif() if(WIN32) @@ -120,7 +118,7 @@ endif() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${OPENSSL_LIBRARIES}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} @@ -133,4 +131,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/core/activation.c b/libfreerdp/core/activation.c index 8551bf8fd..2213d2491 100644 --- a/libfreerdp/core/activation.c +++ b/libfreerdp/core/activation.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Activation Sequence * * Copyright 2011 Marc-Andre Moreau @@ -36,11 +36,11 @@ static const char* const CTRLACTION_STRINGS[] = void rdp_write_synchronize_pdu(STREAM* s, rdpSettings* settings) { - stream_write_uint16(s, SYNCMSGTYPE_SYNC); /* messageType (2 bytes) */ - stream_write_uint16(s, settings->pdu_source); /* targetUser (2 bytes) */ + stream_write_UINT16(s, SYNCMSGTYPE_SYNC); /* messageType (2 bytes) */ + stream_write_UINT16(s, settings->pdu_source); /* targetUser (2 bytes) */ } -boolean rdp_recv_synchronize_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_synchronize_pdu(rdpRdp* rdp, STREAM* s) { if (rdp->settings->server_mode) return rdp_recv_server_synchronize_pdu(rdp, s); @@ -48,13 +48,13 @@ boolean rdp_recv_synchronize_pdu(rdpRdp* rdp, STREAM* s) return rdp_recv_client_synchronize_pdu(rdp, s); } -boolean rdp_recv_server_synchronize_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_server_synchronize_pdu(rdpRdp* rdp, STREAM* s) { rdp->finalize_sc_pdus |= FINALIZE_SC_SYNCHRONIZE_PDU; - return true; + return TRUE; } -boolean rdp_send_server_synchronize_pdu(rdpRdp* rdp) +BOOL rdp_send_server_synchronize_pdu(rdpRdp* rdp) { STREAM* s; @@ -63,30 +63,30 @@ boolean rdp_send_server_synchronize_pdu(rdpRdp* rdp) rdp_write_synchronize_pdu(s, rdp->settings); rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SYNCHRONIZE, rdp->mcs->user_id); - return true; + return TRUE; } -boolean rdp_recv_client_synchronize_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_client_synchronize_pdu(rdpRdp* rdp, STREAM* s) { - uint16 messageType; + UINT16 messageType; rdp->finalize_sc_pdus |= FINALIZE_SC_SYNCHRONIZE_PDU; if (stream_get_left(s) < 4) - return false; + return FALSE; - stream_read_uint16(s, messageType); /* messageType (2 bytes) */ + stream_read_UINT16(s, messageType); /* messageType (2 bytes) */ if (messageType != SYNCMSGTYPE_SYNC) - return false; + return FALSE; /* targetUser (2 bytes) */ - stream_seek_uint16(s); + stream_seek_UINT16(s); - return true; + return TRUE; } -boolean rdp_send_client_synchronize_pdu(rdpRdp* rdp) +BOOL rdp_send_client_synchronize_pdu(rdpRdp* rdp) { STREAM* s; @@ -97,28 +97,28 @@ boolean rdp_send_client_synchronize_pdu(rdpRdp* rdp) return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SYNCHRONIZE, rdp->mcs->user_id); } -boolean rdp_recv_control_pdu(STREAM* s, uint16* action) +BOOL rdp_recv_control_pdu(STREAM* s, UINT16* action) { if (stream_get_left(s) < 8) - return false; + return FALSE; - stream_read_uint16(s, *action); /* action (2 bytes) */ - stream_seek_uint16(s); /* grantId (2 bytes) */ - stream_seek_uint32(s); /* controlId (4 bytes) */ + stream_read_UINT16(s, *action); /* action (2 bytes) */ + stream_seek_UINT16(s); /* grantId (2 bytes) */ + stream_seek_UINT32(s); /* controlId (4 bytes) */ - return true; + return TRUE; } -void rdp_write_client_control_pdu(STREAM* s, uint16 action) +void rdp_write_client_control_pdu(STREAM* s, UINT16 action) { - stream_write_uint16(s, action); /* action (2 bytes) */ - stream_write_uint16(s, 0); /* grantId (2 bytes) */ - stream_write_uint32(s, 0); /* controlId (4 bytes) */ + stream_write_UINT16(s, action); /* action (2 bytes) */ + stream_write_UINT16(s, 0); /* grantId (2 bytes) */ + stream_write_UINT32(s, 0); /* controlId (4 bytes) */ } -boolean rdp_recv_server_control_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_server_control_pdu(rdpRdp* rdp, STREAM* s) { - uint16 action; + UINT16 action; rdp_recv_control_pdu(s, &action); @@ -133,40 +133,40 @@ boolean rdp_recv_server_control_pdu(rdpRdp* rdp, STREAM* s) break; } - return true; + return TRUE; } -boolean rdp_send_server_control_cooperate_pdu(rdpRdp* rdp) +BOOL rdp_send_server_control_cooperate_pdu(rdpRdp* rdp) { STREAM* s; s = rdp_data_pdu_init(rdp); - stream_write_uint16(s, CTRLACTION_COOPERATE); /* action (2 bytes) */ - stream_write_uint16(s, 0); /* grantId (2 bytes) */ - stream_write_uint32(s, 0); /* controlId (4 bytes) */ + stream_write_UINT16(s, CTRLACTION_COOPERATE); /* action (2 bytes) */ + stream_write_UINT16(s, 0); /* grantId (2 bytes) */ + stream_write_UINT32(s, 0); /* controlId (4 bytes) */ rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id); - return true; + return TRUE; } -boolean rdp_send_server_control_granted_pdu(rdpRdp* rdp) +BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp) { STREAM* s; s = rdp_data_pdu_init(rdp); - stream_write_uint16(s, CTRLACTION_GRANTED_CONTROL); /* action (2 bytes) */ - stream_write_uint16(s, rdp->mcs->user_id); /* grantId (2 bytes) */ - stream_write_uint32(s, 0x03EA); /* controlId (4 bytes) */ + stream_write_UINT16(s, CTRLACTION_GRANTED_CONTROL); /* action (2 bytes) */ + stream_write_UINT16(s, rdp->mcs->user_id); /* grantId (2 bytes) */ + stream_write_UINT32(s, 0x03EA); /* controlId (4 bytes) */ rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id); - return true; + return TRUE; } -boolean rdp_send_client_control_pdu(rdpRdp* rdp, uint16 action) +BOOL rdp_send_client_control_pdu(rdpRdp* rdp, UINT16 action) { STREAM* s; @@ -176,32 +176,32 @@ boolean rdp_send_client_control_pdu(rdpRdp* rdp, uint16 action) return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id); } -void rdp_write_persistent_list_entry(STREAM* s, uint32 key1, uint32 key2) +void rdp_write_persistent_list_entry(STREAM* s, UINT32 key1, UINT32 key2) { - stream_write_uint32(s, key1); /* key1 (4 bytes) */ - stream_write_uint32(s, key2); /* key2 (4 bytes) */ + stream_write_UINT32(s, key1); /* key1 (4 bytes) */ + stream_write_UINT32(s, key2); /* key2 (4 bytes) */ } void rdp_write_client_persistent_key_list_pdu(STREAM* s, rdpSettings* settings) { - stream_write_uint16(s, 0); /* numEntriesCache0 (2 bytes) */ - stream_write_uint16(s, 0); /* numEntriesCache1 (2 bytes) */ - stream_write_uint16(s, 0); /* numEntriesCache2 (2 bytes) */ - stream_write_uint16(s, 0); /* numEntriesCache3 (2 bytes) */ - stream_write_uint16(s, 0); /* numEntriesCache4 (2 bytes) */ - stream_write_uint16(s, 0); /* totalEntriesCache0 (2 bytes) */ - stream_write_uint16(s, 0); /* totalEntriesCache1 (2 bytes) */ - stream_write_uint16(s, 0); /* totalEntriesCache2 (2 bytes) */ - stream_write_uint16(s, 0); /* totalEntriesCache3 (2 bytes) */ - stream_write_uint16(s, 0); /* totalEntriesCache4 (2 bytes) */ - stream_write_uint8(s, PERSIST_FIRST_PDU | PERSIST_LAST_PDU); /* bBitMask (1 byte) */ - stream_write_uint8(s, 0); /* pad1 (1 byte) */ - stream_write_uint16(s, 0); /* pad3 (2 bytes) */ + stream_write_UINT16(s, 0); /* numEntriesCache0 (2 bytes) */ + stream_write_UINT16(s, 0); /* numEntriesCache1 (2 bytes) */ + stream_write_UINT16(s, 0); /* numEntriesCache2 (2 bytes) */ + stream_write_UINT16(s, 0); /* numEntriesCache3 (2 bytes) */ + stream_write_UINT16(s, 0); /* numEntriesCache4 (2 bytes) */ + stream_write_UINT16(s, 0); /* totalEntriesCache0 (2 bytes) */ + stream_write_UINT16(s, 0); /* totalEntriesCache1 (2 bytes) */ + stream_write_UINT16(s, 0); /* totalEntriesCache2 (2 bytes) */ + stream_write_UINT16(s, 0); /* totalEntriesCache3 (2 bytes) */ + stream_write_UINT16(s, 0); /* totalEntriesCache4 (2 bytes) */ + stream_write_BYTE(s, PERSIST_FIRST_PDU | PERSIST_LAST_PDU); /* bBitMask (1 byte) */ + stream_write_BYTE(s, 0); /* pad1 (1 byte) */ + stream_write_UINT16(s, 0); /* pad3 (2 bytes) */ /* entries */ } -boolean rdp_send_client_persistent_key_list_pdu(rdpRdp* rdp) +BOOL rdp_send_client_persistent_key_list_pdu(rdpRdp* rdp) { STREAM* s; @@ -211,23 +211,23 @@ boolean rdp_send_client_persistent_key_list_pdu(rdpRdp* rdp) return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_BITMAP_CACHE_PERSISTENT_LIST, rdp->mcs->user_id); } -boolean rdp_recv_client_font_list_pdu(STREAM* s) +BOOL rdp_recv_client_font_list_pdu(STREAM* s) { if (stream_get_left(s) < 8) - return false; + return FALSE; - return true; + return TRUE; } -void rdp_write_client_font_list_pdu(STREAM* s, uint16 flags) +void rdp_write_client_font_list_pdu(STREAM* s, UINT16 flags) { - stream_write_uint16(s, 0); /* numberFonts (2 bytes) */ - stream_write_uint16(s, 0); /* totalNumFonts (2 bytes) */ - stream_write_uint16(s, flags); /* listFlags (2 bytes) */ - stream_write_uint16(s, 50); /* entrySize (2 bytes) */ + stream_write_UINT16(s, 0); /* numberFonts (2 bytes) */ + stream_write_UINT16(s, 0); /* totalNumFonts (2 bytes) */ + stream_write_UINT16(s, flags); /* listFlags (2 bytes) */ + stream_write_UINT16(s, 50); /* entrySize (2 bytes) */ } -boolean rdp_send_client_font_list_pdu(rdpRdp* rdp, uint16 flags) +BOOL rdp_send_client_font_list_pdu(rdpRdp* rdp, UINT16 flags) { STREAM* s; @@ -237,7 +237,7 @@ boolean rdp_send_client_font_list_pdu(rdpRdp* rdp, uint16 flags) return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FONT_LIST, rdp->mcs->user_id); } -boolean rdp_recv_font_map_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_font_map_pdu(rdpRdp* rdp, STREAM* s) { if (rdp->settings->server_mode) return rdp_recv_server_font_map_pdu(rdp, s); @@ -245,41 +245,41 @@ boolean rdp_recv_font_map_pdu(rdpRdp* rdp, STREAM* s) return rdp_recv_client_font_map_pdu(rdp, s); } -boolean rdp_recv_server_font_map_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_server_font_map_pdu(rdpRdp* rdp, STREAM* s) { rdp->finalize_sc_pdus |= FINALIZE_SC_FONT_MAP_PDU; - return true; + return TRUE; } -boolean rdp_recv_client_font_map_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_client_font_map_pdu(rdpRdp* rdp, STREAM* s) { rdp->finalize_sc_pdus |= FINALIZE_SC_FONT_MAP_PDU; - stream_seek_uint16(s); /* numberEntries (2 bytes) */ - stream_seek_uint16(s); /* totalNumEntries (2 bytes) */ - stream_seek_uint16(s); /* mapFlags (2 bytes) */ - stream_seek_uint16(s); /* entrySize (2 bytes) */ + stream_seek_UINT16(s); /* numberEntries (2 bytes) */ + stream_seek_UINT16(s); /* totalNumEntries (2 bytes) */ + stream_seek_UINT16(s); /* mapFlags (2 bytes) */ + stream_seek_UINT16(s); /* entrySize (2 bytes) */ - return true; + return TRUE; } -boolean rdp_send_server_font_map_pdu(rdpRdp* rdp) +BOOL rdp_send_server_font_map_pdu(rdpRdp* rdp) { STREAM* s; s = rdp_data_pdu_init(rdp); - stream_write_uint16(s, 0); /* numberEntries (2 bytes) */ - stream_write_uint16(s, 0); /* totalNumEntries (2 bytes) */ - stream_write_uint16(s, FONTLIST_FIRST | FONTLIST_LAST); /* mapFlags (2 bytes) */ - stream_write_uint16(s, 4); /* entrySize (2 bytes) */ + stream_write_UINT16(s, 0); /* numberEntries (2 bytes) */ + stream_write_UINT16(s, 0); /* totalNumEntries (2 bytes) */ + stream_write_UINT16(s, FONTLIST_FIRST | FONTLIST_LAST); /* mapFlags (2 bytes) */ + stream_write_UINT16(s, 4); /* entrySize (2 bytes) */ return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FONT_MAP, rdp->mcs->user_id); } -boolean rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s) { - uint16 lengthSourceDescriptor; + UINT16 lengthSourceDescriptor; /* * Windows XP can send short DEACTIVATE_ALL PDU that doesn't contain @@ -287,8 +287,8 @@ boolean rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s) */ if (stream_get_left(s) > 0) { - stream_read_uint32(s, rdp->settings->share_id); /* shareId (4 bytes) */ - stream_read_uint16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */ + stream_read_UINT32(s, rdp->settings->share_id); /* shareId (4 bytes) */ + stream_read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */ stream_seek(s, lengthSourceDescriptor); /* sourceDescriptor (should be 0x00) */ } @@ -297,48 +297,48 @@ boolean rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s) while (rdp->state != CONNECTION_STATE_ACTIVE) { if (rdp_check_fds(rdp) < 0) - return false; + return FALSE; if (rdp->disconnect) break; } - return true; + return TRUE; } -boolean rdp_send_deactivate_all(rdpRdp* rdp) +BOOL rdp_send_deactivate_all(rdpRdp* rdp) { STREAM* s; s = rdp_pdu_init(rdp); - stream_write_uint32(s, rdp->settings->share_id); /* shareId (4 bytes) */ - stream_write_uint16(s, 1); /* lengthSourceDescriptor (2 bytes) */ - stream_write_uint8(s, 0); /* sourceDescriptor (should be 0x00) */ + stream_write_UINT32(s, rdp->settings->share_id); /* shareId (4 bytes) */ + stream_write_UINT16(s, 1); /* lengthSourceDescriptor (2 bytes) */ + stream_write_BYTE(s, 0); /* sourceDescriptor (should be 0x00) */ return rdp_send_pdu(rdp, s, PDU_TYPE_DEACTIVATE_ALL, rdp->mcs->user_id); } -boolean rdp_server_accept_client_control_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_client_control_pdu(rdpRdp* rdp, STREAM* s) { - uint16 action; + UINT16 action; if (!rdp_recv_control_pdu(s, &action)) - return false; + return FALSE; if (action == CTRLACTION_REQUEST_CONTROL) { if (!rdp_send_server_control_granted_pdu(rdp)) - return false; + return FALSE; } - return true; + return TRUE; } -boolean rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, STREAM* s) { if (!rdp_recv_client_font_list_pdu(s)) - return false; + return FALSE; if (!rdp_send_server_font_map_pdu(rdp)) - return false; + return FALSE; - return true; + return TRUE; } diff --git a/libfreerdp/core/activation.h b/libfreerdp/core/activation.h index 25891711a..0a231359e 100644 --- a/libfreerdp/core/activation.h +++ b/libfreerdp/core/activation.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Activation Sequence * * Copyright 2011 Marc-Andre Moreau @@ -38,28 +38,28 @@ #define FONTLIST_FIRST 0x0001 #define FONTLIST_LAST 0x0002 -boolean rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s); -boolean rdp_send_deactivate_all(rdpRdp* rdp); +BOOL rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_deactivate_all(rdpRdp* rdp); -boolean rdp_recv_synchronize_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_recv_server_synchronize_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_send_server_synchronize_pdu(rdpRdp* rdp); -boolean rdp_recv_client_synchronize_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_send_client_synchronize_pdu(rdpRdp* rdp); -boolean rdp_recv_control_pdu(STREAM* s, uint16* action); -boolean rdp_recv_server_control_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_send_server_control_cooperate_pdu(rdpRdp* rdp); -boolean rdp_send_server_control_granted_pdu(rdpRdp* rdp); -boolean rdp_send_client_control_pdu(rdpRdp* rdp, uint16 action); -boolean rdp_send_client_persistent_key_list_pdu(rdpRdp* rdp); -boolean rdp_recv_client_font_list_pdu(STREAM* s); -boolean rdp_send_client_font_list_pdu(rdpRdp* rdp, uint16 flags); -boolean rdp_recv_font_map_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_recv_server_font_map_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_recv_client_font_map_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_send_server_font_map_pdu(rdpRdp* rdp); +BOOL rdp_recv_synchronize_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_server_synchronize_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_server_synchronize_pdu(rdpRdp* rdp); +BOOL rdp_recv_client_synchronize_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_client_synchronize_pdu(rdpRdp* rdp); +BOOL rdp_recv_control_pdu(STREAM* s, UINT16* action); +BOOL rdp_recv_server_control_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_server_control_cooperate_pdu(rdpRdp* rdp); +BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp); +BOOL rdp_send_client_control_pdu(rdpRdp* rdp, UINT16 action); +BOOL rdp_send_client_persistent_key_list_pdu(rdpRdp* rdp); +BOOL rdp_recv_client_font_list_pdu(STREAM* s); +BOOL rdp_send_client_font_list_pdu(rdpRdp* rdp, UINT16 flags); +BOOL rdp_recv_font_map_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_server_font_map_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_client_font_map_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_server_font_map_pdu(rdpRdp* rdp); -boolean rdp_server_accept_client_control_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_client_control_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, STREAM* s); #endif /* __ACTIVATION_H */ diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 87350044b..9da8c7de4 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Capability Sets * * Copyright 2011 Marc-Andre Moreau @@ -69,21 +69,21 @@ static const char* const CAPSET_TYPE_STRINGS[] = /* CODEC_GUID_JPEG 0x430C9EED1BAF4CE6869ACB8B37B66237*/ #define CODEC_GUID_JPEG "\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37" -void rdp_read_capability_set_header(STREAM* s, uint16* length, uint16* type) +void rdp_read_capability_set_header(STREAM* s, UINT16* length, UINT16* type) { - stream_read_uint16(s, *type); /* capabilitySetType */ - stream_read_uint16(s, *length); /* lengthCapability */ + stream_read_UINT16(s, *type); /* capabilitySetType */ + stream_read_UINT16(s, *length); /* lengthCapability */ } -void rdp_write_capability_set_header(STREAM* s, uint16 length, uint16 type) +void rdp_write_capability_set_header(STREAM* s, UINT16 length, UINT16 type) { - stream_write_uint16(s, type); /* capabilitySetType */ - stream_write_uint16(s, length); /* lengthCapability */ + stream_write_UINT16(s, type); /* capabilitySetType */ + stream_write_UINT16(s, length); /* lengthCapability */ } -uint8* rdp_capability_set_start(STREAM* s) +BYTE* rdp_capability_set_start(STREAM* s) { - uint8* header; + BYTE* header; stream_get_mark(s, header); stream_write_zero(s, CAPSET_HEADER_LENGTH); @@ -91,10 +91,10 @@ uint8* rdp_capability_set_start(STREAM* s) return header; } -void rdp_capability_set_finish(STREAM* s, uint8* header, uint16 type) +void rdp_capability_set_finish(STREAM* s, BYTE* header, UINT16 type) { - uint16 length; - uint8* footer; + UINT16 length; + BYTE* footer; footer = s->p; length = footer - header; @@ -111,40 +111,40 @@ void rdp_capability_set_finish(STREAM* s, uint8* header, uint16 type) * @param settings settings */ -void rdp_read_general_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_general_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint16 extraFlags; - uint8 refreshRectSupport; - uint8 suppressOutputSupport; + UINT16 extraFlags; + BYTE refreshRectSupport; + BYTE suppressOutputSupport; if (settings->server_mode) { - stream_read_uint16(s, settings->os_major_type); /* osMajorType (2 bytes) */ - stream_read_uint16(s, settings->os_minor_type); /* osMinorType (2 bytes) */ + stream_read_UINT16(s, settings->os_major_type); /* osMajorType (2 bytes) */ + stream_read_UINT16(s, settings->os_minor_type); /* osMinorType (2 bytes) */ } else { - stream_seek_uint16(s); /* osMajorType (2 bytes) */ - stream_seek_uint16(s); /* osMinorType (2 bytes) */ + stream_seek_UINT16(s); /* osMajorType (2 bytes) */ + stream_seek_UINT16(s); /* osMinorType (2 bytes) */ } - stream_seek_uint16(s); /* protocolVersion (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsA (2 bytes) */ - stream_seek_uint16(s); /* generalCompressionTypes (2 bytes) */ - stream_read_uint16(s, extraFlags); /* extraFlags (2 bytes) */ - stream_seek_uint16(s); /* updateCapabilityFlag (2 bytes) */ - stream_seek_uint16(s); /* remoteUnshareFlag (2 bytes) */ - stream_seek_uint16(s); /* generalCompressionLevel (2 bytes) */ - stream_read_uint8(s, refreshRectSupport); /* refreshRectSupport (1 byte) */ - stream_read_uint8(s, suppressOutputSupport); /* suppressOutputSupport (1 byte) */ + stream_seek_UINT16(s); /* protocolVersion (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsA (2 bytes) */ + stream_seek_UINT16(s); /* generalCompressionTypes (2 bytes) */ + stream_read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */ + stream_seek_UINT16(s); /* updateCapabilityFlag (2 bytes) */ + stream_seek_UINT16(s); /* remoteUnshareFlag (2 bytes) */ + stream_seek_UINT16(s); /* generalCompressionLevel (2 bytes) */ + stream_read_BYTE(s, refreshRectSupport); /* refreshRectSupport (1 byte) */ + stream_read_BYTE(s, suppressOutputSupport); /* suppressOutputSupport (1 byte) */ if (!(extraFlags & FASTPATH_OUTPUT_SUPPORTED)) - settings->fastpath_output = false; + settings->fastpath_output = FALSE; - if (refreshRectSupport == false) - settings->refresh_rect = false; + if (refreshRectSupport == FALSE) + settings->refresh_rect = FALSE; - if (suppressOutputSupport == false) - settings->suppress_output = false; + if (suppressOutputSupport == FALSE) + settings->suppress_output = FALSE; } /** @@ -156,8 +156,8 @@ void rdp_read_general_capability_set(STREAM* s, uint16 length, rdpSettings* sett void rdp_write_general_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 extraFlags; + BYTE* header; + UINT16 extraFlags; header = rdp_capability_set_start(s); @@ -172,17 +172,17 @@ void rdp_write_general_capability_set(STREAM* s, rdpSettings* settings) if (settings->salted_checksum) extraFlags |= ENC_SALTED_CHECKSUM; - stream_write_uint16(s, settings->os_major_type); /* osMajorType (2 bytes) */ - stream_write_uint16(s, settings->os_minor_type); /* osMinorType (2 bytes) */ - stream_write_uint16(s, CAPS_PROTOCOL_VERSION); /* protocolVersion (2 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsA (2 bytes) */ - stream_write_uint16(s, 0); /* generalCompressionTypes (2 bytes) */ - stream_write_uint16(s, extraFlags); /* extraFlags (2 bytes) */ - stream_write_uint16(s, 0); /* updateCapabilityFlag (2 bytes) */ - stream_write_uint16(s, 0); /* remoteUnshareFlag (2 bytes) */ - stream_write_uint16(s, 0); /* generalCompressionLevel (2 bytes) */ - stream_write_uint8(s, settings->refresh_rect); /* refreshRectSupport (1 byte) */ - stream_write_uint8(s, settings->suppress_output); /* suppressOutputSupport (1 byte) */ + stream_write_UINT16(s, settings->os_major_type); /* osMajorType (2 bytes) */ + stream_write_UINT16(s, settings->os_minor_type); /* osMinorType (2 bytes) */ + stream_write_UINT16(s, CAPS_PROTOCOL_VERSION); /* protocolVersion (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */ + stream_write_UINT16(s, 0); /* generalCompressionTypes (2 bytes) */ + stream_write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */ + stream_write_UINT16(s, 0); /* updateCapabilityFlag (2 bytes) */ + stream_write_UINT16(s, 0); /* remoteUnshareFlag (2 bytes) */ + stream_write_UINT16(s, 0); /* generalCompressionLevel (2 bytes) */ + stream_write_BYTE(s, settings->refresh_rect); /* refreshRectSupport (1 byte) */ + stream_write_BYTE(s, settings->suppress_output); /* suppressOutputSupport (1 byte) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_GENERAL); } @@ -194,27 +194,27 @@ void rdp_write_general_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_bitmap_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_bitmap_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint8 drawingFlags; - uint16 desktopWidth; - uint16 desktopHeight; - uint16 desktopResizeFlag; - uint16 preferredBitsPerPixel; + BYTE drawingFlags; + UINT16 desktopWidth; + UINT16 desktopHeight; + UINT16 desktopResizeFlag; + UINT16 preferredBitsPerPixel; - stream_read_uint16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */ - stream_seek_uint16(s); /* receive1BitPerPixel (2 bytes) */ - stream_seek_uint16(s); /* receive4BitsPerPixel (2 bytes) */ - stream_seek_uint16(s); /* receive8BitsPerPixel (2 bytes) */ - stream_read_uint16(s, desktopWidth); /* desktopWidth (2 bytes) */ - stream_read_uint16(s, desktopHeight); /* desktopHeight (2 bytes) */ - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ - stream_read_uint16(s, desktopResizeFlag); /* desktopResizeFlag (2 bytes) */ - stream_seek_uint16(s); /* bitmapCompressionFlag (2 bytes) */ - stream_seek_uint8(s); /* highColorFlags (1 byte) */ - stream_read_uint8(s, drawingFlags); /* drawingFlags (1 byte) */ - stream_seek_uint16(s); /* multipleRectangleSupport (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsB (2 bytes) */ + stream_read_UINT16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */ + stream_seek_UINT16(s); /* receive1BitPerPixel (2 bytes) */ + stream_seek_UINT16(s); /* receive4BitsPerPixel (2 bytes) */ + stream_seek_UINT16(s); /* receive8BitsPerPixel (2 bytes) */ + stream_read_UINT16(s, desktopWidth); /* desktopWidth (2 bytes) */ + stream_read_UINT16(s, desktopHeight); /* desktopHeight (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ + stream_read_UINT16(s, desktopResizeFlag); /* desktopResizeFlag (2 bytes) */ + stream_seek_UINT16(s); /* bitmapCompressionFlag (2 bytes) */ + stream_seek_BYTE(s); /* highColorFlags (1 byte) */ + stream_read_BYTE(s, drawingFlags); /* drawingFlags (1 byte) */ + stream_seek_UINT16(s); /* multipleRectangleSupport (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsB (2 bytes) */ if (!settings->server_mode && preferredBitsPerPixel != settings->color_depth) { @@ -222,8 +222,8 @@ void rdp_read_bitmap_capability_set(STREAM* s, uint16 length, rdpSettings* setti settings->color_depth = preferredBitsPerPixel; } - if (desktopResizeFlag == false) - settings->desktop_resize = false; + if (desktopResizeFlag == FALSE) + settings->desktop_resize = FALSE; if (!settings->server_mode && settings->desktop_resize) { @@ -242,10 +242,10 @@ void rdp_read_bitmap_capability_set(STREAM* s, uint16 length, rdpSettings* setti void rdp_write_bitmap_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint8 drawingFlags = 0; - uint16 desktopResizeFlag; - uint16 preferredBitsPerPixel; + BYTE* header; + BYTE drawingFlags = 0; + UINT16 desktopResizeFlag; + UINT16 preferredBitsPerPixel; header = rdp_capability_set_start(s); @@ -258,19 +258,19 @@ void rdp_write_bitmap_capability_set(STREAM* s, rdpSettings* settings) desktopResizeFlag = settings->desktop_resize; - stream_write_uint16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */ - stream_write_uint16(s, 1); /* receive1BitPerPixel (2 bytes) */ - stream_write_uint16(s, 1); /* receive4BitsPerPixel (2 bytes) */ - stream_write_uint16(s, 1); /* receive8BitsPerPixel (2 bytes) */ - stream_write_uint16(s, settings->width); /* desktopWidth (2 bytes) */ - stream_write_uint16(s, settings->height); /* desktopHeight (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ - stream_write_uint16(s, desktopResizeFlag); /* desktopResizeFlag (2 bytes) */ - stream_write_uint16(s, 1); /* bitmapCompressionFlag (2 bytes) */ - stream_write_uint8(s, 0); /* highColorFlags (1 byte) */ - stream_write_uint8(s, drawingFlags); /* drawingFlags (1 byte) */ - stream_write_uint16(s, 1); /* multipleRectangleSupport (2 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsB (2 bytes) */ + stream_write_UINT16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */ + stream_write_UINT16(s, 1); /* receive1BitPerPixel (2 bytes) */ + stream_write_UINT16(s, 1); /* receive4BitsPerPixel (2 bytes) */ + stream_write_UINT16(s, 1); /* receive8BitsPerPixel (2 bytes) */ + stream_write_UINT16(s, settings->width); /* desktopWidth (2 bytes) */ + stream_write_UINT16(s, settings->height); /* desktopHeight (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, desktopResizeFlag); /* desktopResizeFlag (2 bytes) */ + stream_write_UINT16(s, 1); /* bitmapCompressionFlag (2 bytes) */ + stream_write_BYTE(s, 0); /* highColorFlags (1 byte) */ + stream_write_BYTE(s, drawingFlags); /* drawingFlags (1 byte) */ + stream_write_UINT16(s, 1); /* multipleRectangleSupport (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsB (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP); } @@ -282,35 +282,35 @@ void rdp_write_bitmap_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_order_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_order_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { int i; - uint16 orderFlags; - uint8 orderSupport[32]; - uint16 orderSupportExFlags; + UINT16 orderFlags; + BYTE orderSupport[32]; + UINT16 orderSupportExFlags; stream_seek(s, 16); /* terminalDescriptor (16 bytes) */ - stream_seek_uint32(s); /* pad4OctetsA (4 bytes) */ - stream_seek_uint16(s); /* desktopSaveXGranularity (2 bytes) */ - stream_seek_uint16(s); /* desktopSaveYGranularity (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsA (2 bytes) */ - stream_seek_uint16(s); /* maximumOrderLevel (2 bytes) */ - stream_seek_uint16(s); /* numberFonts (2 bytes) */ - stream_read_uint16(s, orderFlags); /* orderFlags (2 bytes) */ + stream_seek_UINT32(s); /* pad4OctetsA (4 bytes) */ + stream_seek_UINT16(s); /* desktopSaveXGranularity (2 bytes) */ + stream_seek_UINT16(s); /* desktopSaveYGranularity (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsA (2 bytes) */ + stream_seek_UINT16(s); /* maximumOrderLevel (2 bytes) */ + stream_seek_UINT16(s); /* numberFonts (2 bytes) */ + stream_read_UINT16(s, orderFlags); /* orderFlags (2 bytes) */ stream_read(s, orderSupport, 32); /* orderSupport (32 bytes) */ - stream_seek_uint16(s); /* textFlags (2 bytes) */ - stream_read_uint16(s, orderSupportExFlags); /* orderSupportExFlags (2 bytes) */ - stream_seek_uint32(s); /* pad4OctetsB (4 bytes) */ - stream_seek_uint32(s); /* desktopSaveSize (4 bytes) */ - stream_seek_uint16(s); /* pad2OctetsC (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsD (2 bytes) */ - stream_seek_uint16(s); /* textANSICodePage (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsE (2 bytes) */ + stream_seek_UINT16(s); /* textFlags (2 bytes) */ + stream_read_UINT16(s, orderSupportExFlags); /* orderSupportExFlags (2 bytes) */ + stream_seek_UINT32(s); /* pad4OctetsB (4 bytes) */ + stream_seek_UINT32(s); /* desktopSaveSize (4 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsC (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsD (2 bytes) */ + stream_seek_UINT16(s); /* textANSICodePage (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsE (2 bytes) */ for (i = 0; i < 32; i++) { - if (orderSupport[i] == false) - settings->order_support[i] = false; + if (orderSupport[i] == FALSE) + settings->order_support[i] = FALSE; } } @@ -323,10 +323,10 @@ void rdp_read_order_capability_set(STREAM* s, uint16 length, rdpSettings* settin void rdp_write_order_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 orderFlags; - uint16 orderSupportExFlags; - uint16 textANSICodePage; + BYTE* header; + UINT16 orderFlags; + UINT16 orderSupportExFlags; + UINT16 textANSICodePage; header = rdp_capability_set_start(s); @@ -349,22 +349,22 @@ void rdp_write_order_capability_set(STREAM* s, rdpSettings* settings) } stream_write_zero(s, 16); /* terminalDescriptor (16 bytes) */ - stream_write_uint32(s, 0); /* pad4OctetsA (4 bytes) */ - stream_write_uint16(s, 1); /* desktopSaveXGranularity (2 bytes) */ - stream_write_uint16(s, 20); /* desktopSaveYGranularity (2 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsA (2 bytes) */ - stream_write_uint16(s, 1); /* maximumOrderLevel (2 bytes) */ - stream_write_uint16(s, 0); /* numberFonts (2 bytes) */ - stream_write_uint16(s, orderFlags); /* orderFlags (2 bytes) */ + stream_write_UINT32(s, 0); /* pad4OctetsA (4 bytes) */ + stream_write_UINT16(s, 1); /* desktopSaveXGranularity (2 bytes) */ + stream_write_UINT16(s, 20); /* desktopSaveYGranularity (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */ + stream_write_UINT16(s, 1); /* maximumOrderLevel (2 bytes) */ + stream_write_UINT16(s, 0); /* numberFonts (2 bytes) */ + stream_write_UINT16(s, orderFlags); /* orderFlags (2 bytes) */ stream_write(s, settings->order_support, 32); /* orderSupport (32 bytes) */ - stream_write_uint16(s, 0); /* textFlags (2 bytes) */ - stream_write_uint16(s, orderSupportExFlags); /* orderSupportExFlags (2 bytes) */ - stream_write_uint32(s, 0); /* pad4OctetsB (4 bytes) */ - stream_write_uint32(s, 230400); /* desktopSaveSize (4 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsC (2 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsD (2 bytes) */ - stream_write_uint16(s, 0); /* textANSICodePage (2 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsE (2 bytes) */ + stream_write_UINT16(s, 0); /* textFlags (2 bytes) */ + stream_write_UINT16(s, orderSupportExFlags); /* orderSupportExFlags (2 bytes) */ + stream_write_UINT32(s, 0); /* pad4OctetsB (4 bytes) */ + stream_write_UINT32(s, 230400); /* desktopSaveSize (4 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsC (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsD (2 bytes) */ + stream_write_UINT16(s, 0); /* textANSICodePage (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsE (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_ORDER); } @@ -376,20 +376,20 @@ void rdp_write_order_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_bitmap_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_bitmap_cache_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint32(s); /* pad1 (4 bytes) */ - stream_seek_uint32(s); /* pad2 (4 bytes) */ - stream_seek_uint32(s); /* pad3 (4 bytes) */ - stream_seek_uint32(s); /* pad4 (4 bytes) */ - stream_seek_uint32(s); /* pad5 (4 bytes) */ - stream_seek_uint32(s); /* pad6 (4 bytes) */ - stream_seek_uint16(s); /* Cache0Entries (2 bytes) */ - stream_seek_uint16(s); /* Cache0MaximumCellSize (2 bytes) */ - stream_seek_uint16(s); /* Cache1Entries (2 bytes) */ - stream_seek_uint16(s); /* Cache1MaximumCellSize (2 bytes) */ - stream_seek_uint16(s); /* Cache2Entries (2 bytes) */ - stream_seek_uint16(s); /* Cache2MaximumCellSize (2 bytes) */ + stream_seek_UINT32(s); /* pad1 (4 bytes) */ + stream_seek_UINT32(s); /* pad2 (4 bytes) */ + stream_seek_UINT32(s); /* pad3 (4 bytes) */ + stream_seek_UINT32(s); /* pad4 (4 bytes) */ + stream_seek_UINT32(s); /* pad5 (4 bytes) */ + stream_seek_UINT32(s); /* pad6 (4 bytes) */ + stream_seek_UINT16(s); /* Cache0Entries (2 bytes) */ + stream_seek_UINT16(s); /* Cache0MaximumCellSize (2 bytes) */ + stream_seek_UINT16(s); /* Cache1Entries (2 bytes) */ + stream_seek_UINT16(s); /* Cache1MaximumCellSize (2 bytes) */ + stream_seek_UINT16(s); /* Cache2Entries (2 bytes) */ + stream_seek_UINT16(s); /* Cache2MaximumCellSize (2 bytes) */ } /** @@ -402,31 +402,31 @@ void rdp_read_bitmap_cache_capability_set(STREAM* s, uint16 length, rdpSettings* void rdp_write_bitmap_cache_capability_set(STREAM* s, rdpSettings* settings) { int bpp; - uint16 size; - uint8* header; + UINT16 size; + BYTE* header; header = rdp_capability_set_start(s); bpp = (settings->color_depth + 7) / 8; - stream_write_uint32(s, 0); /* pad1 (4 bytes) */ - stream_write_uint32(s, 0); /* pad2 (4 bytes) */ - stream_write_uint32(s, 0); /* pad3 (4 bytes) */ - stream_write_uint32(s, 0); /* pad4 (4 bytes) */ - stream_write_uint32(s, 0); /* pad5 (4 bytes) */ - stream_write_uint32(s, 0); /* pad6 (4 bytes) */ + stream_write_UINT32(s, 0); /* pad1 (4 bytes) */ + stream_write_UINT32(s, 0); /* pad2 (4 bytes) */ + stream_write_UINT32(s, 0); /* pad3 (4 bytes) */ + stream_write_UINT32(s, 0); /* pad4 (4 bytes) */ + stream_write_UINT32(s, 0); /* pad5 (4 bytes) */ + stream_write_UINT32(s, 0); /* pad6 (4 bytes) */ size = bpp * 256; - stream_write_uint16(s, 200); /* Cache0Entries (2 bytes) */ - stream_write_uint16(s, size); /* Cache0MaximumCellSize (2 bytes) */ + stream_write_UINT16(s, 200); /* Cache0Entries (2 bytes) */ + stream_write_UINT16(s, size); /* Cache0MaximumCellSize (2 bytes) */ size = bpp * 1024; - stream_write_uint16(s, 600); /* Cache1Entries (2 bytes) */ - stream_write_uint16(s, size); /* Cache1MaximumCellSize (2 bytes) */ + stream_write_UINT16(s, 600); /* Cache1Entries (2 bytes) */ + stream_write_UINT16(s, size); /* Cache1MaximumCellSize (2 bytes) */ size = bpp * 4096; - stream_write_uint16(s, 1000); /* Cache2Entries (2 bytes) */ - stream_write_uint16(s, size); /* Cache2MaximumCellSize (2 bytes) */ + stream_write_UINT16(s, 1000); /* Cache2Entries (2 bytes) */ + stream_write_UINT16(s, size); /* Cache2MaximumCellSize (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CACHE); } @@ -438,12 +438,12 @@ void rdp_write_bitmap_cache_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_control_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_control_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint16(s); /* controlFlags (2 bytes) */ - stream_seek_uint16(s); /* remoteDetachFlag (2 bytes) */ - stream_seek_uint16(s); /* controlInterest (2 bytes) */ - stream_seek_uint16(s); /* detachInterest (2 bytes) */ + stream_seek_UINT16(s); /* controlFlags (2 bytes) */ + stream_seek_UINT16(s); /* remoteDetachFlag (2 bytes) */ + stream_seek_UINT16(s); /* controlInterest (2 bytes) */ + stream_seek_UINT16(s); /* detachInterest (2 bytes) */ } /** @@ -455,14 +455,14 @@ void rdp_read_control_capability_set(STREAM* s, uint16 length, rdpSettings* sett void rdp_write_control_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint16(s, 0); /* controlFlags (2 bytes) */ - stream_write_uint16(s, 0); /* remoteDetachFlag (2 bytes) */ - stream_write_uint16(s, 2); /* controlInterest (2 bytes) */ - stream_write_uint16(s, 2); /* detachInterest (2 bytes) */ + stream_write_UINT16(s, 0); /* controlFlags (2 bytes) */ + stream_write_UINT16(s, 0); /* remoteDetachFlag (2 bytes) */ + stream_write_UINT16(s, 2); /* controlInterest (2 bytes) */ + stream_write_UINT16(s, 2); /* detachInterest (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_CONTROL); } @@ -474,12 +474,12 @@ void rdp_write_control_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_window_activation_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_window_activation_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint16(s); /* helpKeyFlag (2 bytes) */ - stream_seek_uint16(s); /* helpKeyIndexFlag (2 bytes) */ - stream_seek_uint16(s); /* helpExtendedKeyFlag (2 bytes) */ - stream_seek_uint16(s); /* windowManagerKeyFlag (2 bytes) */ + stream_seek_UINT16(s); /* helpKeyFlag (2 bytes) */ + stream_seek_UINT16(s); /* helpKeyIndexFlag (2 bytes) */ + stream_seek_UINT16(s); /* helpExtendedKeyFlag (2 bytes) */ + stream_seek_UINT16(s); /* windowManagerKeyFlag (2 bytes) */ } /** @@ -491,14 +491,14 @@ void rdp_read_window_activation_capability_set(STREAM* s, uint16 length, rdpSett void rdp_write_window_activation_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint16(s, 0); /* helpKeyFlag (2 bytes) */ - stream_write_uint16(s, 0); /* helpKeyIndexFlag (2 bytes) */ - stream_write_uint16(s, 0); /* helpExtendedKeyFlag (2 bytes) */ - stream_write_uint16(s, 0); /* windowManagerKeyFlag (2 bytes) */ + stream_write_UINT16(s, 0); /* helpKeyFlag (2 bytes) */ + stream_write_UINT16(s, 0); /* helpKeyIndexFlag (2 bytes) */ + stream_write_UINT16(s, 0); /* helpExtendedKeyFlag (2 bytes) */ + stream_write_UINT16(s, 0); /* windowManagerKeyFlag (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_ACTIVATION); } @@ -510,18 +510,18 @@ void rdp_write_window_activation_capability_set(STREAM* s, rdpSettings* settings * @param settings settings */ -void rdp_read_pointer_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_pointer_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint16 colorPointerFlag; - uint16 colorPointerCacheSize; - uint16 pointerCacheSize; + UINT16 colorPointerFlag; + UINT16 colorPointerCacheSize; + UINT16 pointerCacheSize; - stream_read_uint16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */ - stream_read_uint16(s, colorPointerCacheSize); /* colorPointerCacheSize (2 bytes) */ - stream_read_uint16(s, pointerCacheSize); /* pointerCacheSize (2 bytes) */ + stream_read_UINT16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */ + stream_read_UINT16(s, colorPointerCacheSize); /* colorPointerCacheSize (2 bytes) */ + stream_read_UINT16(s, pointerCacheSize); /* pointerCacheSize (2 bytes) */ - if (colorPointerFlag == false) - settings->color_pointer = false; + if (colorPointerFlag == FALSE) + settings->color_pointer = FALSE; if (settings->server_mode) { @@ -538,19 +538,19 @@ void rdp_read_pointer_capability_set(STREAM* s, uint16 length, rdpSettings* sett void rdp_write_pointer_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 colorPointerFlag; + BYTE* header; + UINT16 colorPointerFlag; header = rdp_capability_set_start(s); colorPointerFlag = (settings->color_pointer) ? 1 : 0; - stream_write_uint16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */ - stream_write_uint16(s, settings->pointer_cache_size); /* colorPointerCacheSize (2 bytes) */ + stream_write_UINT16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */ + stream_write_UINT16(s, settings->pointer_cache_size); /* colorPointerCacheSize (2 bytes) */ if (settings->large_pointer) { - stream_write_uint16(s, settings->pointer_cache_size); /* pointerCacheSize (2 bytes) */ + stream_write_UINT16(s, settings->pointer_cache_size); /* pointerCacheSize (2 bytes) */ } rdp_capability_set_finish(s, header, CAPSET_TYPE_POINTER); @@ -563,10 +563,10 @@ void rdp_write_pointer_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_share_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_share_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint16(s); /* nodeId (2 bytes) */ - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + stream_seek_UINT16(s); /* nodeId (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ } /** @@ -578,15 +578,15 @@ void rdp_read_share_capability_set(STREAM* s, uint16 length, rdpSettings* settin void rdp_write_share_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 nodeId; + BYTE* header; + UINT16 nodeId; header = rdp_capability_set_start(s); nodeId = (settings->server_mode) ? 0x03EA : 0; - stream_write_uint16(s, nodeId); /* nodeId (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, nodeId); /* nodeId (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_SHARE); } @@ -598,10 +598,10 @@ void rdp_write_share_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_color_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_color_cache_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint16(s); /* colorTableCacheSize (2 bytes) */ - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + stream_seek_UINT16(s); /* colorTableCacheSize (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ } /** @@ -613,12 +613,12 @@ void rdp_read_color_cache_capability_set(STREAM* s, uint16 length, rdpSettings* void rdp_write_color_cache_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint16(s, 6); /* colorTableCacheSize (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, 6); /* colorTableCacheSize (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_COLOR_CACHE); } @@ -630,14 +630,14 @@ void rdp_write_color_cache_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_sound_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_sound_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint16 soundFlags; + UINT16 soundFlags; - stream_read_uint16(s, soundFlags); /* soundFlags (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsA (2 bytes) */ + stream_read_UINT16(s, soundFlags); /* soundFlags (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsA (2 bytes) */ - settings->sound_beeps = (soundFlags & SOUND_BEEPS_FLAG) ? true : false; + settings->sound_beeps = (soundFlags & SOUND_BEEPS_FLAG) ? TRUE : FALSE; } /** @@ -649,15 +649,15 @@ void rdp_read_sound_capability_set(STREAM* s, uint16 length, rdpSettings* settin void rdp_write_sound_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 soundFlags; + BYTE* header; + UINT16 soundFlags; header = rdp_capability_set_start(s); soundFlags = (settings->sound_beeps) ? SOUND_BEEPS_FLAG : 0; - stream_write_uint16(s, soundFlags); /* soundFlags (2 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsA (2 bytes) */ + stream_write_UINT16(s, soundFlags); /* soundFlags (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_SOUND); } @@ -669,31 +669,31 @@ void rdp_write_sound_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_input_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_input_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint16 inputFlags; + UINT16 inputFlags; - stream_read_uint16(s, inputFlags); /* inputFlags (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsA (2 bytes) */ + stream_read_UINT16(s, inputFlags); /* inputFlags (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsA (2 bytes) */ if (settings->server_mode) { - stream_read_uint32(s, settings->kbd_layout); /* keyboardLayout (4 bytes) */ - stream_read_uint32(s, settings->kbd_type); /* keyboardType (4 bytes) */ - stream_read_uint32(s, settings->kbd_subtype); /* keyboardSubType (4 bytes) */ - stream_read_uint32(s, settings->kbd_fn_keys); /* keyboardFunctionKeys (4 bytes) */ + stream_read_UINT32(s, settings->kbd_layout); /* keyboardLayout (4 bytes) */ + stream_read_UINT32(s, settings->kbd_type); /* keyboardType (4 bytes) */ + stream_read_UINT32(s, settings->kbd_subtype); /* keyboardSubType (4 bytes) */ + stream_read_UINT32(s, settings->kbd_fn_keys); /* keyboardFunctionKeys (4 bytes) */ } else { - stream_seek_uint32(s); /* keyboardLayout (4 bytes) */ - stream_seek_uint32(s); /* keyboardType (4 bytes) */ - stream_seek_uint32(s); /* keyboardSubType (4 bytes) */ - stream_seek_uint32(s); /* keyboardFunctionKeys (4 bytes) */ + stream_seek_UINT32(s); /* keyboardLayout (4 bytes) */ + stream_seek_UINT32(s); /* keyboardType (4 bytes) */ + stream_seek_UINT32(s); /* keyboardSubType (4 bytes) */ + stream_seek_UINT32(s); /* keyboardFunctionKeys (4 bytes) */ } stream_seek(s, 64); /* imeFileName (64 bytes) */ - if (settings->server_mode != true) + if (settings->server_mode != TRUE) { if (inputFlags & INPUT_FLAG_FASTPATH_INPUT) { @@ -706,7 +706,7 @@ void rdp_read_input_capability_set(STREAM* s, uint16 length, rdpSettings* settin else { /* server does not support fastpath input */ - settings->fastpath_input = false; + settings->fastpath_input = FALSE; } } } @@ -720,8 +720,8 @@ void rdp_read_input_capability_set(STREAM* s, uint16 length, rdpSettings* settin void rdp_write_input_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 inputFlags; + BYTE* header; + UINT16 inputFlags; header = rdp_capability_set_start(s); @@ -733,12 +733,12 @@ void rdp_write_input_capability_set(STREAM* s, rdpSettings* settings) inputFlags |= INPUT_FLAG_FASTPATH_INPUT2; } - stream_write_uint16(s, inputFlags); /* inputFlags (2 bytes) */ - stream_write_uint16(s, 0); /* pad2OctetsA (2 bytes) */ - stream_write_uint32(s, settings->kbd_layout); /* keyboardLayout (4 bytes) */ - stream_write_uint32(s, settings->kbd_type); /* keyboardType (4 bytes) */ - stream_write_uint32(s, settings->kbd_subtype); /* keyboardSubType (4 bytes) */ - stream_write_uint32(s, settings->kbd_fn_keys); /* keyboardFunctionKeys (4 bytes) */ + stream_write_UINT16(s, inputFlags); /* inputFlags (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */ + stream_write_UINT32(s, settings->kbd_layout); /* keyboardLayout (4 bytes) */ + stream_write_UINT32(s, settings->kbd_type); /* keyboardType (4 bytes) */ + stream_write_UINT32(s, settings->kbd_subtype); /* keyboardSubType (4 bytes) */ + stream_write_UINT32(s, settings->kbd_fn_keys); /* keyboardFunctionKeys (4 bytes) */ stream_write_zero(s, 64); /* imeFileName (64 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_INPUT); @@ -751,13 +751,13 @@ void rdp_write_input_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_font_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_font_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { if (length > 4) - stream_seek_uint16(s); /* fontSupportFlags (2 bytes) */ + stream_seek_UINT16(s); /* fontSupportFlags (2 bytes) */ if (length > 6) - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ } /** @@ -769,12 +769,12 @@ void rdp_read_font_capability_set(STREAM* s, uint16 length, rdpSettings* setting void rdp_write_font_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint16(s, FONTSUPPORT_FONTLIST); /* fontSupportFlags (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, FONTSUPPORT_FONTLIST); /* fontSupportFlags (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_FONT); } @@ -786,9 +786,9 @@ void rdp_write_font_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_brush_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_brush_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint32(s); /* brushSupportLevel (4 bytes) */ + stream_seek_UINT32(s); /* brushSupportLevel (4 bytes) */ } /** @@ -800,11 +800,11 @@ void rdp_read_brush_capability_set(STREAM* s, uint16 length, rdpSettings* settin void rdp_write_brush_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint32(s, BRUSH_COLOR_FULL); /* brushSupportLevel (4 bytes) */ + stream_write_UINT32(s, BRUSH_COLOR_FULL); /* brushSupportLevel (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_BRUSH); } @@ -816,8 +816,8 @@ void rdp_write_brush_capability_set(STREAM* s, rdpSettings* settings) */ void rdp_read_cache_definition(STREAM* s, GLYPH_CACHE_DEFINITION* cache_definition) { - stream_read_uint16(s, cache_definition->cacheEntries); /* cacheEntries (2 bytes) */ - stream_read_uint16(s, cache_definition->cacheMaximumCellSize); /* cacheMaximumCellSize (2 bytes) */ + stream_read_UINT16(s, cache_definition->cacheEntries); /* cacheEntries (2 bytes) */ + stream_read_UINT16(s, cache_definition->cacheMaximumCellSize); /* cacheMaximumCellSize (2 bytes) */ } /** @@ -827,8 +827,8 @@ void rdp_read_cache_definition(STREAM* s, GLYPH_CACHE_DEFINITION* cache_definiti */ void rdp_write_cache_definition(STREAM* s, GLYPH_CACHE_DEFINITION* cache_definition) { - stream_write_uint16(s, cache_definition->cacheEntries); /* cacheEntries (2 bytes) */ - stream_write_uint16(s, cache_definition->cacheMaximumCellSize); /* cacheMaximumCellSize (2 bytes) */ + stream_write_UINT16(s, cache_definition->cacheEntries); /* cacheEntries (2 bytes) */ + stream_write_UINT16(s, cache_definition->cacheMaximumCellSize); /* cacheMaximumCellSize (2 bytes) */ } /** @@ -838,14 +838,14 @@ void rdp_write_cache_definition(STREAM* s, GLYPH_CACHE_DEFINITION* cache_definit * @param settings settings */ -void rdp_read_glyph_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_glyph_cache_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint16 glyphSupportLevel; + UINT16 glyphSupportLevel; stream_seek(s, 40); /* glyphCache (40 bytes) */ - stream_seek_uint32(s); /* fragCache (4 bytes) */ - stream_read_uint16(s, glyphSupportLevel); /* glyphSupportLevel (2 bytes) */ - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + stream_seek_UINT32(s); /* fragCache (4 bytes) */ + stream_read_UINT16(s, glyphSupportLevel); /* glyphSupportLevel (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ settings->glyphSupportLevel = glyphSupportLevel; } @@ -859,7 +859,7 @@ void rdp_read_glyph_cache_capability_set(STREAM* s, uint16 length, rdpSettings* void rdp_write_glyph_cache_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); @@ -877,9 +877,9 @@ void rdp_write_glyph_cache_capability_set(STREAM* s, rdpSettings* settings) rdp_write_cache_definition(s, settings->fragCache); /* fragCache (4 bytes) */ - stream_write_uint16(s, settings->glyphSupportLevel); /* glyphSupportLevel (2 bytes) */ + stream_write_UINT16(s, settings->glyphSupportLevel); /* glyphSupportLevel (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_GLYPH_CACHE); } @@ -891,16 +891,16 @@ void rdp_write_glyph_cache_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_offscreen_bitmap_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_offscreen_bitmap_cache_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint32 offscreenSupportLevel; + UINT32 offscreenSupportLevel; - stream_read_uint32(s, offscreenSupportLevel); /* offscreenSupportLevel (4 bytes) */ - stream_read_uint16(s, settings->offscreen_bitmap_cache_size); /* offscreenCacheSize (2 bytes) */ - stream_read_uint16(s, settings->offscreen_bitmap_cache_entries); /* offscreenCacheEntries (2 bytes) */ + stream_read_UINT32(s, offscreenSupportLevel); /* offscreenSupportLevel (4 bytes) */ + stream_read_UINT16(s, settings->offscreen_bitmap_cache_size); /* offscreenCacheSize (2 bytes) */ + stream_read_UINT16(s, settings->offscreen_bitmap_cache_entries); /* offscreenCacheEntries (2 bytes) */ - if (offscreenSupportLevel & true) - settings->offscreen_bitmap_cache = true; + if (offscreenSupportLevel & TRUE) + settings->offscreen_bitmap_cache = TRUE; } /** @@ -912,17 +912,17 @@ void rdp_read_offscreen_bitmap_cache_capability_set(STREAM* s, uint16 length, rd void rdp_write_offscreen_bitmap_cache_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 offscreenSupportLevel = false; + BYTE* header; + UINT32 offscreenSupportLevel = FALSE; header = rdp_capability_set_start(s); if (settings->offscreen_bitmap_cache) - offscreenSupportLevel = true; + offscreenSupportLevel = TRUE; - stream_write_uint32(s, offscreenSupportLevel); /* offscreenSupportLevel (4 bytes) */ - stream_write_uint16(s, settings->offscreen_bitmap_cache_size); /* offscreenCacheSize (2 bytes) */ - stream_write_uint16(s, settings->offscreen_bitmap_cache_entries); /* offscreenCacheEntries (2 bytes) */ + stream_write_UINT32(s, offscreenSupportLevel); /* offscreenSupportLevel (4 bytes) */ + stream_write_UINT16(s, settings->offscreen_bitmap_cache_size); /* offscreenCacheSize (2 bytes) */ + stream_write_UINT16(s, settings->offscreen_bitmap_cache_entries); /* offscreenCacheEntries (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_OFFSCREEN_CACHE); } @@ -934,16 +934,16 @@ void rdp_write_offscreen_bitmap_cache_capability_set(STREAM* s, rdpSettings* set * @param settings settings */ -void rdp_read_bitmap_cache_host_support_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_bitmap_cache_host_support_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint8 cacheVersion; + BYTE cacheVersion; - stream_read_uint8(s, cacheVersion); /* cacheVersion (1 byte) */ - stream_seek_uint8(s); /* pad1 (1 byte) */ - stream_seek_uint16(s); /* pad2 (2 bytes) */ + stream_read_BYTE(s, cacheVersion); /* cacheVersion (1 byte) */ + stream_seek_BYTE(s); /* pad1 (1 byte) */ + stream_seek_UINT16(s); /* pad2 (2 bytes) */ if (cacheVersion & BITMAP_CACHE_V2) - settings->persistent_bitmap_cache = true; + settings->persistent_bitmap_cache = TRUE; } /** @@ -955,20 +955,20 @@ void rdp_read_bitmap_cache_host_support_capability_set(STREAM* s, uint16 length, void rdp_write_bitmap_cache_host_support_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint8(s, BITMAP_CACHE_V2); /* cacheVersion (1 byte) */ - stream_write_uint8(s, 0); /* pad1 (1 byte) */ - stream_write_uint16(s, 0); /* pad2 (2 bytes) */ + stream_write_BYTE(s, BITMAP_CACHE_V2); /* cacheVersion (1 byte) */ + stream_write_BYTE(s, 0); /* pad1 (1 byte) */ + stream_write_UINT16(s, 0); /* pad2 (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CACHE_HOST_SUPPORT); } void rdp_write_bitmap_cache_cell_info(STREAM* s, BITMAP_CACHE_V2_CELL_INFO* cellInfo) { - uint32 info; + UINT32 info; /** * numEntries is in the first 31 bits, while the last bit (k) @@ -976,7 +976,7 @@ void rdp_write_bitmap_cache_cell_info(STREAM* s, BITMAP_CACHE_V2_CELL_INFO* cell */ info = (cellInfo->numEntries | (cellInfo->persistent << 31)); - stream_write_uint32(s, info); + stream_write_UINT32(s, info); } /** @@ -986,11 +986,11 @@ void rdp_write_bitmap_cache_cell_info(STREAM* s, BITMAP_CACHE_V2_CELL_INFO* cell * @param settings settings */ -void rdp_read_bitmap_cache_v2_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_bitmap_cache_v2_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint16(s); /* cacheFlags (2 bytes) */ - stream_seek_uint8(s); /* pad2 (1 byte) */ - stream_seek_uint8(s); /* numCellCaches (1 byte) */ + stream_seek_UINT16(s); /* cacheFlags (2 bytes) */ + stream_seek_BYTE(s); /* pad2 (1 byte) */ + stream_seek_BYTE(s); /* numCellCaches (1 byte) */ stream_seek(s, 4); /* bitmapCache0CellInfo (4 bytes) */ stream_seek(s, 4); /* bitmapCache1CellInfo (4 bytes) */ stream_seek(s, 4); /* bitmapCache2CellInfo (4 bytes) */ @@ -1008,8 +1008,8 @@ void rdp_read_bitmap_cache_v2_capability_set(STREAM* s, uint16 length, rdpSettin void rdp_write_bitmap_cache_v2_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 cacheFlags; + BYTE* header; + UINT16 cacheFlags; header = rdp_capability_set_start(s); @@ -1018,9 +1018,9 @@ void rdp_write_bitmap_cache_v2_capability_set(STREAM* s, rdpSettings* settings) if (settings->persistent_bitmap_cache) cacheFlags |= PERSISTENT_KEYS_EXPECTED_FLAG; - stream_write_uint16(s, cacheFlags); /* cacheFlags (2 bytes) */ - stream_write_uint8(s, 0); /* pad2 (1 byte) */ - stream_write_uint8(s, settings->bitmapCacheV2NumCells); /* numCellCaches (1 byte) */ + stream_write_UINT16(s, cacheFlags); /* cacheFlags (2 bytes) */ + stream_write_BYTE(s, 0); /* pad2 (1 byte) */ + stream_write_BYTE(s, settings->bitmapCacheV2NumCells); /* numCellCaches (1 byte) */ rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[0]); /* bitmapCache0CellInfo (4 bytes) */ rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[1]); /* bitmapCache1CellInfo (4 bytes) */ rdp_write_bitmap_cache_cell_info(s, &settings->bitmapCacheV2CellInfo[2]); /* bitmapCache2CellInfo (4 bytes) */ @@ -1038,19 +1038,19 @@ void rdp_write_bitmap_cache_v2_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_virtual_channel_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_virtual_channel_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint32 flags; - uint32 VCChunkSize; + UINT32 flags; + UINT32 VCChunkSize; - stream_read_uint32(s, flags); /* flags (4 bytes) */ + stream_read_UINT32(s, flags); /* flags (4 bytes) */ if (length > 8) - stream_read_uint32(s, VCChunkSize); /* VCChunkSize (4 bytes) */ + stream_read_UINT32(s, VCChunkSize); /* VCChunkSize (4 bytes) */ else VCChunkSize = 1600; - if (settings->server_mode != true) + if (settings->server_mode != TRUE) settings->vc_chunk_size = VCChunkSize; } @@ -1063,15 +1063,15 @@ void rdp_read_virtual_channel_capability_set(STREAM* s, uint16 length, rdpSettin void rdp_write_virtual_channel_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 flags; + BYTE* header; + UINT32 flags; header = rdp_capability_set_start(s); flags = VCCAPS_NO_COMPR; - stream_write_uint32(s, flags); /* flags (4 bytes) */ - stream_write_uint32(s, settings->vc_chunk_size); /* VCChunkSize (4 bytes) */ + stream_write_UINT32(s, flags); /* flags (4 bytes) */ + stream_write_UINT32(s, settings->vc_chunk_size); /* VCChunkSize (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_VIRTUAL_CHANNEL); } @@ -1083,17 +1083,17 @@ void rdp_write_virtual_channel_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_draw_nine_grid_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_draw_nine_grid_cache_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint32 drawNineGridSupportLevel; + UINT32 drawNineGridSupportLevel; - stream_read_uint32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */ - stream_read_uint16(s, settings->draw_nine_grid_cache_size); /* drawNineGridCacheSize (2 bytes) */ - stream_read_uint16(s, settings->draw_nine_grid_cache_entries); /* drawNineGridCacheEntries (2 bytes) */ + stream_read_UINT32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */ + stream_read_UINT16(s, settings->draw_nine_grid_cache_size); /* drawNineGridCacheSize (2 bytes) */ + stream_read_UINT16(s, settings->draw_nine_grid_cache_entries); /* drawNineGridCacheEntries (2 bytes) */ if ((drawNineGridSupportLevel & DRAW_NINEGRID_SUPPORTED) || (drawNineGridSupportLevel & DRAW_NINEGRID_SUPPORTED_V2)) - settings->draw_nine_grid = true; + settings->draw_nine_grid = TRUE; } /** @@ -1105,42 +1105,42 @@ void rdp_read_draw_nine_grid_cache_capability_set(STREAM* s, uint16 length, rdpS void rdp_write_draw_nine_grid_cache_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 drawNineGridSupportLevel; + BYTE* header; + UINT32 drawNineGridSupportLevel; header = rdp_capability_set_start(s); drawNineGridSupportLevel = (settings->draw_nine_grid) ? DRAW_NINEGRID_SUPPORTED_V2 : DRAW_NINEGRID_NO_SUPPORT; - stream_write_uint32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */ - stream_write_uint16(s, settings->draw_nine_grid_cache_size); /* drawNineGridCacheSize (2 bytes) */ - stream_write_uint16(s, settings->draw_nine_grid_cache_entries); /* drawNineGridCacheEntries (2 bytes) */ + stream_write_UINT32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */ + stream_write_UINT16(s, settings->draw_nine_grid_cache_size); /* drawNineGridCacheSize (2 bytes) */ + stream_write_UINT16(s, settings->draw_nine_grid_cache_entries); /* drawNineGridCacheEntries (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_DRAW_NINE_GRID_CACHE); } -void rdp_write_gdiplus_cache_entries(STREAM* s, uint16 gce, uint16 bce, uint16 pce, uint16 ice, uint16 ace) +void rdp_write_gdiplus_cache_entries(STREAM* s, UINT16 gce, UINT16 bce, UINT16 pce, UINT16 ice, UINT16 ace) { - stream_write_uint16(s, gce); /* gdipGraphicsCacheEntries (2 bytes) */ - stream_write_uint16(s, bce); /* gdipBrushCacheEntries (2 bytes) */ - stream_write_uint16(s, pce); /* gdipPenCacheEntries (2 bytes) */ - stream_write_uint16(s, ice); /* gdipImageCacheEntries (2 bytes) */ - stream_write_uint16(s, ace); /* gdipImageAttributesCacheEntries (2 bytes) */ + stream_write_UINT16(s, gce); /* gdipGraphicsCacheEntries (2 bytes) */ + stream_write_UINT16(s, bce); /* gdipBrushCacheEntries (2 bytes) */ + stream_write_UINT16(s, pce); /* gdipPenCacheEntries (2 bytes) */ + stream_write_UINT16(s, ice); /* gdipImageCacheEntries (2 bytes) */ + stream_write_UINT16(s, ace); /* gdipImageAttributesCacheEntries (2 bytes) */ } -void rdp_write_gdiplus_cache_chunk_size(STREAM* s, uint16 gccs, uint16 obccs, uint16 opccs, uint16 oiaccs) +void rdp_write_gdiplus_cache_chunk_size(STREAM* s, UINT16 gccs, UINT16 obccs, UINT16 opccs, UINT16 oiaccs) { - stream_write_uint16(s, gccs); /* gdipGraphicsCacheChunkSize (2 bytes) */ - stream_write_uint16(s, obccs); /* gdipObjectBrushCacheChunkSize (2 bytes) */ - stream_write_uint16(s, opccs); /* gdipObjectPenCacheChunkSize (2 bytes) */ - stream_write_uint16(s, oiaccs); /* gdipObjectImageAttributesCacheChunkSize (2 bytes) */ + stream_write_UINT16(s, gccs); /* gdipGraphicsCacheChunkSize (2 bytes) */ + stream_write_UINT16(s, obccs); /* gdipObjectBrushCacheChunkSize (2 bytes) */ + stream_write_UINT16(s, opccs); /* gdipObjectPenCacheChunkSize (2 bytes) */ + stream_write_UINT16(s, oiaccs); /* gdipObjectImageAttributesCacheChunkSize (2 bytes) */ } -void rdp_write_gdiplus_image_cache_properties(STREAM* s, uint16 oiccs, uint16 oicts, uint16 oicms) +void rdp_write_gdiplus_image_cache_properties(STREAM* s, UINT16 oiccs, UINT16 oicts, UINT16 oicms) { - stream_write_uint16(s, oiccs); /* gdipObjectImageCacheChunkSize (2 bytes) */ - stream_write_uint16(s, oicts); /* gdipObjectImageCacheTotalSize (2 bytes) */ - stream_write_uint16(s, oicms); /* gdipObjectImageCacheMaxSize (2 bytes) */ + stream_write_UINT16(s, oiccs); /* gdipObjectImageCacheChunkSize (2 bytes) */ + stream_write_UINT16(s, oicts); /* gdipObjectImageCacheTotalSize (2 bytes) */ + stream_write_UINT16(s, oicms); /* gdipObjectImageCacheMaxSize (2 bytes) */ } /** @@ -1150,23 +1150,23 @@ void rdp_write_gdiplus_image_cache_properties(STREAM* s, uint16 oiccs, uint16 oi * @param settings settings */ -void rdp_read_draw_gdiplus_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_draw_gdiplus_cache_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint32 drawGDIPlusSupportLevel; - uint32 drawGdiplusCacheLevel; + UINT32 drawGDIPlusSupportLevel; + UINT32 drawGdiplusCacheLevel; - stream_read_uint32(s, drawGDIPlusSupportLevel); /* drawGDIPlusSupportLevel (4 bytes) */ - stream_seek_uint32(s); /* GdipVersion (4 bytes) */ - stream_read_uint32(s, drawGdiplusCacheLevel); /* drawGdiplusCacheLevel (4 bytes) */ + stream_read_UINT32(s, drawGDIPlusSupportLevel); /* drawGDIPlusSupportLevel (4 bytes) */ + stream_seek_UINT32(s); /* GdipVersion (4 bytes) */ + stream_read_UINT32(s, drawGdiplusCacheLevel); /* drawGdiplusCacheLevel (4 bytes) */ stream_seek(s, 10); /* GdipCacheEntries (10 bytes) */ stream_seek(s, 8); /* GdipCacheChunkSize (8 bytes) */ stream_seek(s, 6); /* GdipImageCacheProperties (6 bytes) */ if (drawGDIPlusSupportLevel & DRAW_GDIPLUS_SUPPORTED) - settings->draw_gdi_plus = true; + settings->draw_gdi_plus = TRUE; if (drawGdiplusCacheLevel & DRAW_GDIPLUS_CACHE_LEVEL_ONE) - settings->draw_gdi_plus_cache = true; + settings->draw_gdi_plus_cache = TRUE; } /** @@ -1178,18 +1178,18 @@ void rdp_read_draw_gdiplus_cache_capability_set(STREAM* s, uint16 length, rdpSet void rdp_write_draw_gdiplus_cache_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 drawGDIPlusSupportLevel; - uint32 drawGdiplusCacheLevel; + BYTE* header; + UINT32 drawGDIPlusSupportLevel; + UINT32 drawGdiplusCacheLevel; header = rdp_capability_set_start(s); drawGDIPlusSupportLevel = (settings->draw_gdi_plus) ? DRAW_GDIPLUS_SUPPORTED : DRAW_GDIPLUS_DEFAULT; drawGdiplusCacheLevel = (settings->draw_gdi_plus) ? DRAW_GDIPLUS_CACHE_LEVEL_ONE : DRAW_GDIPLUS_CACHE_LEVEL_DEFAULT; - stream_write_uint32(s, drawGDIPlusSupportLevel); /* drawGDIPlusSupportLevel (4 bytes) */ - stream_write_uint32(s, 0); /* GdipVersion (4 bytes) */ - stream_write_uint32(s, drawGdiplusCacheLevel); /* drawGdiplusCacheLevel (4 bytes) */ + stream_write_UINT32(s, drawGDIPlusSupportLevel); /* drawGDIPlusSupportLevel (4 bytes) */ + stream_write_UINT32(s, 0); /* GdipVersion (4 bytes) */ + stream_write_UINT32(s, drawGdiplusCacheLevel); /* drawGdiplusCacheLevel (4 bytes) */ rdp_write_gdiplus_cache_entries(s, 10, 5, 5, 10, 2); /* GdipCacheEntries (10 bytes) */ rdp_write_gdiplus_cache_chunk_size(s, 512, 2048, 1024, 64); /* GdipCacheChunkSize (8 bytes) */ rdp_write_gdiplus_image_cache_properties(s, 4096, 256, 128); /* GdipImageCacheProperties (6 bytes) */ @@ -1204,18 +1204,18 @@ void rdp_write_draw_gdiplus_cache_capability_set(STREAM* s, rdpSettings* setting * @param settings settings */ -void rdp_read_remote_programs_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_remote_programs_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint32 railSupportLevel; + UINT32 railSupportLevel; - stream_read_uint32(s, railSupportLevel); /* railSupportLevel (4 bytes) */ + stream_read_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */ if ((railSupportLevel & RAIL_LEVEL_SUPPORTED) == 0) { - if (settings->remote_app == true) + if (settings->remote_app == TRUE) { /* RemoteApp Failure! */ - settings->remote_app = false; + settings->remote_app = FALSE; } } } @@ -1229,8 +1229,8 @@ void rdp_read_remote_programs_capability_set(STREAM* s, uint16 length, rdpSettin void rdp_write_remote_programs_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 railSupportLevel; + BYTE* header; + UINT32 railSupportLevel; header = rdp_capability_set_start(s); @@ -1239,7 +1239,7 @@ void rdp_write_remote_programs_capability_set(STREAM* s, rdpSettings* settings) if (settings->rail_langbar_supported) railSupportLevel |= RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED; - stream_write_uint32(s, railSupportLevel); /* railSupportLevel (4 bytes) */ + stream_write_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_RAIL); } @@ -1251,11 +1251,11 @@ void rdp_write_remote_programs_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_window_list_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_window_list_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint32(s); /* wndSupportLevel (4 bytes) */ - stream_seek_uint8(s); /* numIconCaches (1 byte) */ - stream_seek_uint16(s); /* numIconCacheEntries (2 bytes) */ + stream_seek_UINT32(s); /* wndSupportLevel (4 bytes) */ + stream_seek_BYTE(s); /* numIconCaches (1 byte) */ + stream_seek_UINT16(s); /* numIconCacheEntries (2 bytes) */ } /** @@ -1267,16 +1267,16 @@ void rdp_read_window_list_capability_set(STREAM* s, uint16 length, rdpSettings* void rdp_write_window_list_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 wndSupportLevel; + BYTE* header; + UINT32 wndSupportLevel; header = rdp_capability_set_start(s); wndSupportLevel = WINDOW_LEVEL_SUPPORTED_EX; - stream_write_uint32(s, wndSupportLevel); /* wndSupportLevel (4 bytes) */ - stream_write_uint8(s, settings->num_icon_caches); /* numIconCaches (1 byte) */ - stream_write_uint16(s, settings->num_icon_cache_entries); /* numIconCacheEntries (2 bytes) */ + stream_write_UINT32(s, wndSupportLevel); /* wndSupportLevel (4 bytes) */ + stream_write_BYTE(s, settings->num_icon_caches); /* numIconCaches (1 byte) */ + stream_write_UINT16(s, settings->num_icon_cache_entries); /* numIconCacheEntries (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_WINDOW); } @@ -1288,9 +1288,9 @@ void rdp_write_window_list_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_desktop_composition_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_desktop_composition_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint16(s); /* compDeskSupportLevel (2 bytes) */ + stream_seek_UINT16(s); /* compDeskSupportLevel (2 bytes) */ } /** @@ -1302,14 +1302,14 @@ void rdp_read_desktop_composition_capability_set(STREAM* s, uint16 length, rdpSe void rdp_write_desktop_composition_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 compDeskSupportLevel; + BYTE* header; + UINT16 compDeskSupportLevel; header = rdp_capability_set_start(s); compDeskSupportLevel = (settings->desktop_composition) ? COMPDESK_SUPPORTED : COMPDESK_NOT_SUPPORTED; - stream_write_uint16(s, compDeskSupportLevel); /* compDeskSupportLevel (2 bytes) */ + stream_write_UINT16(s, compDeskSupportLevel); /* compDeskSupportLevel (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_COMP_DESK); } @@ -1321,9 +1321,9 @@ void rdp_write_desktop_composition_capability_set(STREAM* s, rdpSettings* settin * @param settings settings */ -void rdp_read_multifragment_update_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_multifragment_update_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_read_uint32(s, settings->multifrag_max_request_size); /* MaxRequestSize (4 bytes) */ + stream_read_UINT32(s, settings->multifrag_max_request_size); /* MaxRequestSize (4 bytes) */ } /** @@ -1335,11 +1335,11 @@ void rdp_read_multifragment_update_capability_set(STREAM* s, uint16 length, rdpS void rdp_write_multifragment_update_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint32(s, settings->multifrag_max_request_size); /* MaxRequestSize (4 bytes) */ + stream_write_UINT32(s, settings->multifrag_max_request_size); /* MaxRequestSize (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_MULTI_FRAGMENT_UPDATE); } @@ -1351,9 +1351,9 @@ void rdp_write_multifragment_update_capability_set(STREAM* s, rdpSettings* setti * @param settings settings */ -void rdp_read_large_pointer_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_large_pointer_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint16(s); /* largePointerSupportFlags (2 bytes) */ + stream_seek_UINT16(s); /* largePointerSupportFlags (2 bytes) */ } /** @@ -1365,14 +1365,14 @@ void rdp_read_large_pointer_capability_set(STREAM* s, uint16 length, rdpSettings void rdp_write_large_pointer_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint16 largePointerSupportFlags; + BYTE* header; + UINT16 largePointerSupportFlags; header = rdp_capability_set_start(s); largePointerSupportFlags = (settings->large_pointer) ? LARGE_POINTER_FLAG_96x96 : 0; - stream_write_uint16(s, largePointerSupportFlags); /* largePointerSupportFlags (2 bytes) */ + stream_write_UINT16(s, largePointerSupportFlags); /* largePointerSupportFlags (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_LARGE_POINTER); } @@ -1384,12 +1384,12 @@ void rdp_write_large_pointer_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_surface_commands_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_surface_commands_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint32(s); /* cmdFlags (4 bytes) */ - stream_seek_uint32(s); /* reserved (4 bytes) */ + stream_seek_UINT32(s); /* cmdFlags (4 bytes) */ + stream_seek_UINT32(s); /* reserved (4 bytes) */ - settings->surface_commands = true; + settings->surface_commands = TRUE; } /** @@ -1401,8 +1401,8 @@ void rdp_read_surface_commands_capability_set(STREAM* s, uint16 length, rdpSetti void rdp_write_surface_commands_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 cmdFlags; + BYTE* header; + UINT32 cmdFlags; header = rdp_capability_set_start(s); @@ -1410,8 +1410,8 @@ void rdp_write_surface_commands_capability_set(STREAM* s, rdpSettings* settings) SURFCMDS_SET_SURFACE_BITS | SURFCMDS_STREAM_SURFACE_BITS; - stream_write_uint32(s, cmdFlags); /* cmdFlags (4 bytes) */ - stream_write_uint32(s, 0); /* reserved (4 bytes) */ + stream_write_UINT32(s, cmdFlags); /* cmdFlags (4 bytes) */ + stream_write_UINT32(s, 0); /* reserved (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_SURFACE_COMMANDS); } @@ -1423,18 +1423,18 @@ void rdp_write_surface_commands_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_bitmap_codecs_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_bitmap_codecs_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - uint8 bitmapCodecCount; - uint16 codecPropertiesLength; + BYTE bitmapCodecCount; + UINT16 codecPropertiesLength; - stream_read_uint8(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */ + stream_read_BYTE(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */ if (settings->server_mode) { - settings->rfx_codec = false; - settings->ns_codec = false; - settings->jpeg_codec = false; + settings->rfx_codec = FALSE; + settings->ns_codec = FALSE; + settings->jpeg_codec = FALSE; } while (bitmapCodecCount > 0) @@ -1442,22 +1442,22 @@ void rdp_read_bitmap_codecs_capability_set(STREAM* s, uint16 length, rdpSettings if (settings->server_mode && strncmp((char*)stream_get_tail(s), CODEC_GUID_REMOTEFX, 16) == 0) { stream_seek(s, 16); /* codecGUID (16 bytes) */ - stream_read_uint8(s, settings->rfx_codec_id); - settings->rfx_codec = true; + stream_read_BYTE(s, settings->rfx_codec_id); + settings->rfx_codec = TRUE; } else if (settings->server_mode && strncmp((char*)stream_get_tail(s), CODEC_GUID_NSCODEC, 16) == 0) { stream_seek(s, 16); /*codec GUID (16 bytes) */ - stream_read_uint8(s, settings->ns_codec_id); - settings->ns_codec = true; + stream_read_BYTE(s, settings->ns_codec_id); + settings->ns_codec = TRUE; } else { stream_seek(s, 16); /* codecGUID (16 bytes) */ - stream_seek_uint8(s); /* codecID (1 byte) */ + stream_seek_BYTE(s); /* codecID (1 byte) */ } - stream_read_uint16(s, codecPropertiesLength); /* codecPropertiesLength (2 bytes) */ + stream_read_UINT16(s, codecPropertiesLength); /* codecPropertiesLength (2 bytes) */ stream_seek(s, codecPropertiesLength); /* codecProperties */ bitmapCodecCount--; @@ -1471,47 +1471,47 @@ void rdp_read_bitmap_codecs_capability_set(STREAM* s, uint16 length, rdpSettings */ void rdp_write_rfx_client_capability_container(STREAM* s, rdpSettings* settings) { - uint32 captureFlags; - uint8 codecMode; + UINT32 captureFlags; + BYTE codecMode; captureFlags = settings->rfx_codec_only ? CARDP_CAPS_CAPTURE_NON_CAC : 0; codecMode = settings->rfx_codec_mode; - stream_write_uint16(s, 49); /* codecPropertiesLength */ + stream_write_UINT16(s, 49); /* codecPropertiesLength */ /* TS_RFX_CLNT_CAPS_CONTAINER */ - stream_write_uint32(s, 49); /* length */ - stream_write_uint32(s, captureFlags); /* captureFlags */ - stream_write_uint32(s, 37); /* capsLength */ + stream_write_UINT32(s, 49); /* length */ + stream_write_UINT32(s, captureFlags); /* captureFlags */ + stream_write_UINT32(s, 37); /* capsLength */ /* TS_RFX_CAPS */ - stream_write_uint16(s, CBY_CAPS); /* blockType */ - stream_write_uint32(s, 8); /* blockLen */ - stream_write_uint16(s, 1); /* numCapsets */ + stream_write_UINT16(s, CBY_CAPS); /* blockType */ + stream_write_UINT32(s, 8); /* blockLen */ + stream_write_UINT16(s, 1); /* numCapsets */ /* TS_RFX_CAPSET */ - stream_write_uint16(s, CBY_CAPSET); /* blockType */ - stream_write_uint32(s, 29); /* blockLen */ - stream_write_uint8(s, 0x01); /* codecId (MUST be set to 0x01) */ - stream_write_uint16(s, CLY_CAPSET); /* capsetType */ - stream_write_uint16(s, 2); /* numIcaps */ - stream_write_uint16(s, 8); /* icapLen */ + stream_write_UINT16(s, CBY_CAPSET); /* blockType */ + stream_write_UINT32(s, 29); /* blockLen */ + stream_write_BYTE(s, 0x01); /* codecId (MUST be set to 0x01) */ + stream_write_UINT16(s, CLY_CAPSET); /* capsetType */ + stream_write_UINT16(s, 2); /* numIcaps */ + stream_write_UINT16(s, 8); /* icapLen */ /* TS_RFX_ICAP (RLGR1) */ - stream_write_uint16(s, CLW_VERSION_1_0); /* version */ - stream_write_uint16(s, CT_TILE_64x64); /* tileSize */ - stream_write_uint8(s, codecMode); /* flags */ - stream_write_uint8(s, CLW_COL_CONV_ICT); /* colConvBits */ - stream_write_uint8(s, CLW_XFORM_DWT_53_A); /* transformBits */ - stream_write_uint8(s, CLW_ENTROPY_RLGR1); /* entropyBits */ + stream_write_UINT16(s, CLW_VERSION_1_0); /* version */ + stream_write_UINT16(s, CT_TILE_64x64); /* tileSize */ + stream_write_BYTE(s, codecMode); /* flags */ + stream_write_BYTE(s, CLW_COL_CONV_ICT); /* colConvBits */ + stream_write_BYTE(s, CLW_XFORM_DWT_53_A); /* transformBits */ + stream_write_BYTE(s, CLW_ENTROPY_RLGR1); /* entropyBits */ /* TS_RFX_ICAP (RLGR3) */ - stream_write_uint16(s, CLW_VERSION_1_0); /* version */ - stream_write_uint16(s, CT_TILE_64x64); /* tileSize */ - stream_write_uint8(s, codecMode); /* flags */ - stream_write_uint8(s, CLW_COL_CONV_ICT); /* colConvBits */ - stream_write_uint8(s, CLW_XFORM_DWT_53_A); /* transformBits */ - stream_write_uint8(s, CLW_ENTROPY_RLGR3); /* entropyBits */ + stream_write_UINT16(s, CLW_VERSION_1_0); /* version */ + stream_write_UINT16(s, CT_TILE_64x64); /* tileSize */ + stream_write_BYTE(s, codecMode); /* flags */ + stream_write_BYTE(s, CLW_COL_CONV_ICT); /* colConvBits */ + stream_write_BYTE(s, CLW_XFORM_DWT_53_A); /* transformBits */ + stream_write_BYTE(s, CLW_ENTROPY_RLGR3); /* entropyBits */ } /** @@ -1521,18 +1521,18 @@ void rdp_write_rfx_client_capability_container(STREAM* s, rdpSettings* settings) */ void rdp_write_nsc_client_capability_container(STREAM* s, rdpSettings* settings) { - stream_write_uint16(s, 3); /* codecPropertiesLength */ + stream_write_UINT16(s, 3); /* codecPropertiesLength */ /* TS_NSCODEC_CAPABILITYSET */ - stream_write_uint8(s, 1); /* fAllowDynamicFidelity */ - stream_write_uint8(s, 1); /* fAllowSubsampling */ - stream_write_uint8(s, 3); /* colorLossLevel */ + stream_write_BYTE(s, 1); /* fAllowDynamicFidelity */ + stream_write_BYTE(s, 1); /* fAllowSubsampling */ + stream_write_BYTE(s, 3); /* colorLossLevel */ } void rdp_write_jpeg_client_capability_container(STREAM* s, rdpSettings* settings) { - stream_write_uint16(s, 1); /* codecPropertiesLength */ - stream_write_uint8(s, settings->jpeg_quality); + stream_write_UINT16(s, 1); /* codecPropertiesLength */ + stream_write_BYTE(s, settings->jpeg_quality); } /** @@ -1542,14 +1542,14 @@ void rdp_write_jpeg_client_capability_container(STREAM* s, rdpSettings* settings */ void rdp_write_rfx_server_capability_container(STREAM* s, rdpSettings* settings) { - stream_write_uint16(s, 4); /* codecPropertiesLength */ - stream_write_uint32(s, 0); /* reserved */ + stream_write_UINT16(s, 4); /* codecPropertiesLength */ + stream_write_UINT32(s, 0); /* reserved */ } void rdp_write_jpeg_server_capability_container(STREAM* s, rdpSettings* settings) { - stream_write_uint16(s, 1); /* codecPropertiesLength */ - stream_write_uint8(s, 75); + stream_write_UINT16(s, 1); /* codecPropertiesLength */ + stream_write_BYTE(s, 75); } /** @@ -1559,8 +1559,8 @@ void rdp_write_jpeg_server_capability_container(STREAM* s, rdpSettings* settings */ void rdp_write_nsc_server_capability_container(STREAM* s, rdpSettings* settings) { - stream_write_uint16(s, 4); /* codecPropertiesLength */ - stream_write_uint32(s, 0); /* reserved */ + stream_write_UINT16(s, 4); /* codecPropertiesLength */ + stream_write_UINT32(s, 0); /* reserved */ } /** @@ -1572,8 +1572,8 @@ void rdp_write_nsc_server_capability_container(STREAM* s, rdpSettings* settings) void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint8 bitmapCodecCount; + BYTE* header; + BYTE bitmapCodecCount; header = rdp_capability_set_start(s); @@ -1586,7 +1586,7 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings) if (settings->jpeg_codec) bitmapCodecCount++; - stream_write_uint8(s, bitmapCodecCount); + stream_write_BYTE(s, bitmapCodecCount); if (settings->rfx_codec) { @@ -1594,12 +1594,12 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings) if (settings->server_mode) { - stream_write_uint8(s, 0); /* codecID is defined by the client */ + stream_write_BYTE(s, 0); /* codecID is defined by the client */ rdp_write_rfx_server_capability_container(s, settings); } else { - stream_write_uint8(s, CODEC_ID_REMOTEFX); /* codecID */ + stream_write_BYTE(s, CODEC_ID_REMOTEFX); /* codecID */ rdp_write_rfx_client_capability_container(s, settings); } } @@ -1608,12 +1608,12 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings) stream_write(s, CODEC_GUID_NSCODEC, 16); if (settings->server_mode) { - stream_write_uint8(s, 0); /* codecID is defined by the client */ + stream_write_BYTE(s, 0); /* codecID is defined by the client */ rdp_write_nsc_server_capability_container(s, settings); } else { - stream_write_uint8(s, CODEC_ID_NSCODEC); /* codecID */ + stream_write_BYTE(s, CODEC_ID_NSCODEC); /* codecID */ rdp_write_nsc_client_capability_container(s, settings); } } @@ -1622,12 +1622,12 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings) stream_write(s, CODEC_GUID_JPEG, 16); if (settings->server_mode) { - stream_write_uint8(s, 0); /* codecID is defined by the client */ + stream_write_BYTE(s, 0); /* codecID is defined by the client */ rdp_write_jpeg_server_capability_container(s, settings); } else { - stream_write_uint8(s, CODEC_ID_JPEG); /* codecID */ + stream_write_BYTE(s, CODEC_ID_JPEG); /* codecID */ rdp_write_jpeg_client_capability_container(s, settings); } } @@ -1640,29 +1640,29 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings) * @param settings settings */ -void rdp_read_frame_acknowledge_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_frame_acknowledge_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { if (settings->server_mode) { - stream_read_uint32(s, settings->frame_acknowledge); /* (4 bytes) */ + stream_read_UINT32(s, settings->frame_acknowledge); /* (4 bytes) */ } else { - stream_seek_uint32(s); /* (4 bytes) */ + stream_seek_UINT32(s); /* (4 bytes) */ } } -void rdp_read_bitmap_cache_v3_codec_id_capability_set(STREAM* s, uint16 length, rdpSettings* settings) +void rdp_read_bitmap_cache_v3_codec_id_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { - stream_seek_uint8(s); /* (1 byte) */ + stream_seek_BYTE(s); /* (1 byte) */ } void rdp_write_bitmap_cache_v3_codec_id_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; + BYTE* header; header = rdp_capability_set_start(s); - stream_write_uint8(s, settings->v3_codec_id); + stream_write_BYTE(s, settings->v3_codec_id); rdp_capability_set_finish(s, header, 6); } @@ -1675,22 +1675,22 @@ void rdp_write_bitmap_cache_v3_codec_id_capability_set(STREAM* s, rdpSettings* s void rdp_write_frame_acknowledge_capability_set(STREAM* s, rdpSettings* settings) { - uint8* header; - uint32 frame_acknowledge; + BYTE* header; + UINT32 frame_acknowledge; header = rdp_capability_set_start(s); frame_acknowledge = settings->frame_acknowledge; - stream_write_uint32(s, frame_acknowledge); /* (4 bytes) */ + stream_write_UINT32(s, frame_acknowledge); /* (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_FRAME_ACKNOWLEDGE); } -boolean rdp_read_capability_sets(STREAM* s, rdpSettings* settings, uint16 numberCapabilities) +BOOL rdp_read_capability_sets(STREAM* s, rdpSettings* settings, UINT16 numberCapabilities) { - uint16 type; - uint16 length; - uint8 *bm, *em; + UINT16 type; + UINT16 length; + BYTE *bm, *em; while (numberCapabilities > 0) { @@ -1698,13 +1698,13 @@ boolean rdp_read_capability_sets(STREAM* s, rdpSettings* settings, uint16 number rdp_read_capability_set_header(s, &length, &type); //printf("%s Capability Set (0x%02X), length:%d\n", CAPSET_TYPE_STRINGS[type], type, length); - settings->received_caps[type] = true; + settings->received_caps[type] = TRUE; em = bm + length; if (stream_get_left(s) < length - 4) { printf("error processing stream\n"); - return false; + return FALSE; } switch (type) @@ -1840,26 +1840,26 @@ boolean rdp_read_capability_sets(STREAM* s, rdpSettings* settings, uint16 number numberCapabilities--; } - return true; + return TRUE; } -boolean rdp_recv_demand_active(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_demand_active(rdpRdp* rdp, STREAM* s) { - uint16 length; - uint16 channelId; - uint16 pduType; - uint16 pduLength; - uint16 pduSource; - uint16 numberCapabilities; - uint16 lengthSourceDescriptor; - uint16 lengthCombinedCapabilities; - uint16 securityFlags; + UINT16 length; + UINT16 channelId; + UINT16 pduType; + UINT16 pduLength; + UINT16 pduSource; + UINT16 numberCapabilities; + UINT16 lengthSourceDescriptor; + UINT16 lengthCombinedCapabilities; + UINT16 securityFlags; if (!rdp_read_header(rdp, s, &length, &channelId)) - return false; + return FALSE; if (rdp->disconnect) - return true; + return TRUE; if (rdp->settings->encryption) { @@ -1869,7 +1869,7 @@ boolean rdp_recv_demand_active(rdpRdp* rdp, STREAM* s) if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { printf("rdp_decrypt failed\n"); - return false; + return FALSE; } } } @@ -1877,13 +1877,13 @@ boolean rdp_recv_demand_active(rdpRdp* rdp, STREAM* s) if (channelId != MCS_GLOBAL_CHANNEL_ID) { printf("expected MCS_GLOBAL_CHANNEL_ID %04x, got %04x\n", MCS_GLOBAL_CHANNEL_ID, channelId); - return false; + return FALSE; } if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) { printf("rdp_read_share_control_header failed\n"); - return false; + return FALSE; } rdp->settings->pdu_source = pduSource; @@ -1891,44 +1891,44 @@ boolean rdp_recv_demand_active(rdpRdp* rdp, STREAM* s) if (pduType != PDU_TYPE_DEMAND_ACTIVE) { printf("expected PDU_TYPE_DEMAND_ACTIVE %04x, got %04x\n", PDU_TYPE_DEMAND_ACTIVE, pduType); - return false; + return FALSE; } - stream_read_uint32(s, rdp->settings->share_id); /* shareId (4 bytes) */ - stream_read_uint16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */ - stream_read_uint16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ + stream_read_UINT32(s, rdp->settings->share_id); /* shareId (4 bytes) */ + stream_read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */ + stream_read_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ stream_seek(s, lengthSourceDescriptor); /* sourceDescriptor */ - stream_read_uint16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ + stream_read_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ stream_seek(s, 2); /* pad2Octets (2 bytes) */ /* capabilitySets */ if (!rdp_read_capability_sets(s, rdp->settings, numberCapabilities)) { printf("rdp_read_capability_sets failed\n"); - return false; + return FALSE; } - rdp->update->secondary->glyph_v2 = (rdp->settings->glyphSupportLevel > GLYPH_SUPPORT_FULL) ? true : false; + rdp->update->secondary->glyph_v2 = (rdp->settings->glyphSupportLevel > GLYPH_SUPPORT_FULL) ? TRUE : FALSE; - return true; + return TRUE; } void rdp_write_demand_active(STREAM* s, rdpSettings* settings) { - uint8 *bm, *em, *lm; - uint16 numberCapabilities; - uint16 lengthCombinedCapabilities; + BYTE *bm, *em, *lm; + UINT16 numberCapabilities; + UINT16 lengthCombinedCapabilities; - stream_write_uint32(s, settings->share_id); /* shareId (4 bytes) */ - stream_write_uint16(s, 4); /* lengthSourceDescriptor (2 bytes) */ + stream_write_UINT32(s, settings->share_id); /* shareId (4 bytes) */ + stream_write_UINT16(s, 4); /* lengthSourceDescriptor (2 bytes) */ stream_get_mark(s, lm); - stream_seek_uint16(s); /* lengthCombinedCapabilities (2 bytes) */ + stream_seek_UINT16(s); /* lengthCombinedCapabilities (2 bytes) */ stream_write(s, "RDP", 4); /* sourceDescriptor */ stream_get_mark(s, bm); - stream_seek_uint16(s); /* numberCapabilities (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_seek_UINT16(s); /* numberCapabilities (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ numberCapabilities = 14; rdp_write_general_capability_set(s, settings); @@ -1956,17 +1956,17 @@ void rdp_write_demand_active(STREAM* s, rdpSettings* settings) stream_set_mark(s, lm); /* go back to lengthCombinedCapabilities */ lengthCombinedCapabilities = (em - bm); - stream_write_uint16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ + stream_write_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ stream_set_mark(s, bm); /* go back to numberCapabilities */ - stream_write_uint16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ + stream_write_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ stream_set_mark(s, em); - stream_write_uint32(s, 0); /* sessionId */ + stream_write_UINT32(s, 0); /* sessionId */ } -boolean rdp_send_demand_active(rdpRdp* rdp) +BOOL rdp_send_demand_active(rdpRdp* rdp) { STREAM* s; @@ -1978,23 +1978,23 @@ boolean rdp_send_demand_active(rdpRdp* rdp) rdp_send_pdu(rdp, s, PDU_TYPE_DEMAND_ACTIVE, rdp->mcs->user_id); - return true; + return TRUE; } -boolean rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s) { - uint16 length; - uint16 channelId; - uint16 pduType; - uint16 pduLength; - uint16 pduSource; - uint16 lengthSourceDescriptor; - uint16 lengthCombinedCapabilities; - uint16 numberCapabilities; - uint16 securityFlags; + UINT16 length; + UINT16 channelId; + UINT16 pduType; + UINT16 pduLength; + UINT16 pduSource; + UINT16 lengthSourceDescriptor; + UINT16 lengthCombinedCapabilities; + UINT16 numberCapabilities; + UINT16 securityFlags; if (!rdp_read_header(rdp, s, &length, &channelId)) - return false; + return FALSE; if (rdp->settings->encryption) { @@ -2004,56 +2004,56 @@ boolean rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s) if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { printf("rdp_decrypt failed\n"); - return false; + return FALSE; } } } if (channelId != MCS_GLOBAL_CHANNEL_ID) - return false; + return FALSE; if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) - return false; + return FALSE; rdp->settings->pdu_source = pduSource; if (pduType != PDU_TYPE_CONFIRM_ACTIVE) - return false; + return FALSE; - stream_seek_uint32(s); /* shareId (4 bytes) */ - stream_seek_uint16(s); /* originatorId (2 bytes) */ - stream_read_uint16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */ - stream_read_uint16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ + stream_seek_UINT32(s); /* shareId (4 bytes) */ + stream_seek_UINT16(s); /* originatorId (2 bytes) */ + stream_read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */ + stream_read_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ stream_seek(s, lengthSourceDescriptor); /* sourceDescriptor */ - stream_read_uint16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ + stream_read_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ stream_seek(s, 2); /* pad2Octets (2 bytes) */ if (!rdp_read_capability_sets(s, rdp->settings, numberCapabilities)) - return false; + return FALSE; - return true; + return TRUE; } void rdp_write_confirm_active(STREAM* s, rdpSettings* settings) { - uint8 *bm, *em, *lm; - uint16 numberCapabilities; - uint16 lengthSourceDescriptor; - uint16 lengthCombinedCapabilities; + BYTE *bm, *em, *lm; + UINT16 numberCapabilities; + UINT16 lengthSourceDescriptor; + UINT16 lengthCombinedCapabilities; lengthSourceDescriptor = sizeof(SOURCE_DESCRIPTOR); - stream_write_uint32(s, settings->share_id); /* shareId (4 bytes) */ - stream_write_uint16(s, 0x03EA); /* originatorId (2 bytes) */ - stream_write_uint16(s, lengthSourceDescriptor);/* lengthSourceDescriptor (2 bytes) */ + stream_write_UINT32(s, settings->share_id); /* shareId (4 bytes) */ + stream_write_UINT16(s, 0x03EA); /* originatorId (2 bytes) */ + stream_write_UINT16(s, lengthSourceDescriptor);/* lengthSourceDescriptor (2 bytes) */ stream_get_mark(s, lm); - stream_seek_uint16(s); /* lengthCombinedCapabilities (2 bytes) */ + stream_seek_UINT16(s); /* lengthCombinedCapabilities (2 bytes) */ stream_write(s, SOURCE_DESCRIPTOR, lengthSourceDescriptor); /* sourceDescriptor */ stream_get_mark(s, bm); - stream_seek_uint16(s); /* numberCapabilities (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_seek_UINT16(s); /* numberCapabilities (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ /* Capability Sets */ numberCapabilities = 15; @@ -2146,15 +2146,15 @@ void rdp_write_confirm_active(STREAM* s, rdpSettings* settings) stream_set_mark(s, lm); /* go back to lengthCombinedCapabilities */ lengthCombinedCapabilities = (em - bm); - stream_write_uint16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ + stream_write_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */ stream_set_mark(s, bm); /* go back to numberCapabilities */ - stream_write_uint16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ + stream_write_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */ stream_set_mark(s, em); } -boolean rdp_send_confirm_active(rdpRdp* rdp) +BOOL rdp_send_confirm_active(rdpRdp* rdp) { STREAM* s; diff --git a/libfreerdp/core/capabilities.h b/libfreerdp/core/capabilities.h index 420d69ced..69c2c9353 100644 --- a/libfreerdp/core/capabilities.h +++ b/libfreerdp/core/capabilities.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Capability Sets * * Copyright 2011 Marc-Andre Moreau @@ -163,11 +163,11 @@ #define CLW_ENTROPY_RLGR1 0x01 #define CLW_ENTROPY_RLGR3 0x04 -boolean rdp_recv_demand_active(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_demand_active(rdpRdp* rdp, STREAM* s); void rdp_write_demand_active(STREAM* s, rdpSettings* settings); -boolean rdp_send_demand_active(rdpRdp* rdp); -boolean rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_demand_active(rdpRdp* rdp); +BOOL rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s); void rdp_write_confirm_active(STREAM* s, rdpSettings* settings); -boolean rdp_send_confirm_active(rdpRdp* rdp); +BOOL rdp_send_confirm_active(rdpRdp* rdp); #endif /* __CAPABILITIES_H */ diff --git a/libfreerdp/core/certificate.c b/libfreerdp/core/certificate.c index 1f28616ff..5f65790f7 100644 --- a/libfreerdp/core/certificate.c +++ b/libfreerdp/core/certificate.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Certificate Handling * * Copyright 2011 Jiten Pathy @@ -131,8 +131,8 @@ void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info) { STREAM* s; int length; - uint8 padding; - uint32 version; + BYTE padding; + UINT32 version; int modulus_length; int exponent_length; @@ -144,7 +144,7 @@ void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info) ber_read_sequence_tag(s, &length); /* TBSCertificate (SEQUENCE) */ /* Explicit Contextual Tag [0] */ - ber_read_contextual_tag(s, 0, &length, true); + ber_read_contextual_tag(s, 0, &length, TRUE); ber_read_integer(s, &version); /* version (INTEGER) */ version++; @@ -185,7 +185,7 @@ void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info) /* skip zero padding, if any */ do { - stream_peek_uint8(s, padding); + stream_peek_BYTE(s, padding); if (padding == 0) { @@ -214,11 +214,11 @@ void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info) * @return new X.509 certificate chain */ -rdpX509CertChain* certificate_new_x509_certificate_chain(uint32 count) +rdpX509CertChain* certificate_new_x509_certificate_chain(UINT32 count) { rdpX509CertChain* x509_cert_chain; - x509_cert_chain = (rdpX509CertChain*) xmalloc(sizeof(rdpX509CertChain)); + x509_cert_chain = (rdpX509CertChain*) malloc(sizeof(rdpX509CertChain)); x509_cert_chain->count = count; x509_cert_chain->array = (rdpCertBlob*) xzalloc(sizeof(rdpCertBlob) * count); @@ -240,33 +240,33 @@ void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain) for (i = 0; i < (int) x509_cert_chain->count; i++) { if (x509_cert_chain->array[i].data != NULL) - xfree(x509_cert_chain->array[i].data); + free(x509_cert_chain->array[i].data); } - xfree(x509_cert_chain->array); - xfree(x509_cert_chain); + free(x509_cert_chain->array); + free(x509_cert_chain); } } -static boolean certificate_process_server_public_key(rdpCertificate* certificate, STREAM* s, uint32 length) +static BOOL certificate_process_server_public_key(rdpCertificate* certificate, STREAM* s, UINT32 length) { - uint8 magic[4]; - uint32 keylen; - uint32 bitlen; - uint32 datalen; - uint32 modlen; + BYTE magic[4]; + UINT32 keylen; + UINT32 bitlen; + UINT32 datalen; + UINT32 modlen; stream_read(s, magic, 4); if (memcmp(magic, "RSA1", 4) != 0) { printf("gcc_process_server_public_key: magic error\n"); - return false; + return FALSE; } - stream_read_uint32(s, keylen); - stream_read_uint32(s, bitlen); - stream_read_uint32(s, datalen); + stream_read_UINT32(s, keylen); + stream_read_UINT32(s, bitlen); + stream_read_UINT32(s, datalen); stream_read(s, certificate->cert_info.exponent, 4); modlen = keylen - 8; @@ -276,16 +276,16 @@ static boolean certificate_process_server_public_key(rdpCertificate* certificate /* 8 bytes of zero padding */ stream_seek(s, 8); - return true; + return TRUE; } -static boolean certificate_process_server_public_signature(rdpCertificate* certificate, uint8* sigdata, int sigdatalen, STREAM* s, uint32 siglen) +static BOOL certificate_process_server_public_signature(rdpCertificate* certificate, BYTE* sigdata, int sigdatalen, STREAM* s, UINT32 siglen) { int i, sum; CryptoMd5 md5ctx; - uint8 sig[TSSK_KEY_LENGTH]; - uint8 encsig[TSSK_KEY_LENGTH + 8]; - uint8 md5hash[CRYPTO_MD5_DIGEST_LENGTH]; + BYTE sig[TSSK_KEY_LENGTH]; + BYTE encsig[TSSK_KEY_LENGTH + 8]; + BYTE md5hash[CRYPTO_MD5_DIGEST_LENGTH]; md5ctx = crypto_md5_init(); crypto_md5_update(md5ctx, sigdata, sigdatalen); @@ -301,7 +301,7 @@ static boolean certificate_process_server_public_signature(rdpCertificate* certi if (sum != 0) { printf("certificate_process_server_public_signature: invalid signature\n"); - //return false; + //return FALSE; } siglen -= 8; @@ -312,7 +312,7 @@ static boolean certificate_process_server_public_signature(rdpCertificate* certi if (memcmp(md5hash, sig, sizeof(md5hash)) != 0) { printf("certificate_process_server_public_signature: invalid signature\n"); - //return false; + //return FALSE; } /* @@ -328,10 +328,10 @@ static boolean certificate_process_server_public_signature(rdpCertificate* certi if (sig[16] != 0x00 || sum != 0xFF * (62 - 17) || sig[62] != 0x01) { printf("certificate_process_server_public_signature: invalid signature\n"); - //return false; + //return FALSE; } - return true; + return TRUE; } /** @@ -340,68 +340,68 @@ static boolean certificate_process_server_public_signature(rdpCertificate* certi * @param s stream */ -boolean certificate_read_server_proprietary_certificate(rdpCertificate* certificate, STREAM* s) +BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate, STREAM* s) { - uint32 dwSigAlgId; - uint32 dwKeyAlgId; - uint32 wPublicKeyBlobType; - uint32 wPublicKeyBlobLen; - uint32 wSignatureBlobType; - uint32 wSignatureBlobLen; - uint8* sigdata; + UINT32 dwSigAlgId; + UINT32 dwKeyAlgId; + UINT32 wPublicKeyBlobType; + UINT32 wPublicKeyBlobLen; + UINT32 wSignatureBlobType; + UINT32 wSignatureBlobLen; + BYTE* sigdata; int sigdatalen; /* -4, because we need to include dwVersion */ sigdata = stream_get_tail(s) - 4; - stream_read_uint32(s, dwSigAlgId); - stream_read_uint32(s, dwKeyAlgId); + stream_read_UINT32(s, dwSigAlgId); + stream_read_UINT32(s, dwKeyAlgId); if (!(dwSigAlgId == SIGNATURE_ALG_RSA && dwKeyAlgId == KEY_EXCHANGE_ALG_RSA)) { printf("certificate_read_server_proprietary_certificate: parse error 1\n"); - return false; + return FALSE; } - stream_read_uint16(s, wPublicKeyBlobType); + stream_read_UINT16(s, wPublicKeyBlobType); if (wPublicKeyBlobType != BB_RSA_KEY_BLOB) { printf("certificate_read_server_proprietary_certificate: parse error 2\n"); - return false; + return FALSE; } - stream_read_uint16(s, wPublicKeyBlobLen); + stream_read_UINT16(s, wPublicKeyBlobLen); if (!certificate_process_server_public_key(certificate, s, wPublicKeyBlobLen)) { printf("certificate_read_server_proprietary_certificate: parse error 3\n"); - return false; + return FALSE; } sigdatalen = stream_get_tail(s) - sigdata; - stream_read_uint16(s, wSignatureBlobType); + stream_read_UINT16(s, wSignatureBlobType); if (wSignatureBlobType != BB_RSA_SIGNATURE_BLOB) { printf("certificate_read_server_proprietary_certificate: parse error 4\n"); - return false; + return FALSE; } - stream_read_uint16(s, wSignatureBlobLen); + stream_read_UINT16(s, wSignatureBlobLen); if (wSignatureBlobLen != 72) { printf("certificate_process_server_public_signature: invalid signature length (got %d, expected %d)\n", wSignatureBlobLen, 64); - return false; + return FALSE; } if (!certificate_process_server_public_signature(certificate, sigdata, sigdatalen, s, wSignatureBlobLen)) { printf("certificate_read_server_proprietary_certificate: parse error 5\n"); - return false; + return FALSE; } - return true; + return TRUE; } /** @@ -410,25 +410,25 @@ boolean certificate_read_server_proprietary_certificate(rdpCertificate* certific * @param s stream */ -boolean certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, STREAM* s) +BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, STREAM* s) { int i; - uint32 certLength; - uint32 numCertBlobs; + UINT32 certLength; + UINT32 numCertBlobs; DEBUG_CERTIFICATE("Server X.509 Certificate Chain"); - stream_read_uint32(s, numCertBlobs); /* numCertBlobs */ + stream_read_UINT32(s, numCertBlobs); /* numCertBlobs */ certificate->x509_cert_chain = certificate_new_x509_certificate_chain(numCertBlobs); for (i = 0; i < (int) numCertBlobs; i++) { - stream_read_uint32(s, certLength); + stream_read_UINT32(s, certLength); DEBUG_CERTIFICATE("\nX.509 Certificate #%d, length:%d", i + 1, certLength); - certificate->x509_cert_chain->array[i].data = (uint8*) xmalloc(certLength); + certificate->x509_cert_chain->array[i].data = (BYTE*) malloc(certLength); stream_read(s, certificate->x509_cert_chain->array[i].data, certLength); certificate->x509_cert_chain->array[i].length = certLength; @@ -448,7 +448,7 @@ boolean certificate_read_server_x509_certificate_chain(rdpCertificate* certifica } } - return true; + return TRUE; } /** @@ -458,21 +458,21 @@ boolean certificate_read_server_x509_certificate_chain(rdpCertificate* certifica * @param length certificate length */ -boolean certificate_read_server_certificate(rdpCertificate* certificate, uint8* server_cert, int length) +BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length) { STREAM* s; - uint32 dwVersion; + UINT32 dwVersion; if (length < 1) { DEBUG_CERTIFICATE("null server certificate\n"); - return false; + return FALSE; } s = stream_new(0); stream_attach(s, server_cert, length); - stream_read_uint32(s, dwVersion); /* dwVersion (4 bytes) */ + stream_read_UINT32(s, dwVersion); /* dwVersion (4 bytes) */ switch (dwVersion & CERT_CHAIN_VERSION_MASK) { @@ -489,8 +489,8 @@ boolean certificate_read_server_certificate(rdpCertificate* certificate, uint8* break; } - xfree(s); - return true; + free(s); + return TRUE; } rdpKey* key_new(const char* keyfile) @@ -509,7 +509,7 @@ rdpKey* key_new(const char* keyfile) if (fp == NULL) { printf("unable to load RSA key from %s: %s.", keyfile, strerror(errno)); - xfree(key) ; + free(key) ; return NULL; } @@ -519,7 +519,7 @@ rdpKey* key_new(const char* keyfile) { ERR_print_errors_fp(stdout); fclose(fp); - xfree(key) ; + free(key) ; return NULL; } @@ -530,7 +530,7 @@ rdpKey* key_new(const char* keyfile) case 0: RSA_free(rsa); printf("invalid RSA key in %s", keyfile); - xfree(key) ; + free(key) ; return NULL; case 1: @@ -540,7 +540,7 @@ rdpKey* key_new(const char* keyfile) default: ERR_print_errors_fp(stdout); RSA_free(rsa); - xfree(key) ; + free(key) ; return NULL; } @@ -548,7 +548,7 @@ rdpKey* key_new(const char* keyfile) { RSA_free(rsa); printf("RSA public exponent too large in %s", keyfile); - xfree(key) ; + free(key) ; return NULL; } @@ -577,7 +577,7 @@ void key_free(rdpKey* key) { free(key->Modulus); free(key->PrivateExponent); - xfree(key); + free(key); } } @@ -615,6 +615,6 @@ void certificate_free(rdpCertificate* certificate) if (certificate->cert_info.Modulus != NULL) free(certificate->cert_info.Modulus); - xfree(certificate); + free(certificate); } } diff --git a/libfreerdp/core/certificate.h b/libfreerdp/core/certificate.h index 8ebaa6eaf..00bbf6e0f 100644 --- a/libfreerdp/core/certificate.h +++ b/libfreerdp/core/certificate.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Certificate Handling * * Copyright 2011 Marc-Andre Moreau @@ -44,12 +44,12 @@ void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info); -rdpX509CertChain* certificate_new_x509_certificate_chain(uint32 count); +rdpX509CertChain* certificate_new_x509_certificate_chain(UINT32 count); void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain); -boolean certificate_read_server_proprietary_certificate(rdpCertificate* certificate, STREAM* s); -boolean certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, STREAM* s); -boolean certificate_read_server_certificate(rdpCertificate* certificate, uint8* server_cert, int length); +BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate, STREAM* s); +BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, STREAM* s); +BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length); rdpCertificate* certificate_new(); void certificate_free(rdpCertificate* certificate); diff --git a/libfreerdp/core/channel.c b/libfreerdp/core/channel.c index 824c9768d..9feb0225d 100644 --- a/libfreerdp/core/channel.c +++ b/libfreerdp/core/channel.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Virtual Channels * * Copyright 2011 Vic Lee @@ -34,10 +34,10 @@ #include "rdp.h" #include "channel.h" -boolean freerdp_channel_send(rdpRdp* rdp, uint16 channel_id, uint8* data, int size) +BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channel_id, BYTE* data, int size) { STREAM* s; - uint32 flags; + UINT32 flags; int i, left; int chunk_size; rdpChannel* channel = NULL; @@ -54,7 +54,7 @@ boolean freerdp_channel_send(rdpRdp* rdp, uint16 channel_id, uint8* data, int si if (channel == NULL) { printf("freerdp_channel_send: unknown channel_id %d\n", channel_id); - return false; + return FALSE; } flags = CHANNEL_FLAG_FIRST; @@ -77,8 +77,8 @@ boolean freerdp_channel_send(rdpRdp* rdp, uint16 channel_id, uint8* data, int si flags |= CHANNEL_FLAG_SHOW_PROTOCOL; } - stream_write_uint32(s, size); - stream_write_uint32(s, flags); + stream_write_UINT32(s, size); + stream_write_UINT32(s, flags); stream_check_size(s, chunk_size); stream_write(s, data, chunk_size); @@ -89,31 +89,31 @@ boolean freerdp_channel_send(rdpRdp* rdp, uint16 channel_id, uint8* data, int si flags = 0; } - return true; + return TRUE; } -void freerdp_channel_process(freerdp* instance, STREAM* s, uint16 channel_id) +void freerdp_channel_process(freerdp* instance, STREAM* s, UINT16 channel_id) { - uint32 length; - uint32 flags; + UINT32 length; + UINT32 flags; int chunk_length; - stream_read_uint32(s, length); - stream_read_uint32(s, flags); + stream_read_UINT32(s, length); + stream_read_UINT32(s, flags); chunk_length = stream_get_left(s); IFCALL(instance->ReceiveChannelData, instance, channel_id, stream_get_tail(s), chunk_length, flags, length); } -void freerdp_channel_peer_process(freerdp_peer* client, STREAM* s, uint16 channel_id) +void freerdp_channel_peer_process(freerdp_peer* client, STREAM* s, UINT16 channel_id) { - uint32 length; - uint32 flags; + UINT32 length; + UINT32 flags; int chunk_length; - stream_read_uint32(s, length); - stream_read_uint32(s, flags); + stream_read_UINT32(s, length); + stream_read_UINT32(s, flags); chunk_length = stream_get_left(s); IFCALL(client->ReceiveChannelData, client, diff --git a/libfreerdp/core/channel.h b/libfreerdp/core/channel.h index 3632247c4..0e8d8fe3a 100644 --- a/libfreerdp/core/channel.h +++ b/libfreerdp/core/channel.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Virtual Channels * * Copyright 2011 Vic Lee @@ -20,8 +20,8 @@ #ifndef __CHANNEL_H #define __CHANNEL_H -boolean freerdp_channel_send(rdpRdp* rdp, uint16 channel_id, uint8* data, int size); -void freerdp_channel_process(freerdp* instance, STREAM* s, uint16 channel_id); -void freerdp_channel_peer_process(freerdp_peer* client, STREAM* s, uint16 channel_id); +BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channel_id, BYTE* data, int size); +void freerdp_channel_process(freerdp* instance, STREAM* s, UINT16 channel_id); +void freerdp_channel_peer_process(freerdp_peer* client, STREAM* s, UINT16 channel_id); #endif /* __CHANNEL_H */ diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index be17767a4..afe472ab3 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -1,5 +1,5 @@ /* - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Connection Sequence * * Copyright 2011 Marc-Andre Moreau @@ -27,6 +27,8 @@ #include "connection.h" #include "transport.h" +#include + #include /** @@ -63,10 +65,10 @@ * Establish RDP Connection based on the settings given in the 'rdp' paremeter. * @msdn{cc240452} * @param rdp RDP module - * @return true if the connection succeeded. false otherwise. + * @return true if the connection succeeded. FALSE otherwise. */ -boolean rdp_client_connect(rdpRdp* rdp) +BOOL rdp_client_connect(rdpRdp* rdp) { rdpSettings* settings = rdp->settings; @@ -86,17 +88,17 @@ boolean rdp_client_connect(rdpRdp* rdp) if (!nego_connect(rdp->nego)) { printf("Error: protocol security negotiation or connection failure\n"); - return false; + return FALSE; } if ((rdp->nego->selected_protocol & PROTOCOL_TLS) || (rdp->nego->selected_protocol == PROTOCOL_RDP)) { if ((settings->username != NULL) && ((settings->password != NULL) || (settings->password_cookie != NULL && settings->password_cookie_length > 0))) - settings->autologon = true; + settings->autologon = TRUE; } - rdp_set_blocking_mode(rdp, false); + rdp_set_blocking_mode(rdp, FALSE); rdp->state = CONNECTION_STATE_NEGO; rdp->finalize_sc_pdus = 0; @@ -107,26 +109,26 @@ boolean rdp_client_connect(rdpRdp* rdp) connectErrorCode = MCSCONNECTINITIALERROR; } printf("Error: unable to send MCS Connect Initial\n"); - return false; + return FALSE; } - rdp->transport->process_single_pdu = true; + rdp->transport->process_single_pdu = TRUE; while (rdp->state != CONNECTION_STATE_ACTIVE) { if (rdp_check_fds(rdp) < 0) - return false; + return FALSE; } - rdp->transport->process_single_pdu = false; + rdp->transport->process_single_pdu = FALSE; - return true; + return TRUE; } -boolean rdp_client_disconnect(rdpRdp* rdp) +BOOL rdp_client_disconnect(rdpRdp* rdp) { return transport_disconnect(rdp->transport); } -boolean rdp_client_redirect(rdpRdp* rdp) +BOOL rdp_client_redirect(rdpRdp* rdp) { rdpSettings* settings = rdp->settings; rdpRedirection* redirection = rdp->redirection; @@ -146,7 +148,7 @@ boolean rdp_client_redirect(rdpRdp* rdp) free(settings->server_random); free(settings->server_certificate); - xfree(settings->ip_address); + free(settings->ip_address); rdp->transport = transport_new(settings); rdp->license = license_new(rdp); @@ -164,31 +166,31 @@ boolean rdp_client_redirect(rdpRdp* rdp) { if (redirection->flags & LB_TARGET_NET_ADDRESS) { - xfree(settings->hostname); - settings->hostname = xstrdup(redirection->targetNetAddress.ascii); + free(settings->hostname); + settings->hostname = _strdup(redirection->targetNetAddress.ascii); } else if (redirection->flags & LB_TARGET_FQDN) { - xfree(settings->hostname); - settings->hostname = xstrdup(redirection->targetFQDN.ascii); + free(settings->hostname); + settings->hostname = _strdup(redirection->targetFQDN.ascii); } else if (redirection->flags & LB_TARGET_NETBIOS_NAME) { - xfree(settings->hostname); - settings->hostname = xstrdup(redirection->targetNetBiosName.ascii); + free(settings->hostname); + settings->hostname = _strdup(redirection->targetNetBiosName.ascii); } } if (redirection->flags & LB_USERNAME) { - xfree(settings->username); - settings->username = xstrdup(redirection->username.ascii); + free(settings->username); + settings->username = _strdup(redirection->username.ascii); } if (redirection->flags & LB_DOMAIN) { - xfree(settings->domain); - settings->domain = xstrdup(redirection->domain.ascii); + free(settings->domain); + settings->domain = _strdup(redirection->domain.ascii); } if (redirection->flags & LB_PASSWORD) @@ -200,20 +202,20 @@ boolean rdp_client_redirect(rdpRdp* rdp) return rdp_client_connect(rdp); } -static boolean rdp_client_establish_keys(rdpRdp* rdp) +static BOOL rdp_client_establish_keys(rdpRdp* rdp) { - uint8 client_random[CLIENT_RANDOM_LENGTH]; - uint8 crypt_client_random[256 + 8]; - uint32 key_len; - uint8* mod; - uint8* exp; - uint32 length; + BYTE client_random[CLIENT_RANDOM_LENGTH]; + BYTE crypt_client_random[256 + 8]; + UINT32 key_len; + BYTE* mod; + BYTE* exp; + UINT32 length; STREAM* s; - if (rdp->settings->encryption == false) + if (rdp->settings->encryption == FALSE) { /* no RDP encryption */ - return true; + return TRUE; } /* encrypt client random */ @@ -230,58 +232,58 @@ static boolean rdp_client_establish_keys(rdpRdp* rdp) rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID); rdp_write_security_header(s, SEC_EXCHANGE_PKT); length = key_len + 8; - stream_write_uint32(s, length); + stream_write_UINT32(s, length); stream_write(s, crypt_client_random, length); if (transport_write(rdp->mcs->transport, s) < 0) { - return false; + return FALSE; } /* now calculate encrypt / decrypt and update keys */ if (!security_establish_keys(client_random, rdp)) { - return false; + return FALSE; } - rdp->do_crypt = true; + rdp->do_crypt = TRUE; if (rdp->settings->salted_checksum) - rdp->do_secure_checksum = true; + rdp->do_secure_checksum = TRUE; if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS) { - uint8 fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; + BYTE fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; rdp->fips_encrypt = crypto_des3_encrypt_init(rdp->fips_encrypt_key, fips_ivec); rdp->fips_decrypt = crypto_des3_decrypt_init(rdp->fips_decrypt_key, fips_ivec); rdp->fips_hmac = crypto_hmac_new(); - return true; + return TRUE; } rdp->rc4_decrypt_key = crypto_rc4_init(rdp->decrypt_key, rdp->rc4_key_len); rdp->rc4_encrypt_key = crypto_rc4_init(rdp->encrypt_key, rdp->rc4_key_len); - return true; + return TRUE; } -static boolean rdp_server_establish_keys(rdpRdp* rdp, STREAM* s) +static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s) { - uint8 client_random[64]; /* Should be only 32 after successful decryption, but on failure might take up to 64 bytes. */ - uint8 crypt_client_random[256 + 8]; - uint32 rand_len, key_len; - uint16 channel_id, length, sec_flags; - uint8* mod; - uint8* priv_exp; + BYTE client_random[64]; /* Should be only 32 after successful decryption, but on failure might take up to 64 bytes. */ + BYTE crypt_client_random[256 + 8]; + UINT32 rand_len, key_len; + UINT16 channel_id, length, sec_flags; + BYTE* mod; + BYTE* priv_exp; - if (rdp->settings->encryption == false) + if (rdp->settings->encryption == FALSE) { /* No RDP Security. */ - return true; + return TRUE; } if (!rdp_read_header(rdp, s, &length, &channel_id)) { printf("rdp_server_establish_keys: invalid RDP header\n"); - return false; + return FALSE; } rdp_read_security_header(s, &sec_flags); @@ -289,16 +291,16 @@ static boolean rdp_server_establish_keys(rdpRdp* rdp, STREAM* s) if ((sec_flags & SEC_EXCHANGE_PKT) == 0) { printf("rdp_server_establish_keys: missing SEC_EXCHANGE_PKT in security header\n"); - return false; + return FALSE; } - stream_read_uint32(s, rand_len); + stream_read_UINT32(s, rand_len); key_len = rdp->settings->server_key->ModulusLength; if (rand_len != key_len + 8) { printf("rdp_server_establish_keys: invalid encrypted client random length\n"); - return false; + return FALSE; } memset(crypt_client_random, 0, sizeof(crypt_client_random)); @@ -312,91 +314,91 @@ static boolean rdp_server_establish_keys(rdpRdp* rdp, STREAM* s) /* now calculate encrypt / decrypt and update keys */ if (!security_establish_keys(client_random, rdp)) { - return false; + return FALSE; } - rdp->do_crypt = true; + rdp->do_crypt = TRUE; if (rdp->settings->salted_checksum) - rdp->do_secure_checksum = true; + rdp->do_secure_checksum = TRUE; if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS) { - uint8 fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; + BYTE fips_ivec[8] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; rdp->fips_encrypt = crypto_des3_encrypt_init(rdp->fips_encrypt_key, fips_ivec); rdp->fips_decrypt = crypto_des3_decrypt_init(rdp->fips_decrypt_key, fips_ivec); rdp->fips_hmac = crypto_hmac_new(); - return true; + return TRUE; } rdp->rc4_decrypt_key = crypto_rc4_init(rdp->decrypt_key, rdp->rc4_key_len); rdp->rc4_encrypt_key = crypto_rc4_init(rdp->encrypt_key, rdp->rc4_key_len); - return true; + return TRUE; } -boolean rdp_client_connect_mcs_connect_response(rdpRdp* rdp, STREAM* s) +BOOL rdp_client_connect_mcs_connect_response(rdpRdp* rdp, STREAM* s) { if (!mcs_recv_connect_response(rdp->mcs, s)) { printf("rdp_client_connect_mcs_connect_response: mcs_recv_connect_response failed\n"); - return false; + return FALSE; } if (!mcs_send_erect_domain_request(rdp->mcs)) - return false; + return FALSE; if (!mcs_send_attach_user_request(rdp->mcs)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_MCS_ATTACH_USER; - return true; + return TRUE; } -boolean rdp_client_connect_mcs_attach_user_confirm(rdpRdp* rdp, STREAM* s) +BOOL rdp_client_connect_mcs_attach_user_confirm(rdpRdp* rdp, STREAM* s) { if (!mcs_recv_attach_user_confirm(rdp->mcs, s)) - return false; + return FALSE; if (!mcs_send_channel_join_request(rdp->mcs, rdp->mcs->user_id)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_MCS_CHANNEL_JOIN; - return true; + return TRUE; } -boolean rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s) +BOOL rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s) { int i; - uint16 channel_id; - boolean all_joined = true; + UINT16 channel_id; + BOOL all_joined = TRUE; if (!mcs_recv_channel_join_confirm(rdp->mcs, s, &channel_id)) - return false; + return FALSE; if (!rdp->mcs->user_channel_joined) { if (channel_id != rdp->mcs->user_id) - return false; - rdp->mcs->user_channel_joined = true; + return FALSE; + rdp->mcs->user_channel_joined = TRUE; if (!mcs_send_channel_join_request(rdp->mcs, MCS_GLOBAL_CHANNEL_ID)) - return false; + return FALSE; } else if (!rdp->mcs->global_channel_joined) { if (channel_id != MCS_GLOBAL_CHANNEL_ID) - return false; - rdp->mcs->global_channel_joined = true; + return FALSE; + rdp->mcs->global_channel_joined = TRUE; if (rdp->settings->num_channels > 0) { if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[0].channel_id)) - return false; + return FALSE; - all_joined = false; + all_joined = FALSE; } } else @@ -407,41 +409,41 @@ boolean rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s) continue; if (rdp->settings->channels[i].channel_id != channel_id) - return false; + return FALSE; - rdp->settings->channels[i].joined = true; + rdp->settings->channels[i].joined = TRUE; break; } if (i + 1 < rdp->settings->num_channels) { if (!mcs_send_channel_join_request(rdp->mcs, rdp->settings->channels[i + 1].channel_id)) - return false; + return FALSE; - all_joined = false; + all_joined = FALSE; } } if (rdp->mcs->user_channel_joined && rdp->mcs->global_channel_joined && all_joined) { if (!rdp_client_establish_keys(rdp)) - return false; + return FALSE; if (!rdp_send_client_info(rdp)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_LICENSE; } - return true; + return TRUE; } -boolean rdp_client_connect_license(rdpRdp* rdp, STREAM* s) +BOOL rdp_client_connect_license(rdpRdp* rdp, STREAM* s) { if (!license_recv(rdp->license, s)) - return false; + return FALSE; if (rdp->license->state == LICENSE_STATE_ABORTED) { printf("license connection sequence aborted.\n"); - return false; + return FALSE; } if (rdp->license->state == LICENSE_STATE_COMPLETED) @@ -449,14 +451,14 @@ boolean rdp_client_connect_license(rdpRdp* rdp, STREAM* s) rdp->state = CONNECTION_STATE_CAPABILITY; } - return true; + return TRUE; } -boolean rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s) +BOOL rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s) { - uint8* mark; - uint16 width; - uint16 height; + BYTE* mark; + UINT16 width; + UINT16 height; width = rdp->settings->width; height = rdp->settings->height; @@ -468,17 +470,17 @@ boolean rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s) stream_set_mark(s, mark); stream_seek(s, RDP_PACKET_HEADER_MAX_LENGTH); - if (rdp_recv_out_of_sequence_pdu(rdp, s) != true) - return false; + if (rdp_recv_out_of_sequence_pdu(rdp, s) != TRUE) + return FALSE; - return true; + return TRUE; } if (rdp->disconnect) - return true; + return TRUE; if (!rdp_send_confirm_active(rdp)) - return false; + return FALSE; input_register_client_callbacks(rdp->input); @@ -496,10 +498,10 @@ boolean rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s) rdp_client_connect_finalize(rdp); - return true; + return TRUE; } -boolean rdp_client_connect_finalize(rdpRdp* rdp) +BOOL rdp_client_connect_finalize(rdpRdp* rdp) { /** * [MS-RDPBCGR] 1.3.1.1 - 8. @@ -508,28 +510,28 @@ boolean rdp_client_connect_finalize(rdpRdp* rdp) */ if (!rdp_send_client_synchronize_pdu(rdp)) - return false; + return FALSE; if (!rdp_send_client_control_pdu(rdp, CTRLACTION_COOPERATE)) - return false; + return FALSE; if (!rdp_send_client_control_pdu(rdp, CTRLACTION_REQUEST_CONTROL)) - return false; + return FALSE; if (!rdp_send_client_persistent_key_list_pdu(rdp)) - return false; + return FALSE; if (!rdp_send_client_font_list_pdu(rdp, FONTLIST_FIRST | FONTLIST_LAST)) - return false; + return FALSE; - return true; + return TRUE; } -boolean rdp_server_accept_nego(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_nego(rdpRdp* rdp, STREAM* s) { - boolean status; + BOOL status; rdpSettings* settings = rdp->settings; - transport_set_blocking_mode(rdp->transport, true); + transport_set_blocking_mode(rdp->transport, TRUE); if (!nego_read_request(rdp->nego, s)) - return false; + return FALSE; rdp->nego->selected_protocol = 0; @@ -564,9 +566,9 @@ boolean rdp_server_accept_nego(rdpRdp* rdp, STREAM* s) (rdp->nego->selected_protocol == PROTOCOL_RDP) ? 1: 0); if (!nego_send_negotiation_response(rdp->nego)) - return false; + return FALSE; - status = false; + status = FALSE; if (rdp->nego->selected_protocol & PROTOCOL_NLA) status = transport_accept_nla(rdp->transport); else if (rdp->nego->selected_protocol & PROTOCOL_TLS) @@ -575,21 +577,21 @@ boolean rdp_server_accept_nego(rdpRdp* rdp, STREAM* s) status = transport_accept_rdp(rdp->transport); if (!status) - return false; + return FALSE; - transport_set_blocking_mode(rdp->transport, false); + transport_set_blocking_mode(rdp->transport, FALSE); rdp->state = CONNECTION_STATE_NEGO; - return true; + return TRUE; } -boolean rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, STREAM* s) { int i; if (!mcs_recv_connect_initial(rdp->mcs, s)) - return false; + return FALSE; printf("Accepted client: %s\n", rdp->settings->client_hostname); printf("Accepted channels:"); @@ -601,120 +603,120 @@ boolean rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, STREAM* s) printf("\n"); if (!mcs_send_connect_response(rdp->mcs)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_MCS_CONNECT; - return true; + return TRUE; } -boolean rdp_server_accept_mcs_erect_domain_request(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_mcs_erect_domain_request(rdpRdp* rdp, STREAM* s) { if (!mcs_recv_erect_domain_request(rdp->mcs, s)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_MCS_ERECT_DOMAIN; - return true; + return TRUE; } -boolean rdp_server_accept_mcs_attach_user_request(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_mcs_attach_user_request(rdpRdp* rdp, STREAM* s) { if (!mcs_recv_attach_user_request(rdp->mcs, s)) - return false; + return FALSE; if (!mcs_send_attach_user_confirm(rdp->mcs)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_MCS_ATTACH_USER; - return true; + return TRUE; } -boolean rdp_server_accept_mcs_channel_join_request(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_mcs_channel_join_request(rdpRdp* rdp, STREAM* s) { int i; - uint16 channel_id; - boolean all_joined = true; + UINT16 channel_id; + BOOL all_joined = TRUE; if (!mcs_recv_channel_join_request(rdp->mcs, s, &channel_id)) - return false; + return FALSE; if (!mcs_send_channel_join_confirm(rdp->mcs, channel_id)) - return false; + return FALSE; if (channel_id == rdp->mcs->user_id) - rdp->mcs->user_channel_joined = true; + rdp->mcs->user_channel_joined = TRUE; else if (channel_id == MCS_GLOBAL_CHANNEL_ID) - rdp->mcs->global_channel_joined = true; + rdp->mcs->global_channel_joined = TRUE; for (i = 0; i < rdp->settings->num_channels; i++) { if (rdp->settings->channels[i].channel_id == channel_id) - rdp->settings->channels[i].joined = true; + rdp->settings->channels[i].joined = TRUE; if (!rdp->settings->channels[i].joined) - all_joined = false; + all_joined = FALSE; } if (rdp->mcs->user_channel_joined && rdp->mcs->global_channel_joined && all_joined) rdp->state = CONNECTION_STATE_MCS_CHANNEL_JOIN; - return true; + return TRUE; } -boolean rdp_server_accept_client_keys(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_client_keys(rdpRdp* rdp, STREAM* s) { if (!rdp_server_establish_keys(rdp, s)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_ESTABLISH_KEYS; - return true; + return TRUE; } -boolean rdp_server_accept_client_info(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_client_info(rdpRdp* rdp, STREAM* s) { if (!rdp_recv_client_info(rdp, s)) - return false; + return FALSE; if (!license_send_valid_client_error_packet(rdp->license)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_LICENSE; - return true; + return TRUE; } -boolean rdp_server_accept_confirm_active(rdpRdp* rdp, STREAM* s) +BOOL rdp_server_accept_confirm_active(rdpRdp* rdp, STREAM* s) { if (!rdp_recv_confirm_active(rdp, s)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_ACTIVE; update_reset_state(rdp->update); if (!rdp_send_server_synchronize_pdu(rdp)) - return false; + return FALSE; if (!rdp_send_server_control_cooperate_pdu(rdp)) - return false; + return FALSE; - return true; + return TRUE; } -boolean rdp_server_reactivate(rdpRdp* rdp) +BOOL rdp_server_reactivate(rdpRdp* rdp) { if (!rdp_send_deactivate_all(rdp)) - return false; + return FALSE; rdp->state = CONNECTION_STATE_LICENSE; if (!rdp_send_demand_active(rdp)) - return false; + return FALSE; - return true; + return TRUE; } diff --git a/libfreerdp/core/connection.h b/libfreerdp/core/connection.h index 8d05bedb9..e29232822 100644 --- a/libfreerdp/core/connection.h +++ b/libfreerdp/core/connection.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Connection Sequence * * Copyright 2011 Marc-Andre Moreau @@ -45,23 +45,23 @@ enum CONNECTION_STATE CONNECTION_STATE_ACTIVE }; -boolean rdp_client_connect(rdpRdp* rdp); -boolean rdp_client_redirect(rdpRdp* rdp); -boolean rdp_client_connect_mcs_connect_response(rdpRdp* rdp, STREAM* s); -boolean rdp_client_connect_mcs_attach_user_confirm(rdpRdp* rdp, STREAM* s); -boolean rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s); -boolean rdp_client_connect_license(rdpRdp* rdp, STREAM* s); -boolean rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s); -boolean rdp_client_connect_finalize(rdpRdp* rdp); +BOOL rdp_client_connect(rdpRdp* rdp); +BOOL rdp_client_redirect(rdpRdp* rdp); +BOOL rdp_client_connect_mcs_connect_response(rdpRdp* rdp, STREAM* s); +BOOL rdp_client_connect_mcs_attach_user_confirm(rdpRdp* rdp, STREAM* s); +BOOL rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, STREAM* s); +BOOL rdp_client_connect_license(rdpRdp* rdp, STREAM* s); +BOOL rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s); +BOOL rdp_client_connect_finalize(rdpRdp* rdp); -boolean rdp_server_accept_nego(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_mcs_erect_domain_request(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_mcs_attach_user_request(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_mcs_channel_join_request(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_client_keys(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_client_info(rdpRdp* rdp, STREAM* s); -boolean rdp_server_accept_confirm_active(rdpRdp* rdp, STREAM* s); -boolean rdp_server_reactivate(rdpRdp* rdp); +BOOL rdp_server_accept_nego(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_mcs_erect_domain_request(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_mcs_attach_user_request(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_mcs_channel_join_request(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_client_keys(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_client_info(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_accept_confirm_active(rdpRdp* rdp, STREAM* s); +BOOL rdp_server_reactivate(rdpRdp* rdp); #endif /* __CONNECTION_H */ diff --git a/libfreerdp/core/errinfo.c b/libfreerdp/core/errinfo.c index 423a4e6b1..c835f7476 100644 --- a/libfreerdp/core/errinfo.c +++ b/libfreerdp/core/errinfo.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Error Info * * Copyright 2011 Marc-Andre Moreau @@ -439,7 +439,7 @@ static const ERRINFO ERRINFO_CODES[] = ERRINFO_DEFINE(NONE) }; -void rdp_print_errinfo(uint32 code) +void rdp_print_errinfo(UINT32 code) { const ERRINFO* errInfo; diff --git a/libfreerdp/core/errinfo.h b/libfreerdp/core/errinfo.h index d63f078c4..755ea7c0d 100644 --- a/libfreerdp/core/errinfo.h +++ b/libfreerdp/core/errinfo.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Error Info * * Copyright 2011 Marc-Andre Moreau @@ -123,7 +123,7 @@ struct _ERRINFO { - uint32 code; + UINT32 code; char* name; char* info; }; @@ -131,6 +131,6 @@ typedef struct _ERRINFO ERRINFO; #define ERRINFO_DEFINE(_code) { ERRINFO_##_code , "ERRINFO_" #_code , ERRINFO_##_code##_STRING } -void rdp_print_errinfo(uint32 code); +void rdp_print_errinfo(UINT32 code); #endif diff --git a/libfreerdp/core/extension.c b/libfreerdp/core/extension.c index 2d79c24e4..293b845d5 100644 --- a/libfreerdp/core/extension.c +++ b/libfreerdp/core/extension.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Extension Plugin Interface * * Copyright 2010-2011 Vic Lee @@ -53,7 +53,7 @@ #endif -static uint32 FREERDP_CC extension_register_plugin(rdpExtPlugin* plugin) +static UINT32 FREERDP_CC extension_register_plugin(rdpExtPlugin* plugin) { rdpExtension* ext = (rdpExtension*) plugin->ext; @@ -67,7 +67,7 @@ static uint32 FREERDP_CC extension_register_plugin(rdpExtPlugin* plugin) return 0; } -static uint32 FREERDP_CC extension_register_pre_connect_hook(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook) +static UINT32 FREERDP_CC extension_register_pre_connect_hook(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook) { rdpExtension* ext = (rdpExtension*) plugin->ext; @@ -83,7 +83,7 @@ static uint32 FREERDP_CC extension_register_pre_connect_hook(rdpExtPlugin* plugi return 0; } -static uint32 FREERDP_CC extension_register_post_connect_hook(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook) +static UINT32 FREERDP_CC extension_register_post_connect_hook(rdpExtPlugin* plugin, PFREERDP_EXTENSION_HOOK hook) { rdpExtension* ext = (rdpExtension*) plugin->ext; @@ -224,6 +224,6 @@ void extension_free(rdpExtension* extension) if (extension != NULL) { extension_uninit_plugins(extension); - xfree(extension); + free(extension); } } diff --git a/libfreerdp/core/extension.h b/libfreerdp/core/extension.h index 176888ea3..1ee35ea3d 100644 --- a/libfreerdp/core/extension.h +++ b/libfreerdp/core/extension.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Extension Plugin Interface * * Copyright 2010-2011 Vic Lee diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index b55d62545..930e16516 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Fast Path * * Copyright 2011 Vic Lee @@ -70,12 +70,12 @@ static const char* const FASTPATH_UPDATETYPE_STRINGS[] = * This function assumes that at least two bytes are available in the stream * and doesn't touch third byte. */ -uint16 fastpath_header_length(STREAM* s) +UINT16 fastpath_header_length(STREAM* s) { - uint8 length1; + BYTE length1; - stream_seek_uint8(s); - stream_read_uint8(s, length1); + stream_seek_BYTE(s); + stream_read_BYTE(s, length1); stream_rewind(s, 2); return ((length1 & 0x80) != 0 ? 3 : 2); @@ -87,12 +87,12 @@ uint16 fastpath_header_length(STREAM* s) * @param encryptionFlags * @return length */ -uint16 fastpath_read_header(rdpFastPath* fastpath, STREAM* s) +UINT16 fastpath_read_header(rdpFastPath* fastpath, STREAM* s) { - uint8 header; - uint16 length; + BYTE header; + UINT16 length; - stream_read_uint8(s, header); + stream_read_BYTE(s, header); if (fastpath != NULL) { @@ -105,32 +105,32 @@ uint16 fastpath_read_header(rdpFastPath* fastpath, STREAM* s) return length; } -static INLINE void fastpath_read_update_header(STREAM* s, uint8* updateCode, uint8* fragmentation, uint8* compression) +static INLINE void fastpath_read_update_header(STREAM* s, BYTE* updateCode, BYTE* fragmentation, BYTE* compression) { - uint8 updateHeader; + BYTE updateHeader; - stream_read_uint8(s, updateHeader); + stream_read_BYTE(s, updateHeader); *updateCode = updateHeader & 0x0F; *fragmentation = (updateHeader >> 4) & 0x03; *compression = (updateHeader >> 6) & 0x03; } -static INLINE void fastpath_write_update_header(STREAM* s, uint8 updateCode, uint8 fragmentation, uint8 compression) +static INLINE void fastpath_write_update_header(STREAM* s, BYTE updateCode, BYTE fragmentation, BYTE compression) { - uint8 updateHeader = 0; + BYTE updateHeader = 0; updateHeader |= updateCode & 0x0F; updateHeader |= (fragmentation & 0x03) << 4; updateHeader |= (compression & 0x03) << 6; - stream_write_uint8(s, updateHeader); + stream_write_BYTE(s, updateHeader); } -uint16 fastpath_read_header_rdp(rdpFastPath* fastpath, STREAM* s) +UINT16 fastpath_read_header_rdp(rdpFastPath* fastpath, STREAM* s) { - uint8 header; - uint16 length; + BYTE header; + UINT16 length; - stream_read_uint8(s, header); + stream_read_BYTE(s, header); if (fastpath != NULL) { @@ -143,30 +143,30 @@ uint16 fastpath_read_header_rdp(rdpFastPath* fastpath, STREAM* s) return length - stream_get_length(s); } -static boolean fastpath_recv_orders(rdpFastPath* fastpath, STREAM* s) +static BOOL fastpath_recv_orders(rdpFastPath* fastpath, STREAM* s) { rdpUpdate* update = fastpath->rdp->update; - uint16 numberOrders; + UINT16 numberOrders; - stream_read_uint16(s, numberOrders); /* numberOrders (2 bytes) */ + stream_read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */ while (numberOrders > 0) { if (!update_recv_order(update, s)) - return false; + return FALSE; numberOrders--; } - return true; + return TRUE; } static void fastpath_recv_update_common(rdpFastPath* fastpath, STREAM* s) { - uint16 updateType; + UINT16 updateType; rdpUpdate* update = fastpath->rdp->update; rdpContext* context = update->context; - stream_read_uint16(s, updateType); /* updateType (2 bytes) */ + stream_read_UINT16(s, updateType); /* updateType (2 bytes) */ switch (updateType) { @@ -184,10 +184,10 @@ static void fastpath_recv_update_common(rdpFastPath* fastpath, STREAM* s) static void fastpath_recv_update_synchronize(rdpFastPath* fastpath, STREAM* s) { - stream_seek_uint16(s); /* size (2 bytes), must be set to zero */ + stream_seek_UINT16(s); /* size (2 bytes), must be set to zero */ } -static boolean fastpath_recv_update(rdpFastPath* fastpath, uint8 updateCode, uint32 size, STREAM* s) +static BOOL fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 size, STREAM* s) { rdpUpdate* update = fastpath->rdp->update; rdpContext* context = fastpath->rdp->update->context; @@ -202,7 +202,7 @@ static boolean fastpath_recv_update(rdpFastPath* fastpath, uint8 updateCode, uin { case FASTPATH_UPDATETYPE_ORDERS: if (!fastpath_recv_orders(fastpath, s)) - return false; + return FALSE; break; case FASTPATH_UPDATETYPE_BITMAP: @@ -254,34 +254,34 @@ static boolean fastpath_recv_update(rdpFastPath* fastpath, uint8 updateCode, uin break; } - return true; + return TRUE; } -static boolean fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s) +static BOOL fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s) { - uint16 size; + UINT16 size; int next_pos; - uint32 totalSize; - uint8 updateCode; - uint8 fragmentation; - uint8 compression; - uint8 compressionFlags; + UINT32 totalSize; + BYTE updateCode; + BYTE fragmentation; + BYTE compression; + BYTE compressionFlags; STREAM* update_stream; STREAM* comp_stream; rdpRdp *rdp; - uint32 roff; - uint32 rlen; + UINT32 roff; + UINT32 rlen; rdp = fastpath->rdp; fastpath_read_update_header(s, &updateCode, &fragmentation, &compression); if (compression == FASTPATH_OUTPUT_COMPRESSION_USED) - stream_read_uint8(s, compressionFlags); + stream_read_BYTE(s, compressionFlags); else compressionFlags = 0; - stream_read_uint16(s, size); + stream_read_UINT16(s, size); next_pos = stream_get_pos(s) + size; comp_stream = s; @@ -327,18 +327,18 @@ static boolean fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s) if (update_stream) { if (!fastpath_recv_update(fastpath, updateCode, totalSize, update_stream)) - return false; + return FALSE; } stream_set_pos(s, next_pos); if (comp_stream != s) - xfree(comp_stream); + free(comp_stream); - return true; + return TRUE; } -boolean fastpath_recv_updates(rdpFastPath* fastpath, STREAM* s) +BOOL fastpath_recv_updates(rdpFastPath* fastpath, STREAM* s) { rdpUpdate* update = fastpath->rdp->update; @@ -349,39 +349,39 @@ boolean fastpath_recv_updates(rdpFastPath* fastpath, STREAM* s) if (!fastpath_recv_update_data(fastpath, s)) { /* XXX: Do we need to call EndPaint? */ - return false; + return FALSE; } } IFCALL(update->EndPaint, update->context); - return true; + return TRUE; } -static boolean fastpath_read_input_event_header(STREAM* s, uint8* eventFlags, uint8* eventCode) +static BOOL fastpath_read_input_event_header(STREAM* s, BYTE* eventFlags, BYTE* eventCode) { - uint8 eventHeader; + BYTE eventHeader; if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, eventHeader); /* eventHeader (1 byte) */ + stream_read_BYTE(s, eventHeader); /* eventHeader (1 byte) */ *eventFlags = (eventHeader & 0x1F); *eventCode = (eventHeader >> 5); - return true; + return TRUE; } -static boolean fastpath_recv_input_event_scancode(rdpFastPath* fastpath, STREAM* s, uint8 eventFlags) +static BOOL fastpath_recv_input_event_scancode(rdpFastPath* fastpath, STREAM* s, BYTE eventFlags) { - uint16 flags; - uint16 code; + UINT16 flags; + UINT16 code; if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, code); /* keyCode (1 byte) */ + stream_read_BYTE(s, code); /* keyCode (1 byte) */ flags = 0; if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE)) @@ -394,61 +394,61 @@ static boolean fastpath_recv_input_event_scancode(rdpFastPath* fastpath, STREAM* IFCALL(fastpath->rdp->input->KeyboardEvent, fastpath->rdp->input, flags, code); - return true; + return TRUE; } -static boolean fastpath_recv_input_event_mouse(rdpFastPath* fastpath, STREAM* s, uint8 eventFlags) +static BOOL fastpath_recv_input_event_mouse(rdpFastPath* fastpath, STREAM* s, BYTE eventFlags) { - uint16 pointerFlags; - uint16 xPos; - uint16 yPos; + UINT16 pointerFlags; + UINT16 xPos; + UINT16 yPos; if (stream_get_left(s) < 6) - return false; + return FALSE; - stream_read_uint16(s, pointerFlags); /* pointerFlags (2 bytes) */ - stream_read_uint16(s, xPos); /* xPos (2 bytes) */ - stream_read_uint16(s, yPos); /* yPos (2 bytes) */ + stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */ + stream_read_UINT16(s, xPos); /* xPos (2 bytes) */ + stream_read_UINT16(s, yPos); /* yPos (2 bytes) */ IFCALL(fastpath->rdp->input->MouseEvent, fastpath->rdp->input, pointerFlags, xPos, yPos); - return true; + return TRUE; } -static boolean fastpath_recv_input_event_mousex(rdpFastPath* fastpath, STREAM* s, uint8 eventFlags) +static BOOL fastpath_recv_input_event_mousex(rdpFastPath* fastpath, STREAM* s, BYTE eventFlags) { - uint16 pointerFlags; - uint16 xPos; - uint16 yPos; + UINT16 pointerFlags; + UINT16 xPos; + UINT16 yPos; if (stream_get_left(s) < 6) - return false; + return FALSE; - stream_read_uint16(s, pointerFlags); /* pointerFlags (2 bytes) */ - stream_read_uint16(s, xPos); /* xPos (2 bytes) */ - stream_read_uint16(s, yPos); /* yPos (2 bytes) */ + stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */ + stream_read_UINT16(s, xPos); /* xPos (2 bytes) */ + stream_read_UINT16(s, yPos); /* yPos (2 bytes) */ IFCALL(fastpath->rdp->input->ExtendedMouseEvent, fastpath->rdp->input, pointerFlags, xPos, yPos); - return true; + return TRUE; } -static boolean fastpath_recv_input_event_sync(rdpFastPath* fastpath, STREAM* s, uint8 eventFlags) +static BOOL fastpath_recv_input_event_sync(rdpFastPath* fastpath, STREAM* s, BYTE eventFlags) { IFCALL(fastpath->rdp->input->SynchronizeEvent, fastpath->rdp->input, eventFlags); - return true; + return TRUE; } -static boolean fastpath_recv_input_event_unicode(rdpFastPath* fastpath, STREAM* s, uint8 eventFlags) +static BOOL fastpath_recv_input_event_unicode(rdpFastPath* fastpath, STREAM* s, BYTE eventFlags) { - uint16 unicodeCode; - uint16 flags; + UINT16 unicodeCode; + UINT16 flags; if (stream_get_left(s) < 2) - return false; + return FALSE; - stream_read_uint16(s, unicodeCode); /* unicodeCode (2 bytes) */ + stream_read_UINT16(s, unicodeCode); /* unicodeCode (2 bytes) */ flags = 0; if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_RELEASE)) @@ -458,42 +458,42 @@ static boolean fastpath_recv_input_event_unicode(rdpFastPath* fastpath, STREAM* IFCALL(fastpath->rdp->input->UnicodeKeyboardEvent, fastpath->rdp->input, flags, unicodeCode); - return true; + return TRUE; } -static boolean fastpath_recv_input_event(rdpFastPath* fastpath, STREAM* s) +static BOOL fastpath_recv_input_event(rdpFastPath* fastpath, STREAM* s) { - uint8 eventFlags; - uint8 eventCode; + BYTE eventFlags; + BYTE eventCode; if (!fastpath_read_input_event_header(s, &eventFlags, &eventCode)) - return false; + return FALSE; switch (eventCode) { case FASTPATH_INPUT_EVENT_SCANCODE: if (!fastpath_recv_input_event_scancode(fastpath, s, eventFlags)) - return false; + return FALSE; break; case FASTPATH_INPUT_EVENT_MOUSE: if (!fastpath_recv_input_event_mouse(fastpath, s, eventFlags)) - return false; + return FALSE; break; case FASTPATH_INPUT_EVENT_MOUSEX: if (!fastpath_recv_input_event_mousex(fastpath, s, eventFlags)) - return false; + return FALSE; break; case FASTPATH_INPUT_EVENT_SYNC: if (!fastpath_recv_input_event_sync(fastpath, s, eventFlags)) - return false; + return FALSE; break; case FASTPATH_INPUT_EVENT_UNICODE: if (!fastpath_recv_input_event_unicode(fastpath, s, eventFlags)) - return false; + return FALSE; break; default: @@ -501,12 +501,12 @@ static boolean fastpath_recv_input_event(rdpFastPath* fastpath, STREAM* s) break; } - return true; + return TRUE; } -boolean fastpath_recv_inputs(rdpFastPath* fastpath, STREAM* s) +BOOL fastpath_recv_inputs(rdpFastPath* fastpath, STREAM* s) { - uint8 i; + BYTE i; if (fastpath->numberEvents == 0) { @@ -516,23 +516,23 @@ boolean fastpath_recv_inputs(rdpFastPath* fastpath, STREAM* s) */ if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, fastpath->numberEvents); /* eventHeader (1 byte) */ + stream_read_BYTE(s, fastpath->numberEvents); /* eventHeader (1 byte) */ } for (i = 0; i < fastpath->numberEvents; i++) { if (!fastpath_recv_input_event(fastpath, s)) - return false; + return FALSE; } - return true; + return TRUE; } -static uint32 fastpath_get_sec_bytes(rdpRdp* rdp) +static UINT32 fastpath_get_sec_bytes(rdpRdp* rdp) { - uint32 sec_bytes; + UINT32 sec_bytes; if (rdp->do_crypt) { @@ -545,7 +545,7 @@ static uint32 fastpath_get_sec_bytes(rdpRdp* rdp) return sec_bytes; } -STREAM* fastpath_input_pdu_init(rdpFastPath* fastpath, uint8 eventFlags, uint8 eventCode) +STREAM* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE eventCode) { rdpRdp *rdp; STREAM* s; @@ -560,15 +560,15 @@ STREAM* fastpath_input_pdu_init(rdpFastPath* fastpath, uint8 eventFlags, uint8 e rdp->sec_flags |= SEC_SECURE_CHECKSUM; } stream_seek(s, fastpath_get_sec_bytes(rdp)); - stream_write_uint8(s, eventFlags | (eventCode << 5)); /* eventHeader (1 byte) */ + stream_write_BYTE(s, eventFlags | (eventCode << 5)); /* eventHeader (1 byte) */ return s; } -boolean fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s) +BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s) { rdpRdp *rdp; - uint16 length; - uint8 eventHeader; + UINT16 length; + BYTE eventHeader; int sec_bytes; rdp = fastpath->rdp; @@ -577,7 +577,7 @@ boolean fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s) if (length >= (2 << 14)) { printf("Maximum FastPath PDU length is 32767\n"); - return false; + return FALSE; } eventHeader = FASTPATH_INPUT_ACTION_FASTPATH; @@ -588,7 +588,7 @@ boolean fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s) eventHeader |= (FASTPATH_INPUT_SECURE_CHECKSUM << 6); stream_set_pos(s, 0); - stream_write_uint8(s, eventHeader); + stream_write_BYTE(s, eventHeader); sec_bytes = fastpath_get_sec_bytes(fastpath->rdp); /* * We always encode length in two bytes, eventhough we could use @@ -596,17 +596,17 @@ boolean fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s) * because we can leave room for fixed-length header, store all * the data first and then store the header. */ - stream_write_uint16_be(s, 0x8000 | length); + stream_write_UINT16_be(s, 0x8000 | length); if (sec_bytes > 0) { - uint8* fpInputEvents; - uint16 fpInputEvents_length; + BYTE* fpInputEvents; + UINT16 fpInputEvents_length; fpInputEvents = stream_get_tail(s) + sec_bytes; fpInputEvents_length = length - 3 - sec_bytes; if (rdp->sec_flags & SEC_SECURE_CHECKSUM) - security_salted_mac_signature(rdp, fpInputEvents, fpInputEvents_length, true, stream_get_tail(s)); + security_salted_mac_signature(rdp, fpInputEvents, fpInputEvents_length, TRUE, stream_get_tail(s)); else security_mac_signature(rdp, fpInputEvents, fpInputEvents_length, stream_get_tail(s)); security_encrypt(fpInputEvents, fpInputEvents_length, rdp); @@ -616,9 +616,9 @@ boolean fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s) stream_set_pos(s, length); if (transport_write(fastpath->rdp->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } STREAM* fastpath_update_pdu_init(rdpFastPath* fastpath) @@ -631,13 +631,13 @@ STREAM* fastpath_update_pdu_init(rdpFastPath* fastpath) return s; } -boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM* s) +BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, STREAM* s) { rdpRdp* rdp; - uint8* bm; - uint8* ptr_to_crypt; - uint8* ptr_sig; - uint8* holdp; + BYTE* bm; + BYTE* ptr_to_crypt; + BYTE* ptr_sig; + BYTE* holdp; int fragment; int sec_bytes; int try_comp; @@ -647,17 +647,17 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM int pdu_data_bytes; int dlen; int bytes_to_crypt; - boolean result; - uint16 pduLength; - uint16 maxLength; - uint32 totalLength; - uint8 fragmentation; - uint8 header; + BOOL result; + UINT16 pduLength; + UINT16 maxLength; + UINT32 totalLength; + BYTE fragmentation; + BYTE header; STREAM* update; STREAM* comp_update; STREAM* ls; - result = true; + result = TRUE; rdp = fastpath->rdp; sec_bytes = fastpath_get_sec_bytes(rdp); maxLength = FASTPATH_MAX_PACKET_SIZE - (6 + sec_bytes); @@ -686,7 +686,7 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM pdu_data_bytes = rdp->mppc_enc->bytes_in_opb; comp_flags = FASTPATH_OUTPUT_COMPRESSION_USED; header_bytes = 7 + sec_bytes; - bm = (uint8*) (rdp->mppc_enc->outputBuffer - header_bytes); + bm = (BYTE*) (rdp->mppc_enc->outputBuffer - header_bytes); stream_attach(comp_update, bm, pdu_data_bytes + header_bytes); ls = comp_update; } @@ -707,9 +707,9 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM header = 0; if (sec_bytes > 0) header |= (FASTPATH_OUTPUT_ENCRYPTED << 6); - stream_write_uint8(ls, header); /* fpOutputHeader (1 byte) */ - stream_write_uint8(ls, 0x80 | (pduLength >> 8)); /* length1 */ - stream_write_uint8(ls, pduLength & 0xFF); /* length2 */ + stream_write_BYTE(ls, header); /* fpOutputHeader (1 byte) */ + stream_write_BYTE(ls, 0x80 | (pduLength >> 8)); /* length1 */ + stream_write_BYTE(ls, pduLength & 0xFF); /* length2 */ if (sec_bytes > 0) stream_seek(ls, sec_bytes); @@ -719,13 +719,13 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM /* extra byte if compressed */ if (ls == comp_update) { - stream_write_uint8(ls, cflags); + stream_write_BYTE(ls, cflags); bytes_to_crypt = pdu_data_bytes + 4; } else bytes_to_crypt = pdu_data_bytes + 3; - stream_write_uint16(ls, pdu_data_bytes); + stream_write_UINT16(ls, pdu_data_bytes); stream_attach(update, bm, pduLength); stream_seek(update, pduLength); @@ -736,7 +736,7 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM ptr_to_crypt = bm + 3 + sec_bytes; ptr_sig = bm + 3; if (rdp->sec_flags & SEC_SECURE_CHECKSUM) - security_salted_mac_signature(rdp, ptr_to_crypt, bytes_to_crypt, true, ptr_sig); + security_salted_mac_signature(rdp, ptr_to_crypt, bytes_to_crypt, TRUE, ptr_sig); else security_mac_signature(rdp, ptr_to_crypt, bytes_to_crypt, ptr_sig); security_encrypt(ptr_to_crypt, bytes_to_crypt, rdp); @@ -744,7 +744,7 @@ boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM if (transport_write(fastpath->rdp->transport, update) < 0) { - result = false; + result = FALSE; break; } @@ -774,5 +774,5 @@ rdpFastPath* fastpath_new(rdpRdp* rdp) void fastpath_free(rdpFastPath* fastpath) { stream_free(fastpath->updateData); - xfree(fastpath); + free(fastpath); } diff --git a/libfreerdp/core/fastpath.h b/libfreerdp/core/fastpath.h index 428ce5593..12999398c 100644 --- a/libfreerdp/core/fastpath.h +++ b/libfreerdp/core/fastpath.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Fast Path * * Copyright 2011 Vic Lee @@ -97,24 +97,24 @@ enum FASTPATH_INPUT_KBDFLAGS struct rdp_fastpath { rdpRdp* rdp; - uint8 encryptionFlags; - uint8 numberEvents; + BYTE encryptionFlags; + BYTE numberEvents; STREAM* updateData; }; -uint16 fastpath_header_length(STREAM* s); -uint16 fastpath_read_header(rdpFastPath* fastpath, STREAM* s); -uint16 fastpath_read_header_rdp(rdpFastPath* fastpath, STREAM* s); -boolean fastpath_recv_updates(rdpFastPath* fastpath, STREAM* s); -boolean fastpath_recv_inputs(rdpFastPath* fastpath, STREAM* s); +UINT16 fastpath_header_length(STREAM* s); +UINT16 fastpath_read_header(rdpFastPath* fastpath, STREAM* s); +UINT16 fastpath_read_header_rdp(rdpFastPath* fastpath, STREAM* s); +BOOL fastpath_recv_updates(rdpFastPath* fastpath, STREAM* s); +BOOL fastpath_recv_inputs(rdpFastPath* fastpath, STREAM* s); -STREAM* fastpath_input_pdu_init(rdpFastPath* fastpath, uint8 eventFlags, uint8 eventCode); -boolean fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s); +STREAM* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE eventCode); +BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, STREAM* s); STREAM* fastpath_update_pdu_init(rdpFastPath* fastpath); -boolean fastpath_send_update_pdu(rdpFastPath* fastpath, uint8 updateCode, STREAM* s); +BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, STREAM* s); -boolean fastpath_send_surfcmd_frame_marker(rdpFastPath* fastpath, uint16 frameAction, uint32 frameId); +BOOL fastpath_send_surfcmd_frame_marker(rdpFastPath* fastpath, UINT16 frameAction, UINT32 frameId); rdpFastPath* fastpath_new(rdpRdp* rdp); void fastpath_free(rdpFastPath* fastpath); diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index f20276b05..53e0f926c 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -1,5 +1,5 @@ /* - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Core * * Copyright 2011 Marc-Andre Moreau @@ -44,14 +44,14 @@ * @param instance - pointer to a rdp_freerdp structure that contains base information to establish the connection. * On return, this function will be initialized with the new connection's settings. * - * @return true if successful. false otherwise. + * @return TRUE if successful. FALSE otherwise. * */ -boolean freerdp_connect(freerdp* instance) +BOOL freerdp_connect(freerdp* instance) { rdpRdp* rdp; rdpSettings* settings; - boolean status = false; + BOOL status = FALSE; /* We always set the return code to 0 before we start the connect sequence*/ connectErrorCode = 0; @@ -71,14 +71,14 @@ boolean freerdp_connect(freerdp* instance) extension_load_and_init_plugins(rdp->extension); extension_pre_connect(rdp->extension); - if (status != true) + if (status != TRUE) { if(!connectErrorCode) { connectErrorCode = PREECONNECTERROR; } fprintf(stderr, "%s:%d: freerdp_pre_connect failed\n", __FILE__, __LINE__); - return false; + return FALSE; } status = rdp_client_connect(rdp); @@ -93,16 +93,16 @@ boolean freerdp_connect(freerdp* instance) { if (instance->settings->dump_rfx) { - instance->update->pcap_rfx = pcap_open(instance->settings->dump_rfx_file, true); + instance->update->pcap_rfx = pcap_open(instance->settings->dump_rfx_file, TRUE); if (instance->update->pcap_rfx) - instance->update->dump_rfx = true; + instance->update->dump_rfx = TRUE; } extension_post_connect(rdp->extension); IFCALLRET(instance->PostConnect, status, instance); - if (status != true) + if (status != TRUE) { printf("freerdp_post_connect failed\n"); @@ -111,7 +111,7 @@ boolean freerdp_connect(freerdp* instance) connectErrorCode = POSTCONNECTERROR; } - return false; + return FALSE; } if (instance->settings->play_rfx) @@ -121,10 +121,10 @@ boolean freerdp_connect(freerdp* instance) pcap_record record; s = stream_new(1024); - instance->update->pcap_rfx = pcap_open(instance->settings->play_rfx_file, false); + instance->update->pcap_rfx = pcap_open(instance->settings->play_rfx_file, FALSE); if (instance->update->pcap_rfx) - instance->update->play_rfx = true; + instance->update->play_rfx = TRUE; update = instance->update; @@ -132,7 +132,7 @@ boolean freerdp_connect(freerdp* instance) { pcap_get_next_record_header(update->pcap_rfx, &record); - s->data = (uint8*) xrealloc(s->data, record.length); + s->data = (BYTE*) realloc(s->data, record.length); record.data = s->data; s->size = record.length; @@ -144,8 +144,8 @@ boolean freerdp_connect(freerdp* instance) update->EndPaint(update->context); } - xfree(s->data); - return true; + free(s->data); + return TRUE; } } @@ -157,17 +157,17 @@ boolean freerdp_connect(freerdp* instance) return status; } -boolean freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) +BOOL freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount) { rdpRdp* rdp; rdp = instance->context->rdp; transport_get_fds(rdp->transport, rfds, rcount); - return true; + return TRUE; } -boolean freerdp_check_fds(freerdp* instance) +BOOL freerdp_check_fds(freerdp* instance) { int status; rdpRdp* rdp; @@ -177,27 +177,27 @@ boolean freerdp_check_fds(freerdp* instance) status = rdp_check_fds(rdp); if (status < 0) - return false; + return FALSE; - return true; + return TRUE; } -static int freerdp_send_channel_data(freerdp* instance, int channel_id, uint8* data, int size) +static int freerdp_send_channel_data(freerdp* instance, int channel_id, BYTE* data, int size) { return rdp_send_channel_data(instance->context->rdp, channel_id, data, size); } -boolean freerdp_disconnect(freerdp* instance) +BOOL freerdp_disconnect(freerdp* instance) { rdpRdp* rdp; rdp = instance->context->rdp; transport_disconnect(rdp->transport); - return true; + return TRUE; } -boolean freerdp_shall_disconnect(freerdp* instance) +BOOL freerdp_shall_disconnect(freerdp* instance) { return instance->context->rdp->disconnect; } @@ -269,11 +269,11 @@ void freerdp_context_free(freerdp* instance) rdp_free(instance->context->rdp); graphics_free(instance->context->graphics); - xfree(instance->context); + free(instance->context); instance->context = NULL; } -uint32 freerdp_error_info(freerdp* instance) +UINT32 freerdp_error_info(freerdp* instance) { return instance->context->rdp->errorInfo; } @@ -304,6 +304,6 @@ void freerdp_free(freerdp* instance) { if (instance) { - xfree(instance); + free(instance); } } diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c index 3318e53f6..561b55dfb 100644 --- a/libfreerdp/core/gcc.c +++ b/libfreerdp/core/gcc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.124 Generic Conference Control (GCC) * * Copyright 2011 Marc-Andre Moreau @@ -126,10 +126,10 @@ * { itu-t(0) recommendation(0) t(20) t124(124) version(0) 1 } * v.1 of ITU-T Recommendation T.124 (Feb 1998): "Generic Conference Control" */ -uint8 t124_02_98_oid[6] = { 0, 0, 20, 124, 0, 1 }; +BYTE t124_02_98_oid[6] = { 0, 0, 20, 124, 0, 1 }; -uint8 h221_cs_key[4] = "Duca"; -uint8 h221_sc_key[4] = "McDn"; +BYTE h221_cs_key[4] = "Duca"; +BYTE h221_sc_key[4] = "McDn"; /** * Read a GCC Conference Create Request.\n @@ -138,54 +138,54 @@ uint8 h221_sc_key[4] = "McDn"; * @param settings rdp settings */ -boolean gcc_read_conference_create_request(STREAM* s, rdpSettings* settings) +BOOL gcc_read_conference_create_request(STREAM* s, rdpSettings* settings) { - uint16 length; - uint8 choice; - uint8 number; - uint8 selection; + UINT16 length; + BYTE choice; + BYTE number; + BYTE selection; /* ConnectData */ if (!per_read_choice(s, &choice)) - return false; + return FALSE; if (!per_read_object_identifier(s, t124_02_98_oid)) - return false; + return FALSE; /* ConnectData::connectPDU (OCTET_STRING) */ if (!per_read_length(s, &length)) - return false; + return FALSE; /* ConnectGCCPDU */ if (!per_read_choice(s, &choice)) - return false; + return FALSE; if (!per_read_selection(s, &selection)) - return false; + return FALSE; /* ConferenceCreateRequest::conferenceName */ if (!per_read_numeric_string(s, 1)) /* ConferenceName::numeric */ - return false; + return FALSE; if (!per_read_padding(s, 1)) /* padding */ - return false; + return FALSE; /* UserData (SET OF SEQUENCE) */ if (!per_read_number_of_sets(s, &number) || number != 1) /* one set of UserData */ - return false; + return FALSE; if (!per_read_choice(s, &choice) || choice != 0xC0) /* UserData::value present + select h221NonStandard (1) */ - return false; + return FALSE; /* h221NonStandard */ if (!per_read_octet_string(s, h221_cs_key, 4, 4)) /* h221NonStandard, client-to-server H.221 key, "Duca" */ - return false; + return FALSE; /* userData::value (OCTET_STRING) */ if (!per_read_length(s, &length)) - return false; + return FALSE; if (stream_get_left(s) < length) - return false; + return FALSE; if (!gcc_read_client_data_blocks(s, settings, length)) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -209,7 +209,7 @@ void gcc_write_conference_create_request(STREAM* s, STREAM* user_data) per_write_selection(s, 0x08); /* select optional userData from ConferenceCreateRequest */ /* ConferenceCreateRequest::conferenceName */ - per_write_numeric_string(s, (uint8*)"1", 1, 1); /* ConferenceName::numeric */ + per_write_numeric_string(s, (BYTE*)"1", 1, 1); /* ConferenceName::numeric */ per_write_padding(s, 1); /* padding */ /* UserData (SET OF SEQUENCE) */ @@ -223,14 +223,14 @@ void gcc_write_conference_create_request(STREAM* s, STREAM* user_data) per_write_octet_string(s, user_data->data, stream_get_length(user_data), 0); /* array of client data blocks */ } -boolean gcc_read_conference_create_response(STREAM* s, rdpSettings* settings) +BOOL gcc_read_conference_create_response(STREAM* s, rdpSettings* settings) { - uint16 length; - uint32 tag; - uint16 nodeID; - uint8 result; - uint8 choice; - uint8 number; + UINT16 length; + UINT32 tag; + UINT16 nodeID; + BYTE result; + BYTE choice; + BYTE number; /* ConnectData */ per_read_choice(s, &choice); @@ -259,17 +259,17 @@ boolean gcc_read_conference_create_response(STREAM* s, rdpSettings* settings) /* h221NonStandard */ if (!per_read_octet_string(s, h221_sc_key, 4, 4)) /* h221NonStandard, server-to-client H.221 key, "McDn" */ - return false; + return FALSE; /* userData (OCTET_STRING) */ per_read_length(s, &length); if (!gcc_read_server_data_blocks(s, settings, length)) { printf("gcc_read_conference_create_response: gcc_read_server_data_blocks failed\n"); - return false; + return FALSE; } - return true; + return TRUE; } void gcc_write_conference_create_response(STREAM* s, STREAM* user_data) @@ -306,10 +306,10 @@ void gcc_write_conference_create_response(STREAM* s, STREAM* user_data) per_write_octet_string(s, user_data->data, stream_get_length(user_data), 0); /* array of server data blocks */ } -boolean gcc_read_client_data_blocks(STREAM* s, rdpSettings* settings, int length) +BOOL gcc_read_client_data_blocks(STREAM* s, rdpSettings* settings, int length) { - uint16 type; - uint16 blockLength; + UINT16 type; + UINT16 blockLength; int pos; while (length > 0) @@ -321,27 +321,27 @@ boolean gcc_read_client_data_blocks(STREAM* s, rdpSettings* settings, int length { case CS_CORE: if (!gcc_read_client_core_data(s, settings, blockLength - 4)) - return false; + return FALSE; break; case CS_SECURITY: if (!gcc_read_client_security_data(s, settings, blockLength - 4)) - return false; + return FALSE; break; case CS_NET: if (!gcc_read_client_network_data(s, settings, blockLength - 4)) - return false; + return FALSE; break; case CS_CLUSTER: if (!gcc_read_client_cluster_data(s, settings, blockLength - 4)) - return false; + return FALSE; break; case CS_MONITOR: if (!gcc_read_client_monitor_data(s, settings, blockLength - 4)) - return false; + return FALSE; break; default: @@ -352,7 +352,7 @@ boolean gcc_read_client_data_blocks(STREAM* s, rdpSettings* settings, int length stream_set_pos(s, pos + blockLength); } - return true; + return TRUE; } void gcc_write_client_data_blocks(STREAM* s, rdpSettings* settings) @@ -368,12 +368,12 @@ void gcc_write_client_data_blocks(STREAM* s, rdpSettings* settings) gcc_write_client_monitor_data(s, settings); } -boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length) +BOOL gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length) { - uint16 type; - uint16 offset = 0; - uint16 blockLength; - uint8* holdp; + UINT16 type; + UINT16 offset = 0; + UINT16 blockLength; + BYTE* holdp; while (offset < length) { @@ -382,7 +382,7 @@ boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length if (!gcc_read_user_data_header(s, &type, &blockLength)) { printf("gcc_read_server_data_blocks: gcc_read_user_data_header failed\n"); - return false; + return FALSE; } switch (type) @@ -391,7 +391,7 @@ boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length if (!gcc_read_server_core_data(s, settings)) { printf("gcc_read_server_data_blocks: gcc_read_server_core_data failed\n"); - return false; + return FALSE; } break; @@ -399,7 +399,7 @@ boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length if (!gcc_read_server_security_data(s, settings)) { printf("gcc_read_server_data_blocks: gcc_read_server_security_data failed\n"); - return false; + return FALSE; } break; @@ -407,7 +407,7 @@ boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length if (!gcc_read_server_network_data(s, settings)) { printf("gcc_read_server_data_blocks: gcc_read_server_network_data failed\n"); - return false; + return FALSE; } break; @@ -419,7 +419,7 @@ boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings* settings, int length s->p = holdp + blockLength; } - return true; + return TRUE; } void gcc_write_server_data_blocks(STREAM* s, rdpSettings* settings) @@ -429,18 +429,18 @@ void gcc_write_server_data_blocks(STREAM* s, rdpSettings* settings) gcc_write_server_security_data(s, settings); } -boolean gcc_read_user_data_header(STREAM* s, uint16* type, uint16* length) +BOOL gcc_read_user_data_header(STREAM* s, UINT16* type, UINT16* length) { - stream_read_uint16(s, *type); /* type */ - stream_read_uint16(s, *length); /* length */ + stream_read_UINT16(s, *type); /* type */ + stream_read_UINT16(s, *length); /* length */ if (*length < 4) - return false; + return FALSE; if (stream_get_left(s) < *length - 4) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -451,10 +451,10 @@ boolean gcc_read_user_data_header(STREAM* s, uint16* type, uint16* length) * @param length data block length */ -void gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length) +void gcc_write_user_data_header(STREAM* s, UINT16 type, UINT16 length) { - stream_write_uint16(s, type); /* type */ - stream_write_uint16(s, length); /* length */ + stream_write_UINT16(s, type); /* type */ + stream_write_UINT16(s, length); /* length */ } /** @@ -464,42 +464,42 @@ void gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length) * @param settings rdp settings */ -boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 blockLength) +BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLength) { char* str; - uint32 version; - uint32 color_depth; - uint16 colorDepth = 0; - uint16 postBeta2ColorDepth = 0; - uint16 highColorDepth = 0; - uint16 supportedColorDepths = 0; - uint16 earlyCapabilityFlags = 0; - uint32 serverSelectedProtocol = 0; + UINT32 version; + UINT32 color_depth; + UINT16 colorDepth = 0; + UINT16 postBeta2ColorDepth = 0; + UINT16 highColorDepth = 0; + UINT16 supportedColorDepths = 0; + UINT16 earlyCapabilityFlags = 0; + UINT32 serverSelectedProtocol = 0; /* Length of all required fields, until imeFileName */ if (blockLength < 128) - return false; + return FALSE; - stream_read_uint32(s, version); /* version */ + stream_read_UINT32(s, version); /* version */ settings->rdp_version = (version == RDP_VERSION_4 ? 4 : 7); - stream_read_uint16(s, settings->width); /* desktopWidth */ - stream_read_uint16(s, settings->height); /* desktopHeight */ - stream_read_uint16(s, colorDepth); /* colorDepth */ - stream_seek_uint16(s); /* SASSequence (Secure Access Sequence) */ - stream_read_uint32(s, settings->kbd_layout); /* keyboardLayout */ - stream_read_uint32(s, settings->client_build); /* clientBuild */ + stream_read_UINT16(s, settings->width); /* desktopWidth */ + stream_read_UINT16(s, settings->height); /* desktopHeight */ + stream_read_UINT16(s, colorDepth); /* colorDepth */ + stream_seek_UINT16(s); /* SASSequence (Secure Access Sequence) */ + stream_read_UINT32(s, settings->kbd_layout); /* keyboardLayout */ + stream_read_UINT32(s, settings->client_build); /* clientBuild */ /* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */ freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 32 / 2); stream_seek(s, 32); snprintf(settings->client_hostname, 31, "%s", str); settings->client_hostname[31] = 0; - xfree(str); + free(str); - stream_read_uint32(s, settings->kbd_type); /* keyboardType */ - stream_read_uint32(s, settings->kbd_subtype); /* keyboardSubType */ - stream_read_uint32(s, settings->kbd_fn_keys); /* keyboardFunctionKey */ + stream_read_UINT32(s, settings->kbd_type); /* keyboardType */ + stream_read_UINT32(s, settings->kbd_subtype); /* keyboardSubType */ + stream_read_UINT32(s, settings->kbd_fn_keys); /* keyboardFunctionKey */ stream_seek(s, 64); /* imeFileName */ @@ -516,32 +516,32 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block { if (blockLength < 2) break; - stream_read_uint16(s, postBeta2ColorDepth); /* postBeta2ColorDepth */ + stream_read_UINT16(s, postBeta2ColorDepth); /* postBeta2ColorDepth */ blockLength -= 2; if (blockLength < 2) break; - stream_seek_uint16(s); /* clientProductID */ + stream_seek_UINT16(s); /* clientProductID */ blockLength -= 2; if (blockLength < 4) break; - stream_seek_uint32(s); /* serialNumber */ + stream_seek_UINT32(s); /* serialNumber */ blockLength -= 4; if (blockLength < 2) break; - stream_read_uint16(s, highColorDepth); /* highColorDepth */ + stream_read_UINT16(s, highColorDepth); /* highColorDepth */ blockLength -= 2; if (blockLength < 2) break; - stream_read_uint16(s, supportedColorDepths); /* supportedColorDepths */ + stream_read_UINT16(s, supportedColorDepths); /* supportedColorDepths */ blockLength -= 2; if (blockLength < 2) break; - stream_read_uint16(s, earlyCapabilityFlags); /* earlyCapabilityFlags */ + stream_read_UINT16(s, earlyCapabilityFlags); /* earlyCapabilityFlags */ blockLength -= 2; if (blockLength < 64) @@ -550,26 +550,26 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2); stream_seek(s, 64); snprintf(settings->client_product_id, 32, "%s", str); - xfree(str); + free(str); blockLength -= 64; if (blockLength < 1) break; - stream_read_uint8(s, settings->performance_flags); /* connectionType */ + stream_read_BYTE(s, settings->performance_flags); /* connectionType */ blockLength -= 1; if (blockLength < 1) break; - stream_seek_uint8(s); /* pad1octet */ + stream_seek_BYTE(s); /* pad1octet */ blockLength -= 1; if (blockLength < 4) break; - stream_read_uint32(s, serverSelectedProtocol); /* serverSelectedProtocol */ + stream_read_UINT32(s, serverSelectedProtocol); /* serverSelectedProtocol */ blockLength -= 4; if (settings->selected_protocol != serverSelectedProtocol) - return false; + return FALSE; } while (0); if (highColorDepth > 0) @@ -594,7 +594,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block color_depth = 24; break; default: - return false; + return FALSE; } } else @@ -608,7 +608,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block color_depth = 8; break; default: - return false; + return FALSE; } } @@ -619,7 +619,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block if (color_depth < settings->color_depth || !settings->server_mode) settings->color_depth = color_depth; - return true; + return TRUE; } /** @@ -631,13 +631,13 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block void gcc_write_client_core_data(STREAM* s, rdpSettings* settings) { - uint32 version; + UINT32 version; WCHAR* clientName; int clientNameLength; - uint8 connectionType; - uint16 highColorDepth; - uint16 supportedColorDepths; - uint16 earlyCapabilityFlags; + BYTE connectionType; + UINT16 highColorDepth; + UINT16 supportedColorDepths; + UINT16 earlyCapabilityFlags; WCHAR* clientDigProductId; int clientDigProductIdLength; @@ -648,13 +648,13 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings) clientNameLength = freerdp_AsciiToUnicodeAlloc(settings->client_hostname, &clientName, 0); clientDigProductIdLength = freerdp_AsciiToUnicodeAlloc(settings->client_product_id, &clientDigProductId, 0); - stream_write_uint32(s, version); /* version */ - stream_write_uint16(s, settings->width); /* desktopWidth */ - stream_write_uint16(s, settings->height); /* desktopHeight */ - stream_write_uint16(s, RNS_UD_COLOR_8BPP); /* colorDepth, ignored because of postBeta2ColorDepth */ - stream_write_uint16(s, RNS_UD_SAS_DEL); /* SASSequence (Secure Access Sequence) */ - stream_write_uint32(s, settings->kbd_layout); /* keyboardLayout */ - stream_write_uint32(s, settings->client_build); /* clientBuild */ + stream_write_UINT32(s, version); /* version */ + stream_write_UINT16(s, settings->width); /* desktopWidth */ + stream_write_UINT16(s, settings->height); /* desktopHeight */ + stream_write_UINT16(s, RNS_UD_COLOR_8BPP); /* colorDepth, ignored because of postBeta2ColorDepth */ + stream_write_UINT16(s, RNS_UD_SAS_DEL); /* SASSequence (Secure Access Sequence) */ + stream_write_UINT32(s, settings->kbd_layout); /* keyboardLayout */ + stream_write_UINT32(s, settings->client_build); /* clientBuild */ /* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */ @@ -666,17 +666,17 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings) stream_write(s, clientName, ((clientNameLength + 1) * 2)); stream_write_zero(s, 32 - ((clientNameLength + 1) * 2)); - xfree(clientName); + free(clientName); - stream_write_uint32(s, settings->kbd_type); /* keyboardType */ - stream_write_uint32(s, settings->kbd_subtype); /* keyboardSubType */ - stream_write_uint32(s, settings->kbd_fn_keys); /* keyboardFunctionKey */ + stream_write_UINT32(s, settings->kbd_type); /* keyboardType */ + stream_write_UINT32(s, settings->kbd_subtype); /* keyboardSubType */ + stream_write_UINT32(s, settings->kbd_fn_keys); /* keyboardFunctionKey */ stream_write_zero(s, 64); /* imeFileName */ - stream_write_uint16(s, RNS_UD_COLOR_8BPP); /* postBeta2ColorDepth */ - stream_write_uint16(s, 1); /* clientProductID */ - stream_write_uint32(s, 0); /* serialNumber (should be initialized to 0) */ + stream_write_UINT16(s, RNS_UD_COLOR_8BPP); /* postBeta2ColorDepth */ + stream_write_UINT16(s, 1); /* clientProductID */ + stream_write_UINT32(s, 0); /* serialNumber (should be initialized to 0) */ highColorDepth = MIN(settings->color_depth, 24); @@ -700,10 +700,10 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings) earlyCapabilityFlags |= RNS_UD_CS_WANT_32BPP_SESSION; } - stream_write_uint16(s, highColorDepth); /* highColorDepth */ - stream_write_uint16(s, supportedColorDepths); /* supportedColorDepths */ + stream_write_UINT16(s, highColorDepth); /* highColorDepth */ + stream_write_UINT16(s, supportedColorDepths); /* supportedColorDepths */ - stream_write_uint16(s, earlyCapabilityFlags); /* earlyCapabilityFlags */ + stream_write_UINT16(s, earlyCapabilityFlags); /* earlyCapabilityFlags */ /* clientDigProductId (64 bytes, null-terminated unicode, truncated to 30 characters) */ if (clientDigProductIdLength > 62) @@ -714,36 +714,36 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings) } stream_write(s, clientDigProductId, clientDigProductIdLength + 2); stream_write_zero(s, 64 - clientDigProductIdLength - 2); - xfree(clientDigProductId); + free(clientDigProductId); - stream_write_uint8(s, connectionType); /* connectionType */ - stream_write_uint8(s, 0); /* pad1octet */ + stream_write_BYTE(s, connectionType); /* connectionType */ + stream_write_BYTE(s, 0); /* pad1octet */ - stream_write_uint32(s, settings->selected_protocol); /* serverSelectedProtocol */ + stream_write_UINT32(s, settings->selected_protocol); /* serverSelectedProtocol */ } -boolean gcc_read_server_core_data(STREAM* s, rdpSettings* settings) +BOOL gcc_read_server_core_data(STREAM* s, rdpSettings* settings) { - uint32 version; - uint32 clientRequestedProtocols; + UINT32 version; + UINT32 clientRequestedProtocols; - stream_read_uint32(s, version); /* version */ - stream_read_uint32(s, clientRequestedProtocols); /* clientRequestedProtocols */ + stream_read_UINT32(s, version); /* version */ + stream_read_UINT32(s, clientRequestedProtocols); /* clientRequestedProtocols */ if (version == RDP_VERSION_4 && settings->rdp_version > 4) settings->rdp_version = 4; else if (version == RDP_VERSION_5_PLUS && settings->rdp_version < 5) settings->rdp_version = 7; - return true; + return TRUE; } void gcc_write_server_core_data(STREAM* s, rdpSettings* settings) { gcc_write_user_data_header(s, SC_CORE, 12); - stream_write_uint32(s, settings->rdp_version == 4 ? RDP_VERSION_4 : RDP_VERSION_5_PLUS); - stream_write_uint32(s, settings->requested_protocols); /* clientRequestedProtocols */ + stream_write_UINT32(s, settings->rdp_version == 4 ? RDP_VERSION_4 : RDP_VERSION_5_PLUS); + stream_write_UINT32(s, settings->requested_protocols); /* clientRequestedProtocols */ } /** @@ -753,22 +753,22 @@ void gcc_write_server_core_data(STREAM* s, rdpSettings* settings) * @param settings rdp settings */ -boolean gcc_read_client_security_data(STREAM* s, rdpSettings* settings, uint16 blockLength) +BOOL gcc_read_client_security_data(STREAM* s, rdpSettings* settings, UINT16 blockLength) { if (blockLength < 8) - return false; + return FALSE; if (settings->encryption) { - stream_read_uint32(s, settings->encryption_method); /* encryptionMethods */ + stream_read_UINT32(s, settings->encryption_method); /* encryptionMethods */ if (settings->encryption_method == 0) - stream_read_uint32(s, settings->encryption_method); /* extEncryptionMethods */ + stream_read_UINT32(s, settings->encryption_method); /* extEncryptionMethods */ } else { stream_seek(s, 8); } - return true; + return TRUE; } /** @@ -784,36 +784,36 @@ void gcc_write_client_security_data(STREAM* s, rdpSettings* settings) if (settings->encryption) { - stream_write_uint32(s, settings->encryption_method); /* encryptionMethods */ - stream_write_uint32(s, 0); /* extEncryptionMethods */ + stream_write_UINT32(s, settings->encryption_method); /* encryptionMethods */ + stream_write_UINT32(s, 0); /* extEncryptionMethods */ } else { /* French locale, disable encryption */ - stream_write_uint32(s, 0); /* encryptionMethods */ - stream_write_uint32(s, settings->encryption_method); /* extEncryptionMethods */ + stream_write_UINT32(s, 0); /* encryptionMethods */ + stream_write_UINT32(s, settings->encryption_method); /* extEncryptionMethods */ } } -boolean gcc_read_server_security_data(STREAM* s, rdpSettings* settings) +BOOL gcc_read_server_security_data(STREAM* s, rdpSettings* settings) { - uint8* data; - uint32 length; + BYTE* data; + UINT32 length; - stream_read_uint32(s, settings->encryption_method); /* encryptionMethod */ - stream_read_uint32(s, settings->encryption_level); /* encryptionLevel */ + stream_read_UINT32(s, settings->encryption_method); /* encryptionMethod */ + stream_read_UINT32(s, settings->encryption_level); /* encryptionLevel */ if (settings->encryption_method == 0 && settings->encryption_level == 0) { /* serverRandom and serverRandom must not be present */ - settings->encryption = false; + settings->encryption = FALSE; settings->encryption_method = ENCRYPTION_METHOD_NONE; settings->encryption_level = ENCRYPTION_LEVEL_NONE; - return true; + return TRUE; } - stream_read_uint32(s, settings->server_random_length); /* serverRandomLen */ - stream_read_uint32(s, settings->server_certificate_length); /* serverCertLen */ + stream_read_UINT32(s, settings->server_random_length); /* serverRandomLen */ + stream_read_UINT32(s, settings->server_certificate_length); /* serverCertLen */ if (settings->server_random_length > 0) { @@ -823,7 +823,7 @@ boolean gcc_read_server_security_data(STREAM* s, rdpSettings* settings) } else { - return false; + return FALSE; } if (settings->server_certificate_length > 0) @@ -838,17 +838,17 @@ boolean gcc_read_server_security_data(STREAM* s, rdpSettings* settings) length = settings->server_certificate_length; if (!certificate_read_server_certificate(settings->server_cert, data, length)) - return false; + return FALSE; } else { - return false; + return FALSE; } - return true; + return TRUE; } -static const uint8 initial_signature[] = +static const BYTE initial_signature[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -865,7 +865,7 @@ static const uint8 initial_signature[] = * Yes, Terminal Services Private Key is publicly available. */ -const uint8 tssk_modulus[] = +const BYTE tssk_modulus[] = { 0x3d, 0x3a, 0x5e, 0xbd, 0x72, 0x43, 0x3e, 0xc9, 0x4d, 0xbb, 0xc1, 0x1e, 0x4a, 0xba, 0x5f, 0xcb, @@ -877,7 +877,7 @@ const uint8 tssk_modulus[] = 0x20, 0x93, 0x09, 0x5f, 0x05, 0x6d, 0xea, 0x87 }; -const uint8 tssk_privateExponent[] = +const BYTE tssk_privateExponent[] = { 0x87, 0xa7, 0x19, 0x32, 0xda, 0x11, 0x87, 0x55, 0x58, 0x00, 0x16, 0x16, 0x25, 0x65, 0x68, 0xf8, @@ -889,7 +889,7 @@ const uint8 tssk_privateExponent[] = 0xc7, 0x10, 0x01, 0x13, 0xe7, 0x3f, 0xf3, 0x5f }; -const uint8 tssk_exponent[] = +const BYTE tssk_exponent[] = { 0x5b, 0x7b, 0x88, 0xc0 }; @@ -897,11 +897,11 @@ const uint8 tssk_exponent[] = void gcc_write_server_security_data(STREAM* s, rdpSettings* settings) { CryptoMd5 md5; - uint8* sigData; + BYTE* sigData; int expLen, keyLen, sigDataLen; - uint8 encryptedSignature[TSSK_KEY_LENGTH]; - uint8 signature[sizeof(initial_signature)]; - uint32 headerLen, serverRandomLen, serverCertLen, wPublicKeyBlobLen; + BYTE encryptedSignature[TSSK_KEY_LENGTH]; + BYTE signature[sizeof(initial_signature)]; + UINT32 headerLen, serverRandomLen, serverCertLen, wPublicKeyBlobLen; if (!settings->encryption) { @@ -964,8 +964,8 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings) gcc_write_user_data_header(s, SC_SECURITY, headerLen); - stream_write_uint32(s, settings->encryption_method); /* encryptionMethod */ - stream_write_uint32(s, settings->encryption_level); /* encryptionLevel */ + stream_write_UINT32(s, settings->encryption_method); /* encryptionMethod */ + stream_write_UINT32(s, settings->encryption_level); /* encryptionLevel */ if (settings->encryption_method == ENCRYPTION_METHOD_NONE && settings->encryption_level == ENCRYPTION_LEVEL_NONE) @@ -973,8 +973,8 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings) return; } - stream_write_uint32(s, serverRandomLen); /* serverRandomLen */ - stream_write_uint32(s, serverCertLen); /* serverCertLen */ + stream_write_UINT32(s, serverRandomLen); /* serverRandomLen */ + stream_write_UINT32(s, serverCertLen); /* serverCertLen */ settings->server_random_length = serverRandomLen; settings->server_random = (BYTE*) malloc(serverRandomLen); @@ -983,16 +983,16 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings) sigData = stream_get_tail(s); - stream_write_uint32(s, CERT_CHAIN_VERSION_1); /* dwVersion (4 bytes) */ - stream_write_uint32(s, SIGNATURE_ALG_RSA); /* dwSigAlgId */ - stream_write_uint32(s, KEY_EXCHANGE_ALG_RSA); /* dwKeyAlgId */ - stream_write_uint16(s, BB_RSA_KEY_BLOB); /* wPublicKeyBlobType */ + stream_write_UINT32(s, CERT_CHAIN_VERSION_1); /* dwVersion (4 bytes) */ + stream_write_UINT32(s, SIGNATURE_ALG_RSA); /* dwSigAlgId */ + stream_write_UINT32(s, KEY_EXCHANGE_ALG_RSA); /* dwKeyAlgId */ + stream_write_UINT16(s, BB_RSA_KEY_BLOB); /* wPublicKeyBlobType */ - stream_write_uint16(s, wPublicKeyBlobLen); /* wPublicKeyBlobLen */ + stream_write_UINT16(s, wPublicKeyBlobLen); /* wPublicKeyBlobLen */ stream_write(s, "RSA1", 4); /* magic */ - stream_write_uint32(s, keyLen + 8); /* keylen */ - stream_write_uint32(s, keyLen * 8); /* bitlen */ - stream_write_uint32(s, keyLen - 1); /* datalen */ + stream_write_UINT32(s, keyLen + 8); /* keylen */ + stream_write_UINT32(s, keyLen * 8); /* bitlen */ + stream_write_UINT32(s, keyLen - 1); /* datalen */ stream_write(s, settings->server_key->exponent, expLen); stream_write(s, settings->server_key->Modulus, keyLen); @@ -1000,8 +1000,8 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings) sigDataLen = stream_get_tail(s) - sigData; - stream_write_uint16(s, BB_RSA_SIGNATURE_BLOB); /* wSignatureBlobType */ - stream_write_uint16(s, keyLen + 8); /* wSignatureBlobLen */ + stream_write_UINT16(s, BB_RSA_SIGNATURE_BLOB); /* wSignatureBlobType */ + stream_write_UINT16(s, keyLen + 8); /* wSignatureBlobLen */ memcpy(signature, initial_signature, sizeof(initial_signature)); @@ -1023,29 +1023,29 @@ void gcc_write_server_security_data(STREAM* s, rdpSettings* settings) * @param settings rdp settings */ -boolean gcc_read_client_network_data(STREAM* s, rdpSettings* settings, uint16 blockLength) +BOOL gcc_read_client_network_data(STREAM* s, rdpSettings* settings, UINT16 blockLength) { int i; if (blockLength < 4) - return false; + return FALSE; - stream_read_uint32(s, settings->num_channels); /* channelCount */ + stream_read_UINT32(s, settings->num_channels); /* channelCount */ if (blockLength < 4 + settings->num_channels * 12) - return false; + return FALSE; if (settings->num_channels > 16) - return false; + return FALSE; /* channelDefArray */ for (i = 0; i < settings->num_channels; i++) { /* CHANNEL_DEF */ stream_read(s, settings->channels[i].name, 8); /* name (8 bytes) */ - stream_read_uint32(s, settings->channels[i].options); /* options (4 bytes) */ + stream_read_UINT32(s, settings->channels[i].options); /* options (4 bytes) */ settings->channels[i].channel_id = MCS_GLOBAL_CHANNEL_ID + 1 + i; } - return true; + return TRUE; } /** @@ -1058,34 +1058,34 @@ boolean gcc_read_client_network_data(STREAM* s, rdpSettings* settings, uint16 bl void gcc_write_client_network_data(STREAM* s, rdpSettings* settings) { int i; - uint16 length; + UINT16 length; if (settings->num_channels > 0) { length = settings->num_channels * 12 + 8; gcc_write_user_data_header(s, CS_NET, length); - stream_write_uint32(s, settings->num_channels); /* channelCount */ + stream_write_UINT32(s, settings->num_channels); /* channelCount */ /* channelDefArray */ for (i = 0; i < settings->num_channels; i++) { /* CHANNEL_DEF */ stream_write(s, settings->channels[i].name, 8); /* name (8 bytes) */ - stream_write_uint32(s, settings->channels[i].options); /* options (4 bytes) */ + stream_write_UINT32(s, settings->channels[i].options); /* options (4 bytes) */ } } } -boolean gcc_read_server_network_data(STREAM* s, rdpSettings* settings) +BOOL gcc_read_server_network_data(STREAM* s, rdpSettings* settings) { int i; - uint16 MCSChannelId; - uint16 channelCount; - uint16 channelId; + UINT16 MCSChannelId; + UINT16 channelCount; + UINT16 channelId; - stream_read_uint16(s, MCSChannelId); /* MCSChannelId */ - stream_read_uint16(s, channelCount); /* channelCount */ + stream_read_UINT16(s, MCSChannelId); /* MCSChannelId */ + stream_read_UINT16(s, channelCount); /* channelCount */ if (channelCount != settings->num_channels) { @@ -1095,14 +1095,14 @@ boolean gcc_read_server_network_data(STREAM* s, rdpSettings* settings) for (i = 0; i < channelCount; i++) { - stream_read_uint16(s, channelId); /* channelId */ + stream_read_UINT16(s, channelId); /* channelId */ settings->channels[i].channel_id = channelId; } if (channelCount % 2 == 1) stream_seek(s, 2); /* padding */ - return true; + return TRUE; } void gcc_write_server_network_data(STREAM* s, rdpSettings* settings) @@ -1111,16 +1111,16 @@ void gcc_write_server_network_data(STREAM* s, rdpSettings* settings) gcc_write_user_data_header(s, SC_NET, 8 + settings->num_channels * 2 + (settings->num_channels % 2 == 1 ? 2 : 0)); - stream_write_uint16(s, MCS_GLOBAL_CHANNEL_ID); /* MCSChannelId */ - stream_write_uint16(s, settings->num_channels); /* channelCount */ + stream_write_UINT16(s, MCS_GLOBAL_CHANNEL_ID); /* MCSChannelId */ + stream_write_UINT16(s, settings->num_channels); /* channelCount */ for (i = 0; i < settings->num_channels; i++) { - stream_write_uint16(s, settings->channels[i].channel_id); + stream_write_UINT16(s, settings->channels[i].channel_id); } if (settings->num_channels % 2 == 1) - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); } /** @@ -1130,19 +1130,19 @@ void gcc_write_server_network_data(STREAM* s, rdpSettings* settings) * @param settings rdp settings */ -boolean gcc_read_client_cluster_data(STREAM* s, rdpSettings* settings, uint16 blockLength) +BOOL gcc_read_client_cluster_data(STREAM* s, rdpSettings* settings, UINT16 blockLength) { - uint32 flags; + UINT32 flags; if (blockLength < 8) - return false; + return FALSE; - stream_read_uint32(s, flags); /* flags */ + stream_read_UINT32(s, flags); /* flags */ if ((flags & REDIRECTED_SESSIONID_FIELD_VALID)) - stream_read_uint32(s, settings->redirected_session_id); /* redirectedSessionID */ + stream_read_UINT32(s, settings->redirected_session_id); /* redirectedSessionID */ - return true; + return TRUE; } /** @@ -1154,7 +1154,7 @@ boolean gcc_read_client_cluster_data(STREAM* s, rdpSettings* settings, uint16 bl void gcc_write_client_cluster_data(STREAM* s, rdpSettings* settings) { - uint32 flags; + UINT32 flags; gcc_write_user_data_header(s, CS_CLUSTER, 12); @@ -1163,8 +1163,8 @@ void gcc_write_client_cluster_data(STREAM* s, rdpSettings* settings) if (settings->console_session || settings->redirected_session_id) flags |= REDIRECTED_SESSIONID_FIELD_VALID; - stream_write_uint32(s, flags); /* flags */ - stream_write_uint32(s, settings->redirected_session_id); /* redirectedSessionID */ + stream_write_UINT32(s, flags); /* flags */ + stream_write_UINT32(s, settings->redirected_session_id); /* redirectedSessionID */ } /** @@ -1174,10 +1174,10 @@ void gcc_write_client_cluster_data(STREAM* s, rdpSettings* settings) * @param settings rdp settings */ -boolean gcc_read_client_monitor_data(STREAM* s, rdpSettings* settings, uint16 blockLength) +BOOL gcc_read_client_monitor_data(STREAM* s, rdpSettings* settings, UINT16 blockLength) { printf("CS_MONITOR\n"); - return true; + return TRUE; } /** @@ -1190,16 +1190,16 @@ boolean gcc_read_client_monitor_data(STREAM* s, rdpSettings* settings, uint16 bl void gcc_write_client_monitor_data(STREAM* s, rdpSettings* settings) { int i; - uint16 length; - uint32 left, top, right, bottom, flags; + UINT16 length; + UINT32 left, top, right, bottom, flags; if (settings->num_monitors > 1) { length = (20 * settings->num_monitors) + 12; gcc_write_user_data_header(s, CS_MONITOR, length); - stream_write_uint32(s, 0); /* flags */ - stream_write_uint32(s, settings->num_monitors); /* monitorCount */ + stream_write_UINT32(s, 0); /* flags */ + stream_write_UINT32(s, settings->num_monitors); /* monitorCount */ for (i = 0; i < settings->num_monitors; i++) { @@ -1209,11 +1209,11 @@ void gcc_write_client_monitor_data(STREAM* s, rdpSettings* settings) bottom = settings->monitors[i].y + settings->monitors[i].height - 1; flags = settings->monitors[i].is_primary ? MONITOR_PRIMARY : 0; - stream_write_uint32(s, left); /* left */ - stream_write_uint32(s, top); /* top */ - stream_write_uint32(s, right); /* right */ - stream_write_uint32(s, bottom); /* bottom */ - stream_write_uint32(s, flags); /* flags */ + stream_write_UINT32(s, left); /* left */ + stream_write_UINT32(s, top); /* top */ + stream_write_UINT32(s, right); /* right */ + stream_write_UINT32(s, bottom); /* bottom */ + stream_write_UINT32(s, flags); /* flags */ } } } diff --git a/libfreerdp/core/gcc.h b/libfreerdp/core/gcc.h index 938448ad4..7117992af 100644 --- a/libfreerdp/core/gcc.h +++ b/libfreerdp/core/gcc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.124 Generic Conference Control (GCC) * * Copyright 2011 Marc-Andre Moreau @@ -81,31 +81,31 @@ /* Monitor Flags */ #define MONITOR_PRIMARY 0x00000001 -boolean gcc_read_conference_create_request(STREAM* s, rdpSettings* settings); +BOOL gcc_read_conference_create_request(STREAM* s, rdpSettings* settings); void gcc_write_conference_create_request(STREAM* s, STREAM* user_data); -boolean gcc_read_conference_create_response(STREAM* s, rdpSettings* settings); +BOOL gcc_read_conference_create_response(STREAM* s, rdpSettings* settings); void gcc_write_conference_create_response(STREAM* s, STREAM* user_data); -boolean gcc_read_client_data_blocks(STREAM* s, rdpSettings *settings, int length); +BOOL gcc_read_client_data_blocks(STREAM* s, rdpSettings *settings, int length); void gcc_write_client_data_blocks(STREAM* s, rdpSettings *settings); -boolean gcc_read_server_data_blocks(STREAM* s, rdpSettings *settings, int length); +BOOL gcc_read_server_data_blocks(STREAM* s, rdpSettings *settings, int length); void gcc_write_server_data_blocks(STREAM* s, rdpSettings *settings); -boolean gcc_read_user_data_header(STREAM* s, uint16* type, uint16* length); -void gcc_write_user_data_header(STREAM* s, uint16 type, uint16 length); -boolean gcc_read_client_core_data(STREAM* s, rdpSettings *settings, uint16 blockLength); +BOOL gcc_read_user_data_header(STREAM* s, UINT16* type, UINT16* length); +void gcc_write_user_data_header(STREAM* s, UINT16 type, UINT16 length); +BOOL gcc_read_client_core_data(STREAM* s, rdpSettings *settings, UINT16 blockLength); void gcc_write_client_core_data(STREAM* s, rdpSettings *settings); -boolean gcc_read_server_core_data(STREAM* s, rdpSettings *settings); +BOOL gcc_read_server_core_data(STREAM* s, rdpSettings *settings); void gcc_write_server_core_data(STREAM* s, rdpSettings *settings); -boolean gcc_read_client_security_data(STREAM* s, rdpSettings *settings, uint16 blockLength); +BOOL gcc_read_client_security_data(STREAM* s, rdpSettings *settings, UINT16 blockLength); void gcc_write_client_security_data(STREAM* s, rdpSettings *settings); -boolean gcc_read_server_security_data(STREAM* s, rdpSettings *settings); +BOOL gcc_read_server_security_data(STREAM* s, rdpSettings *settings); void gcc_write_server_security_data(STREAM* s, rdpSettings *settings); -boolean gcc_read_client_network_data(STREAM* s, rdpSettings *settings, uint16 blockLength); +BOOL gcc_read_client_network_data(STREAM* s, rdpSettings *settings, UINT16 blockLength); void gcc_write_client_network_data(STREAM* s, rdpSettings *settings); -boolean gcc_read_server_network_data(STREAM* s, rdpSettings *settings); +BOOL gcc_read_server_network_data(STREAM* s, rdpSettings *settings); void gcc_write_server_network_data(STREAM* s, rdpSettings *settings); -boolean gcc_read_client_cluster_data(STREAM* s, rdpSettings *settings, uint16 blockLength); +BOOL gcc_read_client_cluster_data(STREAM* s, rdpSettings *settings, UINT16 blockLength); void gcc_write_client_cluster_data(STREAM* s, rdpSettings *settings); -boolean gcc_read_client_monitor_data(STREAM* s, rdpSettings *settings, uint16 blockLength); +BOOL gcc_read_client_monitor_data(STREAM* s, rdpSettings *settings, UINT16 blockLength); void gcc_write_client_monitor_data(STREAM* s, rdpSettings *settings); #endif /* __GCC_H */ diff --git a/libfreerdp/core/graphics.c b/libfreerdp/core/graphics.c index 2d7105d0d..f3707e4dc 100644 --- a/libfreerdp/core/graphics.c +++ b/libfreerdp/core/graphics.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Graphical Objects * * Copyright 2011 Marc-Andre Moreau @@ -33,7 +33,7 @@ rdpBitmap* Bitmap_Alloc(rdpContext* context) rdpGraphics* graphics; graphics = context->graphics; - bitmap = (rdpBitmap*) xmalloc(graphics->Bitmap_Prototype->size); + bitmap = (rdpBitmap*) malloc(graphics->Bitmap_Prototype->size); if (bitmap != NULL) { @@ -56,13 +56,13 @@ void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap) bitmap->Free(context, bitmap); if (bitmap->data != NULL) - xfree(bitmap->data); + free(bitmap->data); - xfree(bitmap); + free(bitmap); } } -void Bitmap_SetRectangle(rdpContext* context, rdpBitmap* bitmap, uint16 left, uint16 top, uint16 right, uint16 bottom) +void Bitmap_SetRectangle(rdpContext* context, rdpBitmap* bitmap, UINT16 left, UINT16 top, UINT16 right, UINT16 bottom) { bitmap->left = left; bitmap->top = top; @@ -70,14 +70,14 @@ void Bitmap_SetRectangle(rdpContext* context, rdpBitmap* bitmap, uint16 left, ui bitmap->bottom = bottom; } -void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, uint16 width, uint16 height) +void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, UINT16 width, UINT16 height) { bitmap->width = width; bitmap->height = height; } /* static method */ -void Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean primary) +void Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { context->graphics->Bitmap_Prototype->SetSurface(context, bitmap, primary); } @@ -95,7 +95,7 @@ rdpPointer* Pointer_Alloc(rdpContext* context) rdpGraphics* graphics; graphics = context->graphics; - pointer = (rdpPointer*) xmalloc(graphics->Pointer_Prototype->size); + pointer = (rdpPointer*) malloc(graphics->Pointer_Prototype->size); if (pointer != NULL) { @@ -117,12 +117,12 @@ void Pointer_Free(rdpContext* context, rdpPointer* pointer) pointer->Free(context, pointer); if (pointer->xorMaskData) - xfree(pointer->xorMaskData); + free(pointer->xorMaskData); if (pointer->andMaskData) - xfree(pointer->andMaskData); + free(pointer->andMaskData); - xfree(pointer); + free(pointer); } } @@ -155,7 +155,7 @@ rdpGlyph* Glyph_Alloc(rdpContext* context) rdpGraphics* graphics; graphics = context->graphics; - glyph = (rdpGlyph*) xmalloc(graphics->Glyph_Prototype->size); + glyph = (rdpGlyph*) malloc(graphics->Glyph_Prototype->size); if (glyph != NULL) { @@ -180,12 +180,12 @@ void Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y) context->graphics->Glyph_Prototype->Draw(context, glyph, x, y); } -void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor) +void Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) { context->graphics->Glyph_Prototype->BeginDraw(context, x, y, width, height, bgcolor, fgcolor); } -void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor) +void Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) { context->graphics->Glyph_Prototype->EndDraw(context, x, y, width, height, bgcolor, fgcolor); } @@ -230,9 +230,9 @@ void graphics_free(rdpGraphics* graphics) { if (graphics != NULL) { - xfree(graphics->Bitmap_Prototype); - xfree(graphics->Pointer_Prototype); - xfree(graphics->Glyph_Prototype); - xfree(graphics); + free(graphics->Bitmap_Prototype); + free(graphics->Pointer_Prototype); + free(graphics->Glyph_Prototype); + free(graphics); } } diff --git a/libfreerdp/core/http.c b/libfreerdp/core/http.c index c628a61ce..561174326 100644 --- a/libfreerdp/core/http.c +++ b/libfreerdp/core/http.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Hypertext Transfer Protocol (HTTP) * * Copyright 2012 Marc-Andre Moreau @@ -42,119 +42,115 @@ HttpContext* http_context_new() void http_context_set_method(HttpContext* http_context, char* method) { if (http_context->Method) - xfree(http_context->Method); + free(http_context->Method); - http_context->Method = xstrdup(method); + http_context->Method = _strdup(method); } void http_context_set_uri(HttpContext* http_context, char* uri) { if (http_context->URI) - xfree(http_context->URI); + free(http_context->URI); - http_context->URI = xstrdup(uri); + http_context->URI = _strdup(uri); } void http_context_set_user_agent(HttpContext* http_context, char* user_agent) { if (http_context->UserAgent) - xfree(http_context->UserAgent); + free(http_context->UserAgent); - http_context->UserAgent = xstrdup(user_agent); + http_context->UserAgent = _strdup(user_agent); } void http_context_set_host(HttpContext* http_context, char* host) { if (http_context->Host) - xfree(http_context->Host); + free(http_context->Host); - http_context->Host = xstrdup(host); + http_context->Host = _strdup(host); } void http_context_set_accept(HttpContext* http_context, char* accept) { if (http_context->Accept) - xfree(http_context->Accept); + free(http_context->Accept); - http_context->Accept = xstrdup(accept); + http_context->Accept = _strdup(accept); } void http_context_set_cache_control(HttpContext* http_context, char* cache_control) { if (http_context->CacheControl) - xfree(http_context->CacheControl); + free(http_context->CacheControl); - http_context->CacheControl = xstrdup(cache_control); + http_context->CacheControl = _strdup(cache_control); } void http_context_set_connection(HttpContext* http_context, char* connection) { if (http_context->Connection) - xfree(http_context->Connection); + free(http_context->Connection); - http_context->Connection = xstrdup(connection); + http_context->Connection = _strdup(connection); } void http_context_set_pragma(HttpContext* http_context, char* pragma) { if (http_context->Pragma) - xfree(http_context->Pragma); + free(http_context->Pragma); - http_context->Pragma = xstrdup(pragma); + http_context->Pragma = _strdup(pragma); } void http_context_free(HttpContext* http_context) { if (http_context != NULL) { - xfree(http_context->UserAgent); - xfree(http_context->Host); - xfree(http_context->Accept); - xfree(http_context->CacheControl); - xfree(http_context->Connection); - xfree(http_context->Pragma); - xfree(http_context); + free(http_context->UserAgent); + free(http_context->Host); + free(http_context->Accept); + free(http_context->CacheControl); + free(http_context->Connection); + free(http_context->Pragma); + free(http_context); } } void http_request_set_method(HttpRequest* http_request, char* method) { if (http_request->Method) - xfree(http_request->Method); + free(http_request->Method); - http_request->Method = xstrdup(method); + http_request->Method = _strdup(method); } void http_request_set_uri(HttpRequest* http_request, char* uri) { if (http_request->URI) - xfree(http_request->URI); + free(http_request->URI); - http_request->URI = xstrdup(uri); + http_request->URI = _strdup(uri); } void http_request_set_auth_scheme(HttpRequest* http_request, char* auth_scheme) { if (http_request->AuthScheme) - xfree(http_request->AuthScheme); + free(http_request->AuthScheme); - http_request->AuthScheme = xstrdup(auth_scheme); + http_request->AuthScheme = _strdup(auth_scheme); } void http_request_set_auth_param(HttpRequest* http_request, char* auth_param) { if (http_request->AuthParam) - xfree(http_request->AuthParam); + free(http_request->AuthParam); - http_request->AuthParam = xstrdup(auth_param); + http_request->AuthParam = _strdup(auth_param); } #ifndef _WIN32 -#ifndef errno_t -typedef int errno_t; -#endif - errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, int radix) { int length; @@ -261,11 +257,11 @@ STREAM* http_request_write(HttpContext* http_context, HttpRequest* http_request) { stream_write(s, http_request->lines[i], strlen(http_request->lines[i])); stream_write(s, "\n", 1); - xfree(http_request->lines[i]); + free(http_request->lines[i]); } stream_write(s, "\n", 1); - xfree(http_request->lines); + free(http_request->lines); stream_write(s, "\0", 1); /* append null terminator */ stream_rewind(s, 1); /* don't include null terminator in length */ @@ -290,9 +286,9 @@ void http_request_free(HttpRequest* http_request) { if (http_request != NULL) { - xfree(http_request->Method); - xfree(http_request->URI); - xfree(http_request); + free(http_request->Method); + free(http_request->URI); + free(http_request); } } @@ -310,7 +306,7 @@ void http_response_parse_header_status_line(HttpResponse* http_response, char* s *separator = '\0'; http_response->StatusCode = atoi(status_code); - http_response->ReasonPhrase = xstrdup(reason_phrase); + http_response->ReasonPhrase = _strdup(reason_phrase); *separator = ' '; } @@ -324,15 +320,15 @@ void http_response_parse_header_field(HttpResponse* http_response, char* name, c { char* separator; - http_response->Authorization = xstrdup(value); + http_response->Authorization = _strdup(value); separator = strchr(value, ' '); if (separator != NULL) { *separator = '\0'; - http_response->AuthScheme = xstrdup(value); - http_response->AuthParam = xstrdup(separator + 1); + http_response->AuthScheme = _strdup(value); + http_response->AuthParam = _strdup(separator + 1); *separator = ' '; } } @@ -355,8 +351,8 @@ void http_response_parse_header_field(HttpResponse* http_response, char* name, c /* WWW-Authenticate: NTLM base64token */ *separator = '\0'; - http_response->AuthScheme = xstrdup(value); - http_response->AuthParam = xstrdup(separator + 1); + http_response->AuthScheme = _strdup(value); + http_response->AuthParam = _strdup(separator + 1); *separator = ' '; return; @@ -409,30 +405,30 @@ void http_response_print(HttpResponse* http_response) HttpResponse* http_response_recv(rdpTls* tls) { - uint8* p; + BYTE* p; int nbytes; int length; int status; - uint8* buffer; + BYTE* buffer; char* content; char* header_end; HttpResponse* http_response; nbytes = 0; length = 10000; - buffer = xmalloc(length); + buffer = malloc(length); http_response = http_response_new(); p = buffer; - while (true) + while (TRUE) { status = tls_read(tls, p, length - nbytes); if (status > 0) { nbytes += status; - p = (uint8*) &buffer[nbytes]; + p = (BYTE*) &buffer[nbytes]; } else if (status == 0) { @@ -466,14 +462,14 @@ HttpResponse* http_response_recv(rdpTls* tls) } http_response->count = count; - http_response->lines = (char**) xmalloc(sizeof(char*) * http_response->count); + http_response->lines = (char**) malloc(sizeof(char*) * http_response->count); count = 0; line = strtok((char*) buffer, "\r\n"); while (line != NULL) { - http_response->lines[count] = xstrdup(line); + http_response->lines[count] = _strdup(line); line = strtok(NULL, "\r\n"); count++; } @@ -482,7 +478,7 @@ HttpResponse* http_response_recv(rdpTls* tls) if (http_response->ContentLength > 0) { - http_response->Content = xstrdup(content); + http_response->Content = _strdup(content); } break; @@ -491,12 +487,12 @@ HttpResponse* http_response_recv(rdpTls* tls) if ((length - nbytes) <= 0) { length *= 2; - buffer = xrealloc(buffer, length); - p = (uint8*) &buffer[nbytes]; + buffer = realloc(buffer, length); + p = (BYTE*) &buffer[nbytes]; } } - xfree(buffer); + free(buffer); return http_response; } @@ -520,19 +516,19 @@ void http_response_free(HttpResponse* http_response) if (http_response != NULL) { for (i = 0; i < http_response->count; i++) - xfree(http_response->lines[i]); + free(http_response->lines[i]); - xfree(http_response->lines); + free(http_response->lines); - xfree(http_response->ReasonPhrase); + free(http_response->ReasonPhrase); - xfree(http_response->AuthParam); - xfree(http_response->AuthScheme); - xfree(http_response->Authorization); + free(http_response->AuthParam); + free(http_response->AuthScheme); + free(http_response->Authorization); if (http_response->ContentLength > 0) - xfree(http_response->Content); + free(http_response->Content); - xfree(http_response); + free(http_response); } } diff --git a/libfreerdp/core/http.h b/libfreerdp/core/http.h index 2b3bee83c..4fd8dd03c 100644 --- a/libfreerdp/core/http.h +++ b/libfreerdp/core/http.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Hypertext Transfer Protocol (HTTP) * * Copyright 2012 Marc-Andre Moreau diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c index 8e50a1c34..fc9780b53 100644 --- a/libfreerdp/core/info.c +++ b/libfreerdp/core/info.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Client Info * * Copyright 2011 Marc-Andre Moreau @@ -54,9 +54,9 @@ void rdp_read_server_auto_reconnect_cookie(STREAM* s, rdpSettings* settings) ARC_SC_PRIVATE_PACKET* autoReconnectCookie; autoReconnectCookie = settings->server_auto_reconnect_cookie; - stream_read_uint32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */ - stream_read_uint32(s, autoReconnectCookie->version); /* version (4 bytes) */ - stream_read_uint32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */ + stream_read_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */ + stream_read_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */ + stream_read_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */ stream_read(s, autoReconnectCookie->arcRandomBits, 16); /* arcRandomBits (16 bytes) */ } @@ -67,20 +67,20 @@ void rdp_read_server_auto_reconnect_cookie(STREAM* s, rdpSettings* settings) * @param settings settings */ -boolean rdp_read_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings) +BOOL rdp_read_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings) { ARC_CS_PRIVATE_PACKET* autoReconnectCookie; autoReconnectCookie = settings->client_auto_reconnect_cookie; if (stream_get_left(s) < 28) - return false; + return FALSE; - stream_read_uint32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */ - stream_read_uint32(s, autoReconnectCookie->version); /* version (4 bytes) */ - stream_read_uint32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */ + stream_read_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */ + stream_read_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */ + stream_read_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */ stream_read(s, autoReconnectCookie->securityVerifier, 16); /* SecurityVerifier */ - return true; + return TRUE; } /** @@ -95,9 +95,9 @@ void rdp_write_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings) ARC_CS_PRIVATE_PACKET* autoReconnectCookie; autoReconnectCookie = settings->client_auto_reconnect_cookie; - stream_write_uint32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */ - stream_write_uint32(s, autoReconnectCookie->version); /* version (4 bytes) */ - stream_write_uint32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */ + stream_write_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */ + stream_write_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */ + stream_write_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */ stream_write(s, autoReconnectCookie->securityVerifier, 16); /* SecurityVerifier */ } @@ -108,42 +108,42 @@ void rdp_write_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings) * @param settings settings */ -boolean rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings) +BOOL rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings) { - uint16 clientAddressFamily; - uint16 cbClientAddress; - uint16 cbClientDir; - uint16 cbAutoReconnectLen; + UINT16 clientAddressFamily; + UINT16 cbClientAddress; + UINT16 cbClientDir; + UINT16 cbAutoReconnectLen; - stream_read_uint16(s, clientAddressFamily); /* clientAddressFamily */ - stream_read_uint16(s, cbClientAddress); /* cbClientAddress */ + stream_read_UINT16(s, clientAddressFamily); /* clientAddressFamily */ + stream_read_UINT16(s, cbClientAddress); /* cbClientAddress */ - settings->ipv6 = (clientAddressFamily == ADDRESS_FAMILY_INET6 ? true : false); + settings->ipv6 = (clientAddressFamily == ADDRESS_FAMILY_INET6 ? TRUE : FALSE); if (stream_get_left(s) < cbClientAddress) - return false; + return FALSE; freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->ip_address, cbClientAddress / 2); stream_seek(s, cbClientAddress); - stream_read_uint16(s, cbClientDir); /* cbClientDir */ + stream_read_UINT16(s, cbClientDir); /* cbClientDir */ if (stream_get_left(s) < cbClientDir) - return false; + return FALSE; if (settings->client_dir) - xfree(settings->client_dir); + free(settings->client_dir); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->client_dir, cbClientDir / 2); stream_seek(s, cbClientDir); if (!rdp_read_client_time_zone(s, settings)) - return false; + return FALSE; - stream_seek_uint32(s); /* clientSessionId, should be set to 0 */ - stream_read_uint32(s, settings->performance_flags); /* performanceFlags */ + stream_seek_UINT32(s); /* clientSessionId, should be set to 0 */ + stream_read_UINT32(s, settings->performance_flags); /* performanceFlags */ - stream_read_uint16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */ + stream_read_UINT16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */ if (cbAutoReconnectLen > 0) return rdp_read_client_auto_reconnect_cookie(s, settings); /* autoReconnectCookie */ @@ -151,7 +151,7 @@ boolean rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings) /* reserved1 (2 bytes) */ /* reserved2 (2 bytes) */ - return true; + return TRUE; } /** @@ -178,26 +178,26 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings) cbAutoReconnectLen = (int) settings->client_auto_reconnect_cookie->cbLen; - stream_write_uint16(s, clientAddressFamily); /* clientAddressFamily */ + stream_write_UINT16(s, clientAddressFamily); /* clientAddressFamily */ - stream_write_uint16(s, cbClientAddress + 2); /* cbClientAddress */ + stream_write_UINT16(s, cbClientAddress + 2); /* cbClientAddress */ if (cbClientAddress > 0) stream_write(s, clientAddress, cbClientAddress); /* clientAddress */ - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); - stream_write_uint16(s, cbClientDir + 2); /* cbClientDir */ + stream_write_UINT16(s, cbClientDir + 2); /* cbClientDir */ if (cbClientDir > 0) stream_write(s, clientDir, cbClientDir); /* clientDir */ - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); rdp_write_client_time_zone(s, settings); /* clientTimeZone */ - stream_write_uint32(s, 0); /* clientSessionId, should be set to 0 */ - stream_write_uint32(s, settings->performance_flags); /* performanceFlags */ + stream_write_UINT32(s, 0); /* clientSessionId, should be set to 0 */ + stream_write_UINT32(s, settings->performance_flags); /* performanceFlags */ - stream_write_uint16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */ + stream_write_UINT16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */ if (cbAutoReconnectLen > 0) rdp_write_client_auto_reconnect_cookie(s, settings); /* autoReconnectCookie */ @@ -205,8 +205,8 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings) /* reserved1 (2 bytes) */ /* reserved2 (2 bytes) */ - xfree(clientAddress); - xfree(clientDir); + free(clientAddress); + free(clientDir); } /** @@ -216,31 +216,31 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings) * @param settings settings */ -boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) +BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings) { - uint32 flags; - uint16 cbDomain; - uint16 cbUserName; - uint16 cbPassword; - uint16 cbAlternateShell; - uint16 cbWorkingDir; + UINT32 flags; + UINT16 cbDomain; + UINT16 cbUserName; + UINT16 cbPassword; + UINT16 cbAlternateShell; + UINT16 cbWorkingDir; - stream_seek_uint32(s); /* CodePage */ - stream_read_uint32(s, flags); /* flags */ + stream_seek_UINT32(s); /* CodePage */ + stream_read_UINT32(s, flags); /* flags */ - settings->autologon = ((flags & INFO_AUTOLOGON) ? true : false); - settings->remote_app = ((flags & INFO_RAIL) ? true : false); - settings->console_audio = ((flags & INFO_REMOTECONSOLEAUDIO) ? true : false); - settings->compression = ((flags & INFO_COMPRESSION) ? true : false); + settings->autologon = ((flags & INFO_AUTOLOGON) ? TRUE : FALSE); + settings->remote_app = ((flags & INFO_RAIL) ? TRUE : FALSE); + settings->console_audio = ((flags & INFO_REMOTECONSOLEAUDIO) ? TRUE : FALSE); + settings->compression = ((flags & INFO_COMPRESSION) ? TRUE : FALSE); - stream_read_uint16(s, cbDomain); /* cbDomain */ - stream_read_uint16(s, cbUserName); /* cbUserName */ - stream_read_uint16(s, cbPassword); /* cbPassword */ - stream_read_uint16(s, cbAlternateShell); /* cbAlternateShell */ - stream_read_uint16(s, cbWorkingDir); /* cbWorkingDir */ + stream_read_UINT16(s, cbDomain); /* cbDomain */ + stream_read_UINT16(s, cbUserName); /* cbUserName */ + stream_read_UINT16(s, cbPassword); /* cbPassword */ + stream_read_UINT16(s, cbAlternateShell); /* cbAlternateShell */ + stream_read_UINT16(s, cbWorkingDir); /* cbWorkingDir */ if (stream_get_left(s) < cbDomain + 2) - return false; + return FALSE; if (cbDomain > 0) { @@ -250,7 +250,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) stream_seek(s, 2); if (stream_get_left(s) < cbUserName + 2) - return false; + return FALSE; if (cbUserName > 0) { @@ -260,7 +260,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) stream_seek(s, 2); if (stream_get_left(s) < cbPassword + 2) - return false; + return FALSE; if (cbPassword > 0) { @@ -270,7 +270,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) stream_seek(s, 2); if (stream_get_left(s) < cbAlternateShell + 2) - return false; + return FALSE; if (cbAlternateShell > 0) { @@ -280,7 +280,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) stream_seek(s, 2); if (stream_get_left(s) < cbWorkingDir + 2) - return false; + return FALSE; if (cbWorkingDir > 0) { @@ -292,7 +292,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) if (settings->rdp_version >= 5) return rdp_read_extended_info_packet(s, settings); /* extraInfo */ - return true; + return TRUE; } /** @@ -304,7 +304,7 @@ boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings) void rdp_write_info_packet(STREAM* s, rdpSettings* settings) { - uint32 flags; + UINT32 flags; WCHAR* domain; int cbDomain; WCHAR* userName; @@ -315,7 +315,7 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings) int cbAlternateShell; WCHAR* workingDir; int cbWorkingDir; - boolean usedPasswordCookie = false; + BOOL usedPasswordCookie = FALSE; flags = INFO_MOUSE | INFO_UNICODE | @@ -357,7 +357,7 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings) if (settings->password_cookie && settings->password_cookie_length > 0) { - usedPasswordCookie = true; + usedPasswordCookie = TRUE; password = (WCHAR*) settings->password_cookie; cbPassword = settings->password_cookie_length - 2; /* Strip double zero termination */ } @@ -370,42 +370,42 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings) cbWorkingDir = freerdp_AsciiToUnicodeAlloc(settings->directory, &workingDir, 0) * 2; - stream_write_uint32(s, 0); /* CodePage */ - stream_write_uint32(s, flags); /* flags */ + stream_write_UINT32(s, 0); /* CodePage */ + stream_write_UINT32(s, flags); /* flags */ - stream_write_uint16(s, cbDomain); /* cbDomain */ - stream_write_uint16(s, cbUserName); /* cbUserName */ - stream_write_uint16(s, cbPassword); /* cbPassword */ - stream_write_uint16(s, cbAlternateShell); /* cbAlternateShell */ - stream_write_uint16(s, cbWorkingDir); /* cbWorkingDir */ + stream_write_UINT16(s, cbDomain); /* cbDomain */ + stream_write_UINT16(s, cbUserName); /* cbUserName */ + stream_write_UINT16(s, cbPassword); /* cbPassword */ + stream_write_UINT16(s, cbAlternateShell); /* cbAlternateShell */ + stream_write_UINT16(s, cbWorkingDir); /* cbWorkingDir */ if (cbDomain > 0) stream_write(s, domain, cbDomain); - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); if (cbUserName > 0) stream_write(s, userName, cbUserName); - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); if (cbPassword > 0) stream_write(s, password, cbPassword); - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); if (cbAlternateShell > 0) stream_write(s, alternateShell, cbAlternateShell); - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); if (cbWorkingDir > 0) stream_write(s, workingDir, cbWorkingDir); - stream_write_uint16(s, 0); + stream_write_UINT16(s, 0); - xfree(domain); - xfree(userName); - xfree(alternateShell); - xfree(workingDir); + free(domain); + free(userName); + free(alternateShell); + free(workingDir); if (!usedPasswordCookie) - xfree(password); + free(password); if (settings->rdp_version >= 5) rdp_write_extended_info_packet(s, settings); /* extraInfo */ @@ -418,32 +418,32 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings) * @param s stream */ -boolean rdp_recv_client_info(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_client_info(rdpRdp* rdp, STREAM* s) { - uint16 length; - uint16 channelId; - uint16 securityFlags; + UINT16 length; + UINT16 channelId; + UINT16 securityFlags; if (!rdp_read_header(rdp, s, &length, &channelId)) - return false; + return FALSE; rdp_read_security_header(s, &securityFlags); if ((securityFlags & SEC_INFO_PKT) == 0) - return false; + return FALSE; if (rdp->settings->encryption) { if (securityFlags & SEC_REDIRECTION_PKT) { printf("Error: SEC_REDIRECTION_PKT unsupported\n"); - return false; + return FALSE; } if (securityFlags & SEC_ENCRYPT) { if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { printf("rdp_decrypt failed\n"); - return false; + return FALSE; } } } @@ -457,7 +457,7 @@ boolean rdp_recv_client_info(rdpRdp* rdp, STREAM* s) * @param rdp RDP module */ -boolean rdp_send_client_info(rdpRdp* rdp) +BOOL rdp_send_client_info(rdpRdp* rdp) { STREAM* s; @@ -470,26 +470,26 @@ boolean rdp_send_client_info(rdpRdp* rdp) void rdp_recv_logon_info_v1(rdpRdp* rdp, STREAM* s) { - uint32 cbDomain; - uint32 cbUserName; + UINT32 cbDomain; + UINT32 cbUserName; - stream_read_uint32(s, cbDomain); /* cbDomain (4 bytes) */ + stream_read_UINT32(s, cbDomain); /* cbDomain (4 bytes) */ stream_seek(s, 52); /* domain (52 bytes) */ - stream_read_uint32(s, cbUserName); /* cbUserName (4 bytes) */ + stream_read_UINT32(s, cbUserName); /* cbUserName (4 bytes) */ stream_seek(s, 512); /* userName (512 bytes) */ - stream_seek_uint32(s); /* sessionId (4 bytes) */ + stream_seek_UINT32(s); /* sessionId (4 bytes) */ } void rdp_recv_logon_info_v2(rdpRdp* rdp, STREAM* s) { - uint32 cbDomain; - uint32 cbUserName; + UINT32 cbDomain; + UINT32 cbUserName; - stream_seek_uint16(s); /* version (2 bytes) */ - stream_seek_uint32(s); /* size (4 bytes) */ - stream_seek_uint32(s); /* sessionId (4 bytes) */ - stream_read_uint32(s, cbDomain); /* cbDomain (4 bytes) */ - stream_read_uint32(s, cbUserName); /* cbUserName (4 bytes) */ + stream_seek_UINT16(s); /* version (2 bytes) */ + stream_seek_UINT32(s); /* size (4 bytes) */ + stream_seek_UINT32(s); /* sessionId (4 bytes) */ + stream_read_UINT32(s, cbDomain); /* cbDomain (4 bytes) */ + stream_read_UINT32(s, cbUserName); /* cbUserName (4 bytes) */ stream_seek(s, 558); /* pad */ stream_seek(s, cbDomain); /* domain */ stream_seek(s, cbUserName); /* userName */ @@ -502,44 +502,44 @@ void rdp_recv_logon_plain_notify(rdpRdp* rdp, STREAM* s) void rdp_recv_logon_error_info(rdpRdp* rdp, STREAM* s) { - uint32 errorNotificationType; - uint32 errorNotificationData; + UINT32 errorNotificationType; + UINT32 errorNotificationData; - stream_read_uint32(s, errorNotificationType); /* errorNotificationType (4 bytes) */ - stream_read_uint32(s, errorNotificationData); /* errorNotificationData (4 bytes) */ + stream_read_UINT32(s, errorNotificationType); /* errorNotificationType (4 bytes) */ + stream_read_UINT32(s, errorNotificationData); /* errorNotificationData (4 bytes) */ } void rdp_recv_logon_info_extended(rdpRdp* rdp, STREAM* s) { - uint32 cbFieldData; - uint32 fieldsPresent; - uint16 Length; + UINT32 cbFieldData; + UINT32 fieldsPresent; + UINT16 Length; - stream_read_uint16(s, Length); /* The total size in bytes of this structure */ - stream_read_uint32(s, fieldsPresent); /* fieldsPresent (4 bytes) */ + stream_read_UINT16(s, Length); /* The total size in bytes of this structure */ + stream_read_UINT32(s, fieldsPresent); /* fieldsPresent (4 bytes) */ /* logonFields */ if (fieldsPresent & LOGON_EX_AUTORECONNECTCOOKIE) { - stream_read_uint32(s, cbFieldData); /* cbFieldData (4 bytes) */ + stream_read_UINT32(s, cbFieldData); /* cbFieldData (4 bytes) */ rdp_read_server_auto_reconnect_cookie(s, rdp->settings); } if (fieldsPresent & LOGON_EX_LOGONERRORS) { - stream_read_uint32(s, cbFieldData); /* cbFieldData (4 bytes) */ + stream_read_UINT32(s, cbFieldData); /* cbFieldData (4 bytes) */ rdp_recv_logon_error_info(rdp, s); } stream_seek(s, 570); /* pad */ } -boolean rdp_recv_save_session_info(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_save_session_info(rdpRdp* rdp, STREAM* s) { - uint32 infoType; + UINT32 infoType; - stream_read_uint32(s, infoType); /* infoType (4 bytes) */ + stream_read_UINT32(s, infoType); /* infoType (4 bytes) */ //printf("%s\n", INFO_TYPE_LOGON_STRINGS[infoType]); @@ -565,6 +565,6 @@ boolean rdp_recv_save_session_info(rdpRdp* rdp, STREAM* s) break; } - return true; + return TRUE; } diff --git a/libfreerdp/core/info.h b/libfreerdp/core/info.h index e46582bab..fa3d0f1a1 100644 --- a/libfreerdp/core/info.h +++ b/libfreerdp/core/info.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Client Info * * Copyright 2011 Marc-Andre Moreau @@ -73,18 +73,18 @@ void rdp_read_system_time(STREAM* s, SYSTEM_TIME* system_time); void rdp_write_system_time(STREAM* s, SYSTEM_TIME* system_time); void rdp_get_client_time_zone(STREAM* s, rdpSettings* settings); -boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings); +BOOL rdp_read_client_time_zone(STREAM* s, rdpSettings* settings); void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings); void rdp_read_server_auto_reconnect_cookie(STREAM* s, rdpSettings* settings); -boolean rdp_read_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings); +BOOL rdp_read_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings); void rdp_write_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings); void rdp_write_auto_reconnect_cookie(STREAM* s, rdpSettings* settings); -boolean rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings); +BOOL rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings); void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings); -boolean rdp_read_info_packet(STREAM* s, rdpSettings* settings); +BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings); void rdp_write_info_packet(STREAM* s, rdpSettings* settings); -boolean rdp_recv_client_info(rdpRdp* rdp, STREAM* s); -boolean rdp_send_client_info(rdpRdp* rdp); -boolean rdp_recv_save_session_info(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_client_info(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_client_info(rdpRdp* rdp); +BOOL rdp_recv_save_session_info(rdpRdp* rdp, STREAM* s); #endif /* __INFO_H */ diff --git a/libfreerdp/core/input.c b/libfreerdp/core/input.c index 17d9fdbb1..99e92b37f 100644 --- a/libfreerdp/core/input.c +++ b/libfreerdp/core/input.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Input PDUs * * Copyright 2011 Marc-Andre Moreau @@ -25,19 +25,19 @@ #include "input.h" -void rdp_write_client_input_pdu_header(STREAM* s, uint16 number) +void rdp_write_client_input_pdu_header(STREAM* s, UINT16 number) { - stream_write_uint16(s, 1); /* numberEvents (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, 1); /* numberEvents (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ } -void rdp_write_input_event_header(STREAM* s, uint32 time, uint16 type) +void rdp_write_input_event_header(STREAM* s, UINT32 time, UINT16 type) { - stream_write_uint32(s, time); /* eventTime (4 bytes) */ - stream_write_uint16(s, type); /* messageType (2 bytes) */ + stream_write_UINT32(s, time); /* eventTime (4 bytes) */ + stream_write_UINT16(s, type); /* messageType (2 bytes) */ } -STREAM* rdp_client_input_pdu_init(rdpRdp* rdp, uint16 type) +STREAM* rdp_client_input_pdu_init(rdpRdp* rdp, UINT16 type) { STREAM* s; s = rdp_data_pdu_init(rdp); @@ -51,13 +51,13 @@ void rdp_send_client_input_pdu(rdpRdp* rdp, STREAM* s) rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_INPUT, rdp->mcs->user_id); } -void input_write_synchronize_event(STREAM* s, uint32 flags) +void input_write_synchronize_event(STREAM* s, UINT32 flags) { - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ - stream_write_uint32(s, flags); /* toggleFlags (4 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT32(s, flags); /* toggleFlags (4 bytes) */ } -void input_send_synchronize_event(rdpInput* input, uint32 flags) +void input_send_synchronize_event(rdpInput* input, UINT32 flags) { STREAM* s; rdpRdp* rdp = input->context->rdp; @@ -67,14 +67,14 @@ void input_send_synchronize_event(rdpInput* input, uint32 flags) rdp_send_client_input_pdu(rdp, s); } -void input_write_keyboard_event(STREAM* s, uint16 flags, uint16 code) +void input_write_keyboard_event(STREAM* s, UINT16 flags, UINT16 code) { - stream_write_uint16(s, flags); /* keyboardFlags (2 bytes) */ - stream_write_uint16(s, code); /* keyCode (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, flags); /* keyboardFlags (2 bytes) */ + stream_write_UINT16(s, code); /* keyCode (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ } -void input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { STREAM* s; rdpRdp* rdp = input->context->rdp; @@ -84,17 +84,17 @@ void input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code) rdp_send_client_input_pdu(rdp, s); } -void input_write_unicode_keyboard_event(STREAM* s, uint16 flags, uint16 code) +void input_write_unicode_keyboard_event(STREAM* s, UINT16 flags, UINT16 code) { - stream_write_uint16(s, flags); /* keyboardFlags (2 bytes) */ - stream_write_uint16(s, code); /* unicodeCode (2 bytes) */ - stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ + stream_write_UINT16(s, flags); /* keyboardFlags (2 bytes) */ + stream_write_UINT16(s, code); /* unicodeCode (2 bytes) */ + stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */ } -void input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { STREAM* s; - uint16 keyboardFlags = 0; + UINT16 keyboardFlags = 0; rdpRdp* rdp = input->context->rdp; /* @@ -113,14 +113,14 @@ void input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 cod rdp_send_client_input_pdu(rdp, s); } -void input_write_mouse_event(STREAM* s, uint16 flags, uint16 x, uint16 y) +void input_write_mouse_event(STREAM* s, UINT16 flags, UINT16 x, UINT16 y) { - stream_write_uint16(s, flags); /* pointerFlags (2 bytes) */ - stream_write_uint16(s, x); /* xPos (2 bytes) */ - stream_write_uint16(s, y); /* yPos (2 bytes) */ + stream_write_UINT16(s, flags); /* pointerFlags (2 bytes) */ + stream_write_UINT16(s, x); /* xPos (2 bytes) */ + stream_write_UINT16(s, y); /* yPos (2 bytes) */ } -void input_send_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { STREAM* s; rdpRdp* rdp = input->context->rdp; @@ -130,14 +130,14 @@ void input_send_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) rdp_send_client_input_pdu(rdp, s); } -void input_write_extended_mouse_event(STREAM* s, uint16 flags, uint16 x, uint16 y) +void input_write_extended_mouse_event(STREAM* s, UINT16 flags, UINT16 x, UINT16 y) { - stream_write_uint16(s, flags); /* pointerFlags (2 bytes) */ - stream_write_uint16(s, x); /* xPos (2 bytes) */ - stream_write_uint16(s, y); /* yPos (2 bytes) */ + stream_write_UINT16(s, flags); /* pointerFlags (2 bytes) */ + stream_write_UINT16(s, x); /* xPos (2 bytes) */ + stream_write_UINT16(s, y); /* yPos (2 bytes) */ } -void input_send_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { STREAM* s; rdpRdp* rdp = input->context->rdp; @@ -147,42 +147,42 @@ void input_send_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, ui rdp_send_client_input_pdu(rdp, s); } -void input_send_fastpath_synchronize_event(rdpInput* input, uint32 flags) +void input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags) { STREAM* s; rdpRdp* rdp = input->context->rdp; /* The FastPath Synchronization eventFlags has identical values as SlowPath */ - s = fastpath_input_pdu_init(rdp->fastpath, (uint8) flags, FASTPATH_INPUT_EVENT_SYNC); + s = fastpath_input_pdu_init(rdp->fastpath, (BYTE) flags, FASTPATH_INPUT_EVENT_SYNC); fastpath_send_input_pdu(rdp->fastpath, s); } -void input_send_fastpath_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { STREAM* s; - uint8 eventFlags = 0; + BYTE eventFlags = 0; rdpRdp* rdp = input->context->rdp; eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0; eventFlags |= (flags & KBD_FLAGS_EXTENDED) ? FASTPATH_INPUT_KBDFLAGS_EXTENDED : 0; s = fastpath_input_pdu_init(rdp->fastpath, eventFlags, FASTPATH_INPUT_EVENT_SCANCODE); - stream_write_uint8(s, code); /* keyCode (1 byte) */ + stream_write_BYTE(s, code); /* keyCode (1 byte) */ fastpath_send_input_pdu(rdp->fastpath, s); } -void input_send_fastpath_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { STREAM* s; - uint8 eventFlags = 0; + BYTE eventFlags = 0; rdpRdp* rdp = input->context->rdp; eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0; s = fastpath_input_pdu_init(rdp->fastpath, eventFlags, FASTPATH_INPUT_EVENT_UNICODE); - stream_write_uint16(s, code); /* unicodeCode (2 bytes) */ + stream_write_UINT16(s, code); /* unicodeCode (2 bytes) */ fastpath_send_input_pdu(rdp->fastpath, s); } -void input_send_fastpath_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { STREAM* s; rdpRdp* rdp = input->context->rdp; @@ -192,7 +192,7 @@ void input_send_fastpath_mouse_event(rdpInput* input, uint16 flags, uint16 x, ui fastpath_send_input_pdu(rdp->fastpath, s); } -void input_send_fastpath_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { STREAM* s; rdpRdp* rdp = input->context->rdp; @@ -202,46 +202,46 @@ void input_send_fastpath_extended_mouse_event(rdpInput* input, uint16 flags, uin fastpath_send_input_pdu(rdp->fastpath, s); } -static boolean input_recv_sync_event(rdpInput* input, STREAM* s) +static BOOL input_recv_sync_event(rdpInput* input, STREAM* s) { - uint32 toggleFlags; + UINT32 toggleFlags; if (stream_get_left(s) < 6) - return false; + return FALSE; stream_seek(s, 2); /* pad2Octets (2 bytes) */ - stream_read_uint32(s, toggleFlags); /* toggleFlags (4 bytes) */ + stream_read_UINT32(s, toggleFlags); /* toggleFlags (4 bytes) */ IFCALL(input->SynchronizeEvent, input, toggleFlags); - return true; + return TRUE; } -static boolean input_recv_keyboard_event(rdpInput* input, STREAM* s) +static BOOL input_recv_keyboard_event(rdpInput* input, STREAM* s) { - uint16 keyboardFlags, keyCode; + UINT16 keyboardFlags, keyCode; if (stream_get_left(s) < 6) - return false; + return FALSE; - stream_read_uint16(s, keyboardFlags); /* keyboardFlags (2 bytes) */ - stream_read_uint16(s, keyCode); /* keyCode (2 bytes) */ + stream_read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */ + stream_read_UINT16(s, keyCode); /* keyCode (2 bytes) */ stream_seek(s, 2); /* pad2Octets (2 bytes) */ IFCALL(input->KeyboardEvent, input, keyboardFlags, keyCode); - return true; + return TRUE; } -static boolean input_recv_unicode_keyboard_event(rdpInput* input, STREAM* s) +static BOOL input_recv_unicode_keyboard_event(rdpInput* input, STREAM* s) { - uint16 keyboardFlags, unicodeCode; + UINT16 keyboardFlags, unicodeCode; if (stream_get_left(s) < 6) - return false; + return FALSE; - stream_read_uint16(s, keyboardFlags); /* keyboardFlags (2 bytes) */ - stream_read_uint16(s, unicodeCode); /* unicodeCode (2 bytes) */ + stream_read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */ + stream_read_UINT16(s, unicodeCode); /* unicodeCode (2 bytes) */ stream_seek(s, 2); /* pad2Octets (2 bytes) */ /* @@ -259,76 +259,76 @@ static boolean input_recv_unicode_keyboard_event(rdpInput* input, STREAM* s) IFCALL(input->UnicodeKeyboardEvent, input, keyboardFlags, unicodeCode); - return true; + return TRUE; } -static boolean input_recv_mouse_event(rdpInput* input, STREAM* s) +static BOOL input_recv_mouse_event(rdpInput* input, STREAM* s) { - uint16 pointerFlags, xPos, yPos; + UINT16 pointerFlags, xPos, yPos; if (stream_get_left(s) < 6) - return false; + return FALSE; - stream_read_uint16(s, pointerFlags); /* pointerFlags (2 bytes) */ - stream_read_uint16(s, xPos); /* xPos (2 bytes) */ - stream_read_uint16(s, yPos); /* yPos (2 bytes) */ + stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */ + stream_read_UINT16(s, xPos); /* xPos (2 bytes) */ + stream_read_UINT16(s, yPos); /* yPos (2 bytes) */ IFCALL(input->MouseEvent, input, pointerFlags, xPos, yPos); - return true; + return TRUE; } -static boolean input_recv_extended_mouse_event(rdpInput* input, STREAM* s) +static BOOL input_recv_extended_mouse_event(rdpInput* input, STREAM* s) { - uint16 pointerFlags, xPos, yPos; + UINT16 pointerFlags, xPos, yPos; if (stream_get_left(s) < 6) - return false; + return FALSE; - stream_read_uint16(s, pointerFlags); /* pointerFlags (2 bytes) */ - stream_read_uint16(s, xPos); /* xPos (2 bytes) */ - stream_read_uint16(s, yPos); /* yPos (2 bytes) */ + stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */ + stream_read_UINT16(s, xPos); /* xPos (2 bytes) */ + stream_read_UINT16(s, yPos); /* yPos (2 bytes) */ IFCALL(input->ExtendedMouseEvent, input, pointerFlags, xPos, yPos); - return true; + return TRUE; } -static boolean input_recv_event(rdpInput* input, STREAM* s) +static BOOL input_recv_event(rdpInput* input, STREAM* s) { - uint16 messageType; + UINT16 messageType; if (stream_get_left(s) < 4) - return false; + return FALSE; stream_seek(s, 4); /* eventTime (4 bytes), ignored by the server */ - stream_read_uint16(s, messageType); /* messageType (2 bytes) */ + stream_read_UINT16(s, messageType); /* messageType (2 bytes) */ switch (messageType) { case INPUT_EVENT_SYNC: if (!input_recv_sync_event(input, s)) - return false; + return FALSE; break; case INPUT_EVENT_SCANCODE: if (!input_recv_keyboard_event(input, s)) - return false; + return FALSE; break; case INPUT_EVENT_UNICODE: if (!input_recv_unicode_keyboard_event(input, s)) - return false; + return FALSE; break; case INPUT_EVENT_MOUSE: if (!input_recv_mouse_event(input, s)) - return false; + return FALSE; break; case INPUT_EVENT_MOUSEX: if (!input_recv_extended_mouse_event(input, s)) - return false; + return FALSE; break; default: @@ -338,30 +338,30 @@ static boolean input_recv_event(rdpInput* input, STREAM* s) break; } - return true; + return TRUE; } -boolean input_recv(rdpInput* input, STREAM* s) +BOOL input_recv(rdpInput* input, STREAM* s) { - uint16 i, numberEvents; + UINT16 i, numberEvents; if (stream_get_left(s) < 4) - return false; + return FALSE; - stream_read_uint16(s, numberEvents); /* numberEvents (2 bytes) */ + stream_read_UINT16(s, numberEvents); /* numberEvents (2 bytes) */ stream_seek(s, 2); /* pad2Octets (2 bytes) */ /* Each input event uses 6 exactly bytes. */ if (stream_get_left(s) < 6 * numberEvents) - return false; + return FALSE; for (i = 0; i < numberEvents; i++) { if (!input_recv_event(input, s)) - return false; + return FALSE; } - return true; + return TRUE; } void input_register_client_callbacks(rdpInput* input) @@ -386,17 +386,17 @@ void input_register_client_callbacks(rdpInput* input) } } -void freerdp_input_send_synchronize_event(rdpInput* input, uint32 flags) +void freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags) { IFCALL(input->SynchronizeEvent, input, flags); } -void freerdp_input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { IFCALL(input->KeyboardEvent, input, flags, code); } -void freerdp_input_send_keyboard_event_ex(rdpInput* input, boolean down, uint32 rdp_scancode) +void freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode) { freerdp_input_send_keyboard_event(input, (RDP_SCANCODE_EXTENDED(rdp_scancode) ? KBD_FLAGS_EXTENDED : 0) | @@ -404,17 +404,17 @@ void freerdp_input_send_keyboard_event_ex(rdpInput* input, boolean down, uint32 RDP_SCANCODE_CODE(rdp_scancode)); } -void freerdp_input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { IFCALL(input->UnicodeKeyboardEvent, input, flags, code); } -void freerdp_input_send_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { IFCALL(input->MouseEvent, input, flags, x, y); } -void freerdp_input_send_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { IFCALL(input->ExtendedMouseEvent, input, flags, x, y); } @@ -437,6 +437,6 @@ void input_free(rdpInput* input) { if (input != NULL) { - xfree(input); + free(input); } } diff --git a/libfreerdp/core/input.h b/libfreerdp/core/input.h index 41b8b6756..291763e42 100644 --- a/libfreerdp/core/input.h +++ b/libfreerdp/core/input.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Input PDUs * * Copyright 2011 Marc-Andre Moreau @@ -37,19 +37,19 @@ #define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4 -void input_send_synchronize_event(rdpInput* input, uint32 flags); -void input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void input_send_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); -void input_send_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); +void input_send_synchronize_event(rdpInput* input, UINT32 flags); +void input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); +void input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); -void input_send_fastpath_synchronize_event(rdpInput* input, uint32 flags); -void input_send_fastpath_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void input_send_fastpath_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void input_send_fastpath_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); -void input_send_fastpath_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); +void input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags); +void input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); +void input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); -boolean input_recv(rdpInput* input, STREAM* s); +BOOL input_recv(rdpInput* input, STREAM* s); void input_register_client_callbacks(rdpInput* input); diff --git a/libfreerdp/core/license.c b/libfreerdp/core/license.c index 3090b048c..97aea5464 100644 --- a/libfreerdp/core/license.c +++ b/libfreerdp/core/license.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Licensing * * Copyright 2011 Marc-Andre Moreau @@ -81,12 +81,12 @@ static const char* const state_transitions[] = * @param wMsgSize message size */ -void license_read_preamble(STREAM* s, uint8* bMsgType, uint8* flags, uint16* wMsgSize) +void license_read_preamble(STREAM* s, BYTE* bMsgType, BYTE* flags, UINT16* wMsgSize) { /* preamble (4 bytes) */ - stream_read_uint8(s, *bMsgType); /* bMsgType (1 byte) */ - stream_read_uint8(s, *flags); /* flags (1 byte) */ - stream_read_uint16(s, *wMsgSize); /* wMsgSize (2 bytes) */ + stream_read_BYTE(s, *bMsgType); /* bMsgType (1 byte) */ + stream_read_BYTE(s, *flags); /* flags (1 byte) */ + stream_read_UINT16(s, *wMsgSize); /* wMsgSize (2 bytes) */ } /** @@ -98,12 +98,12 @@ void license_read_preamble(STREAM* s, uint8* bMsgType, uint8* flags, uint16* wMs * @param wMsgSize message size */ -void license_write_preamble(STREAM* s, uint8 bMsgType, uint8 flags, uint16 wMsgSize) +void license_write_preamble(STREAM* s, BYTE bMsgType, BYTE flags, UINT16 wMsgSize) { /* preamble (4 bytes) */ - stream_write_uint8(s, bMsgType); /* bMsgType (1 byte) */ - stream_write_uint8(s, flags); /* flags (1 byte) */ - stream_write_uint16(s, wMsgSize); /* wMsgSize (2 bytes) */ + stream_write_BYTE(s, bMsgType); /* bMsgType (1 byte) */ + stream_write_BYTE(s, flags); /* flags (1 byte) */ + stream_write_UINT16(s, wMsgSize); /* wMsgSize (2 bytes) */ } /** @@ -127,12 +127,12 @@ STREAM* license_send_stream_init(rdpLicense* license) * @param s stream */ -boolean license_send(rdpLicense* license, STREAM* s, uint8 type) +BOOL license_send(rdpLicense* license, STREAM* s, BYTE type) { int length; - uint8 flags; - uint16 wMsgSize; - uint16 sec_flags; + BYTE flags; + UINT16 wMsgSize; + UINT16 sec_flags; DEBUG_LICENSE("Sending %s Packet", LICENSE_MESSAGE_STRINGS[type & 0x1F]); @@ -158,9 +158,9 @@ boolean license_send(rdpLicense* license, STREAM* s, uint8 type) stream_set_pos(s, length); if (transport_write(license->rdp->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -170,31 +170,31 @@ boolean license_send(rdpLicense* license, STREAM* s, uint8 type) * @param s stream */ -boolean license_recv(rdpLicense* license, STREAM* s) +BOOL license_recv(rdpLicense* license, STREAM* s) { - uint16 length; - uint16 channelId; - uint16 sec_flags; - uint8 flags; - uint8 bMsgType; - uint16 wMsgSize; + UINT16 length; + UINT16 channelId; + UINT16 sec_flags; + BYTE flags; + BYTE bMsgType; + UINT16 wMsgSize; if (!rdp_read_header(license->rdp, s, &length, &channelId)) { printf("Incorrect RDP header.\n"); - return false; + return FALSE; } rdp_read_security_header(s, &sec_flags); if (!(sec_flags & SEC_LICENSE_PKT)) { stream_rewind(s, RDP_SECURITY_HEADER_LENGTH); - if (rdp_recv_out_of_sequence_pdu(license->rdp, s) != true) + if (rdp_recv_out_of_sequence_pdu(license->rdp, s) != TRUE) { printf("Unexpected license packet.\n"); - return false; + return FALSE; } - return true; + return TRUE; } license_read_preamble(s, &bMsgType, &flags, &wMsgSize); /* preamble (4 bytes) */ @@ -227,10 +227,10 @@ boolean license_recv(rdpLicense* license, STREAM* s) default: printf("invalid bMsgType:%d\n", bMsgType); - return false; + return FALSE; } - return true; + return TRUE; } void license_generate_randoms(rdpLicense* license) @@ -295,7 +295,7 @@ void license_generate_keys(rdpLicense* license) void license_generate_hwid(rdpLicense* license) { CryptoMd5 md5; - uint8* mac_address; + BYTE* mac_address; memset(license->hwid, 0, HWID_LENGTH); mac_address = license->rdp->transport->tcp->mac_address; @@ -307,11 +307,11 @@ void license_generate_hwid(rdpLicense* license) void license_encrypt_premaster_secret(rdpLicense* license) { - uint8* encrypted_premaster_secret; + BYTE* encrypted_premaster_secret; #if 0 int key_length; - uint8* modulus; - uint8* exponent; + BYTE* modulus; + BYTE* exponent; rdpCertificate *certificate; if (license->server_certificate->length) @@ -331,7 +331,7 @@ void license_encrypt_premaster_secret(rdpLicense* license) freerdp_hexdump(exponent, 4); #endif - encrypted_premaster_secret = (uint8*) xmalloc(MODULUS_MAX_SIZE); + encrypted_premaster_secret = (BYTE*) malloc(MODULUS_MAX_SIZE); memset(encrypted_premaster_secret, 0, MODULUS_MAX_SIZE); crypto_rsa_public_encrypt(license->premaster_secret, PREMASTER_SECRET_LENGTH, @@ -341,7 +341,7 @@ void license_encrypt_premaster_secret(rdpLicense* license) license->encrypted_premaster_secret->length = PREMASTER_SECRET_LENGTH; license->encrypted_premaster_secret->data = encrypted_premaster_secret; #else - encrypted_premaster_secret = (uint8*) xmalloc(MODULUS_MAX_SIZE); + encrypted_premaster_secret = (BYTE*) malloc(MODULUS_MAX_SIZE); memset(encrypted_premaster_secret, 0, MODULUS_MAX_SIZE); license->encrypted_premaster_secret->type = BB_RANDOM_BLOB; @@ -355,7 +355,7 @@ void license_decrypt_platform_challenge(rdpLicense* license) CryptoRc4 rc4; license->platform_challenge->data = - (uint8*) xmalloc(license->encrypted_platform_challenge->length); + (BYTE*) malloc(license->encrypted_platform_challenge->length); license->platform_challenge->length = license->encrypted_platform_challenge->length; @@ -386,16 +386,16 @@ void license_decrypt_platform_challenge(rdpLicense* license) void license_read_product_info(STREAM* s, PRODUCT_INFO* productInfo) { - stream_read_uint32(s, productInfo->dwVersion); /* dwVersion (4 bytes) */ + stream_read_UINT32(s, productInfo->dwVersion); /* dwVersion (4 bytes) */ - stream_read_uint32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */ + stream_read_UINT32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */ - productInfo->pbCompanyName = (uint8*) xmalloc(productInfo->cbCompanyName); + productInfo->pbCompanyName = (BYTE*) malloc(productInfo->cbCompanyName); stream_read(s, productInfo->pbCompanyName, productInfo->cbCompanyName); - stream_read_uint32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */ + stream_read_UINT32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */ - productInfo->pbProductId = (uint8*) xmalloc(productInfo->cbProductId); + productInfo->pbProductId = (BYTE*) malloc(productInfo->cbProductId); stream_read(s, productInfo->pbProductId, productInfo->cbProductId); } @@ -409,7 +409,7 @@ PRODUCT_INFO* license_new_product_info() { PRODUCT_INFO* productInfo; - productInfo = (PRODUCT_INFO*) xmalloc(sizeof(PRODUCT_INFO)); + productInfo = (PRODUCT_INFO*) malloc(sizeof(PRODUCT_INFO)); productInfo->dwVersion = 0; productInfo->cbCompanyName = 0; @@ -429,12 +429,12 @@ PRODUCT_INFO* license_new_product_info() void license_free_product_info(PRODUCT_INFO* productInfo) { if (productInfo->pbCompanyName != NULL) - xfree(productInfo->pbCompanyName); + free(productInfo->pbCompanyName); if (productInfo->pbProductId != NULL) - xfree(productInfo->pbProductId); + free(productInfo->pbProductId); - xfree(productInfo); + free(productInfo); } /** @@ -446,10 +446,10 @@ void license_free_product_info(PRODUCT_INFO* productInfo) void license_read_binary_blob(STREAM* s, LICENSE_BLOB* blob) { - uint16 wBlobType; + UINT16 wBlobType; - stream_read_uint16(s, wBlobType); /* wBlobType (2 bytes) */ - stream_read_uint16(s, blob->length); /* wBlobLen (2 bytes) */ + stream_read_UINT16(s, wBlobType); /* wBlobType (2 bytes) */ + stream_read_UINT16(s, blob->length); /* wBlobLen (2 bytes) */ /* * Server can choose to not send data by setting len to 0. @@ -464,7 +464,7 @@ void license_read_binary_blob(STREAM* s, LICENSE_BLOB* blob) } blob->type = wBlobType; - blob->data = (uint8*) xmalloc(blob->length); + blob->data = (BYTE*) malloc(blob->length); stream_read(s, blob->data, blob->length); /* blobData */ } @@ -478,8 +478,8 @@ void license_read_binary_blob(STREAM* s, LICENSE_BLOB* blob) void license_write_binary_blob(STREAM* s, LICENSE_BLOB* blob) { - stream_write_uint16(s, blob->type); /* wBlobType (2 bytes) */ - stream_write_uint16(s, blob->length); /* wBlobLen (2 bytes) */ + stream_write_UINT16(s, blob->type); /* wBlobType (2 bytes) */ + stream_write_UINT16(s, blob->length); /* wBlobLen (2 bytes) */ if (blob->length > 0) stream_write(s, blob->data, blob->length); /* blobData */ @@ -487,11 +487,11 @@ void license_write_binary_blob(STREAM* s, LICENSE_BLOB* blob) void license_write_padded_binary_blob(STREAM* s, LICENSE_BLOB* blob) { - uint16 pad_len; + UINT16 pad_len; pad_len = 72 % blob->length; - stream_write_uint16(s, blob->type); /* wBlobType (2 bytes) */ - stream_write_uint16(s, blob->length + pad_len); /* wBlobLen (2 bytes) */ + stream_write_UINT16(s, blob->type); /* wBlobType (2 bytes) */ + stream_write_UINT16(s, blob->length + pad_len); /* wBlobLen (2 bytes) */ if (blob->length > 0) stream_write(s, blob->data, blob->length); /* blobData */ @@ -505,11 +505,11 @@ void license_write_padded_binary_blob(STREAM* s, LICENSE_BLOB* blob) * @return new license binary blob */ -LICENSE_BLOB* license_new_binary_blob(uint16 type) +LICENSE_BLOB* license_new_binary_blob(UINT16 type) { LICENSE_BLOB* blob; - blob = (LICENSE_BLOB*) xmalloc(sizeof(LICENSE_BLOB)); + blob = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB)); blob->type = type; blob->length = 0; blob->data = NULL; @@ -526,9 +526,9 @@ LICENSE_BLOB* license_new_binary_blob(uint16 type) void license_free_binary_blob(LICENSE_BLOB* blob) { if (blob->data != NULL) - xfree(blob->data); + free(blob->data); - xfree(blob); + free(blob); } /** @@ -540,13 +540,13 @@ void license_free_binary_blob(LICENSE_BLOB* blob) void license_read_scope_list(STREAM* s, SCOPE_LIST* scopeList) { - uint32 i; - uint32 scopeCount; + UINT32 i; + UINT32 scopeCount; - stream_read_uint32(s, scopeCount); /* ScopeCount (4 bytes) */ + stream_read_UINT32(s, scopeCount); /* ScopeCount (4 bytes) */ scopeList->count = scopeCount; - scopeList->array = (LICENSE_BLOB*) xmalloc(sizeof(LICENSE_BLOB) * scopeCount); + scopeList->array = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB) * scopeCount); /* ScopeArray */ for (i = 0; i < scopeCount; i++) @@ -566,7 +566,7 @@ SCOPE_LIST* license_new_scope_list() { SCOPE_LIST* scopeList; - scopeList = (SCOPE_LIST*) xmalloc(sizeof(SCOPE_LIST)); + scopeList = (SCOPE_LIST*) malloc(sizeof(SCOPE_LIST)); scopeList->count = 0; scopeList->array = NULL; @@ -581,22 +581,22 @@ SCOPE_LIST* license_new_scope_list() void license_free_scope_list(SCOPE_LIST* scopeList) { - uint32 i; + UINT32 i; /* * We must NOT call license_free_binary_blob() on each scopelist->array[i] element, - * because scopelist->array was allocated at once, by a single call to xmalloc. The elements + * because scopelist->array was allocated at once, by a single call to malloc. The elements * it contains cannot be deallocated separately then. * To make things clean, we must deallocate each scopelist->array[].data, - * and finish by deallocating scopelist->array with a single call to xfree(). + * and finish by deallocating scopelist->array with a single call to free(). */ for (i = 0; i < scopeList->count; i++) { - xfree(scopeList->array[i].data); + free(scopeList->array[i].data); } - xfree(scopeList->array) ; - xfree(scopeList); + free(scopeList->array) ; + free(scopeList); } /** @@ -691,11 +691,11 @@ void license_read_upgrade_license_packet(rdpLicense* license, STREAM* s) void license_read_error_alert_packet(rdpLicense* license, STREAM* s) { - uint32 dwErrorCode; - uint32 dwStateTransition; + UINT32 dwErrorCode; + UINT32 dwStateTransition; - stream_read_uint32(s, dwErrorCode); /* dwErrorCode (4 bytes) */ - stream_read_uint32(s, dwStateTransition); /* dwStateTransition (4 bytes) */ + stream_read_UINT32(s, dwErrorCode); /* dwErrorCode (4 bytes) */ + stream_read_UINT32(s, dwStateTransition); /* dwStateTransition (4 bytes) */ license_read_binary_blob(s, license->error_info); /* bbErrorInfo */ #ifdef WITH_DEBUG_LICENSE @@ -740,9 +740,9 @@ void license_read_error_alert_packet(rdpLicense* license, STREAM* s) void license_write_platform_id(rdpLicense* license, STREAM* s) { - stream_write_uint8(s, 0); /* Client Operating System Version */ - stream_write_uint8(s, 0); /* Independent Software Vendor (ISV) */ - stream_write_uint16(s, 0); /* Client Software Build */ + stream_write_BYTE(s, 0); /* Client Operating System Version */ + stream_write_BYTE(s, 0); /* Independent Software Vendor (ISV) */ + stream_write_UINT16(s, 0); /* Client Software Build */ } /** @@ -754,7 +754,7 @@ void license_write_platform_id(rdpLicense* license, STREAM* s) void license_write_new_license_request_packet(rdpLicense* license, STREAM* s) { - stream_write_uint32(s, KEY_EXCHANGE_ALG_RSA); /* PreferredKeyExchangeAlg (4 bytes) */ + stream_write_UINT32(s, KEY_EXCHANGE_ALG_RSA); /* PreferredKeyExchangeAlg (4 bytes) */ license_write_platform_id(license, s); /* PlatformId (4 bytes) */ stream_write(s, license->client_random, 32); /* ClientRandom (32 bytes) */ license_write_padded_binary_blob(s, license->encrypted_premaster_secret); /* EncryptedPremasterSecret */ @@ -780,10 +780,10 @@ void license_send_new_license_request_packet(rdpLicense* license) else username = "username"; - license->client_user_name->data = (uint8*) username; + license->client_user_name->data = (BYTE*) username; license->client_user_name->length = strlen(username) + 1; - license->client_machine_name->data = (uint8*) license->rdp->settings->client_hostname; + license->client_machine_name->data = (BYTE*) license->rdp->settings->client_hostname; license->client_machine_name->length = strlen(license->rdp->settings->client_hostname) + 1; license_write_new_license_request_packet(license, s); @@ -805,7 +805,7 @@ void license_send_new_license_request_packet(rdpLicense* license) * @param mac_data signature */ -void license_write_platform_challenge_response_packet(rdpLicense* license, STREAM* s, uint8* mac_data) +void license_write_platform_challenge_response_packet(rdpLicense* license, STREAM* s, BYTE* mac_data) { /* EncryptedPlatformChallengeResponse */ license_write_binary_blob(s, license->encrypted_platform_challenge); @@ -827,22 +827,22 @@ void license_send_platform_challenge_response_packet(rdpLicense* license) { STREAM* s; int length; - uint8* buffer; + BYTE* buffer; CryptoRc4 rc4; - uint8 mac_data[16]; + BYTE mac_data[16]; s = license_send_stream_init(license); DEBUG_LICENSE("Sending Platform Challenge Response Packet"); license->encrypted_platform_challenge->type = BB_DATA_BLOB; length = license->platform_challenge->length + HWID_LENGTH; - buffer = (uint8*) xmalloc(length); + buffer = (BYTE*) malloc(length); memcpy(buffer, license->platform_challenge->data, license->platform_challenge->length); memcpy(&buffer[license->platform_challenge->length], license->hwid, HWID_LENGTH); security_mac_data(license->mac_salt_key, buffer, length, mac_data); - xfree(buffer); + free(buffer); - buffer = (uint8*) xmalloc(HWID_LENGTH); + buffer = (BYTE*) malloc(HWID_LENGTH); rc4 = crypto_rc4_init(license->licensing_encryption_key, LICENSING_ENCRYPTION_KEY_LENGTH); crypto_rc4(rc4, HWID_LENGTH, license->hwid, buffer); crypto_rc4_free(rc4); @@ -873,20 +873,20 @@ void license_send_platform_challenge_response_packet(rdpLicense* license) * @param license license module */ -boolean license_send_valid_client_error_packet(rdpLicense* license) +BOOL license_send_valid_client_error_packet(rdpLicense* license) { STREAM* s; s = license_send_stream_init(license); - stream_write_uint32(s, STATUS_VALID_CLIENT); /* dwErrorCode */ - stream_write_uint32(s, ST_NO_TRANSITION); /* dwStateTransition */ + stream_write_UINT32(s, STATUS_VALID_CLIENT); /* dwErrorCode */ + stream_write_UINT32(s, ST_NO_TRANSITION); /* dwStateTransition */ license_write_binary_blob(s, license->error_info); license_send(license, s, ERROR_ALERT); - return true; + return TRUE; } /** @@ -945,7 +945,7 @@ void license_free(rdpLicense* license) license_free_binary_blob(license->encrypted_premaster_secret); license_free_binary_blob(license->encrypted_hwid); license_free_scope_list(license->scope_list); - xfree(license); + free(license); } } diff --git a/libfreerdp/core/license.h b/libfreerdp/core/license.h index d3b998fdf..2ce31a93a 100644 --- a/libfreerdp/core/license.h +++ b/libfreerdp/core/license.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Licensing * * Copyright 2011 Marc-Andre Moreau @@ -100,23 +100,23 @@ typedef struct rdp_license rdpLicense; typedef struct { - uint32 dwVersion; - uint32 cbCompanyName; - uint8* pbCompanyName; - uint32 cbProductId; - uint8* pbProductId; + UINT32 dwVersion; + UINT32 cbCompanyName; + BYTE* pbCompanyName; + UINT32 cbProductId; + BYTE* pbProductId; } PRODUCT_INFO; typedef struct { - uint16 type; - uint16 length; - uint8* data; + UINT16 type; + UINT16 length; + BYTE* data; } LICENSE_BLOB; typedef struct { - uint32 count; + UINT32 count; LICENSE_BLOB* array; } SCOPE_LIST; @@ -133,16 +133,16 @@ struct rdp_license LICENSE_STATE state; struct rdp_rdp* rdp; struct rdp_certificate* certificate; - uint8 hwid[HWID_LENGTH]; - uint8 modulus[MODULUS_MAX_SIZE]; - uint8 exponent[EXPONENT_MAX_SIZE]; - uint8 client_random[CLIENT_RANDOM_LENGTH]; - uint8 server_random[SERVER_RANDOM_LENGTH]; - uint8 master_secret[MASTER_SECRET_LENGTH]; - uint8 premaster_secret[PREMASTER_SECRET_LENGTH]; - uint8 session_key_blob[SESSION_KEY_BLOB_LENGTH]; - uint8 mac_salt_key[MAC_SALT_KEY_LENGTH]; - uint8 licensing_encryption_key[LICENSING_ENCRYPTION_KEY_LENGTH]; + BYTE hwid[HWID_LENGTH]; + BYTE modulus[MODULUS_MAX_SIZE]; + BYTE exponent[EXPONENT_MAX_SIZE]; + BYTE client_random[CLIENT_RANDOM_LENGTH]; + BYTE server_random[SERVER_RANDOM_LENGTH]; + BYTE master_secret[MASTER_SECRET_LENGTH]; + BYTE premaster_secret[PREMASTER_SECRET_LENGTH]; + BYTE session_key_blob[SESSION_KEY_BLOB_LENGTH]; + BYTE mac_salt_key[MAC_SALT_KEY_LENGTH]; + BYTE licensing_encryption_key[LICENSING_ENCRYPTION_KEY_LENGTH]; PRODUCT_INFO* product_info; LICENSE_BLOB* error_info; LICENSE_BLOB* key_exchange_list; @@ -156,8 +156,8 @@ struct rdp_license SCOPE_LIST* scope_list; }; -boolean license_recv(rdpLicense* license, STREAM* s); -boolean license_send(rdpLicense* license, STREAM* s, uint8 type); +BOOL license_recv(rdpLicense* license, STREAM* s); +BOOL license_send(rdpLicense* license, STREAM* s, BYTE type); STREAM* license_send_stream_init(rdpLicense* license); void license_generate_randoms(rdpLicense* license); @@ -170,7 +170,7 @@ PRODUCT_INFO* license_new_product_info(); void license_free_product_info(PRODUCT_INFO* productInfo); void license_read_product_info(STREAM* s, PRODUCT_INFO* productInfo); -LICENSE_BLOB* license_new_binary_blob(uint16 type); +LICENSE_BLOB* license_new_binary_blob(UINT16 type); void license_free_binary_blob(LICENSE_BLOB* blob); void license_read_binary_blob(STREAM* s, LICENSE_BLOB* blob); void license_write_binary_blob(STREAM* s, LICENSE_BLOB* blob); @@ -188,10 +188,10 @@ void license_read_error_alert_packet(rdpLicense* license, STREAM* s); void license_write_new_license_request_packet(rdpLicense* license, STREAM* s); void license_send_new_license_request_packet(rdpLicense* license); -void license_write_platform_challenge_response_packet(rdpLicense* license, STREAM* s, uint8* mac_data); +void license_write_platform_challenge_response_packet(rdpLicense* license, STREAM* s, BYTE* mac_data); void license_send_platform_challenge_response_packet(rdpLicense* license); -boolean license_send_valid_client_error_packet(rdpLicense* license); +BOOL license_send_valid_client_error_packet(rdpLicense* license); rdpLicense* license_new(rdpRdp* rdp); void license_free(rdpLicense* license); diff --git a/libfreerdp/core/listener.c b/libfreerdp/core/listener.c index 36dcd3e90..a124a369b 100644 --- a/libfreerdp/core/listener.c +++ b/libfreerdp/core/listener.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Listener * * Copyright 2011 Vic Lee @@ -73,7 +73,7 @@ static const char *inet_ntop(int af, const void* src, char* dst, socklen_t cnt) #endif #endif -static boolean freerdp_listener_open(freerdp_listener* instance, const char* bind_address, uint16 port) +static BOOL freerdp_listener_open(freerdp_listener* instance, const char* bind_address, UINT16 port) { rdpListener* listener = (rdpListener*) instance->listener; int status; @@ -105,7 +105,7 @@ static boolean freerdp_listener_open(freerdp_listener* instance, const char* bin #else perror("getaddrinfo"); #endif - return false; + return FALSE; } for (ai = res; ai && listener->num_sockfds < 5; ai = ai->ai_next) @@ -168,10 +168,10 @@ static boolean freerdp_listener_open(freerdp_listener* instance, const char* bin freeaddrinfo(res); - return (listener->num_sockfds > 0 ? true : false); + return (listener->num_sockfds > 0 ? TRUE : FALSE); } -static boolean freerdp_listener_open_local(freerdp_listener* instance, const char* path) +static BOOL freerdp_listener_open_local(freerdp_listener* instance, const char* path) { #ifndef _WIN32 int status; @@ -184,7 +184,7 @@ static boolean freerdp_listener_open_local(freerdp_listener* instance, const cha if (sockfd == -1) { perror("socket"); - return false; + return FALSE; } fcntl(sockfd, F_SETFL, O_NONBLOCK); @@ -199,7 +199,7 @@ static boolean freerdp_listener_open_local(freerdp_listener* instance, const cha { perror("bind"); close(sockfd); - return false; + return FALSE; } status = listen(sockfd, 10); @@ -208,16 +208,16 @@ static boolean freerdp_listener_open_local(freerdp_listener* instance, const cha { perror("listen"); close(sockfd); - return false; + return FALSE; } listener->sockfds[listener->num_sockfds++] = sockfd; printf("Listening on socket %s.\n", addr.sun_path); - return true; + return TRUE; #else - return true; + return TRUE; #endif } @@ -235,13 +235,13 @@ static void freerdp_listener_close(freerdp_listener* instance) listener->num_sockfds = 0; } -static boolean freerdp_listener_get_fds(freerdp_listener* instance, void** rfds, int* rcount) +static BOOL freerdp_listener_get_fds(freerdp_listener* instance, void** rfds, int* rcount) { int i; rdpListener* listener = (rdpListener*) instance->listener; if (listener->num_sockfds < 1) - return false; + return FALSE; for (i = 0; i < listener->num_sockfds; i++) { @@ -249,10 +249,10 @@ static boolean freerdp_listener_get_fds(freerdp_listener* instance, void** rfds, (*rcount)++; } - return true; + return TRUE; } -static boolean freerdp_listener_check_fds(freerdp_listener* instance) +static BOOL freerdp_listener_check_fds(freerdp_listener* instance) { int i; void* sin_addr; @@ -263,7 +263,7 @@ static boolean freerdp_listener_check_fds(freerdp_listener* instance) rdpListener* listener = (rdpListener*) instance->listener; if (listener->num_sockfds < 1) - return false; + return FALSE; for (i = 0; i < listener->num_sockfds; i++) { @@ -283,7 +283,7 @@ static boolean freerdp_listener_check_fds(freerdp_listener* instance) continue; #endif perror("accept"); - return false; + return FALSE; } client = freerdp_peer_new(peer_sockfd); @@ -295,7 +295,7 @@ static boolean freerdp_listener_check_fds(freerdp_listener* instance) sin_addr = &(((struct sockaddr_in6*) &peer_addr)->sin6_addr); #ifndef _WIN32 else if (peer_addr.ss_family == AF_UNIX) - client->local = true; + client->local = TRUE; #endif if (sin_addr) @@ -304,7 +304,7 @@ static boolean freerdp_listener_check_fds(freerdp_listener* instance) IFCALL(instance->PeerAccepted, instance, client); } - return true; + return TRUE; } freerdp_listener* freerdp_listener_new(void) @@ -332,8 +332,8 @@ void freerdp_listener_free(freerdp_listener* instance) rdpListener* listener; listener = (rdpListener*) instance->listener; - xfree(listener); + free(listener); - xfree(instance); + free(instance); } diff --git a/libfreerdp/core/listener.h b/libfreerdp/core/listener.h index 78a755288..51aa569e0 100644 --- a/libfreerdp/core/listener.h +++ b/libfreerdp/core/listener.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Listener * * Copyright 2011 Vic Lee diff --git a/libfreerdp/core/mcs.c b/libfreerdp/core/mcs.c index 0d6a5dda2..6f9d549c1 100644 --- a/libfreerdp/core/mcs.c +++ b/libfreerdp/core/mcs.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.125 Multipoint Communication Service (MCS) Protocol * * Copyright 2011 Marc-Andre Moreau @@ -156,8 +156,8 @@ * */ -static const uint8 callingDomainSelector[1] = "\x01"; -static const uint8 calledDomainSelector[1] = "\x01"; +static const BYTE callingDomainSelector[1] = "\x01"; +static const BYTE calledDomainSelector[1] = "\x01"; /* static const char* const mcs_result_enumerated[] = @@ -189,24 +189,24 @@ static const char* const mcs_result_enumerated[] = * @return */ -boolean mcs_read_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU* domainMCSPDU, uint16* length) +BOOL mcs_read_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU* domainMCSPDU, UINT16* length) { - uint8 choice; + BYTE choice; enum DomainMCSPDU MCSPDU; *length = tpkt_read_header(s); if (tpdu_read_data(s) == 0) - return false; + return FALSE; MCSPDU = *domainMCSPDU; per_read_choice(s, &choice); *domainMCSPDU = (choice >> 2); if (*domainMCSPDU != MCSPDU) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -216,7 +216,7 @@ boolean mcs_read_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU* domainMCSPDU * @param length TPKT length */ -void mcs_write_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU domainMCSPDU, uint16 length, uint8 options) +void mcs_write_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU domainMCSPDU, UINT16 length, BYTE options) { tpkt_write_header(s, length); tpdu_write_data(s); @@ -233,7 +233,7 @@ void mcs_write_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU domainMCSPDU, u */ static void mcs_init_domain_parameters(DomainParameters* domainParameters, - uint32 maxChannelIds, uint32 maxUserIds, uint32 maxTokenIds, uint32 maxMCSPDUsize) + UINT32 maxChannelIds, UINT32 maxUserIds, UINT32 maxTokenIds, UINT32 maxMCSPDUsize) { domainParameters->maxChannelIds = maxChannelIds; domainParameters->maxUserIds = maxUserIds; @@ -252,7 +252,7 @@ static void mcs_init_domain_parameters(DomainParameters* domainParameters, * @param domainParameters domain parameters */ -boolean mcs_read_domain_parameters(STREAM* s, DomainParameters* domainParameters) +BOOL mcs_read_domain_parameters(STREAM* s, DomainParameters* domainParameters) { int length; ber_read_sequence_tag(s, &length); @@ -265,7 +265,7 @@ boolean mcs_read_domain_parameters(STREAM* s, DomainParameters* domainParameters ber_read_integer(s, &(domainParameters->maxMCSPDUsize)); ber_read_integer(s, &(domainParameters->protocolVersion)); - return true; + return TRUE; } /** @@ -321,32 +321,32 @@ void mcs_print_domain_parameters(DomainParameters* domainParameters) * @param s stream */ -boolean mcs_recv_connect_initial(rdpMcs* mcs, STREAM* s) +BOOL mcs_recv_connect_initial(rdpMcs* mcs, STREAM* s) { int length; - boolean upwardFlag; + BOOL upwardFlag; tpkt_read_header(s); if (tpdu_read_data(s) == 0) - return false; + return FALSE; if (!ber_read_application_tag(s, MCS_TYPE_CONNECT_INITIAL, &length)) - return false; + return FALSE; /* callingDomainSelector (OCTET_STRING) */ if (!ber_read_octet_string_tag(s, &length)) - return false; + return FALSE; stream_seek(s, length); /* calledDomainSelector (OCTET_STRING) */ if (!ber_read_octet_string_tag(s, &length)) - return false; + return FALSE; stream_seek(s, length); /* upwardFlag (BOOLEAN) */ - if (!ber_read_boolean(s, &upwardFlag)) - return false; + if (!ber_read_BOOL(s, &upwardFlag)) + return FALSE; /* targetParameters (DomainParameters) */ mcs_read_domain_parameters(s, &mcs->targetParameters); @@ -358,12 +358,12 @@ boolean mcs_recv_connect_initial(rdpMcs* mcs, STREAM* s) mcs_read_domain_parameters(s, &mcs->maximumParameters); if (!ber_read_octet_string_tag(s, &length)) - return false; + return FALSE; if (!gcc_read_conference_create_request(s, mcs->transport->settings)) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -388,7 +388,7 @@ void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data) ber_write_octet_string(tmps, calledDomainSelector, sizeof(calledDomainSelector)); /* upwardFlag (BOOLEAN) */ - ber_write_boolean(tmps, true); + ber_write_BOOL(tmps, TRUE); /* targetParameters (DomainParameters) */ mcs_write_domain_parameters(tmps, &mcs->targetParameters); @@ -442,11 +442,11 @@ void mcs_write_connect_response(STREAM* s, rdpMcs* mcs, STREAM* user_data) * @param mcs mcs module */ -boolean mcs_send_connect_initial(rdpMcs* mcs) +BOOL mcs_send_connect_initial(rdpMcs* mcs) { STREAM* s; int length; - uint8 *bm, *em; + BYTE *bm, *em; STREAM* gcc_CCrq; STREAM* client_data; int status; @@ -476,7 +476,7 @@ boolean mcs_send_connect_initial(rdpMcs* mcs) stream_free(gcc_CCrq); stream_free(client_data); - return (status < 0 ? false : true); + return (status < 0 ? FALSE : TRUE); } /** @@ -485,33 +485,33 @@ boolean mcs_send_connect_initial(rdpMcs* mcs) * @param mcs mcs module */ -boolean mcs_recv_connect_response(rdpMcs* mcs, STREAM* s) +BOOL mcs_recv_connect_response(rdpMcs* mcs, STREAM* s) { int length; - uint8 result; - uint32 calledConnectId; + BYTE result; + UINT32 calledConnectId; tpkt_read_header(s); if (tpdu_read_data(s) == 0) - return false; + return FALSE; ber_read_application_tag(s, MCS_TYPE_CONNECT_RESPONSE, &length); ber_read_enumerated(s, &result, MCS_Result_enum_length); ber_read_integer(s, &calledConnectId); if (!mcs_read_domain_parameters(s, &(mcs->domainParameters))) - return false; + return FALSE; ber_read_octet_string_tag(s, &length); if (!gcc_read_conference_create_response(s, mcs->transport->settings)) { printf("mcs_recv_connect_response: gcc_read_conference_create_response failed\n"); - return false; + return FALSE; } - return true; + return TRUE; } /** @@ -520,11 +520,11 @@ boolean mcs_recv_connect_response(rdpMcs* mcs, STREAM* s) * @param mcs mcs module */ -boolean mcs_send_connect_response(rdpMcs* mcs) +BOOL mcs_send_connect_response(rdpMcs* mcs) { STREAM* s; int length; - uint8 *bm, *em; + BYTE *bm, *em; STREAM* gcc_CCrsp; STREAM* server_data; @@ -553,7 +553,7 @@ boolean mcs_send_connect_response(rdpMcs* mcs) stream_free(gcc_CCrsp); stream_free(server_data); - return true; + return TRUE; } /** @@ -563,16 +563,16 @@ boolean mcs_send_connect_response(rdpMcs* mcs) * @param s stream */ -boolean mcs_recv_erect_domain_request(rdpMcs* mcs, STREAM* s) +BOOL mcs_recv_erect_domain_request(rdpMcs* mcs, STREAM* s) { - uint16 length; + UINT16 length; enum DomainMCSPDU MCSPDU; MCSPDU = DomainMCSPDU_ErectDomainRequest; if (!mcs_read_domain_mcspdu_header(s, &MCSPDU, &length)) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -581,10 +581,10 @@ boolean mcs_recv_erect_domain_request(rdpMcs* mcs, STREAM* s) * @param mcs */ -boolean mcs_send_erect_domain_request(rdpMcs* mcs) +BOOL mcs_send_erect_domain_request(rdpMcs* mcs) { STREAM* s; - uint16 length = 12; + UINT16 length = 12; s = transport_send_stream_init(mcs->transport, length); mcs_write_domain_mcspdu_header(s, DomainMCSPDU_ErectDomainRequest, length, 0); @@ -593,9 +593,9 @@ boolean mcs_send_erect_domain_request(rdpMcs* mcs) per_write_integer(s, 0); /* subInterval (INTEGER) */ if (transport_write(mcs->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -605,16 +605,16 @@ boolean mcs_send_erect_domain_request(rdpMcs* mcs) * @param s stream */ -boolean mcs_recv_attach_user_request(rdpMcs* mcs, STREAM* s) +BOOL mcs_recv_attach_user_request(rdpMcs* mcs, STREAM* s) { - uint16 length; + UINT16 length; enum DomainMCSPDU MCSPDU; MCSPDU = DomainMCSPDU_AttachUserRequest; if (!mcs_read_domain_mcspdu_header(s, &MCSPDU, &length)) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -623,18 +623,18 @@ boolean mcs_recv_attach_user_request(rdpMcs* mcs, STREAM* s) * @param mcs mcs module */ -boolean mcs_send_attach_user_request(rdpMcs* mcs) +BOOL mcs_send_attach_user_request(rdpMcs* mcs) { STREAM* s; - uint16 length = 8; + UINT16 length = 8; s = transport_send_stream_init(mcs->transport, length); mcs_write_domain_mcspdu_header(s, DomainMCSPDU_AttachUserRequest, length, 0); if (transport_write(mcs->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -643,20 +643,20 @@ boolean mcs_send_attach_user_request(rdpMcs* mcs) * @param mcs mcs module */ -boolean mcs_recv_attach_user_confirm(rdpMcs* mcs, STREAM* s) +BOOL mcs_recv_attach_user_confirm(rdpMcs* mcs, STREAM* s) { - uint16 length; - uint8 result; + UINT16 length; + BYTE result; enum DomainMCSPDU MCSPDU; MCSPDU = DomainMCSPDU_AttachUserConfirm; if (!mcs_read_domain_mcspdu_header(s, &MCSPDU, &length)) - return false; + return FALSE; per_read_enumerated(s, &result, MCS_Result_enum_length); /* result */ per_read_integer16(s, &(mcs->user_id), MCS_BASE_CHANNEL_ID); /* initiator (UserId) */ - return true; + return TRUE; } /** @@ -665,10 +665,10 @@ boolean mcs_recv_attach_user_confirm(rdpMcs* mcs, STREAM* s) * @param mcs mcs module */ -boolean mcs_send_attach_user_confirm(rdpMcs* mcs) +BOOL mcs_send_attach_user_confirm(rdpMcs* mcs) { STREAM* s; - uint16 length = 11; + UINT16 length = 11; s = transport_send_stream_init(mcs->transport, length); @@ -680,7 +680,7 @@ boolean mcs_send_attach_user_confirm(rdpMcs* mcs) transport_write(mcs->transport, s); - return true; + return TRUE; } /** @@ -690,24 +690,24 @@ boolean mcs_send_attach_user_confirm(rdpMcs* mcs) * @param s stream */ -boolean mcs_recv_channel_join_request(rdpMcs* mcs, STREAM* s, uint16* channel_id) +BOOL mcs_recv_channel_join_request(rdpMcs* mcs, STREAM* s, UINT16* channel_id) { - uint16 length; + UINT16 length; enum DomainMCSPDU MCSPDU; - uint16 user_id; + UINT16 user_id; MCSPDU = DomainMCSPDU_ChannelJoinRequest; if (!mcs_read_domain_mcspdu_header(s, &MCSPDU, &length)) - return false; + return FALSE; if (!per_read_integer16(s, &user_id, MCS_BASE_CHANNEL_ID)) - return false; + return FALSE; if (user_id != mcs->user_id) - return false; + return FALSE; if (!per_read_integer16(s, channel_id, 0)) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -717,10 +717,10 @@ boolean mcs_recv_channel_join_request(rdpMcs* mcs, STREAM* s, uint16* channel_id * @param channel_id channel id */ -boolean mcs_send_channel_join_request(rdpMcs* mcs, uint16 channel_id) +BOOL mcs_send_channel_join_request(rdpMcs* mcs, UINT16 channel_id) { STREAM* s; - uint16 length = 12; + UINT16 length = 12; s = transport_send_stream_init(mcs->transport, 12); mcs_write_domain_mcspdu_header(s, DomainMCSPDU_ChannelJoinRequest, length, 0); @@ -729,9 +729,9 @@ boolean mcs_send_channel_join_request(rdpMcs* mcs, uint16 channel_id) per_write_integer16(s, channel_id, 0); if (transport_write(mcs->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -740,24 +740,24 @@ boolean mcs_send_channel_join_request(rdpMcs* mcs, uint16 channel_id) * @param mcs mcs module */ -boolean mcs_recv_channel_join_confirm(rdpMcs* mcs, STREAM* s, uint16* channel_id) +BOOL mcs_recv_channel_join_confirm(rdpMcs* mcs, STREAM* s, UINT16* channel_id) { - uint16 length; - uint8 result; - uint16 initiator; - uint16 requested; + UINT16 length; + BYTE result; + UINT16 initiator; + UINT16 requested; enum DomainMCSPDU MCSPDU; MCSPDU = DomainMCSPDU_ChannelJoinConfirm; if (!mcs_read_domain_mcspdu_header(s, &MCSPDU, &length)) - return false; + return FALSE; per_read_enumerated(s, &result, MCS_Result_enum_length); /* result */ per_read_integer16(s, &initiator, MCS_BASE_CHANNEL_ID); /* initiator (UserId) */ per_read_integer16(s, &requested, 0); /* requested (ChannelId) */ per_read_integer16(s, channel_id, 0); /* channelId */ - return true; + return TRUE; } /** @@ -766,10 +766,10 @@ boolean mcs_recv_channel_join_confirm(rdpMcs* mcs, STREAM* s, uint16* channel_id * @param mcs mcs module */ -boolean mcs_send_channel_join_confirm(rdpMcs* mcs, uint16 channel_id) +BOOL mcs_send_channel_join_confirm(rdpMcs* mcs, UINT16 channel_id) { STREAM* s; - uint16 length = 15; + UINT16 length = 15; s = transport_send_stream_init(mcs->transport, 15); mcs_write_domain_mcspdu_header(s, DomainMCSPDU_ChannelJoinConfirm, length, 2); @@ -781,7 +781,7 @@ boolean mcs_send_channel_join_confirm(rdpMcs* mcs, uint16 channel_id) transport_write(mcs->transport, s); - return true; + return TRUE; } /** @@ -789,10 +789,10 @@ boolean mcs_send_channel_join_confirm(rdpMcs* mcs, uint16 channel_id) * @param mcs mcs module */ -boolean mcs_send_disconnect_provider_ultimatum(rdpMcs* mcs) +BOOL mcs_send_disconnect_provider_ultimatum(rdpMcs* mcs) { STREAM* s; - uint16 length = 9; + UINT16 length = 9; s = transport_send_stream_init(mcs->transport, 9); mcs_write_domain_mcspdu_header(s, DomainMCSPDU_DisconnectProviderUltimatum, length, 1); @@ -801,7 +801,7 @@ boolean mcs_send_disconnect_provider_ultimatum(rdpMcs* mcs) transport_write(mcs->transport, s); - return true; + return TRUE; } /** @@ -836,6 +836,6 @@ void mcs_free(rdpMcs* mcs) { if (mcs != NULL) { - xfree(mcs); + free(mcs); } } diff --git a/libfreerdp/core/mcs.h b/libfreerdp/core/mcs.h index 04cae2607..93a34aceb 100644 --- a/libfreerdp/core/mcs.h +++ b/libfreerdp/core/mcs.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * T.125 Multipoint Communication Service (MCS) Protocol * * Copyright 2011 Marc-Andre Moreau @@ -100,27 +100,27 @@ enum DomainMCSPDU typedef struct { - uint32 maxChannelIds; - uint32 maxUserIds; - uint32 maxTokenIds; - uint32 numPriorities; - uint32 minThroughput; - uint32 maxHeight; - uint32 maxMCSPDUsize; - uint32 protocolVersion; + UINT32 maxChannelIds; + UINT32 maxUserIds; + UINT32 maxTokenIds; + UINT32 numPriorities; + UINT32 minThroughput; + UINT32 maxHeight; + UINT32 maxMCSPDUsize; + UINT32 protocolVersion; } DomainParameters; struct rdp_mcs { - uint16 user_id; + UINT16 user_id; struct rdp_transport* transport; DomainParameters domainParameters; DomainParameters targetParameters; DomainParameters minimumParameters; DomainParameters maximumParameters; - boolean user_channel_joined; - boolean global_channel_joined; + BOOL user_channel_joined; + BOOL global_channel_joined; }; typedef struct rdp_mcs rdpMcs; @@ -132,23 +132,23 @@ typedef struct rdp_mcs rdpMcs; void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data); void mcs_write_connect_response(STREAM* s, rdpMcs* mcs, STREAM* user_data); -boolean mcs_recv_connect_initial(rdpMcs* mcs, STREAM* s); -boolean mcs_send_connect_initial(rdpMcs* mcs); -boolean mcs_recv_connect_response(rdpMcs* mcs, STREAM* s); -boolean mcs_send_connect_response(rdpMcs* mcs); -boolean mcs_recv_erect_domain_request(rdpMcs* mcs, STREAM* s); -boolean mcs_send_erect_domain_request(rdpMcs* mcs); -boolean mcs_recv_attach_user_request(rdpMcs* mcs, STREAM* s); -boolean mcs_send_attach_user_request(rdpMcs* mcs); -boolean mcs_recv_attach_user_confirm(rdpMcs* mcs, STREAM* s); -boolean mcs_send_attach_user_confirm(rdpMcs* mcs); -boolean mcs_recv_channel_join_request(rdpMcs* mcs, STREAM* s, uint16* channel_id); -boolean mcs_send_channel_join_request(rdpMcs* mcs, uint16 channel_id); -boolean mcs_recv_channel_join_confirm(rdpMcs* mcs, STREAM* s, uint16* channel_id); -boolean mcs_send_channel_join_confirm(rdpMcs* mcs, uint16 channel_id); -boolean mcs_send_disconnect_provider_ultimatum(rdpMcs* mcs); -boolean mcs_read_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU* domainMCSPDU, uint16* length); -void mcs_write_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU domainMCSPDU, uint16 length, uint8 options); +BOOL mcs_recv_connect_initial(rdpMcs* mcs, STREAM* s); +BOOL mcs_send_connect_initial(rdpMcs* mcs); +BOOL mcs_recv_connect_response(rdpMcs* mcs, STREAM* s); +BOOL mcs_send_connect_response(rdpMcs* mcs); +BOOL mcs_recv_erect_domain_request(rdpMcs* mcs, STREAM* s); +BOOL mcs_send_erect_domain_request(rdpMcs* mcs); +BOOL mcs_recv_attach_user_request(rdpMcs* mcs, STREAM* s); +BOOL mcs_send_attach_user_request(rdpMcs* mcs); +BOOL mcs_recv_attach_user_confirm(rdpMcs* mcs, STREAM* s); +BOOL mcs_send_attach_user_confirm(rdpMcs* mcs); +BOOL mcs_recv_channel_join_request(rdpMcs* mcs, STREAM* s, UINT16* channel_id); +BOOL mcs_send_channel_join_request(rdpMcs* mcs, UINT16 channel_id); +BOOL mcs_recv_channel_join_confirm(rdpMcs* mcs, STREAM* s, UINT16* channel_id); +BOOL mcs_send_channel_join_confirm(rdpMcs* mcs, UINT16 channel_id); +BOOL mcs_send_disconnect_provider_ultimatum(rdpMcs* mcs); +BOOL mcs_read_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU* domainMCSPDU, UINT16* length); +void mcs_write_domain_mcspdu_header(STREAM* s, enum DomainMCSPDU domainMCSPDU, UINT16 length, BYTE options); rdpMcs* mcs_new(rdpTransport* transport); void mcs_free(rdpMcs* mcs); diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c index 6af15ad97..d5ef12106 100644 --- a/libfreerdp/core/nego.c +++ b/libfreerdp/core/nego.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Protocol Security Negotiation * * Copyright 2011 Marc-Andre Moreau @@ -51,7 +51,7 @@ static const char PROTOCOL_SECURITY_STRINGS[3][4] = "NLA" }; -boolean nego_security_connect(rdpNego* nego); +BOOL nego_security_connect(rdpNego* nego); /** * Negotiate protocol security and connect. @@ -59,7 +59,7 @@ boolean nego_security_connect(rdpNego* nego); * @return */ -boolean nego_connect(rdpNego* nego) +BOOL nego_connect(rdpNego* nego) { if (nego->state == NEGO_STATE_INITIAL) { @@ -103,7 +103,7 @@ boolean nego_connect(rdpNego* nego) { DEBUG_NEGO("Failed to send preconnection information"); nego->state = NEGO_STATE_FINAL; - return false; + return FALSE; } } @@ -117,7 +117,7 @@ boolean nego_connect(rdpNego* nego) { DEBUG_NEGO("Protocol Security Negotiation Failure"); nego->state = NEGO_STATE_FINAL; - return false; + return FALSE; } } while (nego->state != NEGO_STATE_FINAL); @@ -131,7 +131,7 @@ boolean nego_connect(rdpNego* nego) if(nego->selected_protocol == PROTOCOL_RDP) { - nego->transport->settings->encryption = true; + nego->transport->settings->encryption = TRUE; nego->transport->settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS; nego->transport->settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; } @@ -140,18 +140,18 @@ boolean nego_connect(rdpNego* nego) if(!nego_security_connect(nego)) { DEBUG_NEGO("Failed to connect with %s security", PROTOCOL_SECURITY_STRINGS[nego->selected_protocol]); - return false; + return FALSE; } - return true; + return TRUE; } /* connect to selected security layer */ -boolean nego_security_connect(rdpNego* nego) +BOOL nego_security_connect(rdpNego* nego) { if(!nego->tcp_connected) { - nego->security_connected = false; + nego->security_connected = FALSE; } else if (!nego->security_connected) { @@ -184,7 +184,7 @@ boolean nego_security_connect(rdpNego* nego) * @return */ -boolean nego_tcp_connect(rdpNego* nego) +BOOL nego_tcp_connect(rdpNego* nego) { if (!nego->tcp_connected) nego->tcp_connected = transport_connect(nego->transport, nego->hostname, nego->port); @@ -198,7 +198,7 @@ boolean nego_tcp_connect(rdpNego* nego) * @return */ -boolean nego_transport_connect(rdpNego* nego) +BOOL nego_transport_connect(rdpNego* nego) { nego_tcp_connect(nego); @@ -231,48 +231,48 @@ int nego_transport_disconnect(rdpNego* nego) * @return */ -boolean nego_send_preconnection_pdu(rdpNego* nego) +BOOL nego_send_preconnection_pdu(rdpNego* nego) { STREAM* s; - uint32 cbSize; - uint16 cchPCB = 0; + UINT32 cbSize; + UINT16 cchPCB = 0; WCHAR* wszPCB = NULL; if (!nego->send_preconnection_pdu) - return true; + return TRUE; DEBUG_NEGO("Sending preconnection PDU"); if (!nego_tcp_connect(nego)) - return false; + return FALSE; /* it's easier to always send the version 2 PDU, and it's just 2 bytes overhead */ cbSize = PRECONNECTION_PDU_V2_MIN_SIZE; if (nego->preconnection_blob) { - cchPCB = (uint16) freerdp_AsciiToUnicodeAlloc(nego->preconnection_blob, &wszPCB, 0); + cchPCB = (UINT16) freerdp_AsciiToUnicodeAlloc(nego->preconnection_blob, &wszPCB, 0); cchPCB += 1; /* zero-termination */ cbSize += cchPCB * 2; } s = transport_send_stream_init(nego->transport, cbSize); - stream_write_uint32(s, cbSize); /* cbSize */ - stream_write_uint32(s, 0); /* Flags */ - stream_write_uint32(s, PRECONNECTION_PDU_V2); /* Version */ - stream_write_uint32(s, nego->preconnection_id); /* Id */ - stream_write_uint16(s, cchPCB); /* cchPCB */ + stream_write_UINT32(s, cbSize); /* cbSize */ + stream_write_UINT32(s, 0); /* Flags */ + stream_write_UINT32(s, PRECONNECTION_PDU_V2); /* Version */ + stream_write_UINT32(s, nego->preconnection_id); /* Id */ + stream_write_UINT16(s, cchPCB); /* cchPCB */ if (wszPCB) { stream_write(s, wszPCB, cchPCB * 2); /* wszPCB */ - xfree(wszPCB); + free(wszPCB); } if (transport_write(nego->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -393,12 +393,12 @@ void nego_attempt_rdp(rdpNego* nego) * @param nego */ -boolean nego_recv_response(rdpNego* nego) +BOOL nego_recv_response(rdpNego* nego) { STREAM* s = transport_recv_stream_init(nego->transport, 1024); if (transport_read(nego->transport, s) < 0) - return false; + return FALSE; return nego_recv(nego->transport, s, nego); } @@ -411,14 +411,14 @@ boolean nego_recv_response(rdpNego* nego) * @param extra nego pointer */ -boolean nego_recv(rdpTransport* transport, STREAM* s, void* extra) +BOOL nego_recv(rdpTransport* transport, STREAM* s, void* extra) { - uint8 li; - uint8 type; + BYTE li; + BYTE type; rdpNego* nego = (rdpNego*) extra; if (tpkt_read_header(s) == 0) - return false; + return FALSE; li = tpdu_read_connection_confirm(s); @@ -426,7 +426,7 @@ boolean nego_recv(rdpTransport* transport, STREAM* s, void* extra) { /* rdpNegData (optional) */ - stream_read_uint8(s, type); /* Type */ + stream_read_BYTE(s, type); /* Type */ switch (type) { @@ -471,7 +471,7 @@ boolean nego_recv(rdpTransport* transport, STREAM* s, void* extra) nego->state = NEGO_STATE_FINAL; } - return true; + return TRUE; } /** @@ -480,11 +480,11 @@ boolean nego_recv(rdpTransport* transport, STREAM* s, void* extra) * @param s stream */ -boolean nego_read_request(rdpNego* nego, STREAM* s) +BOOL nego_read_request(rdpNego* nego, STREAM* s) { - uint8 li; - uint8 c; - uint8 type; + BYTE li; + BYTE c; + BYTE type; tpkt_read_header(s); li = tpdu_read_connection_request(s); @@ -492,7 +492,7 @@ boolean nego_read_request(rdpNego* nego, STREAM* s) if (li != stream_get_left(s) + 6) { printf("Incorrect TPDU length indicator.\n"); - return false; + return FALSE; } if (stream_get_left(s) > 8) @@ -500,17 +500,17 @@ boolean nego_read_request(rdpNego* nego, STREAM* s) /* Optional routingToken or cookie, ending with CR+LF */ while (stream_get_left(s) > 0) { - stream_read_uint8(s, c); + stream_read_BYTE(s, c); if (c != '\x0D') continue; - stream_peek_uint8(s, c); + stream_peek_BYTE(s, c); if (c != '\x0A') continue; - stream_seek_uint8(s); + stream_seek_BYTE(s); break; } } @@ -519,18 +519,18 @@ boolean nego_read_request(rdpNego* nego, STREAM* s) { /* rdpNegData (optional) */ - stream_read_uint8(s, type); /* Type */ + stream_read_BYTE(s, type); /* Type */ if (type != TYPE_RDP_NEG_REQ) { printf("Incorrect negotiation request type %d\n", type); - return false; + return FALSE; } nego_process_negotiation_request(nego, s); } - return true; + return TRUE; } /** @@ -557,11 +557,11 @@ void nego_send(rdpNego* nego) * @param nego */ -boolean nego_send_negotiation_request(rdpNego* nego) +BOOL nego_send_negotiation_request(rdpNego* nego) { STREAM* s; int length; - uint8 *bm, *em; + BYTE *bm, *em; s = transport_send_stream_init(nego->transport, 256); length = TPDU_CONNECTION_REQUEST_LENGTH; @@ -577,9 +577,9 @@ boolean nego_send_negotiation_request(rdpNego* nego) { int cookie_length = strlen(nego->cookie); stream_write(s, "Cookie: mstshash=", 17); - stream_write(s, (uint8*) nego->cookie, cookie_length); - stream_write_uint8(s, 0x0D); /* CR */ - stream_write_uint8(s, 0x0A); /* LF */ + stream_write(s, (BYTE*) nego->cookie, cookie_length); + stream_write_BYTE(s, 0x0D); /* CR */ + stream_write_BYTE(s, 0x0A); /* LF */ length += cookie_length + 19; } @@ -588,10 +588,10 @@ boolean nego_send_negotiation_request(rdpNego* nego) if (nego->requested_protocols > PROTOCOL_RDP) { /* RDP_NEG_DATA must be present for TLS and NLA */ - stream_write_uint8(s, TYPE_RDP_NEG_REQ); - stream_write_uint8(s, 0); /* flags, must be set to zero */ - stream_write_uint16(s, 8); /* RDP_NEG_DATA length (8) */ - stream_write_uint32(s, nego->requested_protocols); /* requestedProtocols */ + stream_write_BYTE(s, TYPE_RDP_NEG_REQ); + stream_write_BYTE(s, 0); /* flags, must be set to zero */ + stream_write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */ + stream_write_UINT32(s, nego->requested_protocols); /* requestedProtocols */ length += 8; } @@ -602,9 +602,9 @@ boolean nego_send_negotiation_request(rdpNego* nego) stream_set_mark(s, em); if (transport_write(nego->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -615,14 +615,14 @@ boolean nego_send_negotiation_request(rdpNego* nego) void nego_process_negotiation_request(rdpNego* nego, STREAM* s) { - uint8 flags; - uint16 length; + BYTE flags; + UINT16 length; DEBUG_NEGO("RDP_NEG_REQ"); - stream_read_uint8(s, flags); - stream_read_uint16(s, length); - stream_read_uint32(s, nego->requested_protocols); + stream_read_BYTE(s, flags); + stream_read_UINT16(s, length); + stream_read_UINT32(s, nego->requested_protocols); DEBUG_NEGO("requested_protocols: %d", nego->requested_protocols); @@ -637,13 +637,13 @@ void nego_process_negotiation_request(rdpNego* nego, STREAM* s) void nego_process_negotiation_response(rdpNego* nego, STREAM* s) { - uint16 length; + UINT16 length; DEBUG_NEGO("RDP_NEG_RSP"); - stream_read_uint8(s, nego->flags); - stream_read_uint16(s, length); - stream_read_uint32(s, nego->selected_protocol); + stream_read_BYTE(s, nego->flags); + stream_read_UINT16(s, length); + stream_read_UINT32(s, nego->selected_protocol); nego->state = NEGO_STATE_FINAL; } @@ -656,15 +656,15 @@ void nego_process_negotiation_response(rdpNego* nego, STREAM* s) void nego_process_negotiation_failure(rdpNego* nego, STREAM* s) { - uint8 flags; - uint16 length; - uint32 failureCode; + BYTE flags; + UINT16 length; + UINT32 failureCode; DEBUG_NEGO("RDP_NEG_FAILURE"); - stream_read_uint8(s, flags); - stream_read_uint16(s, length); - stream_read_uint32(s, failureCode); + stream_read_BYTE(s, flags); + stream_read_UINT16(s, length); + stream_read_UINT32(s, failureCode); switch (failureCode) { @@ -696,16 +696,16 @@ void nego_process_negotiation_failure(rdpNego* nego, STREAM* s) * @param nego */ -boolean nego_send_negotiation_response(rdpNego* nego) +BOOL nego_send_negotiation_response(rdpNego* nego) { STREAM* s; - uint8* bm; - uint8* em; + BYTE* bm; + BYTE* em; int length; - boolean status; + BOOL status; rdpSettings* settings; - status = true; + status = TRUE; settings = nego->transport->settings; s = transport_send_stream_init(nego->transport, 256); @@ -716,25 +716,25 @@ boolean nego_send_negotiation_response(rdpNego* nego) if (nego->selected_protocol > PROTOCOL_RDP) { /* RDP_NEG_DATA must be present for TLS and NLA */ - stream_write_uint8(s, TYPE_RDP_NEG_RSP); - stream_write_uint8(s, EXTENDED_CLIENT_DATA_SUPPORTED); /* flags */ - stream_write_uint16(s, 8); /* RDP_NEG_DATA length (8) */ - stream_write_uint32(s, nego->selected_protocol); /* selectedProtocol */ + stream_write_BYTE(s, TYPE_RDP_NEG_RSP); + stream_write_BYTE(s, EXTENDED_CLIENT_DATA_SUPPORTED); /* flags */ + stream_write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */ + stream_write_UINT32(s, nego->selected_protocol); /* selectedProtocol */ length += 8; } else if (!settings->rdp_security) { - stream_write_uint8(s, TYPE_RDP_NEG_FAILURE); - stream_write_uint8(s, 0); /* flags */ - stream_write_uint16(s, 8); /* RDP_NEG_DATA length (8) */ + stream_write_BYTE(s, TYPE_RDP_NEG_FAILURE); + stream_write_BYTE(s, 0); /* flags */ + stream_write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */ /* * TODO: Check for other possibilities, * like SSL_NOT_ALLOWED_BY_SERVER. */ printf("nego_send_negotiation_response: client supports only Standard RDP Security\n"); - stream_write_uint32(s, SSL_REQUIRED_BY_SERVER); + stream_write_UINT32(s, SSL_REQUIRED_BY_SERVER); length += 8; - status = false; + status = FALSE; } stream_get_mark(s, em); @@ -744,7 +744,7 @@ boolean nego_send_negotiation_response(rdpNego* nego) stream_set_mark(s, em); if (transport_write(nego->transport, s) < 0) - return false; + return FALSE; if (status) { @@ -754,35 +754,35 @@ boolean nego_send_negotiation_response(rdpNego* nego) if (settings->selected_protocol == PROTOCOL_RDP) { - settings->tls_security = false; - settings->nla_security = false; - settings->rdp_security = true; + settings->tls_security = FALSE; + settings->nla_security = FALSE; + settings->rdp_security = TRUE; if (!settings->local) { - settings->encryption = true; + settings->encryption = TRUE; settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS; settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; } if (settings->encryption && settings->server_key == NULL && settings->rdp_key_file == NULL) - return false; + return FALSE; } else if (settings->selected_protocol == PROTOCOL_TLS) { - settings->tls_security = true; - settings->nla_security = false; - settings->rdp_security = false; - settings->encryption = false; + settings->tls_security = TRUE; + settings->nla_security = FALSE; + settings->rdp_security = FALSE; + settings->encryption = FALSE; settings->encryption_method = ENCRYPTION_METHOD_NONE; settings->encryption_level = ENCRYPTION_LEVEL_NONE; } else if (settings->selected_protocol == PROTOCOL_NLA) { - settings->tls_security = true; - settings->nla_security = true; - settings->rdp_security = false; - settings->encryption = false; + settings->tls_security = TRUE; + settings->nla_security = TRUE; + settings->rdp_security = FALSE; + settings->encryption = FALSE; settings->encryption_method = ENCRYPTION_METHOD_NONE; settings->encryption_level = ENCRYPTION_LEVEL_NONE; } @@ -831,7 +831,7 @@ rdpNego* nego_new(struct rdp_transport * transport) void nego_free(rdpNego* nego) { - xfree(nego); + free(nego); } /** @@ -850,35 +850,35 @@ void nego_set_target(rdpNego* nego, char* hostname, int port) /** * Enable security layer negotiation. * @param nego pointer to the negotiation structure - * @param enable_rdp whether to enable security layer negotiation (true for enabled, false for disabled) + * @param enable_rdp whether to enable security layer negotiation (TRUE for enabled, FALSE for disabled) */ -void nego_set_negotiation_enabled(rdpNego* nego, boolean security_layer_negotiation_enabled) +void nego_set_negotiation_enabled(rdpNego* nego, BOOL security_layer_negotiation_enabled) { - DEBUG_NEGO("Enabling security layer negotiation: %s", security_layer_negotiation_enabled ? "true" : "false"); + DEBUG_NEGO("Enabling security layer negotiation: %s", security_layer_negotiation_enabled ? "TRUE" : "FALSE"); nego->security_layer_negotiation_enabled = security_layer_negotiation_enabled; } /** * Enable RDP security protocol. * @param nego pointer to the negotiation structure - * @param enable_rdp whether to enable normal RDP protocol (true for enabled, false for disabled) + * @param enable_rdp whether to enable normal RDP protocol (TRUE for enabled, FALSE for disabled) */ -void nego_enable_rdp(rdpNego* nego, boolean enable_rdp) +void nego_enable_rdp(rdpNego* nego, BOOL enable_rdp) { - DEBUG_NEGO("Enabling RDP security: %s", enable_rdp ? "true" : "false"); + DEBUG_NEGO("Enabling RDP security: %s", enable_rdp ? "TRUE" : "FALSE"); nego->enabled_protocols[PROTOCOL_RDP] = enable_rdp; } /** * Enable TLS security protocol. * @param nego pointer to the negotiation structure - * @param enable_tls whether to enable TLS + RDP protocol (true for enabled, false for disabled) + * @param enable_tls whether to enable TLS + RDP protocol (TRUE for enabled, FALSE for disabled) */ -void nego_enable_tls(rdpNego* nego, boolean enable_tls) +void nego_enable_tls(rdpNego* nego, BOOL enable_tls) { - DEBUG_NEGO("Enabling TLS security: %s", enable_tls ? "true" : "false"); + DEBUG_NEGO("Enabling TLS security: %s", enable_tls ? "TRUE" : "FALSE"); nego->enabled_protocols[PROTOCOL_TLS] = enable_tls; } @@ -886,12 +886,12 @@ void nego_enable_tls(rdpNego* nego, boolean enable_tls) /** * Enable NLA security protocol. * @param nego pointer to the negotiation structure - * @param enable_nla whether to enable network level authentication protocol (true for enabled, false for disabled) + * @param enable_nla whether to enable network level authentication protocol (TRUE for enabled, FALSE for disabled) */ -void nego_enable_nla(rdpNego* nego, boolean enable_nla) +void nego_enable_nla(rdpNego* nego, BOOL enable_nla) { - DEBUG_NEGO("Enabling NLA security: %s", enable_nla ? "true" : "false"); + DEBUG_NEGO("Enabling NLA security: %s", enable_nla ? "TRUE" : "FALSE"); nego->enabled_protocols[PROTOCOL_NLA] = enable_nla; } @@ -925,7 +925,7 @@ void nego_set_cookie(rdpNego* nego, char* cookie) * @param send_pcpdu */ -void nego_set_send_preconnection_pdu(rdpNego* nego, boolean send_pcpdu) +void nego_set_send_preconnection_pdu(rdpNego* nego, BOOL send_pcpdu) { nego->send_preconnection_pdu = send_pcpdu; } @@ -936,7 +936,7 @@ void nego_set_send_preconnection_pdu(rdpNego* nego, boolean send_pcpdu) * @param id */ -void nego_set_preconnection_id(rdpNego* nego, uint32 id) +void nego_set_preconnection_id(rdpNego* nego, UINT32 id) { nego->preconnection_id = id; } diff --git a/libfreerdp/core/nego.h b/libfreerdp/core/nego.h index 8e4b665c0..a0b046270 100644 --- a/libfreerdp/core/nego.h +++ b/libfreerdp/core/nego.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Protocol Security Negotiation * * Copyright 2011 Marc-Andre Moreau @@ -76,60 +76,60 @@ enum RDP_NEG_MSG struct rdp_nego { int port; - uint32 flags; + UINT32 flags; char* hostname; char* cookie; BYTE* RoutingToken; DWORD RoutingTokenLength; - boolean send_preconnection_pdu; - uint32 preconnection_id; + BOOL send_preconnection_pdu; + UINT32 preconnection_id; char* preconnection_blob; NEGO_STATE state; - boolean tcp_connected; - boolean security_connected; + BOOL tcp_connected; + BOOL security_connected; - uint32 selected_protocol; - uint32 requested_protocols; - boolean security_layer_negotiation_enabled; - uint8 enabled_protocols[3]; + UINT32 selected_protocol; + UINT32 requested_protocols; + BOOL security_layer_negotiation_enabled; + BYTE enabled_protocols[3]; rdpTransport* transport; }; typedef struct rdp_nego rdpNego; -boolean nego_connect(rdpNego* nego); +BOOL nego_connect(rdpNego* nego); -boolean nego_send_preconnection_pdu(rdpNego* nego); +BOOL nego_send_preconnection_pdu(rdpNego* nego); void nego_attempt_nla(rdpNego* nego); void nego_attempt_tls(rdpNego* nego); void nego_attempt_rdp(rdpNego* nego); void nego_send(rdpNego* nego); -boolean nego_recv(rdpTransport* transport, STREAM* s, void* extra); -boolean nego_recv_response(rdpNego* nego); -boolean nego_read_request(rdpNego* nego, STREAM* s); +BOOL nego_recv(rdpTransport* transport, STREAM* s, void* extra); +BOOL nego_recv_response(rdpNego* nego); +BOOL nego_read_request(rdpNego* nego, STREAM* s); -boolean nego_send_negotiation_request(rdpNego* nego); +BOOL nego_send_negotiation_request(rdpNego* nego); void nego_process_negotiation_request(rdpNego* nego, STREAM* s); void nego_process_negotiation_response(rdpNego* nego, STREAM* s); void nego_process_negotiation_failure(rdpNego* nego, STREAM* s); -boolean nego_send_negotiation_response(rdpNego* nego); +BOOL nego_send_negotiation_response(rdpNego* nego); rdpNego* nego_new(struct rdp_transport * transport); void nego_free(rdpNego* nego); void nego_init(rdpNego* nego); void nego_set_target(rdpNego* nego, char* hostname, int port); -void nego_set_negotiation_enabled(rdpNego* nego, boolean security_layer_negotiation_enabled); -void nego_enable_rdp(rdpNego* nego, boolean enable_rdp); -void nego_enable_nla(rdpNego* nego, boolean enable_nla); -void nego_enable_tls(rdpNego* nego, boolean enable_tls); +void nego_set_negotiation_enabled(rdpNego* nego, BOOL security_layer_negotiation_enabled); +void nego_enable_rdp(rdpNego* nego, BOOL enable_rdp); +void nego_enable_nla(rdpNego* nego, BOOL enable_nla); +void nego_enable_tls(rdpNego* nego, BOOL enable_tls); void nego_set_routing_token(rdpNego* nego, BYTE* RoutingToken, DWORD RoutingTokenLength); void nego_set_cookie(rdpNego* nego, char* cookie); -void nego_set_send_preconnection_pdu(rdpNego* nego, boolean send_pcpdu); -void nego_set_preconnection_id(rdpNego* nego, uint32 id); +void nego_set_send_preconnection_pdu(rdpNego* nego, BOOL send_pcpdu); +void nego_set_preconnection_id(rdpNego* nego, UINT32 id); void nego_set_preconnection_blob(rdpNego* nego, char* blob); #ifdef WITH_DEBUG_NEGO diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 7256f2500..aa6ab9ceb 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Drawing Orders * * Copyright 2011 Marc-Andre Moreau @@ -96,7 +96,7 @@ static const char* const ALTSEC_DRAWING_ORDER_STRINGS[] = #endif /* WITH_DEBUG_ORDERS */ -static const uint8 PRIMARY_DRAWING_ORDER_FIELD_BYTES[] = +static const BYTE PRIMARY_DRAWING_ORDER_FIELD_BYTES[] = { DSTBLT_ORDER_FIELD_BYTES, PATBLT_ORDER_FIELD_BYTES, @@ -127,86 +127,86 @@ static const uint8 PRIMARY_DRAWING_ORDER_FIELD_BYTES[] = #define PRIMARY_DRAWING_ORDER_COUNT (ARRAY_SIZE(PRIMARY_DRAWING_ORDER_FIELD_BYTES)) -static const uint8 CBR2_BPP[] = +static const BYTE CBR2_BPP[] = { 0, 0, 0, 8, 16, 24, 32 }; -static const uint8 CBR23_BPP[] = +static const BYTE CBR23_BPP[] = { 0, 0, 0, 8, 16, 24, 32 }; -static const uint8 BMF_BPP[] = +static const BYTE BMF_BPP[] = { 0, 1, 0, 8, 16, 24, 32 }; -static INLINE void update_read_coord(STREAM* s, sint32* coord, boolean delta) +static INLINE void update_read_coord(STREAM* s, INT32* coord, BOOL delta) { - sint8 lsi8; - sint16 lsi16; + INT8 lsi8; + INT16 lsi16; if (delta) { - stream_read_uint8(s, lsi8); + stream_read_BYTE(s, lsi8); *coord += lsi8; } else { - stream_read_uint16(s, lsi16); + stream_read_UINT16(s, lsi16); *coord = lsi16; } } -static INLINE void update_read_color(STREAM* s, uint32* color) +static INLINE void update_read_color(STREAM* s, UINT32* color) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color = byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color |= (byte << 8); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color |= (byte << 16); } -static INLINE void update_read_colorref(STREAM* s, uint32* color) +static INLINE void update_read_colorref(STREAM* s, UINT32* color) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color = byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color |= (byte << 8); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color |= (byte << 16); - stream_seek_uint8(s); + stream_seek_BYTE(s); } -static INLINE void update_read_color_quad(STREAM* s, uint32* color) +static INLINE void update_read_color_quad(STREAM* s, UINT32* color) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color = (byte << 16); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color |= (byte << 8); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *color |= byte; - stream_seek_uint8(s); + stream_seek_BYTE(s); } -static INLINE void update_read_2byte_unsigned(STREAM* s, uint32* value) +static INLINE void update_read_2byte_unsigned(STREAM* s, UINT32* value) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte & 0x80) { *value = (byte & 0x7F) << 8; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value |= byte; } else @@ -215,20 +215,20 @@ static INLINE void update_read_2byte_unsigned(STREAM* s, uint32* value) } } -static INLINE void update_read_2byte_signed(STREAM* s, sint32* value) +static INLINE void update_read_2byte_signed(STREAM* s, INT32* value) { - uint8 byte; - boolean negative; + BYTE byte; + BOOL negative; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); - negative = (byte & 0x40) ? true : false; + negative = (byte & 0x40) ? TRUE : FALSE; *value = (byte & 0x3F); if (byte & 0x80) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value = (*value << 8) | byte; } @@ -236,12 +236,12 @@ static INLINE void update_read_2byte_signed(STREAM* s, sint32* value) *value *= -1; } -static INLINE void update_read_4byte_unsigned(STREAM* s, uint32* value) +static INLINE void update_read_4byte_unsigned(STREAM* s, UINT32* value) { - uint8 byte; - uint8 count; + BYTE byte; + BYTE count; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); count = (byte & 0xC0) >> 6; @@ -253,25 +253,25 @@ static INLINE void update_read_4byte_unsigned(STREAM* s, uint32* value) case 1: *value = (byte & 0x3F) << 8; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value |= byte; break; case 2: *value = (byte & 0x3F) << 16; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value |= (byte << 8); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value |= byte; break; case 3: *value = (byte & 0x3F) << 24; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value |= (byte << 16); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value |= (byte << 8); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value |= byte; break; @@ -280,11 +280,11 @@ static INLINE void update_read_4byte_unsigned(STREAM* s, uint32* value) } } -static INLINE void update_read_delta(STREAM* s, sint32* value) +static INLINE void update_read_delta(STREAM* s, INT32* value) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte & 0x40) *value = (byte | ~0x3F); @@ -293,46 +293,46 @@ static INLINE void update_read_delta(STREAM* s, sint32* value) if (byte & 0x80) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *value = (*value << 8) | byte; } } -static INLINE void update_read_glyph_delta(STREAM* s, uint16* value) +static INLINE void update_read_glyph_delta(STREAM* s, UINT16* value) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte == 0x80) - stream_read_uint16(s, *value); + stream_read_UINT16(s, *value); else *value = (byte & 0x3F); } static INLINE void update_seek_glyph_delta(STREAM* s) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte & 0x80) - stream_seek_uint8(s); + stream_seek_BYTE(s); } -static INLINE void update_read_brush(STREAM* s, rdpBrush* brush, uint8 fieldFlags) +static INLINE void update_read_brush(STREAM* s, rdpBrush* brush, BYTE fieldFlags) { if (fieldFlags & ORDER_FIELD_01) - stream_read_uint8(s, brush->x); + stream_read_BYTE(s, brush->x); if (fieldFlags & ORDER_FIELD_02) - stream_read_uint8(s, brush->y); + stream_read_BYTE(s, brush->y); if (fieldFlags & ORDER_FIELD_03) - stream_read_uint8(s, brush->style); + stream_read_BYTE(s, brush->style); if (fieldFlags & ORDER_FIELD_04) - stream_read_uint8(s, brush->hatch); + stream_read_BYTE(s, brush->hatch); if (brush->style & CACHED_BRUSH) { @@ -346,14 +346,14 @@ static INLINE void update_read_brush(STREAM* s, rdpBrush* brush, uint8 fieldFlag if (fieldFlags & ORDER_FIELD_05) { - brush->data = (uint8*) brush->p8x8; - stream_read_uint8(s, brush->data[7]); - stream_read_uint8(s, brush->data[6]); - stream_read_uint8(s, brush->data[5]); - stream_read_uint8(s, brush->data[4]); - stream_read_uint8(s, brush->data[3]); - stream_read_uint8(s, brush->data[2]); - stream_read_uint8(s, brush->data[1]); + brush->data = (BYTE*) brush->p8x8; + stream_read_BYTE(s, brush->data[7]); + stream_read_BYTE(s, brush->data[6]); + stream_read_BYTE(s, brush->data[5]); + stream_read_BYTE(s, brush->data[4]); + stream_read_BYTE(s, brush->data[3]); + stream_read_BYTE(s, brush->data[2]); + stream_read_BYTE(s, brush->data[1]); brush->data[0] = brush->hatch; } } @@ -361,8 +361,8 @@ static INLINE void update_read_brush(STREAM* s, rdpBrush* brush, uint8 fieldFlag static INLINE void update_read_delta_rects(STREAM* s, DELTA_RECT* rectangles, int number) { int i; - uint8 flags = 0; - uint8* zeroBits; + BYTE flags = 0; + BYTE* zeroBits; int zeroBitsSize; if (number > 45) @@ -403,11 +403,11 @@ static INLINE void update_read_delta_rects(STREAM* s, DELTA_RECT* rectangles, in } } -static INLINE void update_read_delta_points(STREAM* s, DELTA_POINT* points, int number, sint16 x, sint16 y) +static INLINE void update_read_delta_points(STREAM* s, DELTA_POINT* points, int number, INT16 x, INT16 y) { int i; - uint8 flags = 0; - uint8* zeroBits; + BYTE flags = 0; + BYTE* zeroBits; int zeroBitsSize; zeroBitsSize = ((number + 3) / 4); @@ -449,7 +449,7 @@ void update_read_dstblt_order(STREAM* s, ORDER_INFO* orderInfo, DSTBLT_ORDER* ds update_read_coord(s, &dstblt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, dstblt->bRop); + stream_read_BYTE(s, dstblt->bRop); } void update_read_patblt_order(STREAM* s, ORDER_INFO* orderInfo, PATBLT_ORDER* patblt) @@ -467,7 +467,7 @@ void update_read_patblt_order(STREAM* s, ORDER_INFO* orderInfo, PATBLT_ORDER* pa update_read_coord(s, &patblt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, patblt->bRop); + stream_read_BYTE(s, patblt->bRop); if (orderInfo->fieldFlags & ORDER_FIELD_06) update_read_color(s, &patblt->backColor); @@ -493,7 +493,7 @@ void update_read_scrblt_order(STREAM* s, ORDER_INFO* orderInfo, SCRBLT_ORDER* sc update_read_coord(s, &scrblt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, scrblt->bRop); + stream_read_BYTE(s, scrblt->bRop); if (orderInfo->fieldFlags & ORDER_FIELD_06) update_read_coord(s, &scrblt->nXSrc, orderInfo->deltaCoordinates); @@ -504,7 +504,7 @@ void update_read_scrblt_order(STREAM* s, ORDER_INFO* orderInfo, SCRBLT_ORDER* sc void update_read_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, OPAQUE_RECT_ORDER* opaque_rect) { - uint8 byte; + BYTE byte; if (orderInfo->fieldFlags & ORDER_FIELD_01) update_read_coord(s, &opaque_rect->nLeftRect, orderInfo->deltaCoordinates); @@ -520,19 +520,19 @@ void update_read_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, OPAQUE_RECT if (orderInfo->fieldFlags & ORDER_FIELD_05) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); opaque_rect->color = (opaque_rect->color & 0xFFFFFF00) | byte; } if (orderInfo->fieldFlags & ORDER_FIELD_06) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); opaque_rect->color = (opaque_rect->color & 0xFFFF00FF) | (byte << 8); } if (orderInfo->fieldFlags & ORDER_FIELD_07) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); opaque_rect->color = (opaque_rect->color & 0xFF00FFFF) | (byte << 16); } } @@ -552,7 +552,7 @@ void update_read_draw_nine_grid_order(STREAM* s, ORDER_INFO* orderInfo, DRAW_NIN update_read_coord(s, &draw_nine_grid->srcBottom, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint16(s, draw_nine_grid->bitmapId); + stream_read_UINT16(s, draw_nine_grid->bitmapId); } void update_read_multi_dstblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_DSTBLT_ORDER* multi_dstblt) @@ -570,14 +570,14 @@ void update_read_multi_dstblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_DSTB update_read_coord(s, &multi_dstblt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, multi_dstblt->bRop); + stream_read_BYTE(s, multi_dstblt->bRop); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, multi_dstblt->numRectangles); + stream_read_BYTE(s, multi_dstblt->numRectangles); if (orderInfo->fieldFlags & ORDER_FIELD_07) { - stream_read_uint16(s, multi_dstblt->cbData); + stream_read_UINT16(s, multi_dstblt->cbData); update_read_delta_rects(s, multi_dstblt->rectangles, multi_dstblt->numRectangles); } } @@ -597,7 +597,7 @@ void update_read_multi_patblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_PATB update_read_coord(s, &multi_patblt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, multi_patblt->bRop); + stream_read_BYTE(s, multi_patblt->bRop); if (orderInfo->fieldFlags & ORDER_FIELD_06) update_read_color(s, &multi_patblt->backColor); @@ -608,11 +608,11 @@ void update_read_multi_patblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_PATB update_read_brush(s, &multi_patblt->brush, orderInfo->fieldFlags >> 7); if (orderInfo->fieldFlags & ORDER_FIELD_13) - stream_read_uint8(s, multi_patblt->numRectangles); + stream_read_BYTE(s, multi_patblt->numRectangles); if (orderInfo->fieldFlags & ORDER_FIELD_14) { - stream_read_uint16(s, multi_patblt->cbData); + stream_read_UINT16(s, multi_patblt->cbData); update_read_delta_rects(s, multi_patblt->rectangles, multi_patblt->numRectangles); } } @@ -632,7 +632,7 @@ void update_read_multi_scrblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_SCRB update_read_coord(s, &multi_scrblt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, multi_scrblt->bRop); + stream_read_BYTE(s, multi_scrblt->bRop); if (orderInfo->fieldFlags & ORDER_FIELD_06) update_read_coord(s, &multi_scrblt->nXSrc, orderInfo->deltaCoordinates); @@ -641,18 +641,18 @@ void update_read_multi_scrblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_SCRB update_read_coord(s, &multi_scrblt->nYSrc, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_08) - stream_read_uint8(s, multi_scrblt->numRectangles); + stream_read_BYTE(s, multi_scrblt->numRectangles); if (orderInfo->fieldFlags & ORDER_FIELD_09) { - stream_read_uint16(s, multi_scrblt->cbData); + stream_read_UINT16(s, multi_scrblt->cbData); update_read_delta_rects(s, multi_scrblt->rectangles, multi_scrblt->numRectangles); } } void update_read_multi_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect) { - uint8 byte; + BYTE byte; if (orderInfo->fieldFlags & ORDER_FIELD_01) update_read_coord(s, &multi_opaque_rect->nLeftRect, orderInfo->deltaCoordinates); @@ -668,28 +668,28 @@ void update_read_multi_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, MULTI if (orderInfo->fieldFlags & ORDER_FIELD_05) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); multi_opaque_rect->color = (multi_opaque_rect->color & 0xFFFFFF00) | byte; } if (orderInfo->fieldFlags & ORDER_FIELD_06) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); multi_opaque_rect->color = (multi_opaque_rect->color & 0xFFFF00FF) | (byte << 8); } if (orderInfo->fieldFlags & ORDER_FIELD_07) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); multi_opaque_rect->color = (multi_opaque_rect->color & 0xFF00FFFF) | (byte << 16); } if (orderInfo->fieldFlags & ORDER_FIELD_08) - stream_read_uint8(s, multi_opaque_rect->numRectangles); + stream_read_BYTE(s, multi_opaque_rect->numRectangles); if (orderInfo->fieldFlags & ORDER_FIELD_09) { - stream_read_uint16(s, multi_opaque_rect->cbData); + stream_read_UINT16(s, multi_opaque_rect->cbData); update_read_delta_rects(s, multi_opaque_rect->rectangles, multi_opaque_rect->numRectangles); } } @@ -709,14 +709,14 @@ void update_read_multi_draw_nine_grid_order(STREAM* s, ORDER_INFO* orderInfo, MU update_read_coord(s, &multi_draw_nine_grid->srcBottom, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint16(s, multi_draw_nine_grid->bitmapId); + stream_read_UINT16(s, multi_draw_nine_grid->bitmapId); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, multi_draw_nine_grid->nDeltaEntries); + stream_read_BYTE(s, multi_draw_nine_grid->nDeltaEntries); if (orderInfo->fieldFlags & ORDER_FIELD_07) { - stream_read_uint16(s, multi_draw_nine_grid->cbData); + stream_read_UINT16(s, multi_draw_nine_grid->cbData); stream_seek(s, multi_draw_nine_grid->cbData); } } @@ -724,7 +724,7 @@ void update_read_multi_draw_nine_grid_order(STREAM* s, ORDER_INFO* orderInfo, MU void update_read_line_to_order(STREAM* s, ORDER_INFO* orderInfo, LINE_TO_ORDER* line_to) { if (orderInfo->fieldFlags & ORDER_FIELD_01) - stream_read_uint16(s, line_to->backMode); + stream_read_UINT16(s, line_to->backMode); if (orderInfo->fieldFlags & ORDER_FIELD_02) update_read_coord(s, &line_to->nXStart, orderInfo->deltaCoordinates); @@ -742,13 +742,13 @@ void update_read_line_to_order(STREAM* s, ORDER_INFO* orderInfo, LINE_TO_ORDER* update_read_color(s, &line_to->backColor); if (orderInfo->fieldFlags & ORDER_FIELD_07) - stream_read_uint8(s, line_to->bRop2); + stream_read_BYTE(s, line_to->bRop2); if (orderInfo->fieldFlags & ORDER_FIELD_08) - stream_read_uint8(s, line_to->penStyle); + stream_read_BYTE(s, line_to->penStyle); if (orderInfo->fieldFlags & ORDER_FIELD_09) - stream_read_uint8(s, line_to->penWidth); + stream_read_BYTE(s, line_to->penWidth); if (orderInfo->fieldFlags & ORDER_FIELD_10) update_read_color(s, &line_to->penColor); @@ -763,25 +763,25 @@ void update_read_polyline_order(STREAM* s, ORDER_INFO* orderInfo, POLYLINE_ORDER update_read_coord(s, &polyline->yStart, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_03) - stream_read_uint8(s, polyline->bRop2); + stream_read_BYTE(s, polyline->bRop2); if (orderInfo->fieldFlags & ORDER_FIELD_04) - stream_seek_uint16(s); + stream_seek_UINT16(s); if (orderInfo->fieldFlags & ORDER_FIELD_05) update_read_color(s, &polyline->penColor); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, polyline->numPoints); + stream_read_BYTE(s, polyline->numPoints); if (orderInfo->fieldFlags & ORDER_FIELD_07) { - stream_read_uint8(s, polyline->cbData); + stream_read_BYTE(s, polyline->cbData); if (polyline->points == NULL) - polyline->points = (DELTA_POINT*) xmalloc(sizeof(DELTA_POINT) * polyline->numPoints); + polyline->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polyline->numPoints); else - polyline->points = (DELTA_POINT*) xrealloc(polyline->points, sizeof(DELTA_POINT) * polyline->numPoints); + polyline->points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * polyline->numPoints); update_read_delta_points(s, polyline->points, polyline->numPoints, polyline->xStart, polyline->yStart); } @@ -790,7 +790,7 @@ void update_read_polyline_order(STREAM* s, ORDER_INFO* orderInfo, POLYLINE_ORDER void update_read_memblt_order(STREAM* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* memblt) { if (orderInfo->fieldFlags & ORDER_FIELD_01) - stream_read_uint16(s, memblt->cacheId); + stream_read_UINT16(s, memblt->cacheId); if (orderInfo->fieldFlags & ORDER_FIELD_02) update_read_coord(s, &memblt->nLeftRect, orderInfo->deltaCoordinates); @@ -805,7 +805,7 @@ void update_read_memblt_order(STREAM* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* me update_read_coord(s, &memblt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, memblt->bRop); + stream_read_BYTE(s, memblt->bRop); if (orderInfo->fieldFlags & ORDER_FIELD_07) update_read_coord(s, &memblt->nXSrc, orderInfo->deltaCoordinates); @@ -814,7 +814,7 @@ void update_read_memblt_order(STREAM* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* me update_read_coord(s, &memblt->nYSrc, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_09) - stream_read_uint16(s, memblt->cacheIndex); + stream_read_UINT16(s, memblt->cacheIndex); memblt->colorIndex = (memblt->cacheId >> 8); memblt->cacheId = (memblt->cacheId & 0xFF); @@ -823,7 +823,7 @@ void update_read_memblt_order(STREAM* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* me void update_read_mem3blt_order(STREAM* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER* mem3blt) { if (orderInfo->fieldFlags & ORDER_FIELD_01) - stream_read_uint16(s, mem3blt->cacheId); + stream_read_UINT16(s, mem3blt->cacheId); if (orderInfo->fieldFlags & ORDER_FIELD_02) update_read_coord(s, &mem3blt->nLeftRect, orderInfo->deltaCoordinates); @@ -838,7 +838,7 @@ void update_read_mem3blt_order(STREAM* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER* update_read_coord(s, &mem3blt->nHeight, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, mem3blt->bRop); + stream_read_BYTE(s, mem3blt->bRop); if (orderInfo->fieldFlags & ORDER_FIELD_07) update_read_coord(s, &mem3blt->nXSrc, orderInfo->deltaCoordinates); @@ -855,7 +855,7 @@ void update_read_mem3blt_order(STREAM* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER* update_read_brush(s, &mem3blt->brush, orderInfo->fieldFlags >> 10); if (orderInfo->fieldFlags & ORDER_FIELD_16) - stream_read_uint16(s, mem3blt->cacheIndex); + stream_read_UINT16(s, mem3blt->cacheIndex); mem3blt->colorIndex = (mem3blt->cacheId >> 8); mem3blt->cacheId = (mem3blt->cacheId & 0xFF); @@ -864,7 +864,7 @@ void update_read_mem3blt_order(STREAM* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER* void update_read_save_bitmap_order(STREAM* s, ORDER_INFO* orderInfo, SAVE_BITMAP_ORDER* save_bitmap) { if (orderInfo->fieldFlags & ORDER_FIELD_01) - stream_read_uint32(s, save_bitmap->savedBitmapPosition); + stream_read_UINT32(s, save_bitmap->savedBitmapPosition); if (orderInfo->fieldFlags & ORDER_FIELD_02) update_read_coord(s, &save_bitmap->nLeftRect, orderInfo->deltaCoordinates); @@ -879,22 +879,22 @@ void update_read_save_bitmap_order(STREAM* s, ORDER_INFO* orderInfo, SAVE_BITMAP update_read_coord(s, &save_bitmap->nBottomRect, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, save_bitmap->operation); + stream_read_BYTE(s, save_bitmap->operation); } void update_read_glyph_index_order(STREAM* s, ORDER_INFO* orderInfo, GLYPH_INDEX_ORDER* glyph_index) { if (orderInfo->fieldFlags & ORDER_FIELD_01) - stream_read_uint8(s, glyph_index->cacheId); + stream_read_BYTE(s, glyph_index->cacheId); if (orderInfo->fieldFlags & ORDER_FIELD_02) - stream_read_uint8(s, glyph_index->flAccel); + stream_read_BYTE(s, glyph_index->flAccel); if (orderInfo->fieldFlags & ORDER_FIELD_03) - stream_read_uint8(s, glyph_index->ulCharInc); + stream_read_BYTE(s, glyph_index->ulCharInc); if (orderInfo->fieldFlags & ORDER_FIELD_04) - stream_read_uint8(s, glyph_index->fOpRedundant); + stream_read_BYTE(s, glyph_index->fOpRedundant); if (orderInfo->fieldFlags & ORDER_FIELD_05) update_read_color(s, &glyph_index->backColor); @@ -903,40 +903,40 @@ void update_read_glyph_index_order(STREAM* s, ORDER_INFO* orderInfo, GLYPH_INDEX update_read_color(s, &glyph_index->foreColor); if (orderInfo->fieldFlags & ORDER_FIELD_07) - stream_read_uint16(s, glyph_index->bkLeft); + stream_read_UINT16(s, glyph_index->bkLeft); if (orderInfo->fieldFlags & ORDER_FIELD_08) - stream_read_uint16(s, glyph_index->bkTop); + stream_read_UINT16(s, glyph_index->bkTop); if (orderInfo->fieldFlags & ORDER_FIELD_09) - stream_read_uint16(s, glyph_index->bkRight); + stream_read_UINT16(s, glyph_index->bkRight); if (orderInfo->fieldFlags & ORDER_FIELD_10) - stream_read_uint16(s, glyph_index->bkBottom); + stream_read_UINT16(s, glyph_index->bkBottom); if (orderInfo->fieldFlags & ORDER_FIELD_11) - stream_read_uint16(s, glyph_index->opLeft); + stream_read_UINT16(s, glyph_index->opLeft); if (orderInfo->fieldFlags & ORDER_FIELD_12) - stream_read_uint16(s, glyph_index->opTop); + stream_read_UINT16(s, glyph_index->opTop); if (orderInfo->fieldFlags & ORDER_FIELD_13) - stream_read_uint16(s, glyph_index->opRight); + stream_read_UINT16(s, glyph_index->opRight); if (orderInfo->fieldFlags & ORDER_FIELD_14) - stream_read_uint16(s, glyph_index->opBottom); + stream_read_UINT16(s, glyph_index->opBottom); update_read_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14); if (orderInfo->fieldFlags & ORDER_FIELD_20) - stream_read_uint16(s, glyph_index->x); + stream_read_UINT16(s, glyph_index->x); if (orderInfo->fieldFlags & ORDER_FIELD_21) - stream_read_uint16(s, glyph_index->y); + stream_read_UINT16(s, glyph_index->y); if (orderInfo->fieldFlags & ORDER_FIELD_22) { - stream_read_uint8(s, glyph_index->cbData); + stream_read_BYTE(s, glyph_index->cbData); memcpy(glyph_index->data, s->p, glyph_index->cbData); stream_seek(s, glyph_index->cbData); } @@ -945,12 +945,12 @@ void update_read_glyph_index_order(STREAM* s, ORDER_INFO* orderInfo, GLYPH_INDEX void update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_ORDER* fast_index) { if (orderInfo->fieldFlags & ORDER_FIELD_01) - stream_read_uint8(s, fast_index->cacheId); + stream_read_BYTE(s, fast_index->cacheId); if (orderInfo->fieldFlags & ORDER_FIELD_02) { - stream_read_uint8(s, fast_index->ulCharInc); - stream_read_uint8(s, fast_index->flAccel); + stream_read_BYTE(s, fast_index->ulCharInc); + stream_read_BYTE(s, fast_index->flAccel); } if (orderInfo->fieldFlags & ORDER_FIELD_03) @@ -991,7 +991,7 @@ void update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_O if (orderInfo->fieldFlags & ORDER_FIELD_15) { - stream_read_uint8(s, fast_index->cbData); + stream_read_BYTE(s, fast_index->cbData); memcpy(fast_index->data, s->p, fast_index->cbData); stream_seek(s, fast_index->cbData); } @@ -1000,15 +1000,15 @@ void update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_O void update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_ORDER* fast_glyph) { GLYPH_DATA_V2* glyph; - uint8* phold; + BYTE* phold; if (orderInfo->fieldFlags & ORDER_FIELD_01) - stream_read_uint8(s, fast_glyph->cacheId); + stream_read_BYTE(s, fast_glyph->cacheId); if (orderInfo->fieldFlags & ORDER_FIELD_02) { - stream_read_uint8(s, fast_glyph->ulCharInc); - stream_read_uint8(s, fast_glyph->flAccel); + stream_read_BYTE(s, fast_glyph->ulCharInc); + stream_read_BYTE(s, fast_glyph->flAccel); } if (orderInfo->fieldFlags & ORDER_FIELD_03) @@ -1049,14 +1049,14 @@ void update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O if (orderInfo->fieldFlags & ORDER_FIELD_15) { - stream_read_uint8(s, fast_glyph->cbData); + stream_read_BYTE(s, fast_glyph->cbData); memcpy(fast_glyph->data, s->p, fast_glyph->cbData); phold = s->p; stream_seek(s, 1); if ((fast_glyph->cbData > 1) && (fast_glyph->glyph_data == NULL)) { /* parse optional glyph data */ - glyph = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2)); + glyph = (GLYPH_DATA_V2*) malloc(sizeof(GLYPH_DATA_V2)); glyph->cacheIndex = fast_glyph->data[0]; update_read_2byte_signed(s, &glyph->x); update_read_2byte_signed(s, &glyph->y); @@ -1064,7 +1064,7 @@ void update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O update_read_2byte_unsigned(s, &glyph->cy); glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; - glyph->aj = (uint8*) xmalloc(glyph->cb); + glyph->aj = (BYTE*) malloc(glyph->cb); stream_read(s, glyph->aj, glyph->cb); fast_glyph->glyph_data = glyph; } @@ -1081,25 +1081,25 @@ void update_read_polygon_sc_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_SC_O update_read_coord(s, &polygon_sc->yStart, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_03) - stream_read_uint8(s, polygon_sc->bRop2); + stream_read_BYTE(s, polygon_sc->bRop2); if (orderInfo->fieldFlags & ORDER_FIELD_04) - stream_read_uint8(s, polygon_sc->fillMode); + stream_read_BYTE(s, polygon_sc->fillMode); if (orderInfo->fieldFlags & ORDER_FIELD_05) update_read_color(s, &polygon_sc->brushColor); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, polygon_sc->numPoints); + stream_read_BYTE(s, polygon_sc->numPoints); if (orderInfo->fieldFlags & ORDER_FIELD_07) { - stream_read_uint8(s, polygon_sc->cbData); + stream_read_BYTE(s, polygon_sc->cbData); if (polygon_sc->points == NULL) - polygon_sc->points = (DELTA_POINT*) xmalloc(sizeof(DELTA_POINT) * polygon_sc->numPoints); + polygon_sc->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polygon_sc->numPoints); else - polygon_sc->points = (DELTA_POINT*) xrealloc(polygon_sc->points, sizeof(DELTA_POINT) * polygon_sc->numPoints); + polygon_sc->points = (DELTA_POINT*) realloc(polygon_sc->points, sizeof(DELTA_POINT) * polygon_sc->numPoints); update_read_delta_points(s, polygon_sc->points, polygon_sc->numPoints, polygon_sc->xStart, polygon_sc->yStart); } @@ -1114,10 +1114,10 @@ void update_read_polygon_cb_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_CB_O update_read_coord(s, &polygon_cb->yStart, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_03) - stream_read_uint8(s, polygon_cb->bRop2); + stream_read_BYTE(s, polygon_cb->bRop2); if (orderInfo->fieldFlags & ORDER_FIELD_04) - stream_read_uint8(s, polygon_cb->fillMode); + stream_read_BYTE(s, polygon_cb->fillMode); if (orderInfo->fieldFlags & ORDER_FIELD_05) update_read_color(s, &polygon_cb->backColor); @@ -1128,16 +1128,16 @@ void update_read_polygon_cb_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_CB_O update_read_brush(s, &polygon_cb->brush, orderInfo->fieldFlags >> 6); if (orderInfo->fieldFlags & ORDER_FIELD_12) - stream_read_uint8(s, polygon_cb->numPoints); + stream_read_BYTE(s, polygon_cb->numPoints); if (orderInfo->fieldFlags & ORDER_FIELD_13) { - stream_read_uint8(s, polygon_cb->cbData); + stream_read_BYTE(s, polygon_cb->cbData); if (polygon_cb->points == NULL) - polygon_cb->points = (DELTA_POINT*) xmalloc(sizeof(DELTA_POINT) * polygon_cb->numPoints); + polygon_cb->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polygon_cb->numPoints); else - polygon_cb->points = (DELTA_POINT*) xrealloc(polygon_cb->points, sizeof(DELTA_POINT) * polygon_cb->numPoints); + polygon_cb->points = (DELTA_POINT*) realloc(polygon_cb->points, sizeof(DELTA_POINT) * polygon_cb->numPoints); update_read_delta_points(s, polygon_cb->points, polygon_cb->numPoints, polygon_cb->xStart, polygon_cb->yStart); } @@ -1161,10 +1161,10 @@ void update_read_ellipse_sc_order(STREAM* s, ORDER_INFO* orderInfo, ELLIPSE_SC_O update_read_coord(s, &ellipse_sc->bottomRect, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, ellipse_sc->bRop2); + stream_read_BYTE(s, ellipse_sc->bRop2); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, ellipse_sc->fillMode); + stream_read_BYTE(s, ellipse_sc->fillMode); if (orderInfo->fieldFlags & ORDER_FIELD_07) update_read_color(s, &ellipse_sc->color); @@ -1185,10 +1185,10 @@ void update_read_ellipse_cb_order(STREAM* s, ORDER_INFO* orderInfo, ELLIPSE_CB_O update_read_coord(s, &ellipse_cb->bottomRect, orderInfo->deltaCoordinates); if (orderInfo->fieldFlags & ORDER_FIELD_05) - stream_read_uint8(s, ellipse_cb->bRop2); + stream_read_BYTE(s, ellipse_cb->bRop2); if (orderInfo->fieldFlags & ORDER_FIELD_06) - stream_read_uint8(s, ellipse_cb->fillMode); + stream_read_BYTE(s, ellipse_cb->fillMode); if (orderInfo->fieldFlags & ORDER_FIELD_07) update_read_color(s, &ellipse_cb->backColor); @@ -1201,21 +1201,21 @@ void update_read_ellipse_cb_order(STREAM* s, ORDER_INFO* orderInfo, ELLIPSE_CB_O /* Secondary Drawing Orders */ -void update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_order, boolean compressed, uint16 flags) +void update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_order, BOOL compressed, UINT16 flags) { - stream_read_uint8(s, cache_bitmap_order->cacheId); /* cacheId (1 byte) */ - stream_seek_uint8(s); /* pad1Octet (1 byte) */ - stream_read_uint8(s, cache_bitmap_order->bitmapWidth); /* bitmapWidth (1 byte) */ - stream_read_uint8(s, cache_bitmap_order->bitmapHeight); /* bitmapHeight (1 byte) */ - stream_read_uint8(s, cache_bitmap_order->bitmapBpp); /* bitmapBpp (1 byte) */ - stream_read_uint16(s, cache_bitmap_order->bitmapLength); /* bitmapLength (2 bytes) */ - stream_read_uint16(s, cache_bitmap_order->cacheIndex); /* cacheIndex (2 bytes) */ + stream_read_BYTE(s, cache_bitmap_order->cacheId); /* cacheId (1 byte) */ + stream_seek_BYTE(s); /* pad1Octet (1 byte) */ + stream_read_BYTE(s, cache_bitmap_order->bitmapWidth); /* bitmapWidth (1 byte) */ + stream_read_BYTE(s, cache_bitmap_order->bitmapHeight); /* bitmapHeight (1 byte) */ + stream_read_BYTE(s, cache_bitmap_order->bitmapBpp); /* bitmapBpp (1 byte) */ + stream_read_UINT16(s, cache_bitmap_order->bitmapLength); /* bitmapLength (2 bytes) */ + stream_read_UINT16(s, cache_bitmap_order->cacheIndex); /* cacheIndex (2 bytes) */ if (compressed) { if ((flags & NO_BITMAP_COMPRESSION_HDR) == 0) { - uint8* bitmapComprHdr = (uint8*) &(cache_bitmap_order->bitmapComprHdr); + BYTE* bitmapComprHdr = (BYTE*) &(cache_bitmap_order->bitmapComprHdr); stream_read(s, bitmapComprHdr, 8); /* bitmapComprHdr (8 bytes) */ cache_bitmap_order->bitmapLength -= 8; } @@ -1230,9 +1230,9 @@ void update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_ cache_bitmap_order->compressed = compressed; } -void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order, boolean compressed, uint16 flags) +void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order, BOOL compressed, UINT16 flags) { - uint8 bitsPerPixelId; + BYTE bitsPerPixelId; cache_bitmap_v2_order->cacheId = flags & 0x0003; cache_bitmap_v2_order->flags = (flags & 0xFF80) >> 7; @@ -1242,8 +1242,8 @@ void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b if (cache_bitmap_v2_order->flags & CBR2_PERSISTENT_KEY_PRESENT) { - stream_read_uint32(s, cache_bitmap_v2_order->key1); /* key1 (4 bytes) */ - stream_read_uint32(s, cache_bitmap_v2_order->key2); /* key2 (4 bytes) */ + stream_read_UINT32(s, cache_bitmap_v2_order->key1); /* key1 (4 bytes) */ + stream_read_UINT32(s, cache_bitmap_v2_order->key2); /* key2 (4 bytes) */ } if (cache_bitmap_v2_order->flags & CBR2_HEIGHT_SAME_AS_WIDTH) @@ -1267,10 +1267,10 @@ void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b { if (!(cache_bitmap_v2_order->flags & CBR2_NO_BITMAP_COMPRESSION_HDR)) { - stream_read_uint16(s, cache_bitmap_v2_order->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */ - stream_read_uint16(s, cache_bitmap_v2_order->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */ - stream_read_uint16(s, cache_bitmap_v2_order->cbScanWidth); /* cbScanWidth (2 bytes) */ - stream_read_uint16(s, cache_bitmap_v2_order->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */ + stream_read_UINT16(s, cache_bitmap_v2_order->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */ + stream_read_UINT16(s, cache_bitmap_v2_order->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */ + stream_read_UINT16(s, cache_bitmap_v2_order->cbScanWidth); /* cbScanWidth (2 bytes) */ + stream_read_UINT16(s, cache_bitmap_v2_order->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */ cache_bitmap_v2_order->bitmapLength = cache_bitmap_v2_order->cbCompMainBodySize; } @@ -1285,9 +1285,9 @@ void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b cache_bitmap_v2_order->compressed = compressed; } -void update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order, boolean compressed, uint16 flags) +void update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order, BOOL compressed, UINT16 flags) { - uint8 bitsPerPixelId; + BYTE bitsPerPixelId; BITMAP_DATA_EX* bitmapData; cache_bitmap_v3_order->cacheId = flags & 0x00000003; @@ -1296,42 +1296,42 @@ void update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_b bitsPerPixelId = (flags & 0x00000078) >> 3; cache_bitmap_v3_order->bpp = CBR23_BPP[bitsPerPixelId]; - stream_read_uint16(s, cache_bitmap_v3_order->cacheIndex); /* cacheIndex (2 bytes) */ - stream_read_uint32(s, cache_bitmap_v3_order->key1); /* key1 (4 bytes) */ - stream_read_uint32(s, cache_bitmap_v3_order->key2); /* key2 (4 bytes) */ + stream_read_UINT16(s, cache_bitmap_v3_order->cacheIndex); /* cacheIndex (2 bytes) */ + stream_read_UINT32(s, cache_bitmap_v3_order->key1); /* key1 (4 bytes) */ + stream_read_UINT32(s, cache_bitmap_v3_order->key2); /* key2 (4 bytes) */ bitmapData = &cache_bitmap_v3_order->bitmapData; - stream_read_uint8(s, bitmapData->bpp); - stream_seek_uint8(s); /* reserved1 (1 byte) */ - stream_seek_uint8(s); /* reserved2 (1 byte) */ - stream_read_uint8(s, bitmapData->codecID); /* codecID (1 byte) */ - stream_read_uint16(s, bitmapData->width); /* width (2 bytes) */ - stream_read_uint16(s, bitmapData->height); /* height (2 bytes) */ - stream_read_uint32(s, bitmapData->length); /* length (4 bytes) */ + stream_read_BYTE(s, bitmapData->bpp); + stream_seek_BYTE(s); /* reserved1 (1 byte) */ + stream_seek_BYTE(s); /* reserved2 (1 byte) */ + stream_read_BYTE(s, bitmapData->codecID); /* codecID (1 byte) */ + stream_read_UINT16(s, bitmapData->width); /* width (2 bytes) */ + stream_read_UINT16(s, bitmapData->height); /* height (2 bytes) */ + stream_read_UINT32(s, bitmapData->length); /* length (4 bytes) */ if (bitmapData->data == NULL) - bitmapData->data = (uint8*) xmalloc(bitmapData->length); + bitmapData->data = (BYTE*) malloc(bitmapData->length); else - bitmapData->data = (uint8*) xrealloc(bitmapData->data, bitmapData->length); + bitmapData->data = (BYTE*) realloc(bitmapData->data, bitmapData->length); stream_read(s, bitmapData->data, bitmapData->length); } -void update_read_cache_color_table_order(STREAM* s, CACHE_COLOR_TABLE_ORDER* cache_color_table_order, uint16 flags) +void update_read_cache_color_table_order(STREAM* s, CACHE_COLOR_TABLE_ORDER* cache_color_table_order, UINT16 flags) { int i; - uint32* colorTable; + UINT32* colorTable; - stream_read_uint8(s, cache_color_table_order->cacheIndex); /* cacheIndex (1 byte) */ - stream_read_uint8(s, cache_color_table_order->numberColors); /* numberColors (2 bytes) */ + stream_read_BYTE(s, cache_color_table_order->cacheIndex); /* cacheIndex (1 byte) */ + stream_read_BYTE(s, cache_color_table_order->numberColors); /* numberColors (2 bytes) */ colorTable = cache_color_table_order->colorTable; if (colorTable == NULL) - colorTable = (uint32*) xmalloc(cache_color_table_order->numberColors * 4); + colorTable = (UINT32*) malloc(cache_color_table_order->numberColors * 4); else - colorTable = (uint32*) xrealloc(colorTable, cache_color_table_order->numberColors * 4); + colorTable = (UINT32*) realloc(colorTable, cache_color_table_order->numberColors * 4); for (i = 0; i < (int) cache_color_table_order->numberColors; i++) { @@ -1341,35 +1341,35 @@ void update_read_cache_color_table_order(STREAM* s, CACHE_COLOR_TABLE_ORDER* cac cache_color_table_order->colorTable = colorTable; } -void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_order, uint16 flags) +void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_order, UINT16 flags) { int i; - sint16 lsi16; + INT16 lsi16; GLYPH_DATA* glyph; - stream_read_uint8(s, cache_glyph_order->cacheId); /* cacheId (1 byte) */ - stream_read_uint8(s, cache_glyph_order->cGlyphs); /* cGlyphs (1 byte) */ + stream_read_BYTE(s, cache_glyph_order->cacheId); /* cacheId (1 byte) */ + stream_read_BYTE(s, cache_glyph_order->cGlyphs); /* cGlyphs (1 byte) */ for (i = 0; i < (int) cache_glyph_order->cGlyphs; i++) { if (cache_glyph_order->glyphData[i] == NULL) { - cache_glyph_order->glyphData[i] = (GLYPH_DATA*) xmalloc(sizeof(GLYPH_DATA)); + cache_glyph_order->glyphData[i] = (GLYPH_DATA*) malloc(sizeof(GLYPH_DATA)); } glyph = cache_glyph_order->glyphData[i]; - stream_read_uint16(s, glyph->cacheIndex); - stream_read_uint16(s, lsi16); + stream_read_UINT16(s, glyph->cacheIndex); + stream_read_UINT16(s, lsi16); glyph->x = lsi16; - stream_read_uint16(s, lsi16); + stream_read_UINT16(s, lsi16); glyph->y = lsi16; - stream_read_uint16(s, glyph->cx); - stream_read_uint16(s, glyph->cy); + stream_read_UINT16(s, glyph->cx); + stream_read_UINT16(s, glyph->cy); glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; - glyph->aj = (uint8*) xmalloc(glyph->cb); + glyph->aj = (BYTE*) malloc(glyph->cb); stream_read(s, glyph->aj, glyph->cb); } @@ -1378,7 +1378,7 @@ void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_ord stream_seek(s, cache_glyph_order->cGlyphs * 2); } -void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order, uint16 flags) +void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order, UINT16 flags) { int i; GLYPH_DATA_V2* glyph; @@ -1391,11 +1391,11 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly { if (cache_glyph_v2_order->glyphData[i] == NULL) { - cache_glyph_v2_order->glyphData[i] = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2)); + cache_glyph_v2_order->glyphData[i] = (GLYPH_DATA_V2*) malloc(sizeof(GLYPH_DATA_V2)); } glyph = cache_glyph_v2_order->glyphData[i]; - stream_read_uint8(s, glyph->cacheIndex); + stream_read_BYTE(s, glyph->cacheIndex); update_read_2byte_signed(s, &glyph->x); update_read_2byte_signed(s, &glyph->y); update_read_2byte_unsigned(s, &glyph->cx); @@ -1404,7 +1404,7 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; - glyph->aj = (uint8*) xmalloc(glyph->cb); + glyph->aj = (BYTE*) malloc(glyph->cb); stream_read(s, glyph->aj, glyph->cb); } @@ -1413,12 +1413,12 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly stream_seek(s, cache_glyph_v2_order->cGlyphs * 2); } -void update_decompress_brush(STREAM* s, uint8* output, uint8 bpp) +void update_decompress_brush(STREAM* s, BYTE* output, BYTE bpp) { int index; int x, y, k; - uint8 byte = 0; - uint8* palette; + BYTE byte = 0; + BYTE* palette; int bytesPerPixel; palette = s->p + 16; @@ -1429,7 +1429,7 @@ void update_decompress_brush(STREAM* s, uint8* output, uint8 bpp) for (x = 0; x < 8; x++) { if ((x % 4) == 0) - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); index = ((byte >> ((3 - (x % 4)) * 2)) & 0x03); @@ -1441,28 +1441,28 @@ void update_decompress_brush(STREAM* s, uint8* output, uint8 bpp) } } -void update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_order, uint16 flags) +void update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_order, UINT16 flags) { int i; int size; - uint8 iBitmapFormat; - boolean compressed = false; + BYTE iBitmapFormat; + BOOL compressed = FALSE; - stream_read_uint8(s, cache_brush_order->index); /* cacheEntry (1 byte) */ + stream_read_BYTE(s, cache_brush_order->index); /* cacheEntry (1 byte) */ - stream_read_uint8(s, iBitmapFormat); /* iBitmapFormat (1 byte) */ + stream_read_BYTE(s, iBitmapFormat); /* iBitmapFormat (1 byte) */ cache_brush_order->bpp = BMF_BPP[iBitmapFormat]; - stream_read_uint8(s, cache_brush_order->cx); /* cx (1 byte) */ - stream_read_uint8(s, cache_brush_order->cy); /* cy (1 byte) */ - stream_read_uint8(s, cache_brush_order->style); /* style (1 byte) */ - stream_read_uint8(s, cache_brush_order->length); /* iBytes (1 byte) */ + stream_read_BYTE(s, cache_brush_order->cx); /* cx (1 byte) */ + stream_read_BYTE(s, cache_brush_order->cy); /* cy (1 byte) */ + stream_read_BYTE(s, cache_brush_order->style); /* style (1 byte) */ + stream_read_BYTE(s, cache_brush_order->length); /* iBytes (1 byte) */ if ((cache_brush_order->cx == 8) && (cache_brush_order->cy == 8)) { size = (cache_brush_order->bpp == 1) ? 8 : 8 * 8 * cache_brush_order->bpp; - cache_brush_order->data = (uint8*) xmalloc(size); + cache_brush_order->data = (BYTE*) malloc(size); if (cache_brush_order->bpp == 1) { @@ -1476,19 +1476,19 @@ void update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_ord for (i = 7; i >= 0; i--) { - stream_read_uint8(s, cache_brush_order->data[i]); + stream_read_BYTE(s, cache_brush_order->data[i]); } } else { if ((iBitmapFormat == BMF_8BPP) && (cache_brush_order->length == 20)) - compressed = true; + compressed = TRUE; else if ((iBitmapFormat == BMF_16BPP) && (cache_brush_order->length == 24)) - compressed = true; + compressed = TRUE; else if ((iBitmapFormat == BMF_32BPP) && (cache_brush_order->length == 32)) - compressed = true; + compressed = TRUE; - if (compressed != false) + if (compressed != FALSE) { /* compressed brush */ update_decompress_brush(s, cache_brush_order->data, cache_brush_order->bpp); @@ -1511,33 +1511,33 @@ void update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_ord void update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap) { - uint16 flags; - boolean deleteListPresent; + UINT16 flags; + BOOL deleteListPresent; OFFSCREEN_DELETE_LIST* deleteList; - stream_read_uint16(s, flags); /* flags (2 bytes) */ + stream_read_UINT16(s, flags); /* flags (2 bytes) */ create_offscreen_bitmap->id = flags & 0x7FFF; - deleteListPresent = (flags & 0x8000) ? true : false; + deleteListPresent = (flags & 0x8000) ? TRUE : FALSE; - stream_read_uint16(s, create_offscreen_bitmap->cx); /* cx (2 bytes) */ - stream_read_uint16(s, create_offscreen_bitmap->cy); /* cy (2 bytes) */ + stream_read_UINT16(s, create_offscreen_bitmap->cx); /* cx (2 bytes) */ + stream_read_UINT16(s, create_offscreen_bitmap->cy); /* cy (2 bytes) */ deleteList = &(create_offscreen_bitmap->deleteList); if (deleteListPresent) { int i; - stream_read_uint16(s, deleteList->cIndices); + stream_read_UINT16(s, deleteList->cIndices); if (deleteList->cIndices > deleteList->sIndices) { deleteList->sIndices = deleteList->cIndices; - deleteList->indices = xrealloc(deleteList->indices, deleteList->sIndices * 2); + deleteList->indices = realloc(deleteList->indices, deleteList->sIndices * 2); } for (i = 0; i < (int) deleteList->cIndices; i++) { - stream_read_uint16(s, deleteList->indices[i]); + stream_read_UINT16(s, deleteList->indices[i]); } } else @@ -1548,113 +1548,113 @@ void update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA void update_read_switch_surface_order(STREAM* s, SWITCH_SURFACE_ORDER* switch_surface) { - stream_read_uint16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */ + stream_read_UINT16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */ } void update_read_create_nine_grid_bitmap_order(STREAM* s, CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap) { NINE_GRID_BITMAP_INFO* nineGridInfo; - stream_read_uint8(s, create_nine_grid_bitmap->bitmapBpp); /* bitmapBpp (1 byte) */ - stream_read_uint16(s, create_nine_grid_bitmap->bitmapId); /* bitmapId (2 bytes) */ + stream_read_BYTE(s, create_nine_grid_bitmap->bitmapBpp); /* bitmapBpp (1 byte) */ + stream_read_UINT16(s, create_nine_grid_bitmap->bitmapId); /* bitmapId (2 bytes) */ nineGridInfo = &(create_nine_grid_bitmap->nineGridInfo); - stream_read_uint32(s, nineGridInfo->flFlags); /* flFlags (4 bytes) */ - stream_read_uint16(s, nineGridInfo->ulLeftWidth); /* ulLeftWidth (2 bytes) */ - stream_read_uint16(s, nineGridInfo->ulRightWidth); /* ulRightWidth (2 bytes) */ - stream_read_uint16(s, nineGridInfo->ulTopHeight); /* ulTopHeight (2 bytes) */ - stream_read_uint16(s, nineGridInfo->ulBottomHeight); /* ulBottomHeight (2 bytes) */ + stream_read_UINT32(s, nineGridInfo->flFlags); /* flFlags (4 bytes) */ + stream_read_UINT16(s, nineGridInfo->ulLeftWidth); /* ulLeftWidth (2 bytes) */ + stream_read_UINT16(s, nineGridInfo->ulRightWidth); /* ulRightWidth (2 bytes) */ + stream_read_UINT16(s, nineGridInfo->ulTopHeight); /* ulTopHeight (2 bytes) */ + stream_read_UINT16(s, nineGridInfo->ulBottomHeight); /* ulBottomHeight (2 bytes) */ update_read_colorref(s, &nineGridInfo->crTransparent); /* crTransparent (4 bytes) */ } void update_read_frame_marker_order(STREAM* s, FRAME_MARKER_ORDER* frame_marker) { - stream_read_uint32(s, frame_marker->action); /* action (4 bytes) */ + stream_read_UINT32(s, frame_marker->action); /* action (4 bytes) */ } void update_read_stream_bitmap_first_order(STREAM* s, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first) { - stream_read_uint8(s, stream_bitmap_first->bitmapFlags); /* bitmapFlags (1 byte) */ - stream_read_uint8(s, stream_bitmap_first->bitmapBpp); /* bitmapBpp (1 byte) */ - stream_read_uint16(s, stream_bitmap_first->bitmapType); /* bitmapType (2 bytes) */ - stream_read_uint16(s, stream_bitmap_first->bitmapWidth); /* bitmapWidth (2 bytes) */ - stream_read_uint16(s, stream_bitmap_first->bitmapHeight); /* bitmapHeigth (2 bytes) */ + stream_read_BYTE(s, stream_bitmap_first->bitmapFlags); /* bitmapFlags (1 byte) */ + stream_read_BYTE(s, stream_bitmap_first->bitmapBpp); /* bitmapBpp (1 byte) */ + stream_read_UINT16(s, stream_bitmap_first->bitmapType); /* bitmapType (2 bytes) */ + stream_read_UINT16(s, stream_bitmap_first->bitmapWidth); /* bitmapWidth (2 bytes) */ + stream_read_UINT16(s, stream_bitmap_first->bitmapHeight); /* bitmapHeigth (2 bytes) */ if (stream_bitmap_first->bitmapFlags & STREAM_BITMAP_V2) - stream_read_uint32(s, stream_bitmap_first->bitmapSize); /* bitmapSize (4 bytes) */ + stream_read_UINT32(s, stream_bitmap_first->bitmapSize); /* bitmapSize (4 bytes) */ else - stream_read_uint16(s, stream_bitmap_first->bitmapSize); /* bitmapSize (2 bytes) */ + stream_read_UINT16(s, stream_bitmap_first->bitmapSize); /* bitmapSize (2 bytes) */ - stream_read_uint16(s, stream_bitmap_first->bitmapBlockSize); /* bitmapBlockSize (2 bytes) */ + stream_read_UINT16(s, stream_bitmap_first->bitmapBlockSize); /* bitmapBlockSize (2 bytes) */ stream_seek(s, stream_bitmap_first->bitmapBlockSize); /* bitmapBlock */ } void update_read_stream_bitmap_next_order(STREAM* s, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_next) { - stream_read_uint8(s, stream_bitmap_next->bitmapFlags); /* bitmapFlags (1 byte) */ - stream_read_uint16(s, stream_bitmap_next->bitmapType); /* bitmapType (2 bytes) */ - stream_read_uint16(s, stream_bitmap_next->bitmapBlockSize); /* bitmapBlockSize (2 bytes) */ + stream_read_BYTE(s, stream_bitmap_next->bitmapFlags); /* bitmapFlags (1 byte) */ + stream_read_UINT16(s, stream_bitmap_next->bitmapType); /* bitmapType (2 bytes) */ + stream_read_UINT16(s, stream_bitmap_next->bitmapBlockSize); /* bitmapBlockSize (2 bytes) */ stream_seek(s, stream_bitmap_next->bitmapBlockSize); /* bitmapBlock */ } void update_read_draw_gdiplus_first_order(STREAM* s, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first) { - stream_seek_uint8(s); /* pad1Octet (1 byte) */ - stream_read_uint16(s, draw_gdiplus_first->cbSize); /* cbSize (2 bytes) */ - stream_read_uint32(s, draw_gdiplus_first->cbTotalSize); /* cbTotalSize (4 bytes) */ - stream_read_uint32(s, draw_gdiplus_first->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */ + stream_seek_BYTE(s); /* pad1Octet (1 byte) */ + stream_read_UINT16(s, draw_gdiplus_first->cbSize); /* cbSize (2 bytes) */ + stream_read_UINT32(s, draw_gdiplus_first->cbTotalSize); /* cbTotalSize (4 bytes) */ + stream_read_UINT32(s, draw_gdiplus_first->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */ stream_seek(s, draw_gdiplus_first->cbSize); /* emfRecords */ } void update_read_draw_gdiplus_next_order(STREAM* s, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next) { - stream_seek_uint8(s); /* pad1Octet (1 byte) */ - stream_read_uint16(s, draw_gdiplus_next->cbSize); /* cbSize (2 bytes) */ + stream_seek_BYTE(s); /* pad1Octet (1 byte) */ + stream_read_UINT16(s, draw_gdiplus_next->cbSize); /* cbSize (2 bytes) */ stream_seek(s, draw_gdiplus_next->cbSize); /* emfRecords */ } void update_read_draw_gdiplus_end_order(STREAM* s, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end) { - stream_seek_uint8(s); /* pad1Octet (1 byte) */ - stream_read_uint16(s, draw_gdiplus_end->cbSize); /* cbSize (2 bytes) */ - stream_read_uint32(s, draw_gdiplus_end->cbTotalSize); /* cbTotalSize (4 bytes) */ - stream_read_uint32(s, draw_gdiplus_end->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */ + stream_seek_BYTE(s); /* pad1Octet (1 byte) */ + stream_read_UINT16(s, draw_gdiplus_end->cbSize); /* cbSize (2 bytes) */ + stream_read_UINT32(s, draw_gdiplus_end->cbTotalSize); /* cbTotalSize (4 bytes) */ + stream_read_UINT32(s, draw_gdiplus_end->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */ stream_seek(s, draw_gdiplus_end->cbSize); /* emfRecords */ } void update_read_draw_gdiplus_cache_first_order(STREAM* s, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first) { - stream_read_uint8(s, draw_gdiplus_cache_first->flags); /* flags (1 byte) */ - stream_read_uint16(s, draw_gdiplus_cache_first->cacheType); /* cacheType (2 bytes) */ - stream_read_uint16(s, draw_gdiplus_cache_first->cacheIndex); /* cacheIndex (2 bytes) */ - stream_read_uint16(s, draw_gdiplus_cache_first->cbSize); /* cbSize (2 bytes) */ - stream_read_uint32(s, draw_gdiplus_cache_first->cbTotalSize); /* cbTotalSize (4 bytes) */ + stream_read_BYTE(s, draw_gdiplus_cache_first->flags); /* flags (1 byte) */ + stream_read_UINT16(s, draw_gdiplus_cache_first->cacheType); /* cacheType (2 bytes) */ + stream_read_UINT16(s, draw_gdiplus_cache_first->cacheIndex); /* cacheIndex (2 bytes) */ + stream_read_UINT16(s, draw_gdiplus_cache_first->cbSize); /* cbSize (2 bytes) */ + stream_read_UINT32(s, draw_gdiplus_cache_first->cbTotalSize); /* cbTotalSize (4 bytes) */ stream_seek(s, draw_gdiplus_cache_first->cbSize); /* emfRecords */ } void update_read_draw_gdiplus_cache_next_order(STREAM* s, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next) { - stream_read_uint8(s, draw_gdiplus_cache_next->flags); /* flags (1 byte) */ - stream_read_uint16(s, draw_gdiplus_cache_next->cacheType); /* cacheType (2 bytes) */ - stream_read_uint16(s, draw_gdiplus_cache_next->cacheIndex); /* cacheIndex (2 bytes) */ - stream_read_uint16(s, draw_gdiplus_cache_next->cbSize); /* cbSize (2 bytes) */ + stream_read_BYTE(s, draw_gdiplus_cache_next->flags); /* flags (1 byte) */ + stream_read_UINT16(s, draw_gdiplus_cache_next->cacheType); /* cacheType (2 bytes) */ + stream_read_UINT16(s, draw_gdiplus_cache_next->cacheIndex); /* cacheIndex (2 bytes) */ + stream_read_UINT16(s, draw_gdiplus_cache_next->cbSize); /* cbSize (2 bytes) */ stream_seek(s, draw_gdiplus_cache_next->cbSize); /* emfRecords */ } void update_read_draw_gdiplus_cache_end_order(STREAM* s, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end) { - stream_read_uint8(s, draw_gdiplus_cache_end->flags); /* flags (1 byte) */ - stream_read_uint16(s, draw_gdiplus_cache_end->cacheType); /* cacheType (2 bytes) */ - stream_read_uint16(s, draw_gdiplus_cache_end->cacheIndex); /* cacheIndex (2 bytes) */ - stream_read_uint16(s, draw_gdiplus_cache_end->cbSize); /* cbSize (2 bytes) */ - stream_read_uint32(s, draw_gdiplus_cache_end->cbTotalSize); /* cbTotalSize (4 bytes) */ + stream_read_BYTE(s, draw_gdiplus_cache_end->flags); /* flags (1 byte) */ + stream_read_UINT16(s, draw_gdiplus_cache_end->cacheType); /* cacheType (2 bytes) */ + stream_read_UINT16(s, draw_gdiplus_cache_end->cacheIndex); /* cacheIndex (2 bytes) */ + stream_read_UINT16(s, draw_gdiplus_cache_end->cbSize); /* cbSize (2 bytes) */ + stream_read_UINT32(s, draw_gdiplus_cache_end->cbTotalSize); /* cbTotalSize (4 bytes) */ stream_seek(s, draw_gdiplus_cache_end->cbSize); /* emfRecords */ } -void update_read_field_flags(STREAM* s, uint32* fieldFlags, uint8 flags, uint8 fieldBytes) +void update_read_field_flags(STREAM* s, UINT32* fieldFlags, BYTE flags, BYTE fieldBytes) { int i; - uint8 byte; + BYTE byte; if (flags & ORDER_ZERO_FIELD_BYTE_BIT0) fieldBytes--; @@ -1670,39 +1670,39 @@ void update_read_field_flags(STREAM* s, uint32* fieldFlags, uint8 flags, uint8 f *fieldFlags = 0; for (i = 0; i < fieldBytes; i++) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *fieldFlags |= byte << (i * 8); } } void update_read_bounds(STREAM* s, rdpBounds* bounds) { - uint8 flags; + BYTE flags; - stream_read_uint8(s, flags); /* field flags */ + stream_read_BYTE(s, flags); /* field flags */ if (flags & BOUND_LEFT) - update_read_coord(s, &bounds->left, false); + update_read_coord(s, &bounds->left, FALSE); else if (flags & BOUND_DELTA_LEFT) - update_read_coord(s, &bounds->left, true); + update_read_coord(s, &bounds->left, TRUE); if (flags & BOUND_TOP) - update_read_coord(s, &bounds->top, false); + update_read_coord(s, &bounds->top, FALSE); else if (flags & BOUND_DELTA_TOP) - update_read_coord(s, &bounds->top, true); + update_read_coord(s, &bounds->top, TRUE); if (flags & BOUND_RIGHT) - update_read_coord(s, &bounds->right, false); + update_read_coord(s, &bounds->right, FALSE); else if (flags & BOUND_DELTA_RIGHT) - update_read_coord(s, &bounds->right, true); + update_read_coord(s, &bounds->right, TRUE); if (flags & BOUND_BOTTOM) - update_read_coord(s, &bounds->bottom, false); + update_read_coord(s, &bounds->bottom, FALSE); else if (flags & BOUND_DELTA_BOTTOM) - update_read_coord(s, &bounds->bottom, true); + update_read_coord(s, &bounds->bottom, TRUE); } -boolean update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) +BOOL update_recv_primary_order(rdpUpdate* update, STREAM* s, BYTE flags) { ORDER_INFO* orderInfo; rdpContext* context = update->context; @@ -1711,12 +1711,12 @@ boolean update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) orderInfo = &(primary->order_info); if (flags & ORDER_TYPE_CHANGE) - stream_read_uint8(s, orderInfo->orderType); /* orderType (1 byte) */ + stream_read_BYTE(s, orderInfo->orderType); /* orderType (1 byte) */ if (orderInfo->orderType >= PRIMARY_DRAWING_ORDER_COUNT) { printf("Invalid Primary Drawing Order (0x%02X)\n", orderInfo->orderType); - return false; + return FALSE; } update_read_field_flags(s, &(orderInfo->fieldFlags), flags, @@ -1730,7 +1730,7 @@ boolean update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) IFCALL(update->SetBounds, context, &orderInfo->bounds); } - orderInfo->deltaCoordinates = (flags & ORDER_DELTA_COORDINATES) ? true : false; + orderInfo->deltaCoordinates = (flags & ORDER_DELTA_COORDINATES) ? TRUE : FALSE; #ifdef WITH_DEBUG_ORDERS printf("%s Primary Drawing Order (0x%02X)\n", PRIMARY_DRAWING_ORDER_STRINGS[orderInfo->orderType], orderInfo->orderType); @@ -1857,23 +1857,23 @@ boolean update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) IFCALL(update->SetBounds, context, NULL); } - return true; + return TRUE; } -void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags) +void update_recv_secondary_order(rdpUpdate* update, STREAM* s, BYTE flags) { - uint8* next; - uint8 orderType; - uint16 extraFlags; - uint16 orderLength; + BYTE* next; + BYTE orderType; + UINT16 extraFlags; + UINT16 orderLength; rdpContext* context = update->context; rdpSecondaryUpdate* secondary = update->secondary; - stream_read_uint16(s, orderLength); /* orderLength (2 bytes) */ - stream_read_uint16(s, extraFlags); /* extraFlags (2 bytes) */ - stream_read_uint8(s, orderType); /* orderType (1 byte) */ + stream_read_UINT16(s, orderLength); /* orderLength (2 bytes) */ + stream_read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */ + stream_read_BYTE(s, orderType); /* orderType (1 byte) */ - next = s->p + ((sint16) orderLength) + 7; + next = s->p + ((INT16) orderLength) + 7; #ifdef WITH_DEBUG_ORDERS if (orderType < SECONDARY_DRAWING_ORDER_COUNT) @@ -1885,27 +1885,27 @@ void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags) switch (orderType) { case ORDER_TYPE_BITMAP_UNCOMPRESSED: - update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), false, extraFlags); + update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), FALSE, extraFlags); IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order)); break; case ORDER_TYPE_CACHE_BITMAP_COMPRESSED: - update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), true, extraFlags); + update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), TRUE, extraFlags); IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order)); break; case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2: - update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), false, extraFlags); + update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), FALSE, extraFlags); IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order)); break; case ORDER_TYPE_BITMAP_COMPRESSED_V2: - update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), true, extraFlags); + update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), TRUE, extraFlags); IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order)); break; case ORDER_TYPE_BITMAP_COMPRESSED_V3: - update_read_cache_bitmap_v3_order(s, &(secondary->cache_bitmap_v3_order), true, extraFlags); + update_read_cache_bitmap_v3_order(s, &(secondary->cache_bitmap_v3_order), TRUE, extraFlags); IFCALL(secondary->CacheBitmapV3, context, &(secondary->cache_bitmap_v3_order)); break; @@ -1939,9 +1939,9 @@ void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags) s->p = next; } -void update_recv_altsec_order(rdpUpdate* update, STREAM* s, uint8 flags) +void update_recv_altsec_order(rdpUpdate* update, STREAM* s, BYTE flags) { - uint8 orderType; + BYTE orderType; rdpContext* context = update->context; rdpAltSecUpdate* altsec = update->altsec; @@ -2028,11 +2028,11 @@ void update_recv_altsec_order(rdpUpdate* update, STREAM* s, uint8 flags) } } -boolean update_recv_order(rdpUpdate* update, STREAM* s) +BOOL update_recv_order(rdpUpdate* update, STREAM* s) { - uint8 controlFlags; + BYTE controlFlags; - stream_read_uint8(s, controlFlags); /* controlFlags (1 byte) */ + stream_read_BYTE(s, controlFlags); /* controlFlags (1 byte) */ if (!(controlFlags & ORDER_STANDARD)) update_recv_altsec_order(update, s, controlFlags); @@ -2041,8 +2041,8 @@ boolean update_recv_order(rdpUpdate* update, STREAM* s) else { if (!update_recv_primary_order(update, s, controlFlags)) - return false; + return FALSE; } - return true; + return TRUE; } diff --git a/libfreerdp/core/orders.h b/libfreerdp/core/orders.h index 6c182e25a..b75bb1d9a 100644 --- a/libfreerdp/core/orders.h +++ b/libfreerdp/core/orders.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Drawing Orders * * Copyright 2011 Marc-Andre Moreau @@ -184,7 +184,7 @@ #define CG_GLYPH_UNICODE_PRESENT 0x0010 -boolean update_recv_order(rdpUpdate* update, STREAM* s); +BOOL update_recv_order(rdpUpdate* update, STREAM* s); void update_read_dstblt_order(STREAM* s, ORDER_INFO* orderInfo, DSTBLT_ORDER* dstblt); void update_read_patblt_order(STREAM* s, ORDER_INFO* orderInfo, PATBLT_ORDER* patblt); @@ -209,13 +209,13 @@ void update_read_polygon_cb_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_CB_O void update_read_ellipse_sc_order(STREAM* s, ORDER_INFO* orderInfo, ELLIPSE_SC_ORDER* ellipse_sc); void update_read_ellipse_cb_order(STREAM* s, ORDER_INFO* orderInfo, ELLIPSE_CB_ORDER* ellipse_cb); -void update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_order, boolean compressed, uint16 flags); -void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order, boolean compressed, uint16 flags); -void update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order, boolean compressed, uint16 flags); -void update_read_cache_color_table_order(STREAM* s, CACHE_COLOR_TABLE_ORDER* cache_color_table_order, uint16 flags); -void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_order, uint16 flags); -void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order, uint16 flags); -void update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_order, uint16 flags); +void update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_order, BOOL compressed, UINT16 flags); +void update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order, BOOL compressed, UINT16 flags); +void update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order, BOOL compressed, UINT16 flags); +void update_read_cache_color_table_order(STREAM* s, CACHE_COLOR_TABLE_ORDER* cache_color_table_order, UINT16 flags); +void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_order, UINT16 flags); +void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order, UINT16 flags); +void update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_order, UINT16 flags); void update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap); void update_read_switch_surface_order(STREAM* s, SWITCH_SURFACE_ORDER* switch_surface); diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index 66b70939c..482983a9d 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Peer * * Copyright 2011 Vic Lee @@ -26,9 +26,9 @@ #include "peer.h" -static boolean freerdp_peer_initialize(freerdp_peer* client) +static BOOL freerdp_peer_initialize(freerdp_peer* client) { - client->context->rdp->settings->server_mode = true; + client->context->rdp->settings->server_mode = TRUE; client->context->rdp->settings->frame_acknowledge = 0; client->context->rdp->settings->local = client->local; client->context->rdp->state = CONNECTION_STATE_INITIAL; @@ -39,18 +39,18 @@ static boolean freerdp_peer_initialize(freerdp_peer* client) key_new(client->context->rdp->settings->rdp_key_file); } - return true; + return TRUE; } -static boolean freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount) +static BOOL freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount) { rfds[*rcount] = (void*)(long)(client->context->rdp->transport->tcp->sockfd); (*rcount)++; - return true; + return TRUE; } -static boolean freerdp_peer_check_fds(freerdp_peer* client) +static BOOL freerdp_peer_check_fds(freerdp_peer* client) { int status; rdpRdp* rdp; @@ -60,37 +60,37 @@ static boolean freerdp_peer_check_fds(freerdp_peer* client) status = rdp_check_fds(rdp); if (status < 0) - return false; + return FALSE; - return true; + return TRUE; } -static boolean peer_recv_data_pdu(freerdp_peer* client, STREAM* s) +static BOOL peer_recv_data_pdu(freerdp_peer* client, STREAM* s) { - uint8 type; - uint16 length; - uint32 share_id; - uint8 compressed_type; - uint16 compressed_len; + BYTE type; + UINT16 length; + UINT32 share_id; + BYTE compressed_type; + UINT16 compressed_len; if (!rdp_read_share_data_header(s, &length, &type, &share_id, &compressed_type, &compressed_len)) - return false; + return FALSE; switch (type) { case DATA_PDU_TYPE_SYNCHRONIZE: if (!rdp_recv_client_synchronize_pdu(client->context->rdp, s)) - return false; + return FALSE; break; case DATA_PDU_TYPE_CONTROL: if (!rdp_server_accept_client_control_pdu(client->context->rdp, s)) - return false; + return FALSE; break; case DATA_PDU_TYPE_INPUT: if (!input_recv(client->context->rdp->input, s)) - return false; + return FALSE; break; case DATA_PDU_TYPE_BITMAP_CACHE_PERSISTENT_LIST: @@ -100,7 +100,7 @@ static boolean peer_recv_data_pdu(freerdp_peer* client, STREAM* s) case DATA_PDU_TYPE_FONT_LIST: if (!rdp_server_accept_client_font_list_pdu(client->context->rdp, s)) - return false; + return FALSE; if (!client->connected) { @@ -112,7 +112,7 @@ static boolean peer_recv_data_pdu(freerdp_peer* client, STREAM* s) IFCALLRET(client->PostConnect, client->connected, client); if (!client->connected) - return false; + return FALSE; } if (!client->activated) @@ -122,27 +122,27 @@ static boolean peer_recv_data_pdu(freerdp_peer* client, STREAM* s) IFCALLRET(client->Activate, client->activated, client); if (!client->activated) - return false; + return FALSE; } break; case DATA_PDU_TYPE_SHUTDOWN_REQUEST: mcs_send_disconnect_provider_ultimatum(client->context->rdp->mcs); - return false; + return FALSE; case DATA_PDU_TYPE_FRAME_ACKNOWLEDGE: - stream_read_uint32(s, client->ack_frame_id); + stream_read_UINT32(s, client->ack_frame_id); break; case DATA_PDU_TYPE_REFRESH_RECT: if (!update_read_refresh_rect(client->update, s)) - return false; + return FALSE; break; case DATA_PDU_TYPE_SUPPRESS_OUTPUT: if (!update_read_suppress_output(client->update, s)) - return false; + return FALSE; break; default: @@ -150,25 +150,25 @@ static boolean peer_recv_data_pdu(freerdp_peer* client, STREAM* s) break; } - return true; + return TRUE; } -static boolean peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s) +static BOOL peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s) { rdpRdp* rdp; - uint16 length; - uint16 pduType; - uint16 pduLength; - uint16 pduSource; - uint16 channelId; - uint16 securityFlags; + UINT16 length; + UINT16 pduType; + UINT16 pduLength; + UINT16 pduSource; + UINT16 channelId; + UINT16 securityFlags; rdp = client->context->rdp; if (!rdp_read_header(rdp, s, &length, &channelId)) { printf("Incorrect RDP header.\n"); - return false; + return FALSE; } if (rdp->settings->encryption) @@ -180,7 +180,7 @@ static boolean peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s) if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { printf("rdp_decrypt failed\n"); - return false; + return FALSE; } } } @@ -192,7 +192,7 @@ static boolean peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s) else { if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) - return false; + return FALSE; client->settings->pdu_source = pduSource; @@ -200,22 +200,22 @@ static boolean peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s) { case PDU_TYPE_DATA: if (!peer_recv_data_pdu(client, s)) - return false; + return FALSE; break; default: printf("Client sent pduType %d\n", pduType); - return false; + return FALSE; } } - return true; + return TRUE; } -static boolean peer_recv_fastpath_pdu(freerdp_peer* client, STREAM* s) +static BOOL peer_recv_fastpath_pdu(freerdp_peer* client, STREAM* s) { rdpRdp* rdp; - uint16 length; + UINT16 length; rdpFastPath* fastpath; rdp = client->context->rdp; @@ -225,7 +225,7 @@ static boolean peer_recv_fastpath_pdu(freerdp_peer* client, STREAM* s) if (length == 0 || length > stream_get_left(s)) { printf("incorrect FastPath PDU header length %d\n", length); - return false; + return FALSE; } if (fastpath->encryptionFlags & FASTPATH_OUTPUT_ENCRYPTED) @@ -236,7 +236,7 @@ static boolean peer_recv_fastpath_pdu(freerdp_peer* client, STREAM* s) return fastpath_recv_inputs(fastpath, s); } -static boolean peer_recv_pdu(freerdp_peer* client, STREAM* s) +static BOOL peer_recv_pdu(freerdp_peer* client, STREAM* s) { if (tpkt_verify_header(s)) return peer_recv_tpkt_pdu(client, s); @@ -244,7 +244,7 @@ static boolean peer_recv_pdu(freerdp_peer* client, STREAM* s) return peer_recv_fastpath_pdu(client, s); } -static boolean peer_recv_callback(rdpTransport* transport, STREAM* s, void* extra) +static BOOL peer_recv_callback(rdpTransport* transport, STREAM* s, void* extra) { freerdp_peer* client = (freerdp_peer*) extra; rdpRdp* rdp = client->context->rdp; @@ -253,46 +253,46 @@ static boolean peer_recv_callback(rdpTransport* transport, STREAM* s, void* extr { case CONNECTION_STATE_INITIAL: if (!rdp_server_accept_nego(rdp, s)) - return false; + return FALSE; if (rdp->nego->selected_protocol & PROTOCOL_NLA) { sspi_CopyAuthIdentity(&client->identity, &(rdp->nego->transport->credssp->identity)); - IFCALLRET(client->Logon, client->authenticated, client, &client->identity, true); + IFCALLRET(client->Logon, client->authenticated, client, &client->identity, TRUE); credssp_free(rdp->nego->transport->credssp); } else { - IFCALLRET(client->Logon, client->authenticated, client, &client->identity, false); + IFCALLRET(client->Logon, client->authenticated, client, &client->identity, FALSE); } break; case CONNECTION_STATE_NEGO: if (!rdp_server_accept_mcs_connect_initial(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_MCS_CONNECT: if (!rdp_server_accept_mcs_erect_domain_request(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_MCS_ERECT_DOMAIN: if (!rdp_server_accept_mcs_attach_user_request(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_MCS_ATTACH_USER: if (!rdp_server_accept_mcs_channel_join_request(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_MCS_CHANNEL_JOIN: if (rdp->settings->encryption) { if (!rdp_server_accept_client_keys(rdp, s)) - return false; + return FALSE; break; } rdp->state = CONNECTION_STATE_ESTABLISH_KEYS; @@ -300,12 +300,12 @@ static boolean peer_recv_callback(rdpTransport* transport, STREAM* s, void* extr case CONNECTION_STATE_ESTABLISH_KEYS: if (!rdp_server_accept_client_info(rdp, s)) - return false; + return FALSE; IFCALL(client->Capabilities, client); if (!rdp_send_demand_active(rdp)) - return false; + return FALSE; break; case CONNECTION_STATE_LICENSE: @@ -322,18 +322,18 @@ static boolean peer_recv_callback(rdpTransport* transport, STREAM* s, void* extr case CONNECTION_STATE_ACTIVE: if (!peer_recv_pdu(client, s)) - return false; + return FALSE; break; default: printf("Invalid state %d\n", rdp->state); - return false; + return FALSE; } - return true; + return TRUE; } -static boolean freerdp_peer_close(freerdp_peer* client) +static BOOL freerdp_peer_close(freerdp_peer* client) { /** * [MS-RDPBCGR] 1.3.1.4.2 User-Initiated Disconnection Sequence on Server @@ -341,7 +341,7 @@ static boolean freerdp_peer_close(freerdp_peer* client) * optional MCS Disconnect Provider Ultimatum PDU. */ if (!rdp_send_deactivate_all(client->context->rdp)) - return false; + return FALSE; return mcs_send_disconnect_provider_ultimatum(client->context->rdp->mcs); } @@ -350,7 +350,7 @@ static void freerdp_peer_disconnect(freerdp_peer* client) transport_disconnect(client->context->rdp->transport); } -static int freerdp_peer_send_channel_data(freerdp_peer* client, int channelId, uint8* data, int size) +static int freerdp_peer_send_channel_data(freerdp_peer* client, int channelId, BYTE* data, int size) { return rdp_send_channel_data(client->context->rdp, channelId, data, size); } @@ -377,7 +377,7 @@ void freerdp_peer_context_new(freerdp_peer* client) rdp->transport->recv_callback = peer_recv_callback; rdp->transport->recv_extra = client; - transport_set_blocking_mode(rdp->transport, false); + transport_set_blocking_mode(rdp->transport, FALSE); IFCALL(client->ContextNew, client, client->context); } @@ -393,7 +393,7 @@ freerdp_peer* freerdp_peer_new(int sockfd) client = xnew(freerdp_peer); - freerdp_tcp_set_no_delay(sockfd, true); + freerdp_tcp_set_no_delay(sockfd, TRUE); if (client != NULL) { @@ -415,7 +415,7 @@ void freerdp_peer_free(freerdp_peer* client) if (client) { rdp_free(client->context->rdp); - xfree(client->context); - xfree(client); + free(client->context); + free(client); } } diff --git a/libfreerdp/core/peer.h b/libfreerdp/core/peer.h index eb9ed63ec..cee607683 100644 --- a/libfreerdp/core/peer.h +++ b/libfreerdp/core/peer.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Peer * * Copyright 2011 Vic Lee diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index 3623c2b67..32f432f85 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Core * * Copyright 2011 Marc-Andre Moreau @@ -75,10 +75,10 @@ static const char* const DATA_PDU_TYPE_STRINGS[] = * @param flags security flags */ -void rdp_read_security_header(STREAM* s, uint16* flags) +void rdp_read_security_header(STREAM* s, UINT16* flags) { /* Basic Security Header */ - stream_read_uint16(s, *flags); /* flags */ + stream_read_UINT16(s, *flags); /* flags */ stream_seek(s, 2); /* flagsHi (unused) */ } @@ -89,73 +89,73 @@ void rdp_read_security_header(STREAM* s, uint16* flags) * @param flags security flags */ -void rdp_write_security_header(STREAM* s, uint16 flags) +void rdp_write_security_header(STREAM* s, UINT16 flags) { /* Basic Security Header */ - stream_write_uint16(s, flags); /* flags */ - stream_write_uint16(s, 0); /* flagsHi (unused) */ + stream_write_UINT16(s, flags); /* flags */ + stream_write_UINT16(s, 0); /* flagsHi (unused) */ } -boolean rdp_read_share_control_header(STREAM* s, uint16* length, uint16* type, uint16* channel_id) +BOOL rdp_read_share_control_header(STREAM* s, UINT16* length, UINT16* type, UINT16* channel_id) { /* Share Control Header */ - stream_read_uint16(s, *length); /* totalLength */ + stream_read_UINT16(s, *length); /* totalLength */ if (*length - 2 > stream_get_left(s)) - return false; + return FALSE; - stream_read_uint16(s, *type); /* pduType */ + stream_read_UINT16(s, *type); /* pduType */ *type &= 0x0F; /* type is in the 4 least significant bits */ if (*length > 4) - stream_read_uint16(s, *channel_id); /* pduSource */ + stream_read_UINT16(s, *channel_id); /* pduSource */ else /* Windows XP can send such short DEACTIVATE_ALL PDUs. */ *channel_id = 0; - return true; + return TRUE; } -void rdp_write_share_control_header(STREAM* s, uint16 length, uint16 type, uint16 channel_id) +void rdp_write_share_control_header(STREAM* s, UINT16 length, UINT16 type, UINT16 channel_id) { length -= RDP_PACKET_HEADER_MAX_LENGTH; /* Share Control Header */ - stream_write_uint16(s, length); /* totalLength */ - stream_write_uint16(s, type | 0x10); /* pduType */ - stream_write_uint16(s, channel_id); /* pduSource */ + stream_write_UINT16(s, length); /* totalLength */ + stream_write_UINT16(s, type | 0x10); /* pduType */ + stream_write_UINT16(s, channel_id); /* pduSource */ } -boolean rdp_read_share_data_header(STREAM* s, uint16* length, uint8* type, uint32* share_id, - uint8 *compressed_type, uint16 *compressed_len) +BOOL rdp_read_share_data_header(STREAM* s, UINT16* length, BYTE* type, UINT32* share_id, + BYTE *compressed_type, UINT16 *compressed_len) { if (stream_get_left(s) < 12) - return false; + return FALSE; /* Share Data Header */ - stream_read_uint32(s, *share_id); /* shareId (4 bytes) */ - stream_seek_uint8(s); /* pad1 (1 byte) */ - stream_seek_uint8(s); /* streamId (1 byte) */ - stream_read_uint16(s, *length); /* uncompressedLength (2 bytes) */ - stream_read_uint8(s, *type); /* pduType2, Data PDU Type (1 byte) */ - stream_read_uint8(s, *compressed_type); /* compressedType (1 byte) */ - stream_read_uint16(s, *compressed_len); /* compressedLength (2 bytes) */ - return true; + stream_read_UINT32(s, *share_id); /* shareId (4 bytes) */ + stream_seek_BYTE(s); /* pad1 (1 byte) */ + stream_seek_BYTE(s); /* streamId (1 byte) */ + stream_read_UINT16(s, *length); /* uncompressedLength (2 bytes) */ + stream_read_BYTE(s, *type); /* pduType2, Data PDU Type (1 byte) */ + stream_read_BYTE(s, *compressed_type); /* compressedType (1 byte) */ + stream_read_UINT16(s, *compressed_len); /* compressedLength (2 bytes) */ + return TRUE; } -void rdp_write_share_data_header(STREAM* s, uint16 length, uint8 type, uint32 share_id) +void rdp_write_share_data_header(STREAM* s, UINT16 length, BYTE type, UINT32 share_id) { length -= RDP_PACKET_HEADER_MAX_LENGTH; length -= RDP_SHARE_CONTROL_HEADER_LENGTH; length -= RDP_SHARE_DATA_HEADER_LENGTH; /* Share Data Header */ - stream_write_uint32(s, share_id); /* shareId (4 bytes) */ - stream_write_uint8(s, 0); /* pad1 (1 byte) */ - stream_write_uint8(s, STREAM_LOW); /* streamId (1 byte) */ - stream_write_uint16(s, length); /* uncompressedLength (2 bytes) */ - stream_write_uint8(s, type); /* pduType2, Data PDU Type (1 byte) */ - stream_write_uint8(s, 0); /* compressedType (1 byte) */ - stream_write_uint16(s, 0); /* compressedLength (2 bytes) */ + stream_write_UINT32(s, share_id); /* shareId (4 bytes) */ + stream_write_BYTE(s, 0); /* pad1 (1 byte) */ + stream_write_BYTE(s, STREAM_LOW); /* streamId (1 byte) */ + stream_write_UINT16(s, length); /* uncompressedLength (2 bytes) */ + stream_write_BYTE(s, type); /* pduType2, Data PDU Type (1 byte) */ + stream_write_BYTE(s, 0); /* compressedType (1 byte) */ + stream_write_UINT16(s, 0); /* compressedLength (2 bytes) */ } static int rdp_security_stream_init(rdpRdp* rdp, STREAM* s) @@ -222,9 +222,9 @@ STREAM* rdp_data_pdu_init(rdpRdp* rdp) * @param channel_id channel id */ -boolean rdp_read_header(rdpRdp* rdp, STREAM* s, uint16* length, uint16* channel_id) +BOOL rdp_read_header(rdpRdp* rdp, STREAM* s, UINT16* length, UINT16* channel_id) { - uint16 initiator; + UINT16 initiator; enum DomainMCSPDU MCSPDU; MCSPDU = (rdp->settings->server_mode) ? DomainMCSPDU_SendDataRequest : DomainMCSPDU_SendDataIndication; @@ -232,22 +232,22 @@ boolean rdp_read_header(rdpRdp* rdp, STREAM* s, uint16* length, uint16* channel_ if (!mcs_read_domain_mcspdu_header(s, &MCSPDU, length)) { if (MCSPDU != DomainMCSPDU_DisconnectProviderUltimatum) - return false; + return FALSE; } if (*length - 8 > stream_get_left(s)) - return false; + return FALSE; if (MCSPDU == DomainMCSPDU_DisconnectProviderUltimatum) { - uint8 reason; + BYTE reason; (void) per_read_enumerated(s, &reason, 0); DEBUG_RDP("DisconnectProviderUltimatum from server, reason code 0x%02x\n", reason); - rdp->disconnect = true; + rdp->disconnect = TRUE; - return true; + return TRUE; } per_read_integer16(s, &initiator, MCS_BASE_CHANNEL_ID); /* initiator (UserId) */ @@ -256,9 +256,9 @@ boolean rdp_read_header(rdpRdp* rdp, STREAM* s, uint16* length, uint16* channel_ per_read_length(s, length); /* userData (OCTET_STRING) */ if (*length > stream_get_left(s)) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -269,7 +269,7 @@ boolean rdp_read_header(rdpRdp* rdp, STREAM* s, uint16* length, uint16* channel_ * @param channel_id channel id */ -void rdp_write_header(rdpRdp* rdp, STREAM* s, uint16 length, uint16 channel_id) +void rdp_write_header(rdpRdp* rdp, STREAM* s, UINT16 length, UINT16 channel_id) { int body_length; enum DomainMCSPDU MCSPDU; @@ -289,7 +289,7 @@ void rdp_write_header(rdpRdp* rdp, STREAM* s, uint16 length, uint16 channel_id) mcs_write_domain_mcspdu_header(s, MCSPDU, length, 0); per_write_integer16(s, rdp->mcs->user_id, MCS_BASE_CHANNEL_ID); /* initiator */ per_write_integer16(s, channel_id, 0); /* channelId */ - stream_write_uint8(s, 0x70); /* dataPriority + segmentation */ + stream_write_BYTE(s, 0x70); /* dataPriority + segmentation */ /* * We always encode length in two bytes, eventhough we could use * only one byte if length <= 0x7F. It is just easier that way, @@ -297,14 +297,14 @@ void rdp_write_header(rdpRdp* rdp, STREAM* s, uint16 length, uint16 channel_id) * the data first and then store the header. */ length = (length - RDP_PACKET_HEADER_MAX_LENGTH) | 0x8000; - stream_write_uint16_be(s, length); /* userData (OCTET_STRING) */ + stream_write_UINT16_be(s, length); /* userData (OCTET_STRING) */ } -static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length) +static UINT32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length) { - uint8* data; - uint32 sec_flags; - uint32 pad = 0; + BYTE* data; + UINT32 sec_flags; + UINT32 pad = 0; sec_flags = rdp->sec_flags; @@ -319,8 +319,8 @@ static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length) data = s->p + 12; length = length - (data - s->data); - stream_write_uint16(s, 0x10); /* length */ - stream_write_uint8(s, 0x1); /* TSFIPS_VERSION 1*/ + stream_write_UINT16(s, 0x10); /* length */ + stream_write_BYTE(s, 0x1); /* TSFIPS_VERSION 1*/ /* handle padding */ pad = 8 - (length % 8); @@ -330,7 +330,7 @@ static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length) if (pad) memset(data+length, 0, pad); - stream_write_uint8(s, pad); + stream_write_BYTE(s, pad); security_hmac_signature(data, length, s->p, rdp); stream_seek(s, 8); @@ -341,7 +341,7 @@ static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length) data = s->p + 8; length = length - (data - s->data); if (sec_flags & SEC_SECURE_CHECKSUM) - security_salted_mac_signature(rdp, data, length, true, s->p); + security_salted_mac_signature(rdp, data, length, TRUE, s->p); else security_mac_signature(rdp, data, length, s->p); stream_seek(s, 8); @@ -355,9 +355,9 @@ static uint32 rdp_security_stream_out(rdpRdp* rdp, STREAM* s, int length) return pad; } -static uint32 rdp_get_sec_bytes(rdpRdp* rdp) +static UINT32 rdp_get_sec_bytes(rdpRdp* rdp) { - uint32 sec_bytes; + UINT32 sec_bytes; if (rdp->sec_flags & SEC_ENCRYPT) { @@ -385,11 +385,11 @@ static uint32 rdp_get_sec_bytes(rdpRdp* rdp) * @param channel_id channel id */ -boolean rdp_send(rdpRdp* rdp, STREAM* s, uint16 channel_id) +BOOL rdp_send(rdpRdp* rdp, STREAM* s, UINT16 channel_id) { - uint16 length; - uint32 sec_bytes; - uint8* sec_hold; + UINT16 length; + UINT32 sec_bytes; + BYTE* sec_hold; length = stream_get_length(s); stream_set_pos(s, 0); @@ -405,16 +405,16 @@ boolean rdp_send(rdpRdp* rdp, STREAM* s, uint16 channel_id) stream_set_pos(s, length); if (transport_write(rdp->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } -boolean rdp_send_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id) +BOOL rdp_send_pdu(rdpRdp* rdp, STREAM* s, UINT16 type, UINT16 channel_id) { - uint16 length; - uint32 sec_bytes; - uint8* sec_hold; + UINT16 length; + UINT32 sec_bytes; + BYTE* sec_hold; length = stream_get_length(s); stream_set_pos(s, 0); @@ -432,16 +432,16 @@ boolean rdp_send_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id) stream_set_pos(s, length); if (transport_write(rdp->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } -boolean rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, uint8 type, uint16 channel_id) +BOOL rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, BYTE type, UINT16 channel_id) { - uint16 length; - uint32 sec_bytes; - uint8* sec_hold; + UINT16 length; + UINT32 sec_bytes; + BYTE* sec_hold; length = stream_get_length(s); stream_set_pos(s, 0); @@ -460,28 +460,28 @@ boolean rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, uint8 type, uint16 channel_id) stream_set_pos(s, length); if (transport_write(rdp->transport, s) < 0) - return false; + return FALSE; - return true; + return TRUE; } void rdp_recv_set_error_info_data_pdu(rdpRdp* rdp, STREAM* s) { - stream_read_uint32(s, rdp->errorInfo); /* errorInfo (4 bytes) */ + stream_read_UINT32(s, rdp->errorInfo); /* errorInfo (4 bytes) */ if (rdp->errorInfo != ERRINFO_SUCCESS) rdp_print_errinfo(rdp->errorInfo); } -boolean rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s) { - uint8 type; - uint16 length; - uint32 share_id; - uint8 compressed_type; - uint16 compressed_len; - uint32 roff; - uint32 rlen; + BYTE type; + UINT16 length; + UINT32 share_id; + BYTE compressed_type; + UINT16 compressed_len; + UINT32 roff; + UINT32 rlen; STREAM* comp_stream; rdp_read_share_data_header(s, &length, &type, &share_id, &compressed_type, &compressed_len); @@ -500,7 +500,7 @@ boolean rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s) else { printf("decompress_rdp() failed\n"); - return false; + return FALSE; } stream_seek(s, compressed_len - 18); } @@ -515,7 +515,7 @@ boolean rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s) { case DATA_PDU_TYPE_UPDATE: if (!update_recv(rdp->update, comp_stream)) - return false; + return FALSE; break; case DATA_PDU_TYPE_CONTROL: @@ -604,14 +604,14 @@ boolean rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s) stream_free(comp_stream); } - return true; + return TRUE; } -boolean rdp_recv_out_of_sequence_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_out_of_sequence_pdu(rdpRdp* rdp, STREAM* s) { - uint16 type; - uint16 length; - uint16 channelId; + UINT16 type; + UINT16 length; + UINT16 channelId; rdp_read_share_control_header(s, &length, &type, &channelId); @@ -622,11 +622,11 @@ boolean rdp_recv_out_of_sequence_pdu(rdpRdp* rdp, STREAM* s) else if (type == PDU_TYPE_SERVER_REDIRECTION) { rdp_recv_enhanced_security_redirection_packet(rdp, s); - return true; + return TRUE; } else { - return false; + return FALSE; } } @@ -637,19 +637,19 @@ boolean rdp_recv_out_of_sequence_pdu(rdpRdp* rdp, STREAM* s) * @param length int */ -boolean rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, uint16 securityFlags) +BOOL rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, UINT16 securityFlags) { - uint8 cmac[8], wmac[8]; + BYTE cmac[8], wmac[8]; if (rdp->settings->encryption_method == ENCRYPTION_METHOD_FIPS) { - uint16 len; - uint8 version, pad; - uint8 *sig; + UINT16 len; + BYTE version, pad; + BYTE *sig; - stream_read_uint16(s, len); /* 0x10 */ - stream_read_uint8(s, version); /* 0x1 */ - stream_read_uint8(s, pad); + stream_read_UINT16(s, len); /* 0x10 */ + stream_read_BYTE(s, version); /* 0x1 */ + stream_read_BYTE(s, pad); sig = s->p; stream_seek(s, 8); /* signature */ @@ -659,25 +659,25 @@ boolean rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, uint16 securityFlags) if (!security_fips_decrypt(s->p, length, rdp)) { printf("FATAL: cannot decrypt\n"); - return false; /* TODO */ + return FALSE; /* TODO */ } if (!security_fips_check_signature(s->p, length - pad, sig, rdp)) { printf("FATAL: invalid packet signature\n"); - return false; /* TODO */ + return FALSE; /* TODO */ } /* is this what needs adjusting? */ s->size -= pad; - return true; + return TRUE; } stream_read(s, wmac, sizeof(wmac)); length -= sizeof(wmac); security_decrypt(s->p, length, rdp); if (securityFlags & SEC_SECURE_CHECKSUM) - security_salted_mac_signature(rdp, s->p, length, false, cmac); + security_salted_mac_signature(rdp, s->p, length, FALSE, cmac); else security_mac_signature(rdp, s->p, length, cmac); if (memcmp(wmac, cmac, sizeof(wmac)) != 0) @@ -690,9 +690,9 @@ boolean rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, uint16 securityFlags) * us to work with broken RDP clients and servers that * generate invalid signatures. */ - //return false; + //return FALSE; } - return true; + return TRUE; } /** @@ -701,20 +701,20 @@ boolean rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, uint16 securityFlags) * @param s stream */ -static boolean rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s) +static BOOL rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s) { - uint16 length; - uint16 pduType; - uint16 pduLength; - uint16 pduSource; - uint16 channelId; - uint16 securityFlags; - uint8* nextp; + UINT16 length; + UINT16 pduType; + UINT16 pduLength; + UINT16 pduSource; + UINT16 channelId; + UINT16 securityFlags; + BYTE* nextp; if (!rdp_read_header(rdp, s, &length, &channelId)) { printf("Incorrect RDP header.\n"); - return false; + return FALSE; } if (rdp->settings->encryption) @@ -725,7 +725,7 @@ static boolean rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s) if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { printf("rdp_decrypt failed\n"); - return false; + return FALSE; } } if (securityFlags & SEC_REDIRECTION_PKT) @@ -736,7 +736,7 @@ static boolean rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s) */ s->p -= 2; rdp_recv_enhanced_security_redirection_packet(rdp, s); - return true; + return TRUE; } } @@ -760,13 +760,13 @@ static boolean rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s) if (!rdp_recv_data_pdu(rdp, s)) { printf("rdp_recv_data_pdu failed\n"); - return false; + return FALSE; } break; case PDU_TYPE_DEACTIVATE_ALL: if (!rdp_recv_deactivate_all(rdp, s)) - return false; + return FALSE; break; case PDU_TYPE_SERVER_REDIRECTION: @@ -781,12 +781,12 @@ static boolean rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s) } } - return true; + return TRUE; } -static boolean rdp_recv_fastpath_pdu(rdpRdp* rdp, STREAM* s) +static BOOL rdp_recv_fastpath_pdu(rdpRdp* rdp, STREAM* s) { - uint16 length; + UINT16 length; rdpFastPath* fastpath; fastpath = rdp->fastpath; @@ -795,7 +795,7 @@ static boolean rdp_recv_fastpath_pdu(rdpRdp* rdp, STREAM* s) if (length == 0 || length > stream_get_left(s)) { printf("incorrect FastPath PDU header length %d\n", length); - return false; + return FALSE; } if (fastpath->encryptionFlags & FASTPATH_OUTPUT_ENCRYPTED) @@ -806,7 +806,7 @@ static boolean rdp_recv_fastpath_pdu(rdpRdp* rdp, STREAM* s) return fastpath_recv_updates(rdp->fastpath, s); } -static boolean rdp_recv_pdu(rdpRdp* rdp, STREAM* s) +static BOOL rdp_recv_pdu(rdpRdp* rdp, STREAM* s) { if (tpkt_verify_header(s)) return rdp_recv_tpkt_pdu(rdp, s); @@ -829,7 +829,7 @@ void rdp_recv(rdpRdp* rdp) rdp_recv_pdu(rdp, s); } -static boolean rdp_recv_callback(rdpTransport* transport, STREAM* s, void* extra) +static BOOL rdp_recv_callback(rdpTransport* transport, STREAM* s, void* extra) { rdpRdp* rdp = (rdpRdp*) extra; @@ -837,53 +837,53 @@ static boolean rdp_recv_callback(rdpTransport* transport, STREAM* s, void* extra { case CONNECTION_STATE_NEGO: if (!rdp_client_connect_mcs_connect_response(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_MCS_ATTACH_USER: if (!rdp_client_connect_mcs_attach_user_confirm(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_MCS_CHANNEL_JOIN: if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_LICENSE: if (!rdp_client_connect_license(rdp, s)) - return false; + return FALSE; break; case CONNECTION_STATE_CAPABILITY: if (!rdp_client_connect_demand_active(rdp, s)) { printf("rdp_client_connect_demand_active failed\n"); - return false; + return FALSE; } break; case CONNECTION_STATE_FINALIZATION: if (!rdp_recv_pdu(rdp, s)) - return false; + return FALSE; if (rdp->finalize_sc_pdus == FINALIZE_SC_COMPLETE) rdp->state = CONNECTION_STATE_ACTIVE; break; case CONNECTION_STATE_ACTIVE: if (!rdp_recv_pdu(rdp, s)) - return false; + return FALSE; break; default: printf("Invalid state %d\n", rdp->state); - return false; + return FALSE; } - return true; + return TRUE; } -int rdp_send_channel_data(rdpRdp* rdp, int channel_id, uint8* data, int size) +int rdp_send_channel_data(rdpRdp* rdp, int channel_id, BYTE* data, int size) { return freerdp_channel_send(rdp, channel_id, data, size); } @@ -893,7 +893,7 @@ int rdp_send_channel_data(rdpRdp* rdp, int channel_id, uint8* data, int size) * @param rdp RDP module * @param blocking blocking mode */ -void rdp_set_blocking_mode(rdpRdp* rdp, boolean blocking) +void rdp_set_blocking_mode(rdpRdp* rdp, BOOL blocking) { rdp->transport->recv_callback = rdp_recv_callback; rdp->transport->recv_extra = rdp; @@ -966,7 +966,7 @@ void rdp_free(rdpRdp* rdp) redirection_free(rdp->redirection); mppc_dec_free(rdp->mppc_dec); mppc_enc_free(rdp->mppc_enc); - xfree(rdp); + free(rdp); } } diff --git a/libfreerdp/core/rdp.h b/libfreerdp/core/rdp.h index b327f8bce..dc1a3a79d 100644 --- a/libfreerdp/core/rdp.h +++ b/libfreerdp/core/rdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Core * * Copyright 2011 Marc-Andre Moreau @@ -140,54 +140,54 @@ struct rdp_rdp struct crypto_des3_struct* fips_encrypt; struct crypto_des3_struct* fips_decrypt; struct crypto_hmac_struct* fips_hmac; - uint32 sec_flags; - boolean do_crypt; - boolean do_secure_checksum; - uint8 sign_key[16]; - uint8 decrypt_key[16]; - uint8 encrypt_key[16]; - uint8 decrypt_update_key[16]; - uint8 encrypt_update_key[16]; + UINT32 sec_flags; + BOOL do_crypt; + BOOL do_secure_checksum; + BYTE sign_key[16]; + BYTE decrypt_key[16]; + BYTE encrypt_key[16]; + BYTE decrypt_update_key[16]; + BYTE encrypt_update_key[16]; int rc4_key_len; - uint8 fips_sign_key[20]; - uint8 fips_encrypt_key[24]; - uint8 fips_decrypt_key[24]; - uint32 errorInfo; - uint32 finalize_sc_pdus; - boolean disconnect; + BYTE fips_sign_key[20]; + BYTE fips_encrypt_key[24]; + BYTE fips_decrypt_key[24]; + UINT32 errorInfo; + UINT32 finalize_sc_pdus; + BOOL disconnect; }; -void rdp_read_security_header(STREAM* s, uint16* flags); -void rdp_write_security_header(STREAM* s, uint16 flags); +void rdp_read_security_header(STREAM* s, UINT16* flags); +void rdp_write_security_header(STREAM* s, UINT16 flags); -boolean rdp_read_share_control_header(STREAM* s, uint16* length, uint16* type, uint16* channel_id); -void rdp_write_share_control_header(STREAM* s, uint16 length, uint16 type, uint16 channel_id); +BOOL rdp_read_share_control_header(STREAM* s, UINT16* length, UINT16* type, UINT16* channel_id); +void rdp_write_share_control_header(STREAM* s, UINT16 length, UINT16 type, UINT16 channel_id); -boolean rdp_read_share_data_header(STREAM* s, uint16* length, uint8* type, uint32* share_id, - uint8 *compressed_type, uint16 *compressed_len); +BOOL rdp_read_share_data_header(STREAM* s, UINT16* length, BYTE* type, UINT32* share_id, + BYTE *compressed_type, UINT16 *compressed_len); -void rdp_write_share_data_header(STREAM* s, uint16 length, uint8 type, uint32 share_id); +void rdp_write_share_data_header(STREAM* s, UINT16 length, BYTE type, UINT32 share_id); STREAM* rdp_send_stream_init(rdpRdp* rdp); -boolean rdp_read_header(rdpRdp* rdp, STREAM* s, uint16* length, uint16* channel_id); -void rdp_write_header(rdpRdp* rdp, STREAM* s, uint16 length, uint16 channel_id); +BOOL rdp_read_header(rdpRdp* rdp, STREAM* s, UINT16* length, UINT16* channel_id); +void rdp_write_header(rdpRdp* rdp, STREAM* s, UINT16 length, UINT16 channel_id); STREAM* rdp_pdu_init(rdpRdp* rdp); -boolean rdp_send_pdu(rdpRdp* rdp, STREAM* s, uint16 type, uint16 channel_id); +BOOL rdp_send_pdu(rdpRdp* rdp, STREAM* s, UINT16 type, UINT16 channel_id); STREAM* rdp_data_pdu_init(rdpRdp* rdp); -boolean rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, uint8 type, uint16 channel_id); -boolean rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_send_data_pdu(rdpRdp* rdp, STREAM* s, BYTE type, UINT16 channel_id); +BOOL rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s); -boolean rdp_send(rdpRdp* rdp, STREAM* s, uint16 channel_id); +BOOL rdp_send(rdpRdp* rdp, STREAM* s, UINT16 channel_id); void rdp_recv(rdpRdp* rdp); -int rdp_send_channel_data(rdpRdp* rdp, int channel_id, uint8* data, int size); +int rdp_send_channel_data(rdpRdp* rdp, int channel_id, BYTE* data, int size); -boolean rdp_recv_out_of_sequence_pdu(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_out_of_sequence_pdu(rdpRdp* rdp, STREAM* s); -void rdp_set_blocking_mode(rdpRdp* rdp, boolean blocking); +void rdp_set_blocking_mode(rdpRdp* rdp, BOOL blocking); int rdp_check_fds(rdpRdp* rdp); rdpRdp* rdp_new(freerdp* instance); @@ -199,6 +199,6 @@ void rdp_free(rdpRdp* rdp); #define DEBUG_RDP(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__) #endif -boolean rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, uint16 securityFlags); +BOOL rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, UINT16 securityFlags); #endif /* __RDP_H */ diff --git a/libfreerdp/core/redirection.c b/libfreerdp/core/redirection.c index 78ff55230..46f982a25 100644 --- a/libfreerdp/core/redirection.c +++ b/libfreerdp/core/redirection.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Redirection * * Copyright 2011 Marc-Andre Moreau @@ -25,7 +25,7 @@ #include "redirection.h" -void rdp_print_redirection_flags(uint32 flags) +void rdp_print_redirection_flags(UINT32 flags) { printf("redirectionFlags = {\n"); @@ -59,16 +59,16 @@ void rdp_print_redirection_flags(uint32 flags) printf("}\n"); } -boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) { - uint16 flags; - uint16 length; + UINT16 flags; + UINT16 length; rdpRedirection* redirection = rdp->redirection; - stream_read_uint16(s, flags); /* flags (2 bytes) */ - stream_read_uint16(s, length); /* length (2 bytes) */ - stream_read_uint32(s, redirection->sessionID); /* sessionID (4 bytes) */ - stream_read_uint32(s, redirection->flags); /* redirFlags (4 bytes) */ + stream_read_UINT16(s, flags); /* flags (2 bytes) */ + stream_read_UINT16(s, length); /* length (2 bytes) */ + stream_read_UINT32(s, redirection->sessionID); /* sessionID (4 bytes) */ + stream_read_UINT32(s, redirection->flags); /* redirFlags (4 bytes) */ DEBUG_REDIR("flags: 0x%04X, length:%d, sessionID:0x%08X", flags, length, redirection->sessionID); @@ -84,7 +84,7 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) if (redirection->flags & LB_LOAD_BALANCE_INFO) { - stream_read_uint32(s, redirection->LoadBalanceInfoLength); + stream_read_UINT32(s, redirection->LoadBalanceInfoLength); redirection->LoadBalanceInfo = (BYTE*) malloc(redirection->LoadBalanceInfoLength); stream_read(s, redirection->LoadBalanceInfo, redirection->LoadBalanceInfoLength); #ifdef WITH_DEBUG_REDIR @@ -108,7 +108,7 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) if (redirection->flags & LB_PASSWORD) { /* Note: length (hopefully) includes double zero termination */ - stream_read_uint32(s, redirection->PasswordCookieLength); + stream_read_UINT32(s, redirection->PasswordCookieLength); redirection->PasswordCookie = (BYTE*) malloc(redirection->PasswordCookieLength); stream_read(s, redirection->PasswordCookie, redirection->PasswordCookieLength); @@ -139,12 +139,12 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) if (redirection->flags & LB_TARGET_NET_ADDRESSES) { int i; - uint32 count; - uint32 targetNetAddressesLength; + UINT32 count; + UINT32 targetNetAddressesLength; - stream_read_uint32(s, targetNetAddressesLength); + stream_read_UINT32(s, targetNetAddressesLength); - stream_read_uint32(s, redirection->targetNetAddressesCount); + stream_read_UINT32(s, redirection->targetNetAddressesCount); count = redirection->targetNetAddressesCount; redirection->targetNetAddresses = (rdpString*) xzalloc(count * sizeof(rdpString)); @@ -159,23 +159,23 @@ boolean rdp_recv_server_redirection_pdu(rdpRdp* rdp, STREAM* s) stream_seek(s, 8); /* pad (8 bytes) */ if (redirection->flags & LB_NOREDIRECT) - return true; + return TRUE; else return rdp_client_redirect(rdp); } -boolean rdp_recv_redirection_packet(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_redirection_packet(rdpRdp* rdp, STREAM* s) { rdp_recv_server_redirection_pdu(rdp, s); - return true; + return TRUE; } -boolean rdp_recv_enhanced_security_redirection_packet(rdpRdp* rdp, STREAM* s) +BOOL rdp_recv_enhanced_security_redirection_packet(rdpRdp* rdp, STREAM* s) { - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ rdp_recv_server_redirection_pdu(rdp, s); - stream_seek_uint8(s); /* pad2Octets (1 byte) */ - return true; + stream_seek_BYTE(s); /* pad2Octets (1 byte) */ + return TRUE; } rdpRedirection* redirection_new() @@ -216,10 +216,10 @@ void redirection_free(rdpRedirection* redirection) for (i = 0; i < (int) redirection->targetNetAddressesCount; i++) freerdp_string_free(&redirection->targetNetAddresses[i]); - xfree(redirection->targetNetAddresses); + free(redirection->targetNetAddresses); } - xfree(redirection); + free(redirection); } } diff --git a/libfreerdp/core/redirection.h b/libfreerdp/core/redirection.h index fe084fd76..cf9e91df3 100644 --- a/libfreerdp/core/redirection.h +++ b/libfreerdp/core/redirection.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Server Redirection * * Copyright 2011 Marc-Andre Moreau @@ -44,8 +44,8 @@ struct rdp_redirection { - uint32 flags; - uint32 sessionID; + UINT32 flags; + UINT32 sessionID; rdpString tsvUrl; rdpString username; rdpString domain; @@ -56,13 +56,13 @@ struct rdp_redirection DWORD LoadBalanceInfoLength; rdpString targetNetBiosName; rdpString targetNetAddress; - uint32 targetNetAddressesCount; + UINT32 targetNetAddressesCount; rdpString* targetNetAddresses; }; typedef struct rdp_redirection rdpRedirection; -boolean rdp_recv_redirection_packet(rdpRdp* rdp, STREAM* s); -boolean rdp_recv_enhanced_security_redirection_packet(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_redirection_packet(rdpRdp* rdp, STREAM* s); +BOOL rdp_recv_enhanced_security_redirection_packet(rdpRdp* rdp, STREAM* s); rdpRedirection* redirection_new(); void redirection_free(rdpRedirection* redirection); diff --git a/libfreerdp/core/rpc.c b/libfreerdp/core/rpc.c index 08b8ff5c6..98709f725 100644 --- a/libfreerdp/core/rpc.c +++ b/libfreerdp/core/rpc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RPC over HTTP * * Copyright 2012 Fujitsu Technology Solutions GmbH @@ -33,7 +33,7 @@ #include "rpc.h" -boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, char* domain, char* password) +BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, char* user, char* domain, char* password) { SECURITY_STATUS status; @@ -67,7 +67,7 @@ boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, cha if (status != SEC_E_OK) { printf("QuerySecurityPackageInfo status: 0x%08X\n", status); - return false; + return FALSE; } ntlm->cbMaxToken = ntlm->pPackageInfo->cbMaxToken; @@ -78,11 +78,11 @@ boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, cha if (status != SEC_E_OK) { printf("AcquireCredentialsHandle status: 0x%08X\n", status); - return false; + return FALSE; } - ntlm->haveContext = false; - ntlm->haveInputBuffer = false; + ntlm->haveContext = FALSE; + ntlm->haveInputBuffer = FALSE; ZeroMemory(&ntlm->inputBuffer, sizeof(SecBuffer)); ZeroMemory(&ntlm->outputBuffer, sizeof(SecBuffer)); ZeroMemory(&ntlm->ContextSizes, sizeof(SecPkgContext_Sizes)); @@ -92,10 +92,10 @@ boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, cha if (ntlm->confidentiality) ntlm->fContextReq |= ISC_REQ_CONFIDENTIALITY; - return true; + return TRUE; } -boolean ntlm_authenticate(rdpNtlm* ntlm) +BOOL ntlm_authenticate(rdpNtlm* ntlm) { SECURITY_STATUS status; @@ -104,7 +104,7 @@ boolean ntlm_authenticate(rdpNtlm* ntlm) ntlm->outputBufferDesc.pBuffers = &ntlm->outputBuffer; ntlm->outputBuffer.BufferType = SECBUFFER_TOKEN; ntlm->outputBuffer.cbBuffer = ntlm->cbMaxToken; - ntlm->outputBuffer.pvBuffer = xmalloc(ntlm->outputBuffer.cbBuffer); + ntlm->outputBuffer.pvBuffer = malloc(ntlm->outputBuffer.cbBuffer); if (ntlm->haveInputBuffer) { @@ -129,7 +129,7 @@ boolean ntlm_authenticate(rdpNtlm* ntlm) if (ntlm->table->QueryContextAttributes(&ntlm->context, SECPKG_ATTR_SIZES, &ntlm->ContextSizes) != SEC_E_OK) { printf("QueryContextAttributes SECPKG_ATTR_SIZES failure\n"); - return false ; + return FALSE ; } if (status == SEC_I_COMPLETE_NEEDED) @@ -138,10 +138,10 @@ boolean ntlm_authenticate(rdpNtlm* ntlm) status = SEC_I_CONTINUE_NEEDED; } - ntlm->haveInputBuffer = true; - ntlm->haveContext = true; + ntlm->haveInputBuffer = TRUE; + ntlm->haveContext = TRUE; - return true; + return TRUE; } void ntlm_client_uninit(rdpNtlm* ntlm) @@ -204,20 +204,20 @@ STREAM* rpc_ntlm_http_request(rdpRpc* rpc, SecBuffer* ntlm_token, int content_le s = http_request_write(http_context, http_request); http_request_free(http_request); - xfree(base64_ntlm_token); + free(base64_ntlm_token); return s; } -boolean rpc_ntlm_http_out_connect(rdpRpc* rpc) +BOOL rpc_ntlm_http_out_connect(rdpRpc* rpc) { STREAM* s; int ntlm_token_length; - uint8* ntlm_token_data; + BYTE* ntlm_token_data; HttpResponse* http_response; rdpNtlm* ntlm = rpc->ntlm_http_out->ntlm; - ntlm_client_init(ntlm, true, rpc->settings->username, + ntlm_client_init(ntlm, TRUE, rpc->settings->username, rpc->settings->domain, rpc->settings->password); ntlm_authenticate(ntlm); @@ -235,7 +235,7 @@ boolean rpc_ntlm_http_out_connect(rdpRpc* rpc) http_response = http_response_recv(rpc->tls_out); ntlm_token_data = NULL; - crypto_base64_decode((uint8*) http_response->AuthParam, strlen(http_response->AuthParam), + crypto_base64_decode((BYTE*) http_response->AuthParam, strlen(http_response->AuthParam), &ntlm_token_data, &ntlm_token_length); ntlm->inputBuffer.pvBuffer = ntlm_token_data; @@ -256,18 +256,18 @@ boolean rpc_ntlm_http_out_connect(rdpRpc* rpc) ntlm_client_uninit(ntlm); ntlm_free(ntlm); - return true; + return TRUE; } -boolean rpc_ntlm_http_in_connect(rdpRpc* rpc) +BOOL rpc_ntlm_http_in_connect(rdpRpc* rpc) { STREAM* s; int ntlm_token_length; - uint8* ntlm_token_data; + BYTE* ntlm_token_data; HttpResponse* http_response; rdpNtlm* ntlm = rpc->ntlm_http_in->ntlm; - ntlm_client_init(ntlm, true, rpc->settings->username, + ntlm_client_init(ntlm, TRUE, rpc->settings->username, rpc->settings->domain, rpc->settings->password); ntlm_authenticate(ntlm); @@ -285,7 +285,7 @@ boolean rpc_ntlm_http_in_connect(rdpRpc* rpc) http_response = http_response_recv(rpc->tls_in); ntlm_token_data = NULL; - crypto_base64_decode((uint8*) http_response->AuthParam, strlen(http_response->AuthParam), + crypto_base64_decode((BYTE*) http_response->AuthParam, strlen(http_response->AuthParam), &ntlm_token_data, &ntlm_token_length); ntlm->inputBuffer.pvBuffer = ntlm_token_data; @@ -306,25 +306,25 @@ boolean rpc_ntlm_http_in_connect(rdpRpc* rpc) ntlm_client_uninit(ntlm); ntlm_free(ntlm); - return true; + return TRUE; } void rpc_pdu_header_read(STREAM* s, RPC_PDU_HEADER* header) { - stream_read_uint8(s, header->rpc_vers); /* rpc_vers (1 byte) */ - stream_read_uint8(s, header->rpc_vers_minor); /* rpc_vers_minor (1 byte) */ - stream_read_uint8(s, header->ptype); /* PTYPE (1 byte) */ - stream_read_uint8(s, header->pfc_flags); /* pfc_flags (1 byte) */ - stream_read_uint8(s, header->packed_drep[0]); /* packet_drep[0] (1 byte) */ - stream_read_uint8(s, header->packed_drep[1]); /* packet_drep[1] (1 byte) */ - stream_read_uint8(s, header->packed_drep[2]); /* packet_drep[2] (1 byte) */ - stream_read_uint8(s, header->packed_drep[3]); /* packet_drep[3] (1 byte) */ - stream_read_uint16(s, header->frag_length); /* frag_length (2 bytes) */ - stream_read_uint16(s, header->auth_length); /* auth_length (2 bytes) */ - stream_read_uint32(s, header->call_id); /* call_id (4 bytes) */ + stream_read_BYTE(s, header->rpc_vers); /* rpc_vers (1 byte) */ + stream_read_BYTE(s, header->rpc_vers_minor); /* rpc_vers_minor (1 byte) */ + stream_read_BYTE(s, header->ptype); /* PTYPE (1 byte) */ + stream_read_BYTE(s, header->pfc_flags); /* pfc_flags (1 byte) */ + stream_read_BYTE(s, header->packed_drep[0]); /* packet_drep[0] (1 byte) */ + stream_read_BYTE(s, header->packed_drep[1]); /* packet_drep[1] (1 byte) */ + stream_read_BYTE(s, header->packed_drep[2]); /* packet_drep[2] (1 byte) */ + stream_read_BYTE(s, header->packed_drep[3]); /* packet_drep[3] (1 byte) */ + stream_read_UINT16(s, header->frag_length); /* frag_length (2 bytes) */ + stream_read_UINT16(s, header->auth_length); /* auth_length (2 bytes) */ + stream_read_UINT32(s, header->call_id); /* call_id (4 bytes) */ } -int rpc_out_write(rdpRpc* rpc, uint8* data, int length) +int rpc_out_write(rdpRpc* rpc, BYTE* data, int length) { int status; @@ -339,7 +339,7 @@ int rpc_out_write(rdpRpc* rpc, uint8* data, int length) return status; } -int rpc_in_write(rdpRpc* rpc, uint8* data, int length) +int rpc_in_write(rdpRpc* rpc, BYTE* data, int length) { int status; @@ -357,7 +357,7 @@ int rpc_in_write(rdpRpc* rpc, uint8* data, int length) return status; } -boolean rpc_send_bind_pdu(rdpRpc* rpc) +BOOL rpc_send_bind_pdu(rdpRpc* rpc) { STREAM* pdu; rpcconn_bind_hdr_t* bind_pdu; @@ -368,7 +368,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc) DEBUG_RPC("Sending bind PDU"); - ntlm_client_init(rpc->ntlm, false, settings->username, settings->domain, settings->password); + ntlm_client_init(rpc->ntlm, FALSE, settings->username, settings->domain, settings->password); ntlm_authenticate(rpc->ntlm); ntlm_stream->size = rpc->ntlm->outputBuffer.cbBuffer; @@ -392,7 +392,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc) bind_pdu->p_context_elem.n_context_elem = 2; bind_pdu->p_context_elem.reserved = 0; bind_pdu->p_context_elem.reserved2 = 0; - bind_pdu->p_context_elem.p_cont_elem = xmalloc(sizeof(p_cont_elem_t) * bind_pdu->p_context_elem.n_context_elem); + bind_pdu->p_context_elem.p_cont_elem = malloc(sizeof(p_cont_elem_t) * bind_pdu->p_context_elem.n_context_elem); bind_pdu->p_context_elem.p_cont_elem[0].p_cont_id = 0; bind_pdu->p_context_elem.p_cont_elem[0].n_transfer_syn = 1; bind_pdu->p_context_elem.p_cont_elem[0].reserved = 0; @@ -408,7 +408,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc) bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_uuid.node[4] = 0x27; bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_uuid.node[5] = 0x29; bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_version = 0x00030001; - bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes = xmalloc(sizeof(p_syntax_id_t)); + bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes = malloc(sizeof(p_syntax_id_t)); bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_low = 0x8a885d04; bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_mid = 0x1ceb; bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_hi_and_version = 0x11c9; @@ -436,7 +436,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc) bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_uuid.node[4] = 0x27; bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_uuid.node[5] = 0x29; bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_version = 0x00030001; - bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes = xmalloc(sizeof(p_syntax_id_t)); + bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes = malloc(sizeof(p_syntax_id_t)); bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_low = 0x6cb71c2c; bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_mid = 0x9812; bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_hi_and_version = 0x4540; @@ -455,7 +455,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc) bind_pdu->auth_verifier.auth_pad_length = 0x00; /* :01 */ bind_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */ bind_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */ - bind_pdu->auth_verifier.auth_value = xmalloc(bind_pdu->auth_length); /* credentials; size_is(auth_length) p*/; + bind_pdu->auth_verifier.auth_value = malloc(bind_pdu->auth_length); /* credentials; size_is(auth_length) p*/; memcpy(bind_pdu->auth_verifier.auth_value, ntlm_stream->data, bind_pdu->auth_length); stream_free(ntlm_stream); @@ -472,29 +472,29 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc) if (bind_pdu->auth_verifier.auth_pad_length > 0) stream_write(pdu, bind_pdu->auth_verifier.auth_pad, bind_pdu->auth_verifier.auth_pad_length); - stream_write(pdu, &bind_pdu->auth_verifier.auth_type, 8); /* assumed that uint8 pointer is 32bit long (4 bytes) */ + stream_write(pdu, &bind_pdu->auth_verifier.auth_type, 8); /* assumed that BYTE pointer is 32bit long (4 bytes) */ stream_write(pdu, bind_pdu->auth_verifier.auth_value, bind_pdu->auth_length); stream_seal(pdu); rpc_in_write(rpc, pdu->data, pdu->size); stream_free(pdu) ; - xfree(bind_pdu); + free(bind_pdu); - return true; + return TRUE; } int rpc_recv_bind_ack_pdu(rdpRpc* rpc) { - uint8* p; + BYTE* p; STREAM* s; int status; - uint8* pdu; - uint8* auth_data; + BYTE* pdu; + BYTE* auth_data; RPC_PDU_HEADER header; int pdu_length = 0x8FFF; - pdu = xmalloc(pdu_length); + pdu = malloc(pdu_length); if (pdu == NULL) return -1; @@ -509,11 +509,11 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc) stream_detach(s); stream_free(s); - auth_data = xmalloc(header.auth_length); + auth_data = malloc(header.auth_length); if (auth_data == NULL) { - xfree(pdu); + free(pdu); return -1; } @@ -526,11 +526,11 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc) ntlm_authenticate(rpc->ntlm); } - xfree(pdu); + free(pdu); return status; } -boolean rpc_send_rpc_auth_3_pdu(rdpRpc* rpc) +BOOL rpc_send_rpc_auth_3_pdu(rdpRpc* rpc) { STREAM* pdu; STREAM* s = stream_new(0); @@ -562,7 +562,7 @@ boolean rpc_send_rpc_auth_3_pdu(rdpRpc* rpc) rpc_auth_3_pdu->auth_verifier.auth_pad_length = 0x00; /* :01 */ rpc_auth_3_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */ rpc_auth_3_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */ - rpc_auth_3_pdu->auth_verifier.auth_value = xmalloc(rpc_auth_3_pdu->auth_length); /* credentials; size_is(auth_length) p */ + rpc_auth_3_pdu->auth_verifier.auth_value = malloc(rpc_auth_3_pdu->auth_length); /* credentials; size_is(auth_length) p */ memcpy(rpc_auth_3_pdu->auth_verifier.auth_value, s->data, rpc_auth_3_pdu->auth_length); stream_free(s); @@ -580,23 +580,23 @@ boolean rpc_send_rpc_auth_3_pdu(rdpRpc* rpc) rpc_in_write(rpc, pdu->data, stream_get_length(pdu)); stream_free(pdu) ; - xfree(rpc_auth_3_pdu); + free(rpc_auth_3_pdu); - return true; + return TRUE; } -int rpc_out_read(rdpRpc* rpc, uint8* data, int length) +int rpc_out_read(rdpRpc* rpc, BYTE* data, int length) { STREAM* s; int status; - uint8* pdu; + BYTE* pdu; int content_length; RPC_PDU_HEADER header; if (rpc->VirtualConnection->DefaultOutChannel->ReceiverAvailableWindow < 0x00008FFF) /* Just a simple workaround */ rts_send_flow_control_ack_pdu(rpc); /* Send FlowControlAck every time AvailableWindow reaches the half */ - pdu = xmalloc(0xFFFF); + pdu = malloc(0xFFFF); if (pdu == NULL) { @@ -608,7 +608,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) if (status <= 0) { - xfree(pdu); + free(pdu); return status; } @@ -625,14 +625,14 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) if (status < 0) { - xfree(pdu); + free(pdu); return status; } if (header.ptype == PTYPE_RTS) /* RTS PDU */ { printf("rpc_out_read error: Unexpected RTS PDU\n"); - xfree(pdu); + free(pdu); return -1; } else @@ -645,7 +645,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) if (length < header.frag_length) { printf("rpc_out_read error! receive buffer is not large enough\n"); - xfree(pdu); + free(pdu); return -1; } @@ -657,11 +657,11 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) printf("\n"); #endif - xfree(pdu); + free(pdu); return header.frag_length; } -int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum) +int rpc_tsg_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum) { int i; int status; @@ -672,7 +672,7 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum) SECURITY_STATUS encrypt_status; rpcconn_request_hdr_t* request_pdu; - uint8 auth_pad_length = 16 - ((24 + length + 8 + 16) % 16); + BYTE auth_pad_length = 16 - ((24 + length + 8 + 16) % 16); ntlm = rpc->ntlm; @@ -704,7 +704,7 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum) request_pdu->auth_verifier.auth_type = 0x0A; /* :01 which authentication service */ request_pdu->auth_verifier.auth_level = 0x05; /* :01 which level within service */ request_pdu->auth_verifier.auth_pad_length = auth_pad_length; /* :01 */ - request_pdu->auth_verifier.auth_pad = xmalloc(auth_pad_length); /* align(4); size_is(auth_pad_length) p */ + request_pdu->auth_verifier.auth_pad = malloc(auth_pad_length); /* align(4); size_is(auth_pad_length) p */ for (i = 0; i < auth_pad_length; i++) { @@ -713,7 +713,7 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum) request_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */ request_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */ - request_pdu->auth_verifier.auth_value = xmalloc(request_pdu->auth_length); /* credentials; size_is(auth_length) p */ + request_pdu->auth_verifier.auth_value = malloc(request_pdu->auth_length); /* credentials; size_is(auth_length) p */ pdu = stream_new(request_pdu->frag_length); @@ -725,9 +725,9 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum) stream_write(pdu, &request_pdu->auth_verifier.auth_type, 8); - xfree(request_pdu->auth_verifier.auth_value); - xfree(request_pdu->auth_verifier.auth_pad); - xfree(request_pdu); + free(request_pdu->auth_verifier.auth_value); + free(request_pdu->auth_verifier.auth_pad); + free(request_pdu); if (ntlm->table->QueryContextAttributes(&ntlm->context, SECPKG_ATTR_SIZES, &ntlm->ContextSizes) != SEC_E_OK) { @@ -773,17 +773,17 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum) return length; } -int rpc_read(rdpRpc* rpc, uint8* data, int length) +int rpc_read(rdpRpc* rpc, BYTE* data, int length) { int status; int read = 0; int data_length; - uint16 frag_length; - uint16 auth_length; - uint8 auth_pad_length; - uint32 call_id = -1; + UINT16 frag_length; + UINT16 auth_length; + BYTE auth_pad_length; + UINT32 call_id = -1; int rpc_length = length + 0xFF; - uint8* rpc_data = xmalloc(rpc_length); + BYTE* rpc_data = malloc(rpc_length); if (rpc_data == NULL) { @@ -793,26 +793,26 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) if (rpc->read_buffer_len > 0) { - if (rpc->read_buffer_len > (uint32) length) + if (rpc->read_buffer_len > (UINT32) length) { printf("rpc_read error: receiving buffer is not large enough\n"); - xfree(rpc_data); + free(rpc_data); return -1; } memcpy(data, rpc->read_buffer, rpc->read_buffer_len); read += rpc->read_buffer_len; - xfree(rpc->read_buffer); + free(rpc->read_buffer); rpc->read_buffer_len = 0; } - while (true) + while (TRUE) { status = rpc_out_read(rpc, rpc_data, rpc_length); if (status == 0) { - xfree(rpc_data); + free(rpc_data); return read; } else if (status < 0) @@ -821,14 +821,14 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) rpc->VirtualConnection->DefaultInChannel->BytesSent, rpc->VirtualConnection->DefaultOutChannel->BytesReceived); - xfree(rpc_data); + free(rpc_data); return status; } - frag_length = *(uint16*)(rpc_data + 8); - auth_length = *(uint16*)(rpc_data + 10); - call_id = *(uint32*)(rpc_data + 12); - status = *(uint32*)(rpc_data + 16); /* alloc_hint */ + frag_length = *(UINT16*)(rpc_data + 8); + auth_length = *(UINT16*)(rpc_data + 10); + call_id = *(UINT32*)(rpc_data + 12); + status = *(UINT32*)(rpc_data + 16); /* alloc_hint */ auth_pad_length = *(rpc_data + frag_length - auth_length - 6); /* -6 = -8 + 2 (sec_trailer + 2) */ /* data_length must be calculated because alloc_hint carries size of more than one pdu */ @@ -840,7 +840,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) if (read + data_length > length) /* if read data is greater then given buffer */ { rpc->read_buffer_len = read + data_length - length; - rpc->read_buffer = xmalloc(rpc->read_buffer_len); + rpc->read_buffer = malloc(rpc->read_buffer_len); data_length -= rpc->read_buffer_len; @@ -857,11 +857,11 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) break; } - xfree(rpc_data); + free(rpc_data); return read; } -boolean rpc_connect(rdpRpc* rpc) +BOOL rpc_connect(rdpRpc* rpc) { rpc->tls_in = rpc->transport->tls_in; rpc->tls_out = rpc->transport->tls_out; @@ -869,28 +869,28 @@ boolean rpc_connect(rdpRpc* rpc) if (!rts_connect(rpc)) { printf("rts_connect error!\n"); - return false; + return FALSE; } if (!rpc_send_bind_pdu(rpc)) { printf("rpc_send_bind_pdu error!\n"); - return false; + return FALSE; } if (rpc_recv_bind_ack_pdu(rpc) <= 0) { printf("rpc_recv_bind_ack_pdu error!\n"); - return false; + return FALSE; } if (!rpc_send_rpc_auth_3_pdu(rpc)) { printf("rpc_send_rpc_auth_3 error!\n"); - return false; + return FALSE; } - return true; + return TRUE; } void rpc_client_virtual_connection_init(rdpRpc* rpc, RpcVirtualConnection* virtual_connection) @@ -924,7 +924,7 @@ void rpc_client_virtual_connection_free(RpcVirtualConnection* virtual_connection { if (virtual_connection != NULL) { - xfree(virtual_connection); + free(virtual_connection); } } @@ -1018,6 +1018,6 @@ void rpc_free(rdpRpc* rpc) ntlm_http_free(rpc->ntlm_http_in); ntlm_http_free(rpc->ntlm_http_out); rpc_client_virtual_connection_free(rpc->VirtualConnection); - xfree(rpc); + free(rpc); } } diff --git a/libfreerdp/core/rpc.h b/libfreerdp/core/rpc.h index e35bab02e..619ac8119 100644 --- a/libfreerdp/core/rpc.h +++ b/libfreerdp/core/rpc.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RPC over HTTP * * Copyright 2012 Fujitsu Technology Solutions GmbH @@ -44,36 +44,36 @@ typedef struct rdp_ntlm_http rdpNtlmHttp; struct _rpc_pdu_header { - uint8 rpc_vers; - uint8 rpc_vers_minor; - uint8 ptype; - uint8 pfc_flags; - uint8 packed_drep[4]; - uint16 frag_length; - uint16 auth_length; - uint32 call_id; + BYTE rpc_vers; + BYTE rpc_vers_minor; + BYTE ptype; + BYTE pfc_flags; + BYTE packed_drep[4]; + UINT16 frag_length; + UINT16 auth_length; + UINT32 call_id; }; typedef struct _rpc_pdu_header RPC_PDU_HEADER; -typedef uint16 p_context_id_t; +typedef UINT16 p_context_id_t; typedef struct { uuid if_uuid; - uint32 if_version; + UINT32 if_version; } p_syntax_id_t; typedef struct { p_context_id_t p_cont_id; - uint8 n_transfer_syn; /* number of items */ - uint8 reserved; /* alignment pad, m.b.z. */ + BYTE n_transfer_syn; /* number of items */ + BYTE reserved; /* alignment pad, m.b.z. */ p_syntax_id_t abstract_syntax; /* transfer syntax list */ p_syntax_id_t* transfer_syntaxes; /*size_is(n_transfer_syn)*/ } p_cont_elem_t; typedef struct { - uint8 n_context_elem; /* number of items */ - uint8 reserved; /* alignment pad, m.b.z. */ - uint16 reserved2; /* alignment pad, m.b.z. */ + BYTE n_context_elem; /* number of items */ + BYTE reserved; /* alignment pad, m.b.z. */ + UINT16 reserved2; /* alignment pad, m.b.z. */ p_cont_elem_t* p_cont_elem; /*size_is(n_cont_elem)*/ } p_cont_list_t; @@ -101,25 +101,25 @@ typedef struct { /* Same order and number of elements as in bind request */ typedef struct { - uint8 n_results; /* count */ - uint8 reserved; /* alignment pad, m.b.z. */ - uint16 reserved2; /* alignment pad, m.b.z. */ + BYTE n_results; /* count */ + BYTE reserved; /* alignment pad, m.b.z. */ + UINT16 reserved2; /* alignment pad, m.b.z. */ p_result_t* p_results; /*size_is(n_results)*/ } p_result_list_t; typedef struct { - uint8 major; - uint8 minor; + BYTE major; + BYTE minor; } version_t; typedef version_t p_rt_version_t; typedef struct { - uint8 n_protocols; /* count */ + BYTE n_protocols; /* count */ p_rt_version_t* p_protocols; /* size_is(n_protocols) */ } p_rt_versions_supported_t; typedef struct { - uint16 length; + UINT16 length; char* port_spec; /* port string spec; size_is(length) */ } port_any_t; @@ -132,15 +132,15 @@ typedef struct { #define USER_DATA_NOT_READABLE 6 /* not used */ #define NO_PSAP_AVAILABLE 7 /* not used */ -typedef uint16 rpcrt_reason_code_t;/* 0..65535 */ +typedef UINT16 rpcrt_reason_code_t;/* 0..65535 */ typedef struct { - uint8 rpc_vers; - uint8 rpc_vers_minor; - uint8 reserved[2];/* must be zero */ - uint8 packed_drep[4]; - uint32 reject_status; - uint8 reserved2[4]; + BYTE rpc_vers; + BYTE rpc_vers_minor; + BYTE reserved[2];/* must be zero */ + BYTE packed_drep[4]; + UINT32 reject_status; + BYTE reserved2[4]; } rpcrt_optional_data_t; typedef struct { @@ -156,13 +156,13 @@ typedef struct { typedef struct{ /* restore 4 byte alignment */ - uint8* auth_pad; /* align(4); size_is(auth_pad_length) */ - uint8 auth_type; /* :01 which authent service */ - uint8 auth_level; /* :01 which level within service */ - uint8 auth_pad_length; /* :01 */ - uint8 auth_reserved; /* :01 reserved, m.b.z. */ - uint32 auth_context_id; /* :04 */ - uint8* auth_value; /* credentials; size_is(auth_length) */ + BYTE* auth_pad; /* align(4); size_is(auth_pad_length) */ + BYTE auth_type; /* :01 which authent service */ + BYTE auth_level; /* :01 which level within service */ + BYTE auth_pad_length; /* :01 */ + BYTE auth_reserved; /* :01 reserved, m.b.z. */ + UINT32 auth_context_id; /* :04 */ + BYTE* auth_value; /* credentials; size_is(auth_length) */ } auth_verifier_co_t; /* Connection-oriented PDU Definitions */ @@ -171,20 +171,20 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor ; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 alter context PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor ; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 alter context PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ - uint16 max_xmit_frag; /* ignored */ - uint16 max_recv_frag; /* ignored */ - uint32 assoc_group_id; /* ignored */ + UINT16 max_xmit_frag; /* ignored */ + UINT16 max_recv_frag; /* ignored */ + UINT32 assoc_group_id; /* ignored */ /* presentation context list */ @@ -201,26 +201,26 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 alter + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 alter context response PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ - uint16 max_xmit_frag; /* ignored */ - uint16 max_recv_frag; /* ignored */ - uint32 assoc_group_id; /* ignored */ + UINT16 max_xmit_frag; /* ignored */ + UINT16 max_recv_frag; /* ignored */ + UINT32 assoc_group_id; /* ignored */ port_any_t sec_addr; /* ignored */ /* restore 4-octet alignment */ - uint8* pad2; /* size_is(align(4)) */ + BYTE* pad2; /* size_is(align(4)) */ /* presentation context result list, including hints */ @@ -237,20 +237,20 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 bind PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 bind PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ - uint16 max_xmit_frag; /* 16:02 max transmit frag size, bytes */ - uint16 max_recv_frag; /* 18:02 max receive frag size, bytes */ - uint32 assoc_group_id; /* 20:04 incarnation of client-server + UINT16 max_xmit_frag; /* 16:02 max transmit frag size, bytes */ + UINT16 max_recv_frag; /* 18:02 max receive frag size, bytes */ + UINT32 assoc_group_id; /* 20:04 incarnation of client-server * assoc group */ /* presentation context list */ @@ -266,26 +266,26 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor ; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 bind ack PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor ; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 bind ack PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ - uint16 max_xmit_frag; /* 16:02 max transmit frag size */ - uint16 max_recv_frag; /* 18:02 max receive frag size */ - uint32 assoc_group_id; /* 20:04 returned assoc_group_id */ + UINT16 max_xmit_frag; /* 16:02 max transmit frag size */ + UINT16 max_recv_frag; /* 18:02 max receive frag size */ + UINT32 assoc_group_id; /* 20:04 returned assoc_group_id */ port_any_t sec_addr; /* 24:yy optional secondary address * for process incarnation; local port * part of address only */ /* restore 4-octet alignment */ - uint8* pad2; /* size_is(align(4)) */ + BYTE* pad2; /* size_is(align(4)) */ /* presentation context result list, including hints */ @@ -301,19 +301,19 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor ; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 bind ack PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor ; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 bind ack PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ - uint16 max_xmit_frag; /* 16:02 max transmit frag size */ - uint16 max_recv_frag; /* 18:02 max receive frag size */ + UINT16 max_xmit_frag; /* 16:02 max transmit frag size */ + UINT16 max_recv_frag; /* 18:02 max receive frag size */ /* optional authentication verifier */ /* following fields present iff auth_length != 0 */ @@ -325,18 +325,18 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor ; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 bind nak PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor ; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 bind nak PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ - /*p_reject_reason_t*/uint16 provider_reject_reason; /* 16:02 presentation (TODO search definition of p_reject_reason_t) + /*p_reject_reason_t*/UINT16 provider_reject_reason; /* 16:02 presentation (TODO search definition of p_reject_reason_t) context reject */ p_rt_versions_supported_t versions; /* 18:yy array of protocol @@ -348,14 +348,14 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 CO cancel PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 CO cancel PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ @@ -370,40 +370,40 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 fault PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 fault PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ /* needed for request, response, fault */ - uint32 alloc_hint; /* 16:04 allocation hint */ + UINT32 alloc_hint; /* 16:04 allocation hint */ p_context_id_t p_cont_id; /* 20:02 pres context, i.e. data rep */ /* needed for response or fault */ - uint8 cancel_count; /* 22:01 received cancel count */ - uint8 reserved; /* 23:01 reserved, m.b.z. */ + BYTE cancel_count; /* 22:01 received cancel count */ + BYTE reserved; /* 23:01 reserved, m.b.z. */ /* fault code */ - uint32 status; /* 24:04 run-time fault code or zero */ + UINT32 status; /* 24:04 run-time fault code or zero */ /* always pad to next 8-octet boundary */ - uint8 reserved2[4]; /* 28:04 reserved padding, m.b.z. */ + BYTE reserved2[4]; /* 28:04 reserved padding, m.b.z. */ /* stub data here, 8-octet aligned . . . */ - uint8* stub_data; + BYTE* stub_data; /* optional authentication verifier */ /* following fields present iff auth_length != 0 */ @@ -416,14 +416,14 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 orphaned PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 orphaned PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ @@ -438,22 +438,22 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 request PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 request PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ /* needed on request, response, fault */ - uint32 alloc_hint; /* 16:04 allocation hint */ + UINT32 alloc_hint; /* 16:04 allocation hint */ p_context_id_t p_cont_id; /* 20:02 pres context, i.e. data rep */ - uint16 opnum; /* 22:02 operation # + UINT16 opnum; /* 22:02 operation # * within the interface */ /* optional field for request, only present if the PFC_OBJECT_UUID @@ -465,7 +465,7 @@ typedef struct { . . . */ - uint8* stub_data; + BYTE* stub_data; /* optional authentication verifier */ /* following fields present iff auth_length != 0 */ @@ -477,33 +477,33 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 response PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 length of auth_value */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 response PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 length of auth_value */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ /* needed for request, response, fault */ - uint32 alloc_hint; /* 16:04 allocation hint */ + UINT32 alloc_hint; /* 16:04 allocation hint */ p_context_id_t p_cont_id; /* 20:02 pres context, i.e. * data rep */ /* needed for response or fault */ - uint8 cancel_count; /* 22:01 cancel count */ - uint8 reserved; /* 23:01 reserved, m.b.z. */ + BYTE cancel_count; /* 22:01 cancel count */ + BYTE reserved; /* 23:01 reserved, m.b.z. */ /* stub data here, 8-octet aligned . . . */ - uint8* stub_data; + BYTE* stub_data; /* optional authentication verifier */ /* following fields present iff auth_length != 0 */ @@ -516,14 +516,14 @@ typedef struct { /* start 8-octet aligned */ /* common fields */ - uint8 rpc_vers; /* 00:01 RPC version */ - uint8 rpc_vers_minor; /* 01:01 minor version */ - uint8 PTYPE; /* 02:01 shutdown PDU */ - uint8 pfc_flags; /* 03:01 flags */ - uint8 packed_drep[4]; /* 04:04 NDR data rep format label*/ - uint16 frag_length; /* 08:02 total length of fragment */ - uint16 auth_length; /* 10:02 */ - uint32 call_id; /* 12:04 call identifier */ + BYTE rpc_vers; /* 00:01 RPC version */ + BYTE rpc_vers_minor; /* 01:01 minor version */ + BYTE PTYPE; /* 02:01 shutdown PDU */ + BYTE pfc_flags; /* 03:01 flags */ + BYTE packed_drep[4]; /* 04:04 NDR data rep format label*/ + UINT16 frag_length; /* 08:02 total length of fragment */ + UINT16 auth_length; /* 10:02 */ + UINT32 call_id; /* 12:04 call identifier */ /* end common fields */ } rpcconn_shutdown_hdr_t; @@ -538,12 +538,12 @@ struct rdp_ntlm PSecBuffer pBuffer; SecBuffer inputBuffer; SecBuffer outputBuffer; - boolean haveContext; - boolean haveInputBuffer; + BOOL haveContext; + BOOL haveInputBuffer; SecBufferDesc inputBufferDesc; SecBufferDesc outputBufferDesc; CredHandle credentials; - boolean confidentiality; + BOOL confidentiality; SecPkgInfo* pPackageInfo; SecurityFunctionTable* table; SEC_WINNT_AUTH_IDENTITY identity; @@ -568,9 +568,9 @@ struct rdp_ntlm_http struct rpc_ping_originator { - uint32 ConnectionTimeout; - uint32 LastPacketSentTimestamp; - uint32 KeepAliveInterval; + UINT32 ConnectionTimeout; + UINT32 LastPacketSentTimestamp; + UINT32 KeepAliveInterval; }; typedef struct rpc_ping_originator RpcPingOriginator; @@ -580,11 +580,11 @@ struct rpc_in_channel { /* Sending Channel */ - uint32 PlugState; + UINT32 PlugState; void* SendQueue; - uint32 BytesSent; - uint32 SenderAvailableWindow; - uint32 PeerReceiveWindow; + UINT32 BytesSent; + UINT32 SenderAvailableWindow; + UINT32 PeerReceiveWindow; /* Ping Originator */ @@ -598,11 +598,11 @@ struct rpc_out_channel { /* Receiving Channel */ - uint32 ReceiveWindow; - uint32 ReceiveWindowSize; - uint32 ReceiverAvailableWindow; - uint32 BytesReceived; - uint32 AvailableWindowAdvertised; + UINT32 ReceiveWindow; + UINT32 ReceiveWindowSize; + UINT32 ReceiverAvailableWindow; + UINT32 BytesReceived; + UINT32 AvailableWindowAdvertised; }; typedef struct rpc_out_channel RpcOutChannel; @@ -621,17 +621,17 @@ typedef enum _VIRTUAL_CONNECTION_STATE VIRTUAL_CONNECTION_STATE; struct rpc_virtual_connection { - uint8 Cookie[16]; /* Virtual Connection Cookie */ + BYTE Cookie[16]; /* Virtual Connection Cookie */ VIRTUAL_CONNECTION_STATE State; /* Virtual Connection State */ RpcInChannel* DefaultInChannel; /* Default IN Channel */ RpcInChannel* NonDefaultInChannel; /* Non-Default IN Channel */ - uint8 DefaultInChannelCookie[16]; /* Default IN Channel Cookie */ - uint8 NonDefaultInChannelCookie[16]; /* Non-Default Default IN Channel Cookie */ + BYTE DefaultInChannelCookie[16]; /* Default IN Channel Cookie */ + BYTE NonDefaultInChannelCookie[16]; /* Non-Default Default IN Channel Cookie */ RpcOutChannel* DefaultOutChannel; /* Default OUT Channel */ RpcOutChannel* NonDefaultOutChannel; /* Non-Default OUT Channel */ - uint8 DefaultOutChannelCookie[16]; /* Default OUT Channel Cookie */ - uint8 NonDefaultOutChannelCookie[16]; /* Non-Default Default OUT Channel Cookie */ - uint8 AssociationGroupId[16]; /* AssociationGroupId */ + BYTE DefaultOutChannelCookie[16]; /* Default OUT Channel Cookie */ + BYTE NonDefaultOutChannelCookie[16]; /* Non-Default Default OUT Channel Cookie */ + BYTE AssociationGroupId[16]; /* AssociationGroupId */ }; typedef struct rpc_virtual_connection RpcVirtualConnection; @@ -649,41 +649,41 @@ struct rdp_rpc rdpSettings* settings; rdpTransport* transport; - uint8* write_buffer; - uint32 write_buffer_len; - uint8* read_buffer; - uint32 read_buffer_len; + BYTE* write_buffer; + UINT32 write_buffer_len; + BYTE* read_buffer; + UINT32 read_buffer_len; - uint32 call_id; - uint32 pipe_call_id; + UINT32 call_id; + UINT32 pipe_call_id; - uint32 ReceiveWindow; + UINT32 ReceiveWindow; RpcVirtualConnection* VirtualConnection; }; -boolean ntlm_authenticate(rdpNtlm* ntlm); +BOOL ntlm_authenticate(rdpNtlm* ntlm); -boolean ntlm_client_init(rdpNtlm* ntlm, boolean confidentiality, char* user, char* domain, char* password); +BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, char* user, char* domain, char* password); void ntlm_client_uninit(rdpNtlm* ntlm); rdpNtlm* ntlm_new(); void ntlm_free(rdpNtlm* ntlm); -boolean rpc_connect(rdpRpc* rpc); +BOOL rpc_connect(rdpRpc* rpc); -boolean rpc_ntlm_http_out_connect(rdpRpc* rpc); -boolean rpc_ntlm_http_in_connect(rdpRpc* rpc); +BOOL rpc_ntlm_http_out_connect(rdpRpc* rpc); +BOOL rpc_ntlm_http_in_connect(rdpRpc* rpc); void rpc_pdu_header_read(STREAM* s, RPC_PDU_HEADER* header); -int rpc_out_write(rdpRpc* rpc, uint8* data, int length); -int rpc_in_write(rdpRpc* rpc, uint8* data, int length); +int rpc_out_write(rdpRpc* rpc, BYTE* data, int length); +int rpc_in_write(rdpRpc* rpc, BYTE* data, int length); -int rpc_out_read(rdpRpc* rpc, uint8* data, int length); +int rpc_out_read(rdpRpc* rpc, BYTE* data, int length); -int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum); -int rpc_read(rdpRpc* rpc, uint8* data, int length); +int rpc_tsg_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum); +int rpc_read(rdpRpc* rpc, BYTE* data, int length); rdpRpc* rpc_new(rdpTransport* transport); void rpc_free(rdpRpc* rpc); diff --git a/libfreerdp/core/rts.c b/libfreerdp/core/rts.c index f14fd66f3..04d99bc70 100644 --- a/libfreerdp/core/rts.c +++ b/libfreerdp/core/rts.c @@ -45,7 +45,7 @@ * */ -boolean rts_connect(rdpRpc* rpc) +BOOL rts_connect(rdpRpc* rpc) { int status; RTS_PDU rts_pdu; @@ -54,25 +54,25 @@ boolean rts_connect(rdpRpc* rpc) if (!rpc_ntlm_http_out_connect(rpc)) { printf("rpc_out_connect_http error!\n"); - return false; + return FALSE; } if (!rts_send_CONN_A1_pdu(rpc)) { printf("rpc_send_CONN_A1_pdu error!\n"); - return false; + return FALSE; } if (!rpc_ntlm_http_in_connect(rpc)) { printf("rpc_in_connect_http error!\n"); - return false; + return FALSE; } if (!rts_send_CONN_B1_pdu(rpc)) { printf("rpc_send_CONN_B1_pdu error!\n"); - return false; + return FALSE; } /* Receive OUT Channel Response */ @@ -83,7 +83,7 @@ boolean rts_connect(rdpRpc* rpc) printf("rts_connect error!\n"); http_response_print(http_response); http_response_free(http_response) ; - return false; + return FALSE; } http_response_print(http_response); @@ -96,7 +96,7 @@ boolean rts_connect(rdpRpc* rpc) /* Receive CONN_C2 RTS PDU */ status = rts_recv_pdu(rpc, &rts_pdu); - return true; + return TRUE; } #ifdef WITH_DEBUG_RTS @@ -124,76 +124,76 @@ static const char* const RTS_CMD_STRINGS[] = void rts_pdu_header_read(STREAM* s, RTS_PDU_HEADER* header) { - stream_read_uint8(s, header->rpc_vers); /* rpc_vers (1 byte) */ - stream_read_uint8(s, header->rpc_vers_minor); /* rpc_vers_minor (1 byte) */ - stream_read_uint8(s, header->ptype); /* PTYPE (1 byte) */ - stream_read_uint8(s, header->pfc_flags); /* pfc_flags (1 byte) */ - stream_read_uint8(s, header->packed_drep[0]); /* packet_drep[0] (1 byte) */ - stream_read_uint8(s, header->packed_drep[1]); /* packet_drep[1] (1 byte) */ - stream_read_uint8(s, header->packed_drep[2]); /* packet_drep[2] (1 byte) */ - stream_read_uint8(s, header->packed_drep[3]); /* packet_drep[3] (1 byte) */ - stream_read_uint16(s, header->frag_length); /* frag_length (2 bytes) */ - stream_read_uint16(s, header->auth_length); /* auth_length (2 bytes) */ - stream_read_uint32(s, header->call_id); /* call_id (4 bytes) */ - stream_read_uint16(s, header->flags); /* flags (2 bytes) */ - stream_read_uint16(s, header->numberOfCommands); /* numberOfCommands (2 bytes) */ + stream_read_BYTE(s, header->rpc_vers); /* rpc_vers (1 byte) */ + stream_read_BYTE(s, header->rpc_vers_minor); /* rpc_vers_minor (1 byte) */ + stream_read_BYTE(s, header->ptype); /* PTYPE (1 byte) */ + stream_read_BYTE(s, header->pfc_flags); /* pfc_flags (1 byte) */ + stream_read_BYTE(s, header->packed_drep[0]); /* packet_drep[0] (1 byte) */ + stream_read_BYTE(s, header->packed_drep[1]); /* packet_drep[1] (1 byte) */ + stream_read_BYTE(s, header->packed_drep[2]); /* packet_drep[2] (1 byte) */ + stream_read_BYTE(s, header->packed_drep[3]); /* packet_drep[3] (1 byte) */ + stream_read_UINT16(s, header->frag_length); /* frag_length (2 bytes) */ + stream_read_UINT16(s, header->auth_length); /* auth_length (2 bytes) */ + stream_read_UINT32(s, header->call_id); /* call_id (4 bytes) */ + stream_read_UINT16(s, header->flags); /* flags (2 bytes) */ + stream_read_UINT16(s, header->numberOfCommands); /* numberOfCommands (2 bytes) */ } void rts_pdu_header_write(STREAM* s, RTS_PDU_HEADER* header) { - stream_write_uint8(s, header->rpc_vers); /* rpc_vers (1 byte) */ - stream_write_uint8(s, header->rpc_vers_minor); /* rpc_vers_minor (1 byte) */ - stream_write_uint8(s, header->ptype); /* PTYPE (1 byte) */ - stream_write_uint8(s, header->pfc_flags); /* pfc_flags (1 byte) */ - stream_write_uint8(s, header->packed_drep[0]); /* packet_drep[0] (1 byte) */ - stream_write_uint8(s, header->packed_drep[1]); /* packet_drep[1] (1 byte) */ - stream_write_uint8(s, header->packed_drep[2]); /* packet_drep[2] (1 byte) */ - stream_write_uint8(s, header->packed_drep[3]); /* packet_drep[3] (1 byte) */ - stream_write_uint16(s, header->frag_length); /* frag_length (2 bytes) */ - stream_write_uint16(s, header->auth_length); /* auth_length (2 bytes) */ - stream_write_uint32(s, header->call_id); /* call_id (4 bytes) */ - stream_write_uint16(s, header->flags); /* flags (2 bytes) */ - stream_write_uint16(s, header->numberOfCommands); /* numberOfCommands (2 bytes) */ + stream_write_BYTE(s, header->rpc_vers); /* rpc_vers (1 byte) */ + stream_write_BYTE(s, header->rpc_vers_minor); /* rpc_vers_minor (1 byte) */ + stream_write_BYTE(s, header->ptype); /* PTYPE (1 byte) */ + stream_write_BYTE(s, header->pfc_flags); /* pfc_flags (1 byte) */ + stream_write_BYTE(s, header->packed_drep[0]); /* packet_drep[0] (1 byte) */ + stream_write_BYTE(s, header->packed_drep[1]); /* packet_drep[1] (1 byte) */ + stream_write_BYTE(s, header->packed_drep[2]); /* packet_drep[2] (1 byte) */ + stream_write_BYTE(s, header->packed_drep[3]); /* packet_drep[3] (1 byte) */ + stream_write_UINT16(s, header->frag_length); /* frag_length (2 bytes) */ + stream_write_UINT16(s, header->auth_length); /* auth_length (2 bytes) */ + stream_write_UINT32(s, header->call_id); /* call_id (4 bytes) */ + stream_write_UINT16(s, header->flags); /* flags (2 bytes) */ + stream_write_UINT16(s, header->numberOfCommands); /* numberOfCommands (2 bytes) */ } void rts_receive_window_size_command_read(rdpRpc* rpc, STREAM* s) { - stream_seek_uint32(s); /* ReceiveWindowSize (4 bytes) */ + stream_seek_UINT32(s); /* ReceiveWindowSize (4 bytes) */ } -void rts_receive_window_size_command_write(STREAM* s, uint32 ReceiveWindowSize) +void rts_receive_window_size_command_write(STREAM* s, UINT32 ReceiveWindowSize) { - stream_write_uint32(s, RTS_CMD_RECEIVE_WINDOW_SIZE); /* CommandType (4 bytes) */ - stream_write_uint32(s, ReceiveWindowSize); /* ReceiveWindowSize (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_RECEIVE_WINDOW_SIZE); /* CommandType (4 bytes) */ + stream_write_UINT32(s, ReceiveWindowSize); /* ReceiveWindowSize (4 bytes) */ } void rts_flow_control_ack_command_read(rdpRpc* rpc, STREAM* s) { /* Ack (24 bytes) */ - stream_seek_uint32(s); /* BytesReceived (4 bytes) */ - stream_seek_uint32(s); /* AvailableWindow (4 bytes) */ + stream_seek_UINT32(s); /* BytesReceived (4 bytes) */ + stream_seek_UINT32(s); /* AvailableWindow (4 bytes) */ stream_seek(s, 16); /* ChannelCookie (16 bytes) */ } -void rts_flow_control_ack_command_write(STREAM* s, uint32 BytesReceived, uint32 AvailableWindow, uint8* ChannelCookie) +void rts_flow_control_ack_command_write(STREAM* s, UINT32 BytesReceived, UINT32 AvailableWindow, BYTE* ChannelCookie) { - stream_write_uint32(s, RTS_CMD_FLOW_CONTROL_ACK); /* CommandType (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_FLOW_CONTROL_ACK); /* CommandType (4 bytes) */ /* Ack (24 bytes) */ - stream_write_uint32(s, BytesReceived); /* BytesReceived (4 bytes) */ - stream_write_uint32(s, AvailableWindow); /* AvailableWindow (4 bytes) */ + stream_write_UINT32(s, BytesReceived); /* BytesReceived (4 bytes) */ + stream_write_UINT32(s, AvailableWindow); /* AvailableWindow (4 bytes) */ stream_write(s, ChannelCookie, 16); /* ChannelCookie (16 bytes) */ } void rts_connection_timeout_command_read(rdpRpc* rpc, STREAM* s) { - stream_seek_uint32(s); /* ConnectionTimeout (4 bytes) */ + stream_seek_UINT32(s); /* ConnectionTimeout (4 bytes) */ } -void rts_connection_timeout_command_write(STREAM* s, uint32 ConnectionTimeout) +void rts_connection_timeout_command_write(STREAM* s, UINT32 ConnectionTimeout) { - stream_write_uint32(s, RTS_CMD_CONNECTION_TIMEOUT); /* CommandType (4 bytes) */ - stream_write_uint32(s, ConnectionTimeout); /* ConnectionTimeout (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_CONNECTION_TIMEOUT); /* CommandType (4 bytes) */ + stream_write_UINT32(s, ConnectionTimeout); /* ConnectionTimeout (4 bytes) */ } void rts_cookie_command_read(rdpRpc* rpc, STREAM* s) @@ -201,43 +201,43 @@ void rts_cookie_command_read(rdpRpc* rpc, STREAM* s) stream_seek(s, 16); /* Cookie (16 bytes) */ } -void rts_cookie_command_write(STREAM* s, uint8* Cookie) +void rts_cookie_command_write(STREAM* s, BYTE* Cookie) { - stream_write_uint32(s, RTS_CMD_COOKIE); /* CommandType (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_COOKIE); /* CommandType (4 bytes) */ stream_write(s, Cookie, 16); /* Cookie (16 bytes) */ } void rts_channel_lifetime_command_read(rdpRpc* rpc, STREAM* s) { - stream_seek_uint32(s); /* ChannelLifetime (4 bytes) */ + stream_seek_UINT32(s); /* ChannelLifetime (4 bytes) */ } -void rts_channel_lifetime_command_write(STREAM* s, uint32 ChannelLifetime) +void rts_channel_lifetime_command_write(STREAM* s, UINT32 ChannelLifetime) { - stream_write_uint32(s, RTS_CMD_CHANNEL_LIFETIME); /* CommandType (4 bytes) */ - stream_write_uint32(s, ChannelLifetime); /* ChannelLifetime (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_CHANNEL_LIFETIME); /* CommandType (4 bytes) */ + stream_write_UINT32(s, ChannelLifetime); /* ChannelLifetime (4 bytes) */ } void rts_client_keepalive_command_read(rdpRpc* rpc, STREAM* s) { - stream_seek_uint32(s); /* ClientKeepalive (4 bytes) */ + stream_seek_UINT32(s); /* ClientKeepalive (4 bytes) */ } -void rts_client_keepalive_command_write(STREAM* s, uint32 ClientKeepalive) +void rts_client_keepalive_command_write(STREAM* s, UINT32 ClientKeepalive) { - stream_write_uint32(s, RTS_CMD_CLIENT_KEEPALIVE); /* CommandType (4 bytes) */ - stream_write_uint32(s, ClientKeepalive); /* ClientKeepalive (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_CLIENT_KEEPALIVE); /* CommandType (4 bytes) */ + stream_write_UINT32(s, ClientKeepalive); /* ClientKeepalive (4 bytes) */ } void rts_version_command_read(rdpRpc* rpc, STREAM* s) { - stream_seek_uint32(s); /* Version (4 bytes) */ + stream_seek_UINT32(s); /* Version (4 bytes) */ } void rts_version_command_write(STREAM* s) { - stream_write_uint32(s, RTS_CMD_VERSION); /* CommandType (4 bytes) */ - stream_write_uint32(s, 1); /* Version (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_VERSION); /* CommandType (4 bytes) */ + stream_write_UINT32(s, 1); /* Version (4 bytes) */ } void rts_empty_command_read(rdpRpc* rpc, STREAM* s) @@ -247,20 +247,20 @@ void rts_empty_command_read(rdpRpc* rpc, STREAM* s) void rts_empty_command_write(STREAM* s) { - stream_write_uint32(s, RTS_CMD_EMPTY); /* CommandType (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_EMPTY); /* CommandType (4 bytes) */ } void rts_padding_command_read(rdpRpc* rpc, STREAM* s) { - uint32 ConformanceCount; + UINT32 ConformanceCount; - stream_read_uint32(s, ConformanceCount); /* ConformanceCount (4 bytes) */ + stream_read_UINT32(s, ConformanceCount); /* ConformanceCount (4 bytes) */ stream_seek(s, ConformanceCount); /* Padding (variable) */ } -void rts_padding_command_write(STREAM* s, uint32 ConformanceCount) +void rts_padding_command_write(STREAM* s, UINT32 ConformanceCount) { - stream_write_uint32(s, ConformanceCount); /* ConformanceCount (4 bytes) */ + stream_write_UINT32(s, ConformanceCount); /* ConformanceCount (4 bytes) */ stream_write_zero(s, ConformanceCount); /* Padding (variable) */ } @@ -271,7 +271,7 @@ void rts_negative_ance_command_read(rdpRpc* rpc, STREAM* s) void rts_negative_ance_command_write(STREAM* s) { - stream_write_uint32(s, RTS_CMD_NEGATIVE_ANCE); /* CommandType (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_NEGATIVE_ANCE); /* CommandType (4 bytes) */ } void rts_ance_command_read(rdpRpc* rpc, STREAM* s) @@ -281,14 +281,14 @@ void rts_ance_command_read(rdpRpc* rpc, STREAM* s) void rts_ance_command_write(STREAM* s) { - stream_write_uint32(s, RTS_CMD_ANCE); /* CommandType (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_ANCE); /* CommandType (4 bytes) */ } void rts_client_address_command_read(rdpRpc* rpc, STREAM* s) { - uint32 AddressType; + UINT32 AddressType; - stream_read_uint32(s, AddressType); /* AddressType (4 bytes) */ + stream_read_UINT32(s, AddressType); /* AddressType (4 bytes) */ if (AddressType == 0) { @@ -302,10 +302,10 @@ void rts_client_address_command_read(rdpRpc* rpc, STREAM* s) stream_seek(s, 12); /* padding (12 bytes) */ } -void rts_client_address_command_write(STREAM* s, uint32 AddressType, uint8* ClientAddress) +void rts_client_address_command_write(STREAM* s, UINT32 AddressType, BYTE* ClientAddress) { - stream_write_uint32(s, RTS_CMD_CLIENT_ADDRESS); /* CommandType (4 bytes) */ - stream_write_uint32(s, AddressType); /* AddressType (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_CLIENT_ADDRESS); /* CommandType (4 bytes) */ + stream_write_UINT32(s, AddressType); /* AddressType (4 bytes) */ if (AddressType == 0) { @@ -324,46 +324,46 @@ void rts_association_group_id_command_read(rdpRpc* rpc, STREAM* s) stream_seek(s, 16); /* AssociationGroupId (16 bytes) */ } -void rts_association_group_id_command_write(STREAM* s, uint8* associationGroupId) +void rts_association_group_id_command_write(STREAM* s, BYTE* associationGroupId) { - stream_write_uint32(s, RTS_CMD_ASSOCIATION_GROUP_ID); /* CommandType (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_ASSOCIATION_GROUP_ID); /* CommandType (4 bytes) */ stream_write(s, associationGroupId, 16); /* AssociationGroupId (16 bytes) */ } void rts_destination_command_read(rdpRpc* rpc, STREAM* s) { - stream_seek_uint32(s); /* Destination (4 bytes) */ + stream_seek_UINT32(s); /* Destination (4 bytes) */ } -void rts_destination_command_write(STREAM* s, uint32 Destination) +void rts_destination_command_write(STREAM* s, UINT32 Destination) { - stream_write_uint32(s, RTS_CMD_DESTINATION); /* CommandType (4 bytes) */ - stream_write_uint32(s, Destination); /* Destination (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_DESTINATION); /* CommandType (4 bytes) */ + stream_write_UINT32(s, Destination); /* Destination (4 bytes) */ } void rts_ping_traffic_sent_notify_command_read(rdpRpc* rpc, STREAM* s) { - stream_seek_uint32(s); /* PingTrafficSent (4 bytes) */ + stream_seek_UINT32(s); /* PingTrafficSent (4 bytes) */ } -void rts_ping_traffic_sent_notify_command_write(STREAM* s, uint32 PingTrafficSent) +void rts_ping_traffic_sent_notify_command_write(STREAM* s, UINT32 PingTrafficSent) { - stream_write_uint32(s, RTS_CMD_PING_TRAFFIC_SENT_NOTIFY); /* CommandType (4 bytes) */ - stream_write_uint32(s, PingTrafficSent); /* PingTrafficSent (4 bytes) */ + stream_write_UINT32(s, RTS_CMD_PING_TRAFFIC_SENT_NOTIFY); /* CommandType (4 bytes) */ + stream_write_UINT32(s, PingTrafficSent); /* PingTrafficSent (4 bytes) */ } -void rpc_generate_cookie(uint8* cookie) +void rpc_generate_cookie(BYTE* cookie) { RAND_pseudo_bytes(cookie, 16); } -boolean rts_send_CONN_A1_pdu(rdpRpc* rpc) +BOOL rts_send_CONN_A1_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; - uint32 ReceiveWindowSize; - uint8* OUTChannelCookie; - uint8* VirtualConnectionCookie; + UINT32 ReceiveWindowSize; + BYTE* OUTChannelCookie; + BYTE* VirtualConnectionCookie; header.rpc_vers = 5; header.rpc_vers_minor = 0; @@ -383,11 +383,11 @@ boolean rts_send_CONN_A1_pdu(rdpRpc* rpc) s = stream_new(header.frag_length); - rpc_generate_cookie((uint8*) &(rpc->VirtualConnection->Cookie)); - rpc_generate_cookie((uint8*) &(rpc->VirtualConnection->DefaultOutChannelCookie)); + rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->Cookie)); + rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->DefaultOutChannelCookie)); - VirtualConnectionCookie = (uint8*) &(rpc->VirtualConnection->Cookie); - OUTChannelCookie = (uint8*) &(rpc->VirtualConnection->DefaultOutChannelCookie); + VirtualConnectionCookie = (BYTE*) &(rpc->VirtualConnection->Cookie); + OUTChannelCookie = (BYTE*) &(rpc->VirtualConnection->DefaultOutChannelCookie); ReceiveWindowSize = rpc->VirtualConnection->DefaultOutChannel->ReceiveWindow; rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ @@ -401,16 +401,16 @@ boolean rts_send_CONN_A1_pdu(rdpRpc* rpc) stream_free(s); - return true; + return TRUE; } -boolean rts_send_CONN_B1_pdu(rdpRpc* rpc) +BOOL rts_send_CONN_B1_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; - uint8* INChannelCookie; - uint8* AssociationGroupId; - uint8* VirtualConnectionCookie; + BYTE* INChannelCookie; + BYTE* AssociationGroupId; + BYTE* VirtualConnectionCookie; header.rpc_vers = 5; header.rpc_vers_minor = 0; @@ -430,12 +430,12 @@ boolean rts_send_CONN_B1_pdu(rdpRpc* rpc) s = stream_new(header.frag_length); - rpc_generate_cookie((uint8*) &(rpc->VirtualConnection->DefaultInChannelCookie)); - rpc_generate_cookie((uint8*) &(rpc->VirtualConnection->AssociationGroupId)); + rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->DefaultInChannelCookie)); + rpc_generate_cookie((BYTE*) &(rpc->VirtualConnection->AssociationGroupId)); - VirtualConnectionCookie = (uint8*) &(rpc->VirtualConnection->Cookie); - INChannelCookie = (uint8*) &(rpc->VirtualConnection->DefaultInChannelCookie); - AssociationGroupId = (uint8*) &(rpc->VirtualConnection->AssociationGroupId); + VirtualConnectionCookie = (BYTE*) &(rpc->VirtualConnection->Cookie); + INChannelCookie = (BYTE*) &(rpc->VirtualConnection->DefaultInChannelCookie); + AssociationGroupId = (BYTE*) &(rpc->VirtualConnection->AssociationGroupId); rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ rts_version_command_write(s); /* Version (8 bytes) */ @@ -450,10 +450,10 @@ boolean rts_send_CONN_B1_pdu(rdpRpc* rpc) stream_free(s); - return true; + return TRUE; } -boolean rts_send_keep_alive_pdu(rdpRpc* rpc) +BOOL rts_send_keep_alive_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; @@ -483,16 +483,16 @@ boolean rts_send_keep_alive_pdu(rdpRpc* rpc) stream_free(s); - return true; + return TRUE; } -boolean rts_send_flow_control_ack_pdu(rdpRpc* rpc) +BOOL rts_send_flow_control_ack_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; - uint32 BytesReceived; - uint32 AvailableWindow; - uint8* ChannelCookie; + UINT32 BytesReceived; + UINT32 AvailableWindow; + BYTE* ChannelCookie; header.rpc_vers = 5; header.rpc_vers_minor = 0; @@ -512,7 +512,7 @@ boolean rts_send_flow_control_ack_pdu(rdpRpc* rpc) BytesReceived = rpc->VirtualConnection->DefaultOutChannel->BytesReceived; AvailableWindow = rpc->VirtualConnection->DefaultOutChannel->ReceiverAvailableWindow; - ChannelCookie = (uint8*) &(rpc->VirtualConnection->DefaultOutChannelCookie); + ChannelCookie = (BYTE*) &(rpc->VirtualConnection->DefaultOutChannelCookie); s = stream_new(header.frag_length); rts_pdu_header_write(s, &header); /* RTS Header (20 bytes) */ @@ -527,10 +527,10 @@ boolean rts_send_flow_control_ack_pdu(rdpRpc* rpc) stream_free(s); - return true; + return TRUE; } -boolean rts_send_ping_pdu(rdpRpc* rpc) +BOOL rts_send_ping_pdu(rdpRpc* rpc) { STREAM* s; RTS_PDU_HEADER header; @@ -559,14 +559,14 @@ boolean rts_send_ping_pdu(rdpRpc* rpc) stream_free(s); - return true; + return TRUE; } int rts_recv_pdu_commands(rdpRpc* rpc, RTS_PDU* rts_pdu) { int i; STREAM* s; - uint32 CommandType; + UINT32 CommandType; DEBUG_RTS("numberOfCommands:%d", rts_pdu->header.numberOfCommands); @@ -581,7 +581,7 @@ int rts_recv_pdu_commands(rdpRpc* rpc, RTS_PDU* rts_pdu) for (i = 0; i < rts_pdu->header.numberOfCommands; i++) { - stream_read_uint32(s, CommandType); /* CommandType (4 bytes) */ + stream_read_UINT32(s, CommandType); /* CommandType (4 bytes) */ DEBUG_RTS("CommandType: %s (0x%08X)", RTS_CMD_STRINGS[CommandType % 14], CommandType); @@ -667,11 +667,11 @@ int rts_recv_pdu(rdpRpc* rpc, RTS_PDU* rts_pdu) STREAM* s; int status; int length; - uint8 header_buffer[20]; + BYTE header_buffer[20]; rdpTls* tls_out = rpc->tls_out; /* read first 20 bytes to get RTS PDU Header */ - status = tls_read(tls_out, (uint8*) &header_buffer, 20); + status = tls_read(tls_out, (BYTE*) &header_buffer, 20); if (status <= 0) { @@ -688,7 +688,7 @@ int rts_recv_pdu(rdpRpc* rpc, RTS_PDU* rts_pdu) stream_free(s); length = rts_pdu->header.frag_length - 20; - rts_pdu->content = (uint8*) xmalloc(length); + rts_pdu->content = (BYTE*) malloc(length); status = tls_read(tls_out, rts_pdu->content, length); diff --git a/libfreerdp/core/rts.h b/libfreerdp/core/rts.h index 449c0e2b3..7cab90011 100644 --- a/libfreerdp/core/rts.h +++ b/libfreerdp/core/rts.h @@ -93,67 +93,67 @@ struct _rts_pdu_header { - uint8 rpc_vers; - uint8 rpc_vers_minor; - uint8 ptype; - uint8 pfc_flags; - uint8 packed_drep[4]; - uint16 frag_length; - uint16 auth_length; - uint32 call_id; - uint16 flags; - uint16 numberOfCommands; + BYTE rpc_vers; + BYTE rpc_vers_minor; + BYTE ptype; + BYTE pfc_flags; + BYTE packed_drep[4]; + UINT16 frag_length; + UINT16 auth_length; + UINT32 call_id; + UINT16 flags; + UINT16 numberOfCommands; }; typedef struct _rts_pdu_header RTS_PDU_HEADER; struct _rts_pdu { RTS_PDU_HEADER header; - uint8* content; + BYTE* content; }; typedef struct _rts_pdu RTS_PDU; -boolean rts_connect(rdpRpc* rpc); +BOOL rts_connect(rdpRpc* rpc); void rts_pdu_header_read(STREAM* s, RTS_PDU_HEADER* header); void rts_pdu_header_write(STREAM* s, RTS_PDU_HEADER* header); void rts_receive_window_size_command_read(rdpRpc* rpc, STREAM* s); -void rts_receive_window_size_command_write(STREAM* s, uint32 ReceiveWindowSize); +void rts_receive_window_size_command_write(STREAM* s, UINT32 ReceiveWindowSize); void rts_flow_control_ack_command_read(rdpRpc* rpc, STREAM* s); -void rts_flow_control_ack_command_write(STREAM* s, uint32 BytesReceived, uint32 AvailableWindow, uint8* ChannelCookie); +void rts_flow_control_ack_command_write(STREAM* s, UINT32 BytesReceived, UINT32 AvailableWindow, BYTE* ChannelCookie); void rts_connection_timeout_command_read(rdpRpc* rpc, STREAM* s); -void rts_connection_timeout_command_write(STREAM* s, uint32 ConnectionTimeout); +void rts_connection_timeout_command_write(STREAM* s, UINT32 ConnectionTimeout); void rts_cookie_command_read(rdpRpc* rpc, STREAM* s); -void rts_cookie_command_write(STREAM* s, uint8* Cookie); +void rts_cookie_command_write(STREAM* s, BYTE* Cookie); void rts_channel_lifetime_command_read(rdpRpc* rpc, STREAM* s); -void rts_channel_lifetime_command_write(STREAM* s, uint32 ChannelLifetime); +void rts_channel_lifetime_command_write(STREAM* s, UINT32 ChannelLifetime); void rts_client_keepalive_command_read(rdpRpc* rpc, STREAM* s); -void rts_client_keepalive_command_write(STREAM* s, uint32 ClientKeepalive); +void rts_client_keepalive_command_write(STREAM* s, UINT32 ClientKeepalive); void rts_version_command_read(rdpRpc* rpc, STREAM* s); void rts_version_command_write(STREAM* s); void rts_empty_command_read(rdpRpc* rpc, STREAM* s); void rts_empty_command_write(STREAM* s); void rts_padding_command_read(rdpRpc* rpc, STREAM* s); -void rts_padding_command_write(STREAM* s, uint32 ConformanceCount); +void rts_padding_command_write(STREAM* s, UINT32 ConformanceCount); void rts_negative_ance_command_read(rdpRpc* rpc, STREAM* s); void rts_negative_ance_command_write(STREAM* s); void rts_ance_command_read(rdpRpc* rpc, STREAM* s); void rts_ance_command_write(STREAM* s); void rts_client_address_command_read(rdpRpc* rpc, STREAM* s); -void rts_client_address_command_write(STREAM* s, uint32 AddressType, uint8* ClientAddress); +void rts_client_address_command_write(STREAM* s, UINT32 AddressType, BYTE* ClientAddress); void rts_association_group_id_command_read(rdpRpc* rpc, STREAM* s); -void rts_association_group_id_command_write(STREAM* s, uint8* AssociationGroupId); +void rts_association_group_id_command_write(STREAM* s, BYTE* AssociationGroupId); void rts_destination_command_read(rdpRpc* rpc, STREAM* s); -void rts_destination_command_write(STREAM* s, uint32 Destination); +void rts_destination_command_write(STREAM* s, UINT32 Destination); void rts_ping_traffic_sent_notify_command_read(rdpRpc* rpc, STREAM* s); -void rts_ping_traffic_sent_notify_command_write(STREAM* s, uint32 PingTrafficSent); +void rts_ping_traffic_sent_notify_command_write(STREAM* s, UINT32 PingTrafficSent); -boolean rts_send_CONN_A1_pdu(rdpRpc* rpc); -boolean rts_send_CONN_B1_pdu(rdpRpc* rpc); -boolean rts_send_keep_alive_pdu(rdpRpc* rpc); -boolean rts_send_flow_control_ack_pdu(rdpRpc* rpc); -boolean rts_send_ping_pdu(rdpRpc* rpc); +BOOL rts_send_CONN_A1_pdu(rdpRpc* rpc); +BOOL rts_send_CONN_B1_pdu(rdpRpc* rpc); +BOOL rts_send_keep_alive_pdu(rdpRpc* rpc); +BOOL rts_send_flow_control_ack_pdu(rdpRpc* rpc); +BOOL rts_send_ping_pdu(rdpRpc* rpc); int rts_recv_pdu(rdpRpc* rpc, RTS_PDU* rts_pdu); diff --git a/libfreerdp/core/security.c b/libfreerdp/core/security.c index b15a551d6..29c50cdfd 100644 --- a/libfreerdp/core/security.c +++ b/libfreerdp/core/security.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Security * * Copyright 2011 Marc-Andre Moreau @@ -24,7 +24,7 @@ #include "security.h" /* 0x36 repeated 40 times */ -static const uint8 pad1[40] = +static const BYTE pad1[40] = { "\x36\x36\x36\x36\x36\x36\x36\x36" "\x36\x36\x36\x36\x36\x36\x36\x36" @@ -34,7 +34,7 @@ static const uint8 pad1[40] = }; /* 0x5C repeated 48 times */ -static const uint8 pad2[48] = +static const BYTE pad2[48] = { "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C" "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C" @@ -44,7 +44,7 @@ static const uint8 pad2[48] = "\x5C\x5C\x5C\x5C\x5C\x5C\x5C\x5C" }; -static const uint8 +static const BYTE fips_reverse_table[256] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, @@ -81,7 +81,7 @@ fips_reverse_table[256] = 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; -static const uint8 +static const BYTE fips_oddparity_table[256] = { 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x07, 0x07, @@ -118,11 +118,11 @@ fips_oddparity_table[256] = 0xf8, 0xf8, 0xfb, 0xfb, 0xfd, 0xfd, 0xfe, 0xfe }; -static void security_salted_hash(uint8* salt, uint8* input, int length, uint8* salt1, uint8* salt2, uint8* output) +static void security_salted_hash(BYTE* salt, BYTE* input, int length, BYTE* salt1, BYTE* salt2, BYTE* output) { CryptoMd5 md5; CryptoSha1 sha1; - uint8 sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; + BYTE sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; /* SaltedHash(Salt, Input, Salt1, Salt2) = MD5(S + SHA1(Input + Salt + Salt1 + Salt2)) */ @@ -141,13 +141,13 @@ static void security_salted_hash(uint8* salt, uint8* input, int length, uint8* s crypto_md5_final(md5, output); } -static void security_premaster_hash(char* input, int length, uint8* premaster_secret, uint8* client_random, uint8* server_random, uint8* output) +static void security_premaster_hash(char* input, int length, BYTE* premaster_secret, BYTE* client_random, BYTE* server_random, BYTE* output) { /* PremasterHash(Input) = SaltedHash(PremasterSecret, Input, ClientRandom, ServerRandom) */ - security_salted_hash(premaster_secret, (uint8*)input, length, client_random, server_random, output); + security_salted_hash(premaster_secret, (BYTE*)input, length, client_random, server_random, output); } -void security_master_secret(uint8* premaster_secret, uint8* client_random, uint8* server_random, uint8* output) +void security_master_secret(BYTE* premaster_secret, BYTE* client_random, BYTE* server_random, BYTE* output) { /* MasterSecret = PremasterHash('A') + PremasterHash('BB') + PremasterHash('CCC') */ security_premaster_hash("A", 1, premaster_secret, client_random, server_random, &output[0]); @@ -155,13 +155,13 @@ void security_master_secret(uint8* premaster_secret, uint8* client_random, uint8 security_premaster_hash("CCC", 3, premaster_secret, client_random, server_random, &output[32]); } -static void security_master_hash(char* input, int length, uint8* master_secret, uint8* client_random, uint8* server_random, uint8* output) +static void security_master_hash(char* input, int length, BYTE* master_secret, BYTE* client_random, BYTE* server_random, BYTE* output) { /* MasterHash(Input) = SaltedHash(MasterSecret, Input, ServerRandom, ClientRandom) */ - security_salted_hash(master_secret, (uint8*)input, length, server_random, client_random, output); + security_salted_hash(master_secret, (BYTE*)input, length, server_random, client_random, output); } -void security_session_key_blob(uint8* master_secret, uint8* client_random, uint8* server_random, uint8* output) +void security_session_key_blob(BYTE* master_secret, BYTE* client_random, BYTE* server_random, BYTE* output) { /* MasterHash = MasterHash('A') + MasterHash('BB') + MasterHash('CCC') */ security_master_hash("A", 1, master_secret, client_random, server_random, &output[0]); @@ -169,13 +169,13 @@ void security_session_key_blob(uint8* master_secret, uint8* client_random, uint8 security_master_hash("CCC", 3, master_secret, client_random, server_random, &output[32]); } -void security_mac_salt_key(uint8* session_key_blob, uint8* client_random, uint8* server_random, uint8* output) +void security_mac_salt_key(BYTE* session_key_blob, BYTE* client_random, BYTE* server_random, BYTE* output) { /* MacSaltKey = First128Bits(SessionKeyBlob) */ memcpy(output, session_key_blob, 16); } -void security_md5_16_32_32(uint8* in0, uint8* in1, uint8* in2, uint8* output) +void security_md5_16_32_32(BYTE* in0, BYTE* in1, BYTE* in2, BYTE* output) { CryptoMd5 md5; @@ -186,13 +186,13 @@ void security_md5_16_32_32(uint8* in0, uint8* in1, uint8* in2, uint8* output) crypto_md5_final(md5, output); } -void security_licensing_encryption_key(uint8* session_key_blob, uint8* client_random, uint8* server_random, uint8* output) +void security_licensing_encryption_key(BYTE* session_key_blob, BYTE* client_random, BYTE* server_random, BYTE* output) { /* LicensingEncryptionKey = MD5(Second128Bits(SessionKeyBlob) + ClientRandom + ServerRandom)) */ security_md5_16_32_32(&session_key_blob[16], client_random, server_random, output); } -void security_uint32_le(uint8* output, uint32 value) +void security_UINT32_le(BYTE* output, UINT32 value) { output[0] = (value) & 0xFF; output[1] = (value >> 8) & 0xFF; @@ -200,16 +200,16 @@ void security_uint32_le(uint8* output, uint32 value) output[3] = (value >> 24) & 0xFF; } -void security_mac_data(uint8* mac_salt_key, uint8* data, uint32 length, uint8* output) +void security_mac_data(BYTE* mac_salt_key, BYTE* data, UINT32 length, BYTE* output) { CryptoMd5 md5; CryptoSha1 sha1; - uint8 length_le[4]; - uint8 sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; + BYTE length_le[4]; + BYTE sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; /* MacData = MD5(MacSaltKey + pad2 + SHA1(MacSaltKey + pad1 + length + data)) */ - security_uint32_le(length_le, length); /* length must be little-endian */ + security_UINT32_le(length_le, length); /* length must be little-endian */ /* SHA1_Digest = SHA1(MacSaltKey + pad1 + length + data) */ sha1 = crypto_sha1_init(); @@ -227,15 +227,15 @@ void security_mac_data(uint8* mac_salt_key, uint8* data, uint32 length, uint8* o crypto_md5_final(md5, output); } -void security_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, uint8* output) +void security_mac_signature(rdpRdp *rdp, BYTE* data, UINT32 length, BYTE* output) { CryptoMd5 md5; CryptoSha1 sha1; - uint8 length_le[4]; - uint8 md5_digest[CRYPTO_MD5_DIGEST_LENGTH]; - uint8 sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; + BYTE length_le[4]; + BYTE md5_digest[CRYPTO_MD5_DIGEST_LENGTH]; + BYTE sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; - security_uint32_le(length_le, length); /* length must be little-endian */ + security_UINT32_le(length_le, length); /* length must be little-endian */ /* SHA1_Digest = SHA1(MACKeyN + pad1 + length + data) */ sha1 = crypto_sha1_init(); @@ -255,19 +255,19 @@ void security_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, uint8* outp memcpy(output, md5_digest, 8); } -void security_salted_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, boolean encryption, uint8* output) +void security_salted_mac_signature(rdpRdp *rdp, BYTE* data, UINT32 length, BOOL encryption, BYTE* output) { CryptoMd5 md5; CryptoSha1 sha1; - uint8 length_le[4]; - uint8 use_count_le[4]; - uint8 md5_digest[CRYPTO_MD5_DIGEST_LENGTH]; - uint8 sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; + BYTE length_le[4]; + BYTE use_count_le[4]; + BYTE md5_digest[CRYPTO_MD5_DIGEST_LENGTH]; + BYTE sha1_digest[CRYPTO_SHA1_DIGEST_LENGTH]; - security_uint32_le(length_le, length); /* length must be little-endian */ + security_UINT32_le(length_le, length); /* length must be little-endian */ if (encryption) { - security_uint32_le(use_count_le, rdp->encrypt_checksum_use_count); + security_UINT32_le(use_count_le, rdp->encrypt_checksum_use_count); } else { @@ -276,7 +276,7 @@ void security_salted_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, bool * decrypt it, which means decrypt_checksum_use_count is * off by one. */ - security_uint32_le(use_count_le, rdp->decrypt_checksum_use_count - 1); + security_UINT32_le(use_count_le, rdp->decrypt_checksum_use_count - 1); } /* SHA1_Digest = SHA1(MACKeyN + pad1 + length + data) */ @@ -298,23 +298,23 @@ void security_salted_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, bool memcpy(output, md5_digest, 8); } -static void security_A(uint8* master_secret, uint8* client_random, uint8* server_random, uint8* output) +static void security_A(BYTE* master_secret, BYTE* client_random, BYTE* server_random, BYTE* output) { security_premaster_hash("A", 1, master_secret, client_random, server_random, &output[0]); security_premaster_hash("BB", 2, master_secret, client_random, server_random, &output[16]); security_premaster_hash("CCC", 3, master_secret, client_random, server_random, &output[32]); } -static void security_X(uint8* master_secret, uint8* client_random, uint8* server_random, uint8* output) +static void security_X(BYTE* master_secret, BYTE* client_random, BYTE* server_random, BYTE* output) { security_premaster_hash("X", 1, master_secret, client_random, server_random, &output[0]); security_premaster_hash("YY", 2, master_secret, client_random, server_random, &output[16]); security_premaster_hash("ZZZ", 3, master_secret, client_random, server_random, &output[32]); } -static void fips_expand_key_bits(uint8* in, uint8* out) +static void fips_expand_key_bits(BYTE* in, BYTE* out) { - uint8 buf[21], c; + BYTE buf[21], c; int i, b, p, r; /* reverse every byte in the key */ @@ -345,13 +345,13 @@ static void fips_expand_key_bits(uint8* in, uint8* out) out[i] = fips_oddparity_table[fips_reverse_table[out[i]]]; } -boolean security_establish_keys(uint8* client_random, rdpRdp* rdp) +BOOL security_establish_keys(BYTE* client_random, rdpRdp* rdp) { - uint8 pre_master_secret[48]; - uint8 master_secret[48]; - uint8 session_key_blob[48]; - uint8* server_random; - uint8 salt40[] = { 0xD1, 0x26, 0x9E }; + BYTE pre_master_secret[48]; + BYTE master_secret[48]; + BYTE session_key_blob[48]; + BYTE* server_random; + BYTE salt40[] = { 0xD1, 0x26, 0x9E }; rdpSettings* settings; settings = rdp->settings; @@ -360,13 +360,13 @@ boolean security_establish_keys(uint8* client_random, rdpRdp* rdp) if (settings->encryption_method == ENCRYPTION_METHOD_FIPS) { CryptoSha1 sha1; - uint8 client_encrypt_key_t[CRYPTO_SHA1_DIGEST_LENGTH + 1]; - uint8 client_decrypt_key_t[CRYPTO_SHA1_DIGEST_LENGTH + 1]; + BYTE client_encrypt_key_t[CRYPTO_SHA1_DIGEST_LENGTH + 1]; + BYTE client_decrypt_key_t[CRYPTO_SHA1_DIGEST_LENGTH + 1]; printf("FIPS Compliant encryption level.\n"); /* disable fastpath input; it doesnt handle FIPS encryption yet */ - rdp->settings->fastpath_input = false; + rdp->settings->fastpath_input = FALSE; sha1 = crypto_sha1_init(); crypto_sha1_update(sha1, client_random + 16, 16); @@ -432,16 +432,16 @@ boolean security_establish_keys(uint8* client_random, rdpRdp* rdp) rdp->encrypt_use_count =0; rdp->encrypt_checksum_use_count =0; - return true; + return TRUE; } -boolean security_key_update(uint8* key, uint8* update_key, int key_len) +BOOL security_key_update(BYTE* key, BYTE* update_key, int key_len) { - uint8 sha1h[CRYPTO_SHA1_DIGEST_LENGTH]; + BYTE sha1h[CRYPTO_SHA1_DIGEST_LENGTH]; CryptoMd5 md5; CryptoSha1 sha1; CryptoRc4 rc4; - uint8 salt40[] = { 0xD1, 0x26, 0x9E }; + BYTE salt40[] = { 0xD1, 0x26, 0x9E }; sha1 = crypto_sha1_init(); crypto_sha1_update(sha1, update_key, key_len); @@ -462,10 +462,10 @@ boolean security_key_update(uint8* key, uint8* update_key, int key_len) if (key_len == 8) memcpy(key, salt40, 3); /* TODO 56 bit */ - return true; + return TRUE; } -boolean security_encrypt(uint8* data, int length, rdpRdp* rdp) +BOOL security_encrypt(BYTE* data, int length, rdpRdp* rdp) { if (rdp->encrypt_use_count >= 4096) { @@ -477,10 +477,10 @@ boolean security_encrypt(uint8* data, int length, rdpRdp* rdp) crypto_rc4(rdp->rc4_encrypt_key, length, data, data); rdp->encrypt_use_count++; rdp->encrypt_checksum_use_count++; - return true; + return TRUE; } -boolean security_decrypt(uint8* data, int length, rdpRdp* rdp) +BOOL security_decrypt(BYTE* data, int length, rdpRdp* rdp) { if (rdp->decrypt_use_count >= 4096) { @@ -492,15 +492,15 @@ boolean security_decrypt(uint8* data, int length, rdpRdp* rdp) crypto_rc4(rdp->rc4_decrypt_key, length, data, data); rdp->decrypt_use_count += 1; rdp->decrypt_checksum_use_count++; - return true; + return TRUE; } -void security_hmac_signature(uint8* data, int length, uint8* output, rdpRdp* rdp) +void security_hmac_signature(BYTE* data, int length, BYTE* output, rdpRdp* rdp) { - uint8 buf[20]; - uint8 use_count_le[4]; + BYTE buf[20]; + BYTE use_count_le[4]; - security_uint32_le(use_count_le, rdp->encrypt_use_count); + security_UINT32_le(use_count_le, rdp->encrypt_use_count); crypto_hmac_sha1_init(rdp->fips_hmac, rdp->fips_sign_key, 20); crypto_hmac_update(rdp->fips_hmac, data, length); @@ -510,25 +510,25 @@ void security_hmac_signature(uint8* data, int length, uint8* output, rdpRdp* rdp memmove(output, buf, 8); } -boolean security_fips_encrypt(uint8* data, int length, rdpRdp* rdp) +BOOL security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp) { crypto_des3_encrypt(rdp->fips_encrypt, length, data, data); rdp->encrypt_use_count++; - return true; + return TRUE; } -boolean security_fips_decrypt(uint8* data, int length, rdpRdp* rdp) +BOOL security_fips_decrypt(BYTE* data, int length, rdpRdp* rdp) { crypto_des3_decrypt(rdp->fips_decrypt, length, data, data); - return true; + return TRUE; } -boolean security_fips_check_signature(uint8* data, int length, uint8* sig, rdpRdp* rdp) +BOOL security_fips_check_signature(BYTE* data, int length, BYTE* sig, rdpRdp* rdp) { - uint8 buf[20]; - uint8 use_count_le[4]; + BYTE buf[20]; + BYTE use_count_le[4]; - security_uint32_le(use_count_le, rdp->decrypt_use_count); + security_UINT32_le(use_count_le, rdp->decrypt_use_count); crypto_hmac_sha1_init(rdp->fips_hmac, rdp->fips_sign_key, 20); crypto_hmac_update(rdp->fips_hmac, data, length); @@ -538,7 +538,7 @@ boolean security_fips_check_signature(uint8* data, int length, uint8* sig, rdpRd rdp->decrypt_use_count++; if (memcmp(sig, buf, 8)) - return false; + return FALSE; - return true; + return TRUE; } diff --git a/libfreerdp/core/security.h b/libfreerdp/core/security.h index 6ca12ebb6..c493921f1 100644 --- a/libfreerdp/core/security.h +++ b/libfreerdp/core/security.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Security * * Copyright 2011 Marc-Andre Moreau @@ -26,22 +26,22 @@ #include #include -void security_master_secret(uint8* premaster_secret, uint8* client_random, uint8* server_random, uint8* output); -void security_session_key_blob(uint8* master_secret, uint8* client_random, uint8* server_random, uint8* output); -void security_mac_salt_key(uint8* session_key_blob, uint8* client_random, uint8* server_random, uint8* output); -void security_licensing_encryption_key(uint8* session_key_blob, uint8* client_random, uint8* server_random, uint8* output); -void security_mac_data(uint8* mac_salt_key, uint8* data, uint32 length, uint8* output); +void security_master_secret(BYTE* premaster_secret, BYTE* client_random, BYTE* server_random, BYTE* output); +void security_session_key_blob(BYTE* master_secret, BYTE* client_random, BYTE* server_random, BYTE* output); +void security_mac_salt_key(BYTE* session_key_blob, BYTE* client_random, BYTE* server_random, BYTE* output); +void security_licensing_encryption_key(BYTE* session_key_blob, BYTE* client_random, BYTE* server_random, BYTE* output); +void security_mac_data(BYTE* mac_salt_key, BYTE* data, UINT32 length, BYTE* output); -void security_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, uint8* output); -void security_salted_mac_signature(rdpRdp *rdp, uint8* data, uint32 length, boolean encryption, uint8* output); -boolean security_establish_keys(uint8* client_random, rdpRdp* rdp); +void security_mac_signature(rdpRdp *rdp, BYTE* data, UINT32 length, BYTE* output); +void security_salted_mac_signature(rdpRdp *rdp, BYTE* data, UINT32 length, BOOL encryption, BYTE* output); +BOOL security_establish_keys(BYTE* client_random, rdpRdp* rdp); -boolean security_encrypt(uint8* data, int length, rdpRdp* rdp); -boolean security_decrypt(uint8* data, int length, rdpRdp* rdp); +BOOL security_encrypt(BYTE* data, int length, rdpRdp* rdp); +BOOL security_decrypt(BYTE* data, int length, rdpRdp* rdp); -void security_hmac_signature(uint8* data, int length, uint8* output, rdpRdp* rdp); -boolean security_fips_encrypt(uint8* data, int length, rdpRdp* rdp); -boolean security_fips_decrypt(uint8* data, int length, rdpRdp* rdp); -boolean security_fips_check_signature(uint8* data, int length, uint8* sig, rdpRdp* rdp); +void security_hmac_signature(BYTE* data, int length, BYTE* output, rdpRdp* rdp); +BOOL security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp); +BOOL security_fips_decrypt(BYTE* data, int length, rdpRdp* rdp); +BOOL security_fips_check_signature(BYTE* data, int length, BYTE* sig, rdpRdp* rdp); #endif /* __SECURITY_H */ diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index 9af876501..aa5b42471 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RDP Settings * * Copyright 2009-2011 Jay Sorg @@ -30,11 +30,12 @@ #include #endif +#include +#include + #include #include -#include - static const char client_dll[] = "C:\\Windows\\System32\\mstscax.dll"; void settings_client_load_hkey_local_machine(rdpSettings* settings) @@ -135,96 +136,96 @@ rdpSettings* settings_new(void* instance) /* Server instances are NULL */ if (!settings->instance) - settings->server_mode = true; + settings->server_mode = TRUE; settings->width = 1024; settings->height = 768; - settings->workarea = false; - settings->fullscreen = false; - settings->grab_keyboard = true; - settings->decorations = true; + settings->workarea = FALSE; + settings->fullscreen = FALSE; + settings->grab_keyboard = TRUE; + settings->decorations = TRUE; settings->rdp_version = 7; settings->color_depth = 16; - settings->nla_security = true; - settings->tls_security = true; - settings->rdp_security = true; - settings->security_layer_negotiation = true; + settings->nla_security = TRUE; + settings->tls_security = TRUE; + settings->rdp_security = TRUE; + settings->security_layer_negotiation = TRUE; settings->client_build = 2600; settings->kbd_type = 4; /* @msdn{cc240510} 'IBM enhanced (101- or 102-key) keyboard' */ settings->kbd_subtype = 0; settings->kbd_fn_keys = 12; settings->kbd_layout = 0; - settings->encryption = false; - settings->salted_checksum = true; + settings->encryption = FALSE; + settings->salted_checksum = TRUE; settings->port = 3389; - settings->desktop_resize = true; + settings->desktop_resize = TRUE; settings->performance_flags = PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS | PERF_DISABLE_WALLPAPER; - settings->auto_reconnection = true; + settings->auto_reconnection = TRUE; settings->encryption_method = ENCRYPTION_METHOD_NONE; settings->encryption_level = ENCRYPTION_LEVEL_NONE; - settings->authentication = true; - settings->authentication_only = false; - settings->from_stdin = false; + settings->authentication = TRUE; + settings->authentication_only = FALSE; + settings->from_stdin = FALSE; settings->received_caps = xzalloc(32); settings->order_support = xzalloc(32); - settings->order_support[NEG_DSTBLT_INDEX] = true; - settings->order_support[NEG_PATBLT_INDEX] = true; - settings->order_support[NEG_SCRBLT_INDEX] = true; - settings->order_support[NEG_OPAQUE_RECT_INDEX] = true; - settings->order_support[NEG_DRAWNINEGRID_INDEX] = true; - settings->order_support[NEG_MULTIDSTBLT_INDEX] = true; - settings->order_support[NEG_MULTIPATBLT_INDEX] = true; - settings->order_support[NEG_MULTISCRBLT_INDEX] = true; - settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = true; - settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = true; - settings->order_support[NEG_LINETO_INDEX] = true; - settings->order_support[NEG_POLYLINE_INDEX] = true; - settings->order_support[NEG_MEMBLT_INDEX] = true; - settings->order_support[NEG_MEM3BLT_INDEX] = true; - settings->order_support[NEG_SAVEBITMAP_INDEX] = true; - settings->order_support[NEG_GLYPH_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_GLYPH_INDEX] = true; - settings->order_support[NEG_POLYGON_SC_INDEX] = true; - settings->order_support[NEG_POLYGON_CB_INDEX] = true; - settings->order_support[NEG_ELLIPSE_SC_INDEX] = true; - settings->order_support[NEG_ELLIPSE_CB_INDEX] = true; + settings->order_support[NEG_DSTBLT_INDEX] = TRUE; + settings->order_support[NEG_PATBLT_INDEX] = TRUE; + settings->order_support[NEG_SCRBLT_INDEX] = TRUE; + settings->order_support[NEG_OPAQUE_RECT_INDEX] = TRUE; + settings->order_support[NEG_DRAWNINEGRID_INDEX] = TRUE; + settings->order_support[NEG_MULTIDSTBLT_INDEX] = TRUE; + settings->order_support[NEG_MULTIPATBLT_INDEX] = TRUE; + settings->order_support[NEG_MULTISCRBLT_INDEX] = TRUE; + settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = TRUE; + settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = TRUE; + settings->order_support[NEG_LINETO_INDEX] = TRUE; + settings->order_support[NEG_POLYLINE_INDEX] = TRUE; + settings->order_support[NEG_MEMBLT_INDEX] = TRUE; + settings->order_support[NEG_MEM3BLT_INDEX] = TRUE; + settings->order_support[NEG_SAVEBITMAP_INDEX] = TRUE; + settings->order_support[NEG_GLYPH_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_GLYPH_INDEX] = TRUE; + settings->order_support[NEG_POLYGON_SC_INDEX] = TRUE; + settings->order_support[NEG_POLYGON_CB_INDEX] = TRUE; + settings->order_support[NEG_ELLIPSE_SC_INDEX] = TRUE; + settings->order_support[NEG_ELLIPSE_CB_INDEX] = TRUE; settings->client_hostname = xzalloc(32); settings->client_product_id = xzalloc(32); - settings->color_pointer = true; - settings->large_pointer = true; + settings->color_pointer = TRUE; + settings->large_pointer = TRUE; settings->pointer_cache_size = 20; - settings->sound_beeps = true; - settings->disable_wallpaper = false; - settings->disable_full_window_drag = false; - settings->disable_menu_animations = false; - settings->disable_theming = false; + settings->sound_beeps = TRUE; + settings->disable_wallpaper = FALSE; + settings->disable_full_window_drag = FALSE; + settings->disable_menu_animations = FALSE; + settings->disable_theming = FALSE; settings->connection_type = 0; - settings->draw_gdi_plus = false; + settings->draw_gdi_plus = FALSE; - settings->frame_marker = false; - settings->bitmap_cache_v3 = false; + settings->frame_marker = FALSE; + settings->bitmap_cache_v3 = FALSE; - settings->bitmap_cache = true; - settings->persistent_bitmap_cache = false; + settings->bitmap_cache = TRUE; + settings->persistent_bitmap_cache = FALSE; settings->bitmapCacheV2CellInfo = xzalloc(sizeof(BITMAP_CACHE_V2_CELL_INFO) * 6); - settings->refresh_rect = true; - settings->suppress_output = true; + settings->refresh_rect = TRUE; + settings->suppress_output = TRUE; - settings->glyph_cache = true; + settings->glyph_cache = TRUE; settings->glyphSupportLevel = GLYPH_SUPPORT_NONE; settings->glyphCache = xzalloc(sizeof(GLYPH_CACHE_DEFINITION) * 10); settings->fragCache = xnew(GLYPH_CACHE_DEFINITION); @@ -251,14 +252,14 @@ rdpSettings* settings_new(void* instance) settings->fragCache->cacheEntries = 256; settings->fragCache->cacheMaximumCellSize = 256; - settings->offscreen_bitmap_cache = true; + settings->offscreen_bitmap_cache = TRUE; settings->offscreen_bitmap_cache_size = 7680; settings->offscreen_bitmap_cache_entries = 2000; settings->draw_nine_grid_cache_size = 2560; settings->draw_nine_grid_cache_entries = 256; - settings->client_dir = xstrdup(client_dll); + settings->client_dir = _strdup(client_dll); settings->num_icon_caches = 3; settings->num_icon_cache_entries = 12; @@ -267,14 +268,14 @@ rdpSettings* settings_new(void* instance) settings->multifrag_max_request_size = 0x200000; - settings->fastpath_input = true; - settings->fastpath_output = true; + settings->fastpath_input = TRUE; + settings->fastpath_output = TRUE; settings->frame_acknowledge = 2; gethostname(settings->client_hostname, 31); settings->client_hostname[31] = 0; - settings->mouse_motion = true; + settings->mouse_motion = TRUE; settings->client_auto_reconnect_cookie = xnew(ARC_CS_PRIVATE_PACKET); settings->server_auto_reconnect_cookie = xnew(ARC_SC_PRIVATE_PACKET); @@ -293,34 +294,34 @@ void settings_free(rdpSettings* settings) { if (settings != NULL) { - xfree(settings->hostname); - xfree(settings->username); - xfree(settings->password); - xfree(settings->domain); - xfree(settings->shell); - xfree(settings->directory); - xfree(settings->ip_address); - xfree(settings->client_dir); - xfree(settings->cert_file); - xfree(settings->privatekey_file); - xfree(settings->received_caps); - xfree(settings->order_support); - xfree(settings->client_hostname); - xfree(settings->client_product_id); - xfree(settings->server_random); - xfree(settings->server_certificate); - xfree(settings->rdp_key_file); + free(settings->hostname); + free(settings->username); + free(settings->password); + free(settings->domain); + free(settings->shell); + free(settings->directory); + free(settings->ip_address); + free(settings->client_dir); + free(settings->cert_file); + free(settings->privatekey_file); + free(settings->received_caps); + free(settings->order_support); + free(settings->client_hostname); + free(settings->client_product_id); + free(settings->server_random); + free(settings->server_certificate); + free(settings->rdp_key_file); certificate_free(settings->server_cert); - xfree(settings->client_auto_reconnect_cookie); - xfree(settings->server_auto_reconnect_cookie); - xfree(settings->client_time_zone); - xfree(settings->bitmapCacheV2CellInfo); - xfree(settings->glyphCache); - xfree(settings->fragCache); + free(settings->client_auto_reconnect_cookie); + free(settings->server_auto_reconnect_cookie); + free(settings->client_time_zone); + free(settings->bitmapCacheV2CellInfo); + free(settings->glyphCache); + free(settings->fragCache); key_free(settings->server_key); - xfree(settings->config_path); - xfree(settings->current_path); - xfree(settings->development_path); - xfree(settings); + free(settings->config_path); + free(settings->current_path); + free(settings->development_path); + free(settings); } } diff --git a/libfreerdp/core/surface.c b/libfreerdp/core/surface.c index 0826f26e6..59a15102f 100644 --- a/libfreerdp/core/surface.c +++ b/libfreerdp/core/surface.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Surface Commands * * Copyright 2011 Vic Lee @@ -30,16 +30,16 @@ static int update_recv_surfcmd_surface_bits(rdpUpdate* update, STREAM* s) int pos; SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command; - stream_read_uint16(s, cmd->destLeft); - stream_read_uint16(s, cmd->destTop); - stream_read_uint16(s, cmd->destRight); - stream_read_uint16(s, cmd->destBottom); - stream_read_uint8(s, cmd->bpp); + stream_read_UINT16(s, cmd->destLeft); + stream_read_UINT16(s, cmd->destTop); + stream_read_UINT16(s, cmd->destRight); + stream_read_UINT16(s, cmd->destBottom); + stream_read_BYTE(s, cmd->bpp); stream_seek(s, 2); /* reserved1, reserved2 */ - stream_read_uint8(s, cmd->codecID); - stream_read_uint16(s, cmd->width); - stream_read_uint16(s, cmd->height); - stream_read_uint32(s, cmd->bitmapDataLength); + stream_read_BYTE(s, cmd->codecID); + stream_read_UINT16(s, cmd->width); + stream_read_UINT16(s, cmd->height); + stream_read_UINT32(s, cmd->bitmapDataLength); pos = stream_get_pos(s) + cmd->bitmapDataLength; cmd->bitmapData = stream_get_tail(s); @@ -50,12 +50,12 @@ static int update_recv_surfcmd_surface_bits(rdpUpdate* update, STREAM* s) return 20 + cmd->bitmapDataLength; } -static void update_send_frame_acknowledge(rdpRdp* rdp, uint32 frameId) +static void update_send_frame_acknowledge(rdpRdp* rdp, UINT32 frameId) { STREAM* s; s = rdp_data_pdu_init(rdp); - stream_write_uint32(s, frameId); + stream_write_UINT32(s, frameId); rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id); } @@ -63,8 +63,8 @@ static int update_recv_surfcmd_frame_marker(rdpUpdate* update, STREAM* s) { SURFACE_FRAME_MARKER* marker = &update->surface_frame_marker; - stream_read_uint16(s, marker->frameAction); - stream_read_uint32(s, marker->frameId); + stream_read_UINT16(s, marker->frameAction); + stream_read_UINT32(s, marker->frameId); IFCALL(update->SurfaceFrameMarker, update->context, marker); @@ -76,17 +76,17 @@ static int update_recv_surfcmd_frame_marker(rdpUpdate* update, STREAM* s) return 6; } -boolean update_recv_surfcmds(rdpUpdate* update, uint32 size, STREAM* s) +BOOL update_recv_surfcmds(rdpUpdate* update, UINT32 size, STREAM* s) { - uint8* mark; - uint16 cmdType; - uint32 cmdLength; + BYTE* mark; + UINT16 cmdType; + UINT32 cmdLength; while (size > 2) { stream_get_mark(s, mark); - stream_read_uint16(s, cmdType); + stream_read_UINT16(s, cmdType); size -= 2; switch (cmdType) @@ -102,7 +102,7 @@ boolean update_recv_surfcmds(rdpUpdate* update, uint32 size, STREAM* s) default: DEBUG_WARN("unknown cmdType 0x%X", cmdType); - return false; + return FALSE; } size -= cmdLength; @@ -113,34 +113,34 @@ boolean update_recv_surfcmds(rdpUpdate* update, uint32 size, STREAM* s) pcap_flush(update->pcap_rfx); } } - return true; + return TRUE; } void update_write_surfcmd_surface_bits_header(STREAM* s, SURFACE_BITS_COMMAND* cmd) { stream_check_size(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH); - stream_write_uint16(s, CMDTYPE_STREAM_SURFACE_BITS); + stream_write_UINT16(s, CMDTYPE_STREAM_SURFACE_BITS); - stream_write_uint16(s, cmd->destLeft); - stream_write_uint16(s, cmd->destTop); - stream_write_uint16(s, cmd->destRight); - stream_write_uint16(s, cmd->destBottom); - stream_write_uint8(s, cmd->bpp); - stream_write_uint16(s, 0); /* reserved1, reserved2 */ - stream_write_uint8(s, cmd->codecID); - stream_write_uint16(s, cmd->width); - stream_write_uint16(s, cmd->height); - stream_write_uint32(s, cmd->bitmapDataLength); + stream_write_UINT16(s, cmd->destLeft); + stream_write_UINT16(s, cmd->destTop); + stream_write_UINT16(s, cmd->destRight); + stream_write_UINT16(s, cmd->destBottom); + stream_write_BYTE(s, cmd->bpp); + stream_write_UINT16(s, 0); /* reserved1, reserved2 */ + stream_write_BYTE(s, cmd->codecID); + stream_write_UINT16(s, cmd->width); + stream_write_UINT16(s, cmd->height); + stream_write_UINT32(s, cmd->bitmapDataLength); } -void update_write_surfcmd_frame_marker(STREAM* s, uint16 frameAction, uint32 frameId) +void update_write_surfcmd_frame_marker(STREAM* s, UINT16 frameAction, UINT32 frameId) { stream_check_size(s, SURFCMD_FRAME_MARKER_LENGTH); - stream_write_uint16(s, CMDTYPE_FRAME_MARKER); + stream_write_UINT16(s, CMDTYPE_FRAME_MARKER); - stream_write_uint16(s, frameAction); - stream_write_uint32(s, frameId); + stream_write_UINT16(s, frameAction); + stream_write_UINT32(s, frameId); } diff --git a/libfreerdp/core/surface.h b/libfreerdp/core/surface.h index b087e61b9..82dda2491 100644 --- a/libfreerdp/core/surface.h +++ b/libfreerdp/core/surface.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Surface Commands * * Copyright 2011 Vic Lee @@ -33,10 +33,10 @@ enum SURFCMD_CMDTYPE CMDTYPE_STREAM_SURFACE_BITS = 0x0006 }; -boolean update_recv_surfcmds(rdpUpdate* update, uint32 size, STREAM* s); +BOOL update_recv_surfcmds(rdpUpdate* update, UINT32 size, STREAM* s); void update_write_surfcmd_surface_bits_header(STREAM* s, SURFACE_BITS_COMMAND* cmd); -void update_write_surfcmd_frame_marker(STREAM* s, uint16 frameAction, uint32 frameId); +void update_write_surfcmd_frame_marker(STREAM* s, UINT16 frameAction, UINT32 frameId); #endif /* __SURFACE */ diff --git a/libfreerdp/core/tcp.c b/libfreerdp/core/tcp.c index 49b6f80b5..59bad4622 100644 --- a/libfreerdp/core/tcp.c +++ b/libfreerdp/core/tcp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Transmission Control Protocol (TCP) * * Copyright 2011 Vic Lee @@ -29,6 +29,8 @@ #include #include +#include + #ifndef _WIN32 #include #include @@ -59,7 +61,7 @@ void tcp_get_ip_address(rdpTcp * tcp) { - uint8* ip; + BYTE* ip; socklen_t length; struct sockaddr_in sockaddr; @@ -67,7 +69,7 @@ void tcp_get_ip_address(rdpTcp * tcp) if (getsockname(tcp->sockfd, (struct sockaddr*) &sockaddr, &length) == 0) { - ip = (uint8*) (&sockaddr.sin_addr); + ip = (BYTE*) (&sockaddr.sin_addr); snprintf(tcp->ip_address, sizeof(tcp->ip_address), "%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); } @@ -79,13 +81,13 @@ void tcp_get_ip_address(rdpTcp * tcp) tcp->ip_address[sizeof(tcp->ip_address) - 1] = 0; tcp->settings->ipv6 = 0; - tcp->settings->ip_address = xstrdup(tcp->ip_address); + tcp->settings->ip_address = _strdup(tcp->ip_address); } void tcp_get_mac_address(rdpTcp * tcp) { #ifdef LINUX - uint8* mac; + BYTE* mac; struct ifreq if_req; struct if_nameindex* ni; @@ -115,9 +117,9 @@ void tcp_get_mac_address(rdpTcp * tcp) mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); */ } -boolean tcp_connect(rdpTcp* tcp, const char* hostname, uint16 port) +BOOL tcp_connect(rdpTcp* tcp, const char* hostname, UINT16 port) { - uint32 option_value; + UINT32 option_value; socklen_t option_len; if (hostname[0] == '/') @@ -125,14 +127,14 @@ boolean tcp_connect(rdpTcp* tcp, const char* hostname, uint16 port) tcp->sockfd = freerdp_uds_connect(hostname); if (tcp->sockfd < 0) - return false; + return FALSE; } else { tcp->sockfd = freerdp_tcp_connect(hostname, port); if (tcp->sockfd < 0) - return false; + return FALSE; tcp_get_ip_address(tcp); tcp_get_mac_address(tcp); @@ -155,28 +157,28 @@ boolean tcp_connect(rdpTcp* tcp, const char* hostname, uint16 port) tcp_set_keep_alive_mode(tcp); } - return true; + return TRUE; } -int tcp_read(rdpTcp* tcp, uint8* data, int length) +int tcp_read(rdpTcp* tcp, BYTE* data, int length) { return freerdp_tcp_read(tcp->sockfd, data, length); } -int tcp_write(rdpTcp* tcp, uint8* data, int length) +int tcp_write(rdpTcp* tcp, BYTE* data, int length) { return freerdp_tcp_write(tcp->sockfd, data, length); } -boolean tcp_disconnect(rdpTcp* tcp) +BOOL tcp_disconnect(rdpTcp* tcp) { freerdp_tcp_disconnect(tcp->sockfd); tcp->sockfd = -1; - return true; + return TRUE; } -boolean tcp_set_blocking_mode(rdpTcp* tcp, boolean blocking) +BOOL tcp_set_blocking_mode(rdpTcp* tcp, BOOL blocking) { #ifndef _WIN32 int flags; @@ -185,10 +187,10 @@ boolean tcp_set_blocking_mode(rdpTcp* tcp, boolean blocking) if (flags == -1) { printf("tcp_set_blocking_mode: fcntl failed.\n"); - return false; + return FALSE; } - if (blocking == true) + if (blocking == TRUE) fcntl(tcp->sockfd, F_SETFL, flags & ~(O_NONBLOCK)); else fcntl(tcp->sockfd, F_SETFL, flags | O_NONBLOCK); @@ -205,13 +207,13 @@ boolean tcp_set_blocking_mode(rdpTcp* tcp, boolean blocking) WSAEventSelect(tcp->sockfd, tcp->wsa_event, FD_READ); #endif - return true; + return TRUE; } -boolean tcp_set_keep_alive_mode(rdpTcp* tcp) +BOOL tcp_set_keep_alive_mode(rdpTcp* tcp) { #ifndef _WIN32 - uint32 option_value; + UINT32 option_value; socklen_t option_len; option_value = 1; @@ -220,7 +222,7 @@ boolean tcp_set_keep_alive_mode(rdpTcp* tcp) if (setsockopt(tcp->sockfd, SOL_SOCKET, SO_KEEPALIVE, (void*) &option_value, option_len) < 0) { perror("setsockopt() SOL_SOCKET, SO_KEEPALIVE:"); - return false; + return FALSE; } #ifdef TCP_KEEPIDLE @@ -230,12 +232,12 @@ boolean tcp_set_keep_alive_mode(rdpTcp* tcp) if (setsockopt(tcp->sockfd, IPPROTO_TCP, TCP_KEEPIDLE, (void*) &option_value, option_len) < 0) { perror("setsockopt() IPPROTO_TCP, SO_KEEPIDLE:"); - return false; + return FALSE; } #endif #endif - return true; + return TRUE; } rdpTcp* tcp_new(rdpSettings* settings) @@ -257,6 +259,6 @@ void tcp_free(rdpTcp* tcp) { if (tcp != NULL) { - xfree(tcp); + free(tcp); } } diff --git a/libfreerdp/core/tcp.h b/libfreerdp/core/tcp.h index 45c32a83c..fe602784a 100644 --- a/libfreerdp/core/tcp.h +++ b/libfreerdp/core/tcp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Transmission Control Protocol (TCP) * * Copyright 2011 Vic Lee @@ -37,19 +37,19 @@ struct rdp_tcp { int sockfd; char ip_address[32]; - uint8 mac_address[6]; + BYTE mac_address[6]; struct rdp_settings* settings; #ifdef _WIN32 WSAEVENT wsa_event; #endif }; -boolean tcp_connect(rdpTcp* tcp, const char* hostname, uint16 port); -boolean tcp_disconnect(rdpTcp* tcp); -int tcp_read(rdpTcp* tcp, uint8* data, int length); -int tcp_write(rdpTcp* tcp, uint8* data, int length); -boolean tcp_set_blocking_mode(rdpTcp* tcp, boolean blocking); -boolean tcp_set_keep_alive_mode(rdpTcp* tcp); +BOOL tcp_connect(rdpTcp* tcp, const char* hostname, UINT16 port); +BOOL tcp_disconnect(rdpTcp* tcp); +int tcp_read(rdpTcp* tcp, BYTE* data, int length); +int tcp_write(rdpTcp* tcp, BYTE* data, int length); +BOOL tcp_set_blocking_mode(rdpTcp* tcp, BOOL blocking); +BOOL tcp_set_keep_alive_mode(rdpTcp* tcp); rdpTcp* tcp_new(rdpSettings* settings); void tcp_free(rdpTcp* tcp); diff --git a/libfreerdp/core/timezone.c b/libfreerdp/core/timezone.c index f9f86916f..b9f311a14 100644 --- a/libfreerdp/core/timezone.c +++ b/libfreerdp/core/timezone.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Time Zone Redirection * * Copyright 2012 Marc-Andre Moreau @@ -34,14 +34,14 @@ void rdp_read_system_time(STREAM* s, SYSTEM_TIME* system_time) { - stream_read_uint16(s, system_time->wYear); /* wYear, must be set to 0 */ - stream_read_uint16(s, system_time->wMonth); /* wMonth */ - stream_read_uint16(s, system_time->wDayOfWeek); /* wDayOfWeek */ - stream_read_uint16(s, system_time->wDay); /* wDay */ - stream_read_uint16(s, system_time->wHour); /* wHour */ - stream_read_uint16(s, system_time->wMinute); /* wMinute */ - stream_read_uint16(s, system_time->wSecond); /* wSecond */ - stream_read_uint16(s, system_time->wMilliseconds); /* wMilliseconds */ + stream_read_UINT16(s, system_time->wYear); /* wYear, must be set to 0 */ + stream_read_UINT16(s, system_time->wMonth); /* wMonth */ + stream_read_UINT16(s, system_time->wDayOfWeek); /* wDayOfWeek */ + stream_read_UINT16(s, system_time->wDay); /* wDay */ + stream_read_UINT16(s, system_time->wHour); /* wHour */ + stream_read_UINT16(s, system_time->wMinute); /* wMinute */ + stream_read_UINT16(s, system_time->wSecond); /* wSecond */ + stream_read_UINT16(s, system_time->wMilliseconds); /* wMilliseconds */ } /** @@ -53,14 +53,14 @@ void rdp_read_system_time(STREAM* s, SYSTEM_TIME* system_time) void rdp_write_system_time(STREAM* s, SYSTEM_TIME* system_time) { - stream_write_uint16(s, system_time->wYear); /* wYear, must be set to 0 */ - stream_write_uint16(s, system_time->wMonth); /* wMonth */ - stream_write_uint16(s, system_time->wDayOfWeek); /* wDayOfWeek */ - stream_write_uint16(s, system_time->wDay); /* wDay */ - stream_write_uint16(s, system_time->wHour); /* wHour */ - stream_write_uint16(s, system_time->wMinute); /* wMinute */ - stream_write_uint16(s, system_time->wSecond); /* wSecond */ - stream_write_uint16(s, system_time->wMilliseconds); /* wMilliseconds */ + stream_write_UINT16(s, system_time->wYear); /* wYear, must be set to 0 */ + stream_write_UINT16(s, system_time->wMonth); /* wMonth */ + stream_write_UINT16(s, system_time->wDayOfWeek); /* wDayOfWeek */ + stream_write_UINT16(s, system_time->wDay); /* wDay */ + stream_write_UINT16(s, system_time->wHour); /* wHour */ + stream_write_UINT16(s, system_time->wMinute); /* wMinute */ + stream_write_UINT16(s, system_time->wSecond); /* wSecond */ + stream_write_UINT16(s, system_time->wMilliseconds); /* wMilliseconds */ DEBUG_TIMEZONE("Time: y=%d,m=%d,dow=%d,d=%d, %02d:%02d:%02d.%03d", system_time->wYear, system_time->wMonth, system_time->wDayOfWeek, system_time->wDay, system_time->wHour, system_time->wMinute, @@ -74,37 +74,37 @@ void rdp_write_system_time(STREAM* s, SYSTEM_TIME* system_time) * @param settings settings */ -boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) +BOOL rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) { char* str; TIME_ZONE_INFO* clientTimeZone; if (stream_get_left(s) < 172) - return false; + return FALSE; clientTimeZone = settings->client_time_zone; - stream_read_uint32(s, clientTimeZone->bias); /* Bias */ + stream_read_UINT32(s, clientTimeZone->bias); /* Bias */ /* standardName (64 bytes) */ freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2); stream_seek(s, 64); strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName)); - xfree(str); + free(str); rdp_read_system_time(s, &clientTimeZone->standardDate); /* StandardDate */ - stream_read_uint32(s, clientTimeZone->standardBias); /* StandardBias */ + stream_read_UINT32(s, clientTimeZone->standardBias); /* StandardBias */ /* daylightName (64 bytes) */ freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2); stream_seek(s, 64); strncpy(clientTimeZone->daylightName, str, sizeof(clientTimeZone->daylightName)); - xfree(str); + free(str); rdp_read_system_time(s, &clientTimeZone->daylightDate); /* DaylightDate */ - stream_read_uint32(s, clientTimeZone->daylightBias); /* DaylightBias */ + stream_read_UINT32(s, clientTimeZone->daylightBias); /* DaylightBias */ - return true; + return TRUE; } /** @@ -116,9 +116,9 @@ boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) { - uint32 bias; - sint32 sbias; - uint32 bias2c; + UINT32 bias; + INT32 sbias; + UINT32 bias2c; WCHAR* standardName; WCHAR* daylightName; int standardNameLength; @@ -150,7 +150,7 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) else bias = 1440 - clientTimeZone->bias; - stream_write_uint32(s, bias); /* Bias */ + stream_write_UINT32(s, bias); /* Bias */ /* standardName (64 bytes) */ stream_write(s, standardName, standardNameLength); @@ -164,12 +164,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) sbias = clientTimeZone->standardBias - clientTimeZone->bias; if (sbias < 0) - bias2c = (uint32) sbias; + bias2c = (UINT32) sbias; else - bias2c = ~((uint32) sbias) + 1; + bias2c = ~((UINT32) sbias) + 1; /* Note that StandardBias is ignored if no valid standardDate is provided. */ - stream_write_uint32(s, bias2c); /* StandardBias */ + stream_write_UINT32(s, bias2c); /* StandardBias */ DEBUG_TIMEZONE("StandardBias=%d", bias2c); /* daylightName (64 bytes) */ @@ -181,14 +181,14 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) sbias = clientTimeZone->daylightBias - clientTimeZone->bias; if (sbias < 0) - bias2c = (uint32) sbias; + bias2c = (UINT32) sbias; else - bias2c = ~((uint32) sbias) + 1; + bias2c = ~((UINT32) sbias) + 1; /* Note that DaylightBias is ignored if no valid daylightDate is provided. */ - stream_write_uint32(s, bias2c); /* DaylightBias */ + stream_write_UINT32(s, bias2c); /* DaylightBias */ DEBUG_TIMEZONE("DaylightBias=%d", bias2c); - xfree(standardName); - xfree(daylightName); + free(standardName); + free(daylightName); } diff --git a/libfreerdp/core/timezone.h b/libfreerdp/core/timezone.h index 79ef076fc..0bdff4fcb 100644 --- a/libfreerdp/core/timezone.h +++ b/libfreerdp/core/timezone.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Time Zone Redirection * * Copyright 2012 Marc-Andre Moreau @@ -33,7 +33,7 @@ void rdp_read_system_time(STREAM* s, SYSTEM_TIME* system_time); void rdp_write_system_time(STREAM* s, SYSTEM_TIME* system_time); void rdp_get_client_time_zone(STREAM* s, rdpSettings* settings); -boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings); +BOOL rdp_read_client_time_zone(STREAM* s, rdpSettings* settings); void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings); #ifdef WITH_DEBUG_TIMEZONE diff --git a/libfreerdp/core/tpdu.c b/libfreerdp/core/tpdu.c index 8a3002123..51cb78189 100644 --- a/libfreerdp/core/tpdu.c +++ b/libfreerdp/core/tpdu.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X.224 Transport Protocol Data Units (TPDUs) * * Copyright 2011 Marc-Andre Moreau @@ -66,13 +66,13 @@ * @return TPDU length indicator (LI) */ -uint8 -tpdu_read_header(STREAM* s, uint8* code) +BYTE +tpdu_read_header(STREAM* s, BYTE* code) { - uint8 li; + BYTE li; - stream_read_uint8(s, li); /* LI */ - stream_read_uint8(s, *code); /* Code */ + stream_read_BYTE(s, li); /* LI */ + stream_read_BYTE(s, *code); /* Code */ if (*code == X224_TPDU_DATA) { @@ -98,20 +98,20 @@ tpdu_read_header(STREAM* s, uint8* code) */ void -tpdu_write_header(STREAM* s, uint16 length, uint8 code) +tpdu_write_header(STREAM* s, UINT16 length, BYTE code) { - stream_write_uint8(s, length); /* LI */ - stream_write_uint8(s, code); /* code */ + stream_write_BYTE(s, length); /* LI */ + stream_write_BYTE(s, code); /* code */ if (code == X224_TPDU_DATA) { - stream_write_uint8(s, 0x80); /* EOT */ + stream_write_BYTE(s, 0x80); /* EOT */ } else { - stream_write_uint16(s, 0); /* DST-REF */ - stream_write_uint16(s, 0); /* SRC-REF */ - stream_write_uint8(s, 0); /* Class 0 */ + stream_write_UINT16(s, 0); /* DST-REF */ + stream_write_UINT16(s, 0); /* SRC-REF */ + stream_write_BYTE(s, 0); /* Class 0 */ } } @@ -121,10 +121,10 @@ tpdu_write_header(STREAM* s, uint16 length, uint8 code) * @return length indicator (LI) */ -uint8 tpdu_read_connection_request(STREAM* s) +BYTE tpdu_read_connection_request(STREAM* s) { - uint8 li; - uint8 code; + BYTE li; + BYTE code; li = tpdu_read_header(s, &code); @@ -144,7 +144,7 @@ uint8 tpdu_read_connection_request(STREAM* s) */ void -tpdu_write_connection_request(STREAM* s, uint16 length) +tpdu_write_connection_request(STREAM* s, UINT16 length) { tpdu_write_header(s, length, X224_TPDU_CONNECTION_REQUEST); } @@ -155,11 +155,11 @@ tpdu_write_connection_request(STREAM* s, uint16 length) * @return length indicator (LI) */ -uint8 +BYTE tpdu_read_connection_confirm(STREAM* s) { - uint8 li; - uint8 code; + BYTE li; + BYTE code; li = tpdu_read_header(s, &code); @@ -179,7 +179,7 @@ tpdu_read_connection_confirm(STREAM* s) */ void -tpdu_write_connection_confirm(STREAM* s, uint16 length) +tpdu_write_connection_confirm(STREAM* s, UINT16 length) { tpdu_write_header(s, length, X224_TPDU_CONNECTION_CONFIRM); } @@ -191,7 +191,7 @@ tpdu_write_connection_confirm(STREAM* s, uint16 length) */ void -tpdu_write_disconnect_request(STREAM* s, uint16 length) +tpdu_write_disconnect_request(STREAM* s, UINT16 length) { tpdu_write_header(s, length, X224_TPDU_DISCONNECT_REQUEST); } @@ -212,11 +212,11 @@ tpdu_write_data(STREAM* s) * @param s stream */ -uint16 +UINT16 tpdu_read_data(STREAM* s) { - uint8 code; - uint16 li; + BYTE code; + UINT16 li; li = tpdu_read_header(s, &code); diff --git a/libfreerdp/core/tpdu.h b/libfreerdp/core/tpdu.h index c85273c9d..cf92551f0 100644 --- a/libfreerdp/core/tpdu.h +++ b/libfreerdp/core/tpdu.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X.224 Transport Protocol Data Units (TPDUs) * * Copyright 2011 Marc-Andre Moreau @@ -41,14 +41,14 @@ enum X224_TPDU_TYPE #define TPDU_CONNECTION_CONFIRM_LENGTH (TPKT_HEADER_LENGTH + TPDU_CONNECTION_CONFIRM_HEADER_LENGTH) #define TPDU_DISCONNECT_REQUEST_LENGTH (TPKT_HEADER_LENGTH + TPDU_DISCONNECT_REQUEST_HEADER_LENGTH) -uint8 tpdu_read_header(STREAM* s, uint8* code); -void tpdu_write_header(STREAM* s, uint16 length, uint8 code); -uint8 tpdu_read_connection_request(STREAM* s); -void tpdu_write_connection_request(STREAM* s, uint16 length); -uint8 tpdu_read_connection_confirm(STREAM* s); -void tpdu_write_connection_confirm(STREAM* s, uint16 length); -void tpdu_write_disconnect_request(STREAM* s, uint16 length); -uint16 tpdu_read_data(STREAM* s); +BYTE tpdu_read_header(STREAM* s, BYTE* code); +void tpdu_write_header(STREAM* s, UINT16 length, BYTE code); +BYTE tpdu_read_connection_request(STREAM* s); +void tpdu_write_connection_request(STREAM* s, UINT16 length); +BYTE tpdu_read_connection_confirm(STREAM* s); +void tpdu_write_connection_confirm(STREAM* s, UINT16 length); +void tpdu_write_disconnect_request(STREAM* s, UINT16 length); +UINT16 tpdu_read_data(STREAM* s); void tpdu_write_data(STREAM* s); #endif /* __TPDU_H */ diff --git a/libfreerdp/core/tpkt.c b/libfreerdp/core/tpkt.c index 6f5e287aa..8f52285bc 100644 --- a/libfreerdp/core/tpkt.c +++ b/libfreerdp/core/tpkt.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Transport Packets (TPKTs) * * Copyright 2011 Marc-Andre Moreau @@ -60,18 +60,18 @@ /** * Verify if a packet has valid TPKT header.\n * @param s - * @return boolean + * @return BOOL */ -boolean tpkt_verify_header(STREAM* s) +BOOL tpkt_verify_header(STREAM* s) { - uint8 version; + BYTE version; - stream_peek_uint8(s, version); + stream_peek_BYTE(s, version); if (version == 3) - return true; + return TRUE; else - return false; + return FALSE; } /** @@ -80,17 +80,17 @@ boolean tpkt_verify_header(STREAM* s) * @return length */ -uint16 tpkt_read_header(STREAM* s) +UINT16 tpkt_read_header(STREAM* s) { - uint8 version; - uint16 length; + BYTE version; + UINT16 length; - stream_peek_uint8(s, version); + stream_peek_BYTE(s, version); if (version == 3) { stream_seek(s, 2); - stream_read_uint16_be(s, length); + stream_read_UINT16_be(s, length); } else { @@ -107,9 +107,9 @@ uint16 tpkt_read_header(STREAM* s) * @param length */ -void tpkt_write_header(STREAM* s, uint16 length) +void tpkt_write_header(STREAM* s, UINT16 length) { - stream_write_uint8(s, 3); /* version */ - stream_write_uint8(s, 0); /* reserved */ - stream_write_uint16_be(s, length); /* length */ + stream_write_BYTE(s, 3); /* version */ + stream_write_BYTE(s, 0); /* reserved */ + stream_write_UINT16_be(s, length); /* length */ } diff --git a/libfreerdp/core/tpkt.h b/libfreerdp/core/tpkt.h index 331bafd92..73579d269 100644 --- a/libfreerdp/core/tpkt.h +++ b/libfreerdp/core/tpkt.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Transport Packets (TPKTs) * * Copyright 2011 Marc-Andre Moreau @@ -27,8 +27,8 @@ #define TPKT_HEADER_LENGTH 4 -boolean tpkt_verify_header(STREAM* s); -uint16 tpkt_read_header(STREAM* s); -void tpkt_write_header(STREAM* s, uint16 length); +BOOL tpkt_verify_header(STREAM* s); +UINT16 tpkt_read_header(STREAM* s); +void tpkt_write_header(STREAM* s, UINT16 length); #endif /* __TPKT_H */ diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 1073eb95f..2e820e8a5 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Network Transport Layer * * Copyright 2011 Vic Lee @@ -70,7 +70,7 @@ void transport_attach(rdpTransport* transport, int sockfd) transport->tcp->sockfd = sockfd; } -boolean transport_disconnect(rdpTransport* transport) +BOOL transport_disconnect(rdpTransport* transport) { if (transport->layer == TRANSPORT_LAYER_TLS) tls_disconnect(transport->tls); @@ -78,14 +78,14 @@ boolean transport_disconnect(rdpTransport* transport) return tcp_disconnect(transport->tcp); } -boolean transport_connect_rdp(rdpTransport* transport) +BOOL transport_connect_rdp(rdpTransport* transport) { /* RDP encryption */ - return true; + return TRUE; } -boolean transport_connect_tls(rdpTransport* transport) +BOOL transport_connect_tls(rdpTransport* transport) { if (transport->tls == NULL) transport->tls = tls_new(transport->settings); @@ -93,20 +93,20 @@ boolean transport_connect_tls(rdpTransport* transport) transport->layer = TRANSPORT_LAYER_TLS; transport->tls->sockfd = transport->tcp->sockfd; - if (tls_connect(transport->tls) != true) + if (tls_connect(transport->tls) != TRUE) { if (!connectErrorCode) connectErrorCode = TLSCONNECTERROR; tls_free(transport->tls); transport->tls = NULL; - return false; + return FALSE; } - return true; + return TRUE; } -boolean transport_connect_nla(rdpTransport* transport) +BOOL transport_connect_nla(rdpTransport* transport) { freerdp* instance; rdpSettings* settings; @@ -117,20 +117,20 @@ boolean transport_connect_nla(rdpTransport* transport) transport->layer = TRANSPORT_LAYER_TLS; transport->tls->sockfd = transport->tcp->sockfd; - if (tls_connect(transport->tls) != true) + if (tls_connect(transport->tls) != TRUE) { if (!connectErrorCode) connectErrorCode = TLSCONNECTERROR; tls_free(transport->tls); transport->tls = NULL; - return false; + return FALSE; } /* Network Level Authentication */ - if (transport->settings->authentication != true) - return true; + if (transport->settings->authentication != TRUE) + return TRUE; settings = transport->settings; instance = (freerdp*) settings->instance; @@ -147,15 +147,15 @@ boolean transport_connect_nla(rdpTransport* transport) "If credentials are valid, the NTLMSSP implementation may be to blame.\n"); credssp_free(transport->credssp); - return false; + return FALSE; } credssp_free(transport->credssp); - return true; + return TRUE; } -boolean transport_tsg_connect(rdpTransport* transport, const char* hostname, uint16 port) +BOOL transport_tsg_connect(rdpTransport* transport, const char* hostname, UINT16 port) { rdpTsg* tsg = tsg_new(transport); @@ -172,21 +172,21 @@ boolean transport_tsg_connect(rdpTransport* transport, const char* hostname, uin transport->tls_out->sockfd = transport->tcp_out->sockfd; - if (tls_connect(transport->tls_in) != true) - return false; + if (tls_connect(transport->tls_in) != TRUE) + return FALSE; - if (tls_connect(transport->tls_out) != true) - return false; + if (tls_connect(transport->tls_out) != TRUE) + return FALSE; if (!tsg_connect(tsg, hostname, port)) - return false; + return FALSE; - return true; + return TRUE; } -boolean transport_connect(rdpTransport* transport, const char* hostname, uint16 port) +BOOL transport_connect(rdpTransport* transport, const char* hostname, UINT16 port) { - boolean status = false; + BOOL status = FALSE; rdpSettings* settings = transport->settings; if (transport->settings->ts_gateway) @@ -210,14 +210,14 @@ boolean transport_connect(rdpTransport* transport, const char* hostname, uint16 return status; } -boolean transport_accept_rdp(rdpTransport* transport) +BOOL transport_accept_rdp(rdpTransport* transport) { /* RDP encryption */ - return true; + return TRUE; } -boolean transport_accept_tls(rdpTransport* transport) +BOOL transport_accept_tls(rdpTransport* transport) { if (transport->tls == NULL) transport->tls = tls_new(transport->settings); @@ -225,13 +225,13 @@ boolean transport_accept_tls(rdpTransport* transport) transport->layer = TRANSPORT_LAYER_TLS; transport->tls->sockfd = transport->tcp->sockfd; - if (tls_accept(transport->tls, transport->settings->cert_file, transport->settings->privatekey_file) != true) - return false; + if (tls_accept(transport->tls, transport->settings->cert_file, transport->settings->privatekey_file) != TRUE) + return FALSE; - return true; + return TRUE; } -boolean transport_accept_nla(rdpTransport* transport) +BOOL transport_accept_nla(rdpTransport* transport) { freerdp* instance; rdpSettings* settings; @@ -242,13 +242,13 @@ boolean transport_accept_nla(rdpTransport* transport) transport->layer = TRANSPORT_LAYER_TLS; transport->tls->sockfd = transport->tcp->sockfd; - if (tls_accept(transport->tls, transport->settings->cert_file, transport->settings->privatekey_file) != true) - return false; + if (tls_accept(transport->tls, transport->settings->cert_file, transport->settings->privatekey_file) != TRUE) + return FALSE; /* Network Level Authentication */ - if (transport->settings->authentication != true) - return true; + if (transport->settings->authentication != TRUE) + return TRUE; settings = transport->settings; instance = (freerdp*) settings->instance; @@ -260,19 +260,19 @@ boolean transport_accept_nla(rdpTransport* transport) { printf("client authentication failure\n"); credssp_free(transport->credssp); - return false; + return FALSE; } /* don't free credssp module yet, we need to copy the credentials from it first */ - return true; + return TRUE; } int transport_read(rdpTransport* transport, STREAM* s) { int status = -1; - while (true) + while (TRUE) { if (transport->layer == TRANSPORT_LAYER_TLS) status = tls_read(transport->tls, stream_get_tail(s), stream_get_left(s)); @@ -386,7 +386,7 @@ int transport_check_fds(rdpTransport** ptransport) { int pos; int status; - uint16 length; + UINT16 length; STREAM* received; rdpTransport* transport = *ptransport; @@ -462,7 +462,7 @@ int transport_check_fds(rdpTransport** ptransport) stream_seal(received); stream_set_pos(received, 0); - if (transport->recv_callback(transport, received, transport->recv_extra) == false) + if (transport->recv_callback(transport, received, transport->recv_extra) == FALSE) status = -1; stream_free(received); @@ -487,7 +487,7 @@ int transport_check_fds(rdpTransport** ptransport) return 0; } -boolean transport_set_blocking_mode(rdpTransport* transport, boolean blocking) +BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking) { transport->blocking = blocking; return tcp_set_blocking_mode(transport->tcp, blocking); @@ -517,7 +517,7 @@ rdpTransport* transport_new(rdpSettings* settings) transport->recv_stream = stream_new(BUFFER_SIZE); transport->send_stream = stream_new(BUFFER_SIZE); - transport->blocking = true; + transport->blocking = TRUE; transport->layer = TRANSPORT_LAYER_TCP; } @@ -541,6 +541,6 @@ void transport_free(rdpTransport* transport) tcp_free(transport->tcp_in); tsg_free(transport->tsg); - xfree(transport); + free(transport); } } diff --git a/libfreerdp/core/transport.h b/libfreerdp/core/transport.h index e082fc44e..453613558 100644 --- a/libfreerdp/core/transport.h +++ b/libfreerdp/core/transport.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Network Transport Layer * * Copyright 2011 Vic Lee @@ -43,7 +43,7 @@ typedef struct rdp_transport rdpTransport; #include #include -typedef boolean (*TransportRecv) (rdpTransport* transport, STREAM* stream, void* extra); +typedef BOOL (*TransportRecv) (rdpTransport* transport, STREAM* stream, void* extra); struct rdp_transport { @@ -59,32 +59,32 @@ struct rdp_transport struct rdp_tls* tls_out; struct rdp_credssp* credssp; struct rdp_settings* settings; - uint32 usleep_interval; + UINT32 usleep_interval; void* recv_extra; STREAM* recv_buffer; TransportRecv recv_callback; struct wait_obj* recv_event; - boolean blocking; - boolean process_single_pdu; /* process single pdu in transport_check_fds */ + BOOL blocking; + BOOL process_single_pdu; /* process single pdu in transport_check_fds */ }; STREAM* transport_recv_stream_init(rdpTransport* transport, int size); STREAM* transport_send_stream_init(rdpTransport* transport, int size); -boolean transport_connect(rdpTransport* transport, const char* hostname, uint16 port); +BOOL transport_connect(rdpTransport* transport, const char* hostname, UINT16 port); void transport_attach(rdpTransport* transport, int sockfd); -boolean transport_disconnect(rdpTransport* transport); -boolean transport_connect_rdp(rdpTransport* transport); -boolean transport_connect_tls(rdpTransport* transport); -boolean transport_connect_nla(rdpTransport* transport); -boolean transport_connect_tsg(rdpTransport* transport); -boolean transport_accept_rdp(rdpTransport* transport); -boolean transport_accept_tls(rdpTransport* transport); -boolean transport_accept_nla(rdpTransport* transport); +BOOL transport_disconnect(rdpTransport* transport); +BOOL transport_connect_rdp(rdpTransport* transport); +BOOL transport_connect_tls(rdpTransport* transport); +BOOL transport_connect_nla(rdpTransport* transport); +BOOL transport_connect_tsg(rdpTransport* transport); +BOOL transport_accept_rdp(rdpTransport* transport); +BOOL transport_accept_tls(rdpTransport* transport); +BOOL transport_accept_nla(rdpTransport* transport); int transport_read(rdpTransport* transport, STREAM* s); int transport_write(rdpTransport* transport, STREAM* s); void transport_get_fds(rdpTransport* transport, void** rfds, int* rcount); int transport_check_fds(rdpTransport** ptransport); -boolean transport_set_blocking_mode(rdpTransport* transport, boolean blocking); +BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking); rdpTransport* transport_new(rdpSettings* settings); void transport_free(rdpTransport* transport); diff --git a/libfreerdp/core/tsg.c b/libfreerdp/core/tsg.c index f643f24ae..3847a5313 100644 --- a/libfreerdp/core/tsg.c +++ b/libfreerdp/core/tsg.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Terminal Server Gateway (TSG) * * Copyright 2012 Fujitsu Technology Solutions GmbH @@ -41,7 +41,7 @@ * RPC NDR Interface Reference: http://msdn.microsoft.com/en-us/library/windows/desktop/hh802752/ */ -uint8 tsg_packet1[108] = +BYTE tsg_packet1[108] = { 0x43, 0x56, 0x00, 0x00, 0x43, 0x56, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x52, 0x54, 0x43, 0x56, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -284,7 +284,7 @@ uint8 tsg_packet1[108] = HRESULT ReturnValue: 00 00 00 00 */ -uint8 tsg_packet2[112] = +BYTE tsg_packet2[112] = { 0x00, 0x00, 0x00, 0x00, 0x6A, 0x78, 0xE9, 0xAB, 0x02, 0x90, 0x1C, 0x44, 0x8D, 0x99, 0x29, 0x30, 0x53, 0x6C, 0x04, 0x33, 0x52, 0x51, 0x00, 0x00, 0x52, 0x51, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, @@ -330,7 +330,7 @@ uint8 tsg_packet2[112] = 0x00, 0x00 */ -uint8 tsg_packet3[40] = +BYTE tsg_packet3[40] = { 0x00, 0x00, 0x00, 0x00, 0x6A, 0x78, 0xE9, 0xAB, 0x02, 0x90, 0x1C, 0x44, 0x8D, 0x99, 0x29, 0x30, 0x53, 0x6C, 0x04, 0x33, 0x01, 0x00, 0x00, 0x00, 0x52, 0x47, 0x00, 0x00, 0x52, 0x47, 0x00, 0x00, @@ -349,7 +349,7 @@ uint8 tsg_packet3[40] = 0x01, 0x00, 0x00, 0x00 */ -uint8 tsg_packet4[48] = +BYTE tsg_packet4[48] = { 0x00, 0x00, 0x00, 0x00, 0x6A, 0x78, 0xE9, 0xAB, 0x02, 0x90, 0x1C, 0x44, 0x8D, 0x99, 0x29, 0x30, 0x53, 0x6C, 0x04, 0x33, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -366,13 +366,13 @@ uint8 tsg_packet4[48] = 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00 */ -uint8 tsg_packet5[20] = +BYTE tsg_packet5[20] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, uint32* lengths) +DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], UINT32 count, UINT32* lengths) { STREAM* s; int status; @@ -381,11 +381,11 @@ DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, byte* buffer1 = NULL ; byte* buffer2 = NULL ; byte* buffer3 = NULL ; - uint32 buffer1Length; - uint32 buffer2Length; - uint32 buffer3Length; - uint32 numBuffers = 0; - uint32 totalDataBytes = 0; + UINT32 buffer1Length; + UINT32 buffer2Length; + UINT32 buffer3Length; + UINT32 numBuffers = 0; + UINT32 totalDataBytes = 0; tsg = (rdpTsg*) IDL_handle; buffer1Length = buffer2Length = buffer3Length = 0; @@ -417,18 +417,18 @@ DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, s = stream_new(28 + totalDataBytes); /* PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE_NR (20 bytes) */ - stream_write_uint32(s, 0); /* ContextType (4 bytes) */ + stream_write_UINT32(s, 0); /* ContextType (4 bytes) */ stream_write(s, tsg->ChannelContext, 16); /* ContextUuid (4 bytes) */ - stream_write_uint32_be(s, totalDataBytes); /* totalDataBytes (4 bytes) */ - stream_write_uint32_be(s, numBuffers); /* numBuffers (4 bytes) */ + stream_write_UINT32_be(s, totalDataBytes); /* totalDataBytes (4 bytes) */ + stream_write_UINT32_be(s, numBuffers); /* numBuffers (4 bytes) */ if (buffer1Length > 0) - stream_write_uint32_be(s, buffer1Length); /* buffer1Length (4 bytes) */ + stream_write_UINT32_be(s, buffer1Length); /* buffer1Length (4 bytes) */ if (buffer2Length > 0) - stream_write_uint32_be(s, buffer2Length); /* buffer2Length (4 bytes) */ + stream_write_UINT32_be(s, buffer2Length); /* buffer2Length (4 bytes) */ if (buffer3Length > 0) - stream_write_uint32_be(s, buffer3Length); /* buffer3Length (4 bytes) */ + stream_write_UINT32_be(s, buffer3Length); /* buffer3Length (4 bytes) */ if (buffer1Length > 0) stream_write(s, buffer1, buffer1Length); /* buffer1 (variable) */ @@ -453,10 +453,10 @@ DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, return length; } -boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) +BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port) { - uint8* data; - uint32 length; + BYTE* data; + UINT32 length; STREAM* s_p4; int status = -1; rdpRpc* rpc = tsg->rpc; @@ -466,7 +466,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (!rpc_connect(rpc)) { printf("rpc_connect failed!\n"); - return false; + return FALSE; } DEBUG_TSG("rpc_connect success"); @@ -488,23 +488,23 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_write opnum=1 failed!\n"); - return false; + return FALSE; } length = 0x8FFF; - data = xmalloc(length); + data = malloc(length); if (data == NULL) { printf("rpc_recv - memory allocation error\n") ; - return false ; + return FALSE ; } status = rpc_read(rpc, data, length); if (status <= 0) { printf("rpc_recv failed!\n"); - xfree(data) ; - return false; + free(data) ; + return FALSE; } memcpy(tsg->TunnelContext, data + (status - 24), 16); @@ -534,8 +534,8 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_write opnum=2 failed!\n"); - xfree(data) ; - return false; + free(data) ; + return FALSE; } status = rpc_read(rpc, data, length); @@ -543,8 +543,8 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_recv failed!\n"); - xfree(data) ; - return false; + free(data) ; + return FALSE; } memcpy(tsg_packet3 + 4, tsg->TunnelContext, 16); @@ -566,8 +566,8 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_write opnum=3 failed!\n"); - xfree(data) ; - return false; + free(data) ; + return FALSE; } status = -1; @@ -578,13 +578,13 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) s_p4 = stream_new(60 + dest_addr_unic_len + 2); stream_write(s_p4, tsg_packet4, 48); - stream_write_uint32(s_p4, (dest_addr_unic_len / 2) + 1); /* MaximumCount */ - stream_write_uint32(s_p4, 0x00000000); /* Offset */ - stream_write_uint32(s_p4, (dest_addr_unic_len / 2) + 1); /* ActualCount */ + stream_write_UINT32(s_p4, (dest_addr_unic_len / 2) + 1); /* MaximumCount */ + stream_write_UINT32(s_p4, 0x00000000); /* Offset */ + stream_write_UINT32(s_p4, (dest_addr_unic_len / 2) + 1); /* ActualCount */ stream_write(s_p4, dest_addr_unic, dest_addr_unic_len); - stream_write_uint16(s_p4, 0x0000); /* unicode zero to terminate hostname string */ + stream_write_UINT16(s_p4, 0x0000); /* unicode zero to terminate hostname string */ - xfree(dest_addr_unic); + free(dest_addr_unic); /** * OpNum = 4 @@ -604,8 +604,8 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) { printf("rpc_write opnum=4 failed!\n"); stream_free(s_p4); - xfree(data); - return false; + free(data); + return FALSE; } status = rpc_read(rpc, data, length); @@ -614,8 +614,8 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) { printf("rpc_recv failed!\n"); stream_free(s_p4); - xfree(data); - return false; + free(data); + return FALSE; } memcpy(tsg->ChannelContext, data + 4, 16); @@ -643,17 +643,17 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) { printf("rpc_write opnum=8 failed!\n"); stream_free(s_p4); - xfree(data); - return false; + free(data); + return FALSE; } stream_free(s_p4); - xfree(data); + free(data); - return true; + return TRUE; } -int tsg_read(rdpTsg* tsg, uint8* data, uint32 length) +int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length) { int status; @@ -662,7 +662,7 @@ int tsg_read(rdpTsg* tsg, uint8* data, uint32 length) return status; } -int tsg_write(rdpTsg* tsg, uint8* data, uint32 length) +int tsg_write(rdpTsg* tsg, BYTE* data, UINT32 length) { return TsProxySendToServer((handle_t) tsg, data, 1, &length); } @@ -688,6 +688,6 @@ void tsg_free(rdpTsg* tsg) if (tsg != NULL) { rpc_free(tsg->rpc); - xfree(tsg); + free(tsg); } } diff --git a/libfreerdp/core/tsg.h b/libfreerdp/core/tsg.h index 4719ab357..57ceac26b 100644 --- a/libfreerdp/core/tsg.h +++ b/libfreerdp/core/tsg.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Terminal Server Gateway (TSG) * * Copyright 2012 Fujitsu Technology Solutions GmbH @@ -42,8 +42,8 @@ struct rdp_tsg rdpRpc* rpc; rdpSettings* settings; rdpTransport* transport; - uint8 TunnelContext[16]; - uint8 ChannelContext[16]; + BYTE TunnelContext[16]; + BYTE ChannelContext[16]; }; typedef wchar_t* RESOURCENAME; @@ -239,12 +239,12 @@ typedef struct _TSG_PACKET TSG_PACKET_TYPE_UNION tsgPacket; } TSG_PACKET, *PTSG_PACKET; -DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, uint32* lengths); +DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], UINT32 count, UINT32* lengths); -boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port); +BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port); -int tsg_write(rdpTsg* tsg, uint8* data, uint32 length); -int tsg_read(rdpTsg* tsg, uint8* data, uint32 length); +int tsg_write(rdpTsg* tsg, BYTE* data, UINT32 length); +int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length); rdpTsg* tsg_new(rdpTransport* transport); void tsg_free(rdpTsg* tsg); diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index f7b6e1825..d2db6041a 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Update Data PDUs * * Copyright 2011 Marc-Andre Moreau @@ -37,54 +37,54 @@ static const char* const UPDATE_TYPE_STRINGS[] = }; */ -boolean update_recv_orders(rdpUpdate* update, STREAM* s) +BOOL update_recv_orders(rdpUpdate* update, STREAM* s) { - uint16 numberOrders; + UINT16 numberOrders; - stream_seek_uint16(s); /* pad2OctetsA (2 bytes) */ - stream_read_uint16(s, numberOrders); /* numberOrders (2 bytes) */ - stream_seek_uint16(s); /* pad2OctetsB (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsA (2 bytes) */ + stream_read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */ + stream_seek_UINT16(s); /* pad2OctetsB (2 bytes) */ while (numberOrders > 0) { if (!update_recv_order(update, s)) - return false; + return FALSE; numberOrders--; } - return true; + return TRUE; } void update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data) { - stream_read_uint16(s, bitmap_data->destLeft); - stream_read_uint16(s, bitmap_data->destTop); - stream_read_uint16(s, bitmap_data->destRight); - stream_read_uint16(s, bitmap_data->destBottom); - stream_read_uint16(s, bitmap_data->width); - stream_read_uint16(s, bitmap_data->height); - stream_read_uint16(s, bitmap_data->bitsPerPixel); - stream_read_uint16(s, bitmap_data->flags); - stream_read_uint16(s, bitmap_data->bitmapLength); + stream_read_UINT16(s, bitmap_data->destLeft); + stream_read_UINT16(s, bitmap_data->destTop); + stream_read_UINT16(s, bitmap_data->destRight); + stream_read_UINT16(s, bitmap_data->destBottom); + stream_read_UINT16(s, bitmap_data->width); + stream_read_UINT16(s, bitmap_data->height); + stream_read_UINT16(s, bitmap_data->bitsPerPixel); + stream_read_UINT16(s, bitmap_data->flags); + stream_read_UINT16(s, bitmap_data->bitmapLength); if (bitmap_data->flags & BITMAP_COMPRESSION) { if (!(bitmap_data->flags & NO_BITMAP_COMPRESSION_HDR)) { - stream_read_uint16(s, bitmap_data->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */ - stream_read_uint16(s, bitmap_data->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */ - stream_read_uint16(s, bitmap_data->cbScanWidth); /* cbScanWidth (2 bytes) */ - stream_read_uint16(s, bitmap_data->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */ + stream_read_UINT16(s, bitmap_data->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */ + stream_read_UINT16(s, bitmap_data->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */ + stream_read_UINT16(s, bitmap_data->cbScanWidth); /* cbScanWidth (2 bytes) */ + stream_read_UINT16(s, bitmap_data->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */ bitmap_data->bitmapLength = bitmap_data->cbCompMainBodySize; } - bitmap_data->compressed = true; + bitmap_data->compressed = TRUE; stream_get_mark(s, bitmap_data->bitmapDataStream); stream_seek(s, bitmap_data->bitmapLength); } else { - bitmap_data->compressed = false; + bitmap_data->compressed = FALSE; stream_get_mark(s, bitmap_data->bitmapDataStream); stream_seek(s, bitmap_data->bitmapLength); } @@ -94,15 +94,15 @@ void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_upda { int i; - stream_read_uint16(s, bitmap_update->number); /* numberRectangles (2 bytes) */ + stream_read_UINT16(s, bitmap_update->number); /* numberRectangles (2 bytes) */ if (bitmap_update->number > bitmap_update->count) { - uint16 count; + UINT16 count; count = bitmap_update->number * 2; - bitmap_update->rectangles = (BITMAP_DATA*) xrealloc(bitmap_update->rectangles, + bitmap_update->rectangles = (BITMAP_DATA*) realloc(bitmap_update->rectangles, sizeof(BITMAP_DATA) * count); memset(&bitmap_update->rectangles[bitmap_update->count], 0, @@ -123,8 +123,8 @@ void update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_u int i; PALETTE_ENTRY* entry; - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ - stream_read_uint32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ + stream_read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */ if (palette_update->number > 256) palette_update->number = 256; @@ -134,15 +134,15 @@ void update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_u { entry = &palette_update->entries[i]; - stream_read_uint8(s, entry->blue); - stream_read_uint8(s, entry->green); - stream_read_uint8(s, entry->red); + stream_read_BYTE(s, entry->blue); + stream_read_BYTE(s, entry->green); + stream_read_BYTE(s, entry->red); } } void update_read_synchronize(rdpUpdate* update, STREAM* s) { - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ /** * The Synchronize Update is an artifact from the @@ -152,8 +152,8 @@ void update_read_synchronize(rdpUpdate* update, STREAM* s) void update_read_play_sound(STREAM* s, PLAY_SOUND_UPDATE* play_sound) { - stream_read_uint32(s, play_sound->duration); /* duration (4 bytes) */ - stream_read_uint32(s, play_sound->frequency); /* frequency (4 bytes) */ + stream_read_UINT32(s, play_sound->duration); /* duration (4 bytes) */ + stream_read_UINT32(s, play_sound->frequency); /* frequency (4 bytes) */ } void update_recv_play_sound(rdpUpdate* update, STREAM* s) @@ -164,24 +164,24 @@ void update_recv_play_sound(rdpUpdate* update, STREAM* s) void update_read_pointer_position(STREAM* s, POINTER_POSITION_UPDATE* pointer_position) { - stream_read_uint16(s, pointer_position->xPos); /* xPos (2 bytes) */ - stream_read_uint16(s, pointer_position->yPos); /* yPos (2 bytes) */ + stream_read_UINT16(s, pointer_position->xPos); /* xPos (2 bytes) */ + stream_read_UINT16(s, pointer_position->yPos); /* yPos (2 bytes) */ } void update_read_pointer_system(STREAM* s, POINTER_SYSTEM_UPDATE* pointer_system) { - stream_read_uint32(s, pointer_system->type); /* systemPointerType (4 bytes) */ + stream_read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */ } void update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color) { - stream_read_uint16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */ - stream_read_uint16(s, pointer_color->xPos); /* xPos (2 bytes) */ - stream_read_uint16(s, pointer_color->yPos); /* yPos (2 bytes) */ - stream_read_uint16(s, pointer_color->width); /* width (2 bytes) */ - stream_read_uint16(s, pointer_color->height); /* height (2 bytes) */ - stream_read_uint16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */ - stream_read_uint16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */ + stream_read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */ + stream_read_UINT16(s, pointer_color->xPos); /* xPos (2 bytes) */ + stream_read_UINT16(s, pointer_color->yPos); /* yPos (2 bytes) */ + stream_read_UINT16(s, pointer_color->width); /* width (2 bytes) */ + stream_read_UINT16(s, pointer_color->height); /* height (2 bytes) */ + stream_read_UINT16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */ + stream_read_UINT16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */ /** * There does not seem to be any documentation on why @@ -196,39 +196,39 @@ void update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color) if (pointer_color->lengthXorMask > 0) { - pointer_color->xorMaskData = (uint8*) xmalloc(pointer_color->lengthXorMask); + pointer_color->xorMaskData = (BYTE*) malloc(pointer_color->lengthXorMask); stream_read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask); } if (pointer_color->lengthAndMask > 0) { - pointer_color->andMaskData = (uint8*) xmalloc(pointer_color->lengthAndMask); + pointer_color->andMaskData = (BYTE*) malloc(pointer_color->lengthAndMask); stream_read(s, pointer_color->andMaskData, pointer_color->lengthAndMask); } if (stream_get_left(s) > 0) - stream_seek_uint8(s); /* pad (1 byte) */ + stream_seek_BYTE(s); /* pad (1 byte) */ } void update_read_pointer_new(STREAM* s, POINTER_NEW_UPDATE* pointer_new) { - stream_read_uint16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */ + stream_read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */ update_read_pointer_color(s, &pointer_new->colorPtrAttr); /* colorPtrAttr */ } void update_read_pointer_cached(STREAM* s, POINTER_CACHED_UPDATE* pointer_cached) { - stream_read_uint16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */ + stream_read_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */ } void update_recv_pointer(rdpUpdate* update, STREAM* s) { - uint16 messageType; + UINT16 messageType; rdpContext* context = update->context; rdpPointerUpdate* pointer = update->pointer; - stream_read_uint16(s, messageType); /* messageType (2 bytes) */ - stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + stream_read_UINT16(s, messageType); /* messageType (2 bytes) */ + stream_seek_UINT16(s); /* pad2Octets (2 bytes) */ switch (messageType) { @@ -262,12 +262,12 @@ void update_recv_pointer(rdpUpdate* update, STREAM* s) } } -boolean update_recv(rdpUpdate* update, STREAM* s) +BOOL update_recv(rdpUpdate* update, STREAM* s) { - uint16 updateType; + UINT16 updateType; rdpContext* context = update->context; - stream_read_uint16(s, updateType); /* updateType (2 bytes) */ + stream_read_UINT16(s, updateType); /* updateType (2 bytes) */ //printf("%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]); @@ -279,7 +279,7 @@ boolean update_recv(rdpUpdate* update, STREAM* s) if (!update_recv_orders(update, s)) { /* XXX: Do we have to call EndPaint? */ - return false; + return FALSE; } break; @@ -301,7 +301,7 @@ boolean update_recv(rdpUpdate* update, STREAM* s) IFCALL(update->EndPaint, context); - return true; + return TRUE; } void update_reset_state(rdpUpdate* update) @@ -348,23 +348,23 @@ static void update_end_paint(rdpContext* context) } -static void update_write_refresh_rect(STREAM* s, uint8 count, RECTANGLE_16* areas) +static void update_write_refresh_rect(STREAM* s, BYTE count, RECTANGLE_16* areas) { int i; - stream_write_uint8(s, count); /* numberOfAreas (1 byte) */ + stream_write_BYTE(s, count); /* numberOfAreas (1 byte) */ stream_seek(s, 3); /* pad3Octets (3 bytes) */ for (i = 0; i < count; i++) { - stream_write_uint16(s, areas[i].left); /* left (2 bytes) */ - stream_write_uint16(s, areas[i].top); /* top (2 bytes) */ - stream_write_uint16(s, areas[i].right); /* right (2 bytes) */ - stream_write_uint16(s, areas[i].bottom); /* bottom (2 bytes) */ + stream_write_UINT16(s, areas[i].left); /* left (2 bytes) */ + stream_write_UINT16(s, areas[i].top); /* top (2 bytes) */ + stream_write_UINT16(s, areas[i].right); /* right (2 bytes) */ + stream_write_UINT16(s, areas[i].bottom); /* bottom (2 bytes) */ } } -static void update_send_refresh_rect(rdpContext* context, uint8 count, RECTANGLE_16* areas) +static void update_send_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas) { STREAM* s; rdpRdp* rdp = context->rdp; @@ -378,21 +378,21 @@ static void update_send_refresh_rect(rdpContext* context, uint8 count, RECTANGLE } } -static void update_write_suppress_output(STREAM* s, uint8 allow, RECTANGLE_16* area) +static void update_write_suppress_output(STREAM* s, BYTE allow, RECTANGLE_16* area) { - stream_write_uint8(s, allow); /* allowDisplayUpdates (1 byte) */ + stream_write_BYTE(s, allow); /* allowDisplayUpdates (1 byte) */ stream_seek(s, 3); /* pad3Octets (3 bytes) */ if (allow > 0) { - stream_write_uint16(s, area->left); /* left (2 bytes) */ - stream_write_uint16(s, area->top); /* top (2 bytes) */ - stream_write_uint16(s, area->right); /* right (2 bytes) */ - stream_write_uint16(s, area->bottom); /* bottom (2 bytes) */ + stream_write_UINT16(s, area->left); /* left (2 bytes) */ + stream_write_UINT16(s, area->top); /* top (2 bytes) */ + stream_write_UINT16(s, area->right); /* right (2 bytes) */ + stream_write_UINT16(s, area->bottom); /* bottom (2 bytes) */ } } -static void update_send_suppress_output(rdpContext* context, uint8 allow, RECTANGLE_16* area) +static void update_send_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area) { STREAM* s; rdpRdp* rdp = context->rdp; @@ -463,18 +463,18 @@ static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt) s = fastpath_update_pdu_init(rdp->fastpath); - stream_write_uint16(s, 1); /* numberOrders (2 bytes) */ - stream_write_uint8(s, ORDER_STANDARD | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */ - stream_write_uint8(s, ORDER_TYPE_SCRBLT); /* orderType (1 byte) */ - stream_write_uint8(s, 0x7F); /* fieldFlags (variable) */ + stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */ + stream_write_BYTE(s, ORDER_STANDARD | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */ + stream_write_BYTE(s, ORDER_TYPE_SCRBLT); /* orderType (1 byte) */ + stream_write_BYTE(s, 0x7F); /* fieldFlags (variable) */ - stream_write_uint16(s, scrblt->nLeftRect); - stream_write_uint16(s, scrblt->nTopRect); - stream_write_uint16(s, scrblt->nWidth); - stream_write_uint16(s, scrblt->nHeight); - stream_write_uint8(s, scrblt->bRop); - stream_write_uint16(s, scrblt->nXSrc); - stream_write_uint16(s, scrblt->nYSrc); + stream_write_UINT16(s, scrblt->nLeftRect); + stream_write_UINT16(s, scrblt->nTopRect); + stream_write_UINT16(s, scrblt->nWidth); + stream_write_UINT16(s, scrblt->nHeight); + stream_write_BYTE(s, scrblt->bRop); + stream_write_UINT16(s, scrblt->nXSrc); + stream_write_UINT16(s, scrblt->nYSrc); fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s); } @@ -482,7 +482,7 @@ static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt) static void update_send_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system) { STREAM* s; - uint8 updateCode; + BYTE updateCode; rdpRdp* rdp = context->rdp; s = fastpath_update_pdu_init(rdp->fastpath); @@ -499,13 +499,13 @@ static void update_write_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_ { stream_check_size(s, 15 + (int) pointer_color->lengthAndMask + (int) pointer_color->lengthXorMask); - stream_write_uint16(s, pointer_color->cacheIndex); - stream_write_uint16(s, pointer_color->xPos); - stream_write_uint16(s, pointer_color->yPos); - stream_write_uint16(s, pointer_color->width); - stream_write_uint16(s, pointer_color->height); - stream_write_uint16(s, pointer_color->lengthAndMask); - stream_write_uint16(s, pointer_color->lengthXorMask); + stream_write_UINT16(s, pointer_color->cacheIndex); + stream_write_UINT16(s, pointer_color->xPos); + stream_write_UINT16(s, pointer_color->yPos); + stream_write_UINT16(s, pointer_color->width); + stream_write_UINT16(s, pointer_color->height); + stream_write_UINT16(s, pointer_color->lengthAndMask); + stream_write_UINT16(s, pointer_color->lengthXorMask); if (pointer_color->lengthXorMask > 0) stream_write(s, pointer_color->xorMaskData, pointer_color->lengthXorMask); @@ -513,7 +513,7 @@ static void update_write_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_ if (pointer_color->lengthAndMask > 0) stream_write(s, pointer_color->andMaskData, pointer_color->lengthAndMask); - stream_write_uint8(s, 0); /* pad (1 byte) */ + stream_write_BYTE(s, 0); /* pad (1 byte) */ } static void update_send_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color) @@ -532,7 +532,7 @@ static void update_send_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* poi rdpRdp* rdp = context->rdp; s = fastpath_update_pdu_init(rdp->fastpath); - stream_write_uint16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */ + stream_write_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */ update_write_pointer_color(s, &pointer_new->colorPtrAttr); fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_POINTER, s); } @@ -543,56 +543,56 @@ static void update_send_pointer_cached(rdpContext* context, POINTER_CACHED_UPDAT rdpRdp* rdp = context->rdp; s = fastpath_update_pdu_init(rdp->fastpath); - stream_write_uint16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */ + stream_write_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */ fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_CACHED, s); } -boolean update_read_refresh_rect(rdpUpdate* update, STREAM* s) +BOOL update_read_refresh_rect(rdpUpdate* update, STREAM* s) { int index; - uint8 numberOfAreas; + BYTE numberOfAreas; RECTANGLE_16* areas; if (stream_get_left(s) < 4) - return false; + return FALSE; - stream_read_uint8(s, numberOfAreas); + stream_read_BYTE(s, numberOfAreas); stream_seek(s, 3); /* pad3Octects */ areas = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * numberOfAreas); for (index = 0; index < numberOfAreas; index++) { - stream_read_uint16(s, areas[index].left); - stream_read_uint16(s, areas[index].top); - stream_read_uint16(s, areas[index].right); - stream_read_uint16(s, areas[index].bottom); + stream_read_UINT16(s, areas[index].left); + stream_read_UINT16(s, areas[index].top); + stream_read_UINT16(s, areas[index].right); + stream_read_UINT16(s, areas[index].bottom); } IFCALL(update->RefreshRect, update->context, numberOfAreas, areas); free(areas); - return true; + return TRUE; } -boolean update_read_suppress_output(rdpUpdate* update, STREAM* s) +BOOL update_read_suppress_output(rdpUpdate* update, STREAM* s) { - uint8 allowDisplayUpdates; + BYTE allowDisplayUpdates; if (stream_get_left(s) < 4) - return false; + return FALSE; - stream_read_uint8(s, allowDisplayUpdates); + stream_read_BYTE(s, allowDisplayUpdates); stream_seek(s, 3); /* pad3Octects */ if (allowDisplayUpdates > 0 && stream_get_left(s) < 8) - return false; + return FALSE; IFCALL(update->SuppressOutput, update->context, allowDisplayUpdates, allowDisplayUpdates > 0 ? (RECTANGLE_16*) stream_get_tail(s) : NULL); - return true; + return TRUE; } void update_register_server_callbacks(rdpUpdate* update) @@ -638,7 +638,7 @@ rdpUpdate* update_new(rdpRdp* rdp) deleteList = &(update->altsec->create_offscreen_bitmap.deleteList); deleteList->sIndices = 64; - deleteList->indices = xmalloc(deleteList->sIndices * 2); + deleteList->indices = malloc(deleteList->sIndices * 2); deleteList->cIndices = 0; update->SuppressOutput = update_send_suppress_output; @@ -653,17 +653,17 @@ void update_free(rdpUpdate* update) { OFFSCREEN_DELETE_LIST* deleteList; deleteList = &(update->altsec->create_offscreen_bitmap.deleteList); - xfree(deleteList->indices); + free(deleteList->indices); - xfree(update->bitmap_update.rectangles); - xfree(update->pointer); - xfree(update->primary->polyline.points); - xfree(update->primary->polygon_sc.points); - xfree(update->primary); - xfree(update->secondary); - xfree(update->altsec); - xfree(update->window); - xfree(update); + free(update->bitmap_update.rectangles); + free(update->pointer); + free(update->primary->polyline.points); + free(update->primary->polygon_sc.points); + free(update->primary); + free(update->secondary); + free(update->altsec); + free(update->window); + free(update); } } diff --git a/libfreerdp/core/update.h b/libfreerdp/core/update.h index 0a69cc8f5..32c2d1c89 100644 --- a/libfreerdp/core/update.h +++ b/libfreerdp/core/update.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Update Data PDUs * * Copyright 2011 Marc-Andre Moreau @@ -44,7 +44,7 @@ void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_upda void update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_update); void update_recv_play_sound(rdpUpdate* update, STREAM* s); void update_recv_pointer(rdpUpdate* update, STREAM* s); -boolean update_recv(rdpUpdate* update, STREAM* s); +BOOL update_recv(rdpUpdate* update, STREAM* s); void update_read_pointer_position(STREAM* s, POINTER_POSITION_UPDATE* pointer_position); void update_read_pointer_system(STREAM* s, POINTER_SYSTEM_UPDATE* pointer_system); @@ -52,8 +52,8 @@ void update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color); void update_read_pointer_new(STREAM* s, POINTER_NEW_UPDATE* pointer_new); void update_read_pointer_cached(STREAM* s, POINTER_CACHED_UPDATE* pointer_cached); -boolean update_read_refresh_rect(rdpUpdate* update, STREAM* s); -boolean update_read_suppress_output(rdpUpdate* update, STREAM* s); +BOOL update_read_refresh_rect(rdpUpdate* update, STREAM* s); +BOOL update_read_suppress_output(rdpUpdate* update, STREAM* s); void update_register_server_callbacks(rdpUpdate* update); void update_register_client_callbacks(rdpUpdate* update); diff --git a/libfreerdp/core/window.c b/libfreerdp/core/window.c index b80a8ce9a..57127021e 100644 --- a/libfreerdp/core/window.c +++ b/libfreerdp/core/window.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windowing Alternate Secondary Orders * * Copyright 2011 Marc-Andre Moreau @@ -29,53 +29,53 @@ void update_read_icon_info(STREAM* s, ICON_INFO* icon_info) { - stream_read_uint16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */ - stream_read_uint8(s, icon_info->cacheId); /* cacheId (1 byte) */ - stream_read_uint8(s, icon_info->bpp); /* bpp (1 byte) */ - stream_read_uint16(s, icon_info->width); /* width (2 bytes) */ - stream_read_uint16(s, icon_info->height); /* height (2 bytes) */ + stream_read_UINT16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */ + stream_read_BYTE(s, icon_info->cacheId); /* cacheId (1 byte) */ + stream_read_BYTE(s, icon_info->bpp); /* bpp (1 byte) */ + stream_read_UINT16(s, icon_info->width); /* width (2 bytes) */ + stream_read_UINT16(s, icon_info->height); /* height (2 bytes) */ /* cbColorTable is only present when bpp is 1, 2 or 4 */ if (icon_info->bpp == 1 || icon_info->bpp == 2 || icon_info->bpp == 4) - stream_read_uint16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */ + stream_read_UINT16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */ else icon_info->cbColorTable = 0; - stream_read_uint16(s, icon_info->cbBitsMask); /* cbBitsMask (2 bytes) */ - stream_read_uint16(s, icon_info->cbBitsColor); /* cbBitsColor (2 bytes) */ + stream_read_UINT16(s, icon_info->cbBitsMask); /* cbBitsMask (2 bytes) */ + stream_read_UINT16(s, icon_info->cbBitsColor); /* cbBitsColor (2 bytes) */ /* bitsMask */ if (icon_info->bitsMask == NULL) - icon_info->bitsMask = (uint8*) xmalloc(icon_info->cbBitsMask); + icon_info->bitsMask = (BYTE*) malloc(icon_info->cbBitsMask); else - icon_info->bitsMask = (uint8*) xrealloc(icon_info->bitsMask, icon_info->cbBitsMask); + icon_info->bitsMask = (BYTE*) realloc(icon_info->bitsMask, icon_info->cbBitsMask); stream_read(s, icon_info->bitsMask, icon_info->cbBitsMask); /* colorTable */ if (icon_info->colorTable == NULL) - icon_info->colorTable = (uint8*) xmalloc(icon_info->cbColorTable); + icon_info->colorTable = (BYTE*) malloc(icon_info->cbColorTable); else - icon_info->colorTable = (uint8*) xrealloc(icon_info->colorTable, icon_info->cbColorTable); + icon_info->colorTable = (BYTE*) realloc(icon_info->colorTable, icon_info->cbColorTable); stream_read(s, icon_info->colorTable, icon_info->cbColorTable); /* bitsColor */ if (icon_info->bitsColor == NULL) - icon_info->bitsColor = (uint8*) xmalloc(icon_info->cbBitsColor); + icon_info->bitsColor = (BYTE*) malloc(icon_info->cbBitsColor); else - icon_info->bitsColor = (uint8*) xrealloc(icon_info->bitsColor, icon_info->cbBitsColor); + icon_info->bitsColor = (BYTE*) realloc(icon_info->bitsColor, icon_info->cbBitsColor); stream_read(s, icon_info->bitsColor, icon_info->cbBitsColor); } void update_read_cached_icon_info(STREAM* s, CACHED_ICON_INFO* cached_icon_info) { - stream_read_uint16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */ - stream_read_uint8(s, cached_icon_info->cacheId); /* cacheId (1 byte) */ + stream_read_UINT16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */ + stream_read_BYTE(s, cached_icon_info->cacheId); /* cacheId (1 byte) */ } void update_read_notify_icon_infotip(STREAM* s, NOTIFY_ICON_INFOTIP* notify_icon_infotip) { - stream_read_uint32(s, notify_icon_infotip->timeout); /* timeout (4 bytes) */ - stream_read_uint32(s, notify_icon_infotip->flags); /* infoFlags (4 bytes) */ + stream_read_UINT32(s, notify_icon_infotip->timeout); /* timeout (4 bytes) */ + stream_read_UINT32(s, notify_icon_infotip->flags); /* infoFlags (4 bytes) */ rail_read_unicode_string(s, ¬ify_icon_infotip->text); /* infoTipText */ rail_read_unicode_string(s, ¬ify_icon_infotip->title); /* title */ } @@ -86,93 +86,93 @@ void update_read_window_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WIN int size; if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER) - stream_read_uint32(s, window_state->ownerWindowId); /* ownerWindowId (4 bytes) */ + stream_read_UINT32(s, window_state->ownerWindowId); /* ownerWindowId (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE) { - stream_read_uint32(s, window_state->style); /* style (4 bytes) */ - stream_read_uint32(s, window_state->extendedStyle); /* extendedStyle (4 bytes) */ + stream_read_UINT32(s, window_state->style); /* style (4 bytes) */ + stream_read_UINT32(s, window_state->extendedStyle); /* extendedStyle (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW) - stream_read_uint8(s, window_state->showState); /* showState (1 byte) */ + stream_read_BYTE(s, window_state->showState); /* showState (1 byte) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) rail_read_unicode_string(s, &window_state->titleInfo); /* titleInfo */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET) { - stream_read_uint32(s, window_state->clientOffsetX); /* clientOffsetX (4 bytes) */ - stream_read_uint32(s, window_state->clientOffsetY); /* clientOffsetY (4 bytes) */ + stream_read_UINT32(s, window_state->clientOffsetX); /* clientOffsetX (4 bytes) */ + stream_read_UINT32(s, window_state->clientOffsetY); /* clientOffsetY (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE) { - stream_read_uint32(s, window_state->clientAreaWidth); /* clientAreaWidth (4 bytes) */ - stream_read_uint32(s, window_state->clientAreaHeight); /* clientAreaHeight (4 bytes) */ + stream_read_UINT32(s, window_state->clientAreaWidth); /* clientAreaWidth (4 bytes) */ + stream_read_UINT32(s, window_state->clientAreaHeight); /* clientAreaHeight (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT) - stream_read_uint8(s, window_state->RPContent); /* RPContent (1 byte) */ + stream_read_BYTE(s, window_state->RPContent); /* RPContent (1 byte) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT) - stream_read_uint32(s, window_state->rootParentHandle);/* rootParentHandle (4 bytes) */ + stream_read_UINT32(s, window_state->rootParentHandle);/* rootParentHandle (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) { - stream_read_uint32(s, window_state->windowOffsetX); /* windowOffsetX (4 bytes) */ - stream_read_uint32(s, window_state->windowOffsetY); /* windowOffsetY (4 bytes) */ + stream_read_UINT32(s, window_state->windowOffsetX); /* windowOffsetX (4 bytes) */ + stream_read_UINT32(s, window_state->windowOffsetY); /* windowOffsetY (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA) { - stream_read_uint32(s, window_state->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */ - stream_read_uint32(s, window_state->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */ + stream_read_UINT32(s, window_state->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */ + stream_read_UINT32(s, window_state->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE) { - stream_read_uint32(s, window_state->windowWidth); /* windowWidth (4 bytes) */ - stream_read_uint32(s, window_state->windowHeight); /* windowHeight (4 bytes) */ + stream_read_UINT32(s, window_state->windowWidth); /* windowWidth (4 bytes) */ + stream_read_UINT32(s, window_state->windowHeight); /* windowHeight (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS) { - stream_read_uint16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */ + stream_read_UINT16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */ size = sizeof(RECTANGLE_16) * window_state->numWindowRects; - window_state->windowRects = (RECTANGLE_16*) xmalloc(size); + window_state->windowRects = (RECTANGLE_16*) malloc(size); /* windowRects */ for (i = 0; i < (int) window_state->numWindowRects; i++) { - stream_read_uint16(s, window_state->windowRects[i].left); /* left (2 bytes) */ - stream_read_uint16(s, window_state->windowRects[i].top); /* top (2 bytes) */ - stream_read_uint16(s, window_state->windowRects[i].right); /* right (2 bytes) */ - stream_read_uint16(s, window_state->windowRects[i].bottom); /* bottom (2 bytes) */ + stream_read_UINT16(s, window_state->windowRects[i].left); /* left (2 bytes) */ + stream_read_UINT16(s, window_state->windowRects[i].top); /* top (2 bytes) */ + stream_read_UINT16(s, window_state->windowRects[i].right); /* right (2 bytes) */ + stream_read_UINT16(s, window_state->windowRects[i].bottom); /* bottom (2 bytes) */ } } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET) { - stream_read_uint32(s, window_state->visibleOffsetX); /* visibleOffsetX (4 bytes) */ - stream_read_uint32(s, window_state->visibleOffsetY); /* visibleOffsetY (4 bytes) */ + stream_read_UINT32(s, window_state->visibleOffsetX); /* visibleOffsetX (4 bytes) */ + stream_read_UINT32(s, window_state->visibleOffsetY); /* visibleOffsetY (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY) { - stream_read_uint16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */ + stream_read_UINT16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */ size = sizeof(RECTANGLE_16) * window_state->numVisibilityRects; - window_state->visibilityRects = (RECTANGLE_16*) xmalloc(size); + window_state->visibilityRects = (RECTANGLE_16*) malloc(size); /* visibilityRects */ for (i = 0; i < (int) window_state->numVisibilityRects; i++) { - stream_read_uint16(s, window_state->visibilityRects[i].left); /* left (2 bytes) */ - stream_read_uint16(s, window_state->visibilityRects[i].top); /* top (2 bytes) */ - stream_read_uint16(s, window_state->visibilityRects[i].right); /* right (2 bytes) */ - stream_read_uint16(s, window_state->visibilityRects[i].bottom); /* bottom (2 bytes) */ + stream_read_UINT16(s, window_state->visibilityRects[i].left); /* left (2 bytes) */ + stream_read_UINT16(s, window_state->visibilityRects[i].top); /* top (2 bytes) */ + stream_read_UINT16(s, window_state->visibilityRects[i].right); /* right (2 bytes) */ + stream_read_UINT16(s, window_state->visibilityRects[i].bottom); /* bottom (2 bytes) */ } } } @@ -198,7 +198,7 @@ void update_recv_window_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_IN rdpContext* context = update->context; rdpWindowUpdate* window = update->window; - stream_read_uint32(s, orderInfo->windowId); /* windowId (4 bytes) */ + stream_read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_ICON) { @@ -233,7 +233,7 @@ void update_recv_window_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_IN void update_read_notification_icon_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state) { if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION) - stream_read_uint32(s, notify_icon_state->version); /* version (4 bytes) */ + stream_read_UINT32(s, notify_icon_state->version); /* version (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP) rail_read_unicode_string(s, ¬ify_icon_state->toolTip); /* toolTip (UNICODE_STRING) */ @@ -242,7 +242,7 @@ void update_read_notification_icon_state_order(STREAM* s, WINDOW_ORDER_INFO* ord update_read_notify_icon_infotip(s, ¬ify_icon_state->infoTip); /* infoTip (NOTIFY_ICON_INFOTIP) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_STATE) - stream_read_uint32(s, notify_icon_state->state); /* state (4 bytes) */ + stream_read_UINT32(s, notify_icon_state->state); /* state (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_ICON) update_read_icon_info(s, ¬ify_icon_state->icon); /* icon (ICON_INFO) */ @@ -261,8 +261,8 @@ void update_recv_notification_icon_info_order(rdpUpdate* update, STREAM* s, WIND rdpContext* context = update->context; rdpWindowUpdate* window = update->window; - stream_read_uint32(s, orderInfo->windowId); /* windowId (4 bytes) */ - stream_read_uint32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */ + stream_read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */ + stream_read_UINT32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED) { @@ -288,23 +288,23 @@ void update_read_desktop_actively_monitored_order(STREAM* s, WINDOW_ORDER_INFO* int size; if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND) - stream_read_uint32(s, monitored_desktop->activeWindowId); /* activeWindowId (4 bytes) */ + stream_read_UINT32(s, monitored_desktop->activeWindowId); /* activeWindowId (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER) { - stream_read_uint8(s, monitored_desktop->numWindowIds); /* numWindowIds (1 byte) */ + stream_read_BYTE(s, monitored_desktop->numWindowIds); /* numWindowIds (1 byte) */ - size = sizeof(uint32) * monitored_desktop->numWindowIds; + size = sizeof(UINT32) * monitored_desktop->numWindowIds; if (monitored_desktop->windowIds == NULL) - monitored_desktop->windowIds = (uint32*) xmalloc(size); + monitored_desktop->windowIds = (UINT32*) malloc(size); else - monitored_desktop->windowIds = (uint32*) xrealloc(monitored_desktop->windowIds, size); + monitored_desktop->windowIds = (UINT32*) realloc(monitored_desktop->windowIds, size); /* windowIds */ for (i = 0; i < (int) monitored_desktop->numWindowIds; i++) { - stream_read_uint32(s, monitored_desktop->windowIds[i]); + stream_read_UINT32(s, monitored_desktop->windowIds[i]); } } } @@ -335,11 +335,11 @@ void update_recv_desktop_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_I void update_recv_altsec_window_order(rdpUpdate* update, STREAM* s) { - uint16 orderSize; + UINT16 orderSize; rdpWindowUpdate* window = update->window; - stream_read_uint16(s, orderSize); /* orderSize (2 bytes) */ - stream_read_uint32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */ + stream_read_UINT16(s, orderSize); /* orderSize (2 bytes) */ + stream_read_UINT32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */ if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW) update_recv_window_info_order(update, s, &window->orderInfo); diff --git a/libfreerdp/core/window.h b/libfreerdp/core/window.h index 3ee0dff97..7f173ddc2 100644 --- a/libfreerdp/core/window.h +++ b/libfreerdp/core/window.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Windowing Alternate Secondary Orders * * Copyright 2011 Marc-Andre Moreau diff --git a/libfreerdp/crypto/CMakeLists.txt b/libfreerdp/crypto/CMakeLists.txt index 33f984a63..4cd1b0e8d 100644 --- a/libfreerdp/crypto/CMakeLists.txt +++ b/libfreerdp/crypto/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-crypto cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -28,7 +28,7 @@ set(${MODULE_PREFIX}_SRCS crypto.c tls.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -42,7 +42,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} set(${MODULE_PREFIX}_LIBS ${OPENSSL_LIBRARIES}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-sspi) @@ -58,13 +58,15 @@ else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ZLIB_LIBRARIES}) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-crt) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-utils) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/crypto/ber.c b/libfreerdp/crypto/ber.c index 3fe817a40..4c6383c5a 100644 --- a/libfreerdp/crypto/ber.c +++ b/libfreerdp/crypto/ber.c @@ -25,18 +25,18 @@ void ber_read_length(STREAM* s, int* length) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte & 0x80) { byte &= ~(0x80); if (byte == 1) - stream_read_uint8(s, *length); + stream_read_BYTE(s, *length); if (byte == 2) - stream_read_uint16_be(s, *length); + stream_read_UINT16_be(s, *length); } else { @@ -54,13 +54,13 @@ int ber_write_length(STREAM* s, int length) { if (length > 0x7F) { - stream_write_uint8(s, 0x82); - stream_write_uint16_be(s, length); + stream_write_BYTE(s, 0x82); + stream_write_UINT16_be(s, length); return 3; } else { - stream_write_uint8(s, length); + stream_write_BYTE(s, length); return 1; } } @@ -88,28 +88,28 @@ int ber_get_content_length(int length) * @return */ -boolean ber_read_universal_tag(STREAM* s, uint8 tag, boolean pc) +BOOL ber_read_universal_tag(STREAM* s, BYTE tag, BOOL pc) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != (BER_CLASS_UNIV | BER_PC(pc) | (BER_TAG_MASK & tag))) - return false; + return FALSE; - return true; + return TRUE; } /** * Write BER Universal tag. * @param s stream * @param tag BER universally-defined tag - * @param pc primitive (false) or constructed (true) + * @param pc primitive (FALSE) or constructed (TRUE) */ -void ber_write_universal_tag(STREAM* s, uint8 tag, boolean pc) +void ber_write_universal_tag(STREAM* s, BYTE tag, BOOL pc) { - stream_write_uint8(s, (BER_CLASS_UNIV | BER_PC(pc)) | (BER_TAG_MASK & tag)); + stream_write_BYTE(s, (BER_CLASS_UNIV | BER_PC(pc)) | (BER_TAG_MASK & tag)); } /** @@ -119,35 +119,35 @@ void ber_write_universal_tag(STREAM* s, uint8 tag, boolean pc) * @param length length */ -boolean ber_read_application_tag(STREAM* s, uint8 tag, int* length) +BOOL ber_read_application_tag(STREAM* s, BYTE tag, int* length) { - uint8 byte; + BYTE byte; if (tag > 30) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((BER_CLASS_APPL | BER_CONSTRUCT) | BER_TAG_MASK)) - return false; + return FALSE; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != tag) - return false; + return FALSE; ber_read_length(s, length); } else { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((BER_CLASS_APPL | BER_CONSTRUCT) | (BER_TAG_MASK & tag))) - return false; + return FALSE; ber_read_length(s, length); } - return true; + return TRUE; } /** @@ -157,41 +157,41 @@ boolean ber_read_application_tag(STREAM* s, uint8 tag, int* length) * @param length length */ -void ber_write_application_tag(STREAM* s, uint8 tag, int length) +void ber_write_application_tag(STREAM* s, BYTE tag, int length) { if (tag > 30) { - stream_write_uint8(s, (BER_CLASS_APPL | BER_CONSTRUCT) | BER_TAG_MASK); - stream_write_uint8(s, tag); + stream_write_BYTE(s, (BER_CLASS_APPL | BER_CONSTRUCT) | BER_TAG_MASK); + stream_write_BYTE(s, tag); ber_write_length(s, length); } else { - stream_write_uint8(s, (BER_CLASS_APPL | BER_CONSTRUCT) | (BER_TAG_MASK & tag)); + stream_write_BYTE(s, (BER_CLASS_APPL | BER_CONSTRUCT) | (BER_TAG_MASK & tag)); ber_write_length(s, length); } } -boolean ber_read_contextual_tag(STREAM* s, uint8 tag, int* length, boolean pc) +BOOL ber_read_contextual_tag(STREAM* s, BYTE tag, int* length, BOOL pc) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((BER_CLASS_CTXT | BER_PC(pc)) | (BER_TAG_MASK & tag))) { stream_rewind(s, 1); - return false; + return FALSE; } ber_read_length(s, length); - return true; + return TRUE; } -int ber_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc) +int ber_write_contextual_tag(STREAM* s, BYTE tag, int length, BOOL pc) { - stream_write_uint8(s, (BER_CLASS_CTXT | BER_PC(pc)) | (BER_TAG_MASK & tag)); + stream_write_BYTE(s, (BER_CLASS_CTXT | BER_PC(pc)) | (BER_TAG_MASK & tag)); return ber_write_length(s, length) + 1; } @@ -200,18 +200,18 @@ int ber_skip_contextual_tag(int length) return _ber_skip_length(length) + 1; } -boolean ber_read_sequence_tag(STREAM* s, int* length) +BOOL ber_read_sequence_tag(STREAM* s, int* length) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((BER_CLASS_UNIV | BER_CONSTRUCT) | (BER_TAG_SEQUENCE_OF))) - return false; + return FALSE; ber_read_length(s, length); - return true; + return TRUE; } /** @@ -222,7 +222,7 @@ boolean ber_read_sequence_tag(STREAM* s, int* length) int ber_write_sequence_tag(STREAM* s, int length) { - stream_write_uint8(s, (BER_CLASS_UNIV | BER_CONSTRUCT) | (BER_TAG_MASK & BER_TAG_SEQUENCE)); + stream_write_BYTE(s, (BER_CLASS_UNIV | BER_CONSTRUCT) | (BER_TAG_MASK & BER_TAG_SEQUENCE)); return ber_write_length(s, length) + 1; } @@ -236,39 +236,39 @@ int ber_skip_sequence_tag(int length) return 1 + _ber_skip_length(length); } -boolean ber_read_enumerated(STREAM* s, uint8* enumerated, uint8 count) +BOOL ber_read_enumerated(STREAM* s, BYTE* enumerated, BYTE count) { int length; - ber_read_universal_tag(s, BER_TAG_ENUMERATED, false); + ber_read_universal_tag(s, BER_TAG_ENUMERATED, FALSE); ber_read_length(s, &length); if (length == 1) - stream_read_uint8(s, *enumerated); + stream_read_BYTE(s, *enumerated); else - return false; + return FALSE; /* check that enumerated value falls within expected range */ if (*enumerated + 1 > count) - return false; + return FALSE; - return true; + return TRUE; } -void ber_write_enumerated(STREAM* s, uint8 enumerated, uint8 count) +void ber_write_enumerated(STREAM* s, BYTE enumerated, BYTE count) { - ber_write_universal_tag(s, BER_TAG_ENUMERATED, false); + ber_write_universal_tag(s, BER_TAG_ENUMERATED, FALSE); ber_write_length(s, 1); - stream_write_uint8(s, enumerated); + stream_write_BYTE(s, enumerated); } -boolean ber_read_bit_string(STREAM* s, int* length, uint8* padding) +BOOL ber_read_bit_string(STREAM* s, int* length, BYTE* padding) { - ber_read_universal_tag(s, BER_TAG_BIT_STRING, false); + ber_read_universal_tag(s, BER_TAG_BIT_STRING, FALSE); ber_read_length(s, length); - stream_read_uint8(s, *padding); + stream_read_BYTE(s, *padding); - return true; + return TRUE; } /** @@ -278,23 +278,23 @@ boolean ber_read_bit_string(STREAM* s, int* length, uint8* padding) * @param length string length */ -void ber_write_octet_string(STREAM* s, const uint8* oct_str, int length) +void ber_write_octet_string(STREAM* s, const BYTE* oct_str, int length) { - ber_write_universal_tag(s, BER_TAG_OCTET_STRING, false); + ber_write_universal_tag(s, BER_TAG_OCTET_STRING, FALSE); ber_write_length(s, length); stream_write(s, oct_str, length); } -boolean ber_read_octet_string_tag(STREAM* s, int* length) +BOOL ber_read_octet_string_tag(STREAM* s, int* length) { - ber_read_universal_tag(s, BER_TAG_OCTET_STRING, false); + ber_read_universal_tag(s, BER_TAG_OCTET_STRING, FALSE); ber_read_length(s, length); - return true; + return TRUE; } int ber_write_octet_string_tag(STREAM* s, int length) { - ber_write_universal_tag(s, BER_TAG_OCTET_STRING, false); + ber_write_universal_tag(s, BER_TAG_OCTET_STRING, FALSE); ber_write_length(s, length); return 1 + _ber_skip_length(length); } @@ -310,19 +310,19 @@ int ber_skip_octet_string(int length) * @param value */ -boolean ber_read_boolean(STREAM* s, boolean* value) +BOOL ber_read_BOOL(STREAM* s, BOOL* value) { int length; - uint8 v; + BYTE v; - if (!ber_read_universal_tag(s, BER_TAG_BOOLEAN, false)) - return false; + if (!ber_read_universal_tag(s, BER_TAG_BOOLEAN, FALSE)) + return FALSE; ber_read_length(s, &length); if (length != 1) - return false; - stream_read_uint8(s, v); - *value = (v ? true : false); - return true; + return FALSE; + stream_read_BYTE(s, v); + *value = (v ? TRUE : FALSE); + return TRUE; } /** @@ -331,43 +331,43 @@ boolean ber_read_boolean(STREAM* s, boolean* value) * @param value */ -void ber_write_boolean(STREAM* s, boolean value) +void ber_write_BOOL(STREAM* s, BOOL value) { - ber_write_universal_tag(s, BER_TAG_BOOLEAN, false); + ber_write_universal_tag(s, BER_TAG_BOOLEAN, FALSE); ber_write_length(s, 1); - stream_write_uint8(s, (value == true) ? 0xFF : 0); + stream_write_BYTE(s, (value == TRUE) ? 0xFF : 0); } -boolean ber_read_integer(STREAM* s, uint32* value) +BOOL ber_read_integer(STREAM* s, UINT32* value) { int length; - ber_read_universal_tag(s, BER_TAG_INTEGER, false); + ber_read_universal_tag(s, BER_TAG_INTEGER, FALSE); ber_read_length(s, &length); if (value == NULL) { stream_seek(s, length); - return true; + return TRUE; } if (length == 1) - stream_read_uint8(s, *value); + stream_read_BYTE(s, *value); else if (length == 2) - stream_read_uint16_be(s, *value); + stream_read_UINT16_be(s, *value); else if (length == 3) { - uint8 byte; - stream_read_uint8(s, byte); - stream_read_uint16_be(s, *value); + BYTE byte; + stream_read_BYTE(s, byte); + stream_read_UINT16_be(s, *value); *value += (byte << 16); } else if (length == 4) - stream_read_uint32_be(s, *value); + stream_read_UINT32_be(s, *value); else - return false; + return FALSE; - return true; + return TRUE; } /** @@ -376,40 +376,40 @@ boolean ber_read_integer(STREAM* s, uint32* value) * @param value */ -int ber_write_integer(STREAM* s, uint32 value) +int ber_write_integer(STREAM* s, UINT32 value) { - ber_write_universal_tag(s, BER_TAG_INTEGER, false); + ber_write_universal_tag(s, BER_TAG_INTEGER, FALSE); if (value <= 0xFF) { ber_write_length(s, 1); - stream_write_uint8(s, value); + stream_write_BYTE(s, value); return 2; } else if (value < 0xFF80) { ber_write_length(s, 2); - stream_write_uint16_be(s, value); + stream_write_UINT16_be(s, value); return 3; } else if (value < 0xFF8000) { ber_write_length(s, 3); - stream_write_uint8(s, (value >> 16)); - stream_write_uint16_be(s, (value & 0xFFFF)); + stream_write_BYTE(s, (value >> 16)); + stream_write_UINT16_be(s, (value & 0xFFFF)); return 4; } else if (value <= 0xFFFFFFFF) { ber_write_length(s, 4); - stream_write_uint32_be(s, value); + stream_write_UINT32_be(s, value); return 5; } return 0; } -int ber_skip_integer(uint32 value) +int ber_skip_integer(UINT32 value) { if (value <= 0xFF) { @@ -427,9 +427,9 @@ int ber_skip_integer(uint32 value) return 0; } -boolean ber_read_integer_length(STREAM* s, int* length) +BOOL ber_read_integer_length(STREAM* s, int* length) { - ber_read_universal_tag(s, BER_TAG_INTEGER, false); + ber_read_universal_tag(s, BER_TAG_INTEGER, FALSE); ber_read_length(s, length); - return true; + return TRUE; } diff --git a/libfreerdp/crypto/certificate.c b/libfreerdp/crypto/certificate.c index 61e0ab0f3..5e3d56923 100644 --- a/libfreerdp/crypto/certificate.c +++ b/libfreerdp/crypto/certificate.c @@ -26,6 +26,8 @@ #include #include +#include + #include #include @@ -46,7 +48,7 @@ void certificate_store_init(rdpCertificateStore* certificate_store) config_path = freerdp_get_config_path(settings); certificate_store->path = freerdp_construct_path(config_path, (char*) certificate_store_dir); - if (freerdp_check_file_exists(certificate_store->path) == false) + if (freerdp_check_file_exists(certificate_store->path) == FALSE) { freerdp_mkdir(certificate_store->path); printf("creating directory %s\n", certificate_store->path); @@ -54,7 +56,7 @@ void certificate_store_init(rdpCertificateStore* certificate_store) certificate_store->file = freerdp_construct_path(config_path, (char*) certificate_known_hosts_file); - if (freerdp_check_file_exists(certificate_store->file) == false) + if (freerdp_check_file_exists(certificate_store->file) == FALSE) { certificate_store->fp = fopen((char*) certificate_store->file, "w+"); @@ -93,11 +95,11 @@ int certificate_data_match(rdpCertificateStore* certificate_store, rdpCertificat if (size < 1) return match; - data = (char*) xmalloc(size + 2); + data = (char*) malloc(size + 2); if (fread(data, size, 1, fp) != 1) { - xfree(data); + free(data); return match; } @@ -128,7 +130,7 @@ int certificate_data_match(rdpCertificateStore* certificate_store, rdpCertificat pline = strtok(NULL, "\n"); } - xfree(data); + free(data); return match; } @@ -154,11 +156,11 @@ void certificate_data_replace(rdpCertificateStore* certificate_store, rdpCertifi if (size < 1) return; - data = (char*) xmalloc(size + 2); + data = (char*) malloc(size + 2); if (fread(data, size, 1, fp) != 1) { - xfree(data); + free(data); return; } @@ -192,7 +194,7 @@ void certificate_data_replace(rdpCertificateStore* certificate_store, rdpCertifi } fclose(fp); - xfree(data); + free(data); } void certificate_data_print(rdpCertificateStore* certificate_store, rdpCertificateData* certificate_data) @@ -217,8 +219,8 @@ rdpCertificateData* certificate_data_new(char* hostname, char* fingerprint) if (certdata != NULL) { - certdata->hostname = xstrdup(hostname); - certdata->fingerprint = xstrdup(fingerprint); + certdata->hostname = _strdup(hostname); + certdata->fingerprint = _strdup(fingerprint); } return certdata; @@ -228,9 +230,9 @@ void certificate_data_free(rdpCertificateData* certificate_data) { if (certificate_data != NULL) { - xfree(certificate_data->hostname); - xfree(certificate_data->fingerprint); - xfree(certificate_data); + free(certificate_data->hostname); + free(certificate_data->fingerprint); + free(certificate_data); } } @@ -256,8 +258,8 @@ void certificate_store_free(rdpCertificateStore* certstore) if (certstore->fp != NULL) fclose(certstore->fp); - xfree(certstore->path); - xfree(certstore->file); - xfree(certstore); + free(certstore->path); + free(certstore->file); + free(certstore); } } diff --git a/libfreerdp/crypto/crypto.c b/libfreerdp/crypto/crypto.c index a520e52e4..509637b16 100644 --- a/libfreerdp/crypto/crypto.c +++ b/libfreerdp/crypto/crypto.c @@ -25,48 +25,48 @@ CryptoSha1 crypto_sha1_init(void) { - CryptoSha1 sha1 = xmalloc(sizeof(*sha1)); + CryptoSha1 sha1 = malloc(sizeof(*sha1)); SHA1_Init(&sha1->sha_ctx); return sha1; } -void crypto_sha1_update(CryptoSha1 sha1, const uint8* data, uint32 length) +void crypto_sha1_update(CryptoSha1 sha1, const BYTE* data, UINT32 length) { SHA1_Update(&sha1->sha_ctx, data, length); } -void crypto_sha1_final(CryptoSha1 sha1, uint8* out_data) +void crypto_sha1_final(CryptoSha1 sha1, BYTE* out_data) { SHA1_Final(out_data, &sha1->sha_ctx); - xfree(sha1); + free(sha1); } CryptoMd5 crypto_md5_init(void) { - CryptoMd5 md5 = xmalloc(sizeof(*md5)); + CryptoMd5 md5 = malloc(sizeof(*md5)); MD5_Init(&md5->md5_ctx); return md5; } -void crypto_md5_update(CryptoMd5 md5, const uint8* data, uint32 length) +void crypto_md5_update(CryptoMd5 md5, const BYTE* data, UINT32 length) { MD5_Update(&md5->md5_ctx, data, length); } -void crypto_md5_final(CryptoMd5 md5, uint8* out_data) +void crypto_md5_final(CryptoMd5 md5, BYTE* out_data) { MD5_Final(out_data, &md5->md5_ctx); - xfree(md5); + free(md5); } -CryptoRc4 crypto_rc4_init(const uint8* key, uint32 length) +CryptoRc4 crypto_rc4_init(const BYTE* key, UINT32 length) { - CryptoRc4 rc4 = xmalloc(sizeof(*rc4)); + CryptoRc4 rc4 = malloc(sizeof(*rc4)); RC4_set_key(&rc4->rc4_key, length, key); return rc4; } -void crypto_rc4(CryptoRc4 rc4, uint32 length, const uint8* in_data, uint8* out_data) +void crypto_rc4(CryptoRc4 rc4, UINT32 length, const BYTE* in_data, BYTE* out_data) { RC4(&rc4->rc4_key, length, in_data, out_data); } @@ -74,34 +74,34 @@ void crypto_rc4(CryptoRc4 rc4, uint32 length, const uint8* in_data, uint8* out_d void crypto_rc4_free(CryptoRc4 rc4) { if (rc4) - xfree(rc4); + free(rc4); } -CryptoDes3 crypto_des3_encrypt_init(const uint8* key, const uint8* ivec) +CryptoDes3 crypto_des3_encrypt_init(const BYTE* key, const BYTE* ivec) { - CryptoDes3 des3 = xmalloc(sizeof(*des3)); + CryptoDes3 des3 = malloc(sizeof(*des3)); EVP_CIPHER_CTX_init(&des3->des3_ctx); EVP_EncryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec); EVP_CIPHER_CTX_set_padding(&des3->des3_ctx, 0); return des3; } -CryptoDes3 crypto_des3_decrypt_init(const uint8* key, const uint8* ivec) +CryptoDes3 crypto_des3_decrypt_init(const BYTE* key, const BYTE* ivec) { - CryptoDes3 des3 = xmalloc(sizeof(*des3)); + CryptoDes3 des3 = malloc(sizeof(*des3)); EVP_CIPHER_CTX_init(&des3->des3_ctx); EVP_DecryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec); EVP_CIPHER_CTX_set_padding(&des3->des3_ctx, 0); return des3; } -void crypto_des3_encrypt(CryptoDes3 des3, uint32 length, const uint8* in_data, uint8* out_data) +void crypto_des3_encrypt(CryptoDes3 des3, UINT32 length, const BYTE* in_data, BYTE* out_data) { int len; EVP_EncryptUpdate(&des3->des3_ctx, out_data, &len, in_data, length); } -void crypto_des3_decrypt(CryptoDes3 des3, uint32 length, const uint8* in_data, uint8* out_data) +void crypto_des3_decrypt(CryptoDes3 des3, UINT32 length, const BYTE* in_data, BYTE* out_data) { int len; EVP_DecryptUpdate(&des3->des3_ctx, out_data, &len, in_data, length); @@ -115,27 +115,27 @@ void crypto_des3_free(CryptoDes3 des3) if (des3 == NULL) return; EVP_CIPHER_CTX_cleanup(&des3->des3_ctx); - xfree(des3); + free(des3); } CryptoHmac crypto_hmac_new(void) { - CryptoHmac hmac = xmalloc(sizeof(*hmac)); + CryptoHmac hmac = malloc(sizeof(*hmac)); HMAC_CTX_init(&hmac->hmac_ctx); return hmac; } -void crypto_hmac_sha1_init(CryptoHmac hmac, const uint8* data, uint32 length) +void crypto_hmac_sha1_init(CryptoHmac hmac, const BYTE* data, UINT32 length) { HMAC_Init_ex(&hmac->hmac_ctx, data, length, EVP_sha1(), NULL); } -void crypto_hmac_update(CryptoHmac hmac, const uint8* data, uint32 length) +void crypto_hmac_update(CryptoHmac hmac, const BYTE* data, UINT32 length) { HMAC_Update(&hmac->hmac_ctx, data, length); } -void crypto_hmac_final(CryptoHmac hmac, uint8* out_data, uint32 length) +void crypto_hmac_final(CryptoHmac hmac, BYTE* out_data, UINT32 length) { HMAC_Final(&hmac->hmac_ctx, out_data, &length); } @@ -145,14 +145,14 @@ void crypto_hmac_free(CryptoHmac hmac) if (hmac == NULL) return; HMAC_CTX_cleanup(&hmac->hmac_ctx); - xfree(hmac); + free(hmac); } -CryptoCert crypto_cert_read(uint8* data, uint32 length) +CryptoCert crypto_cert_read(BYTE* data, UINT32 length) { - CryptoCert cert = xmalloc(sizeof(*cert)); + CryptoCert cert = malloc(sizeof(*cert)); /* this will move the data pointer but we don't care, we don't use it again */ - cert->px509 = d2i_X509(NULL, (D2I_X509_CONST uint8 **) &data, length); + cert->px509 = d2i_X509(NULL, (D2I_X509_CONST BYTE **) &data, length); return cert; } @@ -163,14 +163,14 @@ void crypto_cert_free(CryptoCert cert) X509_free(cert->px509); - xfree(cert); + free(cert); } -boolean crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* PublicKeyLength) +BOOL crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* PublicKeyLength) { BYTE* ptr; int length; - boolean status = true; + BOOL status = TRUE; EVP_PKEY* pkey = NULL; pkey = X509_get_pubkey(cert->px509); @@ -178,7 +178,7 @@ boolean crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* Pub if (!pkey) { printf("crypto_cert_get_public_key: X509_get_pubkey() failed\n"); - status = false; + status = FALSE; goto exit; } @@ -187,7 +187,7 @@ boolean crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* Pub if (length < 1) { printf("crypto_cert_get_public_key: i2d_PublicKey() failed\n"); - status = false; + status = FALSE; goto exit; } @@ -204,16 +204,16 @@ exit: return status; } -static void crypto_rsa_common(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, int exponent_size, uint8* output) +static void crypto_rsa_common(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, int exponent_size, BYTE* output) { BN_CTX* ctx; int output_length; - uint8* input_reverse; - uint8* modulus_reverse; - uint8* exponent_reverse; + BYTE* input_reverse; + BYTE* modulus_reverse; + BYTE* exponent_reverse; BIGNUM mod, exp, x, y; - input_reverse = (uint8*) xmalloc(2 * key_length + exponent_size); + input_reverse = (BYTE*) malloc(2 * key_length + exponent_size); modulus_reverse = input_reverse + key_length; exponent_reverse = modulus_reverse + key_length; @@ -246,54 +246,54 @@ static void crypto_rsa_common(const uint8* input, int length, uint32 key_length, BN_free(&exp); BN_free(&mod); BN_CTX_free(ctx); - xfree(input_reverse); + free(input_reverse); } -static void crypto_rsa_public(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, uint8* output) +static void crypto_rsa_public(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output) { crypto_rsa_common(input, length, key_length, modulus, exponent, EXPONENT_MAX_SIZE, output); } -static void crypto_rsa_private(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* private_exponent, uint8* output) +static void crypto_rsa_private(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output) { crypto_rsa_common(input, length, key_length, modulus, private_exponent, key_length, output); } -void crypto_rsa_public_encrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, uint8* output) +void crypto_rsa_public_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output) { crypto_rsa_public(input, length, key_length, modulus, exponent, output); } -void crypto_rsa_public_decrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, uint8* output) +void crypto_rsa_public_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output) { crypto_rsa_public(input, length, key_length, modulus, exponent, output); } -void crypto_rsa_private_encrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* private_exponent, uint8* output) +void crypto_rsa_private_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output) { crypto_rsa_private(input, length, key_length, modulus, private_exponent, output); } -void crypto_rsa_private_decrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* private_exponent, uint8* output) +void crypto_rsa_private_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output) { crypto_rsa_private(input, length, key_length, modulus, private_exponent, output); } -void crypto_rsa_decrypt(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* private_exponent, uint8* output) +void crypto_rsa_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output) { crypto_rsa_common(input, length, key_length, modulus, private_exponent, key_length, output); } -void crypto_reverse(uint8* data, int length) +void crypto_reverse(BYTE* data, int length) { int i, j; - uint8 temp; + BYTE temp; for (i = 0, j = length - 1; i < j; i++, j--) { @@ -303,7 +303,7 @@ void crypto_reverse(uint8* data, int length) } } -void crypto_nonce(uint8* nonce, int size) +void crypto_nonce(BYTE* nonce, int size) { RAND_bytes((void*) nonce, size); } @@ -313,8 +313,8 @@ char* crypto_cert_fingerprint(X509* xcert) int i = 0; char* p; char* fp_buffer; - uint32 fp_len; - uint8 fp[EVP_MAX_MD_SIZE]; + UINT32 fp_len; + BYTE fp[EVP_MAX_MD_SIZE]; X509_digest(xcert, EVP_sha1(), fp, &fp_len); @@ -357,7 +357,7 @@ char* crypto_cert_subject(X509* xcert) char* crypto_cert_subject_common_name(X509* xcert, int* length) { int index; - uint8* common_name; + BYTE* common_name; X509_NAME* subject_name; X509_NAME_ENTRY* entry; ASN1_STRING* entry_data; @@ -395,7 +395,7 @@ char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths) int index; int length; char** strings; - uint8* string; + BYTE* string; int num_subject_alt_names; GENERAL_NAMES* subject_alt_names; GENERAL_NAME* subject_alt_name; @@ -407,8 +407,8 @@ char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths) return NULL; num_subject_alt_names = sk_GENERAL_NAME_num(subject_alt_names); - strings = (char**) xmalloc(sizeof(char*) * num_subject_alt_names); - *lengths = (int*) xmalloc(sizeof(int*) * num_subject_alt_names); + strings = (char**) malloc(sizeof(char*) * num_subject_alt_names); + *lengths = (int*) malloc(sizeof(int*) * num_subject_alt_names); for (index = 0; index < num_subject_alt_names; ++index) { @@ -425,8 +425,8 @@ char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths) if (*count < 1) { - xfree(strings) ; - xfree(*lengths) ; + free(strings) ; + free(*lengths) ; *lengths = NULL ; return NULL; } @@ -439,10 +439,10 @@ char* crypto_cert_issuer(X509* xcert) return crypto_print_name(X509_get_issuer_name(xcert)); } -boolean x509_verify_certificate(CryptoCert cert, char* certificate_store_path) +BOOL x509_verify_certificate(CryptoCert cert, char* certificate_store_path) { X509_STORE_CTX* csc; - boolean status = false; + BOOL status = FALSE; X509_STORE* cert_ctx = NULL; X509_LOOKUP* lookup = NULL; X509* xcert = cert->px509; @@ -481,7 +481,7 @@ boolean x509_verify_certificate(CryptoCert cert, char* certificate_store_path) goto end; if (X509_verify_cert(csc) == 1) - status = true; + status = TRUE; X509_STORE_CTX_free(csc); X509_STORE_free(cert_ctx); @@ -497,7 +497,7 @@ rdpCertificateData* crypto_get_certificate_data(X509* xcert, char* hostname) fp = crypto_cert_fingerprint(xcert); certdata = certificate_data_new(hostname, fp); - xfree(fp); + free(fp); return certdata; } @@ -520,12 +520,12 @@ void crypto_cert_print_info(X509* xcert) "the CA certificate in your certificate store, or the certificate has expired. " "Please look at the documentation on how to create local certificate store for a private CA.\n"); - xfree(subject); - xfree(issuer); - xfree(fp); + free(subject); + free(issuer); + free(fp); } -char* crypto_base64_encode(uint8* data, int length) +char* crypto_base64_encode(BYTE* data, int length) { BIO* bmem; BIO* b64; @@ -543,7 +543,7 @@ char* crypto_base64_encode(uint8* data, int length) BIO_get_mem_ptr(b64, &bptr); - base64_string = xmalloc(bptr->length); + base64_string = malloc(bptr->length); memcpy(base64_string, bptr->data, bptr->length - 1); base64_string[bptr->length - 1] = '\0'; @@ -552,11 +552,11 @@ char* crypto_base64_encode(uint8* data, int length) return base64_string; } -void crypto_base64_decode(uint8* enc_data, int length, uint8** dec_data, int* res_length) +void crypto_base64_decode(BYTE* enc_data, int length, BYTE** dec_data, int* res_length) { BIO *b64, *bmem; - *dec_data = xmalloc(length); + *dec_data = malloc(length); memset(*dec_data, 0, length); b64 = BIO_new(BIO_f_base64()); diff --git a/libfreerdp/crypto/der.c b/libfreerdp/crypto/der.c index 441496d83..ef77b2a7f 100644 --- a/libfreerdp/crypto/der.c +++ b/libfreerdp/crypto/der.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * ASN.1 Basic Encoding Rules (DER) * * Copyright 2011 Samsung, Author Jiten Pathy @@ -37,19 +37,19 @@ int der_write_length(STREAM* s, int length) { if (length > 0x7F && length <= 0xFF) { - stream_write_uint8(s, 0x81); - stream_write_uint8(s, length); + stream_write_BYTE(s, 0x81); + stream_write_BYTE(s, length); return 2; } else if (length > 0xFF) { - stream_write_uint8(s, 0x82); - stream_write_uint16_be(s, length); + stream_write_BYTE(s, 0x82); + stream_write_UINT16_be(s, length); return 3; } else { - stream_write_uint8(s, length); + stream_write_BYTE(s, length); return 1; } } @@ -69,15 +69,15 @@ int der_skip_contextual_tag(int length) return _der_skip_length(length) + 1; } -int der_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc) +int der_write_contextual_tag(STREAM* s, BYTE tag, int length, BOOL pc) { - stream_write_uint8(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag)); + stream_write_BYTE(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag)); return der_write_length(s, length) + 1; } -void der_write_universal_tag(STREAM* s, uint8 tag, boolean pc) +void der_write_universal_tag(STREAM* s, BYTE tag, BOOL pc) { - stream_write_uint8(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag)); + stream_write_BYTE(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag)); } int der_skip_octet_string(int length) @@ -85,9 +85,9 @@ int der_skip_octet_string(int length) return 1 + _der_skip_length(length) + length; } -void der_write_octet_string(STREAM* s, uint8* oct_str, int length) +void der_write_octet_string(STREAM* s, BYTE* oct_str, int length) { - der_write_universal_tag(s, ER_TAG_OCTET_STRING, false); + der_write_universal_tag(s, ER_TAG_OCTET_STRING, FALSE); der_write_length(s, length); stream_write(s, oct_str, length); } @@ -99,7 +99,7 @@ int der_skip_sequence_tag(int length) int der_write_sequence_tag(STREAM* s, int length) { - stream_write_uint8(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE)); + stream_write_BYTE(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE)); return der_write_length(s, length) + 1; } diff --git a/libfreerdp/crypto/er.c b/libfreerdp/crypto/er.c index efcc6a46c..e8109bba4 100644 --- a/libfreerdp/crypto/er.c +++ b/libfreerdp/crypto/er.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * ASN.1 Encoding Rules (BER/DER common functions) * * Copyright 2011 Marc-Andre Moreau @@ -28,18 +28,18 @@ void er_read_length(STREAM* s, int* length) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte & 0x80) { byte &= ~(0x80); if (byte == 1) - stream_read_uint8(s, *length); + stream_read_BYTE(s, *length); if (byte == 2) - stream_read_uint16_be(s, *length); + stream_read_UINT16_be(s, *length); } else { @@ -53,7 +53,7 @@ void er_read_length(STREAM* s, int* length) * @param length length */ -int er_write_length(STREAM* s, int length, boolean flag) +int er_write_length(STREAM* s, int length, BOOL flag) { if (flag) return der_write_length(s, length); @@ -84,28 +84,28 @@ int er_get_content_length(int length) * @return */ -boolean er_read_universal_tag(STREAM* s, uint8 tag, boolean pc) +BOOL er_read_universal_tag(STREAM* s, BYTE tag, BOOL pc) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != (ER_CLASS_UNIV | ER_PC(pc) | (ER_TAG_MASK & tag))) - return false; + return FALSE; - return true; + return TRUE; } /** * Write er Universal tag. * @param s stream * @param tag er universally-defined tag - * @param pc primitive (false) or constructed (true) + * @param pc primitive (FALSE) or constructed (TRUE) */ -void er_write_universal_tag(STREAM* s, uint8 tag, boolean pc) +void er_write_universal_tag(STREAM* s, BYTE tag, BOOL pc) { - stream_write_uint8(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag)); + stream_write_BYTE(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag)); } /** @@ -115,35 +115,35 @@ void er_write_universal_tag(STREAM* s, uint8 tag, boolean pc) * @param length length */ -boolean er_read_application_tag(STREAM* s, uint8 tag, int* length) +BOOL er_read_application_tag(STREAM* s, BYTE tag, int* length) { - uint8 byte; + BYTE byte; if (tag > 30) { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((ER_CLASS_APPL | ER_CONSTRUCT) | ER_TAG_MASK)) - return false; + return FALSE; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != tag) - return false; + return FALSE; er_read_length(s, length); } else { - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((ER_CLASS_APPL | ER_CONSTRUCT) | (ER_TAG_MASK & tag))) - return false; + return FALSE; er_read_length(s, length); } - return true; + return TRUE; } /** @@ -153,41 +153,41 @@ boolean er_read_application_tag(STREAM* s, uint8 tag, int* length) * @param length length */ -void er_write_application_tag(STREAM* s, uint8 tag, int length, boolean flag) +void er_write_application_tag(STREAM* s, BYTE tag, int length, BOOL flag) { if (tag > 30) { - stream_write_uint8(s, (ER_CLASS_APPL | ER_CONSTRUCT) | ER_TAG_MASK); - stream_write_uint8(s, tag); + stream_write_BYTE(s, (ER_CLASS_APPL | ER_CONSTRUCT) | ER_TAG_MASK); + stream_write_BYTE(s, tag); er_write_length(s, length, flag); } else { - stream_write_uint8(s, (ER_CLASS_APPL | ER_CONSTRUCT) | (ER_TAG_MASK & tag)); + stream_write_BYTE(s, (ER_CLASS_APPL | ER_CONSTRUCT) | (ER_TAG_MASK & tag)); er_write_length(s, length, flag); } } -boolean er_read_contextual_tag(STREAM* s, uint8 tag, int* length, boolean pc) +BOOL er_read_contextual_tag(STREAM* s, BYTE tag, int* length, BOOL pc) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag))) { stream_rewind(s, 1); - return false; + return FALSE; } er_read_length(s, length); - return true; + return TRUE; } -int er_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc, boolean flag) +int er_write_contextual_tag(STREAM* s, BYTE tag, int length, BOOL pc, BOOL flag) { - stream_write_uint8(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag)); + stream_write_BYTE(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag)); return er_write_length(s, length, flag) + 1; } @@ -196,18 +196,18 @@ int er_skip_contextual_tag(int length) return _er_skip_length(length) + 1; } -boolean er_read_sequence_tag(STREAM* s, int* length) +BOOL er_read_sequence_tag(STREAM* s, int* length) { - uint8 byte; + BYTE byte; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte != ((ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_SEQUENCE_OF))) - return false; + return FALSE; er_read_length(s, length); - return true; + return TRUE; } /** @@ -216,9 +216,9 @@ boolean er_read_sequence_tag(STREAM* s, int* length) * @param length length */ -int er_write_sequence_tag(STREAM* s, int length, boolean flag) +int er_write_sequence_tag(STREAM* s, int length, BOOL flag) { - stream_write_uint8(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE)); + stream_write_BYTE(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE)); return er_write_length(s, length, flag) + 1; } @@ -232,56 +232,56 @@ int er_skip_sequence_tag(int length) return 1 + _er_skip_length(length); } -boolean er_read_enumerated(STREAM* s, uint8* enumerated, uint8 count) +BOOL er_read_enumerated(STREAM* s, BYTE* enumerated, BYTE count) { int length; - er_read_universal_tag(s, ER_TAG_ENUMERATED, false); + er_read_universal_tag(s, ER_TAG_ENUMERATED, FALSE); er_read_length(s, &length); if (length == 1) - stream_read_uint8(s, *enumerated); + stream_read_BYTE(s, *enumerated); else - return false; + return FALSE; /* check that enumerated value falls within expected range */ if (*enumerated + 1 > count) - return false; + return FALSE; - return true; + return TRUE; } -void er_write_enumerated(STREAM* s, uint8 enumerated, uint8 count, boolean flag) +void er_write_enumerated(STREAM* s, BYTE enumerated, BYTE count, BOOL flag) { - er_write_universal_tag(s, ER_TAG_ENUMERATED, false); + er_write_universal_tag(s, ER_TAG_ENUMERATED, FALSE); er_write_length(s, 1, flag); - stream_write_uint8(s, enumerated); + stream_write_BYTE(s, enumerated); } -boolean er_read_bit_string(STREAM* s, int* length, uint8* padding) +BOOL er_read_bit_string(STREAM* s, int* length, BYTE* padding) { - er_read_universal_tag(s, ER_TAG_BIT_STRING, false); + er_read_universal_tag(s, ER_TAG_BIT_STRING, FALSE); er_read_length(s, length); - stream_read_uint8(s, *padding); + stream_read_BYTE(s, *padding); - return true; + return TRUE; } -boolean er_write_bit_string_tag(STREAM* s, uint32 length, uint8 padding, boolean flag) +BOOL er_write_bit_string_tag(STREAM* s, UINT32 length, BYTE padding, BOOL flag) { - er_write_universal_tag(s, ER_TAG_BIT_STRING, false); + er_write_universal_tag(s, ER_TAG_BIT_STRING, FALSE); er_write_length(s, length, flag); - stream_write_uint8(s, padding); - return true; + stream_write_BYTE(s, padding); + return TRUE; } -boolean er_read_octet_string(STREAM* s, int* length) +BOOL er_read_octet_string(STREAM* s, int* length) { - if(!er_read_universal_tag(s, ER_TAG_OCTET_STRING, false)) - return false; + if(!er_read_universal_tag(s, ER_TAG_OCTET_STRING, FALSE)) + return FALSE; er_read_length(s, length); - return true; + return TRUE; } /** @@ -291,16 +291,16 @@ boolean er_read_octet_string(STREAM* s, int* length) * @param length string length */ -void er_write_octet_string(STREAM* s, uint8* oct_str, int length, boolean flag) +void er_write_octet_string(STREAM* s, BYTE* oct_str, int length, BOOL flag) { - er_write_universal_tag(s, ER_TAG_OCTET_STRING, false); + er_write_universal_tag(s, ER_TAG_OCTET_STRING, FALSE); er_write_length(s, length, flag); stream_write(s, oct_str, length); } -int er_write_octet_string_tag(STREAM* s, int length, boolean flag) +int er_write_octet_string_tag(STREAM* s, int length, BOOL flag) { - er_write_universal_tag(s, ER_TAG_OCTET_STRING, false); + er_write_universal_tag(s, ER_TAG_OCTET_STRING, FALSE); er_write_length(s, length, flag); return 1 + _er_skip_length(length); } @@ -316,19 +316,19 @@ int er_skip_octet_string(int length) * @param value */ -boolean er_read_boolean(STREAM* s, boolean* value) +BOOL er_read_BOOL(STREAM* s, BOOL* value) { int length; - uint8 v; + BYTE v; - if (!er_read_universal_tag(s, ER_TAG_BOOLEAN, false)) - return false; + if (!er_read_universal_tag(s, ER_TAG_BOOLEAN, FALSE)) + return FALSE; er_read_length(s, &length); if (length != 1) - return false; - stream_read_uint8(s, v); - *value = (v ? true : false); - return true; + return FALSE; + stream_read_BYTE(s, v); + *value = (v ? TRUE : FALSE); + return TRUE; } /** @@ -337,43 +337,43 @@ boolean er_read_boolean(STREAM* s, boolean* value) * @param value */ -void er_write_boolean(STREAM* s, boolean value) +void er_write_BOOL(STREAM* s, BOOL value) { - er_write_universal_tag(s, ER_TAG_BOOLEAN, false); - er_write_length(s, 1, false); - stream_write_uint8(s, (value == true) ? 0xFF : 0); + er_write_universal_tag(s, ER_TAG_BOOLEAN, FALSE); + er_write_length(s, 1, FALSE); + stream_write_BYTE(s, (value == TRUE) ? 0xFF : 0); } -boolean er_read_integer(STREAM* s, uint32* value) +BOOL er_read_integer(STREAM* s, UINT32* value) { int length; - er_read_universal_tag(s, ER_TAG_INTEGER, false); + er_read_universal_tag(s, ER_TAG_INTEGER, FALSE); er_read_length(s, &length); if (value == NULL) { stream_seek(s, length); - return true; + return TRUE; } if (length == 1) - stream_read_uint8(s, *value); + stream_read_BYTE(s, *value); else if (length == 2) - stream_read_uint16_be(s, *value); + stream_read_UINT16_be(s, *value); else if (length == 3) { - uint8 byte; - stream_read_uint8(s, byte); - stream_read_uint16_be(s, *value); + BYTE byte; + stream_read_BYTE(s, byte); + stream_read_UINT16_be(s, *value); *value += (byte << 16); } else if (length == 4) - stream_read_uint32_be(s, *value); + stream_read_UINT32_be(s, *value); else - return false; + return FALSE; - return true; + return TRUE; } /** @@ -382,33 +382,33 @@ boolean er_read_integer(STREAM* s, uint32* value) * @param value */ -int er_write_integer(STREAM* s, sint32 value) +int er_write_integer(STREAM* s, INT32 value) { - er_write_universal_tag(s, ER_TAG_INTEGER, false); + er_write_universal_tag(s, ER_TAG_INTEGER, FALSE); if (value <= 127 && value >= -128) { - er_write_length(s, 1, false); - stream_write_uint8(s, value); + er_write_length(s, 1, FALSE); + stream_write_BYTE(s, value); return 2; } else if (value <= 32767 && value >= -32768) { - er_write_length(s, 2, false); - stream_write_uint16_be(s, value); + er_write_length(s, 2, FALSE); + stream_write_UINT16_be(s, value); return 3; } else { - er_write_length(s, 4, false); - stream_write_uint32_be(s, value); + er_write_length(s, 4, FALSE); + stream_write_UINT32_be(s, value); return 5; } return 0; } -int er_skip_integer(sint32 value) +int er_skip_integer(INT32 value) { if (value <= 127 && value >= -128) { @@ -426,9 +426,9 @@ int er_skip_integer(sint32 value) return 0; } -boolean er_read_integer_length(STREAM* s, int* length) +BOOL er_read_integer_length(STREAM* s, int* length) { - er_read_universal_tag(s, ER_TAG_INTEGER, false); + er_read_universal_tag(s, ER_TAG_INTEGER, FALSE); er_read_length(s, length); - return true; + return TRUE; } diff --git a/libfreerdp/crypto/nla.c b/libfreerdp/crypto/nla.c index dc20954fa..19ee58684 100644 --- a/libfreerdp/crypto/nla.c +++ b/libfreerdp/crypto/nla.c @@ -119,7 +119,7 @@ int credssp_ntlm_client_init(rdpCredssp* credssp) { if (instance->Authenticate) { - boolean proceed = instance->Authenticate(instance, + BOOL proceed = instance->Authenticate(instance, &settings->username, &settings->password, &settings->domain); if (!proceed) return 0; @@ -183,9 +183,9 @@ int credssp_client_authenticate(rdpCredssp* credssp) SecBuffer output_buffer; SecBufferDesc input_buffer_desc; SecBufferDesc output_buffer_desc; - boolean have_context; - boolean have_input_buffer; - boolean have_pub_key_auth; + BOOL have_context; + BOOL have_input_buffer; + BOOL have_pub_key_auth; sspi_GlobalInit(); @@ -230,9 +230,9 @@ int credssp_client_authenticate(rdpCredssp* credssp) return 0; } - have_context = false; - have_input_buffer = false; - have_pub_key_auth = false; + have_context = FALSE; + have_input_buffer = FALSE; + have_pub_key_auth = FALSE; ZeroMemory(&input_buffer, sizeof(SecBuffer)); ZeroMemory(&output_buffer, sizeof(SecBuffer)); ZeroMemory(&credssp->ContextSizes, sizeof(SecPkgContext_Sizes)); @@ -247,7 +247,7 @@ int credssp_client_authenticate(rdpCredssp* credssp) fContextReq = ISC_REQ_MUTUAL_AUTH | ISC_REQ_CONFIDENTIALITY | ISC_REQ_USE_SESSION_KEY; - while (true) + while (TRUE) { output_buffer_desc.ulVersion = SECBUFFER_VERSION; output_buffer_desc.cBuffers = 1; @@ -273,7 +273,7 @@ int credssp_client_authenticate(rdpCredssp* credssp) if (credssp->table->CompleteAuthToken != NULL) credssp->table->CompleteAuthToken(&credssp->context, &output_buffer_desc); - have_pub_key_auth = true; + have_pub_key_auth = TRUE; if (credssp->table->QueryContextAttributes(&credssp->context, SECPKG_ATTR_SIZES, &credssp->ContextSizes) != SEC_E_OK) { @@ -326,8 +326,8 @@ int credssp_client_authenticate(rdpCredssp* credssp) input_buffer.pvBuffer = credssp->negoToken.pvBuffer; input_buffer.cbBuffer = credssp->negoToken.cbBuffer; - have_input_buffer = true; - have_context = true; + have_input_buffer = TRUE; + have_context = TRUE; } /* Encrypted Public Key +1 */ @@ -385,9 +385,9 @@ int credssp_server_authenticate(rdpCredssp* credssp) SecBuffer output_buffer; SecBufferDesc input_buffer_desc; SecBufferDesc output_buffer_desc; - boolean have_context; - boolean have_input_buffer; - boolean have_pub_key_auth; + BOOL have_context; + BOOL have_input_buffer; + BOOL have_pub_key_auth; sspi_GlobalInit(); @@ -446,9 +446,9 @@ int credssp_server_authenticate(rdpCredssp* credssp) return 0; } - have_context = false; - have_input_buffer = false; - have_pub_key_auth = false; + have_context = FALSE; + have_input_buffer = FALSE; + have_pub_key_auth = FALSE; ZeroMemory(&input_buffer, sizeof(SecBuffer)); ZeroMemory(&output_buffer, sizeof(SecBuffer)); ZeroMemory(&input_buffer_desc, sizeof(SecBufferDesc)); @@ -474,7 +474,7 @@ int credssp_server_authenticate(rdpCredssp* credssp) fContextReq |= ASC_REQ_EXTENDED_ERROR; - while (true) + while (TRUE) { input_buffer_desc.ulVersion = SECBUFFER_VERSION; input_buffer_desc.cBuffers = 1; @@ -533,7 +533,7 @@ int credssp_server_authenticate(rdpCredssp* credssp) if (status == SEC_E_OK) { - have_pub_key_auth = true; + have_pub_key_auth = TRUE; if (credssp->table->QueryContextAttributes(&credssp->context, SECPKG_ATTR_SIZES, &credssp->ContextSizes) != SEC_E_OK) { @@ -573,7 +573,7 @@ int credssp_server_authenticate(rdpCredssp* credssp) if (status != SEC_I_CONTINUE_NEEDED) break; - have_context = true; + have_context = TRUE; } /* Receive encrypted credentials */ @@ -812,7 +812,7 @@ void credssp_read_ts_password_creds(rdpCredssp* credssp, STREAM* s) ber_read_sequence_tag(s, &length); /* [0] domainName (OCTET STRING) */ - ber_read_contextual_tag(s, 0, &length, true); + ber_read_contextual_tag(s, 0, &length, TRUE); ber_read_octet_string_tag(s, &length); credssp->identity.DomainLength = (UINT32) length; credssp->identity.Domain = (UINT16*) malloc(length); @@ -821,7 +821,7 @@ void credssp_read_ts_password_creds(rdpCredssp* credssp, STREAM* s) credssp->identity.DomainLength /= 2; /* [1] userName (OCTET STRING) */ - ber_read_contextual_tag(s, 1, &length, true); + ber_read_contextual_tag(s, 1, &length, TRUE); ber_read_octet_string_tag(s, &length); credssp->identity.UserLength = (UINT32) length; credssp->identity.User = (UINT16*) malloc(length); @@ -830,7 +830,7 @@ void credssp_read_ts_password_creds(rdpCredssp* credssp, STREAM* s) credssp->identity.UserLength /= 2; /* [2] password (OCTET STRING) */ - ber_read_contextual_tag(s, 2, &length, true); + ber_read_contextual_tag(s, 2, &length, TRUE); ber_read_octet_string_tag(s, &length); credssp->identity.PasswordLength = (UINT32) length; credssp->identity.Password = (UINT16*) malloc(length); @@ -852,15 +852,15 @@ void credssp_write_ts_password_creds(rdpCredssp* credssp, STREAM* s) ber_write_sequence_tag(s, length); /* [0] domainName (OCTET STRING) */ - ber_write_contextual_tag(s, 0, credssp->identity.DomainLength * 2 + 2, true); + ber_write_contextual_tag(s, 0, credssp->identity.DomainLength * 2 + 2, TRUE); ber_write_octet_string(s, (BYTE*) credssp->identity.Domain, credssp->identity.DomainLength * 2); /* [1] userName (OCTET STRING) */ - ber_write_contextual_tag(s, 1, credssp->identity.UserLength * 2 + 2, true); + ber_write_contextual_tag(s, 1, credssp->identity.UserLength * 2 + 2, TRUE); ber_write_octet_string(s, (BYTE*) credssp->identity.User, credssp->identity.UserLength * 2); /* [2] password (OCTET STRING) */ - ber_write_contextual_tag(s, 2, credssp->identity.PasswordLength * 2 + 2, true); + ber_write_contextual_tag(s, 2, credssp->identity.PasswordLength * 2 + 2, TRUE); ber_write_octet_string(s, (BYTE*) credssp->identity.Password, credssp->identity.PasswordLength * 2); } @@ -897,11 +897,11 @@ void credssp_read_ts_credentials(rdpCredssp* credssp, PSecBuffer ts_credentials) ber_read_sequence_tag(s, &length); /* [0] credType (INTEGER) */ - ber_read_contextual_tag(s, 0, &length, true); + ber_read_contextual_tag(s, 0, &length, TRUE); ber_read_integer(s, NULL); /* [1] credentials (OCTET STRING) */ - ber_read_contextual_tag(s, 1, &length, true); + ber_read_contextual_tag(s, 1, &length, TRUE); ber_read_octet_string_tag(s, &ts_password_creds_length); credssp_read_ts_password_creds(credssp, s); @@ -923,12 +923,12 @@ void credssp_write_ts_credentials(rdpCredssp* credssp, STREAM* s) length -= ber_write_sequence_tag(s, length); /* [0] credType (INTEGER) */ - length -= ber_write_contextual_tag(s, 0, 3, true); + length -= ber_write_contextual_tag(s, 0, 3, TRUE); length -= ber_write_integer(s, 1); /* [1] credentials (OCTET STRING) */ length -= 1; - length -= ber_write_contextual_tag(s, 1, length, true); + length -= ber_write_contextual_tag(s, 1, length, TRUE); length -= ber_write_octet_string_tag(s, ts_password_creds_length); credssp_write_ts_password_creds(credssp, s); @@ -1097,25 +1097,25 @@ void credssp_send(rdpCredssp* credssp) der_write_sequence_tag(s, length); /* SEQUENCE */ /* [0] version */ - ber_write_contextual_tag(s, 0, 3, true); + ber_write_contextual_tag(s, 0, 3, TRUE); ber_write_integer(s, 2); /* INTEGER */ /* [1] negoTokens (NegoData) */ if (nego_tokens_length > 0) { length = der_get_content_length(nego_tokens_length); - length -= der_write_contextual_tag(s, 1, length, true); /* NegoData */ + length -= der_write_contextual_tag(s, 1, length, TRUE); /* NegoData */ length -= der_write_sequence_tag(s, length); /* SEQUENCE OF NegoDataItem */ length -= der_write_sequence_tag(s, length); /* NegoDataItem */ - length -= der_write_contextual_tag(s, 0, length, true); /* [0] negoToken */ - der_write_octet_string(s, (uint8*) credssp->negoToken.pvBuffer, length); /* OCTET STRING */ + length -= der_write_contextual_tag(s, 0, length, TRUE); /* [0] negoToken */ + der_write_octet_string(s, (BYTE*) credssp->negoToken.pvBuffer, length); /* OCTET STRING */ } /* [2] authInfo (OCTET STRING) */ if (auth_info_length > 0) { length = ber_get_content_length(auth_info_length); - length -= ber_write_contextual_tag(s, 2, length, true); + length -= ber_write_contextual_tag(s, 2, length, TRUE); ber_write_octet_string(s, credssp->authInfo.pvBuffer, credssp->authInfo.cbBuffer); } @@ -1123,7 +1123,7 @@ void credssp_send(rdpCredssp* credssp) if (pub_key_auth_length > 0) { length = ber_get_content_length(pub_key_auth_length); - length -= ber_write_contextual_tag(s, 3, length, true); + length -= ber_write_contextual_tag(s, 3, length, TRUE); ber_write_octet_string(s, credssp->pubKeyAuth.pvBuffer, length); } @@ -1164,15 +1164,15 @@ int credssp_recv(rdpCredssp* credssp) /* TSRequest */ ber_read_sequence_tag(s, &length); - ber_read_contextual_tag(s, 0, &length, true); + ber_read_contextual_tag(s, 0, &length, TRUE); ber_read_integer(s, &version); /* [1] negoTokens (NegoData) */ - if (ber_read_contextual_tag(s, 1, &length, true) != false) + if (ber_read_contextual_tag(s, 1, &length, TRUE) != FALSE) { ber_read_sequence_tag(s, &length); /* SEQUENCE OF NegoDataItem */ ber_read_sequence_tag(s, &length); /* NegoDataItem */ - ber_read_contextual_tag(s, 0, &length, true); /* [0] negoToken */ + ber_read_contextual_tag(s, 0, &length, TRUE); /* [0] negoToken */ ber_read_octet_string_tag(s, &length); /* OCTET STRING */ sspi_SecBufferAlloc(&credssp->negoToken, length); stream_read(s, credssp->negoToken.pvBuffer, length); @@ -1180,7 +1180,7 @@ int credssp_recv(rdpCredssp* credssp) } /* [2] authInfo (OCTET STRING) */ - if (ber_read_contextual_tag(s, 2, &length, true) != false) + if (ber_read_contextual_tag(s, 2, &length, TRUE) != FALSE) { ber_read_octet_string_tag(s, &length); /* OCTET STRING */ sspi_SecBufferAlloc(&credssp->authInfo, length); @@ -1189,7 +1189,7 @@ int credssp_recv(rdpCredssp* credssp) } /* [3] pubKeyAuth (OCTET STRING) */ - if (ber_read_contextual_tag(s, 3, &length, true) != false) + if (ber_read_contextual_tag(s, 3, &length, TRUE) != FALSE) { ber_read_octet_string_tag(s, &length); /* OCTET STRING */ sspi_SecBufferAlloc(&credssp->pubKeyAuth, length); diff --git a/libfreerdp/crypto/per.c b/libfreerdp/crypto/per.c index 34d723647..1665c0502 100644 --- a/libfreerdp/crypto/per.c +++ b/libfreerdp/crypto/per.c @@ -30,23 +30,23 @@ * @return */ -boolean per_read_length(STREAM* s, uint16* length) +BOOL per_read_length(STREAM* s, UINT16* length) { - uint8 byte; + BYTE byte; if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); if (byte & 0x80) { if (stream_get_left(s) < 1) - return false; + return FALSE; byte &= ~(0x80); *length = (byte << 8); - stream_read_uint8(s, byte); + stream_read_BYTE(s, byte); *length += byte; } else @@ -54,7 +54,7 @@ boolean per_read_length(STREAM* s, uint16* length) *length = byte; } - return true; + return TRUE; } /** @@ -66,9 +66,9 @@ boolean per_read_length(STREAM* s, uint16* length) void per_write_length(STREAM* s, int length) { if (length > 0x7F) - stream_write_uint16_be(s, (length | 0x8000)); + stream_write_UINT16_be(s, (length | 0x8000)); else - stream_write_uint8(s, length); + stream_write_BYTE(s, length); } /** @@ -78,13 +78,13 @@ void per_write_length(STREAM* s, int length) * @return */ -boolean per_read_choice(STREAM* s, uint8* choice) +BOOL per_read_choice(STREAM* s, BYTE* choice) { if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, *choice); - return true; + stream_read_BYTE(s, *choice); + return TRUE; } /** @@ -93,9 +93,9 @@ boolean per_read_choice(STREAM* s, uint8* choice) * @param choice index of chosen field */ -void per_write_choice(STREAM* s, uint8 choice) +void per_write_choice(STREAM* s, BYTE choice) { - stream_write_uint8(s, choice); + stream_write_BYTE(s, choice); } /** @@ -105,13 +105,13 @@ void per_write_choice(STREAM* s, uint8 choice) * @return */ -boolean per_read_selection(STREAM* s, uint8* selection) +BOOL per_read_selection(STREAM* s, BYTE* selection) { if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, *selection); - return true; + stream_read_BYTE(s, *selection); + return TRUE; } /** @@ -120,9 +120,9 @@ boolean per_read_selection(STREAM* s, uint8* selection) * @param selection bit map of selected fields */ -void per_write_selection(STREAM* s, uint8 selection) +void per_write_selection(STREAM* s, BYTE selection) { - stream_write_uint8(s, selection); + stream_write_BYTE(s, selection); } /** @@ -132,13 +132,13 @@ void per_write_selection(STREAM* s, uint8 selection) * @return */ -boolean per_read_number_of_sets(STREAM* s, uint8* number) +BOOL per_read_number_of_sets(STREAM* s, BYTE* number) { if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, *number); - return true; + stream_read_BYTE(s, *number); + return TRUE; } /** @@ -147,9 +147,9 @@ boolean per_read_number_of_sets(STREAM* s, uint8* number) * @param number number of sets */ -void per_write_number_of_sets(STREAM* s, uint8 number) +void per_write_number_of_sets(STREAM* s, BYTE number) { - stream_write_uint8(s, number); + stream_write_BYTE(s, number); } /** @@ -158,13 +158,13 @@ void per_write_number_of_sets(STREAM* s, uint8 number) * @param length */ -boolean per_read_padding(STREAM* s, int length) +BOOL per_read_padding(STREAM* s, int length) { if (stream_get_left(s) < length) - return false; + return FALSE; stream_seek(s, length); - return true; + return TRUE; } /** @@ -178,7 +178,7 @@ void per_write_padding(STREAM* s, int length) int i; for (i = 0; i < length; i++) - stream_write_uint8(s, 0); + stream_write_BYTE(s, 0); } /** @@ -188,24 +188,24 @@ void per_write_padding(STREAM* s, int length) * @return */ -boolean per_read_integer(STREAM* s, uint32* integer) +BOOL per_read_integer(STREAM* s, UINT32* integer) { - uint16 length; + UINT16 length; if (!per_read_length(s, &length)) - return false; + return FALSE; if (stream_get_left(s) < length) - return false; + return FALSE; if (length == 1) - stream_read_uint8(s, *integer); + stream_read_BYTE(s, *integer); else if (length == 2) - stream_read_uint16_be(s, *integer); + stream_read_UINT16_be(s, *integer); else - return false; + return FALSE; - return true; + return TRUE; } /** @@ -214,58 +214,58 @@ boolean per_read_integer(STREAM* s, uint32* integer) * @param integer integer */ -void per_write_integer(STREAM* s, uint32 integer) +void per_write_integer(STREAM* s, UINT32 integer) { if (integer <= 0xFF) { per_write_length(s, 1); - stream_write_uint8(s, integer); + stream_write_BYTE(s, integer); } else if (integer <= 0xFFFF) { per_write_length(s, 2); - stream_write_uint16_be(s, integer); + stream_write_UINT16_be(s, integer); } else if (integer <= 0xFFFFFFFF) { per_write_length(s, 4); - stream_write_uint32_be(s, integer); + stream_write_UINT32_be(s, integer); } } /** - * Read PER INTEGER (uint16). + * Read PER INTEGER (UINT16). * @param s stream * @param integer integer * @param min minimum value * @return */ -boolean per_read_integer16(STREAM* s, uint16* integer, uint16 min) +BOOL per_read_integer16(STREAM* s, UINT16* integer, UINT16 min) { if (stream_get_left(s) < 2) - return false; + return FALSE; - stream_read_uint16_be(s, *integer); + stream_read_UINT16_be(s, *integer); if (*integer + min > 0xFFFF) - return false; + return FALSE; *integer += min; - return true; + return TRUE; } /** - * Write PER INTEGER (uint16). + * Write PER INTEGER (UINT16). * @param s stream * @param integer integer * @param min minimum value */ -void per_write_integer16(STREAM* s, uint16 integer, uint16 min) +void per_write_integer16(STREAM* s, UINT16 integer, UINT16 min) { - stream_write_uint16_be(s, integer - min); + stream_write_UINT16_be(s, integer - min); } /** @@ -276,18 +276,18 @@ void per_write_integer16(STREAM* s, uint16 integer, uint16 min) * @return */ -boolean per_read_enumerated(STREAM* s, uint8* enumerated, uint8 count) +BOOL per_read_enumerated(STREAM* s, BYTE* enumerated, BYTE count) { if (stream_get_left(s) < 1) - return false; + return FALSE; - stream_read_uint8(s, *enumerated); + stream_read_BYTE(s, *enumerated); /* check that enumerated value falls within expected range */ if (*enumerated + 1 > count) - return false; + return FALSE; - return true; + return TRUE; } /** @@ -298,9 +298,9 @@ boolean per_read_enumerated(STREAM* s, uint8* enumerated, uint8 count) * @return */ -void per_write_enumerated(STREAM* s, uint8 enumerated, uint8 count) +void per_write_enumerated(STREAM* s, BYTE enumerated, BYTE count) { - stream_write_uint8(s, enumerated); + stream_write_BYTE(s, enumerated); } /** @@ -310,39 +310,39 @@ void per_write_enumerated(STREAM* s, uint8 enumerated, uint8 count) * @return */ -boolean per_read_object_identifier(STREAM* s, uint8 oid[6]) +BOOL per_read_object_identifier(STREAM* s, BYTE oid[6]) { - uint8 t12; - uint16 length; - uint8 a_oid[6]; + BYTE t12; + UINT16 length; + BYTE a_oid[6]; if (!per_read_length(s, &length)) - return false; + return FALSE; if (length != 5) - return false; + return FALSE; if (stream_get_left(s) < length) - return false; + return FALSE; - stream_read_uint8(s, t12); /* first two tuples */ + stream_read_BYTE(s, t12); /* first two tuples */ a_oid[0] = (t12 >> 4); a_oid[1] = (t12 & 0x0F); - stream_read_uint8(s, a_oid[2]); /* tuple 3 */ - stream_read_uint8(s, a_oid[3]); /* tuple 4 */ - stream_read_uint8(s, a_oid[4]); /* tuple 5 */ - stream_read_uint8(s, a_oid[5]); /* tuple 6 */ + stream_read_BYTE(s, a_oid[2]); /* tuple 3 */ + stream_read_BYTE(s, a_oid[3]); /* tuple 4 */ + stream_read_BYTE(s, a_oid[4]); /* tuple 5 */ + stream_read_BYTE(s, a_oid[5]); /* tuple 6 */ if ((a_oid[0] == oid[0]) && (a_oid[1] == oid[1]) && (a_oid[2] == oid[2]) && (a_oid[3] == oid[3]) && (a_oid[4] == oid[4]) && (a_oid[5] == oid[5])) { - return true; + return TRUE; } else { - return false; + return FALSE; } } @@ -352,15 +352,15 @@ boolean per_read_object_identifier(STREAM* s, uint8 oid[6]) * @param oid object identifier (oid) */ -void per_write_object_identifier(STREAM* s, uint8 oid[6]) +void per_write_object_identifier(STREAM* s, BYTE oid[6]) { - uint8 t12 = (oid[0] << 4) & (oid[1] & 0x0F); - stream_write_uint8(s, 5); /* length */ - stream_write_uint8(s, t12); /* first two tuples */ - stream_write_uint8(s, oid[2]); /* tuple 3 */ - stream_write_uint8(s, oid[3]); /* tuple 4 */ - stream_write_uint8(s, oid[4]); /* tuple 5 */ - stream_write_uint8(s, oid[5]); /* tuple 6 */ + BYTE t12 = (oid[0] << 4) & (oid[1] & 0x0F); + stream_write_BYTE(s, 5); /* length */ + stream_write_BYTE(s, t12); /* first two tuples */ + stream_write_BYTE(s, oid[2]); /* tuple 3 */ + stream_write_BYTE(s, oid[3]); /* tuple 4 */ + stream_write_BYTE(s, oid[4]); /* tuple 5 */ + stream_write_BYTE(s, oid[5]); /* tuple 6 */ } /** @@ -370,12 +370,12 @@ void per_write_object_identifier(STREAM* s, uint8 oid[6]) * @param length string length */ -void per_write_string(STREAM* s, uint8* str, int length) +void per_write_string(STREAM* s, BYTE* str, int length) { int i; for (i = 0; i < length; i++) - stream_write_uint8(s, str[i]); + stream_write_BYTE(s, str[i]); } /** @@ -387,20 +387,20 @@ void per_write_string(STREAM* s, uint8* str, int length) * @return */ -boolean per_read_octet_string(STREAM* s, uint8* oct_str, int length, int min) +BOOL per_read_octet_string(STREAM* s, BYTE* oct_str, int length, int min) { int i; - uint16 mlength; - uint8* a_oct_str; + UINT16 mlength; + BYTE* a_oct_str; if (!per_read_length(s, &mlength)) - return false; + return FALSE; if (mlength + min != length) - return false; + return FALSE; if (stream_get_left(s) < length) - return false; + return FALSE; a_oct_str = s->p; stream_seek(s, length); @@ -408,10 +408,10 @@ boolean per_read_octet_string(STREAM* s, uint8* oct_str, int length, int min) for (i = 0; i < length; i++) { if (a_oct_str[i] != oct_str[i]) - return false; + return FALSE; } - return true; + return TRUE; } /** @@ -422,7 +422,7 @@ boolean per_read_octet_string(STREAM* s, uint8* oct_str, int length, int min) * @param min minimum string length */ -void per_write_octet_string(STREAM* s, uint8* oct_str, int length, int min) +void per_write_octet_string(STREAM* s, BYTE* oct_str, int length, int min) { int i; int mlength; @@ -432,7 +432,7 @@ void per_write_octet_string(STREAM* s, uint8* oct_str, int length, int min) per_write_length(s, mlength); for (i = 0; i < length; i++) - stream_write_uint8(s, oct_str[i]); + stream_write_BYTE(s, oct_str[i]); } /** @@ -443,21 +443,21 @@ void per_write_octet_string(STREAM* s, uint8* oct_str, int length, int min) * @param min minimum string length */ -boolean per_read_numeric_string(STREAM* s, int min) +BOOL per_read_numeric_string(STREAM* s, int min) { int length; - uint16 mlength; + UINT16 mlength; if (!per_read_length(s, &mlength)) - return false; + return FALSE; length = (mlength + min + 1) / 2; if (stream_get_left(s) < length) - return false; + return FALSE; stream_seek(s, length); - return true; + return TRUE; } /** @@ -468,11 +468,11 @@ boolean per_read_numeric_string(STREAM* s, int min) * @param min minimum string length */ -void per_write_numeric_string(STREAM* s, uint8* num_str, int length, int min) +void per_write_numeric_string(STREAM* s, BYTE* num_str, int length, int min) { int i; int mlength; - uint8 num, c1, c2; + BYTE num, c1, c2; mlength = (length - min >= 0) ? length - min : min; @@ -487,6 +487,6 @@ void per_write_numeric_string(STREAM* s, uint8* num_str, int length, int min) c2 = (c2 - 0x30) % 10; num = (c1 << 4) | c2; - stream_write_uint8(s, num); /* string */ + stream_write_BYTE(s, num); /* string */ } } diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index 8c8fd6f10..acaf4243c 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -26,7 +26,7 @@ #include -static CryptoCert tls_get_certificate(rdpTls* tls, boolean peer) +static CryptoCert tls_get_certificate(rdpTls* tls, BOOL peer) { CryptoCert cert; X509* server_cert; @@ -43,7 +43,7 @@ static CryptoCert tls_get_certificate(rdpTls* tls, boolean peer) } else { - cert = xmalloc(sizeof(*cert)); + cert = malloc(sizeof(*cert)); cert->px509 = server_cert; } @@ -53,10 +53,10 @@ static CryptoCert tls_get_certificate(rdpTls* tls, boolean peer) static void tls_free_certificate(CryptoCert cert) { X509_free(cert->px509); - xfree(cert); + free(cert); } -boolean tls_connect(rdpTls* tls) +BOOL tls_connect(rdpTls* tls) { CryptoCert cert; long options = 0; @@ -67,7 +67,7 @@ boolean tls_connect(rdpTls* tls) if (tls->ctx == NULL) { printf("SSL_CTX_new failed\n"); - return false; + return FALSE; } /** @@ -106,13 +106,13 @@ boolean tls_connect(rdpTls* tls) if (tls->ssl == NULL) { printf("SSL_new failed\n"); - return false; + return FALSE; } if (SSL_set_fd(tls->ssl, tls->sockfd) < 1) { printf("SSL_set_fd failed\n"); - return false; + return FALSE; } connection_status = SSL_connect(tls->ssl); @@ -121,23 +121,23 @@ boolean tls_connect(rdpTls* tls) { if (tls_print_error("SSL_connect", tls->ssl, connection_status)) { - return false; + return FALSE; } } - cert = tls_get_certificate(tls, true); + cert = tls_get_certificate(tls, TRUE); if (cert == NULL) { printf("tls_connect: tls_get_certificate failed to return the server certificate.\n"); - return false; + return FALSE; } if (!crypto_cert_get_public_key(cert, &tls->PublicKey, &tls->PublicKeyLength)) { printf("tls_connect: crypto_cert_get_public_key failed to return the server public key.\n"); tls_free_certificate(cert); - return false; + return FALSE; } if (!tls_verify_certificate(tls, cert, tls->settings->hostname)) @@ -145,15 +145,15 @@ boolean tls_connect(rdpTls* tls) printf("tls_connect: certificate not trusted, aborting.\n"); tls_disconnect(tls); tls_free_certificate(cert); - return false; + return FALSE; } tls_free_certificate(cert); - return true; + return TRUE; } -boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_file) +BOOL tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_file) { CryptoCert cert; long options = 0; @@ -164,7 +164,7 @@ boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_fi if (tls->ctx == NULL) { printf("SSL_CTX_new failed\n"); - return false; + return FALSE; } /* @@ -209,7 +209,7 @@ boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_fi if (SSL_CTX_use_RSAPrivateKey_file(tls->ctx, privatekey_file, SSL_FILETYPE_PEM) <= 0) { printf("SSL_CTX_use_RSAPrivateKey_file failed\n"); - return false; + return FALSE; } tls->ssl = SSL_new(tls->ctx); @@ -217,36 +217,36 @@ boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_fi if (tls->ssl == NULL) { printf("SSL_new failed\n"); - return false; + return FALSE; } if (SSL_use_certificate_file(tls->ssl, cert_file, SSL_FILETYPE_PEM) <= 0) { printf("SSL_use_certificate_file failed\n"); - return false; + return FALSE; } - cert = tls_get_certificate(tls, false); + cert = tls_get_certificate(tls, FALSE); if (cert == NULL) { printf("tls_connect: tls_get_certificate failed to return the server certificate.\n"); - return false; + return FALSE; } if (!crypto_cert_get_public_key(cert, &tls->PublicKey, &tls->PublicKeyLength)) { printf("tls_connect: crypto_cert_get_public_key failed to return the server public key.\n"); tls_free_certificate(cert); - return false; + return FALSE; } - xfree(cert); + free(cert); if (SSL_set_fd(tls->ssl, tls->sockfd) < 1) { printf("SSL_set_fd failed\n"); - return false; + return FALSE; } while (1) @@ -263,7 +263,7 @@ boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_fi default: if (tls_print_error("SSL_accept", tls->ssl, connection_status)) - return false; + return FALSE; break; } @@ -276,17 +276,17 @@ boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_fi printf("TLS connection accepted\n"); - return true; + return TRUE; } -boolean tls_disconnect(rdpTls* tls) +BOOL tls_disconnect(rdpTls* tls) { if (tls->ssl) SSL_shutdown(tls->ssl); - return true; + return TRUE; } -int tls_read(rdpTls* tls, uint8* data, int length) +int tls_read(rdpTls* tls, BYTE* data, int length) { int status; @@ -311,7 +311,7 @@ int tls_read(rdpTls* tls, uint8* data, int length) return status; } -int tls_read_all(rdpTls* tls, uint8* data, int length) +int tls_read_all(rdpTls* tls, BYTE* data, int length) { int status; @@ -324,7 +324,7 @@ int tls_read_all(rdpTls* tls, uint8* data, int length) return status; } -int tls_write(rdpTls* tls, uint8* data, int length) +int tls_write(rdpTls* tls, BYTE* data, int length) { int status; @@ -350,7 +350,7 @@ int tls_write(rdpTls* tls, uint8* data, int length) } -int tls_write_all(rdpTls* tls, uint8* data, int length) +int tls_write_all(rdpTls* tls, BYTE* data, int length) { int status; int sent = 0; @@ -381,40 +381,40 @@ static void tls_errors(const char *prefix) printf("%s: %s\n", prefix, ERR_error_string(error, NULL)); } -boolean tls_print_error(char* func, SSL* connection, int value) +BOOL tls_print_error(char* func, SSL* connection, int value) { switch (SSL_get_error(connection, value)) { case SSL_ERROR_ZERO_RETURN: printf("%s: Server closed TLS connection\n", func); - return true; + return TRUE; case SSL_ERROR_WANT_READ: printf("%s: SSL_ERROR_WANT_READ\n", func); - return false; + return FALSE; case SSL_ERROR_WANT_WRITE: printf("%s: SSL_ERROR_WANT_WRITE\n", func); - return false; + return FALSE; case SSL_ERROR_SYSCALL: printf("%s: I/O error\n", func); tls_errors(func); - return true; + return TRUE; case SSL_ERROR_SSL: printf("%s: Failure in SSL library (protocol error?)\n", func); tls_errors(func); - return true; + return TRUE; default: printf("%s: Unknown error\n", func); tls_errors(func); - return true; + return TRUE; } } -boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) +BOOL tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) { int match; int index; @@ -423,14 +423,14 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) char** alt_names = NULL; int alt_names_count = 0; int* alt_names_lengths = NULL; - boolean certificate_status; - boolean hostname_match = false; - boolean verification_status = false; + BOOL certificate_status; + BOOL hostname_match = FALSE; + BOOL verification_status = FALSE; rdpCertificateData* certificate_data; /* ignore certificate verification if user explicitly required it (discouraged) */ if (tls->settings->ignore_certificate) - return true; /* success! */ + return TRUE; /* success! */ /* if user explicitly specified a certificate name, use it instead of the hostname */ if (tls->settings->certificate_name) @@ -453,7 +453,7 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) if (strlen(hostname) == common_name_length) { if (memcmp((void*) hostname, (void*) common_name, common_name_length) == 0) - hostname_match = true; + hostname_match = TRUE; } } @@ -466,7 +466,7 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) if (strlen(hostname) == alt_names_lengths[index]) { if (memcmp((void*) hostname, (void*) alt_names[index], alt_names_lengths[index]) == 0) - hostname_match = true; + hostname_match = TRUE; } } } @@ -476,11 +476,11 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) { if (common_name) { - xfree(common_name); + free(common_name); common_name = NULL; } - verification_status = true; /* success! */ + verification_status = TRUE; /* success! */ } /* if the certificate is valid but the certificate name does not match, warn user, do not accept */ @@ -495,7 +495,7 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) char* subject; char* fingerprint; freerdp* instance = (freerdp*) tls->settings->instance; - boolean accept_certificate = false; + BOOL accept_certificate = FALSE; issuer = crypto_cert_issuer(cert->px509); subject = crypto_cert_subject(cert->px509); @@ -516,13 +516,13 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) if (!accept_certificate) { /* user did not accept, abort and do not add entry in known_hosts file */ - verification_status = false; /* failure! */ + verification_status = FALSE; /* failure! */ } else { /* user accepted certificate, add entry in known_hosts file */ certificate_data_print(tls->certificate_store, certificate_data); - verification_status = true; /* success! */ + verification_status = TRUE; /* success! */ } } else if (match == -1) @@ -536,30 +536,30 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) if (!accept_certificate) { /* user did not accept, abort and do not change known_hosts file */ - verification_status = false; /* failure! */ + verification_status = FALSE; /* failure! */ } else { /* user accepted new certificate, add replace fingerprint for this host in known_hosts file */ certificate_data_replace(tls->certificate_store, certificate_data); - verification_status = true; /* success! */ + verification_status = TRUE; /* success! */ } } else if (match == 0) { - verification_status = true; /* success! */ + verification_status = TRUE; /* success! */ } - xfree(issuer); - xfree(subject); - xfree(fingerprint); + free(issuer); + free(subject); + free(fingerprint); } if (certificate_data) { - xfree(certificate_data->fingerprint); - xfree(certificate_data->hostname); - xfree(certificate_data); + free(certificate_data->fingerprint); + free(certificate_data->hostname); + free(certificate_data); } return verification_status; @@ -644,6 +644,6 @@ void tls_free(rdpTls* tls) certificate_store_free(tls->certificate_store); - xfree(tls); + free(tls); } } diff --git a/libfreerdp/gdi/16bpp.c b/libfreerdp/gdi/16bpp.c index fee35ef76..77eb60f98 100644 --- a/libfreerdp/gdi/16bpp.c +++ b/libfreerdp/gdi/16bpp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI 16bpp Internal Buffer Routines * * Copyright 2010-2011 Marc-Andre Moreau @@ -38,10 +38,10 @@ #include -uint16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color) +UINT16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color) { - uint8 r, g, b; - uint16 color16; + BYTE r, g, b; + UINT16 color16; GetBGR32(r, g, b, color); @@ -74,11 +74,11 @@ uint16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color) int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) { int x, y; - uint16 *dstp; + UINT16 *dstp; int nXDest, nYDest; int nWidth, nHeight; - uint16 color16; + UINT16 color16; gdi_RectToCRgn(rect, &nXDest, &nYDest, &nWidth, &nHeight); @@ -89,7 +89,7 @@ int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y); if (dstp != 0) { @@ -108,7 +108,7 @@ int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) static int BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -124,7 +124,7 @@ static int BitBlt_BLACKNESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -140,8 +140,8 @@ static int BitBlt_WHITENESS_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; if ((hdcDest->selectedObject != hdcSrc->selectedObject) || gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0) @@ -201,13 +201,13 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -226,11 +226,11 @@ static int BitBlt_NOTSRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int static int BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint16* dstp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -248,13 +248,13 @@ static int BitBlt_DSTINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -273,13 +273,13 @@ static int BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -298,13 +298,13 @@ static int BitBlt_NOTSRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -323,13 +323,13 @@ static int BitBlt_SRCINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -348,13 +348,13 @@ static int BitBlt_SRCAND_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -373,10 +373,10 @@ static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint16* dstp; - uint16 src16; - uint16 color16; + BYTE* srcp; + UINT16* dstp; + UINT16 src16; + UINT16 color16; HGDI_BITMAP hSrcBmp; /* D = (S & P) | (~S & D) */ @@ -394,8 +394,8 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi for (y = 0; y < nHeight; y++) { - srcp = (uint8*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (BYTE*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -415,22 +415,22 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; - uint16* patp; - uint16 color16; + UINT16* srcp; + UINT16* dstp; + UINT16* patp; + UINT16 color16; /* D = (S & D) | (~S & P) */ if (hdcDest->brush->style == GDI_BS_SOLID) { color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color); - patp = (uint16*) &color16; + patp = (UINT16*) &color16; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -447,14 +447,14 @@ static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi { for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = (*srcp & *dstp) | (~(*srcp) & *patp); srcp++; dstp++; @@ -469,20 +469,20 @@ static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; - uint16* patp; + UINT16* srcp; + UINT16* dstp; + UINT16* patp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *srcp & ~(*patp); srcp++; dstp++; @@ -496,18 +496,18 @@ static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint16* dstp; - uint16* patp; + UINT16* dstp; + UINT16* patp; for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *dstp & *patp; dstp++; @@ -521,18 +521,18 @@ static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, static int BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint16* dstp; - uint16* patp; + UINT16* dstp; + UINT16* patp; for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *dstp ^ ~(*patp); dstp++; } @@ -545,13 +545,13 @@ static int BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -571,20 +571,20 @@ static int BitBlt_DSna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; - uint16* patp; + UINT16* srcp; + UINT16* dstp; + UINT16* patp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *srcp & *patp; srcp++; dstp++; @@ -598,13 +598,13 @@ static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; + UINT16* srcp; + UINT16* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -623,9 +623,9 @@ static int BitBlt_MERGEPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint16* dstp; - uint16* patp; - uint16 color16; + UINT16* dstp; + UINT16* patp; + UINT16 color16; if (hdcDest->brush->style == GDI_BS_SOLID) { @@ -633,7 +633,7 @@ static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -649,13 +649,13 @@ static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi { for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *patp; dstp++; } @@ -669,9 +669,9 @@ static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint16* dstp; - uint16* patp; - uint16 color16; + UINT16* dstp; + UINT16* patp; + UINT16 color16; if (hdcDest->brush->style == GDI_BS_SOLID) { @@ -679,7 +679,7 @@ static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -695,13 +695,13 @@ static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n { for (y = 0; y < nHeight; y++) { - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *patp ^ *dstp; dstp++; } @@ -715,20 +715,20 @@ static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint16* srcp; - uint16* dstp; - uint16* patp; + UINT16* srcp; + UINT16* dstp; + UINT16* patp; for (y = 0; y < nHeight; y++) { - srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *dstp | (*patp | ~(*srcp)); srcp++; dstp++; @@ -883,102 +883,102 @@ int PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i return 1; } -static INLINE void SetPixel_BLACK_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_BLACK_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = 0 */ *pixel = 0; } -static INLINE void SetPixel_NOTMERGEPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_NOTMERGEPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = ~(D | P) */ *pixel = ~(*pixel | *pen); } -static INLINE void SetPixel_MASKNOTPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_MASKNOTPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = D & ~P */ *pixel &= ~(*pen); } -static INLINE void SetPixel_NOTCOPYPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_NOTCOPYPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = ~P */ *pixel = ~(*pen); } -static INLINE void SetPixel_MASKPENNOT_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_MASKPENNOT_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = P & ~D */ *pixel = *pen & ~*pixel; } -static INLINE void SetPixel_NOT_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_NOT_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = ~D */ *pixel = ~(*pixel); } -static INLINE void SetPixel_XORPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_XORPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = D ^ P */ *pixel = *pixel ^ *pen; } -static INLINE void SetPixel_NOTMASKPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_NOTMASKPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = ~(D & P) */ *pixel = ~(*pixel & *pen); } -static INLINE void SetPixel_MASKPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_MASKPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = D & P */ *pixel &= *pen; } -static INLINE void SetPixel_NOTXORPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_NOTXORPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = ~(D ^ P) */ *pixel = ~(*pixel ^ *pen); } -static INLINE void SetPixel_NOP_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_NOP_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = D */ } -static INLINE void SetPixel_MERGENOTPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_MERGENOTPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = D | ~P */ *pixel |= ~(*pen); } -static INLINE void SetPixel_COPYPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_COPYPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = P */ *pixel = *pen; } -static INLINE void SetPixel_MERGEPENNOT_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_MERGEPENNOT_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = P | ~D */ *pixel = *pen | ~(*pixel); } -static INLINE void SetPixel_MERGEPEN_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_MERGEPEN_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = P | D */ *pixel |= *pen; } -static INLINE void SetPixel_WHITE_16bpp(uint16 *pixel, uint16 *pen) +static INLINE void SetPixel_WHITE_16bpp(UINT16 *pixel, UINT16 *pen) { /* D = 1 */ *pixel = 0xFFFF; } -#define PIXEL_TYPE uint16 +#define PIXEL_TYPE UINT16 #define GDI_GET_POINTER gdi_GetPointer_16bpp #define GDI_GET_PEN_COLOR gdi_GetPenColor_16bpp diff --git a/libfreerdp/gdi/32bpp.c b/libfreerdp/gdi/32bpp.c index 570bb2e1c..c604c9ed1 100644 --- a/libfreerdp/gdi/32bpp.c +++ b/libfreerdp/gdi/32bpp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI 32bpp Internal Buffer Routines * * Copyright 2010-2011 Marc-Andre Moreau @@ -38,10 +38,10 @@ #include -uint32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color) +UINT32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color) { - uint32 color32; - uint8 a, r, g, b; + UINT32 color32; + BYTE a, r, g, b; a = 0xFF; GetBGR32(r, g, b, color); @@ -61,8 +61,8 @@ uint32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color) int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) { int x, y; - uint32 *dstp; - uint32 color32; + UINT32 *dstp; + UINT32 color32; int nXDest, nYDest; int nWidth, nHeight; @@ -75,7 +75,7 @@ int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y); if (dstp != 0) { @@ -96,7 +96,7 @@ static int BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n if (hdcDest->alpha) { int x, y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -124,7 +124,7 @@ static int BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n else { int y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -141,7 +141,7 @@ static int BitBlt_BLACKNESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_WHITENESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -157,8 +157,8 @@ static int BitBlt_WHITENESS_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; if ((hdcDest->selectedObject != hdcSrc->selectedObject) || gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0) @@ -218,13 +218,13 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -243,11 +243,11 @@ static int BitBlt_NOTSRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int static int BitBlt_DSTINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint32* dstp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -265,13 +265,13 @@ static int BitBlt_DSTINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -290,13 +290,13 @@ static int BitBlt_SRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -315,13 +315,13 @@ static int BitBlt_NOTSRCERASE_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -340,13 +340,13 @@ static int BitBlt_SRCINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -365,13 +365,13 @@ static int BitBlt_SRCAND_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -390,31 +390,31 @@ static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; - uint32* patp; - uint8* srcp8; - uint32 src32; - uint32 color32; + UINT32* srcp; + UINT32* dstp; + UINT32* patp; + BYTE* srcp8; + UINT32 src32; + UINT32 color32; HGDI_BITMAP hSrcBmp; /* D = (S & P) | (~S & D) */ color32 = gdi_get_color_32bpp(hdcDest, hdcDest->textColor); - patp = (uint32*) &color32; + patp = (UINT32*) &color32; hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject; if (hdcSrc->bytesPerPixel == 1) { /* DSPDxax, used to draw glyphs */ - srcp = (uint32*) & src32; + srcp = (UINT32*) & src32; for (y = 0; y < nHeight; y++) { - srcp8 = (uint8*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp8 = (BYTE*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -434,8 +434,8 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi { for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -455,22 +455,22 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; - uint32* patp; - uint32 color32; + UINT32* srcp; + UINT32* dstp; + UINT32* patp; + UINT32 color32; /* D = (S & D) | (~S & P) */ if (hdcDest->brush->style == GDI_BS_SOLID) { color32 = gdi_get_color_32bpp(hdcDest, hdcDest->brush->color); - patp = (uint32*) &color32; + patp = (UINT32*) &color32; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -487,14 +487,14 @@ static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi { for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = (*srcp & *dstp) | (~(*srcp) & *patp); srcp++; dstp++; @@ -509,20 +509,20 @@ static int BitBlt_PSDPxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; - uint32* patp; + UINT32* srcp; + UINT32* dstp; + UINT32* patp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *srcp & ~(*patp); srcp++; @@ -537,13 +537,13 @@ static int BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -562,18 +562,18 @@ static int BitBlt_DSna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth static int BitBlt_DPa_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint32* dstp; - uint32* patp; + UINT32* dstp; + UINT32* patp; for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *dstp & *patp; dstp++; @@ -587,18 +587,18 @@ static int BitBlt_DPa_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, static int BitBlt_PDxn_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint32* dstp; - uint32* patp; + UINT32* dstp; + UINT32* patp; for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *dstp ^ ~(*patp); dstp++; @@ -612,20 +612,20 @@ static int BitBlt_PDxn_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; - uint32* patp; + UINT32* srcp; + UINT32* dstp; + UINT32* patp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *srcp & *patp; srcp++; @@ -640,13 +640,13 @@ static int BitBlt_MERGECOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; + UINT32* srcp; + UINT32* dstp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -665,9 +665,9 @@ static int BitBlt_MERGEPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint32* dstp; - uint32* patp; - uint32 color32; + UINT32* dstp; + UINT32* patp; + UINT32 color32; if (hdcDest->brush->style == GDI_BS_SOLID) { @@ -675,7 +675,7 @@ static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -691,13 +691,13 @@ static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi { for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *patp; dstp++; } @@ -711,9 +711,9 @@ static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint32* dstp; - uint32* patp; - uint32 color32; + UINT32* dstp; + UINT32* patp; + UINT32 color32; if (hdcDest->brush->style == GDI_BS_SOLID) { @@ -721,7 +721,7 @@ static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -737,13 +737,13 @@ static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n { for (y = 0; y < nHeight; y++) { - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *patp ^ *dstp; dstp++; } @@ -757,20 +757,20 @@ static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint32* srcp; - uint32* dstp; - uint32* patp; + UINT32* srcp; + UINT32* dstp; + UINT32* patp; for (y = 0; y < nHeight; y++) { - srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = *dstp | (*patp | ~(*srcp)); srcp++; dstp++; @@ -925,102 +925,102 @@ int PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i return 1; } -static INLINE void SetPixel_BLACK_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_BLACK_32bpp(UINT32* pixel, UINT32* pen) { /* D = 0 */ *pixel = 0; } -static INLINE void SetPixel_NOTMERGEPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_NOTMERGEPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = ~(D | P) */ *pixel = ~(*pixel | *pen); } -static INLINE void SetPixel_MASKNOTPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_MASKNOTPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = D & ~P */ *pixel &= ~(*pen); } -static INLINE void SetPixel_NOTCOPYPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_NOTCOPYPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = ~P */ *pixel = ~(*pen); } -static INLINE void SetPixel_MASKPENNOT_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_MASKPENNOT_32bpp(UINT32* pixel, UINT32* pen) { /* D = P & ~D */ *pixel = *pen & ~*pixel; } -static INLINE void SetPixel_NOT_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_NOT_32bpp(UINT32* pixel, UINT32* pen) { /* D = ~D */ *pixel = ~(*pixel); } -static INLINE void SetPixel_XORPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_XORPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = D ^ P */ *pixel = *pixel ^ *pen; } -static INLINE void SetPixel_NOTMASKPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_NOTMASKPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = ~(D & P) */ *pixel = ~(*pixel & *pen); } -static INLINE void SetPixel_MASKPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_MASKPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = D & P */ *pixel &= *pen; } -static INLINE void SetPixel_NOTXORPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_NOTXORPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = ~(D ^ P) */ *pixel = ~(*pixel ^ *pen); } -static INLINE void SetPixel_NOP_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_NOP_32bpp(UINT32* pixel, UINT32* pen) { /* D = D */ } -static INLINE void SetPixel_MERGENOTPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_MERGENOTPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = D | ~P */ *pixel |= ~(*pen); } -static INLINE void SetPixel_COPYPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_COPYPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = P */ *pixel = *pen; } -static INLINE void SetPixel_MERGEPENNOT_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_MERGEPENNOT_32bpp(UINT32* pixel, UINT32* pen) { /* D = P | ~D */ *pixel = *pen | ~(*pixel); } -static INLINE void SetPixel_MERGEPEN_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_MERGEPEN_32bpp(UINT32* pixel, UINT32* pen) { /* D = P | D */ *pixel |= *pen; } -static INLINE void SetPixel_WHITE_32bpp(uint32* pixel, uint32* pen) +static INLINE void SetPixel_WHITE_32bpp(UINT32* pixel, UINT32* pen) { /* D = 1 */ *pixel = 0xFFFFFF; } -#define PIXEL_TYPE uint32 +#define PIXEL_TYPE UINT32 #define GDI_GET_POINTER gdi_GetPointer_32bpp #define GDI_GET_PEN_COLOR gdi_GetPenColor_32bpp diff --git a/libfreerdp/gdi/8bpp.c b/libfreerdp/gdi/8bpp.c index f4fce0f9f..c604a94d6 100644 --- a/libfreerdp/gdi/8bpp.c +++ b/libfreerdp/gdi/8bpp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI 8bpp Internal Buffer Routines * * Copyright 2010-2011 Marc-Andre Moreau @@ -38,7 +38,7 @@ #include -uint8 gdi_get_color_8bpp(HGDI_DC hdc, GDI_COLOR color) +BYTE gdi_get_color_8bpp(HGDI_DC hdc, GDI_COLOR color) { /* TODO: Implement 8bpp gdi_get_color_8bpp() */ return 0; @@ -53,7 +53,7 @@ int FillRect_8bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr) static int BitBlt_BLACKNESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -69,7 +69,7 @@ static int BitBlt_BLACKNESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_WHITENESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -85,8 +85,8 @@ static int BitBlt_WHITENESS_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; if ((hdcDest->selectedObject != hdcSrc->selectedObject) || gdi_CopyOverlap(nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc) == 0) @@ -146,8 +146,8 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid static int BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -171,7 +171,7 @@ static int BitBlt_NOTSRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_DSTINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint8* dstp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -193,8 +193,8 @@ static int BitBlt_DSTINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -218,8 +218,8 @@ static int BitBlt_SRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi static int BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -243,8 +243,8 @@ static int BitBlt_NOTSRCERASE_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int static int BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -268,8 +268,8 @@ static int BitBlt_SRCINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -293,8 +293,8 @@ static int BitBlt_SRCAND_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidt static int BitBlt_SRCPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -324,22 +324,22 @@ static int BitBlt_DSPDxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; - uint8* patp; - uint8 color8; + BYTE* srcp; + BYTE* dstp; + BYTE* patp; + BYTE color8; /* D = (S & D) | (~S & P) */ if (hdcDest->brush->style == GDI_BS_SOLID) { color8 = gdi_get_color_8bpp(hdcDest, hdcDest->brush->color); - patp = (uint8*) &color8; + patp = (BYTE*) &color8; for (y = 0; y < nHeight; y++) { - srcp = (uint8*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint8*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (BYTE*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (BYTE*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { @@ -356,14 +356,14 @@ static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid { for (y = 0; y < nHeight; y++) { - srcp = (uint8*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = (uint8*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + srcp = (BYTE*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (BYTE*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { - patp = (uint8*) gdi_get_brush_pointer(hdcDest, x, y); + patp = (BYTE*) gdi_get_brush_pointer(hdcDest, x, y); *dstp = (*srcp & *dstp) | (~(*srcp) & *patp); srcp++; dstp++; @@ -378,9 +378,9 @@ static int BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; - uint8* patp; + BYTE* srcp; + BYTE* dstp; + BYTE* patp; for (y = 0; y < nHeight; y++) { @@ -407,8 +407,8 @@ static int BitBlt_SPna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, static int BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint8* dstp; - uint8* patp; + BYTE* dstp; + BYTE* patp; for (y = 0; y < nHeight; y++) { @@ -432,8 +432,8 @@ static int BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, static int BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint8* dstp; - uint8* patp; + BYTE* dstp; + BYTE* patp; for (y = 0; y < nHeight; y++) { @@ -458,8 +458,8 @@ static int BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, static int BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -483,9 +483,9 @@ static int BitBlt_DSna_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; - uint8* patp; + BYTE* srcp; + BYTE* dstp; + BYTE* patp; for (y = 0; y < nHeight; y++) { @@ -512,8 +512,8 @@ static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; + BYTE* srcp; + BYTE* dstp; for (y = 0; y < nHeight; y++) { @@ -537,9 +537,9 @@ static int BitBlt_MERGEPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n static int BitBlt_PATCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint8* dstp; - uint8* patp; - uint8 palIndex; + BYTE* dstp; + BYTE* patp; + BYTE palIndex; if(hdcDest->brush->style == GDI_BS_SOLID) { @@ -583,9 +583,9 @@ static int BitBlt_PATCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid static int BitBlt_PATINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight) { int x, y; - uint8* dstp; - uint8* patp; - uint8 palIndex; + BYTE* dstp; + BYTE* patp; + BYTE palIndex; if(hdcDest->brush->style == GDI_BS_SOLID) { @@ -629,9 +629,9 @@ static int BitBlt_PATINVERT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_PATPAINT_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; - uint8* patp; + BYTE* srcp; + BYTE* dstp; + BYTE* patp; for (y = 0; y < nHeight; y++) { @@ -798,102 +798,102 @@ int PatBlt_8bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, in return 1; } -static INLINE void SetPixel_BLACK_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_BLACK_8bpp(BYTE* pixel, BYTE* pen) { /* D = 0 */ *pixel = 0; } -static INLINE void SetPixel_NOTMERGEPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_NOTMERGEPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = ~(D | P) */ *pixel = ~(*pixel | *pen); } -static INLINE void SetPixel_MASKNOTPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_MASKNOTPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = D & ~P */ *pixel &= ~(*pen); } -static INLINE void SetPixel_NOTCOPYPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_NOTCOPYPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = ~P */ *pixel = ~(*pen); } -static INLINE void SetPixel_MASKPENNOT_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_MASKPENNOT_8bpp(BYTE* pixel, BYTE* pen) { /* D = P & ~D */ *pixel = *pen & ~*pixel; } -static INLINE void SetPixel_NOT_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_NOT_8bpp(BYTE* pixel, BYTE* pen) { /* D = ~D */ *pixel = ~(*pixel); } -static INLINE void SetPixel_XORPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_XORPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = D ^ P */ *pixel = *pixel ^ *pen; } -static INLINE void SetPixel_NOTMASKPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_NOTMASKPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = ~(D & P) */ *pixel = ~(*pixel & *pen); } -static INLINE void SetPixel_MASKPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_MASKPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = D & P */ *pixel &= *pen; } -static INLINE void SetPixel_NOTXORPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_NOTXORPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = ~(D ^ P) */ *pixel = ~(*pixel ^ *pen); } -static INLINE void SetPixel_NOP_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_NOP_8bpp(BYTE* pixel, BYTE* pen) { /* D = D */ } -static INLINE void SetPixel_MERGENOTPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_MERGENOTPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = D | ~P */ *pixel |= ~(*pen); } -static INLINE void SetPixel_COPYPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_COPYPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = P */ *pixel = *pen; } -static INLINE void SetPixel_MERGEPENNOT_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_MERGEPENNOT_8bpp(BYTE* pixel, BYTE* pen) { /* D = P | ~D */ *pixel = *pen | ~(*pixel); } -static INLINE void SetPixel_MERGEPEN_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_MERGEPEN_8bpp(BYTE* pixel, BYTE* pen) { /* D = P | D */ *pixel |= *pen; } -static INLINE void SetPixel_WHITE_8bpp(uint8* pixel, uint8* pen) +static INLINE void SetPixel_WHITE_8bpp(BYTE* pixel, BYTE* pen) { /* D = 1 */ *pixel = 0xFF; } -#define PIXEL_TYPE uint8 +#define PIXEL_TYPE BYTE #define GDI_GET_POINTER gdi_GetPointer_8bpp #define GDI_GET_PEN_COLOR gdi_GetPenColor_8bpp diff --git a/libfreerdp/gdi/CMakeLists.txt b/libfreerdp/gdi/CMakeLists.txt index 106fc0f16..0cc87069b 100644 --- a/libfreerdp/gdi/CMakeLists.txt +++ b/libfreerdp/gdi/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-gdi cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -39,7 +39,7 @@ set(${MODULE_PREFIX}_SRCS gdi.c gdi.h) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -47,7 +47,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} @@ -59,4 +59,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/gdi/bitmap.c b/libfreerdp/gdi/bitmap.c index d9d326c44..2b9a916c2 100644 --- a/libfreerdp/gdi/bitmap.c +++ b/libfreerdp/gdi/bitmap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Bitmap Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -62,34 +62,34 @@ INLINE GDI_COLOR gdi_GetPixel(HGDI_DC hdc, int nXPos, int nYPos) return (GDI_COLOR) *colorp; } -INLINE uint8 gdi_GetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y) +INLINE BYTE gdi_GetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y) { - return *((uint8*)&(hBmp->data[(Y * hBmp->width) + X])); + return *((BYTE*)&(hBmp->data[(Y * hBmp->width) + X])); } -INLINE uint16 gdi_GetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y) +INLINE UINT16 gdi_GetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y) { - return *((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])); + return *((UINT16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])); } -INLINE uint32 gdi_GetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y) +INLINE UINT32 gdi_GetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y) { - return *((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])); + return *((UINT32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])); } -INLINE uint8* gdi_GetPointer_8bpp(HGDI_BITMAP hBmp, int X, int Y) +INLINE BYTE* gdi_GetPointer_8bpp(HGDI_BITMAP hBmp, int X, int Y) { - return ((uint8*)&(hBmp->data[(Y * hBmp->width) + X])); + return ((BYTE*)&(hBmp->data[(Y * hBmp->width) + X])); } -INLINE uint16* gdi_GetPointer_16bpp(HGDI_BITMAP hBmp, int X, int Y) +INLINE UINT16* gdi_GetPointer_16bpp(HGDI_BITMAP hBmp, int X, int Y) { - return ((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])); + return ((UINT16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])); } -INLINE uint32* gdi_GetPointer_32bpp(HGDI_BITMAP hBmp, int X, int Y) +INLINE UINT32* gdi_GetPointer_32bpp(HGDI_BITMAP hBmp, int X, int Y) { - return ((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])); + return ((UINT32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])); } /** @@ -109,19 +109,19 @@ INLINE GDI_COLOR gdi_SetPixel(HGDI_DC hdc, int X, int Y, GDI_COLOR crColor) return 0; } -INLINE void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, uint8 pixel) +INLINE void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, BYTE pixel) { - *((uint8*)&(hBmp->data[(Y * hBmp->width) + X])) = pixel; + *((BYTE*)&(hBmp->data[(Y * hBmp->width) + X])) = pixel; } -INLINE void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, uint16 pixel) +INLINE void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, UINT16 pixel) { - *((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])) = pixel; + *((UINT16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])) = pixel; } -INLINE void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, uint32 pixel) +INLINE void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, UINT32 pixel) { - *((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])) = pixel; + *((UINT32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])) = pixel; } /** @@ -134,9 +134,9 @@ INLINE void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, uint32 pixel) * @return new bitmap */ -HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, uint8* data) +HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, BYTE* data) { - HGDI_BITMAP hBitmap = (HGDI_BITMAP) xmalloc(sizeof(GDI_BITMAP)); + HGDI_BITMAP hBitmap = (HGDI_BITMAP) malloc(sizeof(GDI_BITMAP)); hBitmap->objectType = GDIOBJECT_BITMAP; hBitmap->bitsPerPixel = cBitsPerPixel; hBitmap->bytesPerPixel = (cBitsPerPixel + 1) / 8; @@ -158,13 +158,13 @@ HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, uint8* HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight) { - HGDI_BITMAP hBitmap = (HGDI_BITMAP) xmalloc(sizeof(GDI_BITMAP)); + HGDI_BITMAP hBitmap = (HGDI_BITMAP) malloc(sizeof(GDI_BITMAP)); hBitmap->objectType = GDIOBJECT_BITMAP; hBitmap->bytesPerPixel = hdc->bytesPerPixel; hBitmap->bitsPerPixel = hdc->bitsPerPixel; hBitmap->width = nWidth; hBitmap->height = nHeight; - hBitmap->data = xmalloc(nWidth * nHeight * hBitmap->bytesPerPixel); + hBitmap->data = malloc(nWidth * nHeight * hBitmap->bytesPerPixel); hBitmap->scanline = nWidth * hBitmap->bytesPerPixel; return hBitmap; } diff --git a/libfreerdp/gdi/brush.c b/libfreerdp/gdi/brush.c index 74f991e2f..c92099306 100644 --- a/libfreerdp/gdi/brush.c +++ b/libfreerdp/gdi/brush.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Brush Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -55,7 +55,7 @@ p_PatBlt PatBlt_[5] = HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor) { - HGDI_BRUSH hBrush = (HGDI_BRUSH) xmalloc(sizeof(GDI_BRUSH)); + HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH)); hBrush->objectType = GDIOBJECT_BRUSH; hBrush->style = GDI_BS_SOLID; hBrush->color = crColor; @@ -71,7 +71,7 @@ HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor) HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp) { - HGDI_BRUSH hBrush = (HGDI_BRUSH) xmalloc(sizeof(GDI_BRUSH)); + HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH)); hBrush->objectType = GDIOBJECT_BRUSH; hBrush->style = GDI_BS_PATTERN; hBrush->pattern = hbmp; diff --git a/libfreerdp/gdi/clipping.c b/libfreerdp/gdi/clipping.c index 7c3b71672..e6186a14f 100644 --- a/libfreerdp/gdi/clipping.c +++ b/libfreerdp/gdi/clipping.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Clipping Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/libfreerdp/gdi/dc.c b/libfreerdp/gdi/dc.c index 24efc4dc9..4c814ebfc 100644 --- a/libfreerdp/gdi/dc.c +++ b/libfreerdp/gdi/dc.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Device Context Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -44,7 +44,7 @@ HGDI_DC gdi_GetDC() { - HGDI_DC hDC = (HGDI_DC) xmalloc(sizeof(GDI_DC)); + HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC)); hDC->bytesPerPixel = 4; hDC->bitsPerPixel = 32; hDC->drawMode = GDI_R2_BLACK; @@ -62,7 +62,7 @@ HGDI_DC gdi_GetDC() HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp) { - HGDI_DC hDC = (HGDI_DC) xmalloc(sizeof(GDI_DC)); + HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC)); hDC->drawMode = GDI_R2_BLACK; hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0); @@ -76,12 +76,12 @@ HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp) hDC->invert = clrconv->invert; hDC->rgb555 = clrconv->rgb555; - hDC->hwnd = (HGDI_WND) xmalloc(sizeof(GDI_WND)); + hDC->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND)); hDC->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0); hDC->hwnd->invalid->null = 1; hDC->hwnd->count = 32; - hDC->hwnd->cinvalid = (HGDI_RGN) xmalloc(sizeof(GDI_RGN) * hDC->hwnd->count); + hDC->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * hDC->hwnd->count); hDC->hwnd->ninvalid = 0; return hDC; @@ -96,7 +96,7 @@ HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp) HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc) { - HGDI_DC hDC = (HGDI_DC) xmalloc(sizeof(GDI_DC)); + HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC)); hDC->bytesPerPixel = hdc->bytesPerPixel; hDC->bitsPerPixel = hdc->bitsPerPixel; hDC->drawMode = hdc->drawMode; diff --git a/libfreerdp/gdi/drawing.c b/libfreerdp/gdi/drawing.c index 2a62055f9..1ecd2c3e5 100644 --- a/libfreerdp/gdi/drawing.c +++ b/libfreerdp/gdi/drawing.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Drawing Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/libfreerdp/gdi/gdi.c b/libfreerdp/gdi/gdi.c index c97a2005c..53a840a20 100644 --- a/libfreerdp/gdi/gdi.c +++ b/libfreerdp/gdi/gdi.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Library * * Copyright 2010-2011 Marc-Andre Moreau @@ -51,7 +51,7 @@ #include "gdi.h" /* Ternary Raster Operation Table */ -static const uint32 rop3_code_table[] = +static const UINT32 rop3_code_table[] = { 0x00000042, /* 0 */ 0x00010289, /* DPSoon */ @@ -313,14 +313,14 @@ static const uint32 rop3_code_table[] = /* GDI Helper Functions */ -INLINE uint32 gdi_rop3_code(uint8 code) +INLINE UINT32 gdi_rop3_code(BYTE code) { return rop3_code_table[code]; } -INLINE uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y) +INLINE BYTE* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y) { - uint8* p; + BYTE* p; HGDI_BITMAP hBmp = (HGDI_BITMAP) hdcBmp->selectedObject; if (x >= 0 && x < hBmp->width && y >= 0 && y < hBmp->height) @@ -335,9 +335,9 @@ INLINE uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y) } } -INLINE uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y) +INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y) { - uint8 * p; + BYTE * p; if (hdcBrush->brush != NULL) { @@ -355,11 +355,11 @@ INLINE uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y) } } - p = (uint8*) &(hdcBrush->textColor); + p = (BYTE*) &(hdcBrush->textColor); return p; } -INLINE int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width) +INLINE int gdi_is_mono_pixel_set(BYTE* data, int x, int y, int width) { int byte; int shift; @@ -373,10 +373,10 @@ INLINE int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width) gdiBitmap* gdi_glyph_new(rdpGdi* gdi, GLYPH_DATA* glyph) { - uint8* extra; + BYTE* extra; gdiBitmap* gdi_bmp; - gdi_bmp = (gdiBitmap*) xmalloc(sizeof(gdiBitmap)); + gdi_bmp = (gdiBitmap*) malloc(sizeof(gdiBitmap)); gdi_bmp->hdc = gdi_GetDC(); gdi_bmp->hdc->bytesPerPixel = 1; @@ -404,11 +404,11 @@ void gdi_glyph_free(gdiBitmap *gdi_bmp) } } -gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, int width, int height, int bpp, uint8* data) +gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, int width, int height, int bpp, BYTE* data) { gdiBitmap* bitmap; - bitmap = (gdiBitmap*) xmalloc(sizeof(gdiBitmap)); + bitmap = (gdiBitmap*) malloc(sizeof(gdiBitmap)); bitmap->hdc = gdi_CreateCompatibleDC(gdi->hdc); DEBUG_GDI("gdi_bitmap_new: width:%d height:%d bpp:%d", width, height, bpp); @@ -467,7 +467,7 @@ void gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt) void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) { - uint8* data; + BYTE* data; rdpBrush* brush; HGDI_BRUSH originalBrush; rdpGdi* gdi = context->gdi; @@ -476,7 +476,7 @@ void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) if (brush->style == GDI_BS_SOLID) { - uint32 color; + UINT32 color; originalBrush = gdi->drawing->hdc->brush; color = freerdp_color_convert_rgb(patblt->foreColor, gdi->srcBpp, 32, gdi->clrconv); @@ -532,7 +532,7 @@ void gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { GDI_RECT rect; HGDI_BRUSH hBrush; - uint32 brush_color; + UINT32 brush_color; rdpGdi *gdi = context->gdi; gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect, @@ -551,7 +551,7 @@ void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_o int i; GDI_RECT rect; HGDI_BRUSH hBrush; - uint32 brush_color; + UINT32 brush_color; DELTA_RECT* rectangle; rdpGdi *gdi = context->gdi; @@ -573,7 +573,7 @@ void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_o void gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) { - uint32 color; + UINT32 color; HGDI_PEN hPen; rdpGdi *gdi = context->gdi; @@ -591,12 +591,12 @@ void gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) { int i; - uint32 color; + UINT32 color; HGDI_PEN hPen; DELTA_POINT* points; rdpGdi* gdi = context->gdi; - sint32 x; - sint32 y; + INT32 x; + INT32 y; color = freerdp_color_convert_rgb(polyline->penColor, gdi->srcBpp, 32, gdi->clrconv); hPen = gdi_CreatePen(GDI_PS_SOLID, 1, (GDI_COLOR) color); @@ -634,8 +634,8 @@ void gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) { rdpBrush* brush; - uint32 foreColor; - uint32 backColor; + UINT32 foreColor; + UINT32 backColor; gdiBitmap* bitmap; HGDI_BRUSH originalBrush; rdpGdi* gdi = context->gdi; @@ -748,7 +748,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co gdi->image->bitmap->height = surface_bits_command->height; gdi->image->bitmap->bitsPerPixel = surface_bits_command->bpp; gdi->image->bitmap->bytesPerPixel = gdi->image->bitmap->bitsPerPixel / 8; - gdi->image->bitmap->data = (uint8*) xrealloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4); + gdi->image->bitmap->data = (BYTE*) realloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4); freerdp_image_flip(nsc_context->bmpdata, gdi->image->bitmap->data, gdi->image->bitmap->width, gdi->image->bitmap->height, 32); gdi_BitBlt(gdi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY); } @@ -759,12 +759,12 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co gdi->image->bitmap->bitsPerPixel = surface_bits_command->bpp; gdi->image->bitmap->bytesPerPixel = gdi->image->bitmap->bitsPerPixel / 8; - gdi->image->bitmap->data = (uint8*) xrealloc(gdi->image->bitmap->data, + gdi->image->bitmap->data = (BYTE*) realloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4); - if ((surface_bits_command->bpp != 32) || (gdi->clrconv->alpha == true)) + if ((surface_bits_command->bpp != 32) || (gdi->clrconv->alpha == TRUE)) { - uint8* temp_image; + BYTE* temp_image; freerdp_image_convert(surface_bits_command->bitmapData, gdi->image->bitmap->data, gdi->image->bitmap->width, gdi->image->bitmap->height, @@ -773,9 +773,9 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co surface_bits_command->bpp = 32; surface_bits_command->bitmapData = gdi->image->bitmap->data; - temp_image = (uint8*) xmalloc(gdi->image->bitmap->width * gdi->image->bitmap->height * 4); + temp_image = (BYTE*) malloc(gdi->image->bitmap->width * gdi->image->bitmap->height * 4); freerdp_image_flip(gdi->image->bitmap->data, temp_image, gdi->image->bitmap->width, gdi->image->bitmap->height, 32); - xfree(gdi->image->bitmap->data); + free(gdi->image->bitmap->data); gdi->image->bitmap->data = temp_image; } else @@ -793,7 +793,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co } if (tile_bitmap != NULL) - xfree(tile_bitmap); + free(tile_bitmap); } /** @@ -843,12 +843,12 @@ void gdi_init_primary(rdpGdi* gdi) if (gdi->drawing == NULL) gdi->drawing = gdi->primary; - gdi->primary->hdc->hwnd = (HGDI_WND) xmalloc(sizeof(GDI_WND)); + gdi->primary->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND)); gdi->primary->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0); gdi->primary->hdc->hwnd->invalid->null = 1; gdi->primary->hdc->hwnd->count = 32; - gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) xmalloc(sizeof(GDI_RGN) * gdi->primary->hdc->hwnd->count); + gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * gdi->primary->hdc->hwnd->count); gdi->primary->hdc->hwnd->ninvalid = 0; } @@ -875,7 +875,7 @@ void gdi_resize(rdpGdi* gdi, int width, int height) * @return */ -int gdi_init(freerdp* instance, uint32 flags, uint8* buffer) +int gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer) { rdpGdi* gdi; rdpCache* cache; @@ -930,11 +930,11 @@ int gdi_init(freerdp* instance, uint32 flags, uint8* buffer) gdi->hdc->bitsPerPixel = gdi->dstBpp; gdi->hdc->bytesPerPixel = gdi->bytesPerPixel; - gdi->clrconv = (HCLRCONV) xmalloc(sizeof(CLRCONV)); + gdi->clrconv = (HCLRCONV) malloc(sizeof(CLRCONV)); gdi->clrconv->alpha = (flags & CLRCONV_ALPHA) ? 1 : 0; gdi->clrconv->invert = (flags & CLRCONV_INVERT) ? 1 : 0; gdi->clrconv->rgb555 = (flags & CLRCONV_RGB555) ? 1 : 0; - gdi->clrconv->palette = (rdpPalette*) xmalloc(sizeof(rdpPalette)); + gdi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette)); gdi->hdc->alpha = gdi->clrconv->alpha; gdi->hdc->invert = gdi->clrconv->invert; diff --git a/libfreerdp/gdi/gdi.h b/libfreerdp/gdi/gdi.h index 99fa73683..6176c8b15 100644 --- a/libfreerdp/gdi/gdi.h +++ b/libfreerdp/gdi/gdi.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Library * * Copyright 2010-2011 Marc-Andre Moreau @@ -22,7 +22,7 @@ #include "graphics.h" -gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, int width, int height, int bpp, uint8* data); +gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, int width, int height, int bpp, BYTE* data); void gdi_bitmap_free_ex(gdiBitmap* gdi_bmp); #endif /* __GDI_CORE_H */ diff --git a/libfreerdp/gdi/graphics.c b/libfreerdp/gdi/graphics.c index bef0c6e61..f49b4e70b 100644 --- a/libfreerdp/gdi/graphics.c +++ b/libfreerdp/gdi/graphics.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Graphical Objects * * Copyright 2011 Marc-Andre Moreau @@ -40,9 +40,9 @@ /* Bitmap Class */ -HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int width, int height, int bpp, uint8* data) +HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int width, int height, int bpp, BYTE* data) { - uint8* bmpData; + BYTE* bmpData; HGDI_BITMAP bitmap; bmpData = freerdp_image_convert(data, NULL, width, height, gdi->srcBpp, bpp, gdi->clrconv); @@ -93,24 +93,24 @@ void gdi_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) } void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, - uint8* data, int width, int height, int bpp, int length, - boolean compressed, int codec_id) + BYTE* data, int width, int height, int bpp, int length, + BOOL compressed, int codec_id) { - uint16 size; + UINT16 size; RFX_MESSAGE* msg; - uint8* src; - uint8* dst; + BYTE* src; + BYTE* dst; int yindex; int xindex; rdpGdi* gdi; - boolean status; + BOOL status; size = width * height * (bpp + 7) / 8; if (bitmap->data == NULL) - bitmap->data = (uint8*) xmalloc(size); + bitmap->data = (BYTE*) malloc(size); else - bitmap->data = (uint8*) xrealloc(bitmap->data, size); + bitmap->data = (BYTE*) realloc(bitmap->data, size); switch (codec_id) { @@ -155,7 +155,7 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, { status = bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); - if (status == false) + if (status == FALSE) { printf("gdi_Bitmap_Decompress: Bitmap Decompression Failed\n"); } @@ -169,12 +169,12 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, bitmap->width = width; bitmap->height = height; - bitmap->compressed = false; + bitmap->compressed = FALSE; bitmap->length = size; bitmap->bpp = bpp; } -void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean primary) +void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { rdpGdi* gdi = context->gdi; @@ -188,7 +188,7 @@ void gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean prima void gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph) { - uint8* data; + BYTE* data; gdiGlyph* gdi_glyph; gdi_glyph = (gdiGlyph*) glyph; @@ -231,7 +231,7 @@ void gdi_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y) gdi_glyph->bitmap->height, gdi_glyph->hdc, 0, 0, GDI_DSPDxax); } -void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor) +void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) { GDI_RECT rect; HGDI_BRUSH brush; @@ -249,7 +249,7 @@ void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int heigh gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor); } -void gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, uint32 bgcolor, uint32 fgcolor) +void gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor) { rdpGdi* gdi = context->gdi; @@ -274,7 +274,7 @@ void gdi_register_graphics(rdpGraphics* graphics) bitmap->SetSurface = gdi_Bitmap_SetSurface; graphics_register_bitmap(graphics, bitmap); - xfree(bitmap); + free(bitmap); glyph = xnew(rdpGlyph); glyph->size = sizeof(gdiGlyph); @@ -286,5 +286,5 @@ void gdi_register_graphics(rdpGraphics* graphics) glyph->EndDraw = gdi_Glyph_EndDraw; graphics_register_glyph(graphics, glyph); - xfree(glyph); + free(glyph); } diff --git a/libfreerdp/gdi/graphics.h b/libfreerdp/gdi/graphics.h index 930c5e860..eaa79aca9 100644 --- a/libfreerdp/gdi/graphics.h +++ b/libfreerdp/gdi/graphics.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Graphical Objects * * Copyright 2011 Marc-Andre Moreau @@ -23,13 +23,13 @@ #include #include -HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int width, int height, int bpp, uint8* data); +HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int width, int height, int bpp, BYTE* data); void gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap); void gdi_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap); void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, - uint8* data, int width, int height, int bpp, int length, - boolean compressed, int codec_id); + BYTE* data, int width, int height, int bpp, int length, + BOOL compressed, int codec_id); void gdi_register_graphics(rdpGraphics* graphics); #endif /* __GDI_GRAPHICS_H */ diff --git a/libfreerdp/gdi/include/line.c b/libfreerdp/gdi/include/line.c index 389304046..d8a56b7ea 100644 --- a/libfreerdp/gdi/include/line.c +++ b/libfreerdp/gdi/include/line.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI LineTo * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/libfreerdp/gdi/line.c b/libfreerdp/gdi/line.c index fafc73d69..aef8b9e9b 100644 --- a/libfreerdp/gdi/line.c +++ b/libfreerdp/gdi/line.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Line Functions * * Copyright 2010-2011 Marc-Andre Moreau diff --git a/libfreerdp/gdi/palette.c b/libfreerdp/gdi/palette.c index 2db3f722f..d069bf2ed 100644 --- a/libfreerdp/gdi/palette.c +++ b/libfreerdp/gdi/palette.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Palette Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -71,9 +71,9 @@ static const GDI_PALETTEENTRY default_system_palette[20] = HGDI_PALETTE gdi_CreatePalette(HGDI_PALETTE palette) { - HGDI_PALETTE hPalette = (HGDI_PALETTE) xmalloc(sizeof(GDI_PALETTE)); + HGDI_PALETTE hPalette = (HGDI_PALETTE) malloc(sizeof(GDI_PALETTE)); hPalette->count = palette->count; - hPalette->entries = (GDI_PALETTEENTRY*) xmalloc(sizeof(GDI_PALETTEENTRY) * hPalette->count); + hPalette->entries = (GDI_PALETTEENTRY*) malloc(sizeof(GDI_PALETTEENTRY) * hPalette->count); memcpy(hPalette->entries, palette->entries, sizeof(GDI_PALETTEENTRY) * hPalette->count); return hPalette; } @@ -85,10 +85,10 @@ HGDI_PALETTE gdi_CreatePalette(HGDI_PALETTE palette) HGDI_PALETTE CreateSystemPalette() { - HGDI_PALETTE palette = (HGDI_PALETTE) xmalloc(sizeof(GDI_PALETTE)); + HGDI_PALETTE palette = (HGDI_PALETTE) malloc(sizeof(GDI_PALETTE)); palette->count = 256; - palette->entries = (GDI_PALETTEENTRY*) xmalloc(sizeof(GDI_PALETTEENTRY) * 256); + palette->entries = (GDI_PALETTEENTRY*) malloc(sizeof(GDI_PALETTEENTRY) * 256); memset(palette->entries, 0, sizeof(GDI_PALETTEENTRY) * 256); memcpy(&palette->entries[0], &default_system_palette[0], 10 * sizeof(GDI_PALETTEENTRY)); diff --git a/libfreerdp/gdi/pen.c b/libfreerdp/gdi/pen.c index beee3ef72..db98ceac6 100644 --- a/libfreerdp/gdi/pen.c +++ b/libfreerdp/gdi/pen.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Pen Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -45,7 +45,7 @@ HGDI_PEN gdi_CreatePen(int fnPenStyle, int nWidth, int crColor) { - HGDI_PEN hPen = (HGDI_PEN) xmalloc(sizeof(GDI_PEN)); + HGDI_PEN hPen = (HGDI_PEN) malloc(sizeof(GDI_PEN)); hPen->objectType = GDIOBJECT_PEN; hPen->style = fnPenStyle; hPen->color = crColor; @@ -53,15 +53,15 @@ HGDI_PEN gdi_CreatePen(int fnPenStyle, int nWidth, int crColor) return hPen; } -INLINE uint8 gdi_GetPenColor_8bpp(HGDI_PEN pen) +INLINE BYTE gdi_GetPenColor_8bpp(HGDI_PEN pen) { /* TODO: implement conversion using palette */ return 0xFF; } -INLINE uint16 gdi_GetPenColor_16bpp(HGDI_PEN pen) +INLINE UINT16 gdi_GetPenColor_16bpp(HGDI_PEN pen) { - uint16 p; + UINT16 p; int r, g, b; GetRGB32(r, g, b, pen->color); RGB_888_565(r, g, b); @@ -69,7 +69,7 @@ INLINE uint16 gdi_GetPenColor_16bpp(HGDI_PEN pen) return p; } -INLINE uint32 gdi_GetPenColor_32bpp(HGDI_PEN pen) +INLINE UINT32 gdi_GetPenColor_32bpp(HGDI_PEN pen) { return pen->color; } diff --git a/libfreerdp/gdi/region.c b/libfreerdp/gdi/region.c index c6d59de61..d3147188f 100644 --- a/libfreerdp/gdi/region.c +++ b/libfreerdp/gdi/region.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Region Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -44,7 +44,7 @@ HGDI_RGN gdi_CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { - HGDI_RGN hRgn = (HGDI_RGN) xmalloc(sizeof(GDI_RGN)); + HGDI_RGN hRgn = (HGDI_RGN) malloc(sizeof(GDI_RGN)); hRgn->objectType = GDIOBJECT_REGION; hRgn->x = nLeftRect; hRgn->y = nTopRect; @@ -65,7 +65,7 @@ HGDI_RGN gdi_CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBot HGDI_RECT gdi_CreateRect(int xLeft, int yTop, int xRight, int yBottom) { - HGDI_RECT hRect = (HGDI_RECT) xmalloc(sizeof(GDI_RECT)); + HGDI_RECT hRect = (HGDI_RECT) malloc(sizeof(GDI_RECT)); hRect->objectType = GDIOBJECT_RECT; hRect->left = xLeft; hRect->top = yTop; diff --git a/libfreerdp/gdi/shape.c b/libfreerdp/gdi/shape.c index 894b04530..840c68771 100644 --- a/libfreerdp/gdi/shape.c +++ b/libfreerdp/gdi/shape.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * GDI Shape Functions * * Copyright 2010-2011 Marc-Andre Moreau @@ -52,9 +52,9 @@ static void Ellipse_Bresenham(HGDI_DC hdc, int x1, int y1, int x2, int y2) int a, b, c; HGDI_BITMAP bmp; - uint8 pixel8; - uint16 pixel16; - uint32 pixel32; + BYTE pixel8; + UINT16 pixel16; + UINT32 pixel32; int bpp = hdc->bitsPerPixel; a = (x1 < x2) ? x2 - x1 : x1 - x2; diff --git a/libfreerdp/locale/CMakeLists.txt b/libfreerdp/locale/CMakeLists.txt index 52e03500e..a96812706 100644 --- a/libfreerdp/locale/CMakeLists.txt +++ b/libfreerdp/locale/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-locale cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -72,7 +72,7 @@ if(NOT WIN32) endif() endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -80,13 +80,15 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-crt) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-utils) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/locale/keyboard.c b/libfreerdp/locale/keyboard.c index a967ef2df..0a5764476 100644 --- a/libfreerdp/locale/keyboard.c +++ b/libfreerdp/locale/keyboard.c @@ -41,12 +41,12 @@ #endif -uint32 RDP_SCANCODE_TO_X11_KEYCODE[256][2]; +UINT32 RDP_SCANCODE_TO_X11_KEYCODE[256][2]; RDP_SCANCODE X11_KEYCODE_TO_RDP_SCANCODE[256]; extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256]; -uint32 freerdp_detect_keyboard(uint32 keyboardLayoutID) +UINT32 freerdp_detect_keyboard(UINT32 keyboardLayoutID) { if (keyboardLayoutID != 0) DEBUG_KBD("keyboard layout configuration: %X", keyboardLayoutID); @@ -66,9 +66,9 @@ uint32 freerdp_detect_keyboard(uint32 keyboardLayoutID) return keyboardLayoutID; } -uint32 freerdp_keyboard_init(uint32 keyboardLayoutId) +UINT32 freerdp_keyboard_init(UINT32 keyboardLayoutId) { - uint32 keycode; + UINT32 keycode; #ifdef WITH_X11 @@ -90,7 +90,7 @@ uint32 freerdp_keyboard_init(uint32 keyboardLayoutId) return keyboardLayoutId; } -RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode) +RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(UINT32 keycode) { DEBUG_KBD("x11 keycode: %02X -> rdp code: %02X%s", keycode, RDP_SCANCODE_CODE(X11_KEYCODE_TO_RDP_SCANCODE[keycode]), @@ -99,7 +99,7 @@ RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode) return X11_KEYCODE_TO_RDP_SCANCODE[keycode]; } -uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boolean extended) +UINT32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(UINT32 scancode, BOOL extended) { if (extended) return RDP_SCANCODE_TO_X11_KEYCODE[scancode][1]; @@ -107,7 +107,7 @@ uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boole return RDP_SCANCODE_TO_X11_KEYCODE[scancode][0]; } -RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode) +RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(UINT32 vkcode) { return VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode]; } diff --git a/libfreerdp/locale/keyboard_keymap.c b/libfreerdp/locale/keyboard_keymap.c index f6f487fa8..920e6b59f 100644 --- a/libfreerdp/locale/keyboard_keymap.c +++ b/libfreerdp/locale/keyboard_keymap.c @@ -23,6 +23,10 @@ #include "keyboard_keymap.h" +#include +#include +#include + #include #include #include @@ -35,16 +39,16 @@ extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256]; -int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name) +int freerdp_keyboard_load_map(UINT32 keycode_to_vkcode[256], char* name) { FILE* fp; char* pch; char* beg; char* end; - uint32 vkcode; + UINT32 vkcode; int kbd_found = 0; char* keymap_path; - uint32 keycode = 0; + UINT32 keycode = 0; char buffer[1024] = ""; char keymap_name[256] = ""; char keymap_include[256] = ""; @@ -80,10 +84,10 @@ int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name) if ((fp = fopen(keymap_path, "r")) == NULL) { DEBUG_KBD("%s not found", keymap_path); - xfree(keymap_path); + free(keymap_path); return 0; } - xfree(keymap_path); + free(keymap_path); while (fgets(buffer, sizeof(buffer), fp) != NULL) { @@ -177,7 +181,7 @@ int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name) return 1; } -void freerdp_keyboard_load_maps(uint32 keycode_to_vkcode[256], char* names) +void freerdp_keyboard_load_maps(UINT32 keycode_to_vkcode[256], char* names) { char* kbd; char* names_end; diff --git a/libfreerdp/locale/keyboard_keymap.h b/libfreerdp/locale/keyboard_keymap.h index 3ae3b76ec..d64aae207 100644 --- a/libfreerdp/locale/keyboard_keymap.h +++ b/libfreerdp/locale/keyboard_keymap.h @@ -22,7 +22,7 @@ #include -int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name); -void freerdp_keyboard_load_maps(uint32 keycode_to_vkcode[256], char* names); +int freerdp_keyboard_load_map(UINT32 keycode_to_vkcode[256], char* name); +void freerdp_keyboard_load_maps(UINT32 keycode_to_vkcode[256], char* names); #endif /* __KEYBOARD_KEYMAP_H */ diff --git a/libfreerdp/locale/keyboard_layout.c b/libfreerdp/locale/keyboard_layout.c index 04d012e31..cca91c7b9 100644 --- a/libfreerdp/locale/keyboard_layout.c +++ b/libfreerdp/locale/keyboard_layout.c @@ -25,6 +25,8 @@ #include #include +#include + #include "liblocale.h" #include @@ -127,8 +129,8 @@ static const RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT_TABLE[] = struct _RDP_KEYBOARD_LAYOUT_VARIANT { - uint32 code; /* Keyboard layout code */ - uint32 id; /* Keyboard variant ID */ + UINT32 code; /* Keyboard layout code */ + UINT32 id; /* Keyboard variant ID */ const char* name; /* Keyboard layout variant name */ }; typedef struct _RDP_KEYBOARD_LAYOUT_VARIANT RDP_KEYBOARD_LAYOUT_VARIANT; @@ -184,7 +186,7 @@ static const RDP_KEYBOARD_LAYOUT_VARIANT RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[] = struct _RDP_KEYBOARD_IME { - uint32 code; /* Keyboard layout code */ + UINT32 code; /* Keyboard layout code */ const char* file; /* IME file */ const char* name; /* Keyboard layout name */ }; @@ -476,34 +478,34 @@ const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256] = RDP_SCANCODE_UNKNOWN }; -RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(uint32 types) +RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(UINT32 types) { int num, length, i; RDP_KEYBOARD_LAYOUT* layouts; num = 0; - layouts = (RDP_KEYBOARD_LAYOUT*) xmalloc((num + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); + layouts = (RDP_KEYBOARD_LAYOUT*) malloc((num + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); if ((types & RDP_KEYBOARD_LAYOUT_TYPE_STANDARD) != 0) { length = ARRAY_SIZE(RDP_KEYBOARD_LAYOUT_TABLE); - layouts = (RDP_KEYBOARD_LAYOUT*) xrealloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); + layouts = (RDP_KEYBOARD_LAYOUT*) realloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); for (i = 0; i < length; i++, num++) { layouts[num].code = RDP_KEYBOARD_LAYOUT_TABLE[i].code; - layouts[num].name = xstrdup(RDP_KEYBOARD_LAYOUT_TABLE[i].name); + layouts[num].name = _strdup(RDP_KEYBOARD_LAYOUT_TABLE[i].name); } } if ((types & RDP_KEYBOARD_LAYOUT_TYPE_VARIANT) != 0) { length = ARRAY_SIZE(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE); - layouts = (RDP_KEYBOARD_LAYOUT*) xrealloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); + layouts = (RDP_KEYBOARD_LAYOUT*) realloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); for (i = 0; i < length; i++, num++) { layouts[num].code = RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].code; - layouts[num].name = xstrdup(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].name); + layouts[num].name = _strdup(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].name); } } if ((types & RDP_KEYBOARD_LAYOUT_TYPE_IME) != 0) @@ -514,7 +516,7 @@ RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(uint32 types) for (i = 0; i < length; i++, num++) { layouts[num].code = RDP_KEYBOARD_IME_TABLE[i].code; - layouts[num].name = xstrdup(RDP_KEYBOARD_IME_TABLE[i].name); + layouts[num].name = _strdup(RDP_KEYBOARD_IME_TABLE[i].name); } } @@ -523,7 +525,7 @@ RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(uint32 types) return layouts; } -const char* freerdp_keyboard_get_layout_name_from_id(uint32 keyboardLayoutID) +const char* freerdp_keyboard_get_layout_name_from_id(UINT32 keyboardLayoutID) { int i; diff --git a/libfreerdp/locale/keyboard_sun.c b/libfreerdp/locale/keyboard_sun.c index aa41e1cf6..92a783785 100644 --- a/libfreerdp/locale/keyboard_sun.c +++ b/libfreerdp/locale/keyboard_sun.c @@ -54,10 +54,10 @@ struct _SOLARIS_KEYBOARD { - uint32 type; /* Solaris keyboard type */ - uint32 layout; /* Layout */ + UINT32 type; /* Solaris keyboard type */ + UINT32 layout; /* Layout */ char* xkbType; /* XKB keyboard */ - uint32 keyboardLayoutId; /* XKB keyboard layout */ + UINT32 keyboardLayoutId; /* XKB keyboard layout */ }; typedef struct _SOLARIS_KEYBOARD SOLARIS_KEYBOARD; @@ -202,7 +202,7 @@ static const SOLARIS_KEYBOARD SOLARIS_KEYBOARD_TABLE[] = { 6, 272, "sun(type6)", KBD_PORTUGUESE_BRAZILIAN_ABNT } /* Brazil6_usb */ }; -uint32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int length) +UINT32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int length) { FILE* kbd; diff --git a/libfreerdp/locale/keyboard_sun.h b/libfreerdp/locale/keyboard_sun.h index 2404723fe..985e1e3ac 100644 --- a/libfreerdp/locale/keyboard_sun.h +++ b/libfreerdp/locale/keyboard_sun.h @@ -20,6 +20,6 @@ #ifndef __LOCALE_KEYBOARD_SUN_H #define __LOCALE_KEYBOARD_SUN_H -uint32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int length); +UINT32 freerdp_detect_keyboard_type_and_layout_solaris(char* keyboard_type, int length); #endif /* __LOCALE_KEYBOARD_SUN_H */ diff --git a/libfreerdp/locale/keyboard_x11.c b/libfreerdp/locale/keyboard_x11.c index 55737d697..639414a44 100644 --- a/libfreerdp/locale/keyboard_x11.c +++ b/libfreerdp/locale/keyboard_x11.c @@ -25,7 +25,10 @@ #include #include +#include + #include "liblocale.h" + #include #include #include @@ -42,7 +45,7 @@ extern const RDP_SCANCODE VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[256]; -uint32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_variant) +UINT32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_variant) { char* pch; char* beg; @@ -51,7 +54,7 @@ uint32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_var char buffer[1024]; char* layout = NULL; char* variant = NULL; - uint32 keyboardLayoutId = 0; + UINT32 keyboardLayoutId = 0; /* We start by looking for _XKB_RULES_NAMES_BACKUP which appears to be used by libxklavier */ @@ -103,8 +106,8 @@ uint32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_var if (keyboardLayoutId > 0) { - *xkb_layout = xstrdup(layout); - *xkb_variant = xstrdup(variant); + *xkb_layout = _strdup(layout); + *xkb_variant = _strdup(variant); return keyboardLayoutId; } @@ -149,8 +152,8 @@ uint32 freerdp_detect_keyboard_layout_from_xkb(char** xkb_layout, char** xkb_var if (keyboardLayoutId > 0) { - *xkb_layout = xstrdup(layout); - *xkb_variant = xstrdup(variant); + *xkb_layout = _strdup(layout); + *xkb_variant = _strdup(variant); return keyboardLayoutId; } @@ -194,7 +197,7 @@ char* freerdp_detect_keymap_from_xkb() *end = '\0'; length = (end - beg); - keymap = (char*) xmalloc(length + 1); + keymap = (char*) malloc(length + 1); strncpy(keymap, beg, length); keymap[length] = '\0'; @@ -208,11 +211,11 @@ char* freerdp_detect_keymap_from_xkb() return keymap; } -uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]) +UINT32 freerdp_keyboard_init_x11(UINT32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]) { - uint32 vkcode; - uint32 keycode; - uint32 keycode_to_vkcode[256]; + UINT32 vkcode; + UINT32 keycode; + UINT32 keycode_to_vkcode[256]; memset(keycode_to_vkcode, 0, sizeof(keycode_to_vkcode)); memset(x11_keycode_to_rdp_scancode, 0, sizeof(x11_keycode_to_rdp_scancode)); @@ -236,8 +239,8 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keyco if (keyboardLayoutId == 0) { keyboardLayoutId = freerdp_detect_keyboard_layout_from_xkb(&xkb_layout, &xkb_variant); - xfree(xkb_layout); - xfree(xkb_variant); + free(xkb_layout); + free(xkb_variant); } keymap = freerdp_detect_keymap_from_xkb(); @@ -245,7 +248,7 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keyco if (keymap != NULL) { freerdp_keyboard_load_maps(keycode_to_vkcode, keymap); - xfree(keymap); + free(keymap); } } #endif diff --git a/libfreerdp/locale/keyboard_x11.h b/libfreerdp/locale/keyboard_x11.h index ccd875579..77dece1c9 100644 --- a/libfreerdp/locale/keyboard_x11.h +++ b/libfreerdp/locale/keyboard_x11.h @@ -20,6 +20,6 @@ #ifndef __LOCALE_KEYBOARD_X11_H #define __LOCALE_KEYBOARD_X11_H -uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]); +UINT32 freerdp_keyboard_init_x11(UINT32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]); #endif /* __LOCALE_KEYBOARD_X11_H */ diff --git a/libfreerdp/locale/keyboard_xkbfile.c b/libfreerdp/locale/keyboard_xkbfile.c index 7e1c000b8..49b06a9d3 100644 --- a/libfreerdp/locale/keyboard_xkbfile.c +++ b/libfreerdp/locale/keyboard_xkbfile.c @@ -23,6 +23,8 @@ #include "keyboard_xkbfile.h" +#include +#include #include #include @@ -177,7 +179,7 @@ void* freerdp_keyboard_xkb_init() return (void*) display; } -uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]) +UINT32 freerdp_keyboard_init_xkbfile(UINT32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]) { void* display; memset(x11_keycode_to_rdp_scancode, 0, sizeof(x11_keycode_to_rdp_scancode)); @@ -225,12 +227,12 @@ static char* comma_substring(char* s, int n) return s; } -uint32 detect_keyboard_layout_from_xkbfile(void* display) +UINT32 detect_keyboard_layout_from_xkbfile(void* display) { char* layout; char* variant; - uint32 group = 0; - uint32 keyboard_layout = 0; + UINT32 group = 0; + UINT32 keyboard_layout = 0; XkbRF_VarDefsRec rules_names; XKeyboardState coreKbdState; XkbStateRec state; @@ -257,10 +259,10 @@ uint32 detect_keyboard_layout_from_xkbfile(void* display) keyboard_layout = find_keyboard_layout_in_xorg_rules(layout, variant); - xfree(rules_names.model); - xfree(rules_names.layout); - xfree(rules_names.variant); - xfree(rules_names.options); + free(rules_names.model); + free(rules_names.layout); + free(rules_names.variant); + free(rules_names.options); } return keyboard_layout; @@ -269,9 +271,9 @@ uint32 detect_keyboard_layout_from_xkbfile(void* display) int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]) { int i, j; - boolean found; + BOOL found; XkbDescPtr xkb; - boolean status = false; + BOOL status = FALSE; if (display && (xkb = XkbGetMap(display, 0, XkbUseCoreKbd))) { @@ -281,7 +283,7 @@ int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keyco for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { - found = false; + found = FALSE; memcpy(xkb_keyname, xkb->names->keys[i].name, 4); if (strlen(xkb_keyname) < 1) @@ -301,7 +303,7 @@ int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keyco } x11_keycode_to_rdp_scancode[i] = XKB_KEY_NAME_SCANCODE_TABLE[j].rdp_scancode; - found = true; + found = TRUE; } } @@ -311,7 +313,7 @@ int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keyco } } - status = true; + status = TRUE; } XkbFreeKeyboard(xkb, 0, 1); diff --git a/libfreerdp/locale/keyboard_xkbfile.h b/libfreerdp/locale/keyboard_xkbfile.h index a6be05e42..9205bd13d 100644 --- a/libfreerdp/locale/keyboard_xkbfile.h +++ b/libfreerdp/locale/keyboard_xkbfile.h @@ -23,8 +23,8 @@ #include #include -uint32 freerdp_keyboard_init_xkbfile(uint32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]); -uint32 detect_keyboard_layout_from_xkbfile(void* display); +UINT32 freerdp_keyboard_init_xkbfile(UINT32 keyboardLayoutId, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]); +UINT32 detect_keyboard_layout_from_xkbfile(void* display); int freerdp_keyboard_load_map_from_xkbfile(void* display, RDP_SCANCODE x11_keycode_to_rdp_scancode[256]); #endif /* __LOCALE_KEYBOARD_XKB_H */ diff --git a/libfreerdp/locale/locale.c b/libfreerdp/locale/locale.c index 82362ef78..8f72b2171 100644 --- a/libfreerdp/locale/locale.c +++ b/libfreerdp/locale/locale.c @@ -34,7 +34,7 @@ struct _SYSTEM_LOCALE { char language[4]; /* Two or three letter language code */ char country[10]; /* Two or three letter country code (Sometimes with Cyrl_ prefix) */ - uint32 code; /* 32-bit unsigned integer corresponding to the locale */ + UINT32 code; /* 32-bit unsigned integer corresponding to the locale */ }; typedef struct _SYSTEM_LOCALE SYSTEM_LOCALE; @@ -248,7 +248,7 @@ static const SYSTEM_LOCALE SYSTEM_LOCALE_TABLE[] = struct _LOCALE_NAME { - uint32 localeId; + UINT32 localeId; const char* name; }; typedef struct _LOCALE_NAME LOCALE_NAME; @@ -458,8 +458,8 @@ static const LOCALE_NAME LOCALE_NAME_TABLE[] = struct _LOCALE_KEYBOARD_LAYOUTS { - uint32 locale; /* Locale ID */ - uint32 keyboardLayouts[5]; /* array of associated keyboard layouts */ + UINT32 locale; /* Locale ID */ + UINT32 keyboardLayouts[5]; /* array of associated keyboard layouts */ }; typedef struct _LOCALE_KEYBOARD_LAYOUTS LOCALE_KEYBOARD_LAYOUTS; @@ -629,7 +629,7 @@ static const LOCALE_KEYBOARD_LAYOUTS LOCALE_KEYBOARD_LAYOUTS_TABLE[] = { XHOSA, { 0x00000409, 0x00000409, 0x0, 0x0, 0x0 } }, }; -boolean freerdp_get_system_language_and_country_codes(char* language, char* country) +BOOL freerdp_get_system_language_and_country_codes(char* language, char* country) { int dot; int underscore; @@ -639,13 +639,13 @@ boolean freerdp_get_system_language_and_country_codes(char* language, char* coun env_lang = getenv("LANG"); /* Get locale from environment variable LANG */ if (env_lang == NULL) - return false; /* LANG environment variable was not set */ + return FALSE; /* LANG environment variable was not set */ underscore = strcspn(env_lang, "_"); if (underscore > 3) { - return false; /* The language name should not be more than 3 letters long */ + return FALSE; /* The language name should not be more than 3 letters long */ } else { @@ -664,10 +664,10 @@ boolean freerdp_get_system_language_and_country_codes(char* language, char* coun } else { - return false; /* Invalid locale */ + return FALSE; /* Invalid locale */ } - return true; + return TRUE; } SYSTEM_LOCALE* freerdp_detect_system_locale() @@ -691,7 +691,7 @@ SYSTEM_LOCALE* freerdp_detect_system_locale() return locale; } -uint32 freerdp_get_system_locale_id() +UINT32 freerdp_get_system_locale_id() { SYSTEM_LOCALE* locale; @@ -703,7 +703,7 @@ uint32 freerdp_get_system_locale_id() return 0; } -const char* freerdp_get_system_locale_name_from_id(uint32 localeId) +const char* freerdp_get_system_locale_name_from_id(UINT32 localeId) { int index; @@ -716,7 +716,7 @@ const char* freerdp_get_system_locale_name_from_id(uint32 localeId) return NULL; } -uint32 freerdp_detect_keyboard_layout_from_system_locale() +UINT32 freerdp_detect_keyboard_layout_from_system_locale() { int i, j; char language[4]; diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index 895374f7a..f46a5fcb5 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -26,6 +26,8 @@ #include #include +#include + #include "liblocale.h" #include @@ -38,22 +40,22 @@ struct _SYSTEM_TIME_ENTRY { - uint16 wYear; - uint16 wMonth; - uint16 wDayOfWeek; - uint16 wDay; - uint16 wHour; - uint16 wMinute; - uint16 wSecond; - uint16 wMilliseconds; + UINT16 wYear; + UINT16 wMonth; + UINT16 wDayOfWeek; + UINT16 wDay; + UINT16 wHour; + UINT16 wMinute; + UINT16 wSecond; + UINT16 wMilliseconds; }; typedef struct _SYSTEM_TIME_ENTRY SYSTEM_TIME_ENTRY; struct _TIME_ZONE_RULE_ENTRY { - uint64 TicksStart; - uint64 TicksEnd; - sint32 DaylightDelta; + UINT64 TicksStart; + UINT64 TicksEnd; + INT32 DaylightDelta; SYSTEM_TIME_ENTRY StandardDate; SYSTEM_TIME_ENTRY DaylightDate; }; @@ -62,13 +64,13 @@ typedef struct _TIME_ZONE_RULE_ENTRY TIME_ZONE_RULE_ENTRY; struct _TIME_ZONE_ENTRY { const char* Id; - uint32 Bias; - boolean SupportsDST; + UINT32 Bias; + BOOL SupportsDST; const char* DisplayName; const char* StandardName; const char* DaylightName; TIME_ZONE_RULE_ENTRY* RuleTable; - uint32 RuleTableCount; + UINT32 RuleTableCount; }; typedef struct _TIME_ZONE_ENTRY TIME_ZONE_ENTRY; @@ -594,507 +596,507 @@ static const TIME_ZONE_RULE_ENTRY TimeZoneRuleTable_100[] = static const TIME_ZONE_ENTRY TimeZoneTable[] = { { - "Dateline Standard Time", 720, false, "(UTC-12:00) International Date Line West", + "Dateline Standard Time", 720, FALSE, "(UTC-12:00) International Date Line West", "Dateline Standard Time", "Dateline Daylight Time", NULL, 0 }, { - "UTC-11", 780, false, "(UTC-11:00) Coordinated Universal Time-11", + "UTC-11", 780, FALSE, "(UTC-11:00) Coordinated Universal Time-11", "UTC-11", "UTC-11", NULL, 0 }, { - "Hawaiian Standard Time", 840, false, "(UTC-10:00) Hawaii", + "Hawaiian Standard Time", 840, FALSE, "(UTC-10:00) Hawaii", "Hawaiian Standard Time", "Hawaiian Daylight Time", NULL, 0 }, { - "Alaskan Standard Time", 900, true, "(UTC-09:00) Alaska", + "Alaskan Standard Time", 900, TRUE, "(UTC-09:00) Alaska", "Alaskan Standard Time", "Alaskan Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_3, 2 }, { - "Pacific Standard Time (Mexico)", 960, true, "(UTC-08:00) Baja California", + "Pacific Standard Time (Mexico)", 960, TRUE, "(UTC-08:00) Baja California", "Pacific Standard Time (Mexico)", "Pacific Daylight Time (Mexico)", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_4, 1 }, { - "Pacific Standard Time", 960, true, "(UTC-08:00) Pacific Time (US & Canada)", + "Pacific Standard Time", 960, TRUE, "(UTC-08:00) Pacific Time (US & Canada)", "Pacific Standard Time", "Pacific Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_5, 2 }, { - "US Mountain Standard Time", 1020, false, "(UTC-07:00) Arizona", + "US Mountain Standard Time", 1020, FALSE, "(UTC-07:00) Arizona", "US Mountain Standard Time", "US Mountain Daylight Time", NULL, 0 }, { - "Mountain Standard Time (Mexico)", 1020, true, "(UTC-07:00) Chihuahua, La Paz, Mazatlan", + "Mountain Standard Time (Mexico)", 1020, TRUE, "(UTC-07:00) Chihuahua, La Paz, Mazatlan", "Mountain Standard Time (Mexico)", "Mountain Daylight Time (Mexico)", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_7, 1 }, { - "Mountain Standard Time", 1020, true, "(UTC-07:00) Mountain Time (US & Canada)", + "Mountain Standard Time", 1020, TRUE, "(UTC-07:00) Mountain Time (US & Canada)", "Mountain Standard Time", "Mountain Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_8, 2 }, { - "Central America Standard Time", 1080, false, "(UTC-06:00) Central America", + "Central America Standard Time", 1080, FALSE, "(UTC-06:00) Central America", "Central America Standard Time", "Central America Daylight Time", NULL, 0 }, { - "Central Standard Time", 1080, true, "(UTC-06:00) Central Time (US & Canada)", + "Central Standard Time", 1080, TRUE, "(UTC-06:00) Central Time (US & Canada)", "Central Standard Time", "Central Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_10, 2 }, { - "Central Standard Time (Mexico)", 1080, true, "(UTC-06:00) Guadalajara, Mexico City, Monterrey", + "Central Standard Time (Mexico)", 1080, TRUE, "(UTC-06:00) Guadalajara, Mexico City, Monterrey", "Central Standard Time (Mexico)", "Central Daylight Time (Mexico)", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_11, 1 }, { - "Canada Central Standard Time", 1080, false, "(UTC-06:00) Saskatchewan", + "Canada Central Standard Time", 1080, FALSE, "(UTC-06:00) Saskatchewan", "Canada Central Standard Time", "Canada Central Daylight Time", NULL, 0 }, { - "SA Pacific Standard Time", 1140, false, "(UTC-05:00) Bogota, Lima, Quito", + "SA Pacific Standard Time", 1140, FALSE, "(UTC-05:00) Bogota, Lima, Quito", "SA Pacific Standard Time", "SA Pacific Daylight Time", NULL, 0 }, { - "Eastern Standard Time", 1140, true, "(UTC-05:00) Eastern Time (US & Canada)", + "Eastern Standard Time", 1140, TRUE, "(UTC-05:00) Eastern Time (US & Canada)", "Eastern Standard Time", "Eastern Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_14, 2 }, { - "US Eastern Standard Time", 1140, true, "(UTC-05:00) Indiana (East)", + "US Eastern Standard Time", 1140, TRUE, "(UTC-05:00) Indiana (East)", "US Eastern Standard Time", "US Eastern Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_15, 2 }, { - "Venezuela Standard Time", 1170, false, "(UTC-04:30) Caracas", + "Venezuela Standard Time", 1170, FALSE, "(UTC-04:30) Caracas", "Venezuela Standard Time", "Venezuela Daylight Time", NULL, 0 }, { - "Paraguay Standard Time", 1200, true, "(UTC-04:00) Asuncion", + "Paraguay Standard Time", 1200, TRUE, "(UTC-04:00) Asuncion", "Paraguay Standard Time", "Paraguay Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_17, 14 }, { - "Atlantic Standard Time", 1200, true, "(UTC-04:00) Atlantic Time (Canada)", + "Atlantic Standard Time", 1200, TRUE, "(UTC-04:00) Atlantic Time (Canada)", "Atlantic Standard Time", "Atlantic Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_18, 2 }, { - "Central Brazilian Standard Time", 1200, true, "(UTC-04:00) Cuiaba", + "Central Brazilian Standard Time", 1200, TRUE, "(UTC-04:00) Cuiaba", "Central Brazilian Standard Time", "Central Brazilian Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_19, 35 }, { - "SA Western Standard Time", 1200, false, "(UTC-04:00) Georgetown, La Paz, Manaus, San Juan", + "SA Western Standard Time", 1200, FALSE, "(UTC-04:00) Georgetown, La Paz, Manaus, San Juan", "SA Western Standard Time", "SA Western Daylight Time", NULL, 0 }, { - "Pacific SA Standard Time", 1200, true, "(UTC-04:00) Santiago", + "Pacific SA Standard Time", 1200, TRUE, "(UTC-04:00) Santiago", "Pacific SA Standard Time", "Pacific SA Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_21, 6 }, { - "Newfoundland Standard Time", 1230, true, "(UTC-03:30) Newfoundland", + "Newfoundland Standard Time", 1230, TRUE, "(UTC-03:30) Newfoundland", "Newfoundland Standard Time", "Newfoundland Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_22, 7 }, { - "E. South America Standard Time", 1260, true, "(UTC-03:00) Brasilia", + "E. South America Standard Time", 1260, TRUE, "(UTC-03:00) Brasilia", "E. South America Standard Time", "E. South America Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_23, 35 }, { - "Argentina Standard Time", 1260, true, "(UTC-03:00) Buenos Aires", + "Argentina Standard Time", 1260, TRUE, "(UTC-03:00) Buenos Aires", "Argentina Standard Time", "Argentina Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_24, 3 }, { - "SA Eastern Standard Time", 1260, false, "(UTC-03:00) Cayenne, Fortaleza", + "SA Eastern Standard Time", 1260, FALSE, "(UTC-03:00) Cayenne, Fortaleza", "SA Eastern Standard Time", "SA Eastern Daylight Time", NULL, 0 }, { - "Greenland Standard Time", 1260, true, "(UTC-03:00) Greenland", + "Greenland Standard Time", 1260, TRUE, "(UTC-03:00) Greenland", "Greenland Standard Time", "Greenland Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_26, 14 }, { - "Montevideo Standard Time", 1260, true, "(UTC-03:00) Montevideo", + "Montevideo Standard Time", 1260, TRUE, "(UTC-03:00) Montevideo", "Montevideo Standard Time", "Montevideo Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_27, 2 }, { - "Bahia Standard Time", 1260, true, "(UTC-03:00) Salvador", + "Bahia Standard Time", 1260, TRUE, "(UTC-03:00) Salvador", "Bahia Standard Time", "Bahia Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_28, 30 }, { - "UTC-02", 1320, false, "(UTC-02:00) Coordinated Universal Time-02", + "UTC-02", 1320, FALSE, "(UTC-02:00) Coordinated Universal Time-02", "UTC-02", "UTC-02", NULL, 0 }, { - "Mid-Atlantic Standard Time", 1320, true, "(UTC-02:00) Mid-Atlantic", + "Mid-Atlantic Standard Time", 1320, TRUE, "(UTC-02:00) Mid-Atlantic", "Mid-Atlantic Standard Time", "Mid-Atlantic Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_30, 1 }, { - "Azores Standard Time", 1380, true, "(UTC-01:00) Azores", + "Azores Standard Time", 1380, TRUE, "(UTC-01:00) Azores", "Azores Standard Time", "Azores Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_31, 1 }, { - "Cape Verde Standard Time", 1380, false, "(UTC-01:00) Cape Verde Is.", + "Cape Verde Standard Time", 1380, FALSE, "(UTC-01:00) Cape Verde Is.", "Cape Verde Standard Time", "Cape Verde Daylight Time", NULL, 0 }, { - "Morocco Standard Time", 0, true, "(UTC) Casablanca", + "Morocco Standard Time", 0, TRUE, "(UTC) Casablanca", "Morocco Standard Time", "Morocco Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_33, 4 }, { - "UTC", 0, false, "(UTC) Coordinated Universal Time", + "UTC", 0, FALSE, "(UTC) Coordinated Universal Time", "Coordinated Universal Time", "Coordinated Universal Time", NULL, 0 }, { - "GMT Standard Time", 0, true, "(UTC) Dublin, Edinburgh, Lisbon, London", + "GMT Standard Time", 0, TRUE, "(UTC) Dublin, Edinburgh, Lisbon, London", "GMT Standard Time", "GMT Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_35, 1 }, { - "Greenwich Standard Time", 0, false, "(UTC) Monrovia, Reykjavik", + "Greenwich Standard Time", 0, FALSE, "(UTC) Monrovia, Reykjavik", "Greenwich Standard Time", "Greenwich Daylight Time", NULL, 0 }, { - "W. Europe Standard Time", 60, true, "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna", + "W. Europe Standard Time", 60, TRUE, "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna", "W. Europe Standard Time", "W. Europe Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_37, 1 }, { - "Central Europe Standard Time", 60, true, "(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague", + "Central Europe Standard Time", 60, TRUE, "(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague", "Central Europe Standard Time", "Central Europe Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_38, 1 }, { - "Romance Standard Time", 60, true, "(UTC+01:00) Brussels, Copenhagen, Madrid, Paris", + "Romance Standard Time", 60, TRUE, "(UTC+01:00) Brussels, Copenhagen, Madrid, Paris", "Romance Standard Time", "Romance Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_39, 1 }, { - "Central European Standard Time", 60, true, "(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb", + "Central European Standard Time", 60, TRUE, "(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb", "Central European Standard Time", "Central European Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_40, 1 }, { - "W. Central Africa Standard Time", 60, false, "(UTC+01:00) West Central Africa", + "W. Central Africa Standard Time", 60, FALSE, "(UTC+01:00) West Central Africa", "W. Central Africa Standard Time", "W. Central Africa Daylight Time", NULL, 0 }, { - "Namibia Standard Time", 60, true, "(UTC+01:00) Windhoek", + "Namibia Standard Time", 60, TRUE, "(UTC+01:00) Windhoek", "Namibia Standard Time", "Namibia Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_42, 2 }, { - "Jordan Standard Time", 120, true, "(UTC+02:00) Amman", + "Jordan Standard Time", 120, TRUE, "(UTC+02:00) Amman", "Jordan Standard Time", "Jordan Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_43, 2 }, { - "GTB Standard Time", 120, true, "(UTC+02:00) Athens, Bucharest, Istanbul", + "GTB Standard Time", 120, TRUE, "(UTC+02:00) Athens, Bucharest, Istanbul", "GTB Standard Time", "GTB Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_44, 1 }, { - "Middle East Standard Time", 120, true, "(UTC+02:00) Beirut", + "Middle East Standard Time", 120, TRUE, "(UTC+02:00) Beirut", "Middle East Standard Time", "Middle East Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_45, 13 }, { - "Egypt Standard Time", 120, true, "(UTC+02:00) Cairo", + "Egypt Standard Time", 120, TRUE, "(UTC+02:00) Cairo", "Egypt Standard Time", "Egypt Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_46, 6 }, { - "Syria Standard Time", 120, true, "(UTC+02:00) Damascus", + "Syria Standard Time", 120, TRUE, "(UTC+02:00) Damascus", "Syria Standard Time", "Syria Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_47, 12 }, { - "South Africa Standard Time", 120, false, "(UTC+02:00) Harare, Pretoria", + "South Africa Standard Time", 120, FALSE, "(UTC+02:00) Harare, Pretoria", "South Africa Standard Time", "South Africa Daylight Time", NULL, 0 }, { - "FLE Standard Time", 120, true, "(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius", + "FLE Standard Time", 120, TRUE, "(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius", "FLE Standard Time", "FLE Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_49, 1 }, { - "Turkey Standard Time", 120, true, "(UTC+02:00) Istanbul", + "Turkey Standard Time", 120, TRUE, "(UTC+02:00) Istanbul", "Turkey Standard Time", "Turkey Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_50, 3 }, { - "Israel Standard Time", 120, true, "(UTC+02:00) Jerusalem", + "Israel Standard Time", 120, TRUE, "(UTC+02:00) Jerusalem", "Jerusalem Standard Time", "Jerusalem Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_51, 18 }, { - "E. Europe Standard Time", 120, true, "(UTC+02:00) Nicosia", + "E. Europe Standard Time", 120, TRUE, "(UTC+02:00) Nicosia", "E. Europe Standard Time", "E. Europe Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_52, 1 }, { - "Arabic Standard Time", 180, true, "(UTC+03:00) Baghdad", + "Arabic Standard Time", 180, TRUE, "(UTC+03:00) Baghdad", "Arabic Standard Time", "Arabic Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_53, 2 }, { - "Kaliningrad Standard Time", 180, true, "(UTC+03:00) Kaliningrad, Minsk", + "Kaliningrad Standard Time", 180, TRUE, "(UTC+03:00) Kaliningrad, Minsk", "Kaliningrad Standard Time", "Kaliningrad Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_54, 1 }, { - "Arab Standard Time", 180, false, "(UTC+03:00) Kuwait, Riyadh", + "Arab Standard Time", 180, FALSE, "(UTC+03:00) Kuwait, Riyadh", "Arab Standard Time", "Arab Daylight Time", NULL, 0 }, { - "E. Africa Standard Time", 180, false, "(UTC+03:00) Nairobi", + "E. Africa Standard Time", 180, FALSE, "(UTC+03:00) Nairobi", "E. Africa Standard Time", "E. Africa Daylight Time", NULL, 0 }, { - "Iran Standard Time", 210, true, "(UTC+03:30) Tehran", + "Iran Standard Time", 210, TRUE, "(UTC+03:30) Tehran", "Iran Standard Time", "Iran Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_57, 3 }, { - "Arabian Standard Time", 240, false, "(UTC+04:00) Abu Dhabi, Muscat", + "Arabian Standard Time", 240, FALSE, "(UTC+04:00) Abu Dhabi, Muscat", "Arabian Standard Time", "Arabian Daylight Time", NULL, 0 }, { - "Azerbaijan Standard Time", 240, true, "(UTC+04:00) Baku", + "Azerbaijan Standard Time", 240, TRUE, "(UTC+04:00) Baku", "Azerbaijan Standard Time", "Azerbaijan Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_59, 1 }, { - "Russian Standard Time", 240, true, "(UTC+04:00) Moscow, St. Petersburg, Volgograd", + "Russian Standard Time", 240, TRUE, "(UTC+04:00) Moscow, St. Petersburg, Volgograd", "Russian Standard Time", "Russian Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_60, 1 }, { - "Mauritius Standard Time", 240, true, "(UTC+04:00) Port Louis", + "Mauritius Standard Time", 240, TRUE, "(UTC+04:00) Port Louis", "Mauritius Standard Time", "Mauritius Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_61, 2 }, { - "Georgian Standard Time", 240, false, "(UTC+04:00) Tbilisi", + "Georgian Standard Time", 240, FALSE, "(UTC+04:00) Tbilisi", "Georgian Standard Time", "Georgian Daylight Time", NULL, 0 }, { - "Caucasus Standard Time", 240, true, "(UTC+04:00) Yerevan", + "Caucasus Standard Time", 240, TRUE, "(UTC+04:00) Yerevan", "Caucasus Standard Time", "Caucasus Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_63, 1 }, { - "Afghanistan Standard Time", 270, false, "(UTC+04:30) Kabul", + "Afghanistan Standard Time", 270, FALSE, "(UTC+04:30) Kabul", "Afghanistan Standard Time", "Afghanistan Daylight Time", NULL, 0 }, { - "Pakistan Standard Time", 300, true, "(UTC+05:00) Islamabad, Karachi", + "Pakistan Standard Time", 300, TRUE, "(UTC+05:00) Islamabad, Karachi", "Pakistan Standard Time", "Pakistan Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_65, 2 }, { - "West Asia Standard Time", 300, false, "(UTC+05:00) Tashkent", + "West Asia Standard Time", 300, FALSE, "(UTC+05:00) Tashkent", "West Asia Standard Time", "West Asia Daylight Time", NULL, 0 }, { - "India Standard Time", 330, false, "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi", + "India Standard Time", 330, FALSE, "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi", "India Standard Time", "India Daylight Time", NULL, 0 }, { - "Sri Lanka Standard Time", 330, false, "(UTC+05:30) Sri Jayawardenepura", + "Sri Lanka Standard Time", 330, FALSE, "(UTC+05:30) Sri Jayawardenepura", "Sri Lanka Standard Time", "Sri Lanka Daylight Time", NULL, 0 }, { - "Nepal Standard Time", 345, false, "(UTC+05:45) Kathmandu", + "Nepal Standard Time", 345, FALSE, "(UTC+05:45) Kathmandu", "Nepal Standard Time", "Nepal Daylight Time", NULL, 0 }, { - "Central Asia Standard Time", 360, false, "(UTC+06:00) Astana", + "Central Asia Standard Time", 360, FALSE, "(UTC+06:00) Astana", "Central Asia Standard Time", "Central Asia Daylight Time", NULL, 0 }, { - "Bangladesh Standard Time", 360, true, "(UTC+06:00) Dhaka", + "Bangladesh Standard Time", 360, TRUE, "(UTC+06:00) Dhaka", "Bangladesh Standard Time", "Bangladesh Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_71, 1 }, { - "Ekaterinburg Standard Time", 360, true, "(UTC+06:00) Ekaterinburg", + "Ekaterinburg Standard Time", 360, TRUE, "(UTC+06:00) Ekaterinburg", "Ekaterinburg Standard Time", "Ekaterinburg Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_72, 1 }, { - "Myanmar Standard Time", 390, false, "(UTC+06:30) Yangon (Rangoon)", + "Myanmar Standard Time", 390, FALSE, "(UTC+06:30) Yangon (Rangoon)", "Myanmar Standard Time", "Myanmar Daylight Time", NULL, 0 }, { - "SE Asia Standard Time", 420, false, "(UTC+07:00) Bangkok, Hanoi, Jakarta", + "SE Asia Standard Time", 420, FALSE, "(UTC+07:00) Bangkok, Hanoi, Jakarta", "SE Asia Standard Time", "SE Asia Daylight Time", NULL, 0 }, { - "N. Central Asia Standard Time", 420, true, "(UTC+07:00) Novosibirsk", + "N. Central Asia Standard Time", 420, TRUE, "(UTC+07:00) Novosibirsk", "N. Central Asia Standard Time", "N. Central Asia Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_75, 1 }, { - "China Standard Time", 480, false, "(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi", + "China Standard Time", 480, FALSE, "(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi", "China Standard Time", "China Daylight Time", NULL, 0 }, { - "North Asia Standard Time", 480, true, "(UTC+08:00) Krasnoyarsk", + "North Asia Standard Time", 480, TRUE, "(UTC+08:00) Krasnoyarsk", "North Asia Standard Time", "North Asia Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_77, 1 }, { - "Singapore Standard Time", 480, false, "(UTC+08:00) Kuala Lumpur, Singapore", + "Singapore Standard Time", 480, FALSE, "(UTC+08:00) Kuala Lumpur, Singapore", "Malay Peninsula Standard Time", "Malay Peninsula Daylight Time", NULL, 0 }, { - "W. Australia Standard Time", 480, true, "(UTC+08:00) Perth", + "W. Australia Standard Time", 480, TRUE, "(UTC+08:00) Perth", "W. Australia Standard Time", "W. Australia Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_79, 4 }, { - "Taipei Standard Time", 480, false, "(UTC+08:00) Taipei", + "Taipei Standard Time", 480, FALSE, "(UTC+08:00) Taipei", "Taipei Standard Time", "Taipei Daylight Time", NULL, 0 }, { - "Ulaanbaatar Standard Time", 480, false, "(UTC+08:00) Ulaanbaatar", + "Ulaanbaatar Standard Time", 480, FALSE, "(UTC+08:00) Ulaanbaatar", "Ulaanbaatar Standard Time", "Ulaanbaatar Daylight Time", NULL, 0 }, { - "North Asia East Standard Time", 540, true, "(UTC+09:00) Irkutsk", + "North Asia East Standard Time", 540, TRUE, "(UTC+09:00) Irkutsk", "North Asia East Standard Time", "North Asia East Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_82, 1 }, { - "Tokyo Standard Time", 540, false, "(UTC+09:00) Osaka, Sapporo, Tokyo", + "Tokyo Standard Time", 540, FALSE, "(UTC+09:00) Osaka, Sapporo, Tokyo", "Tokyo Standard Time", "Tokyo Daylight Time", NULL, 0 }, { - "Korea Standard Time", 540, false, "(UTC+09:00) Seoul", + "Korea Standard Time", 540, FALSE, "(UTC+09:00) Seoul", "Korea Standard Time", "Korea Daylight Time", NULL, 0 }, { - "Cen. Australia Standard Time", 570, true, "(UTC+09:30) Adelaide", + "Cen. Australia Standard Time", 570, TRUE, "(UTC+09:30) Adelaide", "Cen. Australia Standard Time", "Cen. Australia Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_85, 2 }, { - "AUS Central Standard Time", 570, false, "(UTC+09:30) Darwin", + "AUS Central Standard Time", 570, FALSE, "(UTC+09:30) Darwin", "AUS Central Standard Time", "AUS Central Daylight Time", NULL, 0 }, { - "E. Australia Standard Time", 600, false, "(UTC+10:00) Brisbane", + "E. Australia Standard Time", 600, FALSE, "(UTC+10:00) Brisbane", "E. Australia Standard Time", "E. Australia Daylight Time", NULL, 0 }, { - "AUS Eastern Standard Time", 600, true, "(UTC+10:00) Canberra, Melbourne, Sydney", + "AUS Eastern Standard Time", 600, TRUE, "(UTC+10:00) Canberra, Melbourne, Sydney", "AUS Eastern Standard Time", "AUS Eastern Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_88, 2 }, { - "West Pacific Standard Time", 600, false, "(UTC+10:00) Guam, Port Moresby", + "West Pacific Standard Time", 600, FALSE, "(UTC+10:00) Guam, Port Moresby", "West Pacific Standard Time", "West Pacific Daylight Time", NULL, 0 }, { - "Tasmania Standard Time", 600, true, "(UTC+10:00) Hobart", + "Tasmania Standard Time", 600, TRUE, "(UTC+10:00) Hobart", "Tasmania Standard Time", "Tasmania Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_90, 2 }, { - "Yakutsk Standard Time", 600, true, "(UTC+10:00) Yakutsk", + "Yakutsk Standard Time", 600, TRUE, "(UTC+10:00) Yakutsk", "Yakutsk Standard Time", "Yakutsk Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_91, 1 }, { - "Central Pacific Standard Time", 660, false, "(UTC+11:00) Solomon Is., New Caledonia", + "Central Pacific Standard Time", 660, FALSE, "(UTC+11:00) Solomon Is., New Caledonia", "Central Pacific Standard Time", "Central Pacific Daylight Time", NULL, 0 }, { - "Vladivostok Standard Time", 660, true, "(UTC+11:00) Vladivostok", + "Vladivostok Standard Time", 660, TRUE, "(UTC+11:00) Vladivostok", "Vladivostok Standard Time", "Vladivostok Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_93, 1 }, { - "New Zealand Standard Time", 720, true, "(UTC+12:00) Auckland, Wellington", + "New Zealand Standard Time", 720, TRUE, "(UTC+12:00) Auckland, Wellington", "New Zealand Standard Time", "New Zealand Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_94, 3 }, { - "UTC+12", 720, false, "(UTC+12:00) Coordinated Universal Time+12", + "UTC+12", 720, FALSE, "(UTC+12:00) Coordinated Universal Time+12", "UTC+12", "UTC+12", NULL, 0 }, { - "Fiji Standard Time", 720, true, "(UTC+12:00) Fiji", + "Fiji Standard Time", 720, TRUE, "(UTC+12:00) Fiji", "Fiji Standard Time", "Fiji Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_96, 5 }, { - "Magadan Standard Time", 720, true, "(UTC+12:00) Magadan", + "Magadan Standard Time", 720, TRUE, "(UTC+12:00) Magadan", "Magadan Standard Time", "Magadan Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_97, 1 }, { - "Kamchatka Standard Time", 720, true, "(UTC+12:00) Petropavlovsk-Kamchatsky - Old", + "Kamchatka Standard Time", 720, TRUE, "(UTC+12:00) Petropavlovsk-Kamchatsky - Old", "Kamchatka Standard Time", "Kamchatka Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_98, 1 }, { - "Tonga Standard Time", 780, false, "(UTC+13:00) Nuku'alofa", + "Tonga Standard Time", 780, FALSE, "(UTC+13:00) Nuku'alofa", "Tonga Standard Time", "Tonga Daylight Time", NULL, 0 }, { - "Samoa Standard Time", 780, true, "(UTC+13:00) Samoa", + "Samoa Standard Time", 780, TRUE, "(UTC+13:00) Samoa", "Samoa Standard Time", "Samoa Daylight Time", (TIME_ZONE_RULE_ENTRY*) &TimeZoneRuleTable_100, 2 } @@ -1502,7 +1504,7 @@ char* freerdp_get_unix_timezone_identifier() if (tz_env != NULL) { - tzid = xstrdup(tz_env); + tzid = _strdup(tz_env); return tzid; } @@ -1520,7 +1522,7 @@ char* freerdp_get_unix_timezone_identifier() return NULL; } - tzid = (char*) xmalloc(length + 1); + tzid = (char*) malloc(length + 1); fread(tzid, length, 1, fp); tzid[length] = '\0'; @@ -1558,7 +1560,7 @@ char* freerdp_get_unix_timezone_identifier() num++; } - tzid = (char*) xmalloc(len - pos + 1); + tzid = (char*) malloc(len - pos + 1); strncpy(tzid, buf + pos + 1, len - pos); return tzid; @@ -1571,12 +1573,12 @@ char* freerdp_get_unix_timezone_identifier() #endif } -boolean freerdp_match_unix_timezone_identifier_with_list(const char* tzid, const char* list) +BOOL freerdp_match_unix_timezone_identifier_with_list(const char* tzid, const char* list) { char* p; char* list_copy; - list_copy = xstrdup(list); + list_copy = _strdup(list); p = strtok(list_copy, " "); @@ -1584,19 +1586,19 @@ boolean freerdp_match_unix_timezone_identifier_with_list(const char* tzid, const { if (strcmp(p, tzid) == 0) { - xfree(list_copy); - return true; + free(list_copy); + return TRUE; } p = strtok(NULL, " "); } - xfree(list_copy); + free(list_copy); - return false; + return FALSE; } -TIME_ZONE_ENTRY* freerdp_detect_windows_time_zone(uint32 bias) +TIME_ZONE_ENTRY* freerdp_detect_windows_time_zone(UINT32 bias) { int i, j; char* tzid; @@ -1616,24 +1618,24 @@ TIME_ZONE_ENTRY* freerdp_detect_windows_time_zone(uint32 bias) if (freerdp_match_unix_timezone_identifier_with_list(tzid, WindowsTimeZoneIdTable[j].tzid)) { - timezone = (TIME_ZONE_ENTRY*) xmalloc(sizeof(TIME_ZONE_ENTRY)); + timezone = (TIME_ZONE_ENTRY*) malloc(sizeof(TIME_ZONE_ENTRY)); memcpy((void*) timezone, (void*) &TimeZoneTable[i], sizeof(TIME_ZONE_ENTRY)); timezone->Bias = bias; - xfree(tzid); + free(tzid); return timezone; } } } printf("Unable to find a match for unix timezone: %s\n", tzid); - xfree(tzid); + free(tzid); return NULL; } -TIME_ZONE_RULE_ENTRY* freerdp_get_current_time_zone_rule(TIME_ZONE_RULE_ENTRY* rules, uint32 count) +TIME_ZONE_RULE_ENTRY* freerdp_get_current_time_zone_rule(TIME_ZONE_RULE_ENTRY* rules, UINT32 count) { int i; - uint64 windows_time; + UINT64 windows_time; windows_time = freerdp_windows_gmtime(); @@ -1661,14 +1663,14 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) #ifdef HAVE_TM_GMTOFF if (local_time->tm_gmtoff >= 0) - clientTimeZone->bias = (uint32) (local_time->tm_gmtoff / 60); + clientTimeZone->bias = (UINT32) (local_time->tm_gmtoff / 60); else - clientTimeZone->bias = (uint32) (1440 + (sint32) (local_time->tm_gmtoff / 60)); + clientTimeZone->bias = (UINT32) (1440 + (INT32) (local_time->tm_gmtoff / 60)); #elif sun if (local_time->tm_isdst > 0) - clientTimeZone->bias = (uint32) (altzone / 3600); + clientTimeZone->bias = (UINT32) (altzone / 3600); else - clientTimeZone->bias = (uint32) (timezone / 3600); + clientTimeZone->bias = (UINT32) (timezone / 3600); #else clientTimeZone->bias = 0; #endif @@ -1730,7 +1732,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) */ } - xfree(tz); + free(tz); } else { diff --git a/libfreerdp/locale/virtual_key_codes.c b/libfreerdp/locale/virtual_key_codes.c index bd2d9cc81..af93af025 100644 --- a/libfreerdp/locale/virtual_key_codes.c +++ b/libfreerdp/locale/virtual_key_codes.c @@ -31,7 +31,7 @@ struct _VIRTUAL_KEY_CODE { - uint32 code; /* Windows Virtual Key Code */ + UINT32 code; /* Windows Virtual Key Code */ const char* name; /* Virtual Key Code Name */ }; typedef struct _VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE; @@ -296,12 +296,12 @@ static const VIRTUAL_KEY_CODE VIRTUAL_KEY_CODE_TABLE[256] = { 0, "" } }; -const char* freerdp_keyboard_get_virtual_key_code_name(uint32 vkcode) +const char* freerdp_keyboard_get_virtual_key_code_name(UINT32 vkcode) { return VIRTUAL_KEY_CODE_TABLE[vkcode].name; } -uint32 freerdp_keyboard_get_virtual_key_code_from_name(const char* vkcode_name) +UINT32 freerdp_keyboard_get_virtual_key_code_from_name(const char* vkcode_name) { int i = 0; for (i = 0; i < ARRAY_SIZE(VIRTUAL_KEY_CODE_TABLE); i++) diff --git a/libfreerdp/locale/xkb_layout_ids.c b/libfreerdp/locale/xkb_layout_ids.c index 1037351fa..623b86db3 100644 --- a/libfreerdp/locale/xkb_layout_ids.c +++ b/libfreerdp/locale/xkb_layout_ids.c @@ -33,14 +33,14 @@ struct _XKB_VARIANT { const char* variant; /* XKB Keyboard layout variant */ - uint32 keyboardLayoutID; /* Keyboard Layout ID */ + UINT32 keyboardLayoutID; /* Keyboard Layout ID */ }; typedef struct _XKB_VARIANT XKB_VARIANT; struct _XKB_LAYOUT { const char* layout; /* XKB Keyboard layout */ - uint32 keyboardLayoutID; /* Keyboard Layout ID */ + UINT32 keyboardLayoutID; /* Keyboard Layout ID */ const XKB_VARIANT* variants; }; typedef struct _XKB_LAYOUT XKB_LAYOUT; @@ -895,7 +895,7 @@ static const XKB_LAYOUT xkbLayouts[] = { "tm", KBD_TURKISH_Q, tm_variants }, /* Turkmenistan */ }; -uint32 find_keyboard_layout_in_xorg_rules(char* layout, char* variant) +UINT32 find_keyboard_layout_in_xorg_rules(char* layout, char* variant) { int i, j; diff --git a/libfreerdp/locale/xkb_layout_ids.h b/libfreerdp/locale/xkb_layout_ids.h index bfd379c5b..6e0c6469b 100644 --- a/libfreerdp/locale/xkb_layout_ids.h +++ b/libfreerdp/locale/xkb_layout_ids.h @@ -22,6 +22,6 @@ #include -uint32 find_keyboard_layout_in_xorg_rules(char* layout, char* variant); +UINT32 find_keyboard_layout_in_xorg_rules(char* layout, char* variant); #endif /* __FREERDP_XKB_LAYOUT_IDS_H */ diff --git a/libfreerdp/rail/CMakeLists.txt b/libfreerdp/rail/CMakeLists.txt index 8f256ed37..c89318e9b 100644 --- a/libfreerdp/rail/CMakeLists.txt +++ b/libfreerdp/rail/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-rail cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -25,7 +25,7 @@ set(${MODULE_PREFIX}_SRCS rail.c librail.h) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -33,7 +33,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() set(FREERDP_RAIL_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-utils) @@ -42,4 +42,4 @@ else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/rail/icon.c b/libfreerdp/rail/icon.c index bbca5a7ad..3b26b158e 100644 --- a/libfreerdp/rail/icon.c +++ b/libfreerdp/rail/icon.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Window Icon Cache * * Copyright 2011 Marc-Andre Moreau @@ -28,7 +28,7 @@ #include -ICON_INFO* icon_cache_get(rdpIconCache* cache, uint8 id, uint16 index, void** extra) +ICON_INFO* icon_cache_get(rdpIconCache* cache, BYTE id, UINT16 index, void** extra) { ICON_INFO* entry; @@ -52,7 +52,7 @@ ICON_INFO* icon_cache_get(rdpIconCache* cache, uint8 id, uint16 index, void** ex return entry; } -void icon_cache_put(rdpIconCache* cache, uint8 id, uint16 index, ICON_INFO* entry, void* extra) +void icon_cache_put(rdpIconCache* cache, BYTE id, UINT16 index, ICON_INFO* entry, void* extra) { if (id >= cache->numCaches) { @@ -83,7 +83,7 @@ rdpIconCache* icon_cache_new(rdpRail* rail) int i; cache->rail = rail; - cache->numCaches = (uint8) rail->settings->num_icon_cache_entries; + cache->numCaches = (BYTE) rail->settings->num_icon_cache_entries; cache->numCacheEntries = rail->settings->num_icon_cache_entries; cache->caches = xzalloc(cache->numCaches * sizeof(WINDOW_ICON_CACHE)); @@ -105,12 +105,12 @@ void icon_cache_free(rdpIconCache* cache) for (i = 0; i < cache->numCaches; i++) { - xfree(cache->caches[i].entries); + free(cache->caches[i].entries); } - xfree(cache->caches); + free(cache->caches); - xfree(cache); + free(cache); } } diff --git a/libfreerdp/rail/librail.h b/libfreerdp/rail/librail.h index 68d9c8b49..f4795caa0 100644 --- a/libfreerdp/rail/librail.h +++ b/libfreerdp/rail/librail.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) * * Copyright 2011 Marc-Andre Moreau diff --git a/libfreerdp/rail/rail.c b/libfreerdp/rail/rail.c index 0720ce2dd..31f0e17a3 100644 --- a/libfreerdp/rail/rail.c +++ b/libfreerdp/rail/rail.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) * * Copyright 2011 Marc-Andre Moreau @@ -64,7 +64,7 @@ static void rail_WindowIcon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, W icon = (rdpIcon*) xzalloc(sizeof(rdpIcon)); icon->entry = window_icon->iconInfo; - icon->big = (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? true : false; + icon->big = (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? TRUE : FALSE; DEBUG_RAIL("Window Icon: %dx%d@%dbpp cbBitsColor:%d cbBitsMask:%d cbColorTable:%d", window_icon->iconInfo->width, window_icon->iconInfo->height, window_icon->iconInfo->bpp, @@ -160,7 +160,7 @@ void rail_free(rdpRail* rail) { icon_cache_free(rail->cache); window_list_free(rail->list); - xfree(rail->clrconv); - xfree(rail); + free(rail->clrconv); + free(rail); } } diff --git a/libfreerdp/rail/window.c b/libfreerdp/rail/window.c index 5fae5aa7f..792bd6b62 100644 --- a/libfreerdp/rail/window.c +++ b/libfreerdp/rail/window.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RAIL Windows * * Copyright 2011 Marc-Andre Moreau @@ -34,70 +34,70 @@ struct _WINDOW_STYLE { - uint32 style; + UINT32 style; const char* name; - boolean multi; + BOOL multi; }; typedef struct _WINDOW_STYLE WINDOW_STYLE; static const WINDOW_STYLE WINDOW_STYLES[] = { - { WS_BORDER, "WS_BORDER", false }, - { WS_CAPTION, "WS_CAPTION", false }, - { WS_CHILD, "WS_CHILD", false }, - { WS_CLIPCHILDREN, "WS_CLIPCHILDREN", false }, - { WS_CLIPSIBLINGS, "WS_CLIPSIBLINGS", false }, - { WS_DISABLED, "WS_DISABLED", false }, - { WS_DLGFRAME, "WS_DLGFRAME", false }, - { WS_GROUP, "WS_GROUP", false }, - { WS_HSCROLL, "WS_HSCROLL", false }, - { WS_ICONIC, "WS_ICONIC", false }, - { WS_MAXIMIZE, "WS_MAXIMIZE", false }, - { WS_MAXIMIZEBOX, "WS_MAXIMIZEBOX", false }, - { WS_MINIMIZE, "WS_MINIMIZE", false }, - { WS_MINIMIZEBOX, "WS_MINIMIZEBOX", false }, - { WS_OVERLAPPED, "WS_OVERLAPPED", false }, - { WS_OVERLAPPEDWINDOW, "WS_OVERLAPPEDWINDOW", true }, - { WS_POPUP, "WS_POPUP", false }, - { WS_POPUPWINDOW, "WS_POPUPWINDOW", true }, - { WS_SIZEBOX, "WS_SIZEBOX", false }, - { WS_SYSMENU, "WS_SYSMENU", false }, - { WS_TABSTOP, "WS_TABSTOP", false }, - { WS_THICKFRAME, "WS_THICKFRAME", false }, - { WS_VISIBLE, "WS_VISIBLE", false } + { WS_BORDER, "WS_BORDER", FALSE }, + { WS_CAPTION, "WS_CAPTION", FALSE }, + { WS_CHILD, "WS_CHILD", FALSE }, + { WS_CLIPCHILDREN, "WS_CLIPCHILDREN", FALSE }, + { WS_CLIPSIBLINGS, "WS_CLIPSIBLINGS", FALSE }, + { WS_DISABLED, "WS_DISABLED", FALSE }, + { WS_DLGFRAME, "WS_DLGFRAME", FALSE }, + { WS_GROUP, "WS_GROUP", FALSE }, + { WS_HSCROLL, "WS_HSCROLL", FALSE }, + { WS_ICONIC, "WS_ICONIC", FALSE }, + { WS_MAXIMIZE, "WS_MAXIMIZE", FALSE }, + { WS_MAXIMIZEBOX, "WS_MAXIMIZEBOX", FALSE }, + { WS_MINIMIZE, "WS_MINIMIZE", FALSE }, + { WS_MINIMIZEBOX, "WS_MINIMIZEBOX", FALSE }, + { WS_OVERLAPPED, "WS_OVERLAPPED", FALSE }, + { WS_OVERLAPPEDWINDOW, "WS_OVERLAPPEDWINDOW", TRUE }, + { WS_POPUP, "WS_POPUP", FALSE }, + { WS_POPUPWINDOW, "WS_POPUPWINDOW", TRUE }, + { WS_SIZEBOX, "WS_SIZEBOX", FALSE }, + { WS_SYSMENU, "WS_SYSMENU", FALSE }, + { WS_TABSTOP, "WS_TABSTOP", FALSE }, + { WS_THICKFRAME, "WS_THICKFRAME", FALSE }, + { WS_VISIBLE, "WS_VISIBLE", FALSE } }; static const WINDOW_STYLE EXTENDED_WINDOW_STYLES[] = { - { WS_EX_ACCEPTFILES, "WS_EX_ACCEPTFILES", false }, - { WS_EX_APPWINDOW, "WS_EX_APPWINDOW", false }, - { WS_EX_CLIENTEDGE, "WS_EX_CLIENTEDGE", false }, - { WS_EX_COMPOSITED, "WS_EX_COMPOSITED", false }, - { WS_EX_CONTEXTHELP, "WS_EX_CONTEXTHELP", false }, - { WS_EX_CONTROLPARENT, "WS_EX_CONTROLPARENT", false }, - { WS_EX_DLGMODALFRAME, "WS_EX_DLGMODALFRAME", false }, - { WS_EX_LAYERED, "WS_EX_LAYERED", false }, - { WS_EX_LAYOUTRTL, "WS_EX_LAYOUTRTL", false }, - { WS_EX_LEFT, "WS_EX_LEFT", false }, - { WS_EX_LEFTSCROLLBAR, "WS_EX_LEFTSCROLLBAR", false }, - { WS_EX_LTRREADING, "WS_EX_LTRREADING", false }, - { WS_EX_MDICHILD, "WS_EX_MDICHILD", false }, - { WS_EX_NOACTIVATE, "WS_EX_NOACTIVATE", false }, - { WS_EX_NOINHERITLAYOUT, "WS_EX_NOINHERITLAYOUT", false }, - { WS_EX_NOPARENTNOTIFY, "WS_EX_NOPARENTNOTIFY", false }, - { WS_EX_OVERLAPPEDWINDOW, "WS_EX_OVERLAPPEDWINDOW", true }, - { WS_EX_PALETTEWINDOW, "WS_EX_PALETTEWINDOW", true }, - { WS_EX_RIGHT, "WS_EX_RIGHT", false }, - { WS_EX_RIGHTSCROLLBAR, "WS_EX_RIGHTSCROLLBAR", false }, - { WS_EX_RTLREADING, "WS_EX_RTLREADING", false }, - { WS_EX_STATICEDGE, "WS_EX_STATICEDGE", false }, - { WS_EX_TOOLWINDOW, "WS_EX_TOOLWINDOW", false }, - { WS_EX_TOPMOST, "WS_EX_TOPMOST", false }, - { WS_EX_TRANSPARENT, "WS_EX_TRANSPARENT", false }, - { WS_EX_WINDOWEDGE, "WS_EX_WINDOWEDGE", false } + { WS_EX_ACCEPTFILES, "WS_EX_ACCEPTFILES", FALSE }, + { WS_EX_APPWINDOW, "WS_EX_APPWINDOW", FALSE }, + { WS_EX_CLIENTEDGE, "WS_EX_CLIENTEDGE", FALSE }, + { WS_EX_COMPOSITED, "WS_EX_COMPOSITED", FALSE }, + { WS_EX_CONTEXTHELP, "WS_EX_CONTEXTHELP", FALSE }, + { WS_EX_CONTROLPARENT, "WS_EX_CONTROLPARENT", FALSE }, + { WS_EX_DLGMODALFRAME, "WS_EX_DLGMODALFRAME", FALSE }, + { WS_EX_LAYERED, "WS_EX_LAYERED", FALSE }, + { WS_EX_LAYOUTRTL, "WS_EX_LAYOUTRTL", FALSE }, + { WS_EX_LEFT, "WS_EX_LEFT", FALSE }, + { WS_EX_LEFTSCROLLBAR, "WS_EX_LEFTSCROLLBAR", FALSE }, + { WS_EX_LTRREADING, "WS_EX_LTRREADING", FALSE }, + { WS_EX_MDICHILD, "WS_EX_MDICHILD", FALSE }, + { WS_EX_NOACTIVATE, "WS_EX_NOACTIVATE", FALSE }, + { WS_EX_NOINHERITLAYOUT, "WS_EX_NOINHERITLAYOUT", FALSE }, + { WS_EX_NOPARENTNOTIFY, "WS_EX_NOPARENTNOTIFY", FALSE }, + { WS_EX_OVERLAPPEDWINDOW, "WS_EX_OVERLAPPEDWINDOW", TRUE }, + { WS_EX_PALETTEWINDOW, "WS_EX_PALETTEWINDOW", TRUE }, + { WS_EX_RIGHT, "WS_EX_RIGHT", FALSE }, + { WS_EX_RIGHTSCROLLBAR, "WS_EX_RIGHTSCROLLBAR", FALSE }, + { WS_EX_RTLREADING, "WS_EX_RTLREADING", FALSE }, + { WS_EX_STATICEDGE, "WS_EX_STATICEDGE", FALSE }, + { WS_EX_TOOLWINDOW, "WS_EX_TOOLWINDOW", FALSE }, + { WS_EX_TOPMOST, "WS_EX_TOPMOST", FALSE }, + { WS_EX_TRANSPARENT, "WS_EX_TRANSPARENT", FALSE }, + { WS_EX_WINDOWEDGE, "WS_EX_WINDOWEDGE", FALSE } }; -void print_window_styles(uint32 style) +void print_window_styles(UINT32 style) { int i; @@ -118,7 +118,7 @@ void print_window_styles(uint32 style) printf("}\n"); } -void print_extended_window_styles(uint32 style) +void print_extended_window_styles(UINT32 style) { int i; @@ -172,7 +172,7 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) { window->titleInfo.length = window_state->titleInfo.length; - window->titleInfo.string = xmalloc(window_state->titleInfo.length); + window->titleInfo.string = malloc(window_state->titleInfo.length); memcpy(window->titleInfo.string, window_state->titleInfo.string, window->titleInfo.length); #ifdef WITH_DEBUG_RAIL @@ -240,7 +240,7 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW int i; if (window->windowRects != NULL) - xfree(window->windowRects); + free(window->windowRects); window->windowRects = window_state->windowRects; window->numWindowRects = window_state->numWindowRects; @@ -267,7 +267,7 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW int i; if (window->visibilityRects != NULL) - xfree(window->visibilityRects); + free(window->visibilityRects); window->visibilityRects = window_state->visibilityRects; window->numVisibilityRects = window_state->numVisibilityRects; @@ -289,7 +289,7 @@ void rail_CreateWindow(rdpRail* rail, rdpWindow* window) } else { - window->title = (char*) xmalloc(sizeof("RAIL")); + window->title = (char*) malloc(sizeof("RAIL")); memcpy(window->title, "RAIL", sizeof("RAIL")); } @@ -325,7 +325,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window) if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE) { if (window->title != NULL) - xfree(window->title); + free(window->title); freerdp_UnicodeToAsciiAlloc((WCHAR*) window->titleInfo.string, &window->title, window->titleInfo.length / 2); @@ -385,6 +385,6 @@ void rail_DestroyWindow(rdpRail* rail, rdpWindow* window) if (window != NULL) { - xfree(window); + free(window); } } diff --git a/libfreerdp/rail/window_list.c b/libfreerdp/rail/window_list.c index 027c8e4c2..dc42f1d01 100644 --- a/libfreerdp/rail/window_list.c +++ b/libfreerdp/rail/window_list.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * RAIL Window List * * Copyright 2011 Marc-Andre Moreau @@ -33,15 +33,15 @@ void window_list_rewind(rdpWindowList* list) list->iterator = list->head; } -boolean window_list_has_next(rdpWindowList* list) +BOOL window_list_has_next(rdpWindowList* list) { if (list->iterator != NULL) { if (list->iterator != NULL) - return true; + return TRUE; } - return false; + return FALSE; } rdpWindow* window_list_get_next(rdpWindowList* list) @@ -77,7 +77,7 @@ rdpWindow* window_list_get_by_extra_id(rdpWindowList* list, void* extraId) return NULL; } -rdpWindow* window_list_get_by_id(rdpWindowList* list, uint32 windowId) +rdpWindow* window_list_get_by_id(rdpWindowList* list, UINT32 windowId) { rdpWindow* window; @@ -223,6 +223,6 @@ void window_list_free(rdpWindowList* list) { if (list != NULL) { - xfree(list); + free(list); } } diff --git a/libfreerdp/utils/CMakeLists.txt b/libfreerdp/utils/CMakeLists.txt index f6138f099..34e11f72e 100644 --- a/libfreerdp/utils/CMakeLists.txt +++ b/libfreerdp/utils/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # libfreerdp-utils cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -52,7 +52,7 @@ if(NOT WIN32) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} msusb.c) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -72,18 +72,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES SunOS) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} rt) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() - if(NOT WIN32) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-crt) - endif() - - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-synch) - + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-crt winpr-synch) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP") +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") diff --git a/libfreerdp/utils/args.c b/libfreerdp/utils/args.c index 503af4286..9d90df9f7 100644 --- a/libfreerdp/utils/args.c +++ b/libfreerdp/utils/args.c @@ -1,5 +1,5 @@ /* - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Arguments Parsing * * Copyright 2009-2011 Jay Sorg @@ -26,6 +26,8 @@ #include #include +#include + #ifdef _WIN32 #include #define isatty _isatty @@ -51,7 +53,7 @@ void freerdp_parse_hostname(rdpSettings* settings, char* hostname) && (p[1] == 0 || (p[1] == ':' && !strchr(p + 2, ':')))) { /* Either "[...]" or "[...]:..." with at most one : after the brackets */ - settings->hostname = xstrdup(hostname + 1); + settings->hostname = _strdup(hostname + 1); if ((p = strchr((char*)settings->hostname, ']'))) { @@ -64,7 +66,7 @@ void freerdp_parse_hostname(rdpSettings* settings, char* hostname) else { /* Port number is cut off and used if exactly one : in the string */ - settings->hostname = xstrdup(hostname); + settings->hostname = _strdup(hostname); if ((p = strchr((char*)settings->hostname, ':')) && !strchr(p + 1, ':')) { @@ -185,7 +187,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing username\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->username = xstrdup(argv[index]); + settings->username = _strdup(argv[index]); } else if (strcmp("-p", argv[index]) == 0) { @@ -195,7 +197,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing password\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->password = xstrdup(argv[index]); + settings->password = _strdup(argv[index]); settings->autologon = 1; /* @@ -213,7 +215,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing domain\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->domain = xstrdup(argv[index]); + settings->domain = _strdup(argv[index]); } else if (strcmp("-s", argv[index]) == 0) { @@ -223,7 +225,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing shell\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->shell = xstrdup(argv[index]); + settings->shell = _strdup(argv[index]); } else if (strcmp("-c", argv[index]) == 0) { @@ -233,7 +235,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing directory\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->directory = xstrdup(argv[index]); + settings->directory = _strdup(argv[index]); } else if (strcmp("-g", argv[index]) == 0) { @@ -246,15 +248,15 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, if (strncmp("workarea", argv[index], 1) == 0) { - settings->workarea = true; + settings->workarea = TRUE; } else { - settings->width = (uint16) strtol(argv[index], &p, 10); + settings->width = (UINT16) strtol(argv[index], &p, 10); if (*p == 'x') { - settings->height = (uint16) strtol(p + 1, &p, 10); + settings->height = (UINT16) strtol(p + 1, &p, 10); } if (*p == '%') { @@ -274,11 +276,11 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("-f", argv[index]) == 0) { - settings->fullscreen = true; + settings->fullscreen = TRUE; } else if (strcmp("-D", argv[index]) == 0) { - settings->decorations = false; + settings->decorations = FALSE; } else if (strcmp("-T", argv[index]) == 0) { @@ -289,7 +291,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, return FREERDP_ARGS_PARSE_FAILURE; } - settings->window_title = xstrdup(argv[index]); + settings->window_title = _strdup(argv[index]); } else if (strcmp("-t", argv[index]) == 0) { @@ -313,7 +315,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("-K", argv[index]) == 0) { - settings->grab_keyboard = false; + settings->grab_keyboard = FALSE; } else if (strcmp("-n", argv[index]) == 0) { @@ -328,15 +330,15 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("-o", argv[index]) == 0) { - settings->console_audio = true; + settings->console_audio = TRUE; } else if (strcmp("-0", argv[index]) == 0) { - settings->console_session = true; + settings->console_session = TRUE; } else if (strcmp("-z", argv[index]) == 0) { - settings->compression = true; + settings->compression = TRUE; } else if (strcmp("--ntlm", argv[index]) == 0) { @@ -349,31 +351,31 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("--no-glyph-cache", argv[index]) == 0) { - settings->glyph_cache = false; + settings->glyph_cache = FALSE; } else if (strcmp("--no-osb", argv[index]) == 0) { - settings->offscreen_bitmap_cache = false; + settings->offscreen_bitmap_cache = FALSE; } else if (strcmp("--no-bmp-cache", argv[index]) == 0) { - settings->bitmap_cache = false; + settings->bitmap_cache = FALSE; } else if (strcmp("--no-auth", argv[index]) == 0) { - settings->authentication = false; + settings->authentication = FALSE; } else if (strcmp("--authonly", argv[index]) == 0) { - settings->authentication_only = true; + settings->authentication_only = TRUE; } else if (strcmp("--from-stdin", argv[index]) == 0) { - settings->from_stdin = true; + settings->from_stdin = TRUE; } else if (strcmp("--ignore-certificate", argv[index]) == 0) { - settings->ignore_certificate = true; + settings->ignore_certificate = TRUE; } else if (strcmp("--certificate-name", argv[index]) == 0) { @@ -384,12 +386,12 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, return FREERDP_ARGS_PARSE_FAILURE; } - settings->certificate_name = xstrdup(argv[index]); + settings->certificate_name = _strdup(argv[index]); } else if (strcmp("--no-fastpath", argv[index]) == 0) { - settings->fastpath_input = false; - settings->fastpath_output = false; + settings->fastpath_input = FALSE; + settings->fastpath_output = FALSE; } else if (strcmp("--gdi", argv[index]) == 0) { @@ -401,11 +403,11 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } if (strncmp("sw", argv[index], 1) == 0) /* software */ { - settings->sw_gdi = true; + settings->sw_gdi = TRUE; } else if (strncmp("hw", argv[index], 1) == 0) /* hardware */ { - settings->sw_gdi = false; + settings->sw_gdi = FALSE; } else { @@ -421,25 +423,25 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing codec name\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->bitmap_cache_v3 = true; + settings->bitmap_cache_v3 = TRUE; if (strcmp("rfx", argv[index]) == 0) { printf("setting rfx\n"); settings->v3_codec_id = CODEC_ID_REMOTEFX; - settings->rfx_codec = true; + settings->rfx_codec = TRUE; } else if (strcmp("nsc", argv[index]) == 0) { printf("setting codec nsc\n"); settings->v3_codec_id = CODEC_ID_NSCODEC; - settings->ns_codec = true; + settings->ns_codec = TRUE; } #ifdef WITH_JPEG else if (strcmp("jpeg", argv[index]) == 0) { printf("setting codec jpeg\n"); settings->v3_codec_id = CODEC_ID_JPEG; - settings->jpeg_codec = true; + settings->jpeg_codec = TRUE; if (settings->jpeg_quality == 0) settings->jpeg_quality = 75; } @@ -453,7 +455,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, #ifdef WITH_JPEG else if (strcmp("--jpeg", argv[index]) == 0) { - settings->jpeg_codec = true; + settings->jpeg_codec = TRUE; settings->jpeg_quality = 75; } else if (strcmp("--jpegex", argv[index]) == 0) @@ -464,17 +466,17 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing codec name\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->jpeg_codec = true; + settings->jpeg_codec = TRUE; settings->jpeg_quality = atoi(argv[index]); } #endif else if (strcmp("--rfx", argv[index]) == 0) { - settings->rfx_codec = true; - settings->fastpath_output = true; + settings->rfx_codec = TRUE; + settings->fastpath_output = TRUE; settings->color_depth = 32; settings->performance_flags = PERF_FLAG_NONE; - settings->large_pointer = true; + settings->large_pointer = TRUE; } else if (strcmp("--rfx-mode", argv[index]) == 0) { @@ -510,7 +512,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("--nsc", argv[index]) == 0) { - settings->ns_codec = true; + settings->ns_codec = TRUE; } else if (strcmp("--dump-rfx", argv[index]) == 0) { @@ -520,9 +522,9 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing file name\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->dump_rfx_file = xstrdup(argv[index]); - settings->dump_rfx = true; - settings->rfx_codec_only = true; + settings->dump_rfx_file = _strdup(argv[index]); + settings->dump_rfx = TRUE; + settings->rfx_codec_only = TRUE; } else if (strcmp("--play-rfx", argv[index]) == 0) { @@ -532,42 +534,42 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing file name\n"); return FREERDP_ARGS_PARSE_FAILURE; } - settings->play_rfx_file = xstrdup(argv[index]); - settings->play_rfx = true; + settings->play_rfx_file = _strdup(argv[index]); + settings->play_rfx = TRUE; } else if (strcmp("--fonts", argv[index]) == 0) { - settings->smooth_fonts = true; + settings->smooth_fonts = TRUE; } else if (strcmp("--disable-wallpaper", argv[index]) == 0) { - settings->disable_wallpaper = true; + settings->disable_wallpaper = TRUE; } else if (strcmp("--disable-full-window-drag", argv[index]) == 0) { - settings->disable_full_window_drag = true; + settings->disable_full_window_drag = TRUE; } else if (strcmp("--disable-menu-animations", argv[index]) == 0) { - settings->disable_menu_animations = true; + settings->disable_menu_animations = TRUE; } else if (strcmp("--disable-theming", argv[index]) == 0) { - settings->disable_theming = true; + settings->disable_theming = TRUE; } else if (strcmp("--composition", argv[index]) == 0) { - settings->desktop_composition = true; + settings->desktop_composition = TRUE; } else if (strcmp("--no-motion", argv[index]) == 0) { - settings->mouse_motion = false; + settings->mouse_motion = FALSE; } else if (strcmp("--app", argv[index]) == 0) { - settings->remote_app = true; - settings->rail_langbar_supported = true; - settings->workarea = true; + settings->remote_app = TRUE; + settings->rail_langbar_supported = TRUE; + settings->workarea = TRUE; settings->performance_flags = PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG; } else if (strcmp("-x", argv[index]) == 0) @@ -621,15 +623,15 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("--no-rdp", argv[index]) == 0) { - settings->rdp_security = false; + settings->rdp_security = FALSE; } else if (strcmp("--no-tls", argv[index]) == 0) { - settings->tls_security = false; + settings->tls_security = FALSE; } else if (strcmp("--no-nla", argv[index]) == 0) { - settings->nla_security = false; + settings->nla_security = FALSE; } else if (strcmp("--sec", argv[index]) == 0) { @@ -641,24 +643,24 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } if (strncmp("rdp", argv[index], 1) == 0) /* Standard RDP */ { - settings->rdp_security = true; - settings->tls_security = false; - settings->nla_security = false; - settings->encryption = true; + settings->rdp_security = TRUE; + settings->tls_security = FALSE; + settings->nla_security = FALSE; + settings->encryption = TRUE; settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS; settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; } else if (strncmp("tls", argv[index], 1) == 0) /* TLS */ { - settings->rdp_security = false; - settings->tls_security = true; - settings->nla_security = false; + settings->rdp_security = FALSE; + settings->tls_security = TRUE; + settings->nla_security = FALSE; } else if (strncmp("nla", argv[index], 1) == 0) /* NLA */ { - settings->rdp_security = false; - settings->tls_security = false; - settings->nla_security = true; + settings->rdp_security = FALSE; + settings->tls_security = FALSE; + settings->nla_security = TRUE; } else { @@ -668,32 +670,32 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("--no-nego", argv[index]) == 0) { - settings->security_layer_negotiation = false; + settings->security_layer_negotiation = FALSE; } else if (strcmp("--tsg", argv[index]) == 0) { - settings->ts_gateway = true; + settings->ts_gateway = TRUE; index++; if (index == argc) { printf("missing TSG username\n"); return -1; } - settings->tsg_username = xstrdup(argv[index]); + settings->tsg_username = _strdup(argv[index]); index++; if (index == argc) { printf("missing TSG password\n"); return -1; } - settings->tsg_password = xstrdup(argv[index]); + settings->tsg_password = _strdup(argv[index]); index++; if (index == argc) { printf("missing TSG server\n"); return -1; } - settings->tsg_hostname = xstrdup(argv[index]); + settings->tsg_hostname = _strdup(argv[index]); } else if (strcmp("--plugin", argv[index]) == 0) { @@ -706,7 +708,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } plugin_data = NULL; if (strstr(argv[t], "rdpsnd")) - settings->audio_playback = true; + settings->audio_playback = TRUE; if (index < argc - 1 && strcmp("--data", argv[index + 1]) == 0) { index += 2; @@ -714,12 +716,12 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, while (index < argc && strcmp("--", argv[index]) != 0) { if (plugin_data == NULL) - plugin_data = (RDP_PLUGIN_DATA*) xmalloc(sizeof(RDP_PLUGIN_DATA) * (i + 2)); + plugin_data = (RDP_PLUGIN_DATA*) malloc(sizeof(RDP_PLUGIN_DATA) * (i + 2)); else - plugin_data = (RDP_PLUGIN_DATA*) xrealloc(plugin_data, sizeof(RDP_PLUGIN_DATA) * (i + 2)); + plugin_data = (RDP_PLUGIN_DATA*) realloc(plugin_data, sizeof(RDP_PLUGIN_DATA) * (i + 2)); if (strstr(argv[t], "drdynvc") && strstr(argv[index], "audin")) - settings->audio_capture = true; + settings->audio_capture = TRUE; plugin_data[i].size = sizeof(RDP_PLUGIN_DATA); plugin_data[i].data[0] = NULL; @@ -787,7 +789,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } else if (strcmp("--no-salted-checksum", argv[index]) == 0) { - settings->salted_checksum = false; + settings->salted_checksum = FALSE; } else if (strcmp("--pcid", argv[index]) == 0) { @@ -797,7 +799,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing preconnection id value\n"); return -1; } - settings->send_preconnection_pdu = true; + settings->send_preconnection_pdu = TRUE; settings->preconnection_id = atoi(argv[index]); } else if (strcmp("--pcb", argv[index]) == 0) @@ -808,8 +810,8 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, printf("missing preconnection blob value\n"); return -1; } - settings->send_preconnection_pdu = true; - settings->preconnection_blob = xstrdup(argv[index]); + settings->send_preconnection_pdu = TRUE; + settings->preconnection_blob = _strdup(argv[index]); } else if (strcmp("--version", argv[index]) == 0) { @@ -874,12 +876,12 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, input[0] = '\0'; printf("username: "); if (scanf("%511s", input) > 0) { - settings->username = xstrdup(input); + settings->username = _strdup(input); } } /* password */ if (NULL == settings->password) { - settings->password = xmalloc(512 * sizeof(char)); + settings->password = malloc(512 * sizeof(char)); if (isatty(STDIN_FILENO)) freerdp_passphrase_read("password: ", settings->password, 512, settings->from_stdin); else { @@ -899,7 +901,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, /* Try to catch the cases where the string is NULL-ish right at the get go */ if (input[0] != '\0' && !(input[0] == '.' && input[1] == '\0')) { - settings->domain = xstrdup(input); + settings->domain = _strdup(input); } } } diff --git a/libfreerdp/utils/bitmap.c b/libfreerdp/utils/bitmap.c index c9aee3a64..65004c2a7 100644 --- a/libfreerdp/utils/bitmap.c +++ b/libfreerdp/utils/bitmap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Bitmap File Format Utils * * Copyright 2011 Marc-Andre Moreau @@ -30,30 +30,30 @@ typedef struct { - uint8 magic[2]; + BYTE magic[2]; } BITMAP_MAGIC; typedef struct { - uint32 filesz; - uint16 creator1; - uint16 creator2; - uint32 bmp_offset; + UINT32 filesz; + UINT16 creator1; + UINT16 creator2; + UINT32 bmp_offset; } BITMAP_CORE_HEADER; typedef struct { - uint32 header_sz; - sint32 width; - sint32 height; - uint16 nplanes; - uint16 bitspp; - uint32 compress_type; - uint32 bmp_bytesz; - sint32 hres; - sint32 vres; - uint32 ncolors; - uint32 nimpcolors; + UINT32 header_sz; + INT32 width; + INT32 height; + UINT16 nplanes; + UINT16 bitspp; + UINT32 compress_type; + UINT32 bmp_bytesz; + INT32 hres; + INT32 vres; + UINT32 ncolors; + UINT32 nimpcolors; } BITMAP_INFO_HEADER; void freerdp_bitmap_write(char* filename, void* data, int width, int height, int bpp) diff --git a/libfreerdp/utils/dsp.c b/libfreerdp/utils/dsp.c index c89c900cf..189efc510 100644 --- a/libfreerdp/utils/dsp.c +++ b/libfreerdp/utils/dsp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Digital Sound Processing * * Copyright 2010-2011 Vic Lee @@ -30,12 +30,12 @@ #include static void freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, - const uint8* src, int bytes_per_sample, - uint32 schan, uint32 srate, int sframes, - uint32 rchan, uint32 rrate) + const BYTE* src, int bytes_per_sample, + UINT32 schan, UINT32 srate, int sframes, + UINT32 rchan, UINT32 rrate) { - uint8* dst; - uint8* p; + BYTE* dst; + BYTE* p; int rframes; int rsize; int i, j; @@ -50,7 +50,7 @@ static void freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, if (rsize > (int) context->resampled_maxlength) { context->resampled_maxlength = rsize + 1024; - context->resampled_buffer = (uint8*) xrealloc(context->resampled_buffer, context->resampled_maxlength); + context->resampled_buffer = (BYTE*) realloc(context->resampled_buffer, context->resampled_maxlength); } dst = context->resampled_buffer; @@ -81,13 +81,13 @@ static void freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, * http://wiki.multimedia.cx/index.php?title=IMA_ADPCM */ -static const sint16 ima_step_index_table[] = +static const INT16 ima_step_index_table[] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8 }; -static const sint16 ima_step_size_table[] = +static const INT16 ima_step_size_table[] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, @@ -100,11 +100,11 @@ static const sint16 ima_step_size_table[] = 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; -static uint16 dsp_decode_ima_adpcm_sample(ADPCM* adpcm, - int channel, uint8 sample) +static UINT16 dsp_decode_ima_adpcm_sample(ADPCM* adpcm, + int channel, BYTE sample) { - sint32 ss; - sint32 d; + INT32 ss; + INT32 d; ss = ima_step_size_table[adpcm->ima.last_step[channel]]; d = (ss >> 3); @@ -123,7 +123,7 @@ static uint16 dsp_decode_ima_adpcm_sample(ADPCM* adpcm, else if (d > 32767) d = 32767; - adpcm->ima.last_sample[channel] = (sint16) d; + adpcm->ima.last_sample[channel] = (INT16) d; adpcm->ima.last_step[channel] += ima_step_index_table[sample]; if (adpcm->ima.last_step[channel] < 0) @@ -131,16 +131,16 @@ static uint16 dsp_decode_ima_adpcm_sample(ADPCM* adpcm, else if (adpcm->ima.last_step[channel] > 88) adpcm->ima.last_step[channel] = 88; - return (uint16) d; + return (UINT16) d; } static void freerdp_dsp_decode_ima_adpcm(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size) + const BYTE* src, int size, int channels, int block_size) { - uint8* dst; - uint8 sample; - uint16 decoded; - uint32 out_size; + BYTE* dst; + BYTE sample; + UINT16 decoded; + UINT32 out_size; int channel; int i; @@ -148,22 +148,22 @@ static void freerdp_dsp_decode_ima_adpcm(FREERDP_DSP_CONTEXT* context, if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; while (size > 0) { if (size % block_size == 0) { - context->adpcm.ima.last_sample[0] = (sint16) (((uint16)(*src)) | (((uint16)(*(src + 1))) << 8)); - context->adpcm.ima.last_step[0] = (sint16) (*(src + 2)); + context->adpcm.ima.last_sample[0] = (INT16) (((UINT16)(*src)) | (((UINT16)(*(src + 1))) << 8)); + context->adpcm.ima.last_step[0] = (INT16) (*(src + 2)); src += 4; size -= 4; out_size -= 16; if (channels > 1) { - context->adpcm.ima.last_sample[1] = (sint16) (((uint16)(*src)) | (((uint16)(*(src + 1))) << 8)); - context->adpcm.ima.last_step[1] = (sint16) (*(src + 2)); + context->adpcm.ima.last_sample[1] = (INT16) (((UINT16)(*src)) | (((UINT16)(*(src + 1))) << 8)); + context->adpcm.ima.last_step[1] = (INT16) (*(src + 2)); src += 4; size -= 4; out_size -= 16; @@ -215,8 +215,8 @@ static void freerdp_dsp_decode_ima_adpcm(FREERDP_DSP_CONTEXT* context, */ static const struct { - uint8 byte_num; - uint8 byte_shift; + BYTE byte_num; + BYTE byte_shift; } ima_stereo_encode_map[] = { { 0, 0 }, @@ -237,14 +237,14 @@ static const struct { 7, 4 } }; -static uint8 dsp_encode_ima_adpcm_sample(ADPCM* adpcm, - int channel, sint16 sample) +static BYTE dsp_encode_ima_adpcm_sample(ADPCM* adpcm, + int channel, INT16 sample) { - sint32 e; - sint32 d; - sint32 ss; - uint8 enc; - sint32 diff; + INT32 e; + INT32 d; + INT32 ss; + BYTE enc; + INT32 diff; ss = ima_step_size_table[adpcm->ima.last_step[channel]]; d = e = sample - adpcm->ima.last_sample[channel]; @@ -283,7 +283,7 @@ static uint8 dsp_encode_ima_adpcm_sample(ADPCM* adpcm, diff = -32768; else if (diff > 32767) diff = 32767; - adpcm->ima.last_sample[channel] = (sint16) diff; + adpcm->ima.last_sample[channel] = (INT16) diff; adpcm->ima.last_step[channel] += ima_step_index_table[enc]; if (adpcm->ima.last_step[channel] < 0) @@ -295,19 +295,19 @@ static uint8 dsp_encode_ima_adpcm_sample(ADPCM* adpcm, } static void freerdp_dsp_encode_ima_adpcm(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size) + const BYTE* src, int size, int channels, int block_size) { - uint8* dst; - sint16 sample; - uint8 encoded; - uint32 out_size; + BYTE* dst; + INT16 sample; + BYTE encoded; + UINT32 out_size; int i; out_size = size / 2; if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; while (size > 0) @@ -316,13 +316,13 @@ static void freerdp_dsp_encode_ima_adpcm(FREERDP_DSP_CONTEXT* context, { *dst++ = context->adpcm.ima.last_sample[0] & 0xff; *dst++ = (context->adpcm.ima.last_sample[0] >> 8) & 0xff; - *dst++ = (uint8) context->adpcm.ima.last_step[0]; + *dst++ = (BYTE) context->adpcm.ima.last_step[0]; *dst++ = 0; if (channels > 1) { *dst++ = context->adpcm.ima.last_sample[1] & 0xff; *dst++ = (context->adpcm.ima.last_sample[1] >> 8) & 0xff; - *dst++ = (uint8) context->adpcm.ima.last_step[1]; + *dst++ = (BYTE) context->adpcm.ima.last_step[1]; *dst++ = 0; } } @@ -332,7 +332,7 @@ static void freerdp_dsp_encode_ima_adpcm(FREERDP_DSP_CONTEXT* context, memset(dst, 0, 8); for (i = 0; i < 16; i++) { - sample = (sint16) (((uint16)(*src)) | (((uint16)(*(src + 1))) << 8)); + sample = (INT16) (((UINT16)(*src)) | (((UINT16)(*(src + 1))) << 8)); src += 2; encoded = dsp_encode_ima_adpcm_sample(&context->adpcm, i % 2, sample); dst[ima_stereo_encode_map[i].byte_num] |= encoded << ima_stereo_encode_map[i].byte_shift; @@ -342,10 +342,10 @@ static void freerdp_dsp_encode_ima_adpcm(FREERDP_DSP_CONTEXT* context, } else { - sample = (sint16) (((uint16)(*src)) | (((uint16)(*(src + 1))) << 8)); + sample = (INT16) (((UINT16)(*src)) | (((UINT16)(*(src + 1))) << 8)); src += 2; encoded = dsp_encode_ima_adpcm_sample(&context->adpcm, 0, sample); - sample = (sint16) (((uint16)(*src)) | (((uint16)(*(src + 1))) << 8)); + sample = (INT16) (((UINT16)(*src)) | (((UINT16)(*(src + 1))) << 8)); src += 2; encoded |= dsp_encode_ima_adpcm_sample(&context->adpcm, 0, sample) << 4; *dst++ = encoded; @@ -362,28 +362,28 @@ static void freerdp_dsp_encode_ima_adpcm(FREERDP_DSP_CONTEXT* context, * http://wiki.multimedia.cx/index.php?title=Microsoft_ADPCM */ -static const sint16 ms_adpcm_adaptation_table[] = +static const INT16 ms_adpcm_adaptation_table[] = { 230, 230, 230, 230, 307, 409, 512, 614, 768, 614, 512, 409, 307, 230, 230, 230 }; -static const sint16 ms_adpcm_coeff1_table[] = +static const INT16 ms_adpcm_coeff1_table[] = { 256, 512, 0, 192, 240, 460, 392 }; -static const sint16 ms_adpcm_coeff2_table[] = +static const INT16 ms_adpcm_coeff2_table[] = { 0, -256, 0, 64, 0, -208, -232 }; -static sint16 freerdp_dsp_decode_ms_adpcm_sample(ADPCM* adpcm, uint8 sample, int channel) +static INT16 freerdp_dsp_decode_ms_adpcm_sample(ADPCM* adpcm, BYTE sample, int channel) { - sint8 nibble; - sint32 presample; + INT8 nibble; + INT32 presample; - nibble = (sample & 0x08 ? (sint8)sample - 16 : sample); + nibble = (sample & 0x08 ? (INT8)sample - 16 : sample); presample = ((adpcm->ms.sample1[channel] * ms_adpcm_coeff1_table[adpcm->ms.predictor[channel]]) + (adpcm->ms.sample2[channel] * ms_adpcm_coeff2_table[adpcm->ms.predictor[channel]])) / 256; presample += nibble * adpcm->ms.delta[channel]; @@ -396,21 +396,21 @@ static sint16 freerdp_dsp_decode_ms_adpcm_sample(ADPCM* adpcm, uint8 sample, int adpcm->ms.delta[channel] = adpcm->ms.delta[channel] * ms_adpcm_adaptation_table[sample] / 256; if (adpcm->ms.delta[channel] < 16) adpcm->ms.delta[channel] = 16; - return (sint16) presample; + return (INT16) presample; } static void freerdp_dsp_decode_ms_adpcm(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size) + const BYTE* src, int size, int channels, int block_size) { - uint8* dst; - uint8 sample; - uint32 out_size; + BYTE* dst; + BYTE sample; + UINT32 out_size; out_size = size * 4; if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; while (size > 0) @@ -421,43 +421,43 @@ static void freerdp_dsp_decode_ms_adpcm(FREERDP_DSP_CONTEXT* context, { context->adpcm.ms.predictor[0] = *src++; context->adpcm.ms.predictor[1] = *src++; - context->adpcm.ms.delta[0] = *((sint16*)src); + context->adpcm.ms.delta[0] = *((INT16*)src); src += 2; - context->adpcm.ms.delta[1] = *((sint16*)src); + context->adpcm.ms.delta[1] = *((INT16*)src); src += 2; - context->adpcm.ms.sample1[0] = *((sint16*)src); + context->adpcm.ms.sample1[0] = *((INT16*)src); src += 2; - context->adpcm.ms.sample1[1] = *((sint16*)src); + context->adpcm.ms.sample1[1] = *((INT16*)src); src += 2; - context->adpcm.ms.sample2[0] = *((sint16*)src); + context->adpcm.ms.sample2[0] = *((INT16*)src); src += 2; - context->adpcm.ms.sample2[1] = *((sint16*)src); + context->adpcm.ms.sample2[1] = *((INT16*)src); src += 2; size -= 14; - *((sint16*)dst) = context->adpcm.ms.sample2[0]; + *((INT16*)dst) = context->adpcm.ms.sample2[0]; dst += 2; - *((sint16*)dst) = context->adpcm.ms.sample2[1]; + *((INT16*)dst) = context->adpcm.ms.sample2[1]; dst += 2; - *((sint16*)dst) = context->adpcm.ms.sample1[0]; + *((INT16*)dst) = context->adpcm.ms.sample1[0]; dst += 2; - *((sint16*)dst) = context->adpcm.ms.sample1[1]; + *((INT16*)dst) = context->adpcm.ms.sample1[1]; dst += 2; } else { context->adpcm.ms.predictor[0] = *src++; - context->adpcm.ms.delta[0] = *((sint16*)src); + context->adpcm.ms.delta[0] = *((INT16*)src); src += 2; - context->adpcm.ms.sample1[0] = *((sint16*)src); + context->adpcm.ms.sample1[0] = *((INT16*)src); src += 2; - context->adpcm.ms.sample2[0] = *((sint16*)src); + context->adpcm.ms.sample2[0] = *((INT16*)src); src += 2; size -= 7; - *((sint16*)dst) = context->adpcm.ms.sample2[0]; + *((INT16*)dst) = context->adpcm.ms.sample2[0]; dst += 2; - *((sint16*)dst) = context->adpcm.ms.sample1[0]; + *((INT16*)dst) = context->adpcm.ms.sample1[0]; dst += 2; } } @@ -466,25 +466,25 @@ static void freerdp_dsp_decode_ms_adpcm(FREERDP_DSP_CONTEXT* context, { sample = *src++; size--; - *((sint16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample >> 4, 0); + *((INT16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample >> 4, 0); dst += 2; - *((sint16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample & 0x0F, 1); + *((INT16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample & 0x0F, 1); dst += 2; sample = *src++; size--; - *((sint16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample >> 4, 0); + *((INT16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample >> 4, 0); dst += 2; - *((sint16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample & 0x0F, 1); + *((INT16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample & 0x0F, 1); dst += 2; } else { sample = *src++; size--; - *((sint16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample >> 4, 0); + *((INT16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample >> 4, 0); dst += 2; - *((sint16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample & 0x0F, 0); + *((INT16*)dst) = freerdp_dsp_decode_ms_adpcm_sample(&context->adpcm, sample & 0x0F, 0); dst += 2; } } @@ -492,10 +492,10 @@ static void freerdp_dsp_decode_ms_adpcm(FREERDP_DSP_CONTEXT* context, context->adpcm_size = dst - context->adpcm_buffer; } -static uint8 freerdp_dsp_encode_ms_adpcm_sample(ADPCM* adpcm, sint32 sample, int channel) +static BYTE freerdp_dsp_encode_ms_adpcm_sample(ADPCM* adpcm, INT32 sample, int channel) { - sint32 presample; - sint32 errordelta; + INT32 presample; + INT32 errordelta; presample = ((adpcm->ms.sample1[channel] * ms_adpcm_coeff1_table[adpcm->ms.predictor[channel]]) + (adpcm->ms.sample2[channel] * ms_adpcm_coeff2_table[adpcm->ms.predictor[channel]])) / 256; @@ -513,24 +513,24 @@ static uint8 freerdp_dsp_encode_ms_adpcm_sample(ADPCM* adpcm, sint32 sample, int presample = -32768; adpcm->ms.sample2[channel] = adpcm->ms.sample1[channel]; adpcm->ms.sample1[channel] = presample; - adpcm->ms.delta[channel] = adpcm->ms.delta[channel] * ms_adpcm_adaptation_table[(((uint8)errordelta) & 0x0F)] / 256; + adpcm->ms.delta[channel] = adpcm->ms.delta[channel] * ms_adpcm_adaptation_table[(((BYTE)errordelta) & 0x0F)] / 256; if (adpcm->ms.delta[channel] < 16) adpcm->ms.delta[channel] = 16; - return ((uint8)errordelta) & 0x0F; + return ((BYTE)errordelta) & 0x0F; } static void freerdp_dsp_encode_ms_adpcm(FREERDP_DSP_CONTEXT* context, - const uint8* src, int size, int channels, int block_size) + const BYTE* src, int size, int channels, int block_size) { - uint8* dst; - sint32 sample; - uint32 out_size; + BYTE* dst; + INT32 sample; + UINT32 out_size; out_size = size / 2; if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; @@ -547,18 +547,18 @@ static void freerdp_dsp_encode_ms_adpcm(FREERDP_DSP_CONTEXT* context, { *dst++ = context->adpcm.ms.predictor[0]; *dst++ = context->adpcm.ms.predictor[1]; - *dst++ = (uint8) (context->adpcm.ms.delta[0] & 0xff); - *dst++ = (uint8) ((context->adpcm.ms.delta[0] >> 8) & 0xff); - *dst++ = (uint8) (context->adpcm.ms.delta[1] & 0xff); - *dst++ = (uint8) ((context->adpcm.ms.delta[1] >> 8) & 0xff); - context->adpcm.ms.sample1[0] = *((sint16*) (src + 4)); - context->adpcm.ms.sample1[1] = *((sint16*) (src + 6)); - context->adpcm.ms.sample2[0] = *((sint16*) (src + 0)); - context->adpcm.ms.sample2[1] = *((sint16*) (src + 2)); - *((sint16*) (dst + 0)) = (sint16) context->adpcm.ms.sample1[0]; - *((sint16*) (dst + 2)) = (sint16) context->adpcm.ms.sample1[1]; - *((sint16*) (dst + 4)) = (sint16) context->adpcm.ms.sample2[0]; - *((sint16*) (dst + 6)) = (sint16) context->adpcm.ms.sample2[1]; + *dst++ = (BYTE) (context->adpcm.ms.delta[0] & 0xff); + *dst++ = (BYTE) ((context->adpcm.ms.delta[0] >> 8) & 0xff); + *dst++ = (BYTE) (context->adpcm.ms.delta[1] & 0xff); + *dst++ = (BYTE) ((context->adpcm.ms.delta[1] >> 8) & 0xff); + context->adpcm.ms.sample1[0] = *((INT16*) (src + 4)); + context->adpcm.ms.sample1[1] = *((INT16*) (src + 6)); + context->adpcm.ms.sample2[0] = *((INT16*) (src + 0)); + context->adpcm.ms.sample2[1] = *((INT16*) (src + 2)); + *((INT16*) (dst + 0)) = (INT16) context->adpcm.ms.sample1[0]; + *((INT16*) (dst + 2)) = (INT16) context->adpcm.ms.sample1[1]; + *((INT16*) (dst + 4)) = (INT16) context->adpcm.ms.sample2[0]; + *((INT16*) (dst + 6)) = (INT16) context->adpcm.ms.sample2[1]; dst += 8; src += 8; size -= 8; @@ -566,22 +566,22 @@ static void freerdp_dsp_encode_ms_adpcm(FREERDP_DSP_CONTEXT* context, else { *dst++ = context->adpcm.ms.predictor[0]; - *dst++ = (uint8) (context->adpcm.ms.delta[0] & 0xff); - *dst++ = (uint8) ((context->adpcm.ms.delta[0] >> 8) & 0xff); - context->adpcm.ms.sample1[0] = *((sint16*) (src + 2)); - context->adpcm.ms.sample2[0] = *((sint16*) (src + 0)); - *((sint16*) (dst + 0)) = (sint16) context->adpcm.ms.sample1[0]; - *((sint16*) (dst + 2)) = (sint16) context->adpcm.ms.sample2[0]; + *dst++ = (BYTE) (context->adpcm.ms.delta[0] & 0xff); + *dst++ = (BYTE) ((context->adpcm.ms.delta[0] >> 8) & 0xff); + context->adpcm.ms.sample1[0] = *((INT16*) (src + 2)); + context->adpcm.ms.sample2[0] = *((INT16*) (src + 0)); + *((INT16*) (dst + 0)) = (INT16) context->adpcm.ms.sample1[0]; + *((INT16*) (dst + 2)) = (INT16) context->adpcm.ms.sample2[0]; dst += 4; src += 4; size -= 4; } } - sample = *((sint16*) src); + sample = *((INT16*) src); src += 2; *dst = freerdp_dsp_encode_ms_adpcm_sample(&context->adpcm, sample, 0) << 4; - sample = *((sint16*) src); + sample = *((INT16*) src); src += 2; *dst += freerdp_dsp_encode_ms_adpcm_sample(&context->adpcm, sample, channels > 1 ? 1 : 0); dst++; @@ -611,9 +611,9 @@ void freerdp_dsp_context_free(FREERDP_DSP_CONTEXT* context) if (context) { if (context->resampled_buffer) - xfree(context->resampled_buffer); + free(context->resampled_buffer); if (context->adpcm_buffer) - xfree(context->adpcm_buffer); - xfree(context); + free(context->adpcm_buffer); + free(context); } } diff --git a/libfreerdp/utils/event.c b/libfreerdp/utils/event.c index f559b3f21..48ee7109b 100644 --- a/libfreerdp/utils/event.c +++ b/libfreerdp/utils/event.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Events * * Copyright 2011 Vic Lee @@ -27,11 +27,11 @@ #include #include -#include -#include +#include +#include #include -static RDP_EVENT* freerdp_cliprdr_event_new(uint16 event_type) +static RDP_EVENT* freerdp_cliprdr_event_new(UINT16 event_type) { RDP_EVENT* event = NULL; @@ -54,7 +54,7 @@ static RDP_EVENT* freerdp_cliprdr_event_new(uint16 event_type) return event; } -static RDP_EVENT* freerdp_tsmf_event_new(uint16 event_type) +static RDP_EVENT* freerdp_tsmf_event_new(UINT16 event_type) { RDP_EVENT* event = NULL; @@ -71,14 +71,14 @@ static RDP_EVENT* freerdp_tsmf_event_new(uint16 event_type) return event; } -static RDP_EVENT* freerdp_rail_event_new(uint16 event_type) +static RDP_EVENT* freerdp_rail_event_new(UINT16 event_type) { RDP_EVENT* event = NULL; event = xnew(RDP_EVENT); return event; } -RDP_EVENT* freerdp_event_new(uint16 event_class, uint16 event_type, +RDP_EVENT* freerdp_event_new(UINT16 event_class, UINT16 event_type, RDP_EVENT_CALLBACK on_event_free_callback, void* user_data) { RDP_EVENT* event = NULL; @@ -117,14 +117,14 @@ static void freerdp_cliprdr_event_free(RDP_EVENT* event) case RDP_EVENT_TYPE_CB_FORMAT_LIST: { RDP_CB_FORMAT_LIST_EVENT* cb_event = (RDP_CB_FORMAT_LIST_EVENT*)event; - xfree(cb_event->formats); - xfree(cb_event->raw_format_data); + free(cb_event->formats); + free(cb_event->raw_format_data); } break; case RDP_EVENT_TYPE_CB_DATA_RESPONSE: { RDP_CB_DATA_RESPONSE_EVENT* cb_event = (RDP_CB_DATA_RESPONSE_EVENT*)event; - xfree(cb_event->data); + free(cb_event->data); } break; } @@ -137,8 +137,8 @@ static void freerdp_tsmf_event_free(RDP_EVENT* event) case RDP_EVENT_TYPE_TSMF_VIDEO_FRAME: { RDP_VIDEO_FRAME_EVENT* vevent = (RDP_VIDEO_FRAME_EVENT*)event; - xfree(vevent->frame_data); - xfree(vevent->visible_rects); + free(vevent->frame_data); + free(vevent->visible_rects); } break; } @@ -167,6 +167,6 @@ void freerdp_event_free(RDP_EVENT* event) freerdp_rail_event_free(event); break; } - xfree(event); + free(event); } } diff --git a/libfreerdp/utils/file.c b/libfreerdp/utils/file.c index fa3e47ce8..4da37e791 100644 --- a/libfreerdp/utils/file.c +++ b/libfreerdp/utils/file.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * File Utils * * Copyright 2011 Marc-Andre Moreau @@ -26,6 +26,8 @@ #include #include +#include + #include #include #include @@ -72,14 +74,14 @@ void freerdp_mkdir(char* path) #endif } -boolean freerdp_check_file_exists(char* file) +BOOL freerdp_check_file_exists(char* file) { struct stat stat_info; if (stat(file, &stat_info) != 0) - return false; + return FALSE; - return true; + return TRUE; } char* freerdp_get_home_path(rdpSettings* settings) @@ -87,7 +89,7 @@ char* freerdp_get_home_path(rdpSettings* settings) if (settings->home_path == NULL) settings->home_path = getenv(HOME_ENV_VARIABLE); if (settings->home_path == NULL) - settings->home_path = xstrdup("/"); + settings->home_path = _strdup("/"); return settings->home_path; } @@ -97,7 +99,7 @@ char* freerdp_get_config_path(rdpSettings* settings) if (settings->config_path != NULL) return settings->config_path; - settings->config_path = (char*) xmalloc(strlen(settings->home_path) + sizeof(FREERDP_CONFIG_DIR) + 2); + settings->config_path = (char*) malloc(strlen(settings->home_path) + sizeof(FREERDP_CONFIG_DIR) + 2); sprintf(settings->config_path, "%s" PATH_SEPARATOR_STR "%s", settings->home_path, FREERDP_CONFIG_DIR); if (!freerdp_check_file_exists(settings->config_path)) @@ -125,7 +127,7 @@ char* freerdp_construct_path(char* base_path, char* relative_path) relative_path_length = strlen(relative_path); length = base_path_length + relative_path_length + 1; - path = xmalloc(length + 1); + path = malloc(length + 1); sprintf(path, "%s" PATH_SEPARATOR_STR "%s", base_path, relative_path); return path; @@ -150,17 +152,17 @@ char* freerdp_append_shared_library_suffix(char* file_path) if (strcmp(p, SHARED_LIB_SUFFIX) != 0) { - path = xmalloc(file_path_length + shared_lib_suffix_length + 1); + path = malloc(file_path_length + shared_lib_suffix_length + 1); sprintf(path, "%s%s", file_path, SHARED_LIB_SUFFIX); } else { - path = xstrdup(file_path); + path = _strdup(file_path); } } else { - path = xmalloc(file_path_length + shared_lib_suffix_length + 1); + path = malloc(file_path_length + shared_lib_suffix_length + 1); sprintf(path, "%s%s", file_path, SHARED_LIB_SUFFIX); } @@ -179,7 +181,7 @@ char* freerdp_get_parent_path(char* base_path, int depth) return NULL; if (depth <= 0) - return xstrdup(base_path); + return _strdup(base_path); base_length = strlen(base_path); @@ -196,47 +198,47 @@ char* freerdp_get_parent_path(char* base_path, int depth) length = (p - base_path); - path = (char*) xmalloc(length + 1); + path = (char*) malloc(length + 1); memcpy(path, base_path, length); path[length] = '\0'; return path; } -boolean freerdp_path_contains_separator(char* path) +BOOL freerdp_path_contains_separator(char* path) { if (path == NULL) - return false; + return FALSE; if (strchr(path, PATH_SEPARATOR_CHR) == NULL) - return false; + return FALSE; - return true; + return TRUE; } /* detects if we are running from the source tree */ -boolean freerdp_detect_development_mode(rdpSettings* settings) +BOOL freerdp_detect_development_mode(rdpSettings* settings) { int depth = 0; char* current_path; char* development_path = NULL; - boolean development_mode = false; + BOOL development_mode = FALSE; if (freerdp_check_file_exists(".git")) { depth = 0; - development_mode = true; + development_mode = TRUE; } else if (freerdp_check_file_exists(PARENT_PATH ".git")) { depth = 1; - development_mode = true; + development_mode = TRUE; } else if (freerdp_check_file_exists(PARENT_PATH PARENT_PATH ".git")) { depth = 2; - development_mode = true; + development_mode = TRUE; } current_path = freerdp_get_current_path(settings); diff --git a/libfreerdp/utils/hexdump.c b/libfreerdp/utils/hexdump.c index 665aeb000..0f20709e0 100644 --- a/libfreerdp/utils/hexdump.c +++ b/libfreerdp/utils/hexdump.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Hex Dump Utils * * Copyright 2011 Marc-Andre Moreau @@ -28,9 +28,9 @@ #include -void freerdp_hexdump(uint8* data, int length) +void freerdp_hexdump(BYTE* data, int length) { - uint8* p = data; + BYTE* p = data; int i, line, offset = 0; while (offset < length) diff --git a/libfreerdp/utils/list.c b/libfreerdp/utils/list.c index 265753ba6..89cb1f41d 100644 --- a/libfreerdp/utils/list.c +++ b/libfreerdp/utils/list.c @@ -1,5 +1,5 @@ /* - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Double-linked List Utils * * Copyright 2011 Vic Lee @@ -98,7 +98,7 @@ void list_free(LIST* list) { while (list->head) list_dequeue(list); - xfree(list); + free(list); } /** @@ -149,7 +149,7 @@ void* list_dequeue(LIST* list) list->head->prev = NULL; data = item->data; - xfree(item); + free(item); list->count--; } return data; @@ -221,7 +221,7 @@ void* list_remove(LIST* list, void* data) list->head = item->next; if (list->tail == item) list->tail = item->prev; - xfree(item); + free(item); list->count--; } else diff --git a/libfreerdp/utils/load_plugin.c b/libfreerdp/utils/load_plugin.c index 9b713bc76..be5b958e5 100644 --- a/libfreerdp/utils/load_plugin.c +++ b/libfreerdp/utils/load_plugin.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Plugin Loading Utils * * Copyright 2011 Vic Lee @@ -24,7 +24,10 @@ #include #include #include + +#include #include + #include #include #include @@ -48,108 +51,19 @@ #endif - #define MAX_STATIC_PLUGINS 50 struct static_plugin { - const char* name; - const char* entry_name; - void* entry_addr; + const char* name; + const char* entry_name; + void* entry_addr; }; typedef struct static_plugin staticPlugin; static staticPlugin g_static_plugins[MAX_STATIC_PLUGINS]; static int g_static_plugins_count; - -/** - * UNUSED - * This function opens a handle on the specified library in order to load symbols from it. - * It is just a wrapper over dlopen(), but provides some logs in case of error. - * - * The returned pointer can be used to load a symbol from the library, using the freerdp_get_library_symbol() call. - * The returned pointer should be closed using the freerdp_close_library() call. - * - * @see freerdp_get_library_symbol - * @see freerdp_close_library - * - * @param file [IN] - library name - * @return Pointer to the loaded library. NULL if an error occurs. - */ -void* freerdp_open_library(const char* file) -{ - void* library; - - library = DLOPEN(file); - - if (library == NULL) - { - printf("freerdp_load_library: failed to open %s: %s\n", file, DLERROR()); - return NULL; - } - - return library; -} - -/** - * UNUSED - * This function retrieves a pointer to the specified symbol from the given (loaded) library. - * It is a wrapper over the dlsym() function, but provides some logs in case of error. - * - * @see freerdp_open_library - * @see freerdp_close_library - * - * @param library [IN] - a valid pointer to the opened library. - * This pointer should come from a successful call to freerdp_open_library() - * @param name [IN] - name of the symbol that must be loaded - * - * @return A pointer to the loaded symbol. NULL if an error occured. - */ -void* freerdp_get_library_symbol(void* library, const char* name) -{ - void* symbol; - - symbol = DLSYM(library, name); - - if (symbol == NULL) - { - printf("freerdp_get_library_symbol: failed to load %s: %s\n", name, DLERROR()); - return NULL; - } - - return symbol; -} - -/** - * UNUSED - * This function closes a library handle that was previously opened by freerdp_open_library(). - * It is a wrapper over dlclose(), but provides logs in case of error. - * - * @see freerdp_open_library - * @see freerdp_get_library_symbol - * - * @return true if the close succeeded. false otherwise. - */ -boolean freerdp_close_library(void* library) -{ - int status; - - status = DLCLOSE(library); - -#ifdef _WIN32 - if (status != 0) -#else - if (status == 0) -#endif - { - printf("freerdp_free_library: failed to close: %s\n", DLERROR()); - return false; - } - - return true; -} - /** * This function will load the specified library, retrieve the specified symbol in it, and return a pointer to it. * It is used in freerdp_load_plugin() and freerdp_load_channel_plugin(). @@ -204,7 +118,9 @@ void* freerdp_load_plugin(const char* name, const char* entry_name) /* first attempt to load a static plugin */ entry = freerdp_load_static_plugin(name, entry_name); - if (entry != NULL) return entry; + + if (entry != NULL) + return entry; suffixed_name = freerdp_append_shared_library_suffix((char*) name); @@ -216,13 +132,13 @@ void* freerdp_load_plugin(const char* name, const char* entry_name) else { /* explicit path given, use it instead of default path */ - path = xstrdup(suffixed_name); + path = _strdup(suffixed_name); } entry = freerdp_load_library_symbol(path, entry_name); - xfree(suffixed_name); - xfree(path); + free(suffixed_name); + free(path); if (entry == NULL) { @@ -233,71 +149,6 @@ void* freerdp_load_plugin(const char* name, const char* entry_name) return entry; } -/** - * UNUSED - * This function was meant to be used to load channel plugins. - * It was initially called from freerdp_channels_load_plugin() but now we use the freerdp_load_plugin() function - * which is more generic. - * - */ -void* freerdp_load_channel_plugin(rdpSettings* settings, const char* name, const char* entry_name) -{ - char* path; - void* entry; - char* suffixed_name; - - suffixed_name = freerdp_append_shared_library_suffix((char*) name); - - if (!freerdp_path_contains_separator(suffixed_name)) - { - /* no explicit path given, use default path */ - - if (!settings->development_mode) - { - path = freerdp_construct_path(FREERDP_PLUGIN_PATH, suffixed_name); - } - else - { - char* dot; - char* plugin_name; - char* channels_path; - char* channel_subpath; - - dot = strrchr(suffixed_name, '.'); - plugin_name = xmalloc((dot - suffixed_name) + 1); - strncpy(plugin_name, suffixed_name, (dot - suffixed_name)); - plugin_name[(dot - suffixed_name)] = '\0'; - - channels_path = freerdp_construct_path(settings->development_path, "channels"); - channel_subpath = freerdp_construct_path(channels_path, plugin_name); - - path = freerdp_construct_path(channel_subpath, suffixed_name); - - xfree(plugin_name); - xfree(channels_path); - xfree(channel_subpath); - } - } - else - { - /* explicit path given, use it instead of default path */ - path = xstrdup(suffixed_name); - } - - entry = freerdp_load_library_symbol(path, entry_name); - - xfree(suffixed_name); - xfree(path); - - if (entry == NULL) - { - printf("freerdp_load_channel_plugin: failed to load %s/%s\n", name, entry_name); - return NULL; - } - - return entry; -} - /** * This function is used to register a static plugin so that it can be loaded later on using freerdp_load_plugin. * @@ -305,16 +156,16 @@ void* freerdp_load_channel_plugin(rdpSettings* settings, const char* name, const * @param entry_name [IN] - name of the symbol to register for later loading * @param entry [IN] - function pointer to the entry function * - * @return true on success, otherwise false. + * @return TRUE on success, otherwise FALSE. */ -boolean freerdp_register_static_plugin(const char* name, const char* entry_name, void* entry_addr) +BOOL freerdp_register_static_plugin(const char* name, const char* entry_name, void* entry_addr) { staticPlugin* plugin; if (g_static_plugins_count >= MAX_STATIC_PLUGINS) { printf("freerdp_register_static_plugin: cannot register %s/%s", name, entry_name); - return false; + return FALSE; } /* add the static plugin to the vector */ @@ -323,7 +174,7 @@ boolean freerdp_register_static_plugin(const char* name, const char* entry_name, plugin->entry_name = entry_name; plugin->entry_addr = entry_addr; - return true; + return TRUE; } /** @@ -334,11 +185,12 @@ boolean freerdp_register_static_plugin(const char* name, const char* entry_name, * * @return Pointer to the entry function, NULL if no matching plugin could be found */ + void* freerdp_load_static_plugin(const char* name, const char* entry_name) { int i; staticPlugin* plugin; - + for (i = 0; i < g_static_plugins_count; i++) { plugin = &g_static_plugins[i]; diff --git a/libfreerdp/utils/memory.c b/libfreerdp/utils/memory.c index 1a03a9fd1..eaa96dc28 100644 --- a/libfreerdp/utils/memory.c +++ b/libfreerdp/utils/memory.c @@ -1,5 +1,5 @@ /* - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Memory Utils * * Copyright 2009-2011 Jay Sorg @@ -25,36 +25,10 @@ #include #include +#include + #include -/** - * Allocate memory. - * This function is used to secure a malloc call. - * It verifies its return value, and logs an error if the allocation failed. - * - * @param size - number of bytes to allocate. If the size is < 1, it will default to 1. - * - * @return a pointer to the allocated buffer. NULL if the allocation failed. - */ - -void* xmalloc(size_t size) -{ - void* mem; - - if (size < 1) - size = 1; - - mem = malloc(size); - - if (mem == NULL) - { - perror("xmalloc"); - printf("xmalloc: failed to allocate memory of size: %d\n", (int) size); - } - - return mem; -} - /** * Allocate memory initialized to zero. * This function is used to secure a calloc call. @@ -82,137 +56,3 @@ void* xzalloc(size_t size) return mem; } -/** - * Reallocate memory. - * This function is used to secure a realloc call. - * It verifies its return value, and logs an error if the allocation failed. - * - * @param ptr - pointer to the buffer that needs reallocation. This can be NULL, in which case a new buffer is allocated. - * @param size - number of bytes to allocate. If the size is < 1, it will default to 1. - * - * @return a pointer to the reallocated buffer. NULL if the allocation failed (in which case the 'ptr' argument is untouched). - */ - -void* xrealloc(void* ptr, size_t size) -{ - void* mem; - - if (size < 1) - size = 1; - - mem = realloc(ptr, size); - - if (mem == NULL) - perror("xrealloc"); - - return mem; -} - -/** - * Free memory. - * This function is used to secure a free call. - * It verifies that the pointer is valid (non-NULL) before trying to deallocate it's buffer. - * - * @param ptr - pointer to a buffer that needs deallocation. If ptr is NULL, nothing will be done (no segfault). - */ - -void xfree(void* ptr) -{ - if (ptr != NULL) - free(ptr); -} - -/** - * Duplicate a string in memory. - * This function is used to secure the strdup function. - * It will allocate a new memory buffer and copy the string content in it. - * If allocation fails, it will log an error. - * - * @param str - pointer to the character string to copy. If str is NULL, nothing is done. - * - * @return a pointer to a newly allocated character string containing the same bytes as str. - * NULL if an allocation error occurred, or if the str parameter was NULL. - */ - -char* xstrdup(const char* str) -{ - char* mem; - - if (str == NULL) - return NULL; - -#ifdef _WIN32 - mem = _strdup(str); -#else - mem = strdup(str); -#endif - - if (mem == NULL) - perror("strdup"); - - return mem; -} - -/** - * Duplicate a wide string in memory. - * This function is used to secure a call to wcsdup. - * It verifies the return value, and logs a message if an allocation error occurred. - * - * @param wstr - pointer to the wide-character string to duplicate. If wstr is NULL, nothing will be done. - * - * @return a pointer to the newly allocated string, containing the same data as wstr. - * NULL if an allocation error occurred (or if wstr was NULL). - */ - -wchar_t* xwcsdup(const wchar_t* wstr) -{ - wchar_t* mem; - - if (wstr == NULL) - return NULL; - -#ifdef _WIN32 - mem = _wcsdup(wstr); -#elif sun - mem = wsdup(wstr); -#elif (defined(__APPLE__) && defined(__MACH__)) || defined(ANDROID) - mem = xmalloc(wcslen(wstr) * sizeof(wchar_t)); - if (mem != NULL) - wcscpy(mem, wstr); -#else - mem = wcsdup(wstr); -#endif - - if (mem == NULL) - perror("wstrdup"); - - return mem; -} - -/** - * Create an uppercase version of the given string. - * This function will duplicate the string (using xstrdup()) and change its content to all uppercase. - * The original string is untouched. - * - * @param str - pointer to the character string to convert. This content is untouched by the function. - * - * @return pointer to a newly allocated character string, containing the same content as str, converted to uppercase. - * NULL if an allocation error occured. - */ -char* xstrtoup(const char* str) -{ - char* out; - char* p; - int c; - out = xstrdup(str); - if(out != NULL) - { - p = out; - while(*p != '\0') - { - c = toupper((unsigned char)*p); - *p++ = (char)c; - } - } - return out; -} diff --git a/libfreerdp/utils/msusb.c b/libfreerdp/utils/msusb.c index 0c918b8ca..b143e28ee 100644 --- a/libfreerdp/utils/msusb.c +++ b/libfreerdp/utils/msusb.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * RemoteFX USB Redirection * * Copyright 2012 Atrust corp. @@ -35,7 +35,7 @@ msusb_mspipe_new() } static void -msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR ** MsPipes, uint32 NumberOfPipes) +msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR ** MsPipes, UINT32 NumberOfPipes) { int pnum = 0; if (MsPipes) @@ -49,7 +49,7 @@ msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR ** MsPipes, uint32 NumberOfPipes) } void -msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, MSUSB_PIPE_DESCRIPTOR ** NewMsPipes, uint32 NewNumberOfPipes) +msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, MSUSB_PIPE_DESCRIPTOR ** NewMsPipes, UINT32 NewNumberOfPipes) { /* free orignal MsPipes */ msusb_mspipes_free(MsInterface->MsPipes, MsInterface->NumberOfPipes); @@ -60,7 +60,7 @@ msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, MSUSB_PIPE_DESCR } static MSUSB_PIPE_DESCRIPTOR ** -msusb_mspipes_read(uint8 * data, uint32 data_size, uint32 NumberOfPipes, int * offset) +msusb_mspipes_read(BYTE * data, UINT32 data_size, UINT32 NumberOfPipes, int * offset) { MSUSB_PIPE_DESCRIPTOR ** MsPipes; int pnum, move = 0; @@ -72,9 +72,9 @@ msusb_mspipes_read(uint8 * data, uint32 data_size, uint32 NumberOfPipes, int * o { MSUSB_PIPE_DESCRIPTOR * MsPipe = msusb_mspipe_new(); - data_read_uint16(data + move, MsPipe->MaximumPacketSize); - data_read_uint32(data + move + 4, MsPipe->MaximumTransferSize); - data_read_uint32(data + move + 8, MsPipe->PipeFlags); + data_read_UINT16(data + move, MsPipe->MaximumPacketSize); + data_read_UINT32(data + move + 4, MsPipe->MaximumTransferSize); + data_read_UINT32(data + move + 8, MsPipe->PipeFlags); move += 12; /* Already set to zero by memset MsPipe->PipeHandle = 0; @@ -111,7 +111,7 @@ msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR * MsInterface) } static void -msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces, uint32 NumInterfaces) +msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces, UINT32 NumInterfaces) { int inum = 0; @@ -126,24 +126,24 @@ msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces, uint32 N } void -msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR * MsConfig, uint8 InterfaceNumber, MSUSB_INTERFACE_DESCRIPTOR * NewMsInterface) +msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR * MsConfig, BYTE InterfaceNumber, MSUSB_INTERFACE_DESCRIPTOR * NewMsInterface) { msusb_msinterface_free(MsConfig->MsInterfaces[InterfaceNumber]); MsConfig->MsInterfaces[InterfaceNumber] = NewMsInterface; } MSUSB_INTERFACE_DESCRIPTOR * -msusb_msinterface_read(uint8 * data, uint32 data_size, int * offset) +msusb_msinterface_read(BYTE * data, UINT32 data_size, int * offset) { MSUSB_INTERFACE_DESCRIPTOR * MsInterface; MsInterface = msusb_msinterface_new(); - data_read_uint16(data, MsInterface->Length); - data_read_uint16(data + 2, MsInterface->NumberOfPipesExpected); - data_read_uint8(data + 4, MsInterface->InterfaceNumber); - data_read_uint8(data + 5, MsInterface->AlternateSetting); - data_read_uint32(data + 8, MsInterface->NumberOfPipes); + data_read_UINT16(data, MsInterface->Length); + data_read_UINT16(data + 2, MsInterface->NumberOfPipesExpected); + data_read_BYTE(data + 4, MsInterface->InterfaceNumber); + data_read_BYTE(data + 5, MsInterface->AlternateSetting); + data_read_UINT32(data + 8, MsInterface->NumberOfPipes); *offset += 12; MsInterface->InterfaceHandle = 0; @@ -163,30 +163,30 @@ msusb_msinterface_read(uint8 * data, uint32 data_size, int * offset) } int -msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, uint8 * data, int * offset) +msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, BYTE * data, int * offset) { MSUSB_PIPE_DESCRIPTOR ** MsPipes; MSUSB_PIPE_DESCRIPTOR * MsPipe; int pnum = 0, move = 0; /* Length */ - data_write_uint16(data, MsInterface->Length); + data_write_UINT16(data, MsInterface->Length); /* InterfaceNumber */ - data_write_uint8(data + 2, MsInterface->InterfaceNumber); + data_write_BYTE(data + 2, MsInterface->InterfaceNumber); /* AlternateSetting */ - data_write_uint8(data + 3, MsInterface->AlternateSetting); + data_write_BYTE(data + 3, MsInterface->AlternateSetting); /* bInterfaceClass */ - data_write_uint8(data + 4, MsInterface->bInterfaceClass); + data_write_BYTE(data + 4, MsInterface->bInterfaceClass); /* bInterfaceSubClass */ - data_write_uint8(data + 5, MsInterface->bInterfaceSubClass); + data_write_BYTE(data + 5, MsInterface->bInterfaceSubClass); /* bInterfaceProtocol */ - data_write_uint8(data + 6, MsInterface->bInterfaceProtocol); + data_write_BYTE(data + 6, MsInterface->bInterfaceProtocol); /* Padding */ - data_write_uint8(data + 7, 0); + data_write_BYTE(data + 7, 0); /* InterfaceHandle */ - data_write_uint32(data + 8, MsInterface->InterfaceHandle); + data_write_UINT32(data + 8, MsInterface->InterfaceHandle); /* NumberOfPipes */ - data_write_uint32(data + 12, MsInterface->NumberOfPipes); + data_write_UINT32(data + 12, MsInterface->NumberOfPipes); move += 16; /* Pipes */ MsPipes = MsInterface->MsPipes; @@ -194,19 +194,19 @@ msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, uint8 * data, { MsPipe = MsPipes[pnum]; /* MaximumPacketSize */ - data_write_uint16(data + move, MsPipe->MaximumPacketSize); + data_write_UINT16(data + move, MsPipe->MaximumPacketSize); /* EndpointAddress */ - data_write_uint8(data + move + 2, MsPipe->bEndpointAddress); + data_write_BYTE(data + move + 2, MsPipe->bEndpointAddress); /* Interval */ - data_write_uint8(data + move + 3, MsPipe->bInterval); + data_write_BYTE(data + move + 3, MsPipe->bInterval); /* PipeType */ - data_write_uint32(data + move + 4, MsPipe->PipeType); + data_write_UINT32(data + move + 4, MsPipe->PipeType); /* PipeHandle */ - data_write_uint32(data + move + 8, MsPipe->PipeHandle); + data_write_UINT32(data + move + 8, MsPipe->PipeHandle); /* MaximumTransferSize */ - data_write_uint32(data + move + 12, MsPipe->MaximumTransferSize); + data_write_UINT32(data + move + 12, MsPipe->MaximumTransferSize); /* PipeFlags */ - data_write_uint32(data + move + 16, MsPipe->PipeFlags); + data_write_UINT32(data + move + 16, MsPipe->PipeFlags); move += 20; } @@ -217,7 +217,7 @@ msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR * MsInterface, uint8 * data, } static MSUSB_INTERFACE_DESCRIPTOR ** -msusb_msinterface_read_list(uint8 * data, uint32 data_size, uint32 NumInterfaces) +msusb_msinterface_read_list(BYTE * data, UINT32 data_size, UINT32 NumInterfaces) { MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces; int inum, offset = 0; @@ -235,16 +235,16 @@ msusb_msinterface_read_list(uint8 * data, uint32 data_size, uint32 NumInterfaces } int -msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR * MsConfg, uint8 * data, int * offset) +msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR * MsConfg, BYTE * data, int * offset) { MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces; MSUSB_INTERFACE_DESCRIPTOR * MsInterface; int inum = 0; /* ConfigurationHandle*/ - data_write_uint32(data + *offset, MsConfg->ConfigurationHandle); + data_write_UINT32(data + *offset, MsConfg->ConfigurationHandle); /* NumInterfaces*/ - data_write_uint32(data + *offset + 4, MsConfg->NumInterfaces); + data_write_UINT32(data + *offset + 4, MsConfg->NumInterfaces); *offset += 8; /* Interfaces */ MsInterfaces = MsConfg->MsInterfaces; @@ -279,29 +279,29 @@ msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR * MsConfig) } MSUSB_CONFIG_DESCRIPTOR * -msusb_msconfig_read(uint8 * data, uint32 data_size, uint32 NumInterfaces) +msusb_msconfig_read(BYTE * data, UINT32 data_size, UINT32 NumInterfaces) { MSUSB_CONFIG_DESCRIPTOR * MsConfig; - uint8 lenConfiguration, typeConfiguration; - uint16 lenInterface; + BYTE lenConfiguration, typeConfiguration; + UINT16 lenInterface; int i, offset = 0; MsConfig = msusb_msconfig_new(); for(i = 0; i < NumInterfaces; i++) { - data_read_uint16(data + offset, lenInterface); + data_read_UINT16(data + offset, lenInterface); offset += lenInterface; } - data_read_uint8(data + offset, lenConfiguration); - data_read_uint8(data + offset + 1, typeConfiguration); + data_read_BYTE(data + offset, lenConfiguration); + data_read_BYTE(data + offset + 1, typeConfiguration); if (lenConfiguration != 0x9 || typeConfiguration != 0x2) { DEBUG("%s: len and type must be 0x9 and 0x2 , but it is 0x%x and 0x%x", lenConfiguration, typeConfiguration); } - data_read_uint16(data + offset + 2, MsConfig->wTotalLength); - data_read_uint8(data + offset + 5, MsConfig->bConfigurationValue); + data_read_UINT16(data + offset + 2, MsConfig->wTotalLength); + data_read_BYTE(data + offset + 5, MsConfig->bConfigurationValue); MsConfig->NumInterfaces = NumInterfaces; MsConfig->ConfigurationHandle = 0; MsConfig->InitCompleted = 0; diff --git a/libfreerdp/utils/passphrase.c b/libfreerdp/utils/passphrase.c index 35c1b8a78..50d338166 100644 --- a/libfreerdp/utils/passphrase.c +++ b/libfreerdp/utils/passphrase.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Passphrase Handling Utils * * Copyright 2011 Shea Levy diff --git a/libfreerdp/utils/pcap.c b/libfreerdp/utils/pcap.c index 61bdf4089..8e88b0d90 100644 --- a/libfreerdp/utils/pcap.c +++ b/libfreerdp/utils/pcap.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * pcap File Format Utils * * Copyright 2011 Marc-Andre Moreau @@ -22,6 +22,7 @@ #endif #include +#include #include #ifndef _WIN32 @@ -72,7 +73,7 @@ void pcap_read_record(rdpPcap* pcap, pcap_record* record) { pcap_read_record_header(pcap, &record->header); record->length = record->header.incl_len; - record->data = xmalloc(record->length); + record->data = malloc(record->length); fread(record->data, record->length, 1, pcap->fp); } @@ -82,7 +83,7 @@ void pcap_write_record(rdpPcap* pcap, pcap_record* record) fwrite(record->data, record->length, 1, pcap->fp); } -void pcap_add_record(rdpPcap* pcap, void* data, uint32 length) +void pcap_add_record(rdpPcap* pcap, void* data, UINT32 length) { pcap_record* record; struct timeval tp; @@ -114,42 +115,42 @@ void pcap_add_record(rdpPcap* pcap, void* data, uint32 length) record->header.ts_usec = tp.tv_usec; } -boolean pcap_has_next_record(rdpPcap* pcap) +BOOL pcap_has_next_record(rdpPcap* pcap) { if (pcap->file_size - (ftell(pcap->fp)) <= 16) - return false; + return FALSE; - return true; + return TRUE; } -boolean pcap_get_next_record_header(rdpPcap* pcap, pcap_record* record) +BOOL pcap_get_next_record_header(rdpPcap* pcap, pcap_record* record) { - if (pcap_has_next_record(pcap) != true) - return false; + if (pcap_has_next_record(pcap) != TRUE) + return FALSE; pcap_read_record_header(pcap, &record->header); record->length = record->header.incl_len; - return true; + return TRUE; } -boolean pcap_get_next_record_content(rdpPcap* pcap, pcap_record* record) +BOOL pcap_get_next_record_content(rdpPcap* pcap, pcap_record* record) { fread(record->data, record->length, 1, pcap->fp); - return true; + return TRUE; } -boolean pcap_get_next_record(rdpPcap* pcap, pcap_record* record) +BOOL pcap_get_next_record(rdpPcap* pcap, pcap_record* record) { - if (pcap_has_next_record(pcap) != true) - return false; + if (pcap_has_next_record(pcap) != TRUE) + return FALSE; pcap_read_record(pcap, record); - return true; + return TRUE; } -rdpPcap* pcap_open(char* name, boolean write) +rdpPcap* pcap_open(char* name, BOOL write) { rdpPcap* pcap; diff --git a/libfreerdp/utils/profiler.c b/libfreerdp/utils/profiler.c index b12729e93..3b52c72d0 100644 --- a/libfreerdp/utils/profiler.c +++ b/libfreerdp/utils/profiler.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Profiler Utils * * Copyright 2011 Stephen Erisman @@ -22,6 +22,7 @@ #endif #include +#include #include @@ -29,7 +30,7 @@ PROFILER* profiler_create(char* name) { PROFILER* profiler; - profiler = (PROFILER*) xmalloc(sizeof(PROFILER)); + profiler = (PROFILER*) malloc(sizeof(PROFILER)); profiler->name = name; profiler->stopwatch = stopwatch_create(); @@ -41,7 +42,7 @@ void profiler_free(PROFILER* profiler) { stopwatch_free(profiler->stopwatch); - xfree(profiler); + free(profiler); } void profiler_enter(PROFILER* profiler) diff --git a/libfreerdp/utils/rail.c b/libfreerdp/utils/rail.c index 99f41f487..6ab19ec02 100644 --- a/libfreerdp/utils/rail.c +++ b/libfreerdp/utils/rail.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Remote Applications Integrated Locally (RAIL) Utils * * Copyright 2011 Marc-Andre Moreau @@ -21,16 +21,21 @@ #include "config.h" #endif +#include +#include + #include -#include #include +#include + #include -void rail_unicode_string_alloc(RAIL_UNICODE_STRING* unicode_string, uint16 cbString) +void rail_unicode_string_alloc(RAIL_UNICODE_STRING* unicode_string, UINT16 cbString) { unicode_string->length = cbString; - unicode_string->string = xzalloc(cbString); + unicode_string->string = malloc(cbString); + memset(unicode_string->string, 0, cbString); } void rail_unicode_string_free(RAIL_UNICODE_STRING* unicode_string) @@ -38,17 +43,17 @@ void rail_unicode_string_free(RAIL_UNICODE_STRING* unicode_string) unicode_string->length = 0; if (unicode_string->string != NULL) - xfree(unicode_string->string); + free(unicode_string->string); } void rail_read_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string) { - stream_read_uint16(s, unicode_string->length); /* cbString (2 bytes) */ + stream_read_UINT16(s, unicode_string->length); /* cbString (2 bytes) */ if (unicode_string->string == NULL) - unicode_string->string = (uint8*) xmalloc(unicode_string->length); + unicode_string->string = (BYTE*) malloc(unicode_string->length); else - unicode_string->string = (uint8*) xrealloc(unicode_string->string, unicode_string->length); + unicode_string->string = (BYTE*) realloc(unicode_string->string, unicode_string->length); stream_read(s, unicode_string->string, unicode_string->length); } @@ -56,7 +61,7 @@ void rail_read_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string) void rail_write_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string) { stream_check_size(s, 2 + unicode_string->length); - stream_write_uint16(s, unicode_string->length); /* cbString (2 bytes) */ + stream_write_UINT16(s, unicode_string->length); /* cbString (2 bytes) */ stream_write(s, unicode_string->string, unicode_string->length); /* string */ } @@ -71,26 +76,26 @@ void rail_write_unicode_string_value(STREAM* s, RAIL_UNICODE_STRING* unicode_str void rail_read_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16) { - stream_read_uint16(s, rectangle_16->left); /* left (2 bytes) */ - stream_read_uint16(s, rectangle_16->top); /* top (2 bytes) */ - stream_read_uint16(s, rectangle_16->right); /* right (2 bytes) */ - stream_read_uint16(s, rectangle_16->bottom); /* bottom (2 bytes) */ + stream_read_UINT16(s, rectangle_16->left); /* left (2 bytes) */ + stream_read_UINT16(s, rectangle_16->top); /* top (2 bytes) */ + stream_read_UINT16(s, rectangle_16->right); /* right (2 bytes) */ + stream_read_UINT16(s, rectangle_16->bottom); /* bottom (2 bytes) */ } void rail_write_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16) { - stream_write_uint16(s, rectangle_16->left); /* left (2 bytes) */ - stream_write_uint16(s, rectangle_16->top); /* top (2 bytes) */ - stream_write_uint16(s, rectangle_16->right); /* right (2 bytes) */ - stream_write_uint16(s, rectangle_16->bottom); /* bottom (2 bytes) */ + stream_write_UINT16(s, rectangle_16->left); /* left (2 bytes) */ + stream_write_UINT16(s, rectangle_16->top); /* top (2 bytes) */ + stream_write_UINT16(s, rectangle_16->right); /* right (2 bytes) */ + stream_write_UINT16(s, rectangle_16->bottom); /* bottom (2 bytes) */ } -void* rail_clone_order(uint32 event_type, void* order) +void* rail_clone_order(UINT32 event_type, void* order) { struct { - uint32 type; - uint32 size; + UINT32 type; + UINT32 size; } ordersize_table[] = { {RDP_EVENT_TYPE_RAIL_CHANNEL_GET_SYSPARAMS, sizeof(RAIL_SYSPARAM_ORDER)}, @@ -126,7 +131,7 @@ void* rail_clone_order(uint32 event_type, void* order) // Event type not found. if (order_size == 0) return NULL; - new_order = xmalloc(order_size); + new_order = malloc(order_size); memcpy(new_order, order, order_size); //printf("rail_clone_order: type=%d order=%p\n", event_type, new_order); @@ -169,7 +174,7 @@ void* rail_clone_order(uint32 event_type, void* order) return new_order; } -void rail_free_cloned_order(uint32 event_type, void* order) +void rail_free_cloned_order(UINT32 event_type, void* order) { //printf("rail_free_cloned_order: type=%d order=%p\n", event_type, order); if ((event_type == RDP_EVENT_TYPE_RAIL_CHANNEL_GET_SYSPARAMS) || @@ -184,5 +189,5 @@ void rail_free_cloned_order(uint32 event_type, void* order) RAIL_EXEC_RESULT_ORDER* exec_result = (RAIL_EXEC_RESULT_ORDER*)order; rail_unicode_string_free(&exec_result->exeOrFile); } - xfree(order); + free(order); } diff --git a/libfreerdp/utils/signal.c b/libfreerdp/utils/signal.c index 3ce1b277a..cc7e69365 100644 --- a/libfreerdp/utils/signal.c +++ b/libfreerdp/utils/signal.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Signal handling * * Copyright 2011 Shea Levy diff --git a/libfreerdp/utils/sleep.c b/libfreerdp/utils/sleep.c index fe7deb21e..1a74eaad6 100644 --- a/libfreerdp/utils/sleep.c +++ b/libfreerdp/utils/sleep.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Sleep Utils * * Copyright 2011 Marc-Andre Moreau @@ -32,7 +32,7 @@ #include #endif -void freerdp_sleep(uint32 seconds) +void freerdp_sleep(UINT32 seconds) { #ifndef _WIN32 sleep(seconds); @@ -41,14 +41,14 @@ void freerdp_sleep(uint32 seconds) #endif } -void freerdp_usleep(uint32 useconds) +void freerdp_usleep(UINT32 useconds) { #ifndef _WIN32 usleep(useconds); #else - uint64 t1; - uint64 t2; - uint64 freq; + UINT64 t1; + UINT64 t2; + UINT64 freq; QueryPerformanceCounter((LARGE_INTEGER*) &t1); QueryPerformanceCounter((LARGE_INTEGER*) &freq); diff --git a/libfreerdp/utils/stopwatch.c b/libfreerdp/utils/stopwatch.c index f2cad8f6d..a9ffd6bb6 100644 --- a/libfreerdp/utils/stopwatch.c +++ b/libfreerdp/utils/stopwatch.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Stopwatch Utils * * Copyright 2011 Stephen Erisman @@ -21,13 +21,16 @@ #include "config.h" #endif +#include +#include + #include STOPWATCH* stopwatch_create() { STOPWATCH* sw; - sw = (STOPWATCH*) xmalloc(sizeof(STOPWATCH)); + sw = (STOPWATCH*) malloc(sizeof(STOPWATCH)); stopwatch_reset(sw); return sw; @@ -35,7 +38,7 @@ STOPWATCH* stopwatch_create() void stopwatch_free(STOPWATCH* stopwatch) { - xfree(stopwatch); + free(stopwatch); } void stopwatch_start(STOPWATCH* stopwatch) @@ -63,18 +66,18 @@ double stopwatch_get_elapsed_time_in_seconds(STOPWATCH* stopwatch) return ((double) stopwatch->elapsed) / CLOCKS_PER_SEC; } -void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, uint32* sec, uint32* usec) +void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, UINT32* sec, UINT32* usec) { double uelapsed; double clocks_per_usec; - *sec = ((uint32) stopwatch->elapsed) / CLOCKS_PER_SEC; + *sec = ((UINT32) stopwatch->elapsed) / CLOCKS_PER_SEC; uelapsed = stopwatch->elapsed - ((double)(*sec) * CLOCKS_PER_SEC); clocks_per_usec = (CLOCKS_PER_SEC / 1000000); if (clocks_per_usec > 0.0) - *usec = (uint32)(uelapsed / clocks_per_usec); + *usec = (UINT32)(uelapsed / clocks_per_usec); else *usec = 0; } diff --git a/libfreerdp/utils/stream.c b/libfreerdp/utils/stream.c index 534aa2e8c..599c5e797 100644 --- a/libfreerdp/utils/stream.c +++ b/libfreerdp/utils/stream.c @@ -1,5 +1,5 @@ /* - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Stream Utils * * Copyright 2011 Vic Lee @@ -56,7 +56,7 @@ STREAM* stream_new(int size) if (size != 0) { size = size > 0 ? size : 0x400; - stream->data = (uint8*) xzalloc(size); + stream->data = (BYTE*) xzalloc(size); stream->p = stream->data; stream->size = size; } @@ -79,9 +79,9 @@ void stream_free(STREAM* stream) if (stream != NULL) { if (stream->data != NULL) - xfree(stream->data); + free(stream->data); - xfree(stream); + free(stream); } } @@ -107,9 +107,9 @@ void stream_extend(STREAM* stream, int request_size) stream->size += increased_size; if (original_size == 0) - stream->data = (uint8*) xmalloc(stream->size); + stream->data = (BYTE*) malloc(stream->size); else - stream->data = (uint8*) xrealloc(stream->data, stream->size); + stream->data = (BYTE*) realloc(stream->data, stream->size); memset(stream->data + original_size, 0, increased_size); stream_set_pos(stream, pos); diff --git a/libfreerdp/utils/string.c b/libfreerdp/utils/string.c index a8229f006..92f900f71 100644 --- a/libfreerdp/utils/string.c +++ b/libfreerdp/utils/string.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * String Utils * * Copyright 2011 Marc-Andre Moreau @@ -21,15 +21,18 @@ #include "config.h" #endif -#include +#include +#include +#include + #include #include void freerdp_string_read_length32(STREAM* s, rdpString* string) { - stream_read_uint32(s, string->length); - string->unicode = (char*) xmalloc(string->length); + stream_read_UINT32(s, string->length); + string->unicode = (char*) malloc(string->length); stream_read(s, string->unicode, string->length); freerdp_UnicodeToAsciiAlloc((WCHAR*) string->unicode, &string->ascii, string->length / 2); } @@ -37,8 +40,8 @@ void freerdp_string_read_length32(STREAM* s, rdpString* string) void freerdp_string_free(rdpString* string) { if (string->unicode != NULL) - xfree(string->unicode); + free(string->unicode); if (string->ascii != NULL) - xfree(string->ascii); + free(string->ascii); } diff --git a/libfreerdp/utils/svc_plugin.c b/libfreerdp/utils/svc_plugin.c index 7b95e4374..1d8f31fea 100644 --- a/libfreerdp/utils/svc_plugin.c +++ b/libfreerdp/utils/svc_plugin.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Static Virtual Channel Interface * * Copyright 2009-2011 Jay Sorg @@ -37,6 +37,7 @@ /* The list of all plugin instances. */ typedef struct rdp_svc_plugin_list rdpSvcPluginList; + struct rdp_svc_plugin_list { rdpSvcPlugin* plugin; @@ -68,13 +69,13 @@ static void svc_data_in_item_free(svc_data_in_item* item) freerdp_event_free(item->event_in); item->event_in = NULL; } - xfree(item); + free(item); } struct rdp_svc_plugin_private { void* init_handle; - uint32 open_handle; + UINT32 open_handle; STREAM* data_in; LIST* data_in_list; @@ -104,7 +105,7 @@ static rdpSvcPlugin* svc_plugin_find_by_init_handle(void* init_handle) return NULL; } -static rdpSvcPlugin* svc_plugin_find_by_open_handle(uint32 open_handle) +static rdpSvcPlugin* svc_plugin_find_by_open_handle(UINT32 open_handle) { rdpSvcPluginList * list; rdpSvcPlugin * plugin; @@ -144,13 +145,13 @@ static void svc_plugin_remove(rdpSvcPlugin* plugin) prev->next = list->next; else g_svc_plugin_list = list->next; - xfree(list); + free(list); } ReleaseMutex(g_mutex); } -static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, uint32 dataLength, - uint32 totalLength, uint32 dataFlags) +static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT32 dataLength, + UINT32 totalLength, UINT32 dataFlags) { STREAM* data_in; svc_data_in_item* item; @@ -160,7 +161,7 @@ static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, uint3 /* According to MS-RDPBCGR 2.2.6.1, "All virtual channel traffic MUST be suspended. This flag is only valid in server-to-client virtual channel traffic. It MUST be ignored in client-to-server data." Thus it would be best practice to cease data - transmission. However, simply returing here avoids a crash. */ + transmission. However, simply returning here avoids a crash. */ return; } @@ -210,8 +211,8 @@ static void svc_plugin_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event_in) freerdp_thread_signal(plugin->priv->thread); } -static void svc_plugin_open_event(uint32 openHandle, uint32 event, void* pData, uint32 dataLength, - uint32 totalLength, uint32 dataFlags) +static void svc_plugin_open_event(UINT32 openHandle, UINT32 event, void* pData, UINT32 dataLength, + UINT32 totalLength, UINT32 dataFlags) { rdpSvcPlugin* plugin; @@ -263,7 +264,7 @@ static void svc_plugin_process_data_in(rdpSvcPlugin* plugin) IFCALL(plugin->receive_callback, plugin, item->data_in); if (item->event_in) IFCALL(plugin->event_callback, plugin, item->event_in); - xfree(item); + free(item); } else break; @@ -302,9 +303,9 @@ static void* svc_plugin_thread_func(void* arg) return 0; } -static void svc_plugin_process_connected(rdpSvcPlugin* plugin, void* pData, uint32 dataLength) +static void svc_plugin_process_connected(rdpSvcPlugin* plugin, void* pData, UINT32 dataLength) { - uint32 error; + UINT32 error; error = plugin->channel_entry_points.pVirtualChannelOpen(plugin->priv->init_handle, &plugin->priv->open_handle, plugin->channel_def.name, svc_plugin_open_event); @@ -329,7 +330,7 @@ static void svc_plugin_process_terminated(rdpSvcPlugin* plugin) freerdp_thread_free(plugin->priv->thread); plugin->channel_entry_points.pVirtualChannelClose(plugin->priv->open_handle); - xfree(plugin->channel_entry_points.pExtendedData); + free(plugin->channel_entry_points.pExtendedData); svc_plugin_remove(plugin); @@ -342,13 +343,13 @@ static void svc_plugin_process_terminated(rdpSvcPlugin* plugin) stream_free(plugin->priv->data_in); plugin->priv->data_in = NULL; } - xfree(plugin->priv); + free(plugin->priv); plugin->priv = NULL; IFCALL(plugin->terminate_callback, plugin); } -static void svc_plugin_init_event(void* pInitHandle, uint32 event, void* pData, uint32 dataLength) +static void svc_plugin_init_event(void* pInitHandle, UINT32 event, void* pData, UINT32 dataLength) { rdpSvcPlugin* plugin; @@ -407,7 +408,7 @@ void svc_plugin_init(rdpSvcPlugin* plugin, CHANNEL_ENTRY_POINTS* pEntryPoints) int svc_plugin_send(rdpSvcPlugin* plugin, STREAM* data_out) { - uint32 error = 0; + UINT32 error = 0; DEBUG_SVC("length %d", (int) stream_get_length(data_out)); @@ -428,7 +429,7 @@ int svc_plugin_send(rdpSvcPlugin* plugin, STREAM* data_out) int svc_plugin_send_event(rdpSvcPlugin* plugin, RDP_EVENT* event) { - uint32 error = 0; + UINT32 error = 0; DEBUG_SVC("event_type %d", event->event_type); diff --git a/libfreerdp/utils/tcp.c b/libfreerdp/utils/tcp.c index 5bddb45d6..ffd3ac6a0 100644 --- a/libfreerdp/utils/tcp.c +++ b/libfreerdp/utils/tcp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * TCP Utils * * Copyright 2012 Marc-Andre Moreau @@ -112,7 +112,7 @@ int freerdp_tcp_connect(const char* hostname, int port) return sockfd; } -int freerdp_tcp_read(int sockfd, uint8* data, int length) +int freerdp_tcp_read(int sockfd, BYTE* data, int length) { int status; @@ -145,7 +145,7 @@ int freerdp_tcp_read(int sockfd, uint8* data, int length) return status; } -int freerdp_tcp_write(int sockfd, uint8* data, int length) +int freerdp_tcp_write(int sockfd, BYTE* data, int length) { int status; @@ -183,9 +183,9 @@ int freerdp_tcp_disconnect(int sockfd) return 0; } -int freerdp_tcp_set_no_delay(int sockfd, boolean no_delay) +int freerdp_tcp_set_no_delay(int sockfd, BOOL no_delay) { - uint32 option_value; + UINT32 option_value; socklen_t option_len; option_value = no_delay; diff --git a/libfreerdp/utils/thread.c b/libfreerdp/utils/thread.c index 2c1c16076..98be69148 100644 --- a/libfreerdp/utils/thread.c +++ b/libfreerdp/utils/thread.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Thread Utils * * Copyright 2011 Vic Lee @@ -93,5 +93,5 @@ void freerdp_thread_free(freerdp_thread* thread) CloseHandle(thread->mutex); thread->mutex = NULL; - xfree(thread); + free(thread); } diff --git a/libfreerdp/utils/time.c b/libfreerdp/utils/time.c index 0183b58c3..6e7885b0e 100644 --- a/libfreerdp/utils/time.c +++ b/libfreerdp/utils/time.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Time Utils * * Copyright 2012 Marc-Andre Moreau @@ -29,10 +29,10 @@ #include -uint64 freerdp_windows_gmtime() +UINT64 freerdp_windows_gmtime() { time_t unix_time; - uint64 windows_time; + UINT64 windows_time; gmtime(&unix_time); windows_time = freerdp_get_windows_time_from_unix_time(unix_time); @@ -40,14 +40,14 @@ uint64 freerdp_windows_gmtime() return windows_time; } -uint64 freerdp_get_windows_time_from_unix_time(time_t unix_time) +UINT64 freerdp_get_windows_time_from_unix_time(time_t unix_time) { - uint64 windows_time; + UINT64 windows_time; windows_time = (unix_time * 10000000) + 621355968000000000ULL; return windows_time; } -time_t freerdp_get_unix_time_from_windows_time(uint64 windows_time) +time_t freerdp_get_unix_time_from_windows_time(UINT64 windows_time) { time_t unix_time; unix_time = (windows_time - 621355968000000000ULL) / 10000000; diff --git a/libfreerdp/utils/uds.c b/libfreerdp/utils/uds.c index ff44f243c..d05f6ff32 100644 --- a/libfreerdp/utils/uds.c +++ b/libfreerdp/utils/uds.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Unix Domain Socket Utils * * Copyright 2012 Vic Lee diff --git a/libfreerdp/utils/unicode.c b/libfreerdp/utils/unicode.c index 8cd98bc03..bc347254b 100644 --- a/libfreerdp/utils/unicode.c +++ b/libfreerdp/utils/unicode.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Unicode Utils * * Copyright 2011 Marc-Andre Moreau diff --git a/libfreerdp/utils/wait_obj.c b/libfreerdp/utils/wait_obj.c index ac4f1c021..a38603530 100644 --- a/libfreerdp/utils/wait_obj.c +++ b/libfreerdp/utils/wait_obj.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol client. + * FreeRDP: A Remote Desktop Protocol Implementation * Virtual Channel Manager * * Copyright 2009-2011 Jay Sorg @@ -64,7 +64,7 @@ wait_obj_new(void) if (pipe(obj->pipe_fd) < 0) { printf("wait_obj_new: pipe failed\n"); - xfree(obj); + free(obj); return NULL; } #endif @@ -117,7 +117,7 @@ wait_obj_free(struct wait_obj* obj) #endif } - xfree(obj); + free(obj); } } @@ -219,7 +219,7 @@ wait_obj_select(struct wait_obj** listobj, int numobj, int timeout) status = -1; else status = 0; - xfree(hnds); + free(hnds); #endif return status; diff --git a/scripts/LECHash.c b/scripts/LECHash.c index 7c73438f2..285205ff2 100644 --- a/scripts/LECHash.c +++ b/scripts/LECHash.c @@ -1,7 +1,7 @@ #include -typedef unsigned short uint16; +typedef unsigned short UINT16; -static uint16 HuffCodeLEC[] = { +static UINT16 HuffCodeLEC[] = { 0x0004, 0x0024, 0x0014, 0x0011, 0x0051, 0x0031, 0x0071, 0x0009, 0x0049, 0x0029, 0x0069, 0x0015, 0x0095, 0x0055, 0x00d5, 0x0035, 0x00b5, 0x0075, 0x001d, 0x00f5, 0x011d, 0x009d, 0x019d, 0x005d, 0x000d, 0x008d, 0x015d, 0x00dd, 0x01dd, 0x003d, 0x013d, 0x00bd, 0x004d, 0x01bd, 0x007d, 0x006b, 0x017d, 0x00fd, 0x01fd, 0x0003, 0x0103, @@ -24,20 +24,20 @@ static uint16 HuffCodeLEC[] = { 0x002c, 0x001c, 0x0000, 0x003c, 0x0002, 0x0022, 0x0010, 0x0012, 0x0008, 0x0032, 0x000a, 0x002a, 0x001a, 0x003a, 0x0006, 0x0026, 0x0016, 0x0036, 0x000e, 0x002e, 0x001e, 0x003e, 0x0001, 0x00ed, 0x0018, 0x0021, 0x0025, 0x0065 }; -uint16 HashTable[512] = { [0 ... 511] = 0xffff }; +UINT16 HashTable[512] = { [0 ... 511] = 0xffff }; -static uint16 tab[8] = {511, 0, 508, 448, 494, 347, 486, 482}; +static UINT16 tab[8] = {511, 0, 508, 448, 494, 347, 486, 482}; -uint16 hash(uint16 key) +UINT16 hash(UINT16 key) { - uint16 h; + UINT16 h; h = (key & 0x1ff) ^ (key >> 9) ^ (key >> 4) ^ (key >> 7); return h; } -uint16 minihash(uint16 key) +UINT16 minihash(UINT16 key) { - uint16 h; + UINT16 h; h = ((((key >> 8) ^ (key & 0xff)) >> 2) & 0xf); if(key >> 9) h = ~h; @@ -47,7 +47,7 @@ uint16 minihash(uint16 key) void buildhashtable(void) { int i,j; - uint16 h; + UINT16 h; for(i=0;i<293;i++) { h=hash(HuffCodeLEC[i]); @@ -64,9 +64,9 @@ void buildhashtable(void) } } -uint16 getvalue(uint16 huff) +UINT16 getvalue(UINT16 huff) { - uint16 h = HashTable[hash(huff)]; + UINT16 h = HashTable[hash(huff)]; if((h ^ huff) >> 9) return h & 0x1ff; else @@ -77,7 +77,7 @@ main() { int i; buildhashtable(); - printf("static uint16 HuffIndexLEC[512] = {\n"); + printf("static UINT16 HuffIndexLEC[512] = {\n"); for(i=0;i<512;i++) { if(i == 511) diff --git a/scripts/LOMHash.c b/scripts/LOMHash.c index 0644fb11f..c1d4e36ea 100644 --- a/scripts/LOMHash.c +++ b/scripts/LOMHash.c @@ -1,23 +1,23 @@ #include -typedef unsigned short uint16; -typedef unsigned char uint8; -static uint16 HuffCodeLOM[] = { +typedef unsigned short UINT16; +typedef unsigned char BYTE; +static UINT16 HuffCodeLOM[] = { 0x0001, 0x0000, 0x0002, 0x0009, 0x0006, 0x0005, 0x000d, 0x000b, 0x0003, 0x001b, 0x0007, 0x0017, 0x0037, 0x000f, 0x004f, 0x006f, 0x002f, 0x00ef, 0x001f, 0x005f, 0x015f, 0x009f, 0x00df, 0x01df, 0x003f, 0x013f, 0x00bf, 0x01bf, 0x007f, 0x017f, 0x00ff, 0x01ff }; -uint16 HashTable[32] = { [0 ... 31] = 0xffff }; +UINT16 HashTable[32] = { [0 ... 31] = 0xffff }; -uint8 tab[4] = { 0, 4, 10, 19 }; +BYTE tab[4] = { 0, 4, 10, 19 }; -uint16 hash(uint16 key) +UINT16 hash(UINT16 key) { return ((key & 0x1f) ^ (key >> 5) ^ (key >> 9)); } -uint8 minihash(uint16 key) +BYTE minihash(UINT16 key) { - uint8 h; + BYTE h; h = (key >> 4) & 0xf; return ((h ^ (h >> 2) ^ (h >> 3)) & 0x3); } @@ -25,7 +25,7 @@ uint8 minihash(uint16 key) void buildhashtable(void) { int i,j; - uint16 h; + UINT16 h; for(i=0;i<32;i++) { h=hash(HuffCodeLOM[i]); @@ -43,9 +43,9 @@ void buildhashtable(void) } } -uint8 getvalue(uint16 huff) +BYTE getvalue(UINT16 huff) { - uint16 h = HashTable[hash(huff)]; + UINT16 h = HashTable[hash(huff)]; if((h ^ huff) >> 5) { return h & 0x1f; @@ -58,7 +58,7 @@ main() { int i; buildhashtable(); - printf("static uint16 HuffIndexLOM[32] = {\n"); + printf("static UINT16 HuffIndexLOM[32] = {\n"); for(i=0;i<32;i++) { if(i == 31) diff --git a/scripts/TimeZones.cs b/scripts/TimeZones.cs index 36cea6050..d8b0d9edd 100644 --- a/scripts/TimeZones.cs +++ b/scripts/TimeZones.cs @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * Time Zone Redirection Table Generator * * Copyright 2012 Marc-Andre Moreau diff --git a/scripts/WindowsZones.cs b/scripts/WindowsZones.cs index d9c2464bd..834c6d3f1 100644 --- a/scripts/WindowsZones.cs +++ b/scripts/WindowsZones.cs @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * TZID to Windows TimeZone Identifier Table Generator * * Copyright 2012 Marc-Andre Moreau diff --git a/scripts/xkb.pl b/scripts/xkb.pl index 9faa5a0e4..976ee3ba5 100755 --- a/scripts/xkb.pl +++ b/scripts/xkb.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# FreeRDP: A Remote Desktop Protocol client. +# FreeRDP: A Remote Desktop Protocol Implementation # XKB database conversion script # Copyright 2009 Marc-Andre Moreau diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index e7b64a890..3897b5f25 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP Servers # # Copyright 2012 Marc-Andre Moreau diff --git a/server/Sample/CMakeLists.txt b/server/Sample/CMakeLists.txt index a7219c248..35dc0a348 100644 --- a/server/Sample/CMakeLists.txt +++ b/server/Sample/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP Sample Server cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -19,21 +19,29 @@ set(MODULE_NAME "sfreerdp-server") set(MODULE_PREFIX "FREERDP_SERVER_SAMPLE") set(${MODULE_PREFIX}_SRCS - tfreerdp.c) + sfreerdp.c + sfreerdp.h + sf_audin.c + sf_audin.h + sf_rdpsnd.c + sf_rdpsnd.h) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(${MODULE_NAME} + winpr freerdp - freerdp-server) + freerdp-channels-server) else() target_link_libraries(${MODULE_NAME} + winpr-crt freerdp-core freerdp-utils freerdp-codec freerdp-channels - freerdp-server-channels) + freerdp-channels-server) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Sample") + diff --git a/server/Sample/sf_audin.c b/server/Sample/sf_audin.c new file mode 100644 index 000000000..9c19aaa7a --- /dev/null +++ b/server/Sample/sf_audin.c @@ -0,0 +1,76 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Sample Server (Audio Input) + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 "sfreerdp.h" + +#include "sf_audin.h" + +static const rdpsndFormat test_audio_formats[] = +{ + { 0x11, 2, 22050, 1024, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 2 channels */ + { 0x11, 1, 22050, 512, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 1 channels */ + { 0x01, 2, 22050, 4, 16, 0, NULL }, /* PCM, 22050 Hz, 2 channels, 16 bits */ + { 0x01, 1, 22050, 2, 16, 0, NULL }, /* PCM, 22050 Hz, 1 channels, 16 bits */ + { 0x01, 2, 44100, 4, 16, 0, NULL }, /* PCM, 44100 Hz, 2 channels, 16 bits */ + { 0x01, 1, 44100, 2, 16, 0, NULL }, /* PCM, 44100 Hz, 1 channels, 16 bits */ + { 0x01, 2, 11025, 4, 16, 0, NULL }, /* PCM, 11025 Hz, 2 channels, 16 bits */ + { 0x01, 1, 11025, 2, 16, 0, NULL }, /* PCM, 11025 Hz, 1 channels, 16 bits */ + { 0x01, 2, 8000, 4, 16, 0, NULL }, /* PCM, 8000 Hz, 2 channels, 16 bits */ + { 0x01, 1, 8000, 2, 16, 0, NULL } /* PCM, 8000 Hz, 1 channels, 16 bits */ +}; + +static void sf_peer_audin_opening(audin_server_context* context) +{ + printf("AUDIN opening.\n"); + /* Simply choose the first format supported by the client. */ + context->SelectFormat(context, 0); +} + +static void sf_peer_audin_open_result(audin_server_context* context, UINT32 result) +{ + printf("AUDIN open result %d.\n", result); +} + +static void sf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes) +{ + printf("AUDIN receive %d frames.\n", nframes); +} + +void sf_peer_audin_init(testPeerContext* context) +{ + context->audin = audin_server_context_new(context->vcm); + context->audin->data = context; + + context->audin->server_formats = test_audio_formats; + context->audin->num_server_formats = + sizeof(test_audio_formats) / sizeof(test_audio_formats[0]); + + context->audin->dst_format.wFormatTag = 1; + context->audin->dst_format.nChannels = 2; + context->audin->dst_format.nSamplesPerSec = 44100; + context->audin->dst_format.wBitsPerSample = 16; + + context->audin->Opening = sf_peer_audin_opening; + context->audin->OpenResult = sf_peer_audin_open_result; + context->audin->ReceiveSamples = sf_peer_audin_receive_samples; +} diff --git a/server/Sample/sf_audin.h b/server/Sample/sf_audin.h new file mode 100644 index 000000000..51ec4b31a --- /dev/null +++ b/server/Sample/sf_audin.h @@ -0,0 +1,32 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Sample Server (Audio Input) + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 SF_AUDIN_H +#define SF_AUDIN_H + +#include +#include +#include + +#include "sfreerdp.h" + +void sf_peer_audin_init(testPeerContext* context); + +#endif /* WF_AUDIN_H */ + diff --git a/server/Sample/sf_rdpsnd.c b/server/Sample/sf_rdpsnd.c new file mode 100644 index 000000000..ff901fef6 --- /dev/null +++ b/server/Sample/sf_rdpsnd.c @@ -0,0 +1,66 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Sample Server (Audio Output) + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 + +#include "sf_rdpsnd.h" + +static const rdpsndFormat test_audio_formats[] = +{ + { 0x11, 2, 22050, 1024, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 2 channels */ + { 0x11, 1, 22050, 512, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 1 channels */ + { 0x01, 2, 22050, 4, 16, 0, NULL }, /* PCM, 22050 Hz, 2 channels, 16 bits */ + { 0x01, 1, 22050, 2, 16, 0, NULL }, /* PCM, 22050 Hz, 1 channels, 16 bits */ + { 0x01, 2, 44100, 4, 16, 0, NULL }, /* PCM, 44100 Hz, 2 channels, 16 bits */ + { 0x01, 1, 44100, 2, 16, 0, NULL }, /* PCM, 44100 Hz, 1 channels, 16 bits */ + { 0x01, 2, 11025, 4, 16, 0, NULL }, /* PCM, 11025 Hz, 2 channels, 16 bits */ + { 0x01, 1, 11025, 2, 16, 0, NULL }, /* PCM, 11025 Hz, 1 channels, 16 bits */ + { 0x01, 2, 8000, 4, 16, 0, NULL }, /* PCM, 8000 Hz, 2 channels, 16 bits */ + { 0x01, 1, 8000, 2, 16, 0, NULL } /* PCM, 8000 Hz, 1 channels, 16 bits */ +}; + +static void sf_peer_rdpsnd_activated(rdpsnd_server_context* context) +{ + printf("RDPSND Activated\n"); +} + +BOOL sf_peer_rdpsnd_init(testPeerContext* context) +{ + context->rdpsnd = rdpsnd_server_context_new(context->vcm); + context->rdpsnd->data = context; + + context->rdpsnd->server_formats = test_audio_formats; + context->rdpsnd->num_server_formats = + sizeof(test_audio_formats) / sizeof(test_audio_formats[0]); + + context->rdpsnd->src_format.wFormatTag = 1; + context->rdpsnd->src_format.nChannels = 2; + context->rdpsnd->src_format.nSamplesPerSec = 44100; + context->rdpsnd->src_format.wBitsPerSample = 16; + + context->rdpsnd->Activated = sf_peer_rdpsnd_activated; + + context->rdpsnd->Initialize(context->rdpsnd); + + return TRUE; +} diff --git a/server/Sample/sf_rdpsnd.h b/server/Sample/sf_rdpsnd.h new file mode 100644 index 000000000..ce2875f17 --- /dev/null +++ b/server/Sample/sf_rdpsnd.h @@ -0,0 +1,32 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Sample Server (Audio Output) + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 SF_RDPSND_H +#define SF_RDPSND_H + +#include +#include +#include + +#include "sfreerdp.h" + +BOOL sf_peer_rdpsnd_init(testPeerContext* context); + +#endif /* SF_RDPSND_H */ + diff --git a/server/Sample/tfreerdp.c b/server/Sample/sfreerdp.c similarity index 76% rename from server/Sample/tfreerdp.c rename to server/Sample/sfreerdp.c index d3052ccc7..9c4cf489f 100644 --- a/server/Sample/tfreerdp.c +++ b/server/Sample/sfreerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Test Server * * Copyright 2011 Marc-Andre Moreau @@ -30,18 +30,20 @@ #include #include +#include + #include #include #include -#include -#include -#include -#include -#include -#include +#include + +#include "sf_audin.h" +#include "sf_rdpsnd.h" + +#include "sfreerdp.h" static char* test_pcap_file = NULL; -static boolean test_dump_rfx_realtime = true; +static BOOL test_dump_rfx_realtime = TRUE; /* HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, LL3 */ static const unsigned int test_quantization_values[] = @@ -49,43 +51,6 @@ static const unsigned int test_quantization_values[] = 6, 6, 6, 6, 7, 7, 8, 8, 8, 9 }; -static const rdpsndFormat test_audio_formats[] = -{ - { 0x11, 2, 22050, 1024, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 2 channels */ - { 0x11, 1, 22050, 512, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 1 channels */ - { 0x01, 2, 22050, 4, 16, 0, NULL }, /* PCM, 22050 Hz, 2 channels, 16 bits */ - { 0x01, 1, 22050, 2, 16, 0, NULL }, /* PCM, 22050 Hz, 1 channels, 16 bits */ - { 0x01, 2, 44100, 4, 16, 0, NULL }, /* PCM, 44100 Hz, 2 channels, 16 bits */ - { 0x01, 1, 44100, 2, 16, 0, NULL }, /* PCM, 44100 Hz, 1 channels, 16 bits */ - { 0x01, 2, 11025, 4, 16, 0, NULL }, /* PCM, 11025 Hz, 2 channels, 16 bits */ - { 0x01, 1, 11025, 2, 16, 0, NULL }, /* PCM, 11025 Hz, 1 channels, 16 bits */ - { 0x01, 2, 8000, 4, 16, 0, NULL }, /* PCM, 8000 Hz, 2 channels, 16 bits */ - { 0x01, 1, 8000, 2, 16, 0, NULL } /* PCM, 8000 Hz, 1 channels, 16 bits */ -}; - -struct test_peer_context -{ - rdpContext _p; - - RFX_CONTEXT* rfx_context; - NSC_CONTEXT* nsc_context; - STREAM* s; - uint8* icon_data; - uint8* bg_data; - int icon_width; - int icon_height; - int icon_x; - int icon_y; - boolean activated; - WTSVirtualChannelManager* vcm; - void* debug_channel; - freerdp_thread* debug_channel_thread; - audin_server_context* audin; - boolean audin_open; - uint32 frame_id; -}; -typedef struct test_peer_context testPeerContext; - void test_peer_context_new(freerdp_peer* client, testPeerContext* context) { context->rfx_context = rfx_context_new(); @@ -114,19 +79,23 @@ void test_peer_context_free(freerdp_peer* client, testPeerContext* context) freerdp_thread_stop(context->debug_channel_thread); freerdp_thread_free(context->debug_channel_thread); } + stream_free(context->s); - xfree(context->icon_data); - xfree(context->bg_data); + free(context->icon_data); + free(context->bg_data); + rfx_context_free(context->rfx_context); nsc_context_free(context->nsc_context); + if (context->debug_channel) - { WTSVirtualChannelClose(context->debug_channel); - } + if (context->audin) - { audin_server_context_free(context->audin); - } + + if (context->rdpsnd) + rdpsnd_server_context_free(context->rdpsnd); + WTSDestroyVirtualChannelManager(context->vcm); } } @@ -172,13 +141,13 @@ static void test_peer_end_frame(freerdp_peer* client) static void test_peer_draw_background(freerdp_peer* client) { - testPeerContext* context = (testPeerContext*) client->context; - rdpUpdate* update = client->update; - SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command; + int size; STREAM* s; RFX_RECT rect; - uint8* rgb_data; - int size; + BYTE* rgb_data; + rdpUpdate* update = client->update; + SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command; + testPeerContext* context = (testPeerContext*) client->context; if (!client->settings->rfx_codec && !client->settings->ns_codec) return; @@ -193,7 +162,7 @@ static void test_peer_draw_background(freerdp_peer* client) rect.height = client->settings->height; size = rect.width * rect.height * 3; - rgb_data = xmalloc(size); + rgb_data = malloc(size); memset(rgb_data, 0xA0, size); if (client->settings->rfx_codec) @@ -220,7 +189,7 @@ static void test_peer_draw_background(freerdp_peer* client) cmd->bitmapData = stream_get_head(s); update->SurfaceBits(update->context, cmd); - xfree(rgb_data); + free(rgb_data); test_peer_end_frame(client); } @@ -231,7 +200,7 @@ static void test_peer_load_icon(freerdp_peer* client) FILE* fp; int i; char line[50]; - uint8* rgb_data; + BYTE* rgb_data; int c; if (!client->settings->rfx_codec && !client->settings->ns_codec) @@ -250,36 +219,38 @@ static void test_peer_load_icon(freerdp_peer* client) /* Max */ fgets(line, sizeof(line), fp); - rgb_data = xmalloc(context->icon_width * context->icon_height * 3); + rgb_data = malloc(context->icon_width * context->icon_height * 3); for (i = 0; i < context->icon_width * context->icon_height * 3; i++) { if (fgets(line, sizeof(line), fp)) { sscanf(line, "%d", &c); - rgb_data[i] = (uint8)c; + rgb_data[i] = (BYTE)c; } } context->icon_data = rgb_data; /* background with same size, which will be used to erase the icon from old position */ - context->bg_data = xmalloc(context->icon_width * context->icon_height * 3); + context->bg_data = malloc(context->icon_width * context->icon_height * 3); memset(context->bg_data, 0xA0, context->icon_width * context->icon_height * 3); } static void test_peer_draw_icon(freerdp_peer* client, int x, int y) { - testPeerContext* context = (testPeerContext*) client->context; + STREAM* s; + RFX_RECT rect; rdpUpdate* update = client->update; SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command; - RFX_RECT rect; - STREAM* s; + testPeerContext* context = (testPeerContext*) client->context; if (client->update->dump_rfx) return; + if (!context) return; + if (context->icon_width < 1 || !context->activated) return; @@ -319,6 +290,7 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y) } s = test_peer_stream_init(context); + if (client->settings->rfx_codec) { rfx_compose_message(context->rfx_context, s, @@ -349,15 +321,15 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y) test_peer_end_frame(client); } -static boolean test_sleep_tsdiff(uint32 *old_sec, uint32 *old_usec, uint32 new_sec, uint32 new_usec) +static BOOL test_sleep_tsdiff(UINT32 *old_sec, UINT32 *old_usec, UINT32 new_sec, UINT32 new_usec) { - sint32 sec, usec; + INT32 sec, usec; if (*old_sec==0 && *old_usec==0) { *old_sec = new_sec; *old_usec = new_usec; - return true; + return TRUE; } sec = new_sec - *old_sec; @@ -366,7 +338,7 @@ static boolean test_sleep_tsdiff(uint32 *old_sec, uint32 *old_usec, uint32 new_s if (sec<0 || (sec==0 && usec<0)) { printf("Invalid time stamp detected.\n"); - return false; + return FALSE; } *old_sec = new_sec; @@ -384,21 +356,21 @@ static boolean test_sleep_tsdiff(uint32 *old_sec, uint32 *old_usec, uint32 new_s if (usec > 0) freerdp_usleep(usec); - return true; + return TRUE; } void tf_peer_dump_rfx(freerdp_peer* client) { STREAM* s; - uint32 prev_seconds; - uint32 prev_useconds; + UINT32 prev_seconds; + UINT32 prev_useconds; rdpUpdate* update; rdpPcap* pcap_rfx; pcap_record record; s = stream_new(512); update = client->update; - client->update->pcap_rfx = pcap_open(test_pcap_file, false); + client->update->pcap_rfx = pcap_open(test_pcap_file, FALSE); pcap_rfx = client->update->pcap_rfx; if (pcap_rfx == NULL) @@ -410,14 +382,14 @@ void tf_peer_dump_rfx(freerdp_peer* client) { pcap_get_next_record_header(pcap_rfx, &record); - s->data = xrealloc(s->data, record.length); + s->data = realloc(s->data, record.length); record.data = s->data; s->size = record.length; pcap_get_next_record_content(pcap_rfx, &record); s->p = s->data + s->size; - if (test_dump_rfx_realtime && test_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == false) + if (test_dump_rfx_realtime && test_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == FALSE) break; update->SurfaceCommand(update->context, s); @@ -429,11 +401,11 @@ static void* tf_debug_channel_thread_func(void* arg) void* fd; STREAM* s; void* buffer; - uint32 bytes_returned = 0; + UINT32 bytes_returned = 0; testPeerContext* context = (testPeerContext*) arg; freerdp_thread* thread = context->debug_channel_thread; - if (WTSVirtualChannelQuery(context->debug_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == true) + if (WTSVirtualChannelQuery(context->debug_channel, WTSVirtualFileHandle, &buffer, &bytes_returned) == TRUE) { fd = *((void**)buffer); WTSFreeMemory(buffer); @@ -442,28 +414,33 @@ static void* tf_debug_channel_thread_func(void* arg) s = stream_new(4096); - WTSVirtualChannelWrite(context->debug_channel, (uint8*) "test1", 5, NULL); + WTSVirtualChannelWrite(context->debug_channel, (BYTE*) "test1", 5, NULL); while (1) { freerdp_thread_wait(thread); + if (freerdp_thread_is_stopped(thread)) break; stream_set_pos(s, 0); + if (WTSVirtualChannelRead(context->debug_channel, 0, stream_get_head(s), - stream_get_size(s), &bytes_returned) == false) + stream_get_size(s), &bytes_returned) == FALSE) { if (bytes_returned == 0) break; + stream_check_size(s, bytes_returned); + if (WTSVirtualChannelRead(context->debug_channel, 0, stream_get_head(s), - stream_get_size(s), &bytes_returned) == false) + stream_get_size(s), &bytes_returned) == FALSE) { /* should not happen */ break; } } + stream_set_pos(s, bytes_returned); printf("got %d bytes\n", bytes_returned); @@ -475,24 +452,7 @@ static void* tf_debug_channel_thread_func(void* arg) return 0; } -static void tf_peer_audin_opening(audin_server_context* context) -{ - printf("AUDIN opening.\n"); - /* Simply choose the first format supported by the client. */ - context->SelectFormat(context, 0); -} - -static void tf_peer_audin_open_result(audin_server_context* context, uint32 result) -{ - printf("AUDIN open result %d.\n", result); -} - -static void tf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes) -{ - printf("AUDIN recieve %d frames.\n", nframes); -} - -boolean tf_peer_post_connect(freerdp_peer* client) +BOOL tf_peer_post_connect(freerdp_peer* client) { int i; testPeerContext* context = (testPeerContext*) client->context; @@ -503,8 +463,10 @@ boolean tf_peer_post_connect(freerdp_peer* client) * The server may start sending graphics output and receiving keyboard/mouse input after this * callback returns. */ + printf("Client %s is activated (osMajorType %d osMinorType %d)", client->local ? "(local)" : client->hostname, - client->settings->os_major_type, client->settings->os_minor_type); + client->settings->os_major_type, client->settings->os_minor_type); + if (client->settings->autologon) { printf(" and wants to login automatically as %s\\%s", @@ -522,6 +484,7 @@ boolean tf_peer_post_connect(freerdp_peer* client) test_peer_load_icon(client); /* Iterate all channel names requested by the client and activate those supported by the server */ + for (i = 0; i < client->settings->num_channels; i++) { if (client->settings->channels[i].joined) @@ -529,6 +492,7 @@ boolean tf_peer_post_connect(freerdp_peer* client) if (strncmp(client->settings->channels[i].name, "rdpdbg", 6) == 0) { context->debug_channel = WTSVirtualChannelOpenEx(context->vcm, "rdpdbg", 0); + if (context->debug_channel != NULL) { printf("Open channel rdpdbg.\n"); @@ -537,37 +501,32 @@ boolean tf_peer_post_connect(freerdp_peer* client) tf_debug_channel_thread_func, context); } } + else if (strncmp(client->settings->channels[i].name, "rdpsnd", 6) == 0) + { + sf_peer_rdpsnd_init(context); /* Audio Output */ + } } } - context->audin = audin_server_context_new(context->vcm); - context->audin->data = context; - context->audin->server_formats = test_audio_formats; - context->audin->num_server_formats = ARRAY_SIZE(test_audio_formats); + /* Dynamic Virtual Channels */ - context->audin->dst_format.wFormatTag = 1; /* Final output format, PCM only */ - context->audin->dst_format.nChannels = 2; - context->audin->dst_format.nSamplesPerSec = 44100; - context->audin->dst_format.wBitsPerSample = 16; + sf_peer_audin_init(context); /* Audio Input */ - context->audin->Opening = tf_peer_audin_opening; - context->audin->OpenResult = tf_peer_audin_open_result; - context->audin->ReceiveSamples = tf_peer_audin_receive_samples; + /* Return FALSE here would stop the execution of the peer mainloop. */ - /* Return false here would stop the execution of the peer mainloop. */ - return true; + return TRUE; } -boolean tf_peer_activate(freerdp_peer* client) +BOOL tf_peer_activate(freerdp_peer* client) { testPeerContext* context = (testPeerContext*) client->context; rfx_context_reset(context->rfx_context); - context->activated = true; + context->activated = TRUE; if (test_pcap_file != NULL) { - client->update->dump_rfx = true; + client->update->dump_rfx = TRUE; tf_peer_dump_rfx(client); } else @@ -575,15 +534,15 @@ boolean tf_peer_activate(freerdp_peer* client) test_peer_draw_background(client); } - return true; + return TRUE; } -void tf_peer_synchronize_event(rdpInput* input, uint32 flags) +void tf_peer_synchronize_event(rdpInput* input, UINT32 flags) { printf("Client sent a synchronize event (flags:0x%X)\n", flags); } -void tf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { freerdp_peer* client = input->context->peer; rdpUpdate* update = client->update; @@ -591,7 +550,7 @@ void tf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) printf("Client sent a keyboard event (flags:0x%X code:0x%X)\n", flags, code); - if ((flags & 0x4000) && code == 0x1F) /* 's' key */ + if ((flags & 0x4000) && code == 0x22) /* 'g' key */ { if (client->settings->width != 800) { @@ -604,13 +563,13 @@ void tf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) client->settings->height = 480; } update->DesktopResize(update->context); - context->activated = false; + context->activated = FALSE; } else if ((flags & 0x4000) && code == 0x2E) /* 'c' key */ { if (context->debug_channel) { - WTSVirtualChannelWrite(context->debug_channel, (uint8*) "test2", 5, NULL); + WTSVirtualChannelWrite(context->debug_channel, (BYTE*) "test2", 5, NULL); } } else if ((flags & 0x4000) && code == 0x2D) /* 'x' key */ @@ -622,36 +581,40 @@ void tf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) if (!context->audin_open) { context->audin->Open(context->audin); - context->audin_open = true; + context->audin_open = TRUE; } else { context->audin->Close(context->audin); - context->audin_open = false; + context->audin_open = FALSE; } } + else if ((flags & 0x4000) && code == 0x1F) /* 's' key */ + { + + } } -void tf_peer_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { printf("Client sent a unicode keyboard event (flags:0x%X code:0x%X)\n", flags, code); } -void tf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { - printf("Client sent a mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); + //printf("Client sent a mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); test_peer_draw_icon(input->context->peer, x + 10, y); } -void tf_peer_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { - printf("Client sent an extended mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); + //printf("Client sent an extended mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y); } -static void tf_peer_refresh_rect(rdpContext* context, uint8 count, RECTANGLE_16* areas) +static void tf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas) { - uint8 i; + BYTE i; printf("Client requested to refresh:\n"); @@ -661,7 +624,7 @@ static void tf_peer_refresh_rect(rdpContext* context, uint8 count, RECTANGLE_16* } } -static void tf_peer_suppress_output(rdpContext* context, uint8 allow, RECTANGLE_16* area) +static void tf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area) { if (allow > 0) { @@ -689,12 +652,12 @@ static void* test_peer_mainloop(void* arg) test_peer_init(client); /* Initialize the real server settings here */ - client->settings->cert_file = xstrdup("server.crt"); - client->settings->privatekey_file = xstrdup("server.key"); - client->settings->nla_security = false; - client->settings->rfx_codec = true; - client->settings->suppress_output = true; - client->settings->refresh_rect = true; + client->settings->cert_file = _strdup("server.crt"); + client->settings->privatekey_file = _strdup("server.key"); + client->settings->nla_security = FALSE; + client->settings->rfx_codec = TRUE; + client->settings->suppress_output = TRUE; + client->settings->refresh_rect = TRUE; client->PostConnect = tf_peer_post_connect; client->Activate = tf_peer_activate; @@ -717,7 +680,7 @@ static void* test_peer_mainloop(void* arg) { rcount = 0; - if (client->GetFileDescriptor(client, rfds, &rcount) != true) + if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); break; @@ -753,9 +716,9 @@ static void* test_peer_mainloop(void* arg) } } - if (client->CheckFileDescriptor(client) != true) + if (client->CheckFileDescriptor(client) != TRUE) break; - if (WTSVirtualChannelManagerCheckFileDescriptor(context->vcm) != true) + if (WTSVirtualChannelManagerCheckFileDescriptor(context->vcm) != TRUE) break; } @@ -791,7 +754,7 @@ static void test_server_mainloop(freerdp_listener* instance) { rcount = 0; - if (instance->GetFileDescriptor(instance, rfds, &rcount) != true) + if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); break; @@ -826,7 +789,7 @@ static void test_server_mainloop(freerdp_listener* instance) } } - if (instance->CheckFileDescriptor(instance) != true) + if (instance->CheckFileDescriptor(instance) != TRUE) { printf("Failed to check FreeRDP file descriptor\n"); break; @@ -851,7 +814,7 @@ int main(int argc, char* argv[]) test_pcap_file = argv[1]; if (argc > 2 && !strcmp(argv[2], "--fast")) - test_dump_rfx_realtime = false; + test_dump_rfx_realtime = FALSE; /* Open the server socket and start listening. */ if (instance->Open(instance, NULL, 3389) && diff --git a/server/Sample/sfreerdp.h b/server/Sample/sfreerdp.h new file mode 100644 index 000000000..a0b497627 --- /dev/null +++ b/server/Sample/sfreerdp.h @@ -0,0 +1,57 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Sample Server + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 SFREERDP_SERVER_H +#define SFREERDP_SERVER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +struct test_peer_context +{ + rdpContext _p; + + RFX_CONTEXT* rfx_context; + NSC_CONTEXT* nsc_context; + STREAM* s; + BYTE* icon_data; + BYTE* bg_data; + int icon_width; + int icon_height; + int icon_x; + int icon_y; + BOOL activated; + WTSVirtualChannelManager* vcm; + void* debug_channel; + freerdp_thread* debug_channel_thread; + audin_server_context* audin; + BOOL audin_open; + UINT32 frame_id; + rdpsnd_server_context* rdpsnd; +}; +typedef struct test_peer_context testPeerContext; + +#endif /* SFREERDP_SERVER_H */ + diff --git a/server/Windows/CMakeLists.txt b/server/Windows/CMakeLists.txt index b0d680db4..6c08ac469 100644 --- a/server/Windows/CMakeLists.txt +++ b/server/Windows/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP Windows Server cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -51,7 +51,7 @@ if(WITH_WIN8) set(${MODULE_PREFIX}_LIBS d3d11 dxgi dxguid) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp) else() @@ -62,7 +62,7 @@ else() freerdp-channels) endif() -target_link_libraries(wfreerdp-server ${${MODULE_PREFIX}_LIBS}) +target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) if(WITH_SERVER_INTERFACE) diff --git a/server/Windows/cli/CMakeLists.txt b/server/Windows/cli/CMakeLists.txt index f7d2ade5a..fdecbbb43 100644 --- a/server/Windows/cli/CMakeLists.txt +++ b/server/Windows/cli/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP Windows Server (CLI) cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(MODULE_NAME "wfreerdp-server") +set(MODULE_NAME "wfreerdp-server-cli") set(MODULE_PREFIX "FREERDP_SERVER_WINDOWS_CLI") include_directories(..) diff --git a/server/Windows/cli/wfreerdp.c b/server/Windows/cli/wfreerdp.c index a90c50b75..b40e796de 100644 --- a/server/Windows/cli/wfreerdp.c +++ b/server/Windows/cli/wfreerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau diff --git a/server/Windows/cli/wfreerdp.h b/server/Windows/cli/wfreerdp.h index 68e3fad10..f3ab71cb0 100644 --- a/server/Windows/cli/wfreerdp.h +++ b/server/Windows/cli/wfreerdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau diff --git a/server/Windows/wf_dxgi.c b/server/Windows/wf_dxgi.c index 1869932f6..4a22a546f 100644 --- a/server/Windows/wf_dxgi.c +++ b/server/Windows/wf_dxgi.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Corey Clayton diff --git a/server/Windows/wf_dxgi.h b/server/Windows/wf_dxgi.h index 9f3d96f6b..c7b73b803 100644 --- a/server/Windows/wf_dxgi.h +++ b/server/Windows/wf_dxgi.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Corey Clayton diff --git a/server/Windows/wf_info.c b/server/Windows/wf_info.c index addd7e132..15fa7edbb 100644 --- a/server/Windows/wf_info.c +++ b/server/Windows/wf_info.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Corey Clayton @@ -295,7 +295,7 @@ BOOL wf_info_have_invalid_region(wfInfo* wfi) return IsRectEmpty(&wfi->invalid); } -void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, uint8** pBits, int* pitch) +void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, BYTE** pBits, int* pitch) { *width = (wfi->invalid.right - wfi->invalid.left); *height = (wfi->invalid.bottom - wfi->invalid.top); @@ -312,7 +312,7 @@ void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, uint8** pBits *height += 1; offset = (4 * wfi->invalid.left) + (wfi->invalid.top * wfi->width * 4); - *pBits = ((uint8*) (changes->Userbuffer)) + offset; + *pBits = ((BYTE*) (changes->Userbuffer)) + offset; *pitch = wfi->width * 4; } #endif diff --git a/server/Windows/wf_info.h b/server/Windows/wf_info.h index c23ad872b..bad196d21 100644 --- a/server/Windows/wf_info.h +++ b/server/Windows/wf_info.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Corey Clayton @@ -36,6 +36,6 @@ void wf_info_find_invalid_region(wfInfo* wfi); void wf_info_clear_invalid_region(wfInfo* wfi); void wf_info_invalidate_full_screen(wfInfo* wfi); BOOL wf_info_have_invalid_region(wfInfo* wfi); -void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, uint8** pBits, int* pitch); +void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, BYTE** pBits, int* pitch); #endif /* WF_INFO_H */ \ No newline at end of file diff --git a/server/Windows/wf_input.c b/server/Windows/wf_input.c index a802d2ca2..09fd9b077 100644 --- a/server/Windows/wf_input.c +++ b/server/Windows/wf_input.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau @@ -25,7 +25,7 @@ #include "wf_input.h" -void wf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { INPUT keyboard_event; @@ -45,7 +45,7 @@ void wf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code) SendInput(1, &keyboard_event, sizeof(INPUT)); } -void wf_peer_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { INPUT keyboard_event; @@ -62,7 +62,7 @@ void wf_peer_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) SendInput(1, &keyboard_event, sizeof(INPUT)); } -void wf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { INPUT mouse_event; float width, height; @@ -127,7 +127,7 @@ void wf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) } } -void wf_peer_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { if ((flags & PTR_XFLAGS_BUTTON1) || (flags & PTR_XFLAGS_BUTTON2)) { diff --git a/server/Windows/wf_input.h b/server/Windows/wf_input.h index d06c2ed74..8409cfdb0 100644 --- a/server/Windows/wf_input.h +++ b/server/Windows/wf_input.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau @@ -22,9 +22,9 @@ #include "wf_interface.h" -void wf_peer_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void wf_peer_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void wf_peer_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); -void wf_peer_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); +void wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); +void wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); #endif /* WF_INPUT_H */ diff --git a/server/Windows/wf_interface.c b/server/Windows/wf_interface.c index b144a5655..3a50a9dd8 100644 --- a/server/Windows/wf_interface.c +++ b/server/Windows/wf_interface.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau @@ -46,7 +46,7 @@ DWORD WINAPI wf_server_main_loop(LPVOID lpParam) { rcount = 0; - if (instance->GetFileDescriptor(instance, rfds, &rcount) != true) + if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); break; @@ -70,7 +70,7 @@ DWORD WINAPI wf_server_main_loop(LPVOID lpParam) select(max_fds + 1, &rfds_set, NULL, NULL, NULL); - if (instance->CheckFileDescriptor(instance) != true) + if (instance->CheckFileDescriptor(instance) != TRUE) { printf("Failed to check FreeRDP file descriptor\n"); break; @@ -92,7 +92,7 @@ BOOL wfreerdp_server_start(wfServer* server) wf_settings_read_dword(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\Server"), _T("DefaultPort"), &server->port); - if (instance->Open(instance, NULL, (uint16) server->port)) + if (instance->Open(instance, NULL, (UINT16) server->port)) { server->thread = CreateThread(NULL, 0, wf_server_main_loop, (void*) instance, 0, NULL); return TRUE; diff --git a/server/Windows/wf_interface.h b/server/Windows/wf_interface.h index 587d8305c..827501593 100644 --- a/server/Windows/wf_interface.h +++ b/server/Windows/wf_interface.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau diff --git a/server/Windows/wf_mirage.c b/server/Windows/wf_mirage.c index c18b01e0f..150a5caae 100644 --- a/server/Windows/wf_mirage.c +++ b/server/Windows/wf_mirage.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau @@ -26,8 +26,8 @@ /* This function will iterate over the loaded display devices until it finds the mirror device we want to load. If found, it will then copy the registry -key corresponding to the device to the context and returns true. Otherwise -the function returns false. +key corresponding to the device to the context and returns TRUE. Otherwise +the function returns FALSE. */ BOOL wf_mirror_driver_find_display_device(wfInfo* context) { @@ -71,11 +71,11 @@ BOOL wf_mirror_driver_find_display_device(wfInfo* context) /** * This function will attempt to access the the windows registry using the device * key stored in the current context. It will attempt to read the value of the - * "Attach.ToDesktop" subkey and will return true if the value is already set to - * val. If unable to read the subkey, this function will return false. If the - * subkey is not set to val it will then attempt to set it to val and return true. If + * "Attach.ToDesktop" subkey and will return TRUE if the value is already set to + * val. If unable to read the subkey, this function will return FALSE. If the + * subkey is not set to val it will then attempt to set it to val and return TRUE. If * unsuccessful or an unexpected value is encountered, the function returns - * false. + * FALSE. */ BOOL wf_mirror_driver_display_device_attach(wfInfo* context, DWORD mode) @@ -165,8 +165,8 @@ void wf_mirror_driver_print_display_change_status(LONG status) /** * This function will attempt to apply the currently configured display settings - * in the registry to the display driver. It will return true if successful - * otherwise it returns false. + * in the registry to the display driver. It will return TRUE if successful + * otherwise it returns FALSE. * If unload is nonzero then the the driver will be asked to remove itself. */ diff --git a/server/Windows/wf_mirage.h b/server/Windows/wf_mirage.h index 50a6b40e8..9287695d2 100644 --- a/server/Windows/wf_mirage.h +++ b/server/Windows/wf_mirage.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau diff --git a/server/Windows/wf_peer.c b/server/Windows/wf_peer.c index 7a18894a8..74e454911 100644 --- a/server/Windows/wf_peer.c +++ b/server/Windows/wf_peer.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau @@ -57,7 +57,7 @@ void wf_peer_init(freerdp_peer* client) freerdp_peer_context_new(client); } -boolean wf_peer_post_connect(freerdp_peer* client) +BOOL wf_peer_post_connect(freerdp_peer* client) { HDC hdc; wfInfo* wfi; @@ -85,10 +85,10 @@ boolean wf_peer_post_connect(freerdp_peer* client) client->update->DesktopResize(client->update->context); } - return true; + return TRUE; } -boolean wf_peer_activate(freerdp_peer* client) +BOOL wf_peer_activate(freerdp_peer* client) { wfInfo* wfi; wfPeerContext* context = (wfPeerContext*) client->context; @@ -96,13 +96,13 @@ boolean wf_peer_activate(freerdp_peer* client) printf("PeerActivate\n"); wfi = context->info; - client->activated = true; + client->activated = TRUE; wf_update_peer_activate(wfi, context); - return true; + return TRUE; } -boolean wf_peer_logon(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identity, boolean automatic) +BOOL wf_peer_logon(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identity, BOOL automatic) { printf("PeerLogon\n"); @@ -112,10 +112,10 @@ boolean wf_peer_logon(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identity, b identity->User, identity->Domain, identity->Password); } - return true; + return TRUE; } -void wf_peer_synchronize_event(rdpInput* input, uint32 flags) +void wf_peer_synchronize_event(rdpInput* input, UINT32 flags) { } @@ -144,7 +144,7 @@ DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam) { rcount = 0; - if (client->GetFileDescriptor(client, rfds, &rcount) != true) + if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE) { printf("Failed to get peer file descriptor\n"); break; @@ -202,9 +202,9 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam) wf_peer_init(client); settings = client->settings; - settings->rfx_codec = true; - settings->ns_codec = false; - settings->jpeg_codec = false; + settings->rfx_codec = TRUE; + settings->ns_codec = FALSE; + settings->jpeg_codec = FALSE; wf_peer_read_settings(client); client->PostConnect = wf_peer_post_connect; @@ -256,7 +256,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam) if (WaitForSingleObject(context->socketEvent, 0) == 0) { - if (client->CheckFileDescriptor(client) != true) + if (client->CheckFileDescriptor(client) != TRUE) { printf("Failed to check peer file descriptor\n"); context->socketClose = TRUE; diff --git a/server/Windows/wf_peer.h b/server/Windows/wf_peer.h index 0fdf27631..0aa76f82a 100644 --- a/server/Windows/wf_peer.h +++ b/server/Windows/wf_peer.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau @@ -34,10 +34,10 @@ void wf_peer_init(freerdp_peer* client); void wf_dxgi_encode(freerdp_peer* client, UINT timeout); void wf_rfx_encode(freerdp_peer* client); -boolean wf_peer_post_connect(freerdp_peer* client); -boolean wf_peer_activate(freerdp_peer* client); +BOOL wf_peer_post_connect(freerdp_peer* client); +BOOL wf_peer_activate(freerdp_peer* client); -void wf_peer_synchronize_event(rdpInput* input, uint32 flags); +void wf_peer_synchronize_event(rdpInput* input, UINT32 flags); void wf_peer_send_changes(freerdp_peer* client); diff --git a/server/Windows/wf_settings.c b/server/Windows/wf_settings.c index 5167e4f19..c5e703ffe 100644 --- a/server/Windows/wf_settings.c +++ b/server/Windows/wf_settings.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau diff --git a/server/Windows/wf_settings.h b/server/Windows/wf_settings.h index a0f7eb935..c116fa20b 100644 --- a/server/Windows/wf_settings.h +++ b/server/Windows/wf_settings.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau diff --git a/server/Windows/wf_update.c b/server/Windows/wf_update.c index 5242ad442..95768fc12 100644 --- a/server/Windows/wf_update.c +++ b/server/Windows/wf_update.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau @@ -107,7 +107,7 @@ void wf_update_encode(wfInfo* wfi) RFX_RECT rect; long height, width; - uint8* pDataBits = NULL; + BYTE* pDataBits = NULL; int stride; SURFACE_BITS_COMMAND* cmd; @@ -122,8 +122,8 @@ void wf_update_encode(wfInfo* wfi) rect.x = 0; rect.y = 0; - rect.width = (uint16) width; - rect.height = (uint16) height; + rect.width = (UINT16) width; + rect.height = (UINT16) height; //printf("x:%d y:%d w:%d h:%d\n", wfi->invalid.left, wfi->invalid.top, width, height); @@ -239,7 +239,7 @@ void wf_update_peer_deactivate(wfInfo* wfi, wfPeerContext* context) wf_mirror_driver_deactivate(wfi); } - client->activated = false; + client->activated = FALSE; wfi->activePeerCount--; printf("Deactivating Peer Updates: %d\n", wfi->activePeerCount); diff --git a/server/Windows/wf_update.h b/server/Windows/wf_update.h index 3f6a4fd94..0fb9c46bd 100644 --- a/server/Windows/wf_update.h +++ b/server/Windows/wf_update.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP Windows Server * * Copyright 2012 Marc-Andre Moreau diff --git a/server/X11/CMakeLists.txt b/server/X11/CMakeLists.txt index a2fe3f03e..c6282174f 100644 --- a/server/X11/CMakeLists.txt +++ b/server/X11/CMakeLists.txt @@ -1,4 +1,4 @@ -# FreeRDP: A Remote Desktop Protocol Client +# FreeRDP: A Remote Desktop Protocol Implementation # FreeRDP X11 Server cmake build script # # Copyright 2012 Marc-Andre Moreau @@ -63,7 +63,7 @@ if(WITH_XTEST) target_link_libraries(${MODULE_NAME} ${XTEST_LIBRARIES}) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(${MODULE_NAME} freerdp) target_link_libraries(${MODULE_NAME} winpr) else() diff --git a/server/X11/xf_encode.c b/server/X11/xf_encode.c index 5a941ceb6..94ba317c9 100644 --- a/server/X11/xf_encode.c +++ b/server/X11/xf_encode.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 RemoteFX Encoder * * Copyright 2011 Marc-Andre Moreau @@ -81,7 +81,7 @@ void* xf_frame_rate_thread(void* param) xfEvent* event; xfPeerContext* xfp; freerdp_peer* client; - uint32 wait_interval; + UINT32 wait_interval; client = (freerdp_peer*) param; xfp = (xfPeerContext*) client->context; @@ -110,7 +110,7 @@ void* xf_monitor_updates(void* param) int pending_events; xfPeerContext* xfp; freerdp_peer* client; - uint32 wait_interval; + UINT32 wait_interval; struct timeval timeout; int x, y, width, height; XDamageNotifyEvent* notify; diff --git a/server/X11/xf_encode.h b/server/X11/xf_encode.h index 82b68cf14..f84b3f48e 100644 --- a/server/X11/xf_encode.h +++ b/server/X11/xf_encode.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 RemoteFX Encoder * * Copyright 2011 Marc-Andre Moreau diff --git a/server/X11/xf_event.c b/server/X11/xf_event.c index 1a3780792..5086a5ca3 100644 --- a/server/X11/xf_event.c +++ b/server/X11/xf_event.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Server Event Handling * * Copyright 2011 Marc-Andre Moreau @@ -96,7 +96,7 @@ void xf_event_push(xfEventQueue* event_queue, xfEvent* event) if (event_queue->count >= event_queue->size) { event_queue->size *= 2; - event_queue->events = (xfEvent**) xrealloc((void*) event_queue->events, sizeof(xfEvent*) * event_queue->size); + event_queue->events = (xfEvent**) realloc((void*) event_queue->events, sizeof(xfEvent*) * event_queue->size); } event_queue->events[(event_queue->count)++] = event; @@ -161,7 +161,7 @@ xfEventRegion* xf_event_region_new(int x, int y, int width, int height) void xf_event_region_free(xfEventRegion* event_region) { - xfree(event_region); + free(event_region); } xfEvent* xf_event_new(int type) @@ -173,7 +173,7 @@ xfEvent* xf_event_new(int type) void xf_event_free(xfEvent* event) { - xfree(event); + free(event); } xfEventQueue* xf_event_queue_new() diff --git a/server/X11/xf_event.h b/server/X11/xf_event.h index aca80172d..1b983b940 100644 --- a/server/X11/xf_event.h +++ b/server/X11/xf_event.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Server Event Handling * * Copyright 2011 Marc-Andre Moreau diff --git a/server/X11/xf_input.c b/server/X11/xf_input.c index 9d56ab224..a8acf68b4 100644 --- a/server/X11/xf_input.c +++ b/server/X11/xf_input.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Server Input * * Copyright 2011 Marc-Andre Moreau @@ -27,21 +27,21 @@ #include "xf_input.h" -void xf_input_synchronize_event(rdpInput* input, uint32 flags) +void xf_input_synchronize_event(rdpInput* input, UINT32 flags) { printf("Client sent a synchronize event (flags:0x%X)\n", flags); } -void xf_input_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void xf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { #ifdef WITH_XTEST unsigned int keycode; - boolean extended = false; + BOOL extended = FALSE; xfPeerContext* xfp = (xfPeerContext*) input->context; xfInfo* xfi = xfp->info; if (flags & KBD_FLAGS_EXTENDED) - extended = true; + extended = TRUE; keycode = freerdp_keyboard_get_x11_keycode_from_rdp_scancode(code, extended); @@ -63,17 +63,17 @@ void xf_input_keyboard_event(rdpInput* input, uint16 flags, uint16 code) #endif } -void xf_input_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code) +void xf_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { printf("Client sent a unicode keyboard event (flags:0x%X code:0x%X)\n", flags, code); } -void xf_input_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void xf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { #ifdef WITH_XTEST xfPeerContext* xfp = (xfPeerContext*) input->context; int button = 0; - boolean down = false; + BOOL down = FALSE; xfInfo* xfi = xfp->info; pthread_mutex_lock(&(xfp->mutex)); @@ -81,10 +81,10 @@ void xf_input_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) if (flags & PTR_FLAGS_WHEEL) { - boolean negative = false; + BOOL negative = FALSE; if (flags & PTR_FLAGS_WHEEL_NEGATIVE) - negative = true; + negative = TRUE; button = (negative) ? 5 : 4; @@ -104,7 +104,7 @@ void xf_input_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) button = 2; if (flags & PTR_FLAGS_DOWN) - down = true; + down = TRUE; if (button != 0) XTestFakeButtonEvent(xfi->display, button, down, 0); @@ -115,7 +115,7 @@ void xf_input_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) #endif } -void xf_input_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y) +void xf_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { #ifdef WITH_XTEST xfPeerContext* xfp = (xfPeerContext*) input->context; diff --git a/server/X11/xf_input.h b/server/X11/xf_input.h index 34cda06df..201b21b53 100644 --- a/server/X11/xf_input.h +++ b/server/X11/xf_input.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Server Input * * Copyright 2011 Marc-Andre Moreau @@ -24,11 +24,11 @@ #include "xfreerdp.h" -void xf_input_synchronize_event(rdpInput* input, uint32 flags); -void xf_input_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void xf_input_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code); -void xf_input_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); -void xf_input_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y); +void xf_input_synchronize_event(rdpInput* input, UINT32 flags); +void xf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void xf_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +void xf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); +void xf_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); void xf_input_register_callbacks(rdpInput* input); #endif /* __XF_INPUT_H */ diff --git a/server/X11/xf_peer.c b/server/X11/xf_peer.c index 33dd51ca6..d0cf6fc94 100644 --- a/server/X11/xf_peer.c +++ b/server/X11/xf_peer.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Peer * * Copyright 2011 Marc-Andre Moreau @@ -41,7 +41,7 @@ #include extern char* xf_pcap_file; -extern boolean xf_pcap_dump_realtime; +extern BOOL xf_pcap_dump_realtime; #include "xf_event.h" #include "xf_input.h" @@ -179,7 +179,7 @@ xfInfo* xf_info_init() xfi = xnew(xfInfo); - //xfi->use_xshm = true; + //xfi->use_xshm = TRUE; xfi->display = XOpenDisplay(NULL); XInitThreads(); @@ -320,15 +320,15 @@ void xf_peer_live_rfx(freerdp_peer* client) pthread_create(&(xfp->thread), 0, xf_monitor_updates, (void*) client); } -static boolean xf_peer_sleep_tsdiff(uint32 *old_sec, uint32 *old_usec, uint32 new_sec, uint32 new_usec) +static BOOL xf_peer_sleep_tsdiff(UINT32 *old_sec, UINT32 *old_usec, UINT32 new_sec, UINT32 new_usec) { - sint32 sec, usec; + INT32 sec, usec; if (*old_sec == 0 && *old_usec == 0) { *old_sec = new_sec; *old_usec = new_usec; - return true; + return TRUE; } sec = new_sec - *old_sec; @@ -337,7 +337,7 @@ static boolean xf_peer_sleep_tsdiff(uint32 *old_sec, uint32 *old_usec, uint32 ne if (sec < 0 || (sec == 0 && usec < 0)) { printf("Invalid time stamp detected.\n"); - return false; + return FALSE; } *old_sec = new_sec; @@ -355,21 +355,21 @@ static boolean xf_peer_sleep_tsdiff(uint32 *old_sec, uint32 *old_usec, uint32 ne if (usec > 0) freerdp_usleep(usec); - return true; + return TRUE; } void xf_peer_dump_rfx(freerdp_peer* client) { STREAM* s; - uint32 prev_seconds; - uint32 prev_useconds; + UINT32 prev_seconds; + UINT32 prev_useconds; rdpUpdate* update; rdpPcap* pcap_rfx; pcap_record record; s = stream_new(512); update = client->update; - client->update->pcap_rfx = pcap_open(xf_pcap_file, false); + client->update->pcap_rfx = pcap_open(xf_pcap_file, FALSE); pcap_rfx = client->update->pcap_rfx; if (pcap_rfx == NULL) @@ -381,14 +381,14 @@ void xf_peer_dump_rfx(freerdp_peer* client) { pcap_get_next_record_header(pcap_rfx, &record); - s->data = xrealloc(s->data, record.length); + s->data = realloc(s->data, record.length); record.data = s->data; s->size = record.length; pcap_get_next_record_content(pcap_rfx, &record); s->p = s->data + s->size; - if (xf_pcap_dump_realtime && xf_peer_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == false) + if (xf_pcap_dump_realtime && xf_peer_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == FALSE) break; update->SurfaceCommand(update->context, s); @@ -398,7 +398,7 @@ void xf_peer_dump_rfx(freerdp_peer* client) void xf_peer_rfx_update(freerdp_peer* client, int x, int y, int width, int height) { STREAM* s; - uint8* data; + BYTE* data; xfInfo* xfi; RFX_RECT rect; XImage* image; @@ -429,7 +429,7 @@ void xf_peer_rfx_update(freerdp_peer* client, int x, int y, int width, int heigh image = xf_snapshot(xfp, x, y, width, height); - data = (uint8*) image->data; + data = (BYTE*) image->data; data = &data[(y * image->bytes_per_line) + (x * image->bits_per_pixel / 8)]; rfx_compose_message(xfp->rfx_context, s, &rect, 1, data, @@ -450,7 +450,7 @@ void xf_peer_rfx_update(freerdp_peer* client, int x, int y, int width, int heigh image = xf_snapshot(xfp, x, y, width, height); rfx_compose_message(xfp->rfx_context, s, &rect, 1, - (uint8*) image->data, width, height, width * xfi->bytesPerPixel); + (BYTE*) image->data, width, height, width * xfi->bytesPerPixel); cmd->destLeft = x; cmd->destTop = y; @@ -470,20 +470,20 @@ void xf_peer_rfx_update(freerdp_peer* client, int x, int y, int width, int heigh update->SurfaceBits(update->context, cmd); } -boolean xf_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount) +BOOL xf_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount) { xfPeerContext* xfp = (xfPeerContext*) client->context; if (xfp->event_queue->pipe_fd[0] == -1) - return true; + return TRUE; rfds[*rcount] = (void *)(long) xfp->event_queue->pipe_fd[0]; (*rcount)++; - return true; + return TRUE; } -boolean xf_peer_check_fds(freerdp_peer* client) +BOOL xf_peer_check_fds(freerdp_peer* client) { xfInfo* xfi; xfEvent* event; @@ -493,8 +493,8 @@ boolean xf_peer_check_fds(freerdp_peer* client) xfp = (xfPeerContext*) client->context; xfi = xfp->info; - if (xfp->activated == false) - return true; + if (xfp->activated == FALSE) + return TRUE; event = xf_event_peek(xfp->event_queue); @@ -511,7 +511,7 @@ boolean xf_peer_check_fds(freerdp_peer* client) event = xf_event_pop(xfp->event_queue); invalid_region = xfp->hdc->hwnd->invalid; - if (invalid_region->null == false) + if (invalid_region->null == FALSE) { xf_peer_rfx_update(client, invalid_region->x, invalid_region->y, invalid_region->w, invalid_region->h); @@ -524,15 +524,15 @@ boolean xf_peer_check_fds(freerdp_peer* client) } } - return true; + return TRUE; } -boolean xf_peer_capabilities(freerdp_peer* client) +BOOL xf_peer_capabilities(freerdp_peer* client) { - return true; + return TRUE; } -boolean xf_peer_post_connect(freerdp_peer* client) +BOOL xf_peer_post_connect(freerdp_peer* client) { xfInfo* xfi; xfPeerContext* xfp; @@ -572,22 +572,22 @@ boolean xf_peer_post_connect(freerdp_peer* client) client->settings->height = xfi->height; client->update->DesktopResize(client->update->context); - xfp->activated = false; + xfp->activated = FALSE; - /* Return false here would stop the execution of the peer mainloop. */ - return true; + /* Return FALSE here would stop the execution of the peer mainloop. */ + return TRUE; } -boolean xf_peer_activate(freerdp_peer* client) +BOOL xf_peer_activate(freerdp_peer* client) { xfPeerContext* xfp = (xfPeerContext*) client->context; rfx_context_reset(xfp->rfx_context); - xfp->activated = true; + xfp->activated = TRUE; if (xf_pcap_file != NULL) { - client->update->dump_rfx = true; + client->update->dump_rfx = TRUE; xf_peer_dump_rfx(client); } else @@ -596,7 +596,7 @@ boolean xf_peer_activate(freerdp_peer* client) xfp->activations++; } - return true; + return TRUE; } void* xf_peer_main_loop(void* arg) @@ -638,11 +638,11 @@ void* xf_peer_main_loop(void* arg) settings->cert_file = freerdp_construct_path(server_file_path, "server.crt"); settings->privatekey_file = freerdp_construct_path(server_file_path, "server.key"); - settings->nla_security = true; - settings->tls_security = false; - settings->rdp_security = false; + settings->nla_security = TRUE; + settings->tls_security = FALSE; + settings->rdp_security = FALSE; - settings->rfx_codec = true; + settings->rfx_codec = TRUE; client->Capabilities = xf_peer_capabilities; client->PostConnect = xf_peer_post_connect; @@ -656,12 +656,12 @@ void* xf_peer_main_loop(void* arg) { rcount = 0; - if (client->GetFileDescriptor(client, rfds, &rcount) != true) + if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); break; } - if (xf_peer_get_fds(client, rfds, &rcount) != true) + if (xf_peer_get_fds(client, rfds, &rcount) != TRUE) { printf("Failed to get xfreerdp file descriptor\n"); break; @@ -696,12 +696,12 @@ void* xf_peer_main_loop(void* arg) } } - if (client->CheckFileDescriptor(client) != true) + if (client->CheckFileDescriptor(client) != TRUE) { printf("Failed to check freerdp file descriptor\n"); break; } - if ((xf_peer_check_fds(client)) != true) + if ((xf_peer_check_fds(client)) != TRUE) { printf("Failed to check xfreerdp file descriptor\n"); break; diff --git a/server/X11/xf_peer.h b/server/X11/xf_peer.h index 6e15cdb92..5e023513d 100644 --- a/server/X11/xf_peer.h +++ b/server/X11/xf_peer.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * X11 Peer * * Copyright 2011 Marc-Andre Moreau @@ -42,7 +42,7 @@ struct xf_peer_context xfInfo* info; int activations; pthread_t thread; - boolean activated; + BOOL activated; pthread_mutex_t mutex; RFX_CONTEXT* rfx_context; xfEventQueue* event_queue; diff --git a/server/X11/xfreerdp.c b/server/X11/xfreerdp.c index 379209760..d6a28d806 100644 --- a/server/X11/xfreerdp.c +++ b/server/X11/xfreerdp.c @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP X11 Server * * Copyright 2011 Marc-Andre Moreau @@ -36,7 +36,7 @@ #include "xfreerdp.h" char* xf_pcap_file = NULL; -boolean xf_pcap_dump_realtime = true; +BOOL xf_pcap_dump_realtime = TRUE; void xf_server_main_loop(freerdp_listener* instance) { @@ -53,7 +53,7 @@ void xf_server_main_loop(freerdp_listener* instance) { rcount = 0; - if (instance->GetFileDescriptor(instance, rfds, &rcount) != true) + if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE) { printf("Failed to get FreeRDP file descriptor\n"); break; @@ -88,7 +88,7 @@ void xf_server_main_loop(freerdp_listener* instance) } } - if (instance->CheckFileDescriptor(instance) != true) + if (instance->CheckFileDescriptor(instance) != TRUE) { printf("Failed to check FreeRDP file descriptor\n"); break; @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) xf_pcap_file = argv[1]; if (argc > 2 && !strcmp(argv[2], "--fast")) - xf_pcap_dump_realtime = false; + xf_pcap_dump_realtime = FALSE; /* Open the server socket and start listening. */ if (instance->Open(instance, NULL, 3389)) diff --git a/server/X11/xfreerdp.h b/server/X11/xfreerdp.h index 360992372..2fe8659dc 100644 --- a/server/X11/xfreerdp.h +++ b/server/X11/xfreerdp.h @@ -1,5 +1,5 @@ /** - * FreeRDP: A Remote Desktop Protocol Client + * FreeRDP: A Remote Desktop Protocol Implementation * FreeRDP X11 Server * * Copyright 2011 Marc-Andre Moreau @@ -57,7 +57,7 @@ struct xf_info int scanline_pad; int bytesPerPixel; HCLRCONV clrconv; - boolean use_xshm; + BOOL use_xshm; XImage* fb_image; Pixmap fb_pixmap; diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index 1330d6921..3bb687751 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) project(WinPR C) diff --git a/winpr/include/winpr/crt.h b/winpr/include/winpr/crt.h index 8d73a6b90..ab0aa692a 100644 --- a/winpr/include/winpr/crt.h +++ b/winpr/include/winpr/crt.h @@ -33,6 +33,11 @@ #ifndef _WIN32 +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + WINPR_API void* _aligned_malloc(size_t size, size_t alignment); WINPR_API void* _aligned_realloc(void* memblock, size_t size, size_t alignment); WINPR_API void* _aligned_recalloc(void* memblock, size_t num, size_t size, size_t alignment); @@ -45,6 +50,11 @@ WINPR_API size_t _aligned_msize(void* memblock, size_t alignment, size_t offset) WINPR_API void _aligned_free(void* memblock); +/* Buffer Manipulation */ + +WINPR_API errno_t memmove_s(void* dest, size_t numberOfElements, const void* src, size_t count); +WINPR_API errno_t wmemmove_s(WCHAR* dest, size_t numberOfElements, const WCHAR* src, size_t count); + #endif #endif /* WINPR_CRT_H */ diff --git a/winpr/include/winpr/handle.h b/winpr/include/winpr/handle.h index 3ae0bc5cb..f479a4a63 100644 --- a/winpr/include/winpr/handle.h +++ b/winpr/include/winpr/handle.h @@ -33,6 +33,8 @@ #define HANDLE_TYPE_MUTEX 3 #define HANDLE_TYPE_SEMAPHORE 4 #define HANDLE_TYPE_TIMER 5 +#define HANDLE_TYPE_NAMED_PIPE 6 +#define HANDLE_TYPE_ANONYMOUS_PIPE 7 WINPR_API HANDLE winpr_Handle_Insert(ULONG Type, PVOID Object); WINPR_API BOOL winpr_Handle_Remove(HANDLE handle); diff --git a/winpr/include/winpr/interlocked.h b/winpr/include/winpr/interlocked.h index d651c629e..6beb3f015 100644 --- a/winpr/include/winpr/interlocked.h +++ b/winpr/include/winpr/interlocked.h @@ -26,6 +26,11 @@ #ifndef _WIN32 +#ifndef CONTAINING_RECORD +#define CONTAINING_RECORD(address, type, field) \ + ((type *)(((ULONG_PTR) address) - (ULONG_PTR)(&(((type *) 0)->field)))) +#endif + typedef struct _LIST_ENTRY LIST_ENTRY; typedef struct _LIST_ENTRY* PLIST_ENTRY; @@ -120,6 +125,8 @@ typedef union _SLIST_HEADER #endif /* _WIN64 */ +/* Singly-Linked List */ + WINPR_API VOID InitializeSListHead(PSLIST_HEADER ListHead); WINPR_API PSLIST_ENTRY InterlockedPushEntrySList(PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry); @@ -135,10 +142,29 @@ WINPR_API LONG InterlockedDecrement(LONG volatile *Addend); WINPR_API LONG InterlockedExchange(LONG volatile *Target, LONG Value); WINPR_API LONG InterlockedExchangeAdd(LONG volatile *Addend, LONG Value); -WINPR_API LONG InterlockedCompareExchange(LONG volatile *Destination,LONG Exchange, LONG Comperand); -WINPR_API LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand); +WINPR_API LONG InterlockedCompareExchange(LONG volatile *Destination, LONG Exchange, LONG Comperand); #endif /* _WIN32 */ +WINPR_API LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand); + +/* Doubly-Linked List */ + +VOID InitializeListHead(PLIST_ENTRY ListHead); + +BOOL IsListEmpty(const LIST_ENTRY* ListHead); + +BOOL RemoveEntryList(PLIST_ENTRY Entry); + +VOID InsertHeadList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry); +PLIST_ENTRY RemoveHeadList(PLIST_ENTRY ListHead); + +VOID InsertTailList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry); +PLIST_ENTRY RemoveTailList(PLIST_ENTRY ListHead); +VOID AppendTailList(PLIST_ENTRY ListHead, PLIST_ENTRY ListToAppend); + +VOID PushEntryList(PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY Entry); +PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead); + #endif /* WINPR_INTERLOCKED_H */ diff --git a/winpr/include/winpr/pipe.h b/winpr/include/winpr/pipe.h new file mode 100644 index 000000000..24ef3e779 --- /dev/null +++ b/winpr/include/winpr/pipe.h @@ -0,0 +1,34 @@ +/** + * WinPR: Windows Portable Runtime + * Pipe Functions + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 WINPR_PIPE_H +#define WINPR_PIPE_H + +#include +#include +#include +#include + +#ifndef _WIN32 + +WINPR_API BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize); + +#endif + +#endif /* WINPR_PIPE_H */ diff --git a/winpr/include/winpr/tchar.h b/winpr/include/winpr/tchar.h index 2050cabf1..0f0402026 100644 --- a/winpr/include/winpr/tchar.h +++ b/winpr/include/winpr/tchar.h @@ -40,11 +40,21 @@ typedef CHAR TCHAR; #define _tcsdup _wcsdup #define _tcscmp wcscmp #define _tcscpy wcscpy +#define _tcscat wcscat +#define _tcschr wcschr +#define _tcsrchr wcsrchr +#define _tcsstr wcsstr +#define _stprintf_s swprintf_s #else #define _tprintf printf #define _tcsdup _strdup #define _tcscmp strcmp #define _tcscpy strcpy +#define _tcscat strcat +#define _tcschr strchr +#define _tcsrchr strrchr +#define _tcsstr strstr +#define _stprintf_s sprintf_s #endif #endif diff --git a/winpr/include/winpr/wtypes.h b/winpr/include/winpr/wtypes.h index 57c2f6f82..67698a54f 100644 --- a/winpr/include/winpr/wtypes.h +++ b/winpr/include/winpr/wtypes.h @@ -39,12 +39,12 @@ #define __int3264 __int32 #endif -#ifdef OBJC_BOOL_DEFINED -typedef OBJC_BOOL BOOL, *PBOOL, *LPBOOL; -#else -typedef int BOOL, *PBOOL, *LPBOOL; +#ifndef __OBJC__ +typedef int BOOL; #endif +typedef BOOL *PBOOL, *LPBOOL; + typedef unsigned char BYTE, *PBYTE, *LPBYTE; typedef BYTE BOOLEAN, *PBOOLEAN; typedef unsigned short WCHAR, *PWCHAR; @@ -70,7 +70,10 @@ typedef short SHORT; #define CONST const #define CALLBACK -typedef void* HANDLE, *LPHANDLE; +typedef void* HANDLE, *PHANDLE, *LPHANDLE; +typedef HANDLE HINSTANCE; +typedef HANDLE HMODULE; + typedef DWORD HCALL; typedef int INT, *LPINT; typedef signed char INT8; @@ -259,7 +262,6 @@ typedef struct _PROCESS_INFORMATION typedef DWORD (*PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter); typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; -typedef void* HMODULE; typedef void* FARPROC; #endif diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index 0dd4aeaf8..e14b18c7a 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -15,71 +15,46 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(MODULE_NAME "winpr") +set(MODULE_PREFIX "WINPR") + if (APPLE) # flat_namespace should be avoided, but is required for -undefined warning. Since WinPR currently has # a lot of undefined symbols in use, use this hack until they're filled out. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-flat_namespace,-undefined,warning") endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -add_subdirectory(crt) -add_subdirectory(utils) -add_subdirectory(heap) -add_subdirectory(path) -add_subdirectory(io) -add_subdirectory(file) -add_subdirectory(error) -add_subdirectory(environment) -add_subdirectory(interlocked) -add_subdirectory(handle) -add_subdirectory(synch) -add_subdirectory(thread) -add_subdirectory(sysinfo) -add_subdirectory(bcrypt) -add_subdirectory(dsparse) -add_subdirectory(asn1) -add_subdirectory(rpc) -add_subdirectory(sspicli) -add_subdirectory(sspi) -add_subdirectory(registry) -add_subdirectory(library) -add_subdirectory(timezone) -add_subdirectory(winsock) -add_subdirectory(winhttp) +set(FILENAME "ModuleOptions.cmake") +file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") -if(WITH_MONOLITHIC_BUILD) - add_library(winpr - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $) - - set_target_properties(winpr PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib") +foreach(FILEPATH ${FILEPATHS}) + if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}") + string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" ${MODULE_PREFIX}_SUBMODULE ${FILEPATH}) + set(${MODULE_PREFIX}_SUBMODULES ${${MODULE_PREFIX}_SUBMODULES} ${${MODULE_PREFIX}_SUBMODULE}) + endif() +endforeach(FILEPATH) - target_link_libraries(winpr ${WINPR_LIBS}) - install(TARGETS winpr DESTINATION ${CMAKE_INSTALL_LIBDIR}) +foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) + add_subdirectory(${${MODULE_PREFIX}_SUBMODULE}) +endforeach() + +if(MONOLITHIC_BUILD) + + foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES}) + set(${MODULE_PREFIX}_OBJECTS ${${MODULE_PREFIX}_OBJECTS} "$") + endforeach() + + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_OBJECTS}) + + set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") + + target_link_libraries(${MODULE_NAME} ${WINPR_LIBS}) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/libwinpr") endif() - diff --git a/winpr/libwinpr/asn1/CMakeLists.txt b/winpr/libwinpr/asn1/CMakeLists.txt index 5cbef153a..379714d22 100644 --- a/winpr/libwinpr/asn1/CMakeLists.txt +++ b/winpr/libwinpr/asn1/CMakeLists.txt @@ -21,7 +21,11 @@ set(MODULE_PREFIX "WINPR_ASN1") set(${MODULE_PREFIX}_SRCS asn1.c) -if(WITH_MONOLITHIC_BUILD) +if(MSVC AND (NOT MONOLITHIC_BUILD)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,10 +33,14 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/asn1/module.def b/winpr/libwinpr/asn1/module.def new file mode 100644 index 000000000..eba1a913a --- /dev/null +++ b/winpr/libwinpr/asn1/module.def @@ -0,0 +1,3 @@ +LIBRARY "libwinpr-asn1" +EXPORTS + diff --git a/winpr/libwinpr/asn1/test/.gitignore b/winpr/libwinpr/asn1/test/.gitignore new file mode 100644 index 000000000..e2363391e --- /dev/null +++ b/winpr/libwinpr/asn1/test/.gitignore @@ -0,0 +1,2 @@ +TestAsn1 +TestAsn1.c diff --git a/winpr/libwinpr/asn1/test/CMakeLists.txt b/winpr/libwinpr/asn1/test/CMakeLists.txt new file mode 100644 index 000000000..3ff2010b5 --- /dev/null +++ b/winpr/libwinpr/asn1/test/CMakeLists.txt @@ -0,0 +1,34 @@ + +set(MODULE_NAME "TestAsn1") +set(MODULE_PREFIX "TEST_ASN1") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestAsn1Module.c + TestAsn1Encoder.c + TestAsn1Decoder.c + TestAsn1Encode.c + TestAsn1Decode.c + TestAsn1String.c + TestAsn1Integer.c + TestAsn1Compare.c + TestAsn1BerEnc.c + TestAsn1BerDec.c + TestAsn1DerEnc.c + TestAsn1DerDec.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +target_link_libraries(${MODULE_NAME} winpr-asn1) + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/asn1/test/TestAsn1BerDec.c b/winpr/libwinpr/asn1/test/TestAsn1BerDec.c new file mode 100644 index 000000000..d096b3120 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1BerDec.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1BerDec(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1BerEnc.c b/winpr/libwinpr/asn1/test/TestAsn1BerEnc.c new file mode 100644 index 000000000..66568e5e6 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1BerEnc.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1BerEnc(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1Compare.c b/winpr/libwinpr/asn1/test/TestAsn1Compare.c new file mode 100644 index 000000000..407e631a0 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1Compare.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1Compare(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1Decode.c b/winpr/libwinpr/asn1/test/TestAsn1Decode.c new file mode 100644 index 000000000..6e604f3d8 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1Decode.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1Decode(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1Decoder.c b/winpr/libwinpr/asn1/test/TestAsn1Decoder.c new file mode 100644 index 000000000..a8ff7bc21 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1Decoder.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1Decoder(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1DerDec.c b/winpr/libwinpr/asn1/test/TestAsn1DerDec.c new file mode 100644 index 000000000..07ef10749 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1DerDec.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1DerDec(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1DerEnc.c b/winpr/libwinpr/asn1/test/TestAsn1DerEnc.c new file mode 100644 index 000000000..bfbd872b7 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1DerEnc.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1DerEnc(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1Encode.c b/winpr/libwinpr/asn1/test/TestAsn1Encode.c new file mode 100644 index 000000000..9a1e478ea --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1Encode.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1Encode(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1Encoder.c b/winpr/libwinpr/asn1/test/TestAsn1Encoder.c new file mode 100644 index 000000000..6d262cb6a --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1Encoder.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1Encoder(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1Integer.c b/winpr/libwinpr/asn1/test/TestAsn1Integer.c new file mode 100644 index 000000000..ffa83cbea --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1Integer.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1Integer(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1Module.c b/winpr/libwinpr/asn1/test/TestAsn1Module.c new file mode 100644 index 000000000..3e9d1d400 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1Module.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1Module(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/asn1/test/TestAsn1String.c b/winpr/libwinpr/asn1/test/TestAsn1String.c new file mode 100644 index 000000000..c5b057797 --- /dev/null +++ b/winpr/libwinpr/asn1/test/TestAsn1String.c @@ -0,0 +1,11 @@ + +#include +#include +#include +#include + +int TestAsn1String(int argc, char* argv[]) +{ + return 0; +} + diff --git a/winpr/libwinpr/bcrypt/CMakeLists.txt b/winpr/libwinpr/bcrypt/CMakeLists.txt index fc58b0b78..978a8a480 100644 --- a/winpr/libwinpr/bcrypt/CMakeLists.txt +++ b/winpr/libwinpr/bcrypt/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_BCRYPT") set(${MODULE_PREFIX}_SRCS bcrypt.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -35,7 +35,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SO set(${MODULE_PREFIX}_LIBS ${ZLIB_LIBRARIES}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() if(NOT WIN32) diff --git a/winpr/libwinpr/crt/CMakeLists.txt b/winpr/libwinpr/crt/CMakeLists.txt index a92a69137..4d8a5782a 100644 --- a/winpr/libwinpr/crt/CMakeLists.txt +++ b/winpr/libwinpr/crt/CMakeLists.txt @@ -20,14 +20,15 @@ set(MODULE_PREFIX "WINPR_CRT") set(${MODULE_PREFIX}_SRCS alignment.c + buffer.c memory.c string.c) -if(MSVC) +if(MSVC AND (NOT MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -35,7 +36,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/crt/alignment.c b/winpr/libwinpr/crt/alignment.c index 084eef03f..bc60d35a6 100644 --- a/winpr/libwinpr/crt/alignment.c +++ b/winpr/libwinpr/crt/alignment.c @@ -28,7 +28,12 @@ #ifndef _WIN32 #include + +#ifdef __APPLE__ +#include +#else #include +#endif void* _aligned_malloc(size_t size, size_t alignment) { diff --git a/winpr/libwinpr/crt/buffer.c b/winpr/libwinpr/crt/buffer.c new file mode 100644 index 000000000..491d1634d --- /dev/null +++ b/winpr/libwinpr/crt/buffer.c @@ -0,0 +1,52 @@ +/** + * WinPR: Windows Portable Runtime + * Buffer Manipulation + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 + +/* Buffer Manipulation: http://msdn.microsoft.com/en-us/library/b3893xdy/ */ + +#ifndef _WIN32 + +#include + +errno_t memmove_s(void* dest, size_t numberOfElements, const void* src, size_t count) +{ + if (count > numberOfElements) + return -1; + + memmove(dest, src, count); + + return 0; +} + +errno_t wmemmove_s(WCHAR* dest, size_t numberOfElements, const WCHAR* src, size_t count) +{ + if (count * 2 > numberOfElements) + return -1; + + memmove(dest, src, count * 2); + + return 0; +} + +#endif diff --git a/winpr/libwinpr/dsparse/CMakeLists.txt b/winpr/libwinpr/dsparse/CMakeLists.txt index eb59108cb..a4006e1ae 100644 --- a/winpr/libwinpr/dsparse/CMakeLists.txt +++ b/winpr/libwinpr/dsparse/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_DSPARSE") set(${MODULE_PREFIX}_SRCS dsparse.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/environment/CMakeLists.txt b/winpr/libwinpr/environment/CMakeLists.txt index 207632a69..8881db0a9 100644 --- a/winpr/libwinpr/environment/CMakeLists.txt +++ b/winpr/libwinpr/environment/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_ENVIRONMENT") set(${MODULE_PREFIX}_SRCS environment.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/error/CMakeLists.txt b/winpr/libwinpr/error/CMakeLists.txt index 65790882b..b3dc37243 100644 --- a/winpr/libwinpr/error/CMakeLists.txt +++ b/winpr/libwinpr/error/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_ERROR") set(${MODULE_PREFIX}_SRCS error.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/file/CMakeLists.txt b/winpr/libwinpr/file/CMakeLists.txt index 82baa624a..13b5c241b 100644 --- a/winpr/libwinpr/file/CMakeLists.txt +++ b/winpr/libwinpr/file/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_FILE") set(${MODULE_PREFIX}_SRCS file.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() if(NOT WIN32) @@ -41,3 +41,7 @@ else() endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/file/file.c b/winpr/libwinpr/file/file.c index 9ae9c831b..08f562d33 100644 --- a/winpr/libwinpr/file/file.c +++ b/winpr/libwinpr/file/file.c @@ -21,8 +21,14 @@ #include "config.h" #endif +#include + #include +#ifdef HAVE_UNISTD_H +#include +#endif + /** * api-ms-win-core-file-l1-2-0.dll: * @@ -134,7 +140,27 @@ BOOL DeleteFileW(LPCWSTR lpFileName) BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) { - return TRUE; + ULONG Type; + PVOID Object; + + if (!winpr_Handle_GetInfo(hFile, &Type, &Object)) + return FALSE; + + if (Type == HANDLE_TYPE_ANONYMOUS_PIPE) + { + int status; + int read_fd; + + read_fd = (int) ((ULONG_PTR) Object); + + status = read(read_fd, lpBuffer, nNumberOfBytesToRead); + + *lpNumberOfBytesRead = status; + + return TRUE; + } + + return FALSE; } BOOL ReadFileEx(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, @@ -152,7 +178,27 @@ BOOL ReadFileScatter(HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) { - return TRUE; + ULONG Type; + PVOID Object; + + if (!winpr_Handle_GetInfo(hFile, &Type, &Object)) + return FALSE; + + if (Type == HANDLE_TYPE_ANONYMOUS_PIPE) + { + int status; + int write_fd; + + write_fd = (int) ((ULONG_PTR) Object); + + status = write(write_fd, lpBuffer, nNumberOfBytesToWrite); + + *lpNumberOfBytesWritten = status; + + return TRUE; + } + + return FALSE; } BOOL WriteFileEx(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, diff --git a/winpr/libwinpr/file/test/.gitignore b/winpr/libwinpr/file/test/.gitignore new file mode 100644 index 000000000..5d04ec9e1 --- /dev/null +++ b/winpr/libwinpr/file/test/.gitignore @@ -0,0 +1,3 @@ +TestFile +TestFile.c + diff --git a/winpr/libwinpr/file/test/CMakeLists.txt b/winpr/libwinpr/file/test/CMakeLists.txt new file mode 100644 index 000000000..80371dcd1 --- /dev/null +++ b/winpr/libwinpr/file/test/CMakeLists.txt @@ -0,0 +1,28 @@ + +set(MODULE_NAME "TestFile") +set(MODULE_PREFIX "TEST_FILE") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestFileCreateFile.c + TestFileDeleteFile.c + TestFileReadFile.c + TestFileWriteFile.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +if(NOT WIN32) + target_link_libraries(${MODULE_NAME} winpr-file) +endif() + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/file/test/TestFileCreateFile.c b/winpr/libwinpr/file/test/TestFileCreateFile.c new file mode 100644 index 000000000..39b6a26c7 --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileCreateFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileCreateFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/file/test/TestFileDeleteFile.c b/winpr/libwinpr/file/test/TestFileDeleteFile.c new file mode 100644 index 000000000..aaa341ae2 --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileDeleteFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileDeleteFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/file/test/TestFileReadFile.c b/winpr/libwinpr/file/test/TestFileReadFile.c new file mode 100644 index 000000000..936881a4e --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileReadFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileReadFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/file/test/TestFileWriteFile.c b/winpr/libwinpr/file/test/TestFileWriteFile.c new file mode 100644 index 000000000..a8283ee6d --- /dev/null +++ b/winpr/libwinpr/file/test/TestFileWriteFile.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestFileWriteFile(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/handle/CMakeLists.txt b/winpr/libwinpr/handle/CMakeLists.txt index 69acd270f..6f33169d0 100644 --- a/winpr/libwinpr/handle/CMakeLists.txt +++ b/winpr/libwinpr/handle/CMakeLists.txt @@ -18,11 +18,18 @@ set(MODULE_NAME "winpr-handle") set(MODULE_PREFIX "WINPR_HANDLE") +set(CMAKE_THREAD_PREFER_PTHREAD) +find_required_package(Threads) + set(${MODULE_PREFIX}_SRCS handle.c table.c) -if(WITH_MONOLITHIC_BUILD) +if(MSVC AND (NOT MONOLITHIC_BUILD)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -30,9 +37,18 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +set(${MODULE_PREFIX}_LIBS + ${CMAKE_THREAD_LIBS_INIT} + ${CMAKE_DL_LIBS}) + +if(${CMAKE_SYSTEM_NAME} MATCHES SunOS) + set(WINPR_SYNCH_LIBS ${WINPR_SYNCH_LIBS} rt) +endif() +if(MONOLITHIC_BUILD) + set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() + target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/winpr/libwinpr/handle/handle.c b/winpr/libwinpr/handle/handle.c index 4e0d9e840..13c59e601 100644 --- a/winpr/libwinpr/handle/handle.c +++ b/winpr/libwinpr/handle/handle.c @@ -85,6 +85,21 @@ BOOL CloseHandle(HANDLE hObject) return TRUE; } + else if (Type == HANDLE_TYPE_ANONYMOUS_PIPE) + { + int pipe_fd; + + pipe_fd = (int) ((ULONG_PTR) Object); + + if (pipe_fd != -1) + { + close(pipe_fd); + } + + winpr_Handle_Remove(Object); + + return TRUE; + } return FALSE; } diff --git a/winpr/libwinpr/handle/module.def b/winpr/libwinpr/handle/module.def new file mode 100644 index 000000000..5e4d32f95 --- /dev/null +++ b/winpr/libwinpr/handle/module.def @@ -0,0 +1,3 @@ +LIBRARY "libwinpr-handle" +EXPORTS + diff --git a/winpr/libwinpr/heap/CMakeLists.txt b/winpr/libwinpr/heap/CMakeLists.txt index ce34c92b3..0997c5b13 100644 --- a/winpr/libwinpr/heap/CMakeLists.txt +++ b/winpr/libwinpr/heap/CMakeLists.txt @@ -21,11 +21,11 @@ set(MODULE_PREFIX "WINPR_HEAP") set(${MODULE_PREFIX}_SRCS heap.c) -if(MSVC) +if(MSVC AND (NOT MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -33,7 +33,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/interlocked/CMakeLists.txt b/winpr/libwinpr/interlocked/CMakeLists.txt index b52b16432..508804e6e 100644 --- a/winpr/libwinpr/interlocked/CMakeLists.txt +++ b/winpr/libwinpr/interlocked/CMakeLists.txt @@ -21,11 +21,11 @@ set(MODULE_PREFIX "WINPR_INTERLOCKED") set(${MODULE_PREFIX}_SRCS interlocked.c) -if(MSVC) +if(MSVC AND (NOT MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -33,10 +33,10 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() - target_link_libraries(${MODULE_NAME} winpr-crt) + target_link_libraries(${MODULE_NAME} winpr-crt winpr-handle winpr-synch) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/winpr/libwinpr/interlocked/interlocked.c b/winpr/libwinpr/interlocked/interlocked.c index 30b608ee7..2fc887fa4 100644 --- a/winpr/libwinpr/interlocked/interlocked.c +++ b/winpr/libwinpr/interlocked/interlocked.c @@ -21,24 +21,12 @@ #include "config.h" #endif +#include +#include + #include -/** - * api-ms-win-core-interlocked-l1-2-0.dll: - * - * InitializeSListHead - * InterlockedPopEntrySList - * InterlockedPushEntrySList - * InterlockedPushListSListEx - * InterlockedFlushSList - * QueryDepthSList - * InterlockedIncrement - * InterlockedDecrement - * InterlockedExchange - * InterlockedExchangeAdd - * InterlockedCompareExchange - * InterlockedCompareExchange64 - */ +/* Singly-Linked List */ #ifndef _WIN32 @@ -246,6 +234,45 @@ LONG InterlockedCompareExchange(LONG volatile *Destination, LONG Exchange, LONG #endif } +#endif /* _WIN32 */ + +#if (_WIN32 && (_WIN32_WINNT < 0x0502)) + +static volatile HANDLE mutex = NULL; + +int static_mutex_lock(volatile HANDLE* static_mutex) +{ + if (*static_mutex == NULL) + { + HANDLE handle = CreateMutex(NULL, FALSE, NULL); + + if (InterlockedCompareExchangePointer((PVOID*) static_mutex, (PVOID) handle, NULL) != NULL) + CloseHandle(handle); + } + + return (WaitForSingleObject(*static_mutex, INFINITE) == WAIT_FAILED); +} + +/* Not available in XP */ + +LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand) +{ + LONGLONG previousValue = 0; + + static_mutex_lock(&mutex); + + previousValue = *Destination; + + if (*Destination == Comperand) + *Destination = Exchange; + + ReleaseMutex(mutex); + + return previousValue; +} + +#else /* (_WIN32 && (_WIN32_WINNT < 0x0502)) */ + LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand) { #ifdef __GNUC__ @@ -255,4 +282,114 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG E #endif } -#endif +#endif /* (_WIN32 && (_WIN32_WINNT < 0x0502)) */ + +/* Doubly-Linked List */ + +/** + * Kernel-Mode Basics: Windows Linked Lists: + * http://www.osronline.com/article.cfm?article=499 + * + * Singly and Doubly Linked Lists: + * http://msdn.microsoft.com/en-us/library/windows/hardware/ff563802/ + */ + +VOID InitializeListHead(PLIST_ENTRY ListHead) +{ + ListHead->Flink = ListHead->Blink = ListHead; +} + +BOOL IsListEmpty(const LIST_ENTRY* ListHead) +{ + return (BOOL) (ListHead->Flink == ListHead); +} + +BOOL RemoveEntryList(PLIST_ENTRY Entry) +{ + PLIST_ENTRY OldFlink; + PLIST_ENTRY OldBlink; + + OldFlink = Entry->Flink; + OldBlink = Entry->Blink; + OldFlink->Blink = OldBlink; + OldBlink->Flink = OldFlink; + + return (BOOL) (OldFlink == OldBlink); +} + +VOID InsertHeadList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry) +{ + PLIST_ENTRY OldFlink; + + OldFlink = ListHead->Flink; + Entry->Flink = OldFlink; + Entry->Blink = ListHead; + OldFlink->Blink = Entry; + ListHead->Flink = Entry; +} + +PLIST_ENTRY RemoveHeadList(PLIST_ENTRY ListHead) +{ + PLIST_ENTRY Flink; + PLIST_ENTRY Entry; + + Entry = ListHead->Flink; + Flink = Entry->Flink; + ListHead->Flink = Flink; + Flink->Blink = ListHead; + + return Entry; +} + +VOID InsertTailList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry) +{ + PLIST_ENTRY OldBlink; + + OldBlink = ListHead->Blink; + Entry->Flink = ListHead; + Entry->Blink = OldBlink; + OldBlink->Flink = Entry; + ListHead->Blink = Entry; +} + +PLIST_ENTRY RemoveTailList(PLIST_ENTRY ListHead) +{ + PLIST_ENTRY Blink; + PLIST_ENTRY Entry; + + Entry = ListHead->Blink; + Blink = Entry->Blink; + ListHead->Blink = Blink; + Blink->Flink = ListHead; + + return Entry; +} + +VOID AppendTailList(PLIST_ENTRY ListHead, PLIST_ENTRY ListToAppend) +{ + PLIST_ENTRY ListEnd = ListHead->Blink; + + ListHead->Blink->Flink = ListToAppend; + ListHead->Blink = ListToAppend->Blink; + ListToAppend->Blink->Flink = ListHead; + ListToAppend->Blink = ListEnd; +} + +VOID PushEntryList(PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY Entry) +{ + Entry->Next = ListHead->Next; + ListHead->Next = Entry; +} + +PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead) +{ + PSINGLE_LIST_ENTRY FirstEntry; + + FirstEntry = ListHead->Next; + + if (FirstEntry != NULL) + ListHead->Next = FirstEntry->Next; + + return FirstEntry; +} + diff --git a/winpr/libwinpr/interlocked/module.def b/winpr/libwinpr/interlocked/module.def index a73d92a6b..160c9de80 100644 --- a/winpr/libwinpr/interlocked/module.def +++ b/winpr/libwinpr/interlocked/module.def @@ -1,2 +1,13 @@ LIBRARY "libwinpr-interlocked" EXPORTS + InterlockedCompareExchange64 @1 + InitializeListHead @2 + IsListEmpty @3 + RemoveEntryList @4 + InsertHeadList @5 + RemoveHeadList @6 + InsertTailList @7 + RemoveTailList @8 + AppendTailList @9 + PushEntryList @10 + PopEntryList @11 diff --git a/winpr/libwinpr/interlocked/test/CMakeLists.txt b/winpr/libwinpr/interlocked/test/CMakeLists.txt index c04306ba1..c55804f94 100644 --- a/winpr/libwinpr/interlocked/test/CMakeLists.txt +++ b/winpr/libwinpr/interlocked/test/CMakeLists.txt @@ -6,7 +6,8 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) set(${MODULE_PREFIX}_TESTS TestInterlockedAccess.c - TestInterlockedSList.c) + TestInterlockedSList.c + TestInterlockedDList.c) create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} @@ -14,9 +15,7 @@ create_test_sourcelist(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -if(NOT WIN32) - target_link_libraries(${MODULE_NAME} winpr-interlocked) -endif() +target_link_libraries(${MODULE_NAME} winpr-interlocked) foreach(test ${${MODULE_PREFIX}_TESTS}) get_filename_component(TestName ${test} NAME_WE) @@ -24,3 +23,4 @@ foreach(test ${${MODULE_PREFIX}_TESTS}) endforeach() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") + diff --git a/winpr/libwinpr/interlocked/test/TestInterlockedDList.c b/winpr/libwinpr/interlocked/test/TestInterlockedDList.c new file mode 100644 index 000000000..fa3a61fe6 --- /dev/null +++ b/winpr/libwinpr/interlocked/test/TestInterlockedDList.c @@ -0,0 +1,77 @@ + +#include +#include +#include +#include +#include + +typedef struct _LIST_ITEM +{ + LIST_ENTRY ItemEntry; + ULONG Signature; +} LIST_ITEM, *PLIST_ITEM; + +int TestInterlockedDList(int argc, char* argv[]) +{ + ULONG Count; + PLIST_ITEM pListItem; + PLIST_ENTRY pListHead; + PLIST_ENTRY pListEntry; + + pListHead = (PLIST_ENTRY) _aligned_malloc(sizeof(LIST_ENTRY), MEMORY_ALLOCATION_ALIGNMENT); + + if (!pListHead) + { + printf("Memory allocation failed.\n"); + return -1; + } + + InitializeListHead(pListHead); + + if (!IsListEmpty(pListHead)) + { + printf("Expected empty list\n"); + return -1; + } + + /* InsertHeadList / RemoveHeadList */ + + printf("InsertHeadList / RemoveHeadList\n"); + + for (Count = 1; Count <= 10; Count += 1) + { + pListItem = (PLIST_ITEM) _aligned_malloc(sizeof(LIST_ITEM), MEMORY_ALLOCATION_ALIGNMENT); + pListItem->Signature = Count; + InsertHeadList(pListHead, &(pListItem->ItemEntry)); + } + + for (Count = 10; Count >= 1; Count -= 1) + { + pListEntry = RemoveHeadList(pListHead); + pListItem = (PLIST_ITEM) pListEntry; + _aligned_free(pListEntry); + } + + /* InsertTailList / RemoveTailList */ + + printf("InsertTailList / RemoveTailList\n"); + + for (Count = 1; Count <= 10; Count += 1) + { + pListItem = (PLIST_ITEM) _aligned_malloc(sizeof(LIST_ITEM), MEMORY_ALLOCATION_ALIGNMENT); + pListItem->Signature = Count; + InsertTailList(pListHead, &(pListItem->ItemEntry)); + } + + for (Count = 10; Count >= 1; Count -= 1) + { + pListEntry = RemoveTailList(pListHead); + pListItem = (PLIST_ITEM) pListEntry; + _aligned_free(pListEntry); + } + + _aligned_free(pListHead); + + return 0; +} + diff --git a/winpr/libwinpr/io/CMakeLists.txt b/winpr/libwinpr/io/CMakeLists.txt index d2632ae74..39794bf2f 100644 --- a/winpr/libwinpr/io/CMakeLists.txt +++ b/winpr/libwinpr/io/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_IO") set(${MODULE_PREFIX}_SRCS io.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,10 +29,14 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/io/test/.gitignore b/winpr/libwinpr/io/test/.gitignore new file mode 100644 index 000000000..60021fda1 --- /dev/null +++ b/winpr/libwinpr/io/test/.gitignore @@ -0,0 +1,3 @@ +TestIo +TestIo.c + diff --git a/winpr/libwinpr/io/test/CMakeLists.txt b/winpr/libwinpr/io/test/CMakeLists.txt new file mode 100644 index 000000000..6119501f2 --- /dev/null +++ b/winpr/libwinpr/io/test/CMakeLists.txt @@ -0,0 +1,25 @@ + +set(MODULE_NAME "TestIo") +set(MODULE_PREFIX "TEST_IO") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestIoGetOverlappedResult.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +if(NOT WIN32) + target_link_libraries(${MODULE_NAME} winpr-io) +endif() + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/io/test/TestIoGetOverlappedResult.c b/winpr/libwinpr/io/test/TestIoGetOverlappedResult.c new file mode 100644 index 000000000..044eb11cc --- /dev/null +++ b/winpr/libwinpr/io/test/TestIoGetOverlappedResult.c @@ -0,0 +1,10 @@ + +#include +#include +#include +#include + +int TestIoGetOverlappedResult(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/CMakeLists.txt b/winpr/libwinpr/library/CMakeLists.txt index e8004c957..b9b9a23ee 100644 --- a/winpr/libwinpr/library/CMakeLists.txt +++ b/winpr/libwinpr/library/CMakeLists.txt @@ -21,7 +21,11 @@ set(MODULE_PREFIX "WINPR_LIBRARY") set(${MODULE_PREFIX}_SRCS library.c) -if(WITH_MONOLITHIC_BUILD) +if(MSVC AND (NOT MONOLITHIC_BUILD)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,10 +33,19 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) - +if(MONOLITHIC_BUILD) + set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() + if(NOT WIN32) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} dl) + endif() + + target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/library/module.def b/winpr/libwinpr/library/module.def new file mode 100644 index 000000000..c4a5071c4 --- /dev/null +++ b/winpr/libwinpr/library/module.def @@ -0,0 +1,3 @@ +LIBRARY "libwinpr-library" +EXPORTS + diff --git a/winpr/libwinpr/library/test/.gitignore b/winpr/libwinpr/library/test/.gitignore new file mode 100644 index 000000000..36c502679 --- /dev/null +++ b/winpr/libwinpr/library/test/.gitignore @@ -0,0 +1,3 @@ +TestLibrary +TestLibrary.c + diff --git a/winpr/libwinpr/library/test/CMakeLists.txt b/winpr/libwinpr/library/test/CMakeLists.txt new file mode 100644 index 000000000..9096ddc93 --- /dev/null +++ b/winpr/libwinpr/library/test/CMakeLists.txt @@ -0,0 +1,31 @@ + +set(MODULE_NAME "TestLibrary") +set(MODULE_PREFIX "TEST_LIBRARY") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestLibraryAddDllDirectory.c + TestLibraryRemoveDllDirectory.c + TestLibrarySetDefaultDllDirectories.c + TestLibraryLoadLibrary.c + TestLibraryFreeLibrary.c + TestLibraryGetProcAddress.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +target_link_libraries(${MODULE_NAME} winpr-library winpr-path) + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName} ${EXECUTABLE_OUTPUT_PATH}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") + +add_subdirectory(TestLibraryA) +add_subdirectory(TestLibraryB) diff --git a/winpr/libwinpr/library/test/TestLibraryA/CMakeLists.txt b/winpr/libwinpr/library/test/TestLibraryA/CMakeLists.txt new file mode 100644 index 000000000..fc32e6ca9 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryA/CMakeLists.txt @@ -0,0 +1,24 @@ +# WinPR: Windows Portable Runtime +# libwinpr-library cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +set(MODULE_NAME "TestLibraryA") + +add_library(${MODULE_NAME} TestLibraryA.c) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra") diff --git a/winpr/libwinpr/library/test/TestLibraryA/TestLibraryA.c b/winpr/libwinpr/library/test/TestLibraryA/TestLibraryA.c new file mode 100644 index 000000000..39155319c --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryA/TestLibraryA.c @@ -0,0 +1,19 @@ + +#include +#include +#include +#include +#include + +WINPR_API int FunctionA(int a, int b); +WINPR_API int FunctionB(int a, int b); + +int FunctionA(int a, int b) +{ + return (a * b); /* multiply */ +} + +int FunctionB(int a, int b) +{ + return (a / b); /* divide */ +} diff --git a/winpr/libwinpr/library/test/TestLibraryAddDllDirectory.c b/winpr/libwinpr/library/test/TestLibraryAddDllDirectory.c new file mode 100644 index 000000000..0c1c7c4f1 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryAddDllDirectory.c @@ -0,0 +1,12 @@ + +#include +#include +#include +#include +#include +#include + +int TestLibraryAddDllDirectory(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryB/CMakeLists.txt b/winpr/libwinpr/library/test/TestLibraryB/CMakeLists.txt new file mode 100644 index 000000000..f5688cd60 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryB/CMakeLists.txt @@ -0,0 +1,24 @@ +# WinPR: Windows Portable Runtime +# libwinpr-library cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +set(MODULE_NAME "TestLibraryB") + +add_library(${MODULE_NAME} TestLibraryB.c) + +set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "") + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test/Extra") diff --git a/winpr/libwinpr/library/test/TestLibraryB/TestLibraryB.c b/winpr/libwinpr/library/test/TestLibraryB/TestLibraryB.c new file mode 100644 index 000000000..7fb963356 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryB/TestLibraryB.c @@ -0,0 +1,19 @@ + +#include +#include +#include +#include +#include + +WINPR_API int FunctionA(int a, int b); +WINPR_API int FunctionB(int a, int b); + +int FunctionA(int a, int b) +{ + return (a + b); /* add */ +} + +int FunctionB(int a, int b) +{ + return (a - b); /* subtract */ +} diff --git a/winpr/libwinpr/library/test/TestLibraryFreeLibrary.c b/winpr/libwinpr/library/test/TestLibraryFreeLibrary.c new file mode 100644 index 000000000..db6b303ae --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryFreeLibrary.c @@ -0,0 +1,28 @@ + +#include +#include +#include +#include +#include +#include + +int TestLibraryFreeLibrary(int argc, char* argv[]) +{ + HINSTANCE library; + + library = LoadLibrary(_T("kernel32.dll")); + + if (!library) + { + printf("LoadLibrary failure\n"); + return -1; + } + + if (!FreeLibrary(library)) + { + printf("FreeLibrary failure\n"); + return -1; + } + + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c b/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c new file mode 100644 index 000000000..afabdc709 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c @@ -0,0 +1,50 @@ + +#include +#include +#include +#include +#include +#include + +int TestLibraryGetProcAddress(int argc, char* argv[]) +{ + char* str; + int length; + LPTSTR BasePath; + //HINSTANCE library; + LPTSTR LibraryPath; + + str = argv[1]; + +#ifdef UNICODE + length = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0); + BasePath = (WCHAR*) malloc((length + 1) * sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, str, length, (LPWSTR) BasePath, length * sizeof(WCHAR)); + BasePath[length] = 0; +#else + BasePath = _strdup(str); +#endif + + _tprintf(_T("Base Path: %s\n"), BasePath); + + PathAllocCombine(BasePath, _T("TestLibraryA\\TestLibraryA.dll"), 0, &LibraryPath); + + //_tprintf(_T("Loading Library: %s\n"), LibraryPath); + + /* + library = LoadLibrary(LibraryPath); + + if (!library) + { + printf("LoadLibrary failure\n"); + return -1; + } + + if (!FreeLibrary(library)) + { + printf("FreeLibrary failure\n"); + return -1; + }*/ + + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c b/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c new file mode 100644 index 000000000..d127c0d8a --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryLoadLibrary.c @@ -0,0 +1,28 @@ + +#include +#include +#include +#include +#include +#include + +int TestLibraryLoadLibrary(int argc, char* argv[]) +{ + HINSTANCE library; + + library = LoadLibrary(_T("kernel32.dll")); + + if (!library) + { + printf("LoadLibrary failure\n"); + return -1; + } + + if (!FreeLibrary(library)) + { + printf("FreeLibrary failure\n"); + return -1; + } + + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibraryRemoveDllDirectory.c b/winpr/libwinpr/library/test/TestLibraryRemoveDllDirectory.c new file mode 100644 index 000000000..bf7795633 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibraryRemoveDllDirectory.c @@ -0,0 +1,12 @@ + +#include +#include +#include +#include +#include +#include + +int TestLibraryRemoveDllDirectory(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/library/test/TestLibrarySetDefaultDllDirectories.c b/winpr/libwinpr/library/test/TestLibrarySetDefaultDllDirectories.c new file mode 100644 index 000000000..86cd92d82 --- /dev/null +++ b/winpr/libwinpr/library/test/TestLibrarySetDefaultDllDirectories.c @@ -0,0 +1,12 @@ + +#include +#include +#include +#include +#include +#include + +int TestLibrarySetDefaultDllDirectories(int argc, char* argv[]) +{ + return 0; +} diff --git a/winpr/libwinpr/path/CMakeLists.txt b/winpr/libwinpr/path/CMakeLists.txt index 00080ee0a..3d5ac2731 100644 --- a/winpr/libwinpr/path/CMakeLists.txt +++ b/winpr/libwinpr/path/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_PATH") set(${MODULE_PREFIX}_SRCS path.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,10 +29,10 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() - target_link_libraries(${MODULE_NAME} winpr-heap) + target_link_libraries(${MODULE_NAME} winpr-crt winpr-heap) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/winpr/libwinpr/path/path.c b/winpr/libwinpr/path/path.c index ce0a80aaa..6e2e34ec1 100644 --- a/winpr/libwinpr/path/path.c +++ b/winpr/libwinpr/path/path.c @@ -21,18 +21,56 @@ #include "config.h" #endif +#include #include +#include #include HRESULT PathCchAddBackslashA(PSTR pszPath, size_t cchPath) { - return 0; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + pszPathLength = lstrlenA(pszPath); + + if (pszPath[pszPathLength - 1] == '\\') + return S_FALSE; + + if (cchPath > (pszPathLength + 1)) + { + pszPath[pszPathLength] = '\\'; + pszPath[pszPathLength + 1] = '\0'; + + return S_OK; + } + + return S_FALSE; } HRESULT PathCchAddBackslashW(PWSTR pszPath, size_t cchPath) { - return 0; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + pszPathLength = lstrlenW(pszPath); + + if (pszPath[pszPathLength - 1] == '\\') + return S_FALSE; + + if (cchPath > (pszPathLength + 1)) + { + pszPath[pszPathLength] = '\\'; + pszPath[pszPathLength + 1] = '\0'; + + return S_OK; + } + + return S_FALSE; } HRESULT PathCchRemoveBackslashA(PSTR pszPath, size_t cchPath) @@ -47,12 +85,48 @@ HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath) HRESULT PathCchAddBackslashExA(PSTR pszPath, size_t cchPath, PSTR* ppszEnd, size_t* pcchRemaining) { - return 0; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + pszPathLength = lstrlenA(pszPath); + + if (pszPath[pszPathLength - 1] == '\\') + return S_FALSE; + + if (cchPath > (pszPathLength + 1)) + { + pszPath[pszPathLength] = '\\'; + pszPath[pszPathLength + 1] = '\0'; + + return S_OK; + } + + return S_FALSE; } HRESULT PathCchAddBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd, size_t* pcchRemaining) { - return 0; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + pszPathLength = lstrlenW(pszPath); + + if (pszPath[pszPathLength - 1] == '\\') + return S_FALSE; + + if (cchPath > (pszPathLength + 1)) + { + pszPath[pszPathLength] = '\\'; + pszPath[pszPathLength + 1] = '\0'; + + return S_OK; + } + + return S_FALSE; } HRESULT PathCchRemoveBackslashExA(PSTR pszPath, size_t cchPath, PSTR* ppszEnd, size_t* pcchRemaining) @@ -67,22 +141,179 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd, HRESULT PathCchAddExtensionA(PSTR pszPath, size_t cchPath, PCSTR pszExt) { - return 0; + CHAR* pDot; + BOOL bExtDot; + CHAR* pBackslash; + size_t pszExtLength; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + if (!pszExt) + return S_FALSE; + + pszExtLength = lstrlenA(pszExt); + pszPathLength = lstrlenA(pszPath); + bExtDot = (pszExt[0] == '.') ? TRUE : FALSE; + + pDot = strrchr(pszPath, '.'); + pBackslash = strrchr(pszPath, '\\'); + + if (pDot && pBackslash) + { + if (pDot > pBackslash) + return S_FALSE; + } + + if (cchPath > pszPathLength + pszExtLength + ((bExtDot) ? 0 : 1)) + { + if (bExtDot) + sprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, "%s", pszExt); + else + sprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, ".%s", pszExt); + + return S_OK; + } + + return S_FALSE; } HRESULT PathCchAddExtensionW(PWSTR pszPath, size_t cchPath, PCWSTR pszExt) { - return 0; +#ifdef _WIN32 + LPTCH pDot; + BOOL bExtDot; + LPTCH pBackslash; + size_t pszExtLength; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + if (!pszExt) + return S_FALSE; + + pszExtLength = lstrlenW(pszExt); + pszPathLength = lstrlenW(pszPath); + bExtDot = (pszExt[0] == '.') ? TRUE : FALSE; + + pDot = wcsrchr(pszPath, '.'); + pBackslash = wcsrchr(pszPath, '\\'); + + if (pDot && pBackslash) + { + if (pDot > pBackslash) + return S_FALSE; + } + + if (cchPath > pszPathLength + pszExtLength + ((bExtDot) ? 0 : 1)) + { + if (bExtDot) + swprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, L"%s", pszExt); + else + swprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, L".%s", pszExt); + + return S_OK; + } +#endif + return S_FALSE; } HRESULT PathCchAppendA(PSTR pszPath, size_t cchPath, PCSTR pszMore) { - return 0; + BOOL pathBackslash; + BOOL moreBackslash; + size_t pszMoreLength; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + if (!pszMore) + return S_FALSE; + + pszMoreLength = lstrlenA(pszMore); + pszPathLength = lstrlenA(pszPath); + + pathBackslash = (pszPath[pszPathLength - 1] == '\\') ? TRUE : FALSE; + moreBackslash = (pszMore[0] == '\\') ? TRUE : FALSE; + + if (pathBackslash && moreBackslash) + { + if ((pszPathLength + pszMoreLength - 1) < cchPath) + { + sprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, "%s", &pszMore[1]); + return S_OK; + } + } + else if ((pathBackslash && !moreBackslash) || (!pathBackslash && moreBackslash)) + { + if ((pszPathLength + pszMoreLength) < cchPath) + { + sprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, "%s", pszMore); + return S_OK; + } + } + else if (!pathBackslash && !moreBackslash) + { + if ((pszPathLength + pszMoreLength + 1) < cchPath) + { + sprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, "\\%s", pszMore); + return S_OK; + } + } + + return S_FALSE; } HRESULT PathCchAppendW(PWSTR pszPath, size_t cchPath, PCWSTR pszMore) { - return 0; +#ifdef _WIN32 + BOOL pathBackslash; + BOOL moreBackslash; + size_t pszMoreLength; + size_t pszPathLength; + + if (!pszPath) + return S_FALSE; + + if (!pszMore) + return S_FALSE; + + pszMoreLength = lstrlenW(pszMore); + pszPathLength = lstrlenW(pszPath); + + pathBackslash = (pszPath[pszPathLength - 1] == '\\') ? TRUE : FALSE; + moreBackslash = (pszMore[0] == '\\') ? TRUE : FALSE; + + if (pathBackslash && moreBackslash) + { + if ((pszPathLength + pszMoreLength - 1) < cchPath) + { + swprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, L"%s", &pszMore[1]); + return S_OK; + } + } + else if ((pathBackslash && !moreBackslash) || (!pathBackslash && moreBackslash)) + { + if ((pszPathLength + pszMoreLength) < cchPath) + { + swprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, L"%s", pszMore); + return S_OK; + } + } + else if (!pathBackslash && !moreBackslash) + { + if ((pszPathLength + pszMoreLength + 1) < cchPath) + { + swprintf_s(&pszPath[pszPathLength], cchPath - pszPathLength, L"\\%s", pszMore); + return S_OK; + } + } +#endif + + return S_FALSE; } HRESULT PathCchAppendExA(PSTR pszPath, size_t cchPath, PCSTR pszMore, unsigned long dwFlags) @@ -147,12 +378,124 @@ HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, HRESULT PathAllocCombineA(PCSTR pszPathIn, PCSTR pszMore, unsigned long dwFlags, PSTR* ppszPathOut) { - return 0; + PSTR pszPathOut; + BOOL backslashIn; + BOOL backslashMore; + int pszMoreLength; + int pszPathInLength; + int pszPathOutLength; + + if (!pszPathIn) + return S_FALSE; + + if (!pszMore) + return S_FALSE; + + pszPathInLength = lstrlenA(pszPathIn); + pszMoreLength = lstrlenA(pszMore); + + backslashIn = (pszPathIn[pszPathInLength - 1] == '\\') ? TRUE : FALSE; + backslashMore = (pszMore[0] == '\\') ? TRUE : FALSE; + + if (backslashMore) + { + if ((pszPathIn[1] == ':') && (pszPathIn[2] == '\\')) + { + size_t sizeOfBuffer; + + pszPathOutLength = 2 + pszMoreLength; + sizeOfBuffer = (pszPathOutLength + 1) * 2; + + pszPathOut = (PSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2); + sprintf_s(pszPathOut, sizeOfBuffer, "%c:%s", pszPathIn[0], pszMore); + + *ppszPathOut = pszPathOut; + + return S_OK; + } + } + else + { + size_t sizeOfBuffer; + + pszPathOutLength = pszPathInLength + pszMoreLength; + sizeOfBuffer = (pszPathOutLength + 1) * 2; + + pszPathOut = (PSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2); + + if (backslashIn) + sprintf_s(pszPathOut, sizeOfBuffer, "%s%s", pszPathIn, pszMore); + else + sprintf_s(pszPathOut, sizeOfBuffer, "%s\\%s", pszPathIn, pszMore); + + *ppszPathOut = pszPathOut; + + return S_OK; + } + + return S_OK; } HRESULT PathAllocCombineW(PCWSTR pszPathIn, PCWSTR pszMore, unsigned long dwFlags, PWSTR* ppszPathOut) { - return 0; +#ifdef _WIN32 + PWSTR pszPathOut; + BOOL backslashIn; + BOOL backslashMore; + int pszMoreLength; + int pszPathInLength; + int pszPathOutLength; + + if (!pszPathIn) + return S_FALSE; + + if (!pszMore) + return S_FALSE; + + pszPathInLength = lstrlenW(pszPathIn); + pszMoreLength = lstrlenW(pszMore); + + backslashIn = (pszPathIn[pszPathInLength - 1] == '\\') ? TRUE : FALSE; + backslashMore = (pszMore[0] == '\\') ? TRUE : FALSE; + + if (backslashMore) + { + if ((pszPathIn[1] == ':') && (pszPathIn[2] == '\\')) + { + size_t sizeOfBuffer; + + pszPathOutLength = 2 + pszMoreLength; + sizeOfBuffer = (pszPathOutLength + 1) * 2; + + pszPathOut = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2); + swprintf_s(pszPathOut, sizeOfBuffer, L"%c:%s", pszPathIn[0], pszMore); + + *ppszPathOut = pszPathOut; + + return S_OK; + } + } + else + { + size_t sizeOfBuffer; + + pszPathOutLength = pszPathInLength + pszMoreLength; + sizeOfBuffer = (pszPathOutLength + 1) * 2; + + pszPathOut = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeOfBuffer * 2); + + if (backslashIn) + swprintf_s(pszPathOut, sizeOfBuffer, L"%s%s", pszPathIn, pszMore); + else + swprintf_s(pszPathOut, sizeOfBuffer, L"%s\\%s", pszPathIn, pszMore); + + *ppszPathOut = pszPathOut; + + return S_OK; + } +#endif + + return S_OK; } HRESULT PathCchFindExtensionA(PCSTR pszPath, size_t cchPath, PCSTR* ppszExt) @@ -197,12 +540,30 @@ BOOL PathCchIsRootW(PCWSTR pszPath) BOOL PathIsUNCExA(PCSTR pszPath, PCSTR* ppszServer) { - return 0; + if (!pszPath) + return FALSE; + + if ((pszPath[0] == '\\') && (pszPath[1] == '\\')) + { + *ppszServer = &pszPath[2]; + return TRUE; + } + + return FALSE; } BOOL PathIsUNCExW(PCWSTR pszPath, PCWSTR* ppszServer) { - return 0; + if (!pszPath) + return FALSE; + + if ((pszPath[0] == '\\') && (pszPath[1] == '\\')) + { + *ppszServer = &pszPath[2]; + return TRUE; + } + + return FALSE; } HRESULT PathCchSkipRootA(PCSTR pszPath, PCSTR* ppszRootEnd) @@ -227,12 +588,64 @@ HRESULT PathCchStripToRootW(PWSTR pszPath, size_t cchPath) HRESULT PathCchStripPrefixA(PSTR pszPath, size_t cchPath) { - return 0; + BOOL hasPrefix; + BOOL deviceNamespace; + + if (!pszPath) + return S_FALSE; + + if (cchPath < 4) + return S_FALSE; + + hasPrefix = ((pszPath[0] == '\\') && (pszPath[1] == '\\') && + (pszPath[2] == '?') && (pszPath[3] == '\\')) ? TRUE : FALSE; + + if (hasPrefix) + { + if (cchPath < 7) + return S_FALSE; + + deviceNamespace = ((pszPath[5] == ':') && (pszPath[6] == '\\')) ? TRUE : FALSE; + + if (deviceNamespace) + { + memmove_s(pszPath, cchPath, &pszPath[4], cchPath - 4); + return S_OK; + } + } + + return S_FALSE; } HRESULT PathCchStripPrefixW(PWSTR pszPath, size_t cchPath) { - return 0; + BOOL hasPrefix; + BOOL deviceNamespace; + + if (!pszPath) + return S_FALSE; + + if (cchPath < 4) + return S_FALSE; + + hasPrefix = ((pszPath[0] == '\\') && (pszPath[1] == '\\') && + (pszPath[2] == '?') && (pszPath[3] == '\\')) ? TRUE : FALSE; + + if (hasPrefix) + { + if (cchPath < 7) + return S_FALSE; + + deviceNamespace = ((pszPath[5] == ':') && (pszPath[6] == '\\')) ? TRUE : FALSE; + + if (deviceNamespace) + { + wmemmove_s(pszPath, cchPath, &pszPath[4], cchPath - 4); + return S_OK; + } + } + + return S_FALSE; } HRESULT PathCchRemoveFileSpecA(PSTR pszPath, size_t cchPath) diff --git a/winpr/libwinpr/path/test/CMakeLists.txt b/winpr/libwinpr/path/test/CMakeLists.txt index b8eb05fd0..e3a8e41d5 100644 --- a/winpr/libwinpr/path/test/CMakeLists.txt +++ b/winpr/libwinpr/path/test/CMakeLists.txt @@ -34,11 +34,7 @@ create_test_sourcelist(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -if(WIN32) - target_link_libraries(${MODULE_NAME} Pathcch) -else() - target_link_libraries(${MODULE_NAME} winpr-path) -endif() +target_link_libraries(${MODULE_NAME} winpr-path) foreach(test ${${MODULE_PREFIX}_TESTS}) get_filename_component(TestName ${test} NAME_WE) diff --git a/winpr/libwinpr/path/test/TestPathAllocCombine.c b/winpr/libwinpr/path/test/TestPathAllocCombine.c index a2fd2b069..dcddb2dc9 100644 --- a/winpr/libwinpr/path/test/TestPathAllocCombine.c +++ b/winpr/libwinpr/path/test/TestPathAllocCombine.c @@ -29,7 +29,7 @@ int TestPathAllocCombine(int argc, char* argv[]) if (_tcscmp(PathOut, testPathOut) != 0) { - _tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), PathOut, testPathOut); + _tprintf(_T("Path Mismatch 1: Actual: %s, Expected: %s\n"), PathOut, testPathOut); return -1; } @@ -47,7 +47,7 @@ int TestPathAllocCombine(int argc, char* argv[]) if (_tcscmp(PathOut, testPathOutMorePathBackslash) != 0) { - _tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), PathOut, testPathOutMorePathBackslash); + _tprintf(_T("Path Mismatch 2: Actual: %s, Expected: %s\n"), PathOut, testPathOutMorePathBackslash); return -1; } @@ -65,7 +65,7 @@ int TestPathAllocCombine(int argc, char* argv[]) if (_tcscmp(PathOut, testPathOutMorePathBackslash) != 0) { - _tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), PathOut, testPathOutMorePathBackslash); + _tprintf(_T("Path Mismatch 3: Actual: %s, Expected: %s\n"), PathOut, testPathOutMorePathBackslash); return -1; } @@ -83,7 +83,7 @@ int TestPathAllocCombine(int argc, char* argv[]) if (_tcscmp(PathOut, testPathOut) != 0) { - _tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), PathOut, testPathOut); + _tprintf(_T("Path Mismatch 4: Actual: %s, Expected: %s\n"), PathOut, testPathOut); return -1; } diff --git a/winpr/libwinpr/pipe/CMakeLists.txt b/winpr/libwinpr/pipe/CMakeLists.txt new file mode 100644 index 000000000..034abbee6 --- /dev/null +++ b/winpr/libwinpr/pipe/CMakeLists.txt @@ -0,0 +1,47 @@ +# WinPR: Windows Portable Runtime +# libwinpr-pipe cmake build script +# +# Copyright 2012 Marc-Andre Moreau +# +# 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. + +set(MODULE_NAME "winpr-pipe") +set(MODULE_PREFIX "WINPR_PIPE") + +set(${MODULE_PREFIX}_SRCS + pipe.c) + +if(MSVC AND (NOT MONOLITHIC_BUILD)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + +if(MONOLITHIC_BUILD) + add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) +else() + add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) +endif() + +set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") + +if(MONOLITHIC_BUILD) + +else() + target_link_libraries(${MODULE_NAME} winpr-crt winpr-file winpr-handle) + install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR") + +if(BUILD_TESTING) + add_subdirectory(test) +endif() diff --git a/winpr/libwinpr/pipe/ModuleOptions.cmake b/winpr/libwinpr/pipe/ModuleOptions.cmake new file mode 100644 index 000000000..557e6a149 --- /dev/null +++ b/winpr/libwinpr/pipe/ModuleOptions.cmake @@ -0,0 +1,9 @@ + +set(MINWIN_LAYER "1") +set(MINWIN_GROUP "core") +set(MINWIN_MAJOR_VERSION "2") +set(MINWIN_MINOR_VERSION "0") +set(MINWIN_SHORT_NAME "namedpipe") +set(MINWIN_LONG_NAME "Named Pipe Functions") +set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}") + diff --git a/winpr/libwinpr/pipe/module.def b/winpr/libwinpr/pipe/module.def new file mode 100644 index 000000000..8c4cc1eac --- /dev/null +++ b/winpr/libwinpr/pipe/module.def @@ -0,0 +1,3 @@ +LIBRARY "libwinpr-pipe" +EXPORTS + diff --git a/winpr/libwinpr/pipe/pipe.c b/winpr/libwinpr/pipe/pipe.c new file mode 100644 index 000000000..14d784beb --- /dev/null +++ b/winpr/libwinpr/pipe/pipe.c @@ -0,0 +1,61 @@ +/** + * WinPR: Windows Portable Runtime + * Pipe Functions + * + * Copyright 2012 Marc-Andre Moreau + * + * 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 +#include + +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifndef _WIN32 + +BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize) +{ + void* ptr; + HANDLE handle; + int pipe_fd[2]; + + pipe_fd[0] = -1; + pipe_fd[1] = -1; + + if (pipe(pipe_fd) < 0) + { + printf("CreatePipe: failed to create pipe\n"); + return FALSE; + } + + ptr = (void*) ((ULONG_PTR) pipe_fd[0]); + handle = winpr_Handle_Insert(HANDLE_TYPE_ANONYMOUS_PIPE, ptr); + *((ULONG_PTR*) hReadPipe) = (ULONG_PTR) handle; + + ptr = (void*) ((ULONG_PTR) pipe_fd[1]); + handle = winpr_Handle_Insert(HANDLE_TYPE_ANONYMOUS_PIPE, ptr); + *((ULONG_PTR*) hWritePipe) = (ULONG_PTR) handle; + + return TRUE; +} + +#endif diff --git a/winpr/libwinpr/pipe/test/.gitignore b/winpr/libwinpr/pipe/test/.gitignore new file mode 100644 index 000000000..5ecbf1e1e --- /dev/null +++ b/winpr/libwinpr/pipe/test/.gitignore @@ -0,0 +1,3 @@ +TestPipe +TestPipe.c + diff --git a/winpr/libwinpr/pipe/test/CMakeLists.txt b/winpr/libwinpr/pipe/test/CMakeLists.txt new file mode 100644 index 000000000..9122159ad --- /dev/null +++ b/winpr/libwinpr/pipe/test/CMakeLists.txt @@ -0,0 +1,23 @@ + +set(MODULE_NAME "TestPipe") +set(MODULE_PREFIX "TEST_PIPE") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestPipeCreatePipe.c) + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +target_link_libraries(${MODULE_NAME} winpr-pipe) + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${EXECUTABLE_OUTPUT_PATH}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test") diff --git a/winpr/libwinpr/pipe/test/TestPipeCreatePipe.c b/winpr/libwinpr/pipe/test/TestPipeCreatePipe.c new file mode 100644 index 000000000..ecf9b36fb --- /dev/null +++ b/winpr/libwinpr/pipe/test/TestPipeCreatePipe.c @@ -0,0 +1,70 @@ + +#include +#include +#include +#include +#include + +#define BUFFER_SIZE 16 + +int TestPipeCreatePipe(int argc, char* argv[]) +{ + BOOL status; + DWORD dwRead; + DWORD dwWrite; + HANDLE hReadPipe; + HANDLE hWritePipe; + BYTE readBuffer[BUFFER_SIZE]; + BYTE writeBuffer[BUFFER_SIZE]; + + status = CreatePipe(&hReadPipe, &hWritePipe, NULL, BUFFER_SIZE * 2); + + if (!status) + { + _tprintf(_T("CreatePipe failed\n")); + return -1; + } + + FillMemory(writeBuffer, sizeof(writeBuffer), 0xAA); + status = WriteFile(hWritePipe, &writeBuffer, sizeof(writeBuffer), &dwWrite, NULL); + + if (!status) + { + _tprintf(_T("WriteFile failed\n")); + return -1; + } + + if (dwWrite != sizeof(writeBuffer)) + { + _tprintf(_T("WriteFile: unexpected number of bytes written: Actual: %d, Expected: %d\n"), + dwWrite, sizeof(writeBuffer)); + return -1; + } + + ZeroMemory(readBuffer, sizeof(readBuffer)); + status = ReadFile(hReadPipe, &readBuffer, sizeof(readBuffer), &dwRead, NULL); + + if (!status) + { + _tprintf(_T("ReadFile failed\n")); + return -1; + } + + if (dwRead != sizeof(readBuffer)) + { + _tprintf(_T("ReadFile: unexpected number of bytes read: Actual: %d, Expected: %d\n"), + dwWrite, sizeof(readBuffer)); + return -1; + } + + if (memcmp(readBuffer, writeBuffer, BUFFER_SIZE) != 0) + { + _tprintf(_T("ReadFile: read buffer is different from write buffer\n")); + return -1; + } + + CloseHandle(hReadPipe); + CloseHandle(hWritePipe); + + return 0; +} diff --git a/winpr/libwinpr/registry/CMakeLists.txt b/winpr/libwinpr/registry/CMakeLists.txt index b76c1014f..3ed84b94a 100644 --- a/winpr/libwinpr/registry/CMakeLists.txt +++ b/winpr/libwinpr/registry/CMakeLists.txt @@ -23,7 +23,7 @@ set(${MODULE_PREFIX}_SRCS registry_reg.h registry.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -31,7 +31,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() target_link_libraries(${MODULE_NAME} winpr-utils) diff --git a/winpr/libwinpr/rpc/CMakeLists.txt b/winpr/libwinpr/rpc/CMakeLists.txt index ec3c3bb39..a871e748e 100644 --- a/winpr/libwinpr/rpc/CMakeLists.txt +++ b/winpr/libwinpr/rpc/CMakeLists.txt @@ -41,7 +41,7 @@ set(${MODULE_PREFIX}_SRCS ndr_union.h midl.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -61,7 +61,7 @@ else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ZLIB_LIBRARIES}) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) diff --git a/winpr/libwinpr/sspi/CMakeLists.txt b/winpr/libwinpr/sspi/CMakeLists.txt index 197aa4639..6e3ae9416 100644 --- a/winpr/libwinpr/sspi/CMakeLists.txt +++ b/winpr/libwinpr/sspi/CMakeLists.txt @@ -53,7 +53,7 @@ if(NOT WITH_NATIVE_SSPI) ${${MODULE_PREFIX}_SRCS}) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${WINPR_SSPI_SRCS}) else() add_library(${MODULE_NAME} ${WINPR_SSPI_SRCS}) @@ -74,7 +74,7 @@ else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ZLIB_LIBRARIES}) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) else() if (NOT WIN32) @@ -87,7 +87,7 @@ else() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-utils) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) diff --git a/winpr/libwinpr/sspi/test/TestEnumerateSecurityPackages.c b/winpr/libwinpr/sspi/test/TestEnumerateSecurityPackages.c index cab3884c6..8cca3e3cc 100644 --- a/winpr/libwinpr/sspi/test/TestEnumerateSecurityPackages.c +++ b/winpr/libwinpr/sspi/test/TestEnumerateSecurityPackages.c @@ -23,7 +23,7 @@ int TestEnumerateSecurityPackages(int argc, char* argv[]) printf("\nEnumerateSecurityPackages (%d):\n", (unsigned int)cPackages); - for (index = 0; index < cPackages; index++) + for (index = 0; index < (int) cPackages; index++) { printf("\"%s\", \"%s\"\n", pPackageInfo[index].Name, pPackageInfo[index].Comment); } diff --git a/winpr/libwinpr/sspicli/CMakeLists.txt b/winpr/libwinpr/sspicli/CMakeLists.txt index 9374da3fb..ced818b91 100644 --- a/winpr/libwinpr/sspicli/CMakeLists.txt +++ b/winpr/libwinpr/sspicli/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_SSPICLI") set(${MODULE_PREFIX}_SRCS sspicli.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/synch/CMakeLists.txt b/winpr/libwinpr/synch/CMakeLists.txt index 9ab399b3f..4d6bda84b 100644 --- a/winpr/libwinpr/synch/CMakeLists.txt +++ b/winpr/libwinpr/synch/CMakeLists.txt @@ -37,11 +37,11 @@ set(${MODULE_PREFIX}_SRCS timer.c wait.c) -if(MSVC) +if(MSVC AND (NOT MONOLITHIC_BUILD)) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -57,13 +57,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES SunOS) set(WINPR_SYNCH_LIBS ${WINPR_SYNCH_LIBS} rt) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() - if(NOT WIN32) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-handle) - endif() - + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-handle) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/winpr/libwinpr/sysinfo/CMakeLists.txt b/winpr/libwinpr/sysinfo/CMakeLists.txt index f05d6c553..8a84e8ab5 100644 --- a/winpr/libwinpr/sysinfo/CMakeLists.txt +++ b/winpr/libwinpr/sysinfo/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_SYSINFO") set(${MODULE_PREFIX}_SRCS sysinfo.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/thread/CMakeLists.txt b/winpr/libwinpr/thread/CMakeLists.txt index d53f523ea..c15fecf63 100644 --- a/winpr/libwinpr/thread/CMakeLists.txt +++ b/winpr/libwinpr/thread/CMakeLists.txt @@ -27,7 +27,11 @@ set(${MODULE_PREFIX}_SRCS thread.c tls.c) -if(WITH_MONOLITHIC_BUILD) +if(MSVC AND (NOT MONOLITHIC_BUILD)) + set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def) +endif() + +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -43,12 +47,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES SunOS) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} rt) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() - if(NOT WIN32) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-handle) - endif() + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr-handle) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/thread/module.def b/winpr/libwinpr/thread/module.def new file mode 100644 index 000000000..688109ba6 --- /dev/null +++ b/winpr/libwinpr/thread/module.def @@ -0,0 +1,3 @@ +LIBRARY "libwinpr-thread" +EXPORTS + diff --git a/winpr/libwinpr/timezone/CMakeLists.txt b/winpr/libwinpr/timezone/CMakeLists.txt index afbbd50d7..c37638a0a 100644 --- a/winpr/libwinpr/timezone/CMakeLists.txt +++ b/winpr/libwinpr/timezone/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_TIMEZONE") set(${MODULE_PREFIX}_SRCS timezone.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/utils/CMakeLists.txt b/winpr/libwinpr/utils/CMakeLists.txt index eb327c5e5..1ca3a04bc 100644 --- a/winpr/libwinpr/utils/CMakeLists.txt +++ b/winpr/libwinpr/utils/CMakeLists.txt @@ -27,7 +27,7 @@ set(${MODULE_PREFIX}_SRCS include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${OPENSSL_INCLUDE_DIR}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -39,7 +39,7 @@ set(${MODULE_PREFIX}_LIBS ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() if (NOT WIN32) diff --git a/winpr/libwinpr/utils/ModuleOptions.cmake b/winpr/libwinpr/utils/ModuleOptions.cmake new file mode 100644 index 000000000..9e37ca69e --- /dev/null +++ b/winpr/libwinpr/utils/ModuleOptions.cmake @@ -0,0 +1,9 @@ + +set(MINWIN_LAYER "0") +set(MINWIN_GROUP "none") +set(MINWIN_MAJOR_VERSION "0") +set(MINWIN_MINOR_VERSION "0") +set(MINWIN_SHORT_NAME "utils") +set(MINWIN_LONG_NAME "WinPR Utils") +set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}") + diff --git a/winpr/libwinpr/winhttp/CMakeLists.txt b/winpr/libwinpr/winhttp/CMakeLists.txt index ccdf271f5..e84912d4d 100644 --- a/winpr/libwinpr/winhttp/CMakeLists.txt +++ b/winpr/libwinpr/winhttp/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_WINHTTP") set(${MODULE_PREFIX}_SRCS winhttp.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -29,7 +29,7 @@ endif() set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib") -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) else() install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/winpr/libwinpr/winsock/CMakeLists.txt b/winpr/libwinpr/winsock/CMakeLists.txt index abdab2387..b70a25bcc 100644 --- a/winpr/libwinpr/winsock/CMakeLists.txt +++ b/winpr/libwinpr/winsock/CMakeLists.txt @@ -21,7 +21,7 @@ set(MODULE_PREFIX "WINPR_WINSOCK") set(${MODULE_PREFIX}_SRCS winsock.c) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) add_library(${MODULE_NAME} OBJECT ${${MODULE_PREFIX}_SRCS}) else() add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) @@ -33,7 +33,7 @@ if(WIN32) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ws2_32) endif() -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE) else() target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) diff --git a/winpr/tools/hash/CMakeLists.txt b/winpr/tools/hash/CMakeLists.txt index 1e671ab0e..c8e0205c5 100644 --- a/winpr/tools/hash/CMakeLists.txt +++ b/winpr/tools/hash/CMakeLists.txt @@ -23,7 +23,7 @@ set(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -if(WITH_MONOLITHIC_BUILD) +if(MONOLITHIC_BUILD) target_link_libraries(${MODULE_NAME} winpr) else() target_link_libraries(${MODULE_NAME} winpr-utils)