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.
|
|
|
|
*/
|
|
|
|
|
2022-02-16 13:20:38 +03:00
|
|
|
#include <freerdp/config.h>
|
2012-08-15 01:09:01 +04:00
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
#include <winpr/crt.h>
|
2022-01-11 18:01:33 +03:00
|
|
|
#include <winpr/assert.h>
|
2012-11-22 04:22:41 +04:00
|
|
|
|
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")
|
|
|
|
|
2019-05-09 14:23:25 +03:00
|
|
|
static void update_free_window_icon_info(ICON_INFO* iconInfo);
|
|
|
|
|
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
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
|
2014-11-12 18:18:53 +03:00
|
|
|
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
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +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;
|
|
|
|
}
|
|
|
|
|
2019-07-04 10:58:08 +03:00
|
|
|
BOOL utf8_string_to_rail_string(const char* string, RAIL_UNICODE_STRING* unicode_string)
|
|
|
|
{
|
|
|
|
WCHAR* buffer = NULL;
|
2022-10-28 09:09:27 +03:00
|
|
|
size_t len = 0;
|
2019-07-04 10:58:08 +03:00
|
|
|
free(unicode_string->string);
|
|
|
|
unicode_string->string = NULL;
|
|
|
|
unicode_string->length = 0;
|
|
|
|
|
|
|
|
if (!string || strlen(string) < 1)
|
|
|
|
return TRUE;
|
|
|
|
|
2022-10-28 09:09:27 +03:00
|
|
|
buffer = ConvertUtf8ToWCharAlloc(string, &len);
|
2019-07-04 10:58:08 +03:00
|
|
|
|
2022-10-28 09:09:27 +03:00
|
|
|
if (!buffer || (len * sizeof(WCHAR) > UINT16_MAX))
|
2019-07-04 10:58:08 +03:00
|
|
|
{
|
|
|
|
free(buffer);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
unicode_string->string = (BYTE*)buffer;
|
2022-10-28 09:09:27 +03:00
|
|
|
unicode_string->length = (UINT16)len * sizeof(WCHAR);
|
2019-07-04 10:58:08 +03:00
|
|
|
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
|
|
|
{
|
2020-04-06 16:09:03 +03:00
|
|
|
BYTE* newBitMask = NULL;
|
2014-09-12 16:36:29 +04:00
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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) */
|
2019-11-06 17:24:51 +03:00
|
|
|
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))
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
WLog_ERR(TAG, "invalid bpp value %" PRIu32 "", iconInfo->bpp);
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */
|
2013-10-23 00:28:23 +04:00
|
|
|
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:
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
|
2018-11-14 13:29:44 +03:00
|
|
|
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
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT16(s, iconInfo->cbBitsMask); /* cbBitsMask (2 bytes) */
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
/* bitsMask */
|
2020-04-06 16:09:03 +03:00
|
|
|
if (iconInfo->cbBitsMask > 0)
|
|
|
|
{
|
|
|
|
newBitMask = (BYTE*)realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2020-04-06 16:09:03 +03:00
|
|
|
if (!newBitMask)
|
|
|
|
{
|
|
|
|
free(iconInfo->bitsMask);
|
|
|
|
iconInfo->bitsMask = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
iconInfo->bitsMask = newBitMask;
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, iconInfo->cbBitsMask))
|
2020-04-06 16:09:03 +03:00
|
|
|
return FALSE;
|
|
|
|
Stream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);
|
|
|
|
}
|
|
|
|
else
|
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;
|
2020-04-06 16:09:03 +03:00
|
|
|
iconInfo->cbBitsMask = 0;
|
2015-03-23 17:04:23 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
/* colorTable */
|
2020-04-06 16:09:03 +03:00
|
|
|
if (iconInfo->cbColorTable > 0)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
2018-10-15 14:56:19 +03:00
|
|
|
BYTE* new_tab;
|
2019-11-06 17:24:51 +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)
|
2020-03-31 10:06:05 +03:00
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, iconInfo->cbColorTable))
|
2020-03-31 10:06:05 +03:00
|
|
|
return FALSE;
|
2013-10-23 00:28:23 +04:00
|
|
|
Stream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);
|
2020-03-31 10:06:05 +03:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
/* bitsColor */
|
2020-04-06 16:09:03 +03:00
|
|
|
if (iconInfo->cbBitsColor > 0)
|
|
|
|
{
|
|
|
|
newBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
|
|
|
|
|
|
|
if (!newBitMask)
|
|
|
|
{
|
|
|
|
free(iconInfo->bitsColor);
|
|
|
|
iconInfo->bitsColor = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2020-04-06 16:09:03 +03:00
|
|
|
iconInfo->bitsColor = newBitMask;
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, iconInfo->cbBitsColor))
|
2020-04-06 16:09:03 +03:00
|
|
|
return FALSE;
|
|
|
|
Stream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);
|
|
|
|
}
|
|
|
|
else
|
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;
|
2020-04-06 16:09:03 +03:00
|
|
|
iconInfo->cbBitsColor = 0;
|
2015-03-23 17:04:23 +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_cached_icon_info(wStream* s, CACHED_ICON_INFO* cachedIconInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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) */
|
2019-11-06 17:24:51 +03:00
|
|
|
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
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT32(s, notifyIconInfoTip->timeout); /* timeout (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, notifyIconInfoTip->flags); /* infoFlags (4 bytes) */
|
2013-10-23 00:28:23 +04:00
|
|
|
return rail_read_unicode_string(s, ¬ifyIconInfoTip->text) && /* infoTipText */
|
2019-11-06 17:24:51 +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,
|
2019-11-06 17:24:51 +03:00
|
|
|
WINDOW_STATE_ORDER* windowState)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
UINT32 i;
|
|
|
|
size_t 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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT32(s, windowState->style); /* style (4 bytes) */
|
2013-10-16 06:42:07 +04:00
|
|
|
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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
Stream_Read_INT32(s, windowState->clientOffsetX); /* clientOffsetX (4 bytes) */
|
|
|
|
Stream_Read_INT32(s, windowState->clientOffsetY); /* clientOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT32(s, windowState->clientAreaWidth); /* clientAreaWidth (4 bytes) */
|
2013-10-16 06:42:07 +04:00
|
|
|
Stream_Read_UINT32(s, windowState->clientAreaHeight); /* clientAreaHeight (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_X)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2019-05-08 16:36:20 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->resizeMarginLeft);
|
|
|
|
Stream_Read_UINT32(s, windowState->resizeMarginRight);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_Y)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2019-05-08 16:36:20 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
Stream_Read_UINT32(s, windowState->resizeMarginTop);
|
|
|
|
Stream_Read_UINT32(s, windowState->resizeMarginBottom);
|
|
|
|
}
|
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
2019-11-06 17:24:51 +03: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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
Stream_Read_INT32(s, windowState->windowOffsetX); /* windowOffsetX (4 bytes) */
|
|
|
|
Stream_Read_INT32(s, windowState->windowOffsetY); /* windowOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-16 06:42:07 +04:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
Stream_Read_INT32(s, windowState->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */
|
|
|
|
Stream_Read_INT32(s, windowState->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT32(s, windowState->windowWidth); /* windowWidth (4 bytes) */
|
2013-10-16 06:42:07 +04:00
|
|
|
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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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
|
|
|
|
2021-09-20 23:12:04 +03:00
|
|
|
if (windowState->numWindowRects > 0)
|
2018-10-15 14:56:19 +03:00
|
|
|
{
|
2021-09-20 23:12:04 +03:00
|
|
|
size = sizeof(RECTANGLE_16) * windowState->numWindowRects;
|
|
|
|
newRect = (RECTANGLE_16*)realloc(windowState->windowRects, size);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2021-09-20 23:12:04 +03:00
|
|
|
if (!newRect)
|
|
|
|
{
|
|
|
|
free(windowState->windowRects);
|
|
|
|
windowState->windowRects = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2021-09-20 23:12:04 +03:00
|
|
|
windowState->windowRects = newRect;
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2023-01-24 16:53:36 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, windowState->numWindowRects, 8ull))
|
2021-09-20 23:12:04 +03:00
|
|
|
return FALSE;
|
2013-01-12 17:49:01 +04:00
|
|
|
|
2021-09-20 23:12:04 +03:00
|
|
|
/* windowRects */
|
|
|
|
for (i = 0; i < windowState->numWindowRects; i++)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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->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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (windowState->numVisibilityRects != 0)
|
2018-10-15 14:56:19 +03:00
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
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;
|
|
|
|
|
2023-01-24 16:53:36 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, windowState->numVisibilityRects,
|
|
|
|
8ull))
|
2019-05-08 16:36:20 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* visibilityRects */
|
|
|
|
for (i = 0; i < windowState->numVisibilityRects; i++)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT16(s, windowState->visibilityRects[i].left); /* left (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, windowState->visibilityRects[i].top); /* top (2 bytes) */
|
2019-05-08 16:36:20 +03:00
|
|
|
Stream_Read_UINT16(s, windowState->visibilityRects[i].right); /* right (2 bytes) */
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT16(s,
|
|
|
|
windowState->visibilityRects[i].bottom); /* bottom (2 bytes) */
|
2019-05-08 16:36:20 +03:00
|
|
|
}
|
2017-06-29 12:24:36 +03:00
|
|
|
}
|
2019-05-08 16:36:20 +03:00
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OVERLAY_DESCRIPTION)
|
|
|
|
{
|
|
|
|
if (!rail_read_unicode_string(s, &windowState->OverlayDescription))
|
|
|
|
return FALSE;
|
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_OVERLAY_NULL)
|
|
|
|
{
|
2019-06-03 10:05:43 +03:00
|
|
|
/* no data to be read here */
|
2019-05-08 16:36:20 +03:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TASKBAR_BUTTON)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
Stream_Read_UINT8(s, windowState->TaskbarButton);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ENFORCE_SERVER_ZORDER)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
|
2019-05-08 16:36:20 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
Stream_Read_UINT8(s, windowState->EnforceServerZOrder);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_STATE)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
|
2019-05-08 16:36:20 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
Stream_Read_UINT8(s, windowState->AppBarState);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_EDGE)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
|
2019-05-08 16:36:20 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
Stream_Read_UINT8(s, windowState->AppBarEdge);
|
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,
|
2019-11-06 17:24:51 +03:00
|
|
|
WINDOW_ICON_ORDER* window_icon)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2019-05-09 14:23:25 +03:00
|
|
|
WINPR_UNUSED(orderInfo);
|
2019-11-06 17:24:51 +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,
|
2019-11-06 17:24:51 +03:00
|
|
|
WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2019-05-09 14:23:25 +03:00
|
|
|
WINPR_UNUSED(orderInfo);
|
2019-11-06 17:24:51 +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-10-18 11:55:48 +03:00
|
|
|
static BOOL window_order_supported(const rdpSettings* settings, UINT32 fieldFlags)
|
|
|
|
{
|
2018-10-19 12:14:09 +03:00
|
|
|
const UINT32 mask = (WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE | WINDOW_ORDER_FIELD_RP_CONTENT |
|
2018-10-18 11:55:48 +03:00
|
|
|
WINDOW_ORDER_FIELD_ROOT_PARENT);
|
2018-10-18 18:23:06 +03:00
|
|
|
BOOL dresult;
|
2018-10-18 11:55:48 +03:00
|
|
|
|
|
|
|
if (!settings)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* See [MS-RDPERP] 2.2.1.1.2 Window List Capability Set */
|
2018-10-18 18:23:06 +03:00
|
|
|
dresult = settings->AllowUnanouncedOrdersFromServer;
|
|
|
|
|
2018-10-18 11:55:48 +03:00
|
|
|
switch (settings->RemoteWndSupportLevel)
|
|
|
|
{
|
|
|
|
case WINDOW_LEVEL_SUPPORTED_EX:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case WINDOW_LEVEL_SUPPORTED:
|
2018-10-18 18:23:06 +03:00
|
|
|
return ((fieldFlags & mask) == 0) || dresult;
|
2018-10-18 11:55:48 +03:00
|
|
|
|
|
|
|
case WINDOW_LEVEL_NOT_SUPPORTED:
|
2018-10-18 18:23:06 +03:00
|
|
|
return dresult;
|
2018-10-18 11:55:48 +03:00
|
|
|
|
|
|
|
default:
|
2018-10-18 18:23:06 +03:00
|
|
|
return dresult;
|
2018-10-18 11:55:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#define DUMP_APPEND(buffer, size, ...) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
char* b = (buffer); \
|
|
|
|
size_t s = (size); \
|
|
|
|
size_t pos = strnlen(b, s); \
|
2019-05-24 10:19:33 +03:00
|
|
|
_snprintf(&b[pos], s - pos, __VA_ARGS__); \
|
2019-11-06 17:24:51 +03:00
|
|
|
} while (0)
|
2019-05-23 13:15:26 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static void dump_window_state_order(wLog* log, const char* msg, const WINDOW_ORDER_INFO* order,
|
|
|
|
const WINDOW_STATE_ORDER* state)
|
2019-05-23 13:15:26 +03:00
|
|
|
{
|
2019-05-24 10:19:33 +03:00
|
|
|
char buffer[3000] = { 0 };
|
|
|
|
const size_t bufferSize = sizeof(buffer) - 1;
|
2019-05-23 13:15:26 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
_snprintf(buffer, bufferSize, "%s windowId=0x%" PRIu32 "", msg, order->windowId);
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_OWNER)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " owner=0x%" PRIx32 "", state->ownerWindowId);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_STYLE)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " [ex]style=<0x%" PRIx32 ", 0x%" PRIx32 "", state->style,
|
|
|
|
state->extendedStyle);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (state->style & WS_POPUP)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " popup");
|
2019-05-23 13:15:26 +03:00
|
|
|
if (state->style & WS_VISIBLE)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " visible");
|
2019-05-23 13:15:26 +03:00
|
|
|
if (state->style & WS_THICKFRAME)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " thickframe");
|
2019-05-23 13:15:26 +03:00
|
|
|
if (state->style & WS_BORDER)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " border");
|
2019-05-23 13:15:26 +03:00
|
|
|
if (state->style & WS_CAPTION)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " caption");
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (state->extendedStyle & WS_EX_NOACTIVATE)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " noactivate");
|
2019-05-23 13:15:26 +03:00
|
|
|
if (state->extendedStyle & WS_EX_TOOLWINDOW)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " toolWindow");
|
2019-05-23 13:15:26 +03:00
|
|
|
if (state->extendedStyle & WS_EX_TOPMOST)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " topMost");
|
2019-05-23 13:15:26 +03:00
|
|
|
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, ">");
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
const char* showStr;
|
|
|
|
switch (state->showState)
|
2019-05-23 13:15:26 +03:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
case 0:
|
|
|
|
showStr = "hidden";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
showStr = "minimized";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
showStr = "maximized";
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
showStr = "current";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
showStr = "<unknown>";
|
|
|
|
break;
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " show=%s", showStr);
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " title");
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
2019-11-13 10:28:14 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " clientOffset=(%" PRId32 ",%" PRId32 ")",
|
|
|
|
state->clientOffsetX, state->clientOffsetY);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " clientAreaWidth=%" PRIu32 " clientAreaHeight=%" PRIu32 "",
|
|
|
|
state->clientAreaWidth, state->clientAreaHeight);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_X)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize,
|
|
|
|
" resizeMarginLeft=%" PRIu32 " resizeMarginRight=%" PRIu32 "",
|
|
|
|
state->resizeMarginLeft, state->resizeMarginRight);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_Y)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize,
|
|
|
|
" resizeMarginTop=%" PRIu32 " resizeMarginBottom=%" PRIu32 "",
|
|
|
|
state->resizeMarginTop, state->resizeMarginBottom);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " rpContent=0x%" PRIx32 "", state->RPContent);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " rootParent=0x%" PRIx32 "", state->rootParentHandle);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)
|
2019-11-13 10:28:14 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " windowOffset=(%" PRId32 ",%" PRId32 ")",
|
|
|
|
state->windowOffsetX, state->windowOffsetY);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
2019-11-13 10:28:14 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " windowClientDelta=(%" PRId32 ",%" PRId32 ")",
|
|
|
|
state->windowClientDeltaX, state->windowClientDeltaY);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " windowWidth=%" PRIu32 " windowHeight=%" PRIu32 "",
|
|
|
|
state->windowWidth, state->windowHeight);
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
|
|
|
{
|
|
|
|
UINT32 i;
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " windowRects=(");
|
2019-11-06 17:24:51 +03:00
|
|
|
for (i = 0; i < state->numWindowRects; i++)
|
2019-05-23 13:15:26 +03:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, "(%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ")",
|
|
|
|
state->windowRects[i].left, state->windowRects[i].top,
|
|
|
|
state->windowRects[i].right, state->windowRects[i].bottom);
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, ")");
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
2019-11-13 10:28:14 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " visibleOffset=(%" PRId32 ",%" PRId32 ")",
|
|
|
|
state->visibleOffsetX, state->visibleOffsetY);
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
|
|
|
{
|
|
|
|
UINT32 i;
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " visibilityRects=(");
|
2019-11-06 17:24:51 +03:00
|
|
|
for (i = 0; i < state->numVisibilityRects; i++)
|
2019-05-23 13:15:26 +03:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, "(%" PRIu16 ",%" PRIu16 ",%" PRIu16 ",%" PRIu16 ")",
|
|
|
|
state->visibilityRects[i].left, state->visibilityRects[i].top,
|
|
|
|
state->visibilityRects[i].right, state->visibilityRects[i].bottom);
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, ")");
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_OVERLAY_DESCRIPTION)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " overlayDescr");
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_ICON_OVERLAY_NULL)
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " iconOverlayNull");
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_TASKBAR_BUTTON)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " taskBarButton=0x%" PRIx8 "", state->TaskbarButton);
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_ENFORCE_SERVER_ZORDER)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " enforceServerZOrder=0x%" PRIx8 "",
|
|
|
|
state->EnforceServerZOrder);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_STATE)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " appBarState=0x%" PRIx8 "", state->AppBarState);
|
2019-05-23 13:15:26 +03:00
|
|
|
if (order->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_EDGE)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
const char* appBarEdgeStr;
|
2019-05-23 13:15:26 +03:00
|
|
|
switch (state->AppBarEdge)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
case 0:
|
|
|
|
appBarEdgeStr = "left";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
appBarEdgeStr = "top";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
appBarEdgeStr = "right";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
appBarEdgeStr = "bottom";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
appBarEdgeStr = "<unknown>";
|
|
|
|
break;
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " appBarEdge=%s", appBarEdgeStr);
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WLog_Print(log, WLOG_DEBUG, buffer);
|
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s,
|
2019-11-06 17:24:51 +03:00
|
|
|
WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
rdp_update_internal* up = update_cast(update);
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpWindowUpdate* window = update->window;
|
2022-01-11 18:01:33 +03:00
|
|
|
|
2016-03-03 18:21:12 +03:00
|
|
|
BOOL result = TRUE;
|
2011-11-22 06:07:03 +04:00
|
|
|
|
2022-01-11 18:01:33 +03:00
|
|
|
WINPR_ASSERT(s);
|
|
|
|
WINPR_ASSERT(context);
|
|
|
|
WINPR_ASSERT(window);
|
|
|
|
WINPR_ASSERT(orderInfo);
|
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
WINDOW_ICON_ORDER window_icon = { 0 };
|
|
|
|
result = update_read_window_icon_order(s, orderInfo, &window_icon);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (result)
|
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_DEBUG, "WindowIcon windowId=0x%" PRIx32 "",
|
2019-11-06 17:24:51 +03:00
|
|
|
orderInfo->windowId);
|
2019-05-08 16:36:20 +03:00
|
|
|
IFCALLRET(window->WindowIcon, result, context, orderInfo, &window_icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
update_free_window_icon_info(window_icon.iconInfo);
|
2019-05-09 14:23:25 +03:00
|
|
|
free(window_icon.iconInfo);
|
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
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
WINDOW_CACHED_ICON_ORDER window_cached_icon = { 0 };
|
|
|
|
result = update_read_window_cached_icon_order(s, orderInfo, &window_cached_icon);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (result)
|
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_DEBUG, "WindowCachedIcon windowId=0x%" PRIx32 "",
|
2019-11-06 17:24:51 +03:00
|
|
|
orderInfo->windowId);
|
2019-05-08 16:36:20 +03:00
|
|
|
IFCALLRET(window->WindowCachedIcon, result, context, orderInfo, &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);
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_DEBUG, "WindowDelete windowId=0x%" PRIx32 "", orderInfo->windowId);
|
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
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
WINDOW_STATE_ORDER windowState = { 0 };
|
|
|
|
result = update_read_window_state_order(s, orderInfo, &windowState);
|
2011-08-16 07:37:43 +04:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (result)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
|
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
dump_window_state_order(up->log, "WindowCreate", orderInfo, &windowState);
|
2019-05-08 16:36:20 +03:00
|
|
|
IFCALLRET(window->WindowCreate, result, context, orderInfo, &windowState);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
dump_window_state_order(up->log, "WindowUpdate", orderInfo, &windowState);
|
2019-05-08 16:36:20 +03:00
|
|
|
IFCALLRET(window->WindowUpdate, result, context, orderInfo, &windowState);
|
|
|
|
}
|
|
|
|
|
|
|
|
update_free_window_state(&windowState);
|
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
|
|
|
}
|
|
|
|
|
2019-05-09 14:23:25 +03:00
|
|
|
static void update_notify_icon_state_order_free(NOTIFY_ICON_STATE_ORDER* notify)
|
|
|
|
{
|
|
|
|
free(notify->toolTip.string);
|
|
|
|
free(notify->infoTip.text.string);
|
|
|
|
free(notify->infoTip.title.string);
|
|
|
|
update_free_window_icon_info(¬ify->icon);
|
|
|
|
memset(notify, 0, sizeof(NOTIFY_ICON_STATE_ORDER));
|
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo,
|
2019-11-06 17:24:51 +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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
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)
|
|
|
|
{
|
2019-11-06 17:24:51 +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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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)
|
|
|
|
{
|
2019-11-06 17:24:51 +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,
|
2019-11-06 17:24:51 +03:00
|
|
|
WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
rdp_update_internal* up = update_cast(update);
|
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
|
|
|
|
2022-01-11 18:01:33 +03:00
|
|
|
WINPR_ASSERT(s);
|
|
|
|
WINPR_ASSERT(orderInfo);
|
|
|
|
WINPR_ASSERT(context);
|
|
|
|
WINPR_ASSERT(window);
|
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */
|
2013-05-09 00:09:16 +04:00
|
|
|
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);
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->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
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
NOTIFY_ICON_STATE_ORDER notify_icon_state = { 0 };
|
2019-05-09 14:23:25 +03:00
|
|
|
result = update_read_notification_icon_state_order(s, orderInfo, ¬ify_icon_state);
|
2019-05-08 16:36:20 +03:00
|
|
|
|
2019-05-09 14:23:25 +03:00
|
|
|
if (!result)
|
|
|
|
goto fail;
|
2011-08-16 07:37:43 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_DEBUG, "NotifyIconCreate");
|
2019-05-08 16:36:20 +03:00
|
|
|
IFCALLRET(window->NotifyIconCreate, result, context, orderInfo, ¬ify_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
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_DEBUG, "NotifyIconUpdate");
|
2019-05-08 16:36:20 +03:00
|
|
|
IFCALLRET(window->NotifyIconUpdate, result, context, orderInfo, ¬ify_icon_state);
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
2019-11-06 17:24:51 +03:00
|
|
|
fail:
|
|
|
|
update_notify_icon_state_order_free(¬ify_icon_state);
|
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,
|
2019-11-06 17:24:51 +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)
|
|
|
|
{
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, 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
|
|
|
|
2023-01-24 16:53:36 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, monitored_desktop->numWindowIds, 4ull))
|
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 */
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static void dump_monitored_desktop(wLog* log, const char* msg, const WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
const MONITORED_DESKTOP_ORDER* monitored)
|
2019-05-23 13:15:26 +03:00
|
|
|
{
|
2019-05-24 10:19:33 +03:00
|
|
|
char buffer[1000] = { 0 };
|
|
|
|
const size_t bufferSize = sizeof(buffer) - 1;
|
2019-05-23 13:15:26 +03:00
|
|
|
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, "%s", msg);
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND)
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " activeWindowId=0x%" PRIx32 "", monitored->activeWindowId);
|
2019-05-23 13:15:26 +03:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
|
|
|
|
{
|
|
|
|
UINT32 i;
|
|
|
|
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, " windows=(");
|
2019-05-23 13:15:26 +03:00
|
|
|
for (i = 0; i < monitored->numWindowIds; i++)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, "0x%" PRIx32 ",", monitored->windowIds[i]);
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
2019-05-24 10:19:33 +03:00
|
|
|
DUMP_APPEND(buffer, bufferSize, ")");
|
2019-05-23 13:15:26 +03:00
|
|
|
}
|
|
|
|
WLog_Print(log, WLOG_DEBUG, buffer);
|
|
|
|
}
|
|
|
|
|
2018-11-14 13:06:23 +03:00
|
|
|
static BOOL update_recv_desktop_info_order(rdpUpdate* update, wStream* s,
|
2019-11-06 17:24:51 +03:00
|
|
|
WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
rdp_update_internal* up = update_cast(update);
|
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
|
|
|
|
2022-01-11 18:01:33 +03:00
|
|
|
WINPR_ASSERT(s);
|
|
|
|
WINPR_ASSERT(orderInfo);
|
|
|
|
WINPR_ASSERT(context);
|
|
|
|
WINPR_ASSERT(window);
|
|
|
|
|
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);
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_DEBUG, "NonMonitoredDesktop, windowId=0x%" PRIx32 "",
|
2019-11-06 17:24:51 +03:00
|
|
|
orderInfo->windowId);
|
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
|
|
|
{
|
2019-05-08 16:36:20 +03:00
|
|
|
MONITORED_DESKTOP_ORDER monitored_desktop = { 0 };
|
|
|
|
result = update_read_desktop_actively_monitored_order(s, orderInfo, &monitored_desktop);
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
dump_monitored_desktop(up->log, "ActivelyMonitoredDesktop", orderInfo,
|
2019-11-06 17:24:51 +03:00
|
|
|
&monitored_desktop);
|
2019-05-08 16:36:20 +03:00
|
|
|
IFCALLRET(window->MonitoredDesktop, result, context, orderInfo, &monitored_desktop);
|
|
|
|
}
|
2018-10-15 14:56:19 +03:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
free(monitored_desktop.windowIds);
|
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
|
|
|
}
|
|
|
|
|
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;
|
2019-05-08 16:36:20 +03:00
|
|
|
size_t remaining;
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 orderSize;
|
2019-05-08 16:36:20 +03:00
|
|
|
WINDOW_ORDER_INFO orderInfo = { 0 };
|
2022-01-11 18:01:33 +03:00
|
|
|
rdp_update_internal* up = update_cast(update);
|
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
remaining = Stream_GetRemainingLength(s);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!Stream_CheckAndLogRequiredLength(TAG, s, 6))
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
Stream_Read_UINT16(s, orderSize); /* orderSize (2 bytes) */
|
2019-05-08 16:36:20 +03:00
|
|
|
Stream_Read_UINT32(s, orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */
|
|
|
|
|
|
|
|
if (remaining + 1 < orderSize)
|
|
|
|
{
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_ERROR, "Stream short orderSize");
|
2019-05-08 16:36:20 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-11-22 06:07:03 +04:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (!window_order_supported(update->context->settings, orderInfo.fieldFlags))
|
2019-07-04 10:58:08 +03:00
|
|
|
{
|
|
|
|
WLog_INFO(TAG, "Window order %08" PRIx32 " not supported!", orderInfo.fieldFlags);
|
2018-10-18 11:55:48 +03:00
|
|
|
return FALSE;
|
2019-07-04 10:58:08 +03:00
|
|
|
}
|
2018-10-18 11:55:48 +03:00
|
|
|
|
2019-05-08 16:36:20 +03:00
|
|
|
if (orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW)
|
|
|
|
rc = update_recv_window_info_order(update, s, &orderInfo);
|
|
|
|
else if (orderInfo.fieldFlags & WINDOW_ORDER_TYPE_NOTIFY)
|
|
|
|
rc = update_recv_notification_icon_info_order(update, s, &orderInfo);
|
|
|
|
else if (orderInfo.fieldFlags & WINDOW_ORDER_TYPE_DESKTOP)
|
|
|
|
rc = update_recv_desktop_info_order(update, s, &orderInfo);
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2018-10-15 14:56:19 +03:00
|
|
|
if (!rc)
|
2022-01-11 18:01:33 +03:00
|
|
|
WLog_Print(up->log, WLOG_ERROR, "windoworder flags %08" PRIx32 " failed",
|
2019-05-08 16:36:20 +03:00
|
|
|
orderInfo.fieldFlags);
|
2018-10-15 14:56:19 +03:00
|
|
|
|
|
|
|
return rc;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|