2011-08-09 10:32:50 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-08-09 10:32:50 +04:00
|
|
|
* Windowing Alternate Secondary Orders
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
* Copyright 2011 Roman Barabanov <romanbarabanov@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
#include <freerdp/log.h>
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
#include "window.h"
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
#define TAG FREERDP_TAG("core.window")
|
|
|
|
|
2015-05-18 12:28:00 +03:00
|
|
|
BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
2014-11-12 18:18:53 +03:00
|
|
|
{
|
2015-03-11 08:40:20 +03:00
|
|
|
UINT16 new_len;
|
2018-10-15 14:56:19 +03:00
|
|
|
BYTE* new_str;
|
2015-03-11 08:40:20 +03:00
|
|
|
|
2014-11-12 18:18:53 +03:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
Stream_Read_UINT16(s, new_len); /* cbString (2 bytes) */
|
2014-11-12 18:18:53 +03:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
if (Stream_GetRemainingLength(s) < new_len)
|
2014-11-12 18:18:53 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2015-05-07 16:08:00 +03:00
|
|
|
if (!new_len)
|
|
|
|
{
|
|
|
|
free(unicode_string->string);
|
|
|
|
unicode_string->string = NULL;
|
|
|
|
unicode_string->length = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
new_str = (BYTE*) realloc(unicode_string->string, new_len);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
if (!new_str)
|
2015-03-23 17:04:23 +03:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
free(unicode_string->string);
|
2015-03-23 17:04:23 +03:00
|
|
|
unicode_string->string = NULL;
|
2015-03-11 08:40:20 +03:00
|
|
|
return FALSE;
|
2015-03-23 17:04:23 +03:00
|
|
|
}
|
2014-11-12 18:18:53 +03:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
unicode_string->string = new_str;
|
|
|
|
unicode_string->length = new_len;
|
2014-11-12 18:18:53 +03:00
|
|
|
Stream_Read(s, unicode_string->string, unicode_string->length);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-11-14 13:29:44 +03:00
|
|
|
/* See [MS-RDPERP] 2.2.1.2.3 Icon Info (TS_ICON_INFO) */
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
BYTE* newBitMask;
|
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read_UINT16(s, iconInfo->cacheEntry); /* cacheEntry (2 bytes) */
|
|
|
|
Stream_Read_UINT8(s, iconInfo->cacheId); /* cacheId (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, iconInfo->bpp); /* bpp (1 byte) */
|
2014-09-12 16:36:29 +04:00
|
|
|
|
2014-05-29 12:12:02 +04:00
|
|
|
if ((iconInfo->bpp < 1) || (iconInfo->bpp > 32))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "invalid bpp value %"PRIu32"", iconInfo->bpp);
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, iconInfo->height); /* height (2 bytes) */
|
2011-08-15 03:20:53 +04:00
|
|
|
|
2018-11-10 23:09:20 +03:00
|
|
|
/* cbColorTable is only present when bpp is 1, 4 or 8 */
|
2018-11-14 13:29:44 +03:00
|
|
|
switch (iconInfo->bpp)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
2018-11-14 13:29:44 +03:00
|
|
|
case 1:
|
|
|
|
case 4:
|
|
|
|
case 8:
|
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2018-11-14 13:29:44 +03:00
|
|
|
Stream_Read_UINT16(s, iconInfo->cbColorTable); /* cbColorTable (2 bytes) */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
iconInfo->cbColorTable = 0;
|
|
|
|
break;
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-15 03:20:53 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read_UINT16(s, iconInfo->cbBitsMask); /* cbBitsMask (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask + iconInfo->cbBitsColor)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
/* bitsMask */
|
2014-05-29 12:12:02 +04:00
|
|
|
newBitMask = (BYTE*) realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2014-05-29 12:12:02 +04:00
|
|
|
if (!newBitMask)
|
2015-03-23 17:04:23 +03:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
free(iconInfo->bitsMask);
|
2015-03-23 17:04:23 +03:00
|
|
|
iconInfo->bitsMask = NULL;
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
2015-03-23 17:04:23 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2018-10-15 14:56:19 +03:00
|
|
|
iconInfo->bitsMask = newBitMask;
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
/* colorTable */
|
2013-10-23 00:28:23 +04:00
|
|
|
if (iconInfo->colorTable == NULL)
|
2013-08-30 16:19:50 +04:00
|
|
|
{
|
2013-10-23 00:28:23 +04:00
|
|
|
if (iconInfo->cbColorTable)
|
2015-06-16 16:42:07 +03:00
|
|
|
{
|
2013-10-23 00:28:23 +04:00
|
|
|
iconInfo->colorTable = (BYTE*) malloc(iconInfo->cbColorTable);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
if (!iconInfo->colorTable)
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-08-30 16:19:50 +04:00
|
|
|
}
|
2013-10-23 00:28:23 +04:00
|
|
|
else if (iconInfo->cbColorTable)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
BYTE* new_tab;
|
2015-03-11 08:40:20 +03:00
|
|
|
new_tab = (BYTE*) realloc(iconInfo->colorTable, iconInfo->cbColorTable);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
if (!new_tab)
|
2015-03-23 17:04:23 +03:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
free(iconInfo->colorTable);
|
2015-03-23 17:04:23 +03:00
|
|
|
iconInfo->colorTable = NULL;
|
2015-03-11 08:40:20 +03:00
|
|
|
return FALSE;
|
2015-03-23 17:04:23 +03:00
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
iconInfo->colorTable = new_tab;
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
2013-08-30 16:19:50 +04:00
|
|
|
else
|
|
|
|
{
|
2013-10-23 00:28:23 +04:00
|
|
|
free(iconInfo->colorTable);
|
|
|
|
iconInfo->colorTable = NULL;
|
2013-08-30 16:19:50 +04:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
if (iconInfo->colorTable)
|
|
|
|
Stream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
/* bitsColor */
|
2018-10-15 14:56:19 +03:00
|
|
|
newBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
|
|
|
|
2014-05-29 12:12:02 +04:00
|
|
|
if (!newBitMask)
|
2015-03-23 17:04:23 +03:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
free(iconInfo->bitsColor);
|
2015-03-23 17:04:23 +03:00
|
|
|
iconInfo->bitsColor = NULL;
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
2015-03-23 17:04:23 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2018-10-15 14:56:19 +03:00
|
|
|
iconInfo->bitsColor = newBitMask;
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_cached_icon_info(wStream* s, CACHED_ICON_INFO* cachedIconInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 3)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read_UINT16(s, cachedIconInfo->cacheEntry); /* cacheEntry (2 bytes) */
|
|
|
|
Stream_Read_UINT8(s, cachedIconInfo->cacheId); /* cacheId (1 byte) */
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_notify_icon_infotip(wStream* s, NOTIFY_ICON_INFOTIP* notifyIconInfoTip)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
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 */
|
2018-10-15 14:56:19 +03:00
|
|
|
rail_read_unicode_string(s, ¬ifyIconInfoTip->title); /* title */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
WINDOW_STATE_ORDER* windowState)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int size;
|
2017-06-22 05:21:20 +03:00
|
|
|
RECTANGLE_16* newRect;
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->ownerWindowId); /* ownerWindowId (4 bytes) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->style); /* style (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, windowState->extendedStyle); /* extendedStyle (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT8(s, windowState->showState); /* showState (1 byte) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
|
|
|
{
|
2013-10-16 06:42:07 +04:00
|
|
|
if (!rail_read_unicode_string(s, &windowState->titleInfo)) /* titleInfo */
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->clientOffsetX); /* clientOffsetX (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, windowState->clientOffsetY); /* clientOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->clientAreaWidth); /* clientAreaWidth (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, windowState->clientAreaHeight); /* clientAreaHeight (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT8(s, windowState->RPContent); /* RPContent (1 byte) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->rootParentHandle);/* rootParentHandle (4 bytes) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->windowOffsetX); /* windowOffsetX (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, windowState->windowOffsetY); /* windowOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, windowState->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
Stream_Read_UINT32(s, windowState->windowWidth); /* windowWidth (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, windowState->windowHeight); /* windowHeight (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
Stream_Read_UINT16(s, windowState->numWindowRects); /* numWindowRects (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2018-10-15 14:56:19 +03:00
|
|
|
if (windowState->numWindowRects == 0)
|
|
|
|
{
|
2017-06-29 12:24:36 +03:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
size = sizeof(RECTANGLE_16) * windowState->numWindowRects;
|
2017-06-22 05:21:20 +03:00
|
|
|
newRect = (RECTANGLE_16*)realloc(windowState->windowRects, size);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2017-06-22 05:21:20 +03:00
|
|
|
if (!newRect)
|
|
|
|
{
|
|
|
|
free(windowState->windowRects);
|
|
|
|
windowState->windowRects = NULL;
|
2015-06-16 16:42:07 +03:00
|
|
|
return FALSE;
|
2017-06-22 05:21:20 +03:00
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2017-06-22 05:21:20 +03:00
|
|
|
windowState->windowRects = newRect;
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8 * windowState->numWindowRects)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
/* windowRects */
|
2013-10-16 06:42:07 +04:00
|
|
|
for (i = 0; i < (int) windowState->numWindowRects; i++)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2013-10-16 06:42:07 +04:00
|
|
|
Stream_Read_UINT16(s, windowState->windowRects[i].left); /* left (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, windowState->windowRects[i].top); /* top (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, windowState->windowRects[i].right); /* right (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, windowState->windowRects[i].bottom); /* bottom (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
Stream_Read_UINT32(s, windowState->visibleOffsetX); /* visibleOffsetX (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, windowState->visibleOffsetY); /* visibleOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
Stream_Read_UINT16(s, windowState->numVisibilityRects); /* numVisibilityRects (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2018-10-15 14:56:19 +03:00
|
|
|
if (windowState->numVisibilityRects == 0)
|
|
|
|
{
|
2017-06-29 12:24:36 +03:00
|
|
|
return TRUE;
|
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
size = sizeof(RECTANGLE_16) * windowState->numVisibilityRects;
|
2017-06-22 05:21:20 +03:00
|
|
|
newRect = (RECTANGLE_16*)realloc(windowState->visibilityRects, size);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2017-06-22 05:21:20 +03:00
|
|
|
if (!newRect)
|
|
|
|
{
|
|
|
|
free(windowState->visibilityRects);
|
|
|
|
windowState->visibilityRects = NULL;
|
2015-06-16 16:42:07 +03:00
|
|
|
return FALSE;
|
2017-06-22 05:21:20 +03:00
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2017-06-22 05:21:20 +03:00
|
|
|
windowState->visibilityRects = newRect;
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < windowState->numVisibilityRects * 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
/* visibilityRects */
|
2013-10-16 06:42:07 +04:00
|
|
|
for (i = 0; i < (int) windowState->numVisibilityRects; i++)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2013-10-16 06:42:07 +04:00
|
|
|
Stream_Read_UINT16(s, windowState->visibilityRects[i].left); /* left (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, windowState->visibilityRects[i].top); /* top (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, windowState->visibilityRects[i].right); /* right (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, windowState->visibilityRects[i].bottom); /* bottom (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_window_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
WINDOW_ICON_ORDER* window_icon)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2017-06-23 04:50:56 +03:00
|
|
|
update_free_window_icon_info(window_icon->iconInfo);
|
2015-06-16 16:42:07 +03:00
|
|
|
window_icon->iconInfo = (ICON_INFO*) calloc(1, sizeof(ICON_INFO));
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
if (!window_icon->iconInfo)
|
|
|
|
return FALSE;
|
2012-11-22 04:22:41 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
return update_read_icon_info(s, window_icon->iconInfo); /* iconInfo (ICON_INFO) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_window_cached_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
2018-10-15 14:56:19 +03:00
|
|
|
WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
return update_read_cached_icon_info(s,
|
|
|
|
&window_cached_icon->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static void update_read_window_delete_order(wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
|
|
|
/* window deletion event */
|
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s,
|
|
|
|
WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpWindowUpdate* window = update->window;
|
2016-03-03 18:21:12 +03:00
|
|
|
BOOL result = TRUE;
|
2011-11-22 06:07:03 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_ICON)
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (!update_read_window_icon_order(s, orderInfo, &window->window_icon))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "WindowIcon");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->WindowIcon, result, context, orderInfo, &window->window_icon);
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
else if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON)
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (!update_read_window_cached_icon_order(s, orderInfo, &window->window_cached_icon))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "WindowCachedIcon");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->WindowCachedIcon, result, context, orderInfo, &window->window_cached_icon);
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
else if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED)
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2011-08-18 06:31:27 +04:00
|
|
|
update_read_window_delete_order(s, orderInfo);
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "WindowDelete");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->WindowDelete, result, context, orderInfo);
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
else
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (!update_read_window_state_order(s, orderInfo, &window->window_state))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2011-08-16 07:37:43 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "WindowCreate");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->WindowCreate, result, context, orderInfo, &window->window_state);
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
2011-08-16 07:37:43 +04:00
|
|
|
else
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "WindowUpdate");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->WindowUpdate, result, context, orderInfo, &window->window_state);
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2016-03-03 18:21:12 +03:00
|
|
|
return result;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
2018-10-15 14:56:19 +03:00
|
|
|
NOTIFY_ICON_STATE_ORDER* notify_icon_state)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, notify_icon_state->version); /* version (4 bytes) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP)
|
|
|
|
{
|
|
|
|
if (!rail_read_unicode_string(s, ¬ify_icon_state->toolTip)) /* toolTip (UNICODE_STRING) */
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
|
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
if (!update_read_notify_icon_infotip(s,
|
|
|
|
¬ify_icon_state->infoTip)) /* infoTip (NOTIFY_ICON_INFOTIP) */
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_STATE)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, notify_icon_state->state); /* state (4 bytes) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_ICON)
|
|
|
|
{
|
|
|
|
if (!update_read_icon_info(s, ¬ify_icon_state->icon)) /* icon (ICON_INFO) */
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON)
|
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
if (!update_read_cached_icon_info(s,
|
|
|
|
¬ify_icon_state->cachedIcon)) /* cachedIcon (CACHED_ICON_INFO) */
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static void update_read_notification_icon_delete_order(wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
|
|
|
/* notification icon deletion event */
|
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s,
|
2018-10-15 14:56:19 +03:00
|
|
|
WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpWindowUpdate* window = update->window;
|
2016-03-03 18:21:12 +03:00
|
|
|
BOOL result = TRUE;
|
2011-11-22 06:07:03 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED)
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2011-08-18 06:31:27 +04:00
|
|
|
update_read_notification_icon_delete_order(s, orderInfo);
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "NotifyIconDelete");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->NotifyIconDelete, result, context, orderInfo);
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
else
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (!update_read_notification_icon_state_order(s, orderInfo, &window->notify_icon_state))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2011-08-16 07:37:43 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "NotifyIconCreate");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->NotifyIconCreate, result, context, orderInfo, &window->notify_icon_state);
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
2011-08-16 07:37:43 +04:00
|
|
|
else
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "NotifyIconUpdate");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->NotifyIconUpdate, result, context, orderInfo, &window->notify_icon_state);
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2016-03-03 18:21:12 +03:00
|
|
|
return result;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
2018-10-15 14:56:19 +03:00
|
|
|
MONITORED_DESKTOP_ORDER* monitored_desktop)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int size;
|
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, monitored_desktop->activeWindowId); /* activeWindowId (4 bytes) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
|
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
UINT32* newid;
|
2015-03-11 08:40:20 +03:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, monitored_desktop->numWindowIds); /* numWindowIds (1 byte) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4 * monitored_desktop->numWindowIds)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2018-10-15 14:56:19 +03:00
|
|
|
if (monitored_desktop->numWindowIds > 0)
|
|
|
|
{
|
2015-04-28 10:21:38 +03:00
|
|
|
size = sizeof(UINT32) * monitored_desktop->numWindowIds;
|
|
|
|
newid = (UINT32*)realloc(monitored_desktop->windowIds, size);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2015-04-28 10:21:38 +03:00
|
|
|
if (!newid)
|
|
|
|
{
|
|
|
|
free(monitored_desktop->windowIds);
|
|
|
|
monitored_desktop->windowIds = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2015-04-28 10:21:38 +03:00
|
|
|
monitored_desktop->windowIds = newid;
|
|
|
|
|
|
|
|
/* windowIds */
|
|
|
|
for (i = 0; i < (int)monitored_desktop->numWindowIds; i++)
|
|
|
|
{
|
|
|
|
Stream_Read_UINT32(s, monitored_desktop->windowIds[i]);
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static void update_read_desktop_non_monitored_order(wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
|
|
|
/* non-monitored desktop notification event */
|
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_recv_desktop_info_order(rdpUpdate* update, wStream* s,
|
|
|
|
WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpWindowUpdate* window = update->window;
|
2016-03-03 18:21:12 +03:00
|
|
|
BOOL result = TRUE;
|
2011-11-22 06:07:03 +04:00
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_NONE)
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2011-08-09 10:32:50 +04:00
|
|
|
update_read_desktop_non_monitored_order(s, orderInfo);
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "NonMonitoredDesktop");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->NonMonitoredDesktop, result, context, orderInfo);
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
else
|
2011-08-09 11:01:40 +04:00
|
|
|
{
|
2013-10-10 21:00:04 +04:00
|
|
|
if (!update_read_desktop_actively_monitored_order(s, orderInfo, &window->monitored_desktop))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "ActivelyMonitoredDesktop");
|
2016-03-03 18:21:12 +03:00
|
|
|
IFCALLRET(window->MonitoredDesktop, result, context, orderInfo, &window->monitored_desktop);
|
2011-08-09 11:01:40 +04:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2016-03-03 18:21:12 +03:00
|
|
|
return result;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2017-06-21 17:07:07 +03:00
|
|
|
void update_free_window_icon_info(ICON_INFO* iconInfo)
|
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
if (!iconInfo)
|
|
|
|
return;
|
|
|
|
|
|
|
|
free(iconInfo->bitsColor);
|
|
|
|
iconInfo->bitsColor = NULL;
|
|
|
|
free(iconInfo->bitsMask);
|
|
|
|
iconInfo->bitsMask = NULL;
|
|
|
|
free(iconInfo->colorTable);
|
|
|
|
iconInfo->colorTable = NULL;
|
2017-06-21 17:07:07 +03:00
|
|
|
free(iconInfo);
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_altsec_window_order(rdpUpdate* update, wStream* s)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
BOOL rc = TRUE;
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 orderSize;
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpWindowUpdate* window = update->window;
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 6)
|
2018-10-15 14:56:19 +03:00
|
|
|
{
|
|
|
|
WLog_Print(update->log, WLOG_ERROR, "Stream short");
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2018-10-15 14:56:19 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, orderSize); /* orderSize (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */
|
2011-11-22 06:07:03 +04:00
|
|
|
|
|
|
|
if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW)
|
2018-10-15 14:56:19 +03:00
|
|
|
rc = update_recv_window_info_order(update, s, &window->orderInfo);
|
2011-11-22 06:07:03 +04:00
|
|
|
else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_NOTIFY)
|
2018-10-15 14:56:19 +03:00
|
|
|
rc = update_recv_notification_icon_info_order(update, s, &window->orderInfo);
|
2011-11-22 06:07:03 +04:00
|
|
|
else if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_DESKTOP)
|
2018-10-15 14:56:19 +03:00
|
|
|
rc = update_recv_desktop_info_order(update, s, &window->orderInfo);
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2018-10-15 14:56:19 +03:00
|
|
|
if (!rc)
|
|
|
|
WLog_Print(update->log, WLOG_ERROR, "windoworder flags %08"PRIx32" failed",
|
|
|
|
window->orderInfo.fieldFlags);
|
|
|
|
|
|
|
|
return rc;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|