mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Fixed logging.
This commit is contained in:
@@ -302,22 +302,30 @@ fail:
|
||||
|
||||
static BOOL freerdp_check_point(rdpContext* context, INT32 x, INT32 y)
|
||||
{
|
||||
UINT32 dw, dh;
|
||||
|
||||
if (!context || !context->settings)
|
||||
return FALSE;
|
||||
|
||||
dw = context->settings->DesktopWidth;
|
||||
dh = context->settings->DesktopHeight;
|
||||
|
||||
if (x < 0)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
if (y < 0)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
if (x > context->settings->DesktopWidth)
|
||||
return FALSE;
|
||||
if (x > dw)
|
||||
goto fail;
|
||||
|
||||
if (y > context->settings->DesktopHeight)
|
||||
return FALSE;
|
||||
if (y > dw)
|
||||
goto fail;
|
||||
|
||||
return TRUE;
|
||||
fail:
|
||||
WLog_ERR(TAG, "Invalid point %"PRId32"x%"PRId32" [%"PRIu32"x%"PRIu32"]", x, y, dw, dh);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL freerdp_check_delta_point(rdpContext* context, INT32 x, INT32 y, UINT32 count,
|
||||
@@ -353,10 +361,10 @@ static BOOL freerdp_check_delta_rect(rdpContext* context, UINT32 count, const DE
|
||||
INT32 h = 0;
|
||||
|
||||
if (!context || !data)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
if (count > 45)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
@@ -367,10 +375,13 @@ static BOOL freerdp_check_delta_rect(rdpContext* context, UINT32 count, const DE
|
||||
h = delta->height;
|
||||
|
||||
if (!freerdp_primary_check_rect(context, x, y, w, h))
|
||||
return FALSE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
fail:
|
||||
WLog_ERR(TAG, "invalid delta rectangles");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL freerdp_check_glyph_op_bound(rdpContext* context, INT32 left, INT32 top, INT32 right,
|
||||
@@ -2735,7 +2746,7 @@ static BOOL update_read_create_offscreen_bitmap_order(wStream* s,
|
||||
|
||||
if (deleteListPresent)
|
||||
{
|
||||
int i;
|
||||
UINT32 i;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
@@ -2757,7 +2768,7 @@ static BOOL update_read_create_offscreen_bitmap_order(wStream* s,
|
||||
if (Stream_GetRemainingLength(s) < 2 * deleteList->cIndices)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < (int) deleteList->cIndices; i++)
|
||||
for (i = 0; i < deleteList->cIndices; i++)
|
||||
{
|
||||
Stream_Read_UINT16(s, deleteList->indices[i]);
|
||||
}
|
||||
@@ -3670,7 +3681,11 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
WLog_Print(update->log, WLOG_WARN,
|
||||
"Primary Drawing Order %s failed", orderName);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (flags & ORDER_BOUNDS)
|
||||
{
|
||||
@@ -3819,159 +3834,133 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
|
||||
switch (orderType)
|
||||
{
|
||||
case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP:
|
||||
if (!update_read_create_offscreen_bitmap_order(s,
|
||||
if (update_read_create_offscreen_bitmap_order(s,
|
||||
&(altsec->create_offscreen_bitmap)))
|
||||
{
|
||||
WLog_Print(update->log, WLOG_ERROR, "%s - update_read_create_offscreen_bitmap_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->CreateOffscreenBitmap, rc, context,
|
||||
&(altsec->create_offscreen_bitmap));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->CreateOffscreenBitmap, rc, 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_Print(update->log, WLOG_ERROR, "%s - update_read_switch_surface_order() failed", orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->SwitchSurface, rc, context, &(altsec->switch_surface));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->SwitchSurface, rc, context, &(altsec->switch_surface));
|
||||
break;
|
||||
|
||||
case ORDER_TYPE_CREATE_NINE_GRID_BITMAP:
|
||||
if (!update_read_create_nine_grid_bitmap_order(s,
|
||||
if (update_read_create_nine_grid_bitmap_order(s,
|
||||
&(altsec->create_nine_grid_bitmap)))
|
||||
{
|
||||
WLog_Print(update->log, WLOG_ERROR, "%s - update_read_create_nine_grid_bitmap_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->CreateNineGridBitmap, rc, context,
|
||||
&(altsec->create_nine_grid_bitmap));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->CreateNineGridBitmap, rc, 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_Print(update->log, WLOG_ERROR, "%s - update_read_frame_marker_order() failed", orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->FrameMarker, rc, context, &(altsec->frame_marker));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->FrameMarker, rc, 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_Print(update->log, WLOG_ERROR, "%s - update_read_stream_bitmap_first_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->StreamBitmapFirst, rc, context, &(altsec->stream_bitmap_first));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->StreamBitmapFirst, rc, 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_Print(update->log, WLOG_ERROR, "%s - update_read_stream_bitmap_next_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->StreamBitmapNext, rc, context, &(altsec->stream_bitmap_next));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->StreamBitmapNext, rc, 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_Print(update->log, WLOG_ERROR, "%s - update_read_draw_gdiplus_first_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->DrawGdiPlusFirst, rc, context, &(altsec->draw_gdiplus_first));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->DrawGdiPlusFirst, rc, 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_Print(update->log, WLOG_ERROR, "%s - update_read_draw_gdiplus_next_order() failed", orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->DrawGdiPlusNext, rc, context, &(altsec->draw_gdiplus_next));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->DrawGdiPlusNext, rc, 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_Print(update->log, WLOG_ERROR, "%s - update_read_draw_gdiplus_end_order() failed", orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->DrawGdiPlusEnd, rc, context, &(altsec->draw_gdiplus_end));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->DrawGdiPlusEnd, rc, context, &(altsec->draw_gdiplus_end));
|
||||
break;
|
||||
|
||||
case ORDER_TYPE_GDIPLUS_CACHE_FIRST:
|
||||
if (!update_read_draw_gdiplus_cache_first_order(s,
|
||||
if (update_read_draw_gdiplus_cache_first_order(s,
|
||||
&(altsec->draw_gdiplus_cache_first)))
|
||||
{
|
||||
WLog_Print(update->log, WLOG_ERROR, "%s - update_read_draw_gdiplus_cache_first_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->DrawGdiPlusCacheFirst, rc, context,
|
||||
&(altsec->draw_gdiplus_cache_first));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->DrawGdiPlusCacheFirst, rc, context,
|
||||
&(altsec->draw_gdiplus_cache_first));
|
||||
break;
|
||||
|
||||
case ORDER_TYPE_GDIPLUS_CACHE_NEXT:
|
||||
if (!update_read_draw_gdiplus_cache_next_order(s,
|
||||
if (update_read_draw_gdiplus_cache_next_order(s,
|
||||
&(altsec->draw_gdiplus_cache_next)))
|
||||
{
|
||||
WLog_Print(update->log, WLOG_ERROR, "%s - update_read_draw_gdiplus_cache_next_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->DrawGdiPlusCacheNext, rc, context,
|
||||
&(altsec->draw_gdiplus_cache_next));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->DrawGdiPlusCacheNext, rc, context,
|
||||
&(altsec->draw_gdiplus_cache_next));
|
||||
break;
|
||||
|
||||
case ORDER_TYPE_GDIPLUS_CACHE_END:
|
||||
if (!update_read_draw_gdiplus_cache_end_order(s,
|
||||
if (update_read_draw_gdiplus_cache_end_order(s,
|
||||
&(altsec->draw_gdiplus_cache_end)))
|
||||
{
|
||||
WLog_Print(update->log, WLOG_ERROR, "%s - update_read_draw_gdiplus_cache_end_order() failed",
|
||||
orderName);
|
||||
return FALSE;
|
||||
IFCALLRET(altsec->DrawGdiPlusCacheEnd, rc, context, &(altsec->draw_gdiplus_cache_end));
|
||||
}
|
||||
|
||||
IFCALLRET(altsec->DrawGdiPlusCacheEnd, rc, context, &(altsec->draw_gdiplus_cache_end));
|
||||
break;
|
||||
|
||||
case ORDER_TYPE_WINDOW:
|
||||
return update_recv_altsec_window_order(update, s);
|
||||
rc = update_recv_altsec_window_order(update, s);
|
||||
break;
|
||||
|
||||
case ORDER_TYPE_COMPDESK_FIRST:
|
||||
rc = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
WLog_Print(update->log, WLOG_WARN,
|
||||
"Alternate Secondary Drawing Order %s", orderName);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
WLog_Print(update->log, WLOG_WARN,
|
||||
"Alternate Secondary Drawing Order %s failed", orderName);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
BOOL update_recv_order(rdpUpdate* update, wStream* s)
|
||||
{
|
||||
BOOL rc;
|
||||
BYTE controlFlags;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
@@ -3983,11 +3972,14 @@ BOOL update_recv_order(rdpUpdate* update, wStream* s)
|
||||
Stream_Read_UINT8(s, controlFlags); /* controlFlags (1 byte) */
|
||||
|
||||
if (!(controlFlags & ORDER_STANDARD))
|
||||
return update_recv_altsec_order(update, s, controlFlags);
|
||||
rc = update_recv_altsec_order(update, s, controlFlags);
|
||||
else if (controlFlags & ORDER_SECONDARY)
|
||||
return update_recv_secondary_order(update, s, controlFlags);
|
||||
rc = update_recv_secondary_order(update, s, controlFlags);
|
||||
else
|
||||
return update_recv_primary_order(update, s, controlFlags);
|
||||
rc = update_recv_primary_order(update, s, controlFlags);
|
||||
|
||||
return TRUE;
|
||||
if (!rc)
|
||||
WLog_Print(update->log, WLOG_ERROR, "order flags %02"PRIx8" failed", controlFlags);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
UINT16 new_len;
|
||||
BYTE *new_str;
|
||||
BYTE* new_str;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
@@ -52,9 +52,10 @@ BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
}
|
||||
|
||||
new_str = (BYTE*) realloc(unicode_string->string, new_len);
|
||||
|
||||
if (!new_str)
|
||||
{
|
||||
free (unicode_string->string);
|
||||
free(unicode_string->string);
|
||||
unicode_string->string = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -62,7 +63,6 @@ BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
unicode_string->string = new_str;
|
||||
unicode_string->length = new_len;
|
||||
Stream_Read(s, unicode_string->string, unicode_string->length);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -110,14 +110,15 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
||||
|
||||
/* bitsMask */
|
||||
newBitMask = (BYTE*) realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);
|
||||
|
||||
if (!newBitMask)
|
||||
{
|
||||
free (iconInfo->bitsMask);
|
||||
free(iconInfo->bitsMask);
|
||||
iconInfo->bitsMask = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
iconInfo->bitsMask = newBitMask;
|
||||
|
||||
iconInfo->bitsMask = newBitMask;
|
||||
Stream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);
|
||||
|
||||
/* colorTable */
|
||||
@@ -126,21 +127,23 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
||||
if (iconInfo->cbColorTable)
|
||||
{
|
||||
iconInfo->colorTable = (BYTE*) malloc(iconInfo->cbColorTable);
|
||||
|
||||
if (!iconInfo->colorTable)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (iconInfo->cbColorTable)
|
||||
{
|
||||
BYTE *new_tab;
|
||||
|
||||
BYTE* new_tab;
|
||||
new_tab = (BYTE*) realloc(iconInfo->colorTable, iconInfo->cbColorTable);
|
||||
|
||||
if (!new_tab)
|
||||
{
|
||||
free (iconInfo->colorTable);
|
||||
free(iconInfo->colorTable);
|
||||
iconInfo->colorTable = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iconInfo->colorTable = new_tab;
|
||||
}
|
||||
else
|
||||
@@ -153,17 +156,17 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
||||
Stream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);
|
||||
|
||||
/* bitsColor */
|
||||
newBitMask = (BYTE *)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||
newBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||
|
||||
if (!newBitMask)
|
||||
{
|
||||
free (iconInfo->bitsColor);
|
||||
free(iconInfo->bitsColor);
|
||||
iconInfo->bitsColor = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iconInfo->bitsColor = newBitMask;
|
||||
|
||||
Stream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -174,7 +177,6 @@ BOOL update_read_cached_icon_info(wStream* s, CACHED_ICON_INFO* cachedIconInfo)
|
||||
|
||||
Stream_Read_UINT16(s, cachedIconInfo->cacheEntry); /* cacheEntry (2 bytes) */
|
||||
Stream_Read_UINT8(s, cachedIconInfo->cacheId); /* cacheId (1 byte) */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -185,12 +187,12 @@ BOOL update_read_notify_icon_infotip(wStream* s, NOTIFY_ICON_INFOTIP* notifyIcon
|
||||
|
||||
Stream_Read_UINT32(s, notifyIconInfoTip->timeout); /* timeout (4 bytes) */
|
||||
Stream_Read_UINT32(s, notifyIconInfoTip->flags); /* infoFlags (4 bytes) */
|
||||
|
||||
return rail_read_unicode_string(s, ¬ifyIconInfoTip->text) && /* infoTipText */
|
||||
rail_read_unicode_string(s, ¬ifyIconInfoTip->title); /* title */
|
||||
rail_read_unicode_string(s, ¬ifyIconInfoTip->title); /* title */
|
||||
}
|
||||
|
||||
BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
|
||||
BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
WINDOW_STATE_ORDER* windowState)
|
||||
{
|
||||
int i;
|
||||
int size;
|
||||
@@ -295,18 +297,21 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
|
||||
Stream_Read_UINT16(s, windowState->numWindowRects); /* numWindowRects (2 bytes) */
|
||||
|
||||
if (windowState->numWindowRects == 0) {
|
||||
if (windowState->numWindowRects == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
size = sizeof(RECTANGLE_16) * windowState->numWindowRects;
|
||||
newRect = (RECTANGLE_16*)realloc(windowState->windowRects, size);
|
||||
|
||||
if (!newRect)
|
||||
{
|
||||
free(windowState->windowRects);
|
||||
windowState->windowRects = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
windowState->windowRects = newRect;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 8 * windowState->numWindowRects)
|
||||
@@ -338,17 +343,21 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
|
||||
Stream_Read_UINT16(s, windowState->numVisibilityRects); /* numVisibilityRects (2 bytes) */
|
||||
|
||||
if (windowState->numVisibilityRects == 0) {
|
||||
if (windowState->numVisibilityRects == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
size = sizeof(RECTANGLE_16) * windowState->numVisibilityRects;
|
||||
newRect = (RECTANGLE_16*)realloc(windowState->visibilityRects, size);
|
||||
|
||||
if (!newRect)
|
||||
{
|
||||
free(windowState->visibilityRects);
|
||||
windowState->visibilityRects = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
windowState->visibilityRects = newRect;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < windowState->numVisibilityRects * 8)
|
||||
@@ -363,22 +372,27 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
Stream_Read_UINT16(s, windowState->visibilityRects[i].bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL update_read_window_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon)
|
||||
BOOL update_read_window_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
WINDOW_ICON_ORDER* window_icon)
|
||||
{
|
||||
update_free_window_icon_info(window_icon->iconInfo);
|
||||
window_icon->iconInfo = (ICON_INFO*) calloc(1, sizeof(ICON_INFO));
|
||||
|
||||
if (!window_icon->iconInfo)
|
||||
return FALSE;
|
||||
|
||||
return update_read_icon_info(s, window_icon->iconInfo); /* iconInfo (ICON_INFO) */
|
||||
}
|
||||
|
||||
BOOL update_read_window_cached_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
||||
BOOL update_read_window_cached_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
||||
{
|
||||
return update_read_cached_icon_info(s, &window_cached_icon->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
|
||||
return update_read_cached_icon_info(s,
|
||||
&window_cached_icon->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
|
||||
}
|
||||
|
||||
void update_read_window_delete_order(wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
||||
@@ -401,6 +415,7 @@ BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_I
|
||||
{
|
||||
if (!update_read_window_icon_order(s, orderInfo, &window->window_icon))
|
||||
return FALSE;
|
||||
|
||||
WLog_Print(update->log, WLOG_DEBUG, "WindowIcon");
|
||||
IFCALLRET(window->WindowIcon, result, context, orderInfo, &window->window_icon);
|
||||
}
|
||||
@@ -408,6 +423,7 @@ BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_I
|
||||
{
|
||||
if (!update_read_window_cached_icon_order(s, orderInfo, &window->window_cached_icon))
|
||||
return FALSE;
|
||||
|
||||
WLog_Print(update->log, WLOG_DEBUG, "WindowCachedIcon");
|
||||
IFCALLRET(window->WindowCachedIcon, result, context, orderInfo, &window->window_cached_icon);
|
||||
}
|
||||
@@ -437,12 +453,14 @@ BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_I
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state)
|
||||
BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
NOTIFY_ICON_STATE_ORDER* notify_icon_state)
|
||||
{
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
Stream_Read_UINT32(s, notify_icon_state->version); /* version (4 bytes) */
|
||||
}
|
||||
|
||||
@@ -454,7 +472,8 @@ BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* or
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
|
||||
{
|
||||
if (!update_read_notify_icon_infotip(s, ¬ify_icon_state->infoTip)) /* infoTip (NOTIFY_ICON_INFOTIP) */
|
||||
if (!update_read_notify_icon_infotip(s,
|
||||
¬ify_icon_state->infoTip)) /* infoTip (NOTIFY_ICON_INFOTIP) */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -474,7 +493,8 @@ BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* or
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON)
|
||||
{
|
||||
if (!update_read_cached_icon_info(s, ¬ify_icon_state->cachedIcon)) /* cachedIcon (CACHED_ICON_INFO) */
|
||||
if (!update_read_cached_icon_info(s,
|
||||
¬ify_icon_state->cachedIcon)) /* cachedIcon (CACHED_ICON_INFO) */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -486,7 +506,8 @@ void update_read_notification_icon_delete_order(wStream* s, WINDOW_ORDER_INFO* o
|
||||
/* notification icon deletion event */
|
||||
}
|
||||
|
||||
BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
||||
BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s,
|
||||
WINDOW_ORDER_INFO* orderInfo)
|
||||
{
|
||||
rdpContext* context = update->context;
|
||||
rdpWindowUpdate* window = update->window;
|
||||
@@ -524,7 +545,8 @@ BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s, WIN
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop)
|
||||
BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
||||
MONITORED_DESKTOP_ORDER* monitored_desktop)
|
||||
{
|
||||
int i;
|
||||
int size;
|
||||
@@ -539,7 +561,7 @@ BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO*
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
|
||||
{
|
||||
UINT32 *newid;
|
||||
UINT32* newid;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
@@ -549,16 +571,18 @@ BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO*
|
||||
if (Stream_GetRemainingLength(s) < 4 * monitored_desktop->numWindowIds)
|
||||
return FALSE;
|
||||
|
||||
if (monitored_desktop->numWindowIds > 0) {
|
||||
if (monitored_desktop->numWindowIds > 0)
|
||||
{
|
||||
size = sizeof(UINT32) * monitored_desktop->numWindowIds;
|
||||
|
||||
newid = (UINT32*)realloc(monitored_desktop->windowIds, size);
|
||||
|
||||
if (!newid)
|
||||
{
|
||||
free(monitored_desktop->windowIds);
|
||||
monitored_desktop->windowIds = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
monitored_desktop->windowIds = newid;
|
||||
|
||||
/* windowIds */
|
||||
@@ -593,6 +617,7 @@ BOOL update_recv_desktop_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_
|
||||
{
|
||||
if (!update_read_desktop_actively_monitored_order(s, orderInfo, &window->monitored_desktop))
|
||||
return FALSE;
|
||||
|
||||
WLog_Print(update->log, WLOG_DEBUG, "ActivelyMonitoredDesktop");
|
||||
IFCALLRET(window->MonitoredDesktop, result, context, orderInfo, &window->monitored_desktop);
|
||||
}
|
||||
@@ -602,39 +627,44 @@ BOOL update_recv_desktop_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_
|
||||
|
||||
void update_free_window_icon_info(ICON_INFO* iconInfo)
|
||||
{
|
||||
if (!iconInfo)
|
||||
return;
|
||||
|
||||
free(iconInfo->bitsColor);
|
||||
iconInfo->bitsColor = NULL;
|
||||
|
||||
free(iconInfo->bitsMask);
|
||||
iconInfo->bitsMask = NULL;
|
||||
|
||||
free(iconInfo->colorTable);
|
||||
iconInfo->colorTable = NULL;
|
||||
if (!iconInfo)
|
||||
return;
|
||||
|
||||
free(iconInfo->bitsColor);
|
||||
iconInfo->bitsColor = NULL;
|
||||
free(iconInfo->bitsMask);
|
||||
iconInfo->bitsMask = NULL;
|
||||
free(iconInfo->colorTable);
|
||||
iconInfo->colorTable = NULL;
|
||||
free(iconInfo);
|
||||
}
|
||||
|
||||
BOOL update_recv_altsec_window_order(rdpUpdate* update, wStream* s)
|
||||
{
|
||||
BOOL rc = TRUE;
|
||||
UINT16 orderSize;
|
||||
rdpWindowUpdate* window = update->window;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
{
|
||||
WLog_Print(update->log, WLOG_ERROR, "Stream short");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Stream_Read_UINT16(s, orderSize); /* orderSize (2 bytes) */
|
||||
Stream_Read_UINT32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */
|
||||
|
||||
if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW)
|
||||
return update_recv_window_info_order(update, s, &window->orderInfo);
|
||||
rc = update_recv_window_info_order(update, s, &window->orderInfo);
|
||||
else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_NOTIFY)
|
||||
return update_recv_notification_icon_info_order(update, s, &window->orderInfo);
|
||||
rc = update_recv_notification_icon_info_order(update, s, &window->orderInfo);
|
||||
else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_DESKTOP)
|
||||
return update_recv_desktop_info_order(update, s, &window->orderInfo);
|
||||
rc = update_recv_desktop_info_order(update, s, &window->orderInfo);
|
||||
|
||||
return TRUE;
|
||||
if (!rc)
|
||||
WLog_Print(update->log, WLOG_ERROR, "windoworder flags %08"PRIx32" failed",
|
||||
window->orderInfo.fieldFlags);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user