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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
|
|
|
stream_read_BYTE(s, icon_info->cacheId); /* cacheId (1 byte) */
|
|
|
|
stream_read_BYTE(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-01-12 17:49:01 +04:00
|
|
|
if (icon_info->bpp == 1 || icon_info->bpp == 2 || icon_info->bpp == 4) {
|
|
|
|
if(stream_get_left(s) < 2)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */
|
2013-01-12 17:49:01 +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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < icon_info->cbBitsMask + icon_info->cbBitsColor)
|
|
|
|
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);
|
2011-08-09 10:32:50 +04:00
|
|
|
stream_read(s, icon_info->bitsMask, icon_info->cbBitsMask);
|
|
|
|
|
|
|
|
/* colorTable */
|
|
|
|
if (icon_info->colorTable == NULL)
|
2012-10-09 11:01:37 +04:00
|
|
|
icon_info->colorTable = (BYTE*) malloc(icon_info->cbColorTable);
|
2011-08-09 10:32:50 +04:00
|
|
|
else
|
2012-10-09 11:01:37 +04:00
|
|
|
icon_info->colorTable = (BYTE*) realloc(icon_info->colorTable, icon_info->cbColorTable);
|
2011-08-09 10:32:50 +04:00
|
|
|
stream_read(s, icon_info->colorTable, icon_info->cbColorTable);
|
|
|
|
|
|
|
|
/* 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);
|
2011-08-09 10:32:50 +04:00
|
|
|
stream_read(s, icon_info->bitsColor, icon_info->cbBitsColor);
|
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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 3)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
|
|
|
stream_read_BYTE(s, cached_icon_info->cacheId); /* cacheId (1 byte) */
|
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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +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-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-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int size;
|
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER) {
|
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->style); /* style (4 bytes) */
|
|
|
|
stream_read_UINT32(s, window_state->extendedStyle); /* extendedStyle (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW) {
|
|
|
|
if(stream_get_left(s) < 1)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_BYTE(s, window_state->showState); /* showState (1 byte) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) {
|
|
|
|
if(!rail_read_unicode_string(s, &window_state->titleInfo)) /* titleInfo */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->clientOffsetX); /* clientOffsetX (4 bytes) */
|
|
|
|
stream_read_UINT32(s, window_state->clientOffsetY); /* clientOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->clientAreaWidth); /* clientAreaWidth (4 bytes) */
|
|
|
|
stream_read_UINT32(s, window_state->clientAreaHeight); /* clientAreaHeight (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT) {
|
|
|
|
if(stream_get_left(s) < 1)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_BYTE(s, window_state->RPContent); /* RPContent (1 byte) */
|
2013-01-12 17:49:01 +04:00
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT) {
|
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->windowOffsetX); /* windowOffsetX (4 bytes) */
|
|
|
|
stream_read_UINT32(s, window_state->windowOffsetY); /* windowOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */
|
|
|
|
stream_read_UINT32(s, window_state->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->windowWidth); /* windowWidth (4 bytes) */
|
|
|
|
stream_read_UINT32(s, window_state->windowHeight); /* windowHeight (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 2)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
size = sizeof(RECTANGLE_16) * window_state->numWindowRects;
|
2012-10-09 07:21:26 +04:00
|
|
|
window_state->windowRects = (RECTANGLE_16*) malloc(size);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8 * window_state->numWindowRects)
|
|
|
|
return FALSE;
|
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
/* windowRects */
|
2011-12-04 02:24:18 +04:00
|
|
|
for (i = 0; i < (int) window_state->numWindowRects; i++)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, window_state->windowRects[i].left); /* left (2 bytes) */
|
|
|
|
stream_read_UINT16(s, window_state->windowRects[i].top); /* top (2 bytes) */
|
|
|
|
stream_read_UINT16(s, window_state->windowRects[i].right); /* right (2 bytes) */
|
|
|
|
stream_read_UINT16(s, window_state->windowRects[i].bottom); /* bottom (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, window_state->visibleOffsetX); /* visibleOffsetX (4 bytes) */
|
|
|
|
stream_read_UINT32(s, window_state->visibleOffsetY); /* visibleOffsetY (4 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
|
|
|
{
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 2)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
|
|
|
size = sizeof(RECTANGLE_16) * window_state->numVisibilityRects;
|
2012-10-09 07:21:26 +04:00
|
|
|
window_state->visibilityRects = (RECTANGLE_16*) malloc(size);
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < window_state->numVisibilityRects * 8)
|
|
|
|
return FALSE;
|
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
/* visibilityRects */
|
2011-12-04 02:24:18 +04:00
|
|
|
for (i = 0; i < (int) window_state->numVisibilityRects; i++)
|
2011-08-09 10:32:50 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, window_state->visibilityRects[i].left); /* left (2 bytes) */
|
|
|
|
stream_read_UINT16(s, window_state->visibilityRects[i].top); /* top (2 bytes) */
|
|
|
|
stream_read_UINT16(s, window_state->visibilityRects[i].right); /* right (2 bytes) */
|
|
|
|
stream_read_UINT16(s, window_state->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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +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
|
|
|
{
|
2011-08-15 03:20:53 +04:00
|
|
|
DEBUG_WND("Window Icon Order");
|
2013-01-12 17:49:01 +04:00
|
|
|
if(!update_read_window_icon_order(s, orderInfo, &window->window_icon))
|
|
|
|
return FALSE;
|
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
|
|
|
{
|
2011-08-15 03:20:53 +04:00
|
|
|
DEBUG_WND("Window Cached Icon Order");
|
2013-01-12 17:49:01 +04:00
|
|
|
if(!update_read_window_cached_icon_order(s, orderInfo, &window->window_cached_icon))
|
|
|
|
return FALSE;
|
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-15 03:20:53 +04:00
|
|
|
DEBUG_WND("Window Deleted Order");
|
2011-08-18 06:31:27 +04:00
|
|
|
update_read_window_delete_order(s, orderInfo);
|
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
|
|
|
{
|
2011-08-15 03:20:53 +04:00
|
|
|
DEBUG_WND("Window State Order");
|
2013-01-12 17:49:01 +04:00
|
|
|
if(!update_read_window_state_order(s, orderInfo, &window->window_state))
|
|
|
|
return FALSE;
|
2011-08-16 07:37:43 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->WindowCreate, context, orderInfo, &window->window_state);
|
2011-08-16 07:37:43 +04:00
|
|
|
else
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->WindowUpdate, context, orderInfo, &window->window_state);
|
2011-08-09 11:01:40 +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-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION) {
|
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +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-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP) {
|
|
|
|
if(!rail_read_unicode_string(s, ¬ify_icon_state->toolTip)) /* toolTip (UNICODE_STRING) */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +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) */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_STATE) {
|
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +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-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_ICON) {
|
|
|
|
if(!update_read_icon_info(s, ¬ify_icon_state->icon)) /* icon (ICON_INFO) */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON) {
|
|
|
|
if(!update_read_cached_icon_info(s, ¬ify_icon_state->cachedIcon)) /* cachedIcon (CACHED_ICON_INFO) */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 8)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +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-16 07:37:43 +04:00
|
|
|
DEBUG_WND("Delete Notification Icon Deleted Order");
|
2011-08-18 06:31:27 +04:00
|
|
|
update_read_notification_icon_delete_order(s, orderInfo);
|
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
|
|
|
{
|
2011-08-15 03:20:53 +04:00
|
|
|
DEBUG_WND("Notification Icon State Order");
|
2013-01-12 17:49:01 +04:00
|
|
|
if(!update_read_notification_icon_state_order(s, orderInfo, &window->notify_icon_state))
|
|
|
|
return FALSE;
|
2011-08-16 07:37:43 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->NotifyIconCreate, context, orderInfo, &window->notify_icon_state);
|
2011-08-16 07:37:43 +04:00
|
|
|
else
|
2011-11-22 06:07:03 +04:00
|
|
|
IFCALL(window->NotifyIconUpdate, context, orderInfo, &window->notify_icon_state);
|
2011-08-09 11:01:40 +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-01-12 17:49:01 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND) {
|
|
|
|
if(stream_get_left(s) < 4)
|
|
|
|
return FALSE;
|
2012-10-09 11:26:39 +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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 1)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_BYTE(s, monitored_desktop->numWindowIds); /* numWindowIds (1 byte) */
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2013-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 4 * monitored_desktop->numWindowIds)
|
|
|
|
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
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
stream_read_UINT32(s, monitored_desktop->windowIds[i]);
|
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
|
|
|
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-15 03:20:53 +04:00
|
|
|
DEBUG_WND("Non-Monitored Desktop Order");
|
2011-08-09 10:32:50 +04:00
|
|
|
update_read_desktop_non_monitored_order(s, orderInfo);
|
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
|
|
|
{
|
2011-08-15 03:20:53 +04:00
|
|
|
DEBUG_WND("Actively Monitored Desktop Order");
|
2013-01-12 17:49:01 +04:00
|
|
|
if(!update_read_desktop_actively_monitored_order(s, orderInfo, &window->monitored_desktop))
|
|
|
|
return FALSE;
|
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-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-01-12 17:49:01 +04:00
|
|
|
if(stream_get_left(s) < 6)
|
|
|
|
return FALSE;
|
2012-10-09 11:01:37 +04:00
|
|
|
stream_read_UINT16(s, orderSize); /* orderSize (2 bytes) */
|
2012-10-09 11:26:39 +04:00
|
|
|
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);
|
|
|
|
return TRUE;
|
2011-08-09 10:32:50 +04:00
|
|
|
}
|
|
|
|
|