* debug and error messages now print function name and line number

* add debug messages to trace fake network dissconects
This commit is contained in:
ivan-83 2015-03-19 02:41:29 +03:00
parent ec1d475b53
commit 6ed3914ca2
10 changed files with 308 additions and 154 deletions

View File

@ -97,7 +97,7 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, w
Stream_Read_UINT32(s, Version); Stream_Read_UINT32(s, Version);
DEBUG_DVC("process_version: Version=%d", Version); DEBUG_DVC("Version=%d", Version);
out = Stream_New(NULL, 5); out = Stream_New(NULL, 5);
Stream_Write_UINT8(out, MSG_SNDIN_VERSION); Stream_Write_UINT8(out, MSG_SNDIN_VERSION);
@ -130,7 +130,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
UINT32 cbSizeFormatsPacket; UINT32 cbSizeFormatsPacket;
Stream_Read_UINT32(s, NumFormats); Stream_Read_UINT32(s, NumFormats);
DEBUG_DVC("process_formats: NumFormats %d", NumFormats); DEBUG_DVC("NumFormats %d", NumFormats);
if ((NumFormats < 1) || (NumFormats > 1000)) if ((NumFormats < 1) || (NumFormats > 1000))
{ {
WLog_ERR(TAG, "bad NumFormats %d", NumFormats); WLog_ERR(TAG, "bad NumFormats %d", NumFormats);
@ -158,7 +158,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
format.data = Stream_Pointer(s); format.data = Stream_Pointer(s);
Stream_Seek(s, format.cbSize); 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", "nBlockAlign=%d wBitsPerSample=%d cbSize=%d",
format.wFormatTag, format.nChannels, format.nSamplesPerSec, format.wFormatTag, format.nChannels, format.nSamplesPerSec,
format.nBlockAlign, format.wBitsPerSample, format.cbSize); format.nBlockAlign, format.wBitsPerSample, format.cbSize);
@ -171,7 +171,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
continue; continue;
if (audin->device && audin->device->FormatSupported(audin->device, &format)) 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 */ /* Store the agreed format in the corresponding index */
callback->formats[callback->formats_count++] = format; 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, FramesPerPacket);
Stream_Read_UINT32(s, initialFormat); Stream_Read_UINT32(s, initialFormat);
DEBUG_DVC("process_open: FramesPerPacket=%d initialFormat=%d", DEBUG_DVC("FramesPerPacket=%d initialFormat=%d",
FramesPerPacket, initialFormat); FramesPerPacket, initialFormat);
if (initialFormat >= (UINT32) callback->formats_count) if (initialFormat >= (UINT32) callback->formats_count)
@ -296,7 +296,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
Stream_Read_UINT32(s, NewFormat); Stream_Read_UINT32(s, NewFormat);
DEBUG_DVC("process_format_change: NewFormat=%d", NewFormat); DEBUG_DVC("NewFormat=%d", NewFormat);
if (NewFormat >= (UINT32) callback->formats_count) if (NewFormat >= (UINT32) callback->formats_count)
{ {
@ -326,7 +326,7 @@ static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
Stream_Read_UINT8(data, MessageId); Stream_Read_UINT8(data, MessageId);
DEBUG_DVC("on_data_received: MessageId=0x%x", MessageId); DEBUG_DVC("MessageId=0x%x", MessageId);
switch (MessageId) switch (MessageId)
{ {
@ -360,7 +360,7 @@ static int audin_on_close(IWTSVirtualChannelCallback* pChannelCallback)
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback; AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin; AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin;
DEBUG_DVC("on_close"); DEBUG_DVC("...");
if (audin->device) if (audin->device)
IFCALL(audin->device->Close, 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_CHANNEL_CALLBACK* callback;
AUDIN_LISTENER_CALLBACK* listener_callback = (AUDIN_LISTENER_CALLBACK*) pListenerCallback; 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)); callback = (AUDIN_CHANNEL_CALLBACK*) malloc(sizeof(AUDIN_CHANNEL_CALLBACK));
ZeroMemory(callback, 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; AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin;
DEBUG_DVC("plugin_initialize"); DEBUG_DVC("...");
audin->listener_callback = (AUDIN_LISTENER_CALLBACK*) malloc(sizeof(AUDIN_LISTENER_CALLBACK)); audin->listener_callback = (AUDIN_LISTENER_CALLBACK*) malloc(sizeof(AUDIN_LISTENER_CALLBACK));
ZeroMemory(audin->listener_callback, 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; AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin;
DEBUG_DVC("plugin_terminated"); DEBUG_DVC("...");
if (audin->device) if (audin->device)
{ {
@ -445,7 +445,7 @@ static void audin_register_device_plugin(IWTSPlugin* pPlugin, IAudinDevice* devi
return; return;
} }
DEBUG_DVC("register_device_plugin: device registered."); DEBUG_DVC("device registered.");
audin->device = device; audin->device = device;
} }

View File

@ -48,9 +48,9 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const
if (!audio->Open(audio, device)) { if (!audio->Open(audio, device)) {
audio->Free(audio); audio->Free(audio);
audio = NULL; 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 { } 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; return audio;
@ -85,7 +85,7 @@ ITSMFAudioDevice* tsmf_load_audio_device(const char* name, const char* device)
if (audio == NULL) { if (audio == NULL) {
WLog_ERR(TAG, "no sound device."); WLog_ERR(TAG, "no sound device.");
} else { } 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; return audio;

View File

@ -263,7 +263,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
{ {
case FASTPATH_UPDATETYPE_ORDERS: case FASTPATH_UPDATETYPE_ORDERS:
if (!fastpath_recv_orders(fastpath, s)) { 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; return -1;
} }
break; break;
@ -271,14 +271,14 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
case FASTPATH_UPDATETYPE_BITMAP: case FASTPATH_UPDATETYPE_BITMAP:
case FASTPATH_UPDATETYPE_PALETTE: case FASTPATH_UPDATETYPE_PALETTE:
if (!fastpath_recv_update_common(fastpath, s)) { 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; return -1;
} }
break; break;
case FASTPATH_UPDATETYPE_SYNCHRONIZE: case FASTPATH_UPDATETYPE_SYNCHRONIZE:
if (!fastpath_recv_update_synchronize(fastpath, s)) 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 else
IFCALL(update->Synchronize, context); IFCALL(update->Synchronize, context);
break; break;
@ -286,7 +286,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
case FASTPATH_UPDATETYPE_SURFCMDS: case FASTPATH_UPDATETYPE_SURFCMDS:
status = update_recv_surfcmds(update, size, s); status = update_recv_surfcmds(update, size, s);
if (status < 0) 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; break;
case FASTPATH_UPDATETYPE_PTR_NULL: 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: case FASTPATH_UPDATETYPE_PTR_POSITION:
if (!update_read_pointer_position(s, &pointer->pointer_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; return -1;
} }
IFCALL(pointer->PointerPosition, context, &pointer->pointer_position); 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: case FASTPATH_UPDATETYPE_COLOR:
if (!update_read_pointer_color(s, &pointer->pointer_color, 24)) { 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; return -1;
} }
IFCALL(pointer->PointerColor, context, &pointer->pointer_color); 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: case FASTPATH_UPDATETYPE_CACHED:
if (!update_read_pointer_cached(s, &pointer->pointer_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; return -1;
} }
IFCALL(pointer->PointerCached, context, &pointer->pointer_cached); 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: case FASTPATH_UPDATETYPE_POINTER:
if (!update_read_pointer_new(s, &pointer->pointer_new)) { 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; return -1;
} }
IFCALL(pointer->PointerNew, context, &pointer->pointer_new); 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); Stream_Read_UINT16(s, size);
if (Stream_GetRemainingLength(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; return -1;
} }
@ -395,7 +395,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
if (bulkStatus < 0) if (bulkStatus < 0)
{ {
WLog_ERR(TAG, "fastpath_recv_update_data: bulk_decompress() failed"); WLog_ERR(TAG, "bulk_decompress() failed");
return -1; return -1;
} }
@ -417,7 +417,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
{ {
if (fastpath->fragmentation != -1) 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; goto out_fail;
} }
@ -445,7 +445,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
if (totalSize > transport->settings->MultifragMaxRequestSize) 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); totalSize, transport->settings->MultifragMaxRequestSize);
goto out_fail; goto out_fail;
} }
@ -472,7 +472,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
if (totalSize > transport->settings->MultifragMaxRequestSize) 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); totalSize, transport->settings->MultifragMaxRequestSize);
goto out_fail; goto out_fail;
} }
@ -500,7 +500,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
if (totalSize > transport->settings->MultifragMaxRequestSize) 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); totalSize, transport->settings->MultifragMaxRequestSize);
goto out_fail; goto out_fail;
} }
@ -552,7 +552,7 @@ int fastpath_recv_updates(rdpFastPath* fastpath, wStream* s)
while (Stream_GetRemainingLength(s) >= 3) while (Stream_GetRemainingLength(s) >= 3)
{ {
if (fastpath_recv_update_data(fastpath, s) < 0) { 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; return -1;
} }
} }
@ -703,7 +703,7 @@ static BOOL fastpath_recv_input_event(rdpFastPath* fastpath, wStream* s)
break; break;
default: default:
WLog_ERR(TAG, "Unknown eventCode %d", eventCode); WLog_ERR(TAG, "Unknown eventCode %d", eventCode);
break; break;
} }
@ -814,7 +814,7 @@ BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iNu
if (length >= (2 << 14)) if (length >= (2 << 14))
{ {
WLog_ERR(TAG, "Maximum FastPath PDU length is 32767"); WLog_ERR(TAG, "Maximum FastPath PDU length is 32767");
return FALSE; return FALSE;
} }

