return TRUE;
}
-static BOOL fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 size, STREAM* s)
+static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 size, STREAM* s)
{
+ int status = 0;
rdpUpdate* update = fastpath->rdp->update;
rdpContext* context = fastpath->rdp->update->context;
rdpPointerUpdate* pointer = update->pointer;
{
case FASTPATH_UPDATETYPE_ORDERS:
if (!fastpath_recv_orders(fastpath, s))
- return FALSE;
+ return -1;
break;
case FASTPATH_UPDATETYPE_BITMAP:
case FASTPATH_UPDATETYPE_PALETTE:
- if(!fastpath_recv_update_common(fastpath, s))
- return FALSE;
+ if (!fastpath_recv_update_common(fastpath, s))
+ return -1;
break;
case FASTPATH_UPDATETYPE_SYNCHRONIZE:
break;
case FASTPATH_UPDATETYPE_SURFCMDS:
- if (update_recv_surfcmds(update, size, s) < 0)
- return FALSE;
+ status = update_recv_surfcmds(update, size, s);
break;
case FASTPATH_UPDATETYPE_PTR_NULL:
case FASTPATH_UPDATETYPE_PTR_POSITION:
if (!update_read_pointer_position(s, &pointer->pointer_position))
- return FALSE;
+ return -1;
IFCALL(pointer->PointerPosition, context, &pointer->pointer_position);
break;
case FASTPATH_UPDATETYPE_COLOR:
if (!update_read_pointer_color(s, &pointer->pointer_color))
- return FALSE;
+ return -1;
IFCALL(pointer->PointerColor, context, &pointer->pointer_color);
break;
case FASTPATH_UPDATETYPE_CACHED:
if (!update_read_pointer_cached(s, &pointer->pointer_cached))
- return FALSE;
+ return -1;
IFCALL(pointer->PointerCached, context, &pointer->pointer_cached);
break;
case FASTPATH_UPDATETYPE_POINTER:
if (!update_read_pointer_new(s, &pointer->pointer_new))
- return FALSE;
+ return -1;
IFCALL(pointer->PointerNew, context, &pointer->pointer_new);
break;
break;
}
- return TRUE;
+ return status;
}
static BOOL fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s)
{
+ int status;
UINT16 size;
int next_pos;
UINT32 totalSize;
BYTE compressionFlags;
STREAM* update_stream;
STREAM* comp_stream;
- rdpRdp *rdp;
+ rdpRdp* rdp;
UINT32 roff;
UINT32 rlen;
+ status = 0;
rdp = fastpath->rdp;
fastpath_read_update_header(s, &updateCode, &fragmentation, &compression);
compressionFlags = 0;
stream_read_UINT16(s, size);
- if(stream_get_left(s) < size)
- return FALSE;
+
+ if (stream_get_left(s) < size)
+ return -1;
+
next_pos = stream_get_pos(s) + size;
comp_stream = s;
if (update_stream)
{
- if (!fastpath_recv_update(fastpath, updateCode, totalSize, update_stream))
- return FALSE;
+ status = fastpath_recv_update(fastpath, updateCode, totalSize, update_stream);
+
+ if (status < 0)
+ return -1;
}
stream_set_pos(s, next_pos);
if (comp_stream != s)
free(comp_stream);
- return TRUE;
+ return status;
}
int fastpath_recv_updates(rdpFastPath* fastpath, STREAM* s)
{
+ int status = 0;
rdpUpdate* update = fastpath->rdp->update;
IFCALL(update->BeginPaint, update->context);
while (stream_get_left(s) >= 3)
{
- if (!fastpath_recv_update_data(fastpath, s))
+ if (fastpath_recv_update_data(fastpath, s) < 0)
return -1;
}
IFCALL(update->EndPaint, update->context);
- return 0;
+ return status;
}
static BOOL fastpath_read_input_event_header(STREAM* s, BYTE* eventFlags, BYTE* eventCode)
if (stream_get_left(s) < 12)
return FALSE;
+
stream_read_UINT16(s, len); /* 0x10 */
stream_read_BYTE(s, version); /* 0x1 */
stream_read_BYTE(s, pad);
if (channelId != MCS_GLOBAL_CHANNEL_ID)
{
- if(!freerdp_channel_process(rdp->instance, s, channelId))
+ if (!freerdp_channel_process(rdp->instance, s, channelId))
return -1;
}
else
while (stream_get_left(s) > 3)
{
stream_get_mark(s, nextp);
+
if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource))
return -1;
+
nextp += pduLength;
rdp->settings->PduSource = pduSource;
rdpFastPath* fastpath;
fastpath = rdp->fastpath;
+
if (!fastpath_read_header_rdp(fastpath, s, &length))
return -1;
if (fastpath->encryptionFlags & FASTPATH_OUTPUT_ENCRYPTED)
{
UINT16 flags = (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0;
+
if (!rdp_decrypt(rdp, s, length, flags))
return -1;
}
#include "surface.h"
-static BOOL update_recv_surfcmd_surface_bits(rdpUpdate* update, STREAM* s, UINT32 *length)
+static int update_recv_surfcmd_surface_bits(rdpUpdate* update, STREAM* s, UINT32 *length)
{
int pos;
SURFACE_BITS_COMMAND* cmd = &update->surface_bits_command;
- if(stream_get_left(s) < 20)
- return FALSE;
+ if (stream_get_left(s) < 20)
+ return -1;
+
stream_read_UINT16(s, cmd->destLeft);
stream_read_UINT16(s, cmd->destTop);
stream_read_UINT16(s, cmd->destRight);
stream_read_UINT16(s, cmd->width);
stream_read_UINT16(s, cmd->height);
stream_read_UINT32(s, cmd->bitmapDataLength);
- if(stream_get_left(s) < cmd->bitmapDataLength)
- return FALSE;
+
+ if (stream_get_left(s) < cmd->bitmapDataLength)
+ return -1;
+
pos = stream_get_pos(s) + cmd->bitmapDataLength;
cmd->bitmapData = stream_get_tail(s);
IFCALL(update->SurfaceBits, update->context, cmd);
stream_set_pos(s, pos);
-
*length = 20 + cmd->bitmapDataLength;
- return TRUE;
+
+ return 0;
}
static void update_send_frame_acknowledge(rdpRdp* rdp, UINT32 frameId)
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id);
}
-static BOOL update_recv_surfcmd_frame_marker(rdpUpdate* update, STREAM* s, UINT32 *length)
+static int update_recv_surfcmd_frame_marker(rdpUpdate* update, STREAM* s, UINT32 *length)
{
SURFACE_FRAME_MARKER* marker = &update->surface_frame_marker;
- if(stream_get_left(s) < 6)
- return FALSE;
+ if (stream_get_left(s) < 6)
+ return -1;
+
stream_read_UINT16(s, marker->frameAction);
stream_read_UINT32(s, marker->frameId);
IFCALL(update->SurfaceFrameMarker, update->context, marker);
- if (update->context->rdp->settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE] && update->context->rdp->settings->FrameAcknowledge > 0 && marker->frameAction == SURFACECMD_FRAMEACTION_END)
+ if (update->context->rdp->settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE] &&
+ (update->context->rdp->settings->FrameAcknowledge > 0) &&
+ (marker->frameAction == SURFACECMD_FRAMEACTION_END))
{
update_send_frame_acknowledge(update->context->rdp, marker->frameId);
}
*length = 6;
- return TRUE;
+
+ return 0;
}
int update_recv_surfcmds(rdpUpdate* update, UINT32 size, STREAM* s)
{
case CMDTYPE_SET_SURFACE_BITS:
case CMDTYPE_STREAM_SURFACE_BITS:
- if (!update_recv_surfcmd_surface_bits(update, s, &cmdLength))
+ if (update_recv_surfcmd_surface_bits(update, s, &cmdLength) < 0)
return -1;
break;
case CMDTYPE_FRAME_MARKER:
- if (!update_recv_surfcmd_frame_marker(update, s, &cmdLength))
+ if (update_recv_surfcmd_frame_marker(update, s, &cmdLength) < 0)
return -1;
break;