From 6ed3914ca245a7ed1b52c474279b8bfa2bbc1cfe Mon Sep 17 00:00:00 2001 From: ivan-83 Date: Thu, 19 Mar 2015 02:41:29 +0300 Subject: [PATCH] * debug and error messages now print function name and line number * add debug messages to trace fake network dissconects --- channels/audin/client/audin_main.c | 24 ++-- channels/tsmf/client/tsmf_audio.c | 6 +- libfreerdp/core/fastpath.c | 34 ++--- libfreerdp/core/freerdp.c | 6 +- libfreerdp/core/orders.c | 220 +++++++++++++++++++++-------- libfreerdp/core/peer.c | 38 ++--- libfreerdp/core/rdp.c | 96 ++++++++----- libfreerdp/core/transport.c | 9 +- libfreerdp/core/update.c | 21 ++- winpr/libwinpr/utils/wlog/wlog.c | 8 +- 10 files changed, 308 insertions(+), 154 deletions(-) diff --git a/channels/audin/client/audin_main.c b/channels/audin/client/audin_main.c index e86233d46..53b18a905 100644 --- a/channels/audin/client/audin_main.c +++ b/channels/audin/client/audin_main.c @@ -97,7 +97,7 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, w Stream_Read_UINT32(s, Version); - DEBUG_DVC("process_version: Version=%d", Version); + DEBUG_DVC("Version=%d", Version); out = Stream_New(NULL, 5); Stream_Write_UINT8(out, MSG_SNDIN_VERSION); @@ -130,7 +130,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w UINT32 cbSizeFormatsPacket; Stream_Read_UINT32(s, NumFormats); - DEBUG_DVC("process_formats: NumFormats %d", NumFormats); + DEBUG_DVC("NumFormats %d", NumFormats); if ((NumFormats < 1) || (NumFormats > 1000)) { WLog_ERR(TAG, "bad NumFormats %d", NumFormats); @@ -158,7 +158,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w format.data = Stream_Pointer(s); Stream_Seek(s, format.cbSize); - DEBUG_DVC("process_formats: wFormatTag=%d nChannels=%d nSamplesPerSec=%d " + DEBUG_DVC("wFormatTag=%d nChannels=%d nSamplesPerSec=%d " "nBlockAlign=%d wBitsPerSample=%d cbSize=%d", format.wFormatTag, format.nChannels, format.nSamplesPerSec, format.nBlockAlign, format.wBitsPerSample, format.cbSize); @@ -171,7 +171,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w continue; if (audin->device && audin->device->FormatSupported(audin->device, &format)) { - DEBUG_DVC("process_formats: format ok"); + DEBUG_DVC("format ok"); /* Store the agreed format in the corresponding index */ callback->formats[callback->formats_count++] = format; @@ -264,7 +264,7 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, wStr Stream_Read_UINT32(s, FramesPerPacket); Stream_Read_UINT32(s, initialFormat); - DEBUG_DVC("process_open: FramesPerPacket=%d initialFormat=%d", + DEBUG_DVC("FramesPerPacket=%d initialFormat=%d", FramesPerPacket, initialFormat); if (initialFormat >= (UINT32) callback->formats_count) @@ -296,7 +296,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb Stream_Read_UINT32(s, NewFormat); - DEBUG_DVC("process_format_change: NewFormat=%d", NewFormat); + DEBUG_DVC("NewFormat=%d", NewFormat); if (NewFormat >= (UINT32) callback->formats_count) { @@ -326,7 +326,7 @@ static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, Stream_Read_UINT8(data, MessageId); - DEBUG_DVC("on_data_received: MessageId=0x%x", MessageId); + DEBUG_DVC("MessageId=0x%x", MessageId); switch (MessageId) { @@ -360,7 +360,7 @@ static int audin_on_close(IWTSVirtualChannelCallback* pChannelCallback) AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin; - DEBUG_DVC("on_close"); + DEBUG_DVC("..."); if (audin->device) IFCALL(audin->device->Close, audin->device); @@ -378,7 +378,7 @@ static int audin_on_new_channel_connection(IWTSListenerCallback* pListenerCallba AUDIN_CHANNEL_CALLBACK* callback; AUDIN_LISTENER_CALLBACK* listener_callback = (AUDIN_LISTENER_CALLBACK*) pListenerCallback; - DEBUG_DVC("on_new_channel_connection"); + DEBUG_DVC("..."); callback = (AUDIN_CHANNEL_CALLBACK*) malloc(sizeof(AUDIN_CHANNEL_CALLBACK)); ZeroMemory(callback, sizeof(AUDIN_CHANNEL_CALLBACK)); @@ -398,7 +398,7 @@ static int audin_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage { AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin; - DEBUG_DVC("plugin_initialize"); + DEBUG_DVC("..."); audin->listener_callback = (AUDIN_LISTENER_CALLBACK*) malloc(sizeof(AUDIN_LISTENER_CALLBACK)); ZeroMemory(audin->listener_callback, sizeof(AUDIN_LISTENER_CALLBACK)); @@ -415,7 +415,7 @@ static int audin_plugin_terminated(IWTSPlugin* pPlugin) { AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin; - DEBUG_DVC("plugin_terminated"); + DEBUG_DVC("..."); if (audin->device) { @@ -445,7 +445,7 @@ static void audin_register_device_plugin(IWTSPlugin* pPlugin, IAudinDevice* devi return; } - DEBUG_DVC("register_device_plugin: device registered."); + DEBUG_DVC("device registered."); audin->device = device; } diff --git a/channels/tsmf/client/tsmf_audio.c b/channels/tsmf/client/tsmf_audio.c index 1bf16de3a..bd6e34cd9 100644 --- a/channels/tsmf/client/tsmf_audio.c +++ b/channels/tsmf/client/tsmf_audio.c @@ -48,9 +48,9 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const if (!audio->Open(audio, device)) { audio->Free(audio); audio = NULL; - WLog_ERR(TAG, "tsmf_load_audio_device_by_name: failed to open, name: %s, device: %s", name, device); + WLog_ERR(TAG, "failed to open, name: %s, device: %s", name, device); } else { - WLog_DBG(TAG, "tsmf_load_audio_device_by_name: name: %s, device: %s", name, device); + WLog_DBG(TAG, "name: %s, device: %s", name, device); } return audio; @@ -85,7 +85,7 @@ ITSMFAudioDevice* tsmf_load_audio_device(const char* name, const char* device) if (audio == NULL) { WLog_ERR(TAG, "no sound device."); } else { - WLog_DBG(TAG, "tsmf_load_audio_device: name: %s, device: %s", name, device); + WLog_DBG(TAG, "name: %s, device: %s", name, device); } return audio; diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index 70c4d6e09..8de4d8ccb 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -263,7 +263,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s { case FASTPATH_UPDATETYPE_ORDERS: if (!fastpath_recv_orders(fastpath, s)) { - WLog_DBG(TAG, "fastpath_recv_update: FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()"); + WLog_DBG(TAG, "FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()"); return -1; } break; @@ -271,14 +271,14 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s case FASTPATH_UPDATETYPE_BITMAP: case FASTPATH_UPDATETYPE_PALETTE: if (!fastpath_recv_update_common(fastpath, s)) { - WLog_DBG(TAG, "fastpath_recv_update: FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()"); + WLog_DBG(TAG, "FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()"); return -1; } break; case FASTPATH_UPDATETYPE_SYNCHRONIZE: if (!fastpath_recv_update_synchronize(fastpath, s)) - WLog_ERR(TAG, "fastpath_recv_update: fastpath_recv_update_synchronize failure but we continue"); + WLog_ERR(TAG, "fastpath_recv_update_synchronize failure but we continue"); else IFCALL(update->Synchronize, context); break; @@ -286,7 +286,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s case FASTPATH_UPDATETYPE_SURFCMDS: status = update_recv_surfcmds(update, size, s); if (status < 0) - WLog_DBG(TAG, "fastpath_recv_update: FASTPATH_UPDATETYPE_SURFCMDS - update_recv_surfcmds() - %i", status); + WLog_DBG(TAG, "FASTPATH_UPDATETYPE_SURFCMDS - update_recv_surfcmds() - %i", status); break; case FASTPATH_UPDATETYPE_PTR_NULL: @@ -301,7 +301,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s case FASTPATH_UPDATETYPE_PTR_POSITION: if (!update_read_pointer_position(s, &pointer->pointer_position)) { - WLog_DBG(TAG, "fastpath_recv_update: FASTPATH_UPDATETYPE_PTR_POSITION - update_read_pointer_position()"); + WLog_DBG(TAG, "FASTPATH_UPDATETYPE_PTR_POSITION - update_read_pointer_position()"); return -1; } IFCALL(pointer->PointerPosition, context, &pointer->pointer_position); @@ -309,7 +309,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s case FASTPATH_UPDATETYPE_COLOR: if (!update_read_pointer_color(s, &pointer->pointer_color, 24)) { - WLog_DBG(TAG, "fastpath_recv_update: FASTPATH_UPDATETYPE_COLOR - update_read_pointer_color()"); + WLog_DBG(TAG, "FASTPATH_UPDATETYPE_COLOR - update_read_pointer_color()"); return -1; } IFCALL(pointer->PointerColor, context, &pointer->pointer_color); @@ -317,7 +317,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s case FASTPATH_UPDATETYPE_CACHED: if (!update_read_pointer_cached(s, &pointer->pointer_cached)) { - WLog_DBG(TAG, "fastpath_recv_update: FASTPATH_UPDATETYPE_CACHED - update_read_pointer_cached()"); + WLog_DBG(TAG, "FASTPATH_UPDATETYPE_CACHED - update_read_pointer_cached()"); return -1; } IFCALL(pointer->PointerCached, context, &pointer->pointer_cached); @@ -325,7 +325,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s case FASTPATH_UPDATETYPE_POINTER: if (!update_read_pointer_new(s, &pointer->pointer_new)) { - WLog_DBG(TAG, "fastpath_recv_update: FASTPATH_UPDATETYPE_POINTER - update_read_pointer_new()"); + WLog_DBG(TAG, "FASTPATH_UPDATETYPE_POINTER - update_read_pointer_new()"); return -1; } IFCALL(pointer->PointerNew, context, &pointer->pointer_new); @@ -384,7 +384,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) Stream_Read_UINT16(s, size); if (Stream_GetRemainingLength(s) < size) { - WLog_DBG(TAG, "fastpath_recv_update_data: Stream_GetRemainingLength() < size"); + WLog_DBG(TAG, "Stream_GetRemainingLength() < size"); return -1; } @@ -395,7 +395,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) if (bulkStatus < 0) { - WLog_ERR(TAG, "fastpath_recv_update_data: bulk_decompress() failed"); + WLog_ERR(TAG, "bulk_decompress() failed"); return -1; } @@ -417,7 +417,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) { if (fastpath->fragmentation != -1) { - WLog_ERR(TAG, "fastpath_recv_update_data: Unexpected FASTPATH_FRAGMENT_SINGLE"); + WLog_ERR(TAG, "Unexpected FASTPATH_FRAGMENT_SINGLE"); goto out_fail; } @@ -445,7 +445,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) if (totalSize > transport->settings->MultifragMaxRequestSize) { - WLog_ERR(TAG, "fastpath_recv_update_data: Total size (%d) exceeds MultifragMaxRequestSize (%d)", + WLog_ERR(TAG, "Total size (%d) exceeds MultifragMaxRequestSize (%d)", totalSize, transport->settings->MultifragMaxRequestSize); goto out_fail; } @@ -472,7 +472,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) if (totalSize > transport->settings->MultifragMaxRequestSize) { - WLog_ERR(TAG, "fastpath_recv_update_data: Total size (%d) exceeds MultifragMaxRequestSize (%d)", + WLog_ERR(TAG, "Total size (%d) exceeds MultifragMaxRequestSize (%d)", totalSize, transport->settings->MultifragMaxRequestSize); goto out_fail; } @@ -500,7 +500,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) if (totalSize > transport->settings->MultifragMaxRequestSize) { - WLog_ERR(TAG, "fastpath_recv_update_data: Total size (%d) exceeds MultifragMaxRequestSize (%d)", + WLog_ERR(TAG, "Total size (%d) exceeds MultifragMaxRequestSize (%d)", totalSize, transport->settings->MultifragMaxRequestSize); goto out_fail; } @@ -552,7 +552,7 @@ int fastpath_recv_updates(rdpFastPath* fastpath, wStream* s) while (Stream_GetRemainingLength(s) >= 3) { if (fastpath_recv_update_data(fastpath, s) < 0) { - WLog_DBG(TAG, "fastpath_recv_updates: fastpath_recv_update_data() fail"); + WLog_DBG(TAG, "fastpath_recv_update_data() fail"); return -1; } } @@ -703,7 +703,7 @@ static BOOL fastpath_recv_input_event(rdpFastPath* fastpath, wStream* s) break; default: - WLog_ERR(TAG, "Unknown eventCode %d", eventCode); + WLog_ERR(TAG, "Unknown eventCode %d", eventCode); break; } @@ -814,7 +814,7 @@ BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iNu if (length >= (2 << 14)) { - WLog_ERR(TAG, "Maximum FastPath PDU length is 32767"); + WLog_ERR(TAG, "Maximum FastPath PDU length is 32767"); return FALSE; } diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index 5b88a9ecb..01835c660 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -210,7 +210,7 @@ BOOL freerdp_check_fds(freerdp* instance) TerminateEventArgs e; rdpContext* context = instance->context; - WLog_DBG(TAG, "freerdp_check_fds: rdp_check_fds() - %i", status); + WLog_DBG(TAG, "rdp_check_fds() - %i", status); EventArgsInit(&e, "freerdp"); e.code = 0; PubSub_OnTerminate(context->pubSub, context, &e); @@ -245,13 +245,13 @@ BOOL freerdp_check_event_handles(rdpContext* context) status = freerdp_check_fds(context->instance); if (!status) { - WLog_DBG(TAG, "freerdp_check_event_handles: freerdp_check_fds() - %i", status); + WLog_DBG(TAG, "freerdp_check_fds() - %i", status); return FALSE; } status = freerdp_channels_check_fds(context->channels, context->instance); if (!status) { - WLog_DBG(TAG, "freerdp_check_event_handles: freerdp_channels_check_fds() - %i", status); + WLog_DBG(TAG, "freerdp_channels_check_fds() - %i", status); return FALSE; } diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 66531b52b..45a47c401 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -499,8 +499,10 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value) { BYTE byte; - if (Stream_GetRemainingLength(s) < 1) + if (Stream_GetRemainingLength(s) < 1) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); return FALSE; + } Stream_Read_UINT8(s, byte); if (byte & 0x40) @@ -510,8 +512,10 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value) if (byte & 0x80) { - if (Stream_GetRemainingLength(s) < 1) + if (Stream_GetRemainingLength(s) < 1) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); return FALSE; + } Stream_Read_UINT8(s, byte); *value = (*value << 8) | byte; } @@ -722,8 +726,10 @@ static INLINE BOOL update_read_delta_points(wStream* s, DELTA_POINT* points, int zeroBitsSize = ((number + 3) / 4); - if (Stream_GetRemainingLength(s) < zeroBitsSize) + if (Stream_GetRemainingLength(s) < zeroBitsSize) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < %i", zeroBitsSize); return FALSE; + } Stream_GetPointer(s, zeroBits); Stream_Seek(s, zeroBitsSize); @@ -735,11 +741,15 @@ static INLINE BOOL update_read_delta_points(wStream* s, DELTA_POINT* points, int if (i % 4 == 0) flags = zeroBits[i / 4]; - if ((~flags & 0x80) && !update_read_delta(s, &points[i].x)) + if ((~flags & 0x80) && !update_read_delta(s, &points[i].x)) { + WLog_DBG(TAG, "update_read_delta(x) failed"); return FALSE; + } - if ((~flags & 0x40) && !update_read_delta(s, &points[i].y)) + if ((~flags & 0x40) && !update_read_delta(s, &points[i].y)) { + WLog_DBG(TAG, "update_read_delta(y) failed"); return FALSE; + } flags <<= 2; } @@ -1335,13 +1345,17 @@ BOOL update_read_polyline_order(wStream* s, ORDER_INFO* orderInfo, POLYLINE_ORDE { DELTA_POINT *new_points; - if (Stream_GetRemainingLength(s) < 1) + if (Stream_GetRemainingLength(s) < 1) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); return FALSE; + } Stream_Read_UINT8(s, polyline->cbData); new_points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * new_num); - if (!new_points) + if (!new_points) { + WLog_DBG(TAG, "realloc(%i) failed", new_num); return FALSE; + } polyline->points = new_points; polyline->numDeltaEntries = new_num; @@ -3134,15 +3148,19 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags) } if (!update_read_field_flags(s, &(orderInfo->fieldFlags), flags, - PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType])) + PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType])) { + WLog_DBG(TAG, "update_read_field_flags() failed"); return FALSE; + } if (flags & ORDER_BOUNDS) { if (!(flags & ORDER_ZERO_BOUNDS_DELTAS)) { - if (!update_read_bounds(s, &orderInfo->bounds)) + if (!update_read_bounds(s, &orderInfo->bounds)) { + WLog_DBG(TAG, "update_read_bounds() failed"); return FALSE; + } } IFCALL(update->SetBounds, context, &orderInfo->bounds); @@ -3157,155 +3175,199 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags) switch (orderInfo->orderType) { case ORDER_TYPE_DSTBLT: - if (!update_read_dstblt_order(s, orderInfo, &(primary->dstblt))) + if (!update_read_dstblt_order(s, orderInfo, &(primary->dstblt))) { + WLog_DBG(TAG, "ORDER_TYPE_DSTBLT - update_read_dstblt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DstBlt"); IFCALL(primary->DstBlt, context, &primary->dstblt); break; case ORDER_TYPE_PATBLT: - if (!update_read_patblt_order(s, orderInfo, &(primary->patblt))) + if (!update_read_patblt_order(s, orderInfo, &(primary->patblt))) { + WLog_DBG(TAG, "ORDER_TYPE_PATBLT - update_read_patblt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "PatBlt"); IFCALL(primary->PatBlt, context, &primary->patblt); break; case ORDER_TYPE_SCRBLT: - if (!update_read_scrblt_order(s, orderInfo, &(primary->scrblt))) + if (!update_read_scrblt_order(s, orderInfo, &(primary->scrblt))) { + WLog_DBG(TAG, "ORDER_TYPE_SCRBLT - update_read_scrblt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "ScrBlt"); IFCALL(primary->ScrBlt, context, &primary->scrblt); break; case ORDER_TYPE_OPAQUE_RECT: - if (!update_read_opaque_rect_order(s, orderInfo, &(primary->opaque_rect))) + if (!update_read_opaque_rect_order(s, orderInfo, &(primary->opaque_rect))) { + WLog_DBG(TAG, "ORDER_TYPE_OPAQUE_RECT - update_read_opaque_rect_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "OpaqueRect"); IFCALL(primary->OpaqueRect, context, &primary->opaque_rect); break; case ORDER_TYPE_DRAW_NINE_GRID: - if (!update_read_draw_nine_grid_order(s, orderInfo, &(primary->draw_nine_grid))) + if (!update_read_draw_nine_grid_order(s, orderInfo, &(primary->draw_nine_grid))) { + WLog_DBG(TAG, "ORDER_TYPE_DRAW_NINE_GRID - update_read_draw_nine_grid_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DrawNineGrid"); IFCALL(primary->DrawNineGrid, context, &primary->draw_nine_grid); break; case ORDER_TYPE_MULTI_DSTBLT: - if (!update_read_multi_dstblt_order(s, orderInfo, &(primary->multi_dstblt))) + if (!update_read_multi_dstblt_order(s, orderInfo, &(primary->multi_dstblt))) { + WLog_DBG(TAG, "ORDER_TYPE_MULTI_DSTBLT - update_read_multi_dstblt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "MultiDstBlt"); IFCALL(primary->MultiDstBlt, context, &primary->multi_dstblt); break; case ORDER_TYPE_MULTI_PATBLT: - if (!update_read_multi_patblt_order(s, orderInfo, &(primary->multi_patblt))) + if (!update_read_multi_patblt_order(s, orderInfo, &(primary->multi_patblt))) { + WLog_DBG(TAG, "ORDER_TYPE_MULTI_PATBLT - update_read_multi_patblt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "MultiPatBlt"); IFCALL(primary->MultiPatBlt, context, &primary->multi_patblt); break; case ORDER_TYPE_MULTI_SCRBLT: - if (!update_read_multi_scrblt_order(s, orderInfo, &(primary->multi_scrblt))) + if (!update_read_multi_scrblt_order(s, orderInfo, &(primary->multi_scrblt))) { + WLog_DBG(TAG, "ORDER_TYPE_MULTI_SCRBLT - update_read_multi_scrblt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "MultiScrBlt"); IFCALL(primary->MultiScrBlt, context, &primary->multi_scrblt); break; case ORDER_TYPE_MULTI_OPAQUE_RECT: - if (!update_read_multi_opaque_rect_order(s, orderInfo, &(primary->multi_opaque_rect))) + if (!update_read_multi_opaque_rect_order(s, orderInfo, &(primary->multi_opaque_rect))) { + WLog_DBG(TAG, "ORDER_TYPE_MULTI_OPAQUE_RECT - update_read_multi_opaque_rect_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "MultiOpaqueRect"); IFCALL(primary->MultiOpaqueRect, context, &primary->multi_opaque_rect); break; case ORDER_TYPE_MULTI_DRAW_NINE_GRID: - if (!update_read_multi_draw_nine_grid_order(s, orderInfo, &(primary->multi_draw_nine_grid))) + if (!update_read_multi_draw_nine_grid_order(s, orderInfo, &(primary->multi_draw_nine_grid))) { + WLog_DBG(TAG, "ORDER_TYPE_MULTI_DRAW_NINE_GRID - update_read_multi_draw_nine_grid_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "MultiDrawNineGrid"); IFCALL(primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid); break; case ORDER_TYPE_LINE_TO: - if (!update_read_line_to_order(s, orderInfo, &(primary->line_to))) + if (!update_read_line_to_order(s, orderInfo, &(primary->line_to))) { + WLog_DBG(TAG, "ORDER_TYPE_LINE_TO - update_read_line_to_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "LineTo"); IFCALL(primary->LineTo, context, &primary->line_to); break; case ORDER_TYPE_POLYLINE: - if (!update_read_polyline_order(s, orderInfo, &(primary->polyline))) + if (!update_read_polyline_order(s, orderInfo, &(primary->polyline))) { + WLog_DBG(TAG, "ORDER_TYPE_POLYLINE - update_read_polyline_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "Polyline"); IFCALL(primary->Polyline, context, &primary->polyline); break; case ORDER_TYPE_MEMBLT: - if (!update_read_memblt_order(s, orderInfo, &(primary->memblt))) + if (!update_read_memblt_order(s, orderInfo, &(primary->memblt))) { + WLog_DBG(TAG, "ORDER_TYPE_MEMBLT - update_read_memblt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "MemBlt"); IFCALL(primary->MemBlt, context, &primary->memblt); break; case ORDER_TYPE_MEM3BLT: - if (!update_read_mem3blt_order(s, orderInfo, &(primary->mem3blt))) + if (!update_read_mem3blt_order(s, orderInfo, &(primary->mem3blt))) { + WLog_DBG(TAG, "ORDER_TYPE_MEM3BLT - update_read_mem3blt_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "Mem3Blt"); IFCALL(primary->Mem3Blt, context, &primary->mem3blt); break; case ORDER_TYPE_SAVE_BITMAP: - if (!update_read_save_bitmap_order(s, orderInfo, &(primary->save_bitmap))) + if (!update_read_save_bitmap_order(s, orderInfo, &(primary->save_bitmap))) { + WLog_DBG(TAG, "ORDER_TYPE_SAVE_BITMAP - update_read_save_bitmap_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "SaveBitmap"); IFCALL(primary->SaveBitmap, context, &primary->save_bitmap); break; case ORDER_TYPE_GLYPH_INDEX: - if (!update_read_glyph_index_order(s, orderInfo, &(primary->glyph_index))) + if (!update_read_glyph_index_order(s, orderInfo, &(primary->glyph_index))) { + WLog_DBG(TAG, "ORDER_TYPE_GLYPH_INDEX - update_read_glyph_index_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "GlyphIndex"); IFCALL(primary->GlyphIndex, context, &primary->glyph_index); break; case ORDER_TYPE_FAST_INDEX: - if (!update_read_fast_index_order(s, orderInfo, &(primary->fast_index))) + if (!update_read_fast_index_order(s, orderInfo, &(primary->fast_index))) { + WLog_DBG(TAG, "ORDER_TYPE_FAST_INDEX - update_read_fast_index_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "FastIndex"); IFCALL(primary->FastIndex, context, &primary->fast_index); break; case ORDER_TYPE_FAST_GLYPH: - if (!update_read_fast_glyph_order(s, orderInfo, &(primary->fast_glyph))) + if (!update_read_fast_glyph_order(s, orderInfo, &(primary->fast_glyph))) { + WLog_DBG(TAG, "ORDER_TYPE_FAST_GLYPH - update_read_fast_glyph_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "FastGlyph"); IFCALL(primary->FastGlyph, context, &primary->fast_glyph); break; case ORDER_TYPE_POLYGON_SC: - if (!update_read_polygon_sc_order(s, orderInfo, &(primary->polygon_sc))) + if (!update_read_polygon_sc_order(s, orderInfo, &(primary->polygon_sc))) { + WLog_DBG(TAG, "ORDER_TYPE_POLYGON_SC - update_read_polygon_sc_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "PolygonSC"); IFCALL(primary->PolygonSC, context, &primary->polygon_sc); break; case ORDER_TYPE_POLYGON_CB: - if (!update_read_polygon_cb_order(s, orderInfo, &(primary->polygon_cb))) + if (!update_read_polygon_cb_order(s, orderInfo, &(primary->polygon_cb))) { + WLog_DBG(TAG, "ORDER_TYPE_POLYGON_CB - update_read_polygon_cb_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "PolygonCB"); IFCALL(primary->PolygonCB, context, &primary->polygon_cb); break; case ORDER_TYPE_ELLIPSE_SC: - if (!update_read_ellipse_sc_order(s, orderInfo, &(primary->ellipse_sc))) + if (!update_read_ellipse_sc_order(s, orderInfo, &(primary->ellipse_sc))) { + WLog_DBG(TAG, "ORDER_TYPE_ELLIPSE_SC - update_read_ellipse_sc_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "EllipseSC"); IFCALL(primary->EllipseSC, context, &primary->ellipse_sc); break; case ORDER_TYPE_ELLIPSE_CB: - if (!update_read_ellipse_cb_order(s, orderInfo, &(primary->ellipse_cb))) + if (!update_read_ellipse_cb_order(s, orderInfo, &(primary->ellipse_cb))) { + WLog_DBG(TAG, "ORDER_TYPE_ELLIPSE_CB - update_read_ellipse_cb_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "EllipseCB"); IFCALL(primary->EllipseCB, context, &primary->ellipse_cb); break; @@ -3331,8 +3393,10 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags) rdpContext* context = update->context; rdpSecondaryUpdate* secondary = update->secondary; - if (Stream_GetRemainingLength(s) < 5) + if (Stream_GetRemainingLength(s) < 5) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 5"); return FALSE; + } Stream_Read_UINT16(s, orderLength); /* orderLength (2 bytes) */ Stream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */ @@ -3350,43 +3414,55 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags) switch (orderType) { case ORDER_TYPE_BITMAP_UNCOMPRESSED: - if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), FALSE, extraFlags)) + if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), FALSE, extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED - update_read_cache_bitmap_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressed"); IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order)); break; case ORDER_TYPE_CACHE_BITMAP_COMPRESSED: - if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), TRUE, extraFlags)) + if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), TRUE, extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_CACHE_BITMAP_COMPRESSED - update_read_cache_bitmap_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressed"); IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order)); break; case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2: - if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), FALSE, extraFlags)) + if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), FALSE, extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressedV2"); IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order)); break; case ORDER_TYPE_BITMAP_COMPRESSED_V2: - if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), TRUE, extraFlags)) + if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), TRUE, extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV2"); IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order)); break; case ORDER_TYPE_BITMAP_COMPRESSED_V3: - if (!update_read_cache_bitmap_v3_order(s, &(secondary->cache_bitmap_v3_order), extraFlags)) + if (!update_read_cache_bitmap_v3_order(s, &(secondary->cache_bitmap_v3_order), extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V3 - update_read_cache_bitmap_v3_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV3"); IFCALL(secondary->CacheBitmapV3, context, &(secondary->cache_bitmap_v3_order)); break; case ORDER_TYPE_CACHE_COLOR_TABLE: - if (!update_read_cache_color_table_order(s, &(secondary->cache_color_table_order), extraFlags)) + if (!update_read_cache_color_table_order(s, &(secondary->cache_color_table_order), extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_CACHE_COLOR_TABLE - update_read_cache_color_table_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheColorTable"); IFCALL(secondary->CacheColorTable, context, &(secondary->cache_color_table_order)); break; @@ -3394,23 +3470,29 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags) case ORDER_TYPE_CACHE_GLYPH: if (secondary->glyph_v2) { - if (!update_read_cache_glyph_v2_order(s, &(secondary->cache_glyph_v2_order), extraFlags)) + if (!update_read_cache_glyph_v2_order(s, &(secondary->cache_glyph_v2_order), extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_v2_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheGlyphV2"); IFCALL(secondary->CacheGlyphV2, context, &(secondary->cache_glyph_v2_order)); } else { - if (!update_read_cache_glyph_order(s, &(secondary->cache_glyph_order), extraFlags)) + if (!update_read_cache_glyph_order(s, &(secondary->cache_glyph_order), extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheGlyph"); IFCALL(secondary->CacheGlyph, context, &(secondary->cache_glyph_order)); } break; case ORDER_TYPE_CACHE_BRUSH: - if (!update_read_cache_brush_order(s, &(secondary->cache_brush_order), extraFlags)) + if (!update_read_cache_brush_order(s, &(secondary->cache_brush_order), extraFlags)) { + WLog_DBG(TAG, "ORDER_TYPE_CACHE_BRUSH - update_read_cache_brush_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CacheBrush"); IFCALL(secondary->CacheBrush, context, &(secondary->cache_brush_order)); break; @@ -3434,94 +3516,118 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags) #ifdef WITH_DEBUG_ORDERS if (orderType < ALTSEC_DRAWING_ORDER_COUNT) - WLog_DBG(TAG, "%s Alternate Secondary Drawing Order (0x%02X)", ALTSEC_DRAWING_ORDER_STRINGS[orderType], orderType); + WLog_DBG(TAG, "%s Alternate Secondary Drawing Order (0x%02X)", ALTSEC_DRAWING_ORDER_STRINGS[orderType], orderType); else - WLog_DBG(TAG, "Unknown Alternate Secondary Drawing Order: 0x%02X", orderType); + WLog_DBG(TAG, "Unknown Alternate Secondary Drawing Order: 0x%02X", orderType); #endif switch (orderType) { case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP: - if (!update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap))) + if (!update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap))) { + WLog_DBG(TAG, "ORDER_TYPE_CREATE_OFFSCREEN_BITMAP - update_read_create_offscreen_bitmap_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CreateOffscreenBitmap"); IFCALL(altsec->CreateOffscreenBitmap, context, &(altsec->create_offscreen_bitmap)); break; case ORDER_TYPE_SWITCH_SURFACE: - if (!update_read_switch_surface_order(s, &(altsec->switch_surface))) + if (!update_read_switch_surface_order(s, &(altsec->switch_surface))) { + WLog_DBG(TAG, "ORDER_TYPE_SWITCH_SURFACE - update_read_switch_surface_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "SwitchSurface"); IFCALL(altsec->SwitchSurface, context, &(altsec->switch_surface)); break; case ORDER_TYPE_CREATE_NINE_GRID_BITMAP: - if (!update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap))) + if (!update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap))) { + WLog_DBG(TAG, "ORDER_TYPE_CREATE_NINE_GRID_BITMAP - update_read_create_nine_grid_bitmap_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "CreateNineGridBitmap"); IFCALL(altsec->CreateNineGridBitmap, context, &(altsec->create_nine_grid_bitmap)); break; case ORDER_TYPE_FRAME_MARKER: - if (!update_read_frame_marker_order(s, &(altsec->frame_marker))) + if (!update_read_frame_marker_order(s, &(altsec->frame_marker))) { + WLog_DBG(TAG, "ORDER_TYPE_FRAME_MARKER - update_read_frame_marker_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "AltSecFrameMarker: action: %s (%d)", (!altsec->frame_marker.action) ? "Begin" : "End", altsec->frame_marker.action); IFCALL(altsec->FrameMarker, context, &(altsec->frame_marker)); break; case ORDER_TYPE_STREAM_BITMAP_FIRST: - if (!update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first))) + if (!update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first))) { + WLog_DBG(TAG, "ORDER_TYPE_STREAM_BITMAP_FIRST - update_read_stream_bitmap_first_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapFirst"); IFCALL(altsec->StreamBitmapFirst, context, &(altsec->stream_bitmap_first)); break; case ORDER_TYPE_STREAM_BITMAP_NEXT: - if (!update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next))) + if (!update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next))) { + WLog_DBG(TAG, "ORDER_TYPE_STREAM_BITMAP_NEXT - update_read_stream_bitmap_next_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapNext"); IFCALL(altsec->StreamBitmapNext, context, &(altsec->stream_bitmap_next)); break; case ORDER_TYPE_GDIPLUS_FIRST: - if (!update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first))) + if (!update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first))) { + WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_FIRST - update_read_draw_gdiplus_first_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusFirst"); IFCALL(altsec->DrawGdiPlusFirst, context, &(altsec->draw_gdiplus_first)); break; case ORDER_TYPE_GDIPLUS_NEXT: - if (!update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next))) + if (!update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next))) { + WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_NEXT - update_read_draw_gdiplus_next_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusNext"); IFCALL(altsec->DrawGdiPlusNext, context, &(altsec->draw_gdiplus_next)); break; case ORDER_TYPE_GDIPLUS_END: - if (update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end))) + if (update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end))) { + WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_END - update_read_draw_gdiplus_end_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusEnd"); IFCALL(altsec->DrawGdiPlusEnd, context, &(altsec->draw_gdiplus_end)); break; case ORDER_TYPE_GDIPLUS_CACHE_FIRST: - if (!update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first))) + if (!update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first))) { + WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_FIRST - update_read_draw_gdiplus_cache_first_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheFirst"); IFCALL(altsec->DrawGdiPlusCacheFirst, context, &(altsec->draw_gdiplus_cache_first)); break; case ORDER_TYPE_GDIPLUS_CACHE_NEXT: - if (!update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next))) + if (!update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next))) { + WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_NEXT - update_read_draw_gdiplus_cache_next_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheNext"); IFCALL(altsec->DrawGdiPlusCacheNext, context, &(altsec->draw_gdiplus_cache_next)); break; case ORDER_TYPE_GDIPLUS_CACHE_END: - if (!update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end))) + if (!update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end))) { + WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_END - update_read_draw_gdiplus_cache_end_order() failed"); return FALSE; + } WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheEnd"); IFCALL(altsec->DrawGdiPlusCacheEnd, context, &(altsec->draw_gdiplus_cache_end)); break; @@ -3543,8 +3649,10 @@ BOOL update_recv_order(rdpUpdate* update, wStream* s) { BYTE controlFlags; - if (Stream_GetRemainingLength(s) < 1) + if (Stream_GetRemainingLength(s) < 1) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); return FALSE; + } Stream_Read_UINT8(s, controlFlags); /* controlFlags (1 byte) */ diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index 90b4ad31b..a3c493e9e 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -331,7 +331,7 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s) break; default: - WLog_ERR(TAG, "Data PDU type %d", type); + WLog_ERR(TAG, "Data PDU type %d", type); break; } @@ -352,7 +352,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s) if (!rdp_read_header(rdp, s, &length, &channelId)) { - WLog_ERR(TAG, "Incorrect RDP header."); + WLog_ERR(TAG, "Incorrect RDP header."); return -1; } @@ -368,7 +368,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s) { if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { - WLog_ERR(TAG, "rdp_decrypt failed"); + WLog_ERR(TAG, "rdp_decrypt failed"); return -1; } } @@ -399,7 +399,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s) break; default: - WLog_ERR(TAG, "Client sent pduType %d", pduType); + WLog_ERR(TAG, "Client sent pduType %d", pduType); return -1; } } @@ -429,7 +429,7 @@ static int peer_recv_fastpath_pdu(freerdp_peer* client, wStream* s) if ((length == 0) || (length > Stream_GetRemainingLength(s))) { - WLog_ERR(TAG, "incorrect FastPath PDU header length %d", length); + WLog_ERR(TAG, "incorrect FastPath PDU header length %d", length); return -1; } @@ -459,7 +459,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) { case CONNECTION_STATE_INITIAL: if (!rdp_server_accept_nego(rdp, s)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_INITIAL - rdp_server_accept_nego() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_INITIAL - rdp_server_accept_nego() fail"); return -1; } @@ -479,28 +479,28 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) case CONNECTION_STATE_NEGO: if (!rdp_server_accept_mcs_connect_initial(rdp, s)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_NEGO - rdp_server_accept_mcs_connect_initial() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_NEGO - rdp_server_accept_mcs_connect_initial() fail"); return -1; } break; case CONNECTION_STATE_MCS_CONNECT: if (!rdp_server_accept_mcs_erect_domain_request(rdp, s)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_MCS_CONNECT - rdp_server_accept_mcs_erect_domain_request() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_MCS_CONNECT - rdp_server_accept_mcs_erect_domain_request() fail"); return -1; } break; case CONNECTION_STATE_MCS_ERECT_DOMAIN: if (!rdp_server_accept_mcs_attach_user_request(rdp, s)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_MCS_ERECT_DOMAIN - rdp_server_accept_mcs_attach_user_request() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_MCS_ERECT_DOMAIN - rdp_server_accept_mcs_attach_user_request() fail"); return -1; } break; case CONNECTION_STATE_MCS_ATTACH_USER: if (!rdp_server_accept_mcs_channel_join_request(rdp, s)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_MCS_ATTACH_USER - rdp_server_accept_mcs_channel_join_request() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_MCS_ATTACH_USER - rdp_server_accept_mcs_channel_join_request() fail"); return -1; } break; @@ -509,7 +509,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) if (rdp->settings->UseRdpSecurityLayer) { if (!rdp_server_establish_keys(rdp, s)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT - rdp_server_establish_keys() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT - rdp_server_establish_keys() fail"); return -1; } } @@ -521,7 +521,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) case CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE: if (!rdp_recv_client_info(rdp, s)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE - rdp_recv_client_info() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE - rdp_recv_client_info() fail"); return -1; } @@ -532,7 +532,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) case CONNECTION_STATE_LICENSING: if (!license_send_valid_client_error_packet(rdp->license)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_LICENSING - license_send_valid_client_error_packet() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_LICENSING - license_send_valid_client_error_packet() fail"); return FALSE; } @@ -548,7 +548,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) IFCALL(client->Capabilities, client); if (!rdp_send_demand_active(rdp)) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_CAPABILITIES_EXCHANGE - rdp_send_demand_active() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - rdp_send_demand_active() fail"); return -1; } @@ -557,7 +557,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) if (s) { if (peer_recv_pdu(client, s) < 0) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail"); return -1; } } @@ -570,7 +570,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) */ if (peer_recv_pdu(client, s) < 0) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail"); return -1; } } @@ -579,20 +579,20 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) case CONNECTION_STATE_FINALIZATION: if (peer_recv_pdu(client, s) < 0) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_FINALIZATION - peer_recv_pdu() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_FINALIZATION - peer_recv_pdu() fail"); return -1; } break; case CONNECTION_STATE_ACTIVE: if (peer_recv_pdu(client, s) < 0) { - WLog_DBG(TAG, "peer_recv_callback: CONNECTION_STATE_ACTIVE - peer_recv_pdu() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_ACTIVE - peer_recv_pdu() fail"); return -1; } break; default: - WLog_ERR(TAG, "Invalid state %d", rdp->state); + WLog_ERR(TAG, "Invalid state %d", rdp->state); return -1; } diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index b5d44ca4f..60c5862c2 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -767,8 +767,10 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s) BYTE compressedType; UINT16 compressedLength; - if (!rdp_read_share_data_header(s, &length, &type, &shareId, &compressedType, &compressedLength)) + if (!rdp_read_share_data_header(s, &length, &type, &shareId, &compressedType, &compressedLength)) { + WLog_DBG(TAG, "rdp_read_share_data_header() failed"); return -1; + } cs = s; @@ -814,73 +816,101 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s) switch (type) { case DATA_PDU_TYPE_UPDATE: - if (!update_recv(rdp->update, cs)) + if (!update_recv(rdp->update, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_UPDATE - update_recv() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_CONTROL: - if (!rdp_recv_server_control_pdu(rdp, cs)) + if (!rdp_recv_server_control_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_CONTROL - rdp_recv_server_control_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_POINTER: - if (!update_recv_pointer(rdp->update, cs)) + if (!update_recv_pointer(rdp->update, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_POINTER - update_recv_pointer() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_SYNCHRONIZE: - if (!rdp_recv_synchronize_pdu(rdp, cs)) + if (!rdp_recv_synchronize_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_SYNCHRONIZE - rdp_recv_synchronize_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_PLAY_SOUND: - if (!update_recv_play_sound(rdp->update, cs)) + if (!update_recv_play_sound(rdp->update, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_PLAY_SOUND - update_recv_play_sound() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_SHUTDOWN_DENIED: - if (!rdp_recv_server_shutdown_denied_pdu(rdp, cs)) + if (!rdp_recv_server_shutdown_denied_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_SHUTDOWN_DENIED - rdp_recv_server_shutdown_denied_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_SAVE_SESSION_INFO: - if (!rdp_recv_save_session_info(rdp, cs)) + if (!rdp_recv_save_session_info(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_SAVE_SESSION_INFO - rdp_recv_save_session_info() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_FONT_MAP: - if (!rdp_recv_font_map_pdu(rdp, cs)) + if (!rdp_recv_font_map_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_FONT_MAP - rdp_recv_font_map_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS: - if (!rdp_recv_server_set_keyboard_indicators_pdu(rdp, cs)) + if (!rdp_recv_server_set_keyboard_indicators_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS - rdp_recv_server_set_keyboard_indicators_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS: - if (!rdp_recv_server_set_keyboard_ime_status_pdu(rdp, cs)) + if (!rdp_recv_server_set_keyboard_ime_status_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS - rdp_recv_server_set_keyboard_ime_status_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_SET_ERROR_INFO: - if (!rdp_recv_set_error_info_data_pdu(rdp, cs)) + if (!rdp_recv_set_error_info_data_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_SET_ERROR_INFO - rdp_recv_set_error_info_data_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_ARC_STATUS: - if (!rdp_recv_server_auto_reconnect_status_pdu(rdp, cs)) + if (!rdp_recv_server_auto_reconnect_status_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_ARC_STATUS - rdp_recv_server_auto_reconnect_status_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_STATUS_INFO: - if (!rdp_recv_server_status_info_pdu(rdp, cs)) + if (!rdp_recv_server_status_info_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_STATUS_INFO - rdp_recv_server_status_info_pdu() failed"); goto out_fail; + } break; case DATA_PDU_TYPE_MONITOR_LAYOUT: - if (!rdp_recv_monitor_layout_pdu(rdp, cs)) + if (!rdp_recv_monitor_layout_pdu(rdp, cs)) { + WLog_DBG(TAG, "DATA_PDU_TYPE_MONITOR_LAYOUT - rdp_recv_monitor_layout_pdu() failed"); goto out_fail; + } break; default: @@ -1077,7 +1107,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s) if (!rdp_read_header(rdp, s, &length, &channelId)) { - WLog_ERR(TAG, "rdp_recv_tpkt_pdu: Incorrect RDP header."); + WLog_ERR(TAG, "Incorrect RDP header."); return -1; } @@ -1092,7 +1122,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s) if (rdp->settings->UseRdpSecurityLayer) { if (!rdp_read_security_header(s, &securityFlags)) { - WLog_DBG(TAG, "rdp_recv_tpkt_pdu: rdp_read_security_header() fail"); + WLog_DBG(TAG, "rdp_read_security_header() fail"); return -1; } @@ -1100,7 +1130,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s) { if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { - WLog_ERR(TAG, "rdp_recv_tpkt_pdu: rdp_decrypt failed"); + WLog_ERR(TAG, "rdp_decrypt failed"); return -1; } } @@ -1124,7 +1154,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s) nextPosition = Stream_GetPosition(s); if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) { - WLog_DBG(TAG, "rdp_recv_tpkt_pdu: rdp_read_share_control_header() fail"); + WLog_DBG(TAG, "rdp_read_share_control_header() fail"); return -1; } @@ -1137,14 +1167,14 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s) case PDU_TYPE_DATA: if (rdp_recv_data_pdu(rdp, s) < 0) { - WLog_ERR(TAG, "rdp_recv_data_pdu failed"); + WLog_ERR(TAG, "rdp_recv_data_pdu() failed"); return -1; } break; case PDU_TYPE_DEACTIVATE_ALL: if (!rdp_recv_deactivate_all(rdp, s)) { - WLog_DBG(TAG, "rdp_recv_tpkt_pdu: rdp_recv_deactivate_all() fail"); + WLog_DBG(TAG, "rdp_recv_deactivate_all() fail"); return -1; } break; @@ -1173,7 +1203,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s) else { if (!freerdp_channel_process(rdp->instance, s, channelId)) { - WLog_DBG(TAG, "rdp_recv_tpkt_pdu: freerdp_channel_process() fail"); + WLog_DBG(TAG, "freerdp_channel_process() fail"); return -1; } } @@ -1189,7 +1219,7 @@ static int rdp_recv_fastpath_pdu(rdpRdp* rdp, wStream* s) fastpath = rdp->fastpath; if (!fastpath_read_header_rdp(fastpath, s, &length)) { - WLog_DBG(TAG, "rdp_recv_fastpath_pdu: fastpath_read_header_rdp() fail"); + WLog_DBG(TAG, "fastpath_read_header_rdp() fail"); return -1; } @@ -1209,7 +1239,7 @@ static int rdp_recv_fastpath_pdu(rdpRdp* rdp, wStream* s) UINT16 flags = (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0; if (!rdp_decrypt(rdp, s, length, flags)) { - WLog_DBG(TAG, "rdp_recv_fastpath_pdu: rdp_decrypt() fail"); + WLog_DBG(TAG, "rdp_decrypt() fail"); return -1; } } @@ -1246,7 +1276,7 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra) { case CONNECTION_STATE_NLA: if (nla_recv_pdu(rdp->nla, s) < 1) { - WLog_DBG(TAG, "rdp_recv_callback: CONNECTION_STATE_NLA - nla_recv_pdu() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_NLA - nla_recv_pdu() fail"); return -1; } @@ -1258,7 +1288,7 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra) rdp->nla = NULL; if (!mcs_client_begin(rdp->mcs)) { - WLog_DBG(TAG, "rdp_recv_callback: CONNECTION_STATE_NLA - mcs_client_begin() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_NLA - mcs_client_begin() fail"); return -1; } } @@ -1305,7 +1335,7 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra) case CONNECTION_STATE_MCS_CHANNEL_JOIN: if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s)) { - WLog_DBG(TAG, "rdp_recv_callback: CONNECTION_STATE_MCS_CHANNEL_JOIN - rdp_client_connect_mcs_channel_join_confirm() fail"); + WLog_DBG(TAG, "CONNECTION_STATE_MCS_CHANNEL_JOIN - rdp_client_connect_mcs_channel_join_confirm() fail"); status = -1; } break; @@ -1313,13 +1343,13 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra) case CONNECTION_STATE_LICENSING: status = rdp_client_connect_license(rdp, s); if (status < 0) - WLog_DBG(TAG, "rdp_recv_callback: CONNECTION_STATE_LICENSING - rdp_client_connect_license() - %i", status); + WLog_DBG(TAG, "CONNECTION_STATE_LICENSING - rdp_client_connect_license() - %i", status); break; case CONNECTION_STATE_CAPABILITIES_EXCHANGE: status = rdp_client_connect_demand_active(rdp, s); if (status < 0) - WLog_DBG(TAG, "rdp_recv_callback: CONNECTION_STATE_CAPABILITIES_EXCHANGE - rdp_client_connect_demand_active() - %i", status); + WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - rdp_client_connect_demand_active() - %i", status); break; case CONNECTION_STATE_FINALIZATION: @@ -1331,13 +1361,13 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra) return 2; } if (status < 0) - WLog_DBG(TAG, "rdp_recv_callback: CONNECTION_STATE_FINALIZATION - rdp_recv_pdu() - %i", status); + WLog_DBG(TAG, "CONNECTION_STATE_FINALIZATION - rdp_recv_pdu() - %i", status); break; case CONNECTION_STATE_ACTIVE: status = rdp_recv_pdu(rdp, s); if (status < 0) - WLog_DBG(TAG, "rdp_recv_callback: CONNECTION_STATE_ACTIVE - rdp_recv_pdu() - %i", status); + WLog_DBG(TAG, "CONNECTION_STATE_ACTIVE - rdp_recv_pdu() - %i", status); break; default: @@ -1383,7 +1413,7 @@ int rdp_check_fds(rdpRdp* rdp) status = tsg_check_event_handles(tsg); if (status < 0) { - WLog_DBG(TAG, "rdp_check_fds: tsg_check_event_handles() - %i", status); + WLog_DBG(TAG, "tsg_check_event_handles() - %i", status); return -1; } @@ -1398,7 +1428,7 @@ int rdp_check_fds(rdpRdp* rdp) status = rdp_client_redirect(rdp); /* session redirection */ } if (status < 0) - WLog_DBG(TAG, "rdp_check_fds: transport_check_fds() - %i", status); + WLog_DBG(TAG, "transport_check_fds() - %i", status); return status; } diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 0529afaab..86e9ac097 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -768,7 +768,8 @@ int transport_check_fds(rdpTransport* transport) */ if ((status = transport_read_pdu(transport, transport->ReceiveBuffer)) <= 0) { - WLog_DBG(TAG, "transport_check_fds: transport_read_pdu() - %i", status); + if (status < 0) + WLog_DBG(TAG, "transport_read_pdu() - %i", status); return status; } @@ -791,7 +792,7 @@ int transport_check_fds(rdpTransport* transport) } if (recv_status < 0) { - WLog_DBG(TAG, "transport_check_fds: transport->ReceiveCallback() - %i", recv_status); + WLog_DBG(TAG, "transport->ReceiveCallback() - %i", recv_status); return -1; } } @@ -924,7 +925,7 @@ static void* transport_client_thread(void* arg) if (transport->layer == TRANSPORT_LAYER_CLOSED) { - WLog_DBG(TAG, "transport_client: TRANSPORT_LAYER_CLOSED"); + WLog_DBG(TAG, "TRANSPORT_LAYER_CLOSED"); rdp_set_error_info(rdp, ERRINFO_PEER_DISCONNECTED); break; } @@ -938,7 +939,7 @@ static void* transport_client_thread(void* arg) { if (!freerdp_check_event_handles(context)) { - WLog_DBG(TAG, "transport_client: freerdp_check_event_handles()"); + WLog_DBG(TAG, "freerdp_check_event_handles()"); rdp_set_error_info(rdp, ERRINFO_PEER_DISCONNECTED); break; } diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 1bb5a8e73..999def820 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -51,8 +51,10 @@ BOOL update_recv_orders(rdpUpdate* update, wStream* s) { UINT16 numberOrders; - if (Stream_GetRemainingLength(s) < 6) + if (Stream_GetRemainingLength(s) < 6) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 6"); return FALSE; + } Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */ Stream_Read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */ @@ -60,8 +62,10 @@ BOOL update_recv_orders(rdpUpdate* update, wStream* s) while (numberOrders > 0) { - if (!update_recv_order(update, s)) + if (!update_recv_order(update, s)) { + WLog_DBG(TAG, "update_recv_order() failed"); return FALSE; + } numberOrders--; } @@ -487,8 +491,10 @@ BOOL update_recv(rdpUpdate* update, wStream* s) UINT16 updateType; rdpContext* context = update->context; - if (Stream_GetRemainingLength(s) < 2) + if (Stream_GetRemainingLength(s) < 2) { + WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 2"); return FALSE; + } Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */ //WLog_DBG(TAG, "%s Update Data PDU", UPDATE_TYPE_STRINGS[updateType]); @@ -501,19 +507,24 @@ BOOL update_recv(rdpUpdate* update, wStream* s) if (!update_recv_orders(update, s)) { /* XXX: Do we have to call EndPaint? */ + WLog_DBG(TAG, "UPDATE_TYPE_ORDERS - update_recv_orders() failed"); return FALSE; } break; case UPDATE_TYPE_BITMAP: - if (!update_read_bitmap_update(update, s, &update->bitmap_update)) + if (!update_read_bitmap_update(update, s, &update->bitmap_update)) { + WLog_DBG(TAG, "UPDATE_TYPE_BITMAP - update_read_bitmap_update() failed"); return FALSE; + } IFCALL(update->BitmapUpdate, context, &update->bitmap_update); break; case UPDATE_TYPE_PALETTE: - if (!update_read_palette(update, s, &update->palette_update)) + if (!update_read_palette(update, s, &update->palette_update)) { + WLog_DBG(TAG, "UPDATE_TYPE_PALETTE - update_read_palette() failed"); return FALSE; + } IFCALL(update->Palette, context, &update->palette_update); break; diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index 7cf7fdeb5..c9a14aa7a 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -216,7 +216,7 @@ int WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args) if (message->Type == WLOG_MESSAGE_TEXT) { - if (!strchr(message->FormatString, '%')) + if (!strchr(message->FormatString, '%') && message->Level != WLOG_DEBUG && message->Level != WLOG_ERROR) { message->TextString = (LPSTR) message->FormatString; status = WLog_Write(log, message); @@ -224,7 +224,11 @@ int WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args) else { char formattedLogMessage[WLOG_MAX_STRING_SIZE]; - wvsnprintfx(formattedLogMessage, WLOG_MAX_STRING_SIZE - 1, message->FormatString, args); + int offset = 0; + + if (message->Level == WLOG_DEBUG || message->Level == WLOG_ERROR) + offset = snprintf(formattedLogMessage, (WLOG_MAX_STRING_SIZE - 1), "%s, line %i: ", message->FunctionName, message->LineNumber); + wvsnprintfx((formattedLogMessage + offset), ((WLOG_MAX_STRING_SIZE - 1) - offset), message->FormatString, args); message->TextString = formattedLogMessage; status = WLog_Write(log, message); }