View File

@ -210,7 +210,7 @@ BOOL freerdp_check_fds(freerdp* instance)
TerminateEventArgs e; TerminateEventArgs e;
rdpContext* context = instance->context; 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"); EventArgsInit(&e, "freerdp");
e.code = 0; e.code = 0;
PubSub_OnTerminate(context->pubSub, context, &e); PubSub_OnTerminate(context->pubSub, context, &e);
@ -245,13 +245,13 @@ BOOL freerdp_check_event_handles(rdpContext* context)
status = freerdp_check_fds(context->instance); status = freerdp_check_fds(context->instance);
if (!status) { if (!status) {
WLog_DBG(TAG, "freerdp_check_event_handles: freerdp_check_fds() - %i", status); WLog_DBG(TAG, "freerdp_check_fds() - %i", status);
return FALSE; return FALSE;
} }
status = freerdp_channels_check_fds(context->channels, context->instance); status = freerdp_channels_check_fds(context->channels, context->instance);
if (!status) { 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; return FALSE;
} }

View File

@ -499,8 +499,10 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
{ {
BYTE byte; BYTE byte;
if (Stream_GetRemainingLength(s) < 1) if (Stream_GetRemainingLength(s) < 1) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
}
Stream_Read_UINT8(s, byte); Stream_Read_UINT8(s, byte);
if (byte & 0x40) if (byte & 0x40)
@ -510,8 +512,10 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
if (byte & 0x80) if (byte & 0x80)
{ {
if (Stream_GetRemainingLength(s) < 1) if (Stream_GetRemainingLength(s) < 1) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
}
Stream_Read_UINT8(s, byte); Stream_Read_UINT8(s, byte);
*value = (*value << 8) | 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); zeroBitsSize = ((number + 3) / 4);
if (Stream_GetRemainingLength(s) < zeroBitsSize) if (Stream_GetRemainingLength(s) < zeroBitsSize) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < %i", zeroBitsSize);
return FALSE; return FALSE;
}
Stream_GetPointer(s, zeroBits); Stream_GetPointer(s, zeroBits);
Stream_Seek(s, zeroBitsSize); 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) if (i % 4 == 0)
flags = zeroBits[i / 4]; 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; 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; return FALSE;
}
flags <<= 2; flags <<= 2;
} }
@ -1335,13 +1345,17 @@ BOOL update_read_polyline_order(wStream* s, ORDER_INFO* orderInfo, POLYLINE_ORDE
{ {
DELTA_POINT *new_points; DELTA_POINT *new_points;
if (Stream_GetRemainingLength(s) < 1) if (Stream_GetRemainingLength(s) < 1) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
}
Stream_Read_UINT8(s, polyline->cbData); Stream_Read_UINT8(s, polyline->cbData);
new_points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * new_num); 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; return FALSE;
}
polyline->points = new_points; polyline->points = new_points;
polyline->numDeltaEntries = new_num; 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, 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; return FALSE;
}
if (flags & ORDER_BOUNDS) if (flags & ORDER_BOUNDS)
{ {
if (!(flags & ORDER_ZERO_BOUNDS_DELTAS)) 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; return FALSE;
}
} }
IFCALL(update->SetBounds, context, &orderInfo->bounds); IFCALL(update->SetBounds, context, &orderInfo->bounds);
@ -3157,155 +3175,199 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
switch (orderInfo->orderType) switch (orderInfo->orderType)
{ {
case ORDER_TYPE_DSTBLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DstBlt"); WLog_Print(update->log, WLOG_DEBUG, "DstBlt");
IFCALL(primary->DstBlt, context, &primary->dstblt); IFCALL(primary->DstBlt, context, &primary->dstblt);
break; break;
case ORDER_TYPE_PATBLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "PatBlt"); WLog_Print(update->log, WLOG_DEBUG, "PatBlt");
IFCALL(primary->PatBlt, context, &primary->patblt); IFCALL(primary->PatBlt, context, &primary->patblt);
break; break;
case ORDER_TYPE_SCRBLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "ScrBlt"); WLog_Print(update->log, WLOG_DEBUG, "ScrBlt");
IFCALL(primary->ScrBlt, context, &primary->scrblt); IFCALL(primary->ScrBlt, context, &primary->scrblt);
break; break;
case ORDER_TYPE_OPAQUE_RECT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "OpaqueRect"); WLog_Print(update->log, WLOG_DEBUG, "OpaqueRect");
IFCALL(primary->OpaqueRect, context, &primary->opaque_rect); IFCALL(primary->OpaqueRect, context, &primary->opaque_rect);
break; break;
case ORDER_TYPE_DRAW_NINE_GRID: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawNineGrid"); WLog_Print(update->log, WLOG_DEBUG, "DrawNineGrid");
IFCALL(primary->DrawNineGrid, context, &primary->draw_nine_grid); IFCALL(primary->DrawNineGrid, context, &primary->draw_nine_grid);
break; break;
case ORDER_TYPE_MULTI_DSTBLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiDstBlt"); WLog_Print(update->log, WLOG_DEBUG, "MultiDstBlt");
IFCALL(primary->MultiDstBlt, context, &primary->multi_dstblt); IFCALL(primary->MultiDstBlt, context, &primary->multi_dstblt);
break; break;
case ORDER_TYPE_MULTI_PATBLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiPatBlt"); WLog_Print(update->log, WLOG_DEBUG, "MultiPatBlt");
IFCALL(primary->MultiPatBlt, context, &primary->multi_patblt); IFCALL(primary->MultiPatBlt, context, &primary->multi_patblt);
break; break;
case ORDER_TYPE_MULTI_SCRBLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiScrBlt"); WLog_Print(update->log, WLOG_DEBUG, "MultiScrBlt");
IFCALL(primary->MultiScrBlt, context, &primary->multi_scrblt); IFCALL(primary->MultiScrBlt, context, &primary->multi_scrblt);
break; break;
case ORDER_TYPE_MULTI_OPAQUE_RECT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiOpaqueRect"); WLog_Print(update->log, WLOG_DEBUG, "MultiOpaqueRect");
IFCALL(primary->MultiOpaqueRect, context, &primary->multi_opaque_rect); IFCALL(primary->MultiOpaqueRect, context, &primary->multi_opaque_rect);
break; break;
case ORDER_TYPE_MULTI_DRAW_NINE_GRID: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiDrawNineGrid"); WLog_Print(update->log, WLOG_DEBUG, "MultiDrawNineGrid");
IFCALL(primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid); IFCALL(primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid);
break; break;
case ORDER_TYPE_LINE_TO: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "LineTo"); WLog_Print(update->log, WLOG_DEBUG, "LineTo");
IFCALL(primary->LineTo, context, &primary->line_to); IFCALL(primary->LineTo, context, &primary->line_to);
break; break;
case ORDER_TYPE_POLYLINE: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "Polyline"); WLog_Print(update->log, WLOG_DEBUG, "Polyline");
IFCALL(primary->Polyline, context, &primary->polyline); IFCALL(primary->Polyline, context, &primary->polyline);
break; break;
case ORDER_TYPE_MEMBLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MemBlt"); WLog_Print(update->log, WLOG_DEBUG, "MemBlt");
IFCALL(primary->MemBlt, context, &primary->memblt); IFCALL(primary->MemBlt, context, &primary->memblt);
break; break;
case ORDER_TYPE_MEM3BLT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "Mem3Blt"); WLog_Print(update->log, WLOG_DEBUG, "Mem3Blt");
IFCALL(primary->Mem3Blt, context, &primary->mem3blt); IFCALL(primary->Mem3Blt, context, &primary->mem3blt);
break; break;
case ORDER_TYPE_SAVE_BITMAP: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "SaveBitmap"); WLog_Print(update->log, WLOG_DEBUG, "SaveBitmap");
IFCALL(primary->SaveBitmap, context, &primary->save_bitmap); IFCALL(primary->SaveBitmap, context, &primary->save_bitmap);
break; break;
case ORDER_TYPE_GLYPH_INDEX: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "GlyphIndex"); WLog_Print(update->log, WLOG_DEBUG, "GlyphIndex");
IFCALL(primary->GlyphIndex, context, &primary->glyph_index); IFCALL(primary->GlyphIndex, context, &primary->glyph_index);
break; break;
case ORDER_TYPE_FAST_INDEX: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "FastIndex"); WLog_Print(update->log, WLOG_DEBUG, "FastIndex");
IFCALL(primary->FastIndex, context, &primary->fast_index); IFCALL(primary->FastIndex, context, &primary->fast_index);
break; break;
case ORDER_TYPE_FAST_GLYPH: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "FastGlyph"); WLog_Print(update->log, WLOG_DEBUG, "FastGlyph");
IFCALL(primary->FastGlyph, context, &primary->fast_glyph); IFCALL(primary->FastGlyph, context, &primary->fast_glyph);
break; break;
case ORDER_TYPE_POLYGON_SC: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "PolygonSC"); WLog_Print(update->log, WLOG_DEBUG, "PolygonSC");
IFCALL(primary->PolygonSC, context, &primary->polygon_sc); IFCALL(primary->PolygonSC, context, &primary->polygon_sc);
break; break;
case ORDER_TYPE_POLYGON_CB: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "PolygonCB"); WLog_Print(update->log, WLOG_DEBUG, "PolygonCB");
IFCALL(primary->PolygonCB, context, &primary->polygon_cb); IFCALL(primary->PolygonCB, context, &primary->polygon_cb);
break; break;
case ORDER_TYPE_ELLIPSE_SC: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "EllipseSC"); WLog_Print(update->log, WLOG_DEBUG, "EllipseSC");
IFCALL(primary->EllipseSC, context, &primary->ellipse_sc); IFCALL(primary->EllipseSC, context, &primary->ellipse_sc);
break; break;
case ORDER_TYPE_ELLIPSE_CB: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "EllipseCB"); WLog_Print(update->log, WLOG_DEBUG, "EllipseCB");
IFCALL(primary->EllipseCB, context, &primary->ellipse_cb); IFCALL(primary->EllipseCB, context, &primary->ellipse_cb);
break; break;
@ -3331,8 +3393,10 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
rdpContext* context = update->context; rdpContext* context = update->context;
rdpSecondaryUpdate* secondary = update->secondary; rdpSecondaryUpdate* secondary = update->secondary;
if (Stream_GetRemainingLength(s) < 5) if (Stream_GetRemainingLength(s) < 5) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 5");
return FALSE; return FALSE;
}
Stream_Read_UINT16(s, orderLength); /* orderLength (2 bytes) */ Stream_Read_UINT16(s, orderLength); /* orderLength (2 bytes) */
Stream_Read_UINT16(s, extraFlags); /* extraFlags (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) switch (orderType)
{ {
case ORDER_TYPE_BITMAP_UNCOMPRESSED: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressed"); WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressed");
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order)); IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
break; break;
case ORDER_TYPE_CACHE_BITMAP_COMPRESSED: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressed"); WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressed");
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order)); IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
break; break;
case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressedV2"); WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressedV2");
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order)); IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
break; break;
case ORDER_TYPE_BITMAP_COMPRESSED_V2: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV2"); WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV2");
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order)); IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
break; break;
case ORDER_TYPE_BITMAP_COMPRESSED_V3: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV3"); WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV3");
IFCALL(secondary->CacheBitmapV3, context, &(secondary->cache_bitmap_v3_order)); IFCALL(secondary->CacheBitmapV3, context, &(secondary->cache_bitmap_v3_order));
break; break;
case ORDER_TYPE_CACHE_COLOR_TABLE: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheColorTable"); WLog_Print(update->log, WLOG_DEBUG, "CacheColorTable");
IFCALL(secondary->CacheColorTable, context, &(secondary->cache_color_table_order)); IFCALL(secondary->CacheColorTable, context, &(secondary->cache_color_table_order));
break; break;
@ -3394,23 +3470,29 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_CACHE_GLYPH: case ORDER_TYPE_CACHE_GLYPH:
if (secondary->glyph_v2) 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheGlyphV2"); WLog_Print(update->log, WLOG_DEBUG, "CacheGlyphV2");
IFCALL(secondary->CacheGlyphV2, context, &(secondary->cache_glyph_v2_order)); IFCALL(secondary->CacheGlyphV2, context, &(secondary->cache_glyph_v2_order));
} }
else 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheGlyph"); WLog_Print(update->log, WLOG_DEBUG, "CacheGlyph");
IFCALL(secondary->CacheGlyph, context, &(secondary->cache_glyph_order)); IFCALL(secondary->CacheGlyph, context, &(secondary->cache_glyph_order));
} }
break; break;
case ORDER_TYPE_CACHE_BRUSH: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBrush"); WLog_Print(update->log, WLOG_DEBUG, "CacheBrush");
IFCALL(secondary->CacheBrush, context, &(secondary->cache_brush_order)); IFCALL(secondary->CacheBrush, context, &(secondary->cache_brush_order));
break; break;
@ -3434,94 +3516,118 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
#ifdef WITH_DEBUG_ORDERS #ifdef WITH_DEBUG_ORDERS
if (orderType < ALTSEC_DRAWING_ORDER_COUNT) 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 else
WLog_DBG(TAG, "Unknown Alternate Secondary Drawing Order: 0x%02X", orderType); WLog_DBG(TAG, "Unknown Alternate Secondary Drawing Order: 0x%02X", orderType);
#endif #endif
switch (orderType) switch (orderType)
{ {
case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CreateOffscreenBitmap"); WLog_Print(update->log, WLOG_DEBUG, "CreateOffscreenBitmap");
IFCALL(altsec->CreateOffscreenBitmap, context, &(altsec->create_offscreen_bitmap)); IFCALL(altsec->CreateOffscreenBitmap, context, &(altsec->create_offscreen_bitmap));
break; break;
case ORDER_TYPE_SWITCH_SURFACE: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "SwitchSurface"); WLog_Print(update->log, WLOG_DEBUG, "SwitchSurface");
IFCALL(altsec->SwitchSurface, context, &(altsec->switch_surface)); IFCALL(altsec->SwitchSurface, context, &(altsec->switch_surface));
break; break;
case ORDER_TYPE_CREATE_NINE_GRID_BITMAP: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CreateNineGridBitmap"); WLog_Print(update->log, WLOG_DEBUG, "CreateNineGridBitmap");
IFCALL(altsec->CreateNineGridBitmap, context, &(altsec->create_nine_grid_bitmap)); IFCALL(altsec->CreateNineGridBitmap, context, &(altsec->create_nine_grid_bitmap));
break; break;
case ORDER_TYPE_FRAME_MARKER: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "AltSecFrameMarker: action: %s (%d)", WLog_Print(update->log, WLOG_DEBUG, "AltSecFrameMarker: action: %s (%d)",
(!altsec->frame_marker.action) ? "Begin" : "End", altsec->frame_marker.action); (!altsec->frame_marker.action) ? "Begin" : "End", altsec->frame_marker.action);
IFCALL(altsec->FrameMarker, context, &(altsec->frame_marker)); IFCALL(altsec->FrameMarker, context, &(altsec->frame_marker));
break; break;
case ORDER_TYPE_STREAM_BITMAP_FIRST: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapFirst"); WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapFirst");
IFCALL(altsec->StreamBitmapFirst, context, &(altsec->stream_bitmap_first)); IFCALL(altsec->StreamBitmapFirst, context, &(altsec->stream_bitmap_first));
break; break;
case ORDER_TYPE_STREAM_BITMAP_NEXT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapNext"); WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapNext");
IFCALL(altsec->StreamBitmapNext, context, &(altsec->stream_bitmap_next)); IFCALL(altsec->StreamBitmapNext, context, &(altsec->stream_bitmap_next));
break; break;
case ORDER_TYPE_GDIPLUS_FIRST: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusFirst"); WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusFirst");
IFCALL(altsec->DrawGdiPlusFirst, context, &(altsec->draw_gdiplus_first)); IFCALL(altsec->DrawGdiPlusFirst, context, &(altsec->draw_gdiplus_first));
break; break;
case ORDER_TYPE_GDIPLUS_NEXT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusNext"); WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusNext");
IFCALL(altsec->DrawGdiPlusNext, context, &(altsec->draw_gdiplus_next)); IFCALL(altsec->DrawGdiPlusNext, context, &(altsec->draw_gdiplus_next));
break; break;
case ORDER_TYPE_GDIPLUS_END: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusEnd"); WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusEnd");
IFCALL(altsec->DrawGdiPlusEnd, context, &(altsec->draw_gdiplus_end)); IFCALL(altsec->DrawGdiPlusEnd, context, &(altsec->draw_gdiplus_end));
break; break;
case ORDER_TYPE_GDIPLUS_CACHE_FIRST: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheFirst"); WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheFirst");
IFCALL(altsec->DrawGdiPlusCacheFirst, context, &(altsec->draw_gdiplus_cache_first)); IFCALL(altsec->DrawGdiPlusCacheFirst, context, &(altsec->draw_gdiplus_cache_first));
break; break;
case ORDER_TYPE_GDIPLUS_CACHE_NEXT: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheNext"); WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheNext");
IFCALL(altsec->DrawGdiPlusCacheNext, context, &(altsec->draw_gdiplus_cache_next)); IFCALL(altsec->DrawGdiPlusCacheNext, context, &(altsec->draw_gdiplus_cache_next));
break; break;
case ORDER_TYPE_GDIPLUS_CACHE_END: 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; return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheEnd"); WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheEnd");
IFCALL(altsec->DrawGdiPlusCacheEnd, context, &(altsec->draw_gdiplus_cache_end)); IFCALL(altsec->DrawGdiPlusCacheEnd, context, &(altsec->draw_gdiplus_cache_end));
break; break;
@ -3543,8 +3649,10 @@ BOOL update_recv_order(rdpUpdate* update, wStream* s)
{ {
BYTE controlFlags; BYTE controlFlags;
if (Stream_GetRemainingLength(s) < 1) if (Stream_GetRemainingLength(s) < 1) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
}
Stream_Read_UINT8(s, controlFlags); /* controlFlags (1 byte) */ Stream_Read_UINT8(s, controlFlags); /* controlFlags (1 byte) */

