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>
|
|
|
|
|
2011-08-10 10:24:06 +04:00
|
|
|
#include <freerdp/utils/rail.h>
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
#include "window.h"
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_icon_info(wStream* s, ICON_INFO* icon_info)
|
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-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
|
|
|
Stream_Read_UINT8(s, icon_info->cacheId); /* cacheId (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, icon_info->bpp); /* bpp (1 byte) */
|
|
|
|
Stream_Read_UINT16(s, icon_info->width); /* width (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, icon_info->height); /* height (2 bytes) */
|
2011-08-15 03:20:53 +04:00
|
|
|
|
|
|
|
/* cbColorTable is only present when bpp is 1, 2 or 4 */
|
2013-10-10 21:00:04 +04:00
|
|
|
if (icon_info->bpp == 1 || icon_info->bpp == 2 || icon_info->bpp == 4)
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
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_UINT16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-15 03:20:53 +04:00
|
|
|
icon_info->cbColorTable = 0;
|
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-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, icon_info->cbBitsMask); /* cbBitsMask (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, icon_info->cbBitsColor); /* cbBitsColor (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-10-10 21:00:04 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < icon_info->cbBitsMask + icon_info->cbBitsColor)
|
2013-01-12 17:49:01 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
/* bitsMask */
|
|
|
|
if (icon_info->bitsMask == NULL)
|
2012-10-09 11:01:37 +04:00
|
|
|
icon_info->bitsMask = (BYTE*) malloc(icon_info->cbBitsMask);
|
2011-08-09 10:32:50 +04:00
|
|
|
else
|
2012-10-09 11:01:37 +04:00
|
|
|
icon_info->bitsMask = (BYTE*) realloc(icon_info->bitsMask, icon_info->cbBitsMask);
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, icon_info->bitsMask, icon_info->cbBitsMask);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
/* colorTable */
|
|
|
|
if (icon_info->colorTable == NULL)
|
2013-08-30 16:19:50 +04:00
|
|
|
{
|
|
|
|
if (icon_info->cbColorTable)
|
|
|
|
icon_info->colorTable = (BYTE*) malloc(icon_info->cbColorTable);
|
|
|
|
}
|
|
|
|
else if (icon_info->cbColorTable)
|
2013-10-10 21:00:04 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
icon_info->colorTable = (BYTE*) realloc(icon_info->colorTable, icon_info->cbColorTable);
|
2013-10-10 21:00:04 +04:00
|
|
|
}
|
2013-08-30 16:19:50 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
free(icon_info->colorTable);
|
|
|
|
icon_info->colorTable = NULL;
|
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-08-30 18:31:40 +04:00
|
|
|
if (icon_info->colorTable)
|
|
|
|
Stream_Read(s, icon_info->colorTable, icon_info->cbColorTable);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
/* bitsColor */
|
|
|
|
if (icon_info->bitsColor == NULL)
|
2012-10-09 11:01:37 +04:00
|
|
|
icon_info->bitsColor = (BYTE*) malloc(icon_info->cbBitsColor);
|
2011-08-09 10:32:50 +04:00
|
|
|
else
|
2012-10-09 11:01:37 +04:00
|
|
|
icon_info->bitsColor = (BYTE*) realloc(icon_info->bitsColor, icon_info->cbBitsColor);
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, icon_info->bitsColor, icon_info->cbBitsColor);
|
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
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_cached_icon_info(wStream* s, CACHED_ICON_INFO* cached_icon_info)
|
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-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
|
|
|
Stream_Read_UINT8(s, cached_icon_info->cacheId); /* cacheId (1 byte) */
|
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
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_notify_icon_infotip(wStream* s, NOTIFY_ICON_INFOTIP* notify_icon_infotip)
|
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-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, notify_icon_infotip->timeout); /* timeout (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, notify_icon_infotip->flags); /* infoFlags (4 bytes) */
|
2013-10-10 21:00:04 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
return rail_read_unicode_string(s, ¬ify_icon_infotip->text) && /* infoTipText */
|
|
|
|
rail_read_unicode_string(s, ¬ify_icon_infotip->title); /* title */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
size = sizeof(RECTANGLE_16) * windowState->numWindowRects;
|
|
|
|
windowState->windowRects = (RECTANGLE_16*) malloc(size);
|
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
|
|
|
|
2013-10-16 06:42:07 +04:00
|
|
|
size = sizeof(RECTANGLE_16) * windowState->numVisibilityRects;
|
|
|
|
windowState->visibilityRects = (RECTANGLE_16*) malloc(size);
|
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
|
|
|
}
|
|
|
|
}
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
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
|
|
|
{
|
2012-11-22 04:22:41 +04:00
|
|
|
window_icon->iconInfo = (ICON_INFO*) malloc(sizeof(ICON_INFO));
|
|
|
|
ZeroMemory(window_icon->iconInfo, sizeof(ICON_INFO));
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_window_cached_icon_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
return update_read_cached_icon_info(s, &window_cached_icon->cachedIcon); /* cachedIcon (CACHED_ICON_INFO) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void update_read_window_delete_order(wStream* s, WINDOW_ORDER_INFO* orderInfo)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
|
|
|
/* window deletion event */
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
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;
|
|
|
|
|
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;
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "WindowIcon");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->WindowIcon, 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;
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "WindowCachedIcon");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->WindowCachedIcon, 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");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->WindowDelete, 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");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->WindowCreate, 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");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->WindowUpdate, 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
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, 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;
|
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)
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
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 */
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_notification_icon_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;
|
|
|
|
|
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");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->NotifyIconDelete, 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");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->NotifyIconCreate, 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");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->NotifyIconUpdate, 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
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, 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)
|
|
|
|
{
|
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;
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
size = sizeof(UINT32) * monitored_desktop->numWindowIds;
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (monitored_desktop->windowIds == NULL)
|
2012-10-09 11:26:39 +04:00
|
|
|
monitored_desktop->windowIds = (UINT32*) malloc(size);
|
2011-08-09 10:32:50 +04:00
|
|
|
else
|
2012-10-09 11:26:39 +04:00
|
|
|
monitored_desktop->windowIds = (UINT32*) realloc(monitored_desktop->windowIds, size);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
/* windowIds */
|
2011-12-04 02:24:18 +04:00
|
|
|
for (i = 0; i < (int) monitored_desktop->numWindowIds; i++)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
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 */
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
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;
|
|
|
|
|
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");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->NonMonitoredDesktop, 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;
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "ActivelyMonitoredDesktop");
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->MonitoredDesktop, context, orderInfo, &window->monitored_desktop);
|
2011-08-09 11:01:40 +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
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
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)
|
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_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)
|
2013-01-12 17:49:01 +04:00
|
|
|
return 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)
|
2013-01-12 17:49:01 +04:00
|
|
|
return 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)
|
2013-01-12 17:49:01 +04:00
|
|
|
return update_recv_desktop_info_order(update, s, &window->orderInfo);
|
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
|
|
|
}
|
|
|
|
|