View File

@ -331,7 +331,7 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s)
break; break;
default: default:
WLog_ERR(TAG, "Data PDU type %d", type); WLog_ERR(TAG, "Data PDU type %d", type);
break; break;
} }
@ -352,7 +352,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
if (!rdp_read_header(rdp, s, &length, &channelId)) if (!rdp_read_header(rdp, s, &length, &channelId))
{ {
WLog_ERR(TAG, "Incorrect RDP header."); WLog_ERR(TAG, "Incorrect RDP header.");
return -1; 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)) if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
{ {
WLog_ERR(TAG, "rdp_decrypt failed"); WLog_ERR(TAG, "rdp_decrypt failed");
return -1; return -1;
} }
} }
@ -399,7 +399,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
break; break;
default: default:
WLog_ERR(TAG, "Client sent pduType %d", pduType); WLog_ERR(TAG, "Client sent pduType %d", pduType);
return -1; return -1;
} }
} }
@ -429,7 +429,7 @@ static int peer_recv_fastpath_pdu(freerdp_peer* client, wStream* s)
if ((length == 0) || (length > Stream_GetRemainingLength(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; return -1;
} }
@ -459,7 +459,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
{ {
case CONNECTION_STATE_INITIAL: case CONNECTION_STATE_INITIAL:
if (!rdp_server_accept_nego(rdp, s)) { 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; return -1;
} }
@ -479,28 +479,28 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_NEGO: case CONNECTION_STATE_NEGO:
if (!rdp_server_accept_mcs_connect_initial(rdp, s)) { 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; return -1;
} }
break; break;
case CONNECTION_STATE_MCS_CONNECT: case CONNECTION_STATE_MCS_CONNECT:
if (!rdp_server_accept_mcs_erect_domain_request(rdp, s)) { 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; return -1;
} }
break; break;
case CONNECTION_STATE_MCS_ERECT_DOMAIN: case CONNECTION_STATE_MCS_ERECT_DOMAIN:
if (!rdp_server_accept_mcs_attach_user_request(rdp, s)) { 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; return -1;
} }
break; break;
case CONNECTION_STATE_MCS_ATTACH_USER: case CONNECTION_STATE_MCS_ATTACH_USER:
if (!rdp_server_accept_mcs_channel_join_request(rdp, s)) { 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; return -1;
} }
break; break;
@ -509,7 +509,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
if (rdp->settings->UseRdpSecurityLayer) if (rdp->settings->UseRdpSecurityLayer)
{ {
if (!rdp_server_establish_keys(rdp, s)) { 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; return -1;
} }
} }
@ -521,7 +521,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE: case CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE:
if (!rdp_recv_client_info(rdp, s)) { 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; return -1;
} }
@ -532,7 +532,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_LICENSING: case CONNECTION_STATE_LICENSING:
if (!license_send_valid_client_error_packet(rdp->license)) { 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; return FALSE;
} }
@ -548,7 +548,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
IFCALL(client->Capabilities, client); IFCALL(client->Capabilities, client);
if (!rdp_send_demand_active(rdp)) { 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; return -1;
} }
@ -557,7 +557,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
if (s) if (s)
{ {
if (peer_recv_pdu(client, s) < 0) { 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; return -1;
} }
} }
@ -570,7 +570,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
*/ */
if (peer_recv_pdu(client, s) < 0) { 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; return -1;
} }
} }
@ -579,20 +579,20 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_FINALIZATION: case CONNECTION_STATE_FINALIZATION:
if (peer_recv_pdu(client, s) < 0) { 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; return -1;
} }
break; break;
case CONNECTION_STATE_ACTIVE: case CONNECTION_STATE_ACTIVE:
if (peer_recv_pdu(client, s) < 0) { 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; return -1;
} }
break; break;
default: default:
WLog_ERR(TAG, "Invalid state %d", rdp->state); WLog_ERR(TAG, "Invalid state %d", rdp->state);
return -1; return -1;
} }

View File

@ -767,8 +767,10 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s)
BYTE compressedType; BYTE compressedType;
UINT16 compressedLength; 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; return -1;
}
cs = s; cs = s;
@ -814,73 +816,101 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s)
switch (type) switch (type)
{ {
case DATA_PDU_TYPE_UPDATE: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_CONTROL: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_POINTER: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_SYNCHRONIZE: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_PLAY_SOUND: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_SHUTDOWN_DENIED: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_SAVE_SESSION_INFO: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_FONT_MAP: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_SET_ERROR_INFO: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_ARC_STATUS: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_STATUS_INFO: 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; goto out_fail;
}
break; break;
case DATA_PDU_TYPE_MONITOR_LAYOUT: 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; goto out_fail;
}
break; break;
default: default:
@ -1077,7 +1107,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
if (!rdp_read_header(rdp, s, &length, &channelId)) 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; return -1;
} }
@ -1092,7 +1122,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
if (rdp->settings->UseRdpSecurityLayer) if (rdp->settings->UseRdpSecurityLayer)
{ {
if (!rdp_read_security_header(s, &securityFlags)) { 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; return -1;
} }
@ -1100,7 +1130,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
{ {
if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) 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; return -1;
} }
} }
@ -1124,7 +1154,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
nextPosition = Stream_GetPosition(s); nextPosition = Stream_GetPosition(s);
if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) { 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; return -1;
} }
@ -1137,14 +1167,14 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
case PDU_TYPE_DATA: case PDU_TYPE_DATA:
if (rdp_recv_data_pdu(rdp, s) < 0) 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; return -1;
} }
break; break;
case PDU_TYPE_DEACTIVATE_ALL: case PDU_TYPE_DEACTIVATE_ALL:
if (!rdp_recv_deactivate_all(rdp, s)) { 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; return -1;
} }
break; break;
@ -1173,7 +1203,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
else else
{ {
if (!freerdp_channel_process(rdp->instance, s, channelId)) { 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; return -1;
} }
} }
@ -1189,7 +1219,7 @@ static int rdp_recv_fastpath_pdu(rdpRdp* rdp, wStream* s)
fastpath = rdp->fastpath; fastpath = rdp->fastpath;
if (!fastpath_read_header_rdp(fastpath, s, &length)) { 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; 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; UINT16 flags = (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0;
if (!rdp_decrypt(rdp, s, length, flags)) { 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; return -1;
} }
} }
@ -1246,7 +1276,7 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
{ {
case CONNECTION_STATE_NLA: case CONNECTION_STATE_NLA:
if (nla_recv_pdu(rdp->nla, s) < 1) { 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; return -1;
} }
@ -1258,7 +1288,7 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
rdp->nla = NULL; rdp->nla = NULL;
if (!mcs_client_begin(rdp->mcs)) { 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; return -1;
} }
} }
@ -1305,7 +1335,7 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_MCS_CHANNEL_JOIN: case CONNECTION_STATE_MCS_CHANNEL_JOIN:
if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s)) { 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; status = -1;
} }
break; break;
@ -1313,13 +1343,13 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_LICENSING: case CONNECTION_STATE_LICENSING:
status = rdp_client_connect_license(rdp, s); status = rdp_client_connect_license(rdp, s);
if (status < 0) 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; break;
case CONNECTION_STATE_CAPABILITIES_EXCHANGE: case CONNECTION_STATE_CAPABILITIES_EXCHANGE:
status = rdp_client_connect_demand_active(rdp, s); status = rdp_client_connect_demand_active(rdp, s);
if (status < 0) 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; break;
case CONNECTION_STATE_FINALIZATION: case CONNECTION_STATE_FINALIZATION:
@ -1331,13 +1361,13 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
return 2; return 2;
} }
if (status < 0) 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; break;
case CONNECTION_STATE_ACTIVE: case CONNECTION_STATE_ACTIVE:
status = rdp_recv_pdu(rdp, s); status = rdp_recv_pdu(rdp, s);
if (status < 0) 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; break;
default: default:
@ -1383,7 +1413,7 @@ int rdp_check_fds(rdpRdp* rdp)
status = tsg_check_event_handles(tsg); status = tsg_check_event_handles(tsg);
if (status < 0) { 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; return -1;
} }
@ -1398,7 +1428,7 @@ int rdp_check_fds(rdpRdp* rdp)
status = rdp_client_redirect(rdp); /* session redirection */ status = rdp_client_redirect(rdp); /* session redirection */
} }
if (status < 0) if (status < 0)
WLog_DBG(TAG, "rdp_check_fds: transport_check_fds() - %i", status); WLog_DBG(TAG, "transport_check_fds() - %i", status);
return status; return status;
} }

View File

@ -768,7 +768,8 @@ int transport_check_fds(rdpTransport* transport)
*/ */
if ((status = transport_read_pdu(transport, transport->ReceiveBuffer)) <= 0) 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; return status;
} }
@ -791,7 +792,7 @@ int transport_check_fds(rdpTransport* transport)
} }
if (recv_status < 0) { 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; return -1;
} }
} }
@ -924,7 +925,7 @@ static void* transport_client_thread(void* arg)
if (transport->layer == TRANSPORT_LAYER_CLOSED) 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); rdp_set_error_info(rdp, ERRINFO_PEER_DISCONNECTED);
break; break;
} }
@ -938,7 +939,7 @@ static void* transport_client_thread(void* arg)
{ {
if (!freerdp_check_event_handles(context)) 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); rdp_set_error_info(rdp, ERRINFO_PEER_DISCONNECTED);
break; break;
} }

View File

@ -51,8 +51,10 @@ BOOL update_recv_orders(rdpUpdate* update, wStream* s)
{ {
UINT16 numberOrders; UINT16 numberOrders;
if (Stream_GetRemainingLength(s) < 6) if (Stream_GetRemainingLength(s) < 6) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 6");
return FALSE; return FALSE;
}
Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */ Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */
Stream_Read_UINT16(s, numberOrders); /* numberOrders (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) while (numberOrders > 0)
{ {
if (!update_recv_order(update, s)) if (!update_recv_order(update, s)) {
WLog_DBG(TAG, "update_recv_order() failed");
return FALSE; return FALSE;
}
numberOrders--; numberOrders--;
} }
@ -487,8 +491,10 @@ BOOL update_recv(rdpUpdate* update, wStream* s)
UINT16 updateType; UINT16 updateType;
rdpContext* context = update->context; rdpContext* context = update->context;
if (Stream_GetRemainingLength(s) < 2) if (Stream_GetRemainingLength(s) < 2) {
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 2");
return FALSE; return FALSE;
}
Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */ Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */
//WLog_DBG(TAG, "%s Update Data PDU", UPDATE_TYPE_STRINGS[updateType]); //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)) if (!update_recv_orders(update, s))
{ {
/* XXX: Do we have to call EndPaint? */ /* XXX: Do we have to call EndPaint? */
WLog_DBG(TAG, "UPDATE_TYPE_ORDERS - update_recv_orders() failed");
return FALSE; return FALSE;
} }
break; break;
case UPDATE_TYPE_BITMAP: 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; return FALSE;
}
IFCALL(update->BitmapUpdate, context, &update->bitmap_update); IFCALL(update->BitmapUpdate, context, &update->bitmap_update);
break; break;
case UPDATE_TYPE_PALETTE: 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; return FALSE;
}
IFCALL(update->Palette, context, &update->palette_update); IFCALL(update->Palette, context, &update->palette_update);
break; break;

View File

@ -216,7 +216,7 @@ int WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args)
if (message->Type == WLOG_MESSAGE_TEXT) 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; message->TextString = (LPSTR) message->FormatString;
status = WLog_Write(log, message); status = WLog_Write(log, message);
@ -224,7 +224,11 @@ int WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args)
else else
{ {
char formattedLogMessage[WLOG_MAX_STRING_SIZE]; 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; message->TextString = formattedLogMessage;
status = WLog_Write(log, message); status = WLog_Write(log, message);
} }