2011-07-25 09:45:25 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-25 09:45:25 +04:00
|
|
|
* Update Data PDUs
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@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>
|
2013-05-07 06:27:19 +04:00
|
|
|
#include <winpr/print.h>
|
2013-01-09 02:18:10 +04:00
|
|
|
#include <winpr/thread.h>
|
2013-01-25 04:08:30 +04:00
|
|
|
#include <winpr/collections.h>
|
2012-11-22 04:22:41 +04:00
|
|
|
|
2011-07-25 09:45:25 +04:00
|
|
|
#include "update.h"
|
2011-08-24 19:31:58 +04:00
|
|
|
#include "surface.h"
|
2013-01-25 05:05:03 +04:00
|
|
|
#include "message.h"
|
2012-09-24 12:59:18 +04:00
|
|
|
|
2012-10-08 09:32:41 +04:00
|
|
|
#include <freerdp/peer.h>
|
2011-10-03 04:28:20 +04:00
|
|
|
#include <freerdp/codec/bitmap.h>
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-12-01 02:40:36 +04:00
|
|
|
/*
|
|
|
|
static const char* const UPDATE_TYPE_STRINGS[] =
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
|
|
|
"Orders",
|
|
|
|
"Bitmap",
|
|
|
|
"Palette",
|
|
|
|
"Synchronize"
|
|
|
|
};
|
2011-12-01 02:40:36 +04:00
|
|
|
*/
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-05-07 23:33:52 +04:00
|
|
|
extern const BYTE PRIMARY_DRAWING_ORDER_FIELD_BYTES[];
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_orders(rdpUpdate* update, wStream* s)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 numberOrders;
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 6)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* pad2OctetsB (2 bytes) */
|
2011-07-25 22:50:26 +04:00
|
|
|
|
|
|
|
while (numberOrders > 0)
|
|
|
|
{
|
2012-02-11 17:30:09 +04:00
|
|
|
if (!update_recv_order(update, s))
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2011-07-25 22:50:26 +04:00
|
|
|
numberOrders--;
|
|
|
|
}
|
2012-02-11 17:30:09 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_bitmap_data(wStream* s, BITMAP_DATA* bitmap_data)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 18)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, bitmap_data->destLeft);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->destTop);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->destRight);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->destBottom);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->width);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->height);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->bitsPerPixel);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->flags);
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->bitmapLength);
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-07-25 22:50:26 +04:00
|
|
|
if (bitmap_data->flags & BITMAP_COMPRESSION)
|
|
|
|
{
|
2011-12-20 05:31:37 +04:00
|
|
|
if (!(bitmap_data->flags & NO_BITMAP_COMPRESSION_HDR))
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, bitmap_data->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->cbScanWidth); /* cbScanWidth (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, bitmap_data->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
|
2011-12-20 05:31:37 +04:00
|
|
|
bitmap_data->bitmapLength = bitmap_data->cbCompMainBodySize;
|
|
|
|
}
|
2011-07-25 22:50:26 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
bitmap_data->compressed = TRUE;
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_GetPointer(s, bitmap_data->bitmapDataStream);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, bitmap_data->bitmapLength);
|
2011-08-04 11:39:10 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < bitmap_data->bitmapLength)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2012-10-09 10:31:28 +04:00
|
|
|
bitmap_data->compressed = FALSE;
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_GetPointer(s, bitmap_data->bitmapDataStream);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, bitmap_data->bitmapLength);
|
2011-08-04 11:39:10 +04:00
|
|
|
}
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_bitmap(rdpUpdate* update, wStream* s, BITMAP_UPDATE* bitmap_update)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2011-07-27 02:32:14 +04:00
|
|
|
int i;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, bitmap_update->number); /* numberRectangles (2 bytes) */
|
2011-07-27 02:32:14 +04:00
|
|
|
|
2011-10-03 07:09:13 +04:00
|
|
|
if (bitmap_update->number > bitmap_update->count)
|
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 count;
|
2011-10-03 07:09:13 +04:00
|
|
|
|
|
|
|
count = bitmap_update->number * 2;
|
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
bitmap_update->rectangles = (BITMAP_DATA*) realloc(bitmap_update->rectangles,
|
2011-10-21 01:28:59 +04:00
|
|
|
sizeof(BITMAP_DATA) * count);
|
2011-10-03 07:09:13 +04:00
|
|
|
|
2011-10-21 05:34:55 +04:00
|
|
|
memset(&bitmap_update->rectangles[bitmap_update->count], 0,
|
2011-10-21 01:28:59 +04:00
|
|
|
sizeof(BITMAP_DATA) * (count - bitmap_update->count));
|
2011-10-03 07:09:13 +04:00
|
|
|
|
|
|
|
bitmap_update->count = count;
|
|
|
|
}
|
2011-07-25 09:45:25 +04:00
|
|
|
|
|
|
|
/* rectangles */
|
2011-12-04 02:24:18 +04:00
|
|
|
for (i = 0; i < (int) bitmap_update->number; i++)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_bitmap_data(s, &bitmap_update->rectangles[i]))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_palette(rdpUpdate* update, wStream* s, PALETTE_UPDATE* palette_update)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2011-07-27 02:32:14 +04:00
|
|
|
int i;
|
2011-10-21 20:17:04 +04:00
|
|
|
PALETTE_ENTRY* entry;
|
2011-07-27 02:32:14 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 6)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* pad2Octets (2 bytes) */
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */
|
2011-07-27 02:32:14 +04:00
|
|
|
|
|
|
|
if (palette_update->number > 256)
|
|
|
|
palette_update->number = 256;
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < palette_update->number * 3)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-07-25 09:45:25 +04:00
|
|
|
/* paletteEntries */
|
2011-08-17 05:08:14 +04:00
|
|
|
for (i = 0; i < (int) palette_update->number; i++)
|
2011-07-27 02:32:14 +04:00
|
|
|
{
|
2011-10-21 20:17:04 +04:00
|
|
|
entry = &palette_update->entries[i];
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, entry->blue);
|
|
|
|
Stream_Read_UINT8(s, entry->green);
|
|
|
|
Stream_Read_UINT8(s, entry->red);
|
2011-07-27 02:32:14 +04:00
|
|
|
}
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void update_read_synchronize(rdpUpdate* update, wStream* s)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* pad2Octets (2 bytes) */
|
2011-07-25 09:45:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The Synchronize Update is an artifact from the
|
|
|
|
* T.128 protocol and should be ignored.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_play_sound(wStream* s, PLAY_SOUND_UPDATE* play_sound)
|
2011-08-24 10:54:46 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, play_sound->duration); /* duration (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, play_sound->frequency); /* frequency (4 bytes) */
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-08-24 10:54:46 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_play_sound(rdpUpdate* update, wStream* s)
|
2011-08-24 10:54:46 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_play_sound(s, &update->play_sound))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->PlaySound, update->context, &update->play_sound);
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-08-24 10:54:46 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_pointer_position(wStream* s, POINTER_POSITION_UPDATE* pointer_position)
|
2011-08-24 10:38:39 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, pointer_position->xPos); /* xPos (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, pointer_position->yPos); /* yPos (2 bytes) */
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_pointer_system(wStream* s, POINTER_SYSTEM_UPDATE* pointer_system)
|
2011-08-24 10:38:39 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
|
2011-08-24 10:38:39 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 14)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, pointer_color->xPos); /* xPos (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, pointer_color->yPos); /* yPos (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, pointer_color->width); /* width (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, pointer_color->height); /* height (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */
|
2011-08-24 10:38:39 +04:00
|
|
|
|
2012-03-18 23:34:08 +04:00
|
|
|
/**
|
|
|
|
* There does not seem to be any documentation on why
|
|
|
|
* xPos / yPos can be larger than width / height
|
|
|
|
* so it is missing in documentation or a bug in implementation
|
|
|
|
* 2.2.9.1.1.4.4 Color Pointer Update (TS_COLORPOINTERATTRIBUTE)
|
|
|
|
*/
|
|
|
|
if (pointer_color->xPos >= pointer_color->width)
|
|
|
|
pointer_color->xPos = 0;
|
|
|
|
if (pointer_color->yPos >= pointer_color->height)
|
|
|
|
pointer_color->yPos = 0;
|
|
|
|
|
2011-08-24 10:38:39 +04:00
|
|
|
if (pointer_color->lengthXorMask > 0)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < pointer_color->lengthXorMask)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
|
|
|
if (!pointer_color->xorMaskData)
|
|
|
|
pointer_color->xorMaskData = malloc(pointer_color->lengthXorMask);
|
|
|
|
else
|
|
|
|
pointer_color->xorMaskData = realloc(pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pointer_color->lengthAndMask > 0)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < pointer_color->lengthAndMask)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
|
|
|
if (!pointer_color->andMaskData)
|
|
|
|
pointer_color->andMaskData = malloc(pointer_color->lengthAndMask);
|
|
|
|
else
|
|
|
|
pointer_color->andMaskData = realloc(pointer_color->andMaskData, pointer_color->lengthAndMask);
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) > 0)
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s); /* pad (1 byte) */
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_pointer_new(wStream* s, POINTER_NEW_UPDATE* pointer_new)
|
2011-08-24 10:38:39 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-14 02:37:50 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
|
2013-01-12 03:46:04 +04:00
|
|
|
return update_read_pointer_color(s, &pointer_new->colorPtrAttr); /* colorPtrAttr */
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_pointer_cached(wStream* s, POINTER_CACHED_UPDATE* pointer_cached)
|
2011-08-24 10:38:39 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_pointer(rdpUpdate* update, wStream* s)
|
2011-08-24 10:38:39 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 messageType;
|
2011-11-22 02:48:03 +04:00
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpPointerUpdate* pointer = update->pointer;
|
2011-08-24 10:38:39 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2 + 2)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, messageType); /* messageType (2 bytes) */
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* pad2Octets (2 bytes) */
|
2011-08-24 10:38:39 +04:00
|
|
|
|
|
|
|
switch (messageType)
|
|
|
|
{
|
|
|
|
case PTR_MSG_TYPE_POSITION:
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_pointer_position(s, &pointer->pointer_position))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2011-11-22 02:48:03 +04:00
|
|
|
IFCALL(pointer->PointerPosition, context, &pointer->pointer_position);
|
2011-08-24 10:38:39 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PTR_MSG_TYPE_SYSTEM:
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_pointer_system(s, &pointer->pointer_system))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2011-11-22 02:48:03 +04:00
|
|
|
IFCALL(pointer->PointerSystem, context, &pointer->pointer_system);
|
2011-08-24 10:38:39 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PTR_MSG_TYPE_COLOR:
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_pointer_color(s, &pointer->pointer_color))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2011-11-22 02:48:03 +04:00
|
|
|
IFCALL(pointer->PointerColor, context, &pointer->pointer_color);
|
2011-08-24 10:38:39 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PTR_MSG_TYPE_POINTER:
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_pointer_new(s, &pointer->pointer_new))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2011-11-22 02:48:03 +04:00
|
|
|
IFCALL(pointer->PointerNew, context, &pointer->pointer_new);
|
2011-08-24 10:38:39 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PTR_MSG_TYPE_CACHED:
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_pointer_cached(s, &pointer->pointer_cached))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2011-11-22 02:48:03 +04:00
|
|
|
IFCALL(pointer->PointerCached, context, &pointer->pointer_cached);
|
2011-08-24 10:38:39 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-01-12 03:46:04 +04:00
|
|
|
return TRUE;
|
2011-08-24 10:38:39 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv(rdpUpdate* update, wStream* s)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 updateType;
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpContext* context = update->context;
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-03-29 02:06:34 +04:00
|
|
|
//fprintf(stderr, "%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->BeginPaint, context);
|
2011-07-28 21:46:36 +04:00
|
|
|
|
2011-07-25 09:45:25 +04:00
|
|
|
switch (updateType)
|
|
|
|
{
|
|
|
|
case UPDATE_TYPE_ORDERS:
|
2012-02-11 17:30:09 +04:00
|
|
|
if (!update_recv_orders(update, s))
|
|
|
|
{
|
|
|
|
/* XXX: Do we have to call EndPaint? */
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2012-02-11 17:30:09 +04:00
|
|
|
}
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UPDATE_TYPE_BITMAP:
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_bitmap(update, s, &update->bitmap_update))
|
|
|
|
return FALSE;
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->BitmapUpdate, context, &update->bitmap_update);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UPDATE_TYPE_PALETTE:
|
2013-01-14 02:37:50 +04:00
|
|
|
if (!update_read_palette(update, s, &update->palette_update))
|
2013-01-12 03:46:04 +04:00
|
|
|
return FALSE;
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->Palette, context, &update->palette_update);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UPDATE_TYPE_SYNCHRONIZE:
|
2011-07-28 08:38:25 +04:00
|
|
|
update_read_synchronize(update, s);
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->Synchronize, context);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
}
|
2011-07-28 21:46:36 +04:00
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->EndPaint, context);
|
2011-08-07 17:27:52 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
|
|
|
|
2011-08-08 05:12:36 +04:00
|
|
|
void update_reset_state(rdpUpdate* update)
|
|
|
|
{
|
2011-11-22 03:11:43 +04:00
|
|
|
rdpPrimaryUpdate* primary = update->primary;
|
2011-11-22 04:53:38 +04:00
|
|
|
rdpAltSecUpdate* altsec = update->altsec;
|
2011-11-22 03:11:43 +04:00
|
|
|
|
2013-01-24 23:09:44 +04:00
|
|
|
ZeroMemory(&primary->order_info, sizeof(ORDER_INFO));
|
|
|
|
ZeroMemory(&primary->dstblt, sizeof(DSTBLT_ORDER));
|
|
|
|
ZeroMemory(&primary->patblt, sizeof(PATBLT_ORDER));
|
|
|
|
ZeroMemory(&primary->scrblt, sizeof(SCRBLT_ORDER));
|
|
|
|
ZeroMemory(&primary->opaque_rect, sizeof(OPAQUE_RECT_ORDER));
|
|
|
|
ZeroMemory(&primary->draw_nine_grid, sizeof(DRAW_NINE_GRID_ORDER));
|
|
|
|
ZeroMemory(&primary->multi_dstblt, sizeof(MULTI_DSTBLT_ORDER));
|
|
|
|
ZeroMemory(&primary->multi_patblt, sizeof(MULTI_PATBLT_ORDER));
|
|
|
|
ZeroMemory(&primary->multi_scrblt, sizeof(MULTI_SCRBLT_ORDER));
|
|
|
|
ZeroMemory(&primary->multi_opaque_rect, sizeof(MULTI_OPAQUE_RECT_ORDER));
|
|
|
|
ZeroMemory(&primary->multi_draw_nine_grid, sizeof(MULTI_DRAW_NINE_GRID_ORDER));
|
|
|
|
ZeroMemory(&primary->line_to, sizeof(LINE_TO_ORDER));
|
|
|
|
ZeroMemory(&primary->polyline, sizeof(POLYLINE_ORDER));
|
|
|
|
ZeroMemory(&primary->memblt, sizeof(MEMBLT_ORDER));
|
|
|
|
ZeroMemory(&primary->mem3blt, sizeof(MEM3BLT_ORDER));
|
|
|
|
ZeroMemory(&primary->save_bitmap, sizeof(SAVE_BITMAP_ORDER));
|
|
|
|
ZeroMemory(&primary->glyph_index, sizeof(GLYPH_INDEX_ORDER));
|
|
|
|
ZeroMemory(&primary->fast_index, sizeof(FAST_INDEX_ORDER));
|
|
|
|
ZeroMemory(&primary->fast_glyph, sizeof(FAST_GLYPH_ORDER));
|
|
|
|
ZeroMemory(&primary->polygon_sc, sizeof(POLYGON_SC_ORDER));
|
|
|
|
ZeroMemory(&primary->polygon_cb, sizeof(POLYGON_CB_ORDER));
|
|
|
|
ZeroMemory(&primary->ellipse_sc, sizeof(ELLIPSE_SC_ORDER));
|
|
|
|
ZeroMemory(&primary->ellipse_cb, sizeof(ELLIPSE_CB_ORDER));
|
2011-11-22 03:11:43 +04:00
|
|
|
|
|
|
|
primary->order_info.orderType = ORDER_TYPE_PATBLT;
|
2013-01-25 07:38:13 +04:00
|
|
|
|
|
|
|
if (!update->initialState)
|
|
|
|
{
|
|
|
|
altsec->switch_surface.bitmapId = SCREEN_BITMAP_SURFACE;
|
|
|
|
IFCALL(altsec->SwitchSurface, update->context, &(altsec->switch_surface));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void update_post_connect(rdpUpdate* update)
|
|
|
|
{
|
2013-01-28 03:22:46 +04:00
|
|
|
update->asynchronous = update->context->settings->AsyncUpdate;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
if (update->asynchronous)
|
2013-02-04 20:05:24 +04:00
|
|
|
update->proxy = update_message_proxy_new(update);
|
2013-01-25 07:38:13 +04:00
|
|
|
|
|
|
|
update->altsec->switch_surface.bitmapId = SCREEN_BITMAP_SURFACE;
|
|
|
|
IFCALL(update->altsec->SwitchSurface, update->context, &(update->altsec->switch_surface));
|
|
|
|
|
|
|
|
update->initialState = FALSE;
|
2011-08-08 05:12:36 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
static void update_begin_paint(rdpContext* context)
|
2011-08-23 16:37:08 +04:00
|
|
|
{
|
2013-05-10 00:30:28 +04:00
|
|
|
wStream* s;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
if (update->us)
|
|
|
|
update->EndPaint(context);
|
2011-09-21 01:01:38 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
s = fastpath_update_pdu_init_new(context->rdp->fastpath);
|
|
|
|
Stream_SealLength(s);
|
|
|
|
Stream_Seek(s, 2); /* numberOrders (2 bytes) */
|
|
|
|
|
|
|
|
update->combineUpdates = TRUE;
|
|
|
|
update->numberOrders = 0;
|
|
|
|
update->us = s;
|
2011-08-23 16:37:08 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
static void update_end_paint(rdpContext* context)
|
2011-08-23 16:37:08 +04:00
|
|
|
{
|
2013-05-10 00:30:28 +04:00
|
|
|
wStream* s;
|
|
|
|
int headerLength;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
if (!update->us)
|
|
|
|
return;
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
headerLength = Stream_Length(s);
|
|
|
|
Stream_SealLength(s);
|
2011-11-11 23:02:59 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_SetPosition(s, headerLength);
|
|
|
|
Stream_Write_UINT16(s, update->numberOrders); /* numberOrders (2 bytes) */
|
|
|
|
Stream_SetPosition(s, Stream_Length(s));
|
|
|
|
|
|
|
|
if (update->numberOrders > 0)
|
|
|
|
{
|
|
|
|
fastpath_send_update_pdu(context->rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
update->combineUpdates = FALSE;
|
|
|
|
update->numberOrders = 0;
|
|
|
|
update->us = NULL;
|
|
|
|
|
|
|
|
Stream_Free(s, TRUE);
|
2011-11-11 23:02:59 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 00:49:19 +04:00
|
|
|
static void update_flush(rdpContext* context)
|
|
|
|
{
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
if (update->numberOrders > 0)
|
|
|
|
{
|
|
|
|
update->EndPaint(context);
|
|
|
|
update->BeginPaint(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-10 03:41:32 +04:00
|
|
|
static void update_set_bounds(rdpContext* context, rdpBounds* bounds)
|
|
|
|
{
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
CopyMemory(&update->previousBounds, &update->currentBounds, sizeof(rdpBounds));
|
|
|
|
|
|
|
|
if (!bounds)
|
|
|
|
ZeroMemory(&update->currentBounds, sizeof(rdpBounds));
|
|
|
|
else
|
|
|
|
CopyMemory(&update->currentBounds, bounds, sizeof(rdpBounds));
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL update_bounds_is_null(rdpBounds* bounds)
|
|
|
|
{
|
|
|
|
if ((bounds->left == 0) && (bounds->top == 0) &&
|
|
|
|
(bounds->right == 0) && (bounds->bottom == 0))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL update_bounds_equals(rdpBounds* bounds1, rdpBounds* bounds2)
|
|
|
|
{
|
|
|
|
if ((bounds1->left == bounds2->left) && (bounds1->top == bounds2->top) &&
|
|
|
|
(bounds1->right == bounds2->right) && (bounds1->bottom == bounds2->bottom))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int update_prepare_bounds(rdpContext* context, ORDER_INFO* orderInfo)
|
|
|
|
{
|
|
|
|
int length = 0;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
orderInfo->boundsFlags = 0;
|
|
|
|
|
|
|
|
if (update_bounds_is_null(&update->currentBounds))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
orderInfo->controlFlags |= ORDER_BOUNDS;
|
|
|
|
|
|
|
|
if (update_bounds_equals(&update->previousBounds, &update->currentBounds))
|
|
|
|
{
|
|
|
|
orderInfo->controlFlags |= ORDER_ZERO_BOUNDS_DELTAS;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
length += 1;
|
|
|
|
|
|
|
|
if (update->previousBounds.left != update->currentBounds.left)
|
|
|
|
{
|
|
|
|
orderInfo->bounds.left = update->currentBounds.left;
|
|
|
|
orderInfo->boundsFlags |= BOUND_LEFT;
|
|
|
|
length += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (update->previousBounds.top != update->currentBounds.top)
|
|
|
|
{
|
|
|
|
orderInfo->bounds.top = update->currentBounds.top;
|
|
|
|
orderInfo->boundsFlags |= BOUND_TOP;
|
|
|
|
length += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (update->previousBounds.right != update->currentBounds.right)
|
|
|
|
{
|
|
|
|
orderInfo->bounds.right = update->currentBounds.right;
|
|
|
|
orderInfo->boundsFlags |= BOUND_RIGHT;
|
|
|
|
length += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (update->previousBounds.bottom != update->currentBounds.bottom)
|
|
|
|
{
|
|
|
|
orderInfo->bounds.bottom = update->currentBounds.bottom;
|
|
|
|
orderInfo->boundsFlags |= BOUND_BOTTOM;
|
|
|
|
length += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
|
|
|
int update_prepare_order_info(rdpContext* context, ORDER_INFO* orderInfo, UINT32 orderType)
|
|
|
|
{
|
|
|
|
int length = 1;
|
|
|
|
|
|
|
|
orderInfo->fieldFlags = 0;
|
|
|
|
orderInfo->orderType = orderType;
|
|
|
|
|
|
|
|
orderInfo->controlFlags = ORDER_STANDARD;
|
|
|
|
|
|
|
|
orderInfo->controlFlags |= ORDER_TYPE_CHANGE;
|
|
|
|
length += 1;
|
|
|
|
|
|
|
|
length += PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType];
|
|
|
|
|
|
|
|
length += update_prepare_bounds(context, orderInfo);
|
|
|
|
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
|
|
|
int update_write_order_info(rdpContext* context, wStream* s, ORDER_INFO* orderInfo, int offset)
|
|
|
|
{
|
|
|
|
int position;
|
|
|
|
|
|
|
|
position = Stream_GetPosition(s);
|
|
|
|
Stream_SetPosition(s, offset);
|
|
|
|
|
|
|
|
Stream_Write_UINT8(s, orderInfo->controlFlags); /* controlFlags (1 byte) */
|
|
|
|
|
|
|
|
if (orderInfo->controlFlags & ORDER_TYPE_CHANGE)
|
|
|
|
Stream_Write_UINT8(s, orderInfo->orderType); /* orderType (1 byte) */
|
|
|
|
|
|
|
|
update_write_field_flags(s, orderInfo->fieldFlags, orderInfo->controlFlags,
|
|
|
|
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType]);
|
|
|
|
|
|
|
|
update_write_bounds(s, orderInfo);
|
|
|
|
|
|
|
|
Stream_SetPosition(s, position);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void update_write_refresh_rect(wStream* s, BYTE count, RECTANGLE_16* areas)
|
2011-11-11 23:02:59 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, count); /* numberOfAreas (1 byte) */
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, 3); /* pad3Octets (3 bytes) */
|
2011-11-11 23:02:59 +04:00
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
2012-09-24 12:59:18 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, areas[i].left); /* left (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, areas[i].top); /* top (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, areas[i].right); /* right (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, areas[i].bottom); /* bottom (2 bytes) */
|
2012-09-24 12:59:18 +04:00
|
|
|
}
|
2011-11-11 23:02:59 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
static void update_send_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
|
2011-11-11 23:02:59 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
2011-11-11 23:02:59 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (rdp->settings->RefreshRect)
|
2012-05-28 16:20:42 +04:00
|
|
|
{
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
update_write_refresh_rect(s, count, areas);
|
2011-11-11 23:02:59 +04:00
|
|
|
|
2012-05-28 16:20:42 +04:00
|
|
|
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_REFRESH_RECT, rdp->mcs->user_id);
|
|
|
|
}
|
2011-11-11 23:02:59 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void update_write_suppress_output(wStream* s, BYTE allow, RECTANGLE_16* area)
|
2011-11-11 23:02:59 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, allow); /* allowDisplayUpdates (1 byte) */
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, 3); /* pad3Octets (3 bytes) */
|
2011-11-11 23:02:59 +04:00
|
|
|
|
|
|
|
if (allow > 0)
|
2012-09-24 12:59:18 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, area->left); /* left (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, area->top); /* top (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, area->right); /* right (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, area->bottom); /* bottom (2 bytes) */
|
2012-09-24 12:59:18 +04:00
|
|
|
}
|
2011-11-11 23:02:59 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
static void update_send_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
|
2011-11-11 23:02:59 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
2011-11-11 23:02:59 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (rdp->settings->SuppressOutput)
|
2012-05-28 16:20:42 +04:00
|
|
|
{
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
update_write_suppress_output(s, allow, area);
|
2011-11-11 23:02:59 +04:00
|
|
|
|
2012-05-28 16:20:42 +04:00
|
|
|
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SUPPRESS_OUTPUT, rdp->mcs->user_id);
|
|
|
|
}
|
2011-08-23 16:37:08 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void update_send_surface_command(rdpContext* context, wStream* s)
|
2011-08-27 05:44:37 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* update;
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
2011-12-03 10:42:13 +04:00
|
|
|
|
|
|
|
update = fastpath_update_pdu_init(rdp->fastpath);
|
2013-05-02 02:15:55 +04:00
|
|
|
Stream_EnsureRemainingCapacity(update, Stream_GetPosition(s));
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Write(update, Stream_Buffer(s), Stream_GetPosition(s));
|
2011-12-03 10:42:13 +04:00
|
|
|
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, update);
|
2011-08-27 05:44:37 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
static void update_send_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_command)
|
2011-08-23 19:28:28 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
2011-12-03 10:42:13 +04:00
|
|
|
|
|
|
|
s = fastpath_update_pdu_init(rdp->fastpath);
|
2013-05-02 02:15:55 +04:00
|
|
|
Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) surface_bits_command->bitmapDataLength);
|
2011-12-03 10:42:13 +04:00
|
|
|
update_write_surfcmd_surface_bits_header(s, surface_bits_command);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write(s, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
|
2011-12-03 10:42:13 +04:00
|
|
|
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s);
|
2011-08-23 19:28:28 +04:00
|
|
|
}
|
|
|
|
|
2011-12-16 03:26:32 +04:00
|
|
|
static void update_send_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker)
|
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-12-16 03:26:32 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
|
|
|
|
|
|
|
s = fastpath_update_pdu_init(rdp->fastpath);
|
|
|
|
update_write_surfcmd_frame_marker(s, surface_frame_marker->frameAction, surface_frame_marker->frameId);
|
|
|
|
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s);
|
|
|
|
}
|
|
|
|
|
2013-01-17 08:58:01 +04:00
|
|
|
static void update_send_frame_acknowledge(rdpContext* context, UINT32 frameId)
|
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2013-01-17 08:58:01 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
|
|
|
|
2013-01-19 12:45:24 +04:00
|
|
|
if (rdp->settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE])
|
|
|
|
{
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, frameId);
|
2013-01-19 12:45:24 +04:00
|
|
|
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id);
|
|
|
|
}
|
2013-01-17 08:58:01 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
static void update_send_synchronize(rdpContext* context)
|
2011-08-25 13:03:53 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
2011-08-25 13:03:53 +04:00
|
|
|
|
|
|
|
s = fastpath_update_pdu_init(rdp->fastpath);
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Zero(s, 2); /* pad2Octets (2 bytes) */
|
2011-12-03 10:42:13 +04:00
|
|
|
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SYNCHRONIZE, s);
|
2011-08-25 13:03:53 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
static void update_send_desktop_resize(rdpContext* context)
|
2011-09-06 13:19:16 +04:00
|
|
|
{
|
2012-10-08 09:32:41 +04:00
|
|
|
if (context->peer)
|
2012-10-09 22:03:41 +04:00
|
|
|
context->peer->activated = FALSE;
|
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
rdp_server_reactivate(context->rdp);
|
2011-09-06 13:19:16 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static void update_send_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
int offset;
|
|
|
|
int headerLength;
|
|
|
|
ORDER_INFO orderInfo;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_DSTBLT);
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
offset = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_dstblt_order(s, &orderInfo, dstblt);
|
|
|
|
update_write_order_info(context, s, &orderInfo, offset);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
}
|
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
static void update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
|
|
|
{
|
|
|
|
wStream* s;
|
2013-05-10 03:41:32 +04:00
|
|
|
int offset;
|
2013-05-08 01:40:54 +04:00
|
|
|
int headerLength;
|
2013-05-07 20:45:52 +04:00
|
|
|
ORDER_INFO orderInfo;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-10 03:41:32 +04:00
|
|
|
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_PATBLT);
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
s = update->us;
|
2013-05-10 03:41:32 +04:00
|
|
|
offset = Stream_GetPosition(s);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
2013-05-08 01:40:54 +04:00
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
update_write_patblt_order(s, &orderInfo, patblt);
|
2013-05-10 03:41:32 +04:00
|
|
|
update_write_order_info(context, s, &orderInfo, offset);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
update->numberOrders++;
|
2013-05-07 20:45:52 +04:00
|
|
|
}
|
|
|
|
|
2011-11-24 20:47:40 +04:00
|
|
|
static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
|
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2013-05-10 03:41:32 +04:00
|
|
|
int offset;
|
2013-05-07 23:33:52 +04:00
|
|
|
int headerLength;
|
2013-05-07 20:45:52 +04:00
|
|
|
ORDER_INFO orderInfo;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2011-11-24 20:47:40 +04:00
|
|
|
|
2013-05-10 03:41:32 +04:00
|
|
|
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_SCRBLT);
|
2013-05-07 23:33:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
s = update->us;
|
2013-05-10 03:41:32 +04:00
|
|
|
offset = Stream_GetPosition(s);
|
2011-11-24 20:47:40 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
2013-05-07 23:33:52 +04:00
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
update_write_scrblt_order(s, &orderInfo, scrblt);
|
2013-05-10 03:41:32 +04:00
|
|
|
update_write_order_info(context, s, &orderInfo, offset);
|
2011-11-24 20:47:40 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
update->numberOrders++;
|
2011-11-24 20:47:40 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 06:27:19 +04:00
|
|
|
static void update_send_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
|
|
|
|
{
|
|
|
|
wStream* s;
|
2013-05-10 03:41:32 +04:00
|
|
|
int offset;
|
2013-05-07 23:33:52 +04:00
|
|
|
int headerLength;
|
2013-05-07 06:27:19 +04:00
|
|
|
ORDER_INFO orderInfo;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-10 03:41:32 +04:00
|
|
|
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_OPAQUE_RECT);
|
2013-05-07 23:33:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
s = update->us;
|
2013-05-10 03:41:32 +04:00
|
|
|
offset = Stream_GetPosition(s);
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
2013-05-07 23:33:52 +04:00
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 06:27:19 +04:00
|
|
|
update_write_opaque_rect_order(s, &orderInfo, opaque_rect);
|
2013-05-10 03:41:32 +04:00
|
|
|
update_write_order_info(context, s, &orderInfo, offset);
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
update->numberOrders++;
|
2013-05-07 06:27:19 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static void update_send_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
int offset;
|
|
|
|
int headerLength;
|
|
|
|
ORDER_INFO orderInfo;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_LINE_TO);
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
offset = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_line_to_order(s, &orderInfo, line_to);
|
|
|
|
update_write_order_info(context, s, &orderInfo, offset);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
}
|
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
static void update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
|
|
|
{
|
|
|
|
wStream* s;
|
2013-05-10 03:41:32 +04:00
|
|
|
int offset;
|
2013-05-07 23:33:52 +04:00
|
|
|
int headerLength;
|
2013-05-07 19:41:32 +04:00
|
|
|
ORDER_INFO orderInfo;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2013-05-07 19:41:32 +04:00
|
|
|
|
2013-05-10 03:41:32 +04:00
|
|
|
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_MEMBLT);
|
2013-05-07 23:33:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
s = update->us;
|
2013-05-10 03:41:32 +04:00
|
|
|
offset = Stream_GetPosition(s);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
2013-05-07 23:33:52 +04:00
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
update_write_memblt_order(s, &orderInfo, memblt);
|
2013-05-10 03:41:32 +04:00
|
|
|
update_write_order_info(context, s, &orderInfo, offset);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
update->numberOrders++;
|
2013-05-07 19:41:32 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
static void update_send_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index)
|
|
|
|
{
|
|
|
|
wStream* s;
|
2013-05-10 03:41:32 +04:00
|
|
|
int offset;
|
2013-05-07 23:33:52 +04:00
|
|
|
int headerLength;
|
2013-05-07 20:45:52 +04:00
|
|
|
ORDER_INFO orderInfo;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-10 03:41:32 +04:00
|
|
|
headerLength = update_prepare_order_info(context, &orderInfo, ORDER_TYPE_GLYPH_INDEX);
|
2013-05-07 23:33:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
s = update->us;
|
2013-05-10 03:41:32 +04:00
|
|
|
offset = Stream_GetPosition(s);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
2013-05-07 23:33:52 +04:00
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
update_write_glyph_index_order(s, &orderInfo, glyph_index);
|
2013-05-10 03:41:32 +04:00
|
|
|
update_write_order_info(context, s, &orderInfo, offset);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
update->numberOrders++;
|
2013-05-07 20:45:52 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static void update_send_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
int bm, em;
|
|
|
|
BYTE orderType;
|
|
|
|
int headerLength;
|
|
|
|
UINT16 extraFlags;
|
|
|
|
INT16 orderLength;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
extraFlags = 0;
|
|
|
|
headerLength = 6;
|
|
|
|
|
|
|
|
orderType = cache_bitmap->compressed ?
|
|
|
|
ORDER_TYPE_CACHE_BITMAP_COMPRESSED : ORDER_TYPE_BITMAP_UNCOMPRESSED;
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_cache_bitmap_order(s, cache_bitmap, cache_bitmap->compressed, &extraFlags);
|
|
|
|
em = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
orderLength = (em - bm) - 13;
|
|
|
|
|
|
|
|
Stream_SetPosition(s, bm);
|
|
|
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, orderType); /* orderType (1 byte) */
|
|
|
|
Stream_SetPosition(s, em);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* temporary workaround to avoid PDUs exceeding maximum size
|
|
|
|
*/
|
|
|
|
|
|
|
|
update->EndPaint(context);
|
|
|
|
update->BeginPaint(context);
|
|
|
|
}
|
|
|
|
|
2013-05-07 07:21:12 +04:00
|
|
|
static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
|
|
|
|
{
|
|
|
|
wStream* s;
|
2013-05-10 00:30:28 +04:00
|
|
|
int bm, em;
|
2013-05-10 05:04:41 +04:00
|
|
|
BYTE orderType;
|
2013-05-10 00:30:28 +04:00
|
|
|
int headerLength;
|
2013-05-08 01:40:54 +04:00
|
|
|
UINT16 extraFlags;
|
|
|
|
INT16 orderLength;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-06-10 00:49:19 +04:00
|
|
|
update_flush(context);
|
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
extraFlags = 0;
|
2013-05-10 00:30:28 +04:00
|
|
|
headerLength = 6;
|
|
|
|
|
2013-05-10 05:04:41 +04:00
|
|
|
orderType = cache_bitmap_v2->compressed ?
|
|
|
|
ORDER_TYPE_BITMAP_COMPRESSED_V2 : ORDER_TYPE_BITMAP_UNCOMPRESSED_V2;
|
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
update_write_cache_bitmap_v2_order(s, cache_bitmap_v2, cache_bitmap_v2->compressed, &extraFlags);
|
2013-05-10 00:30:28 +04:00
|
|
|
em = Stream_GetPosition(s);
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-06-10 00:49:19 +04:00
|
|
|
printf("update_send_cache_bitmap_v2: orderLength: %d numberOrders: %d\n", orderLength, update->numberOrders);
|
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
orderLength = (em - bm) - 13;
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_SetPosition(s, bm);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
2013-05-10 05:04:41 +04:00
|
|
|
Stream_Write_UINT8(s, orderType); /* orderType (1 byte) */
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_SetPosition(s, em);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* temporary workaround to avoid PDUs exceeding maximum size
|
|
|
|
*/
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-06-10 00:49:19 +04:00
|
|
|
update_flush(context);
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static void update_send_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
int bm, em;
|
|
|
|
BYTE orderType;
|
|
|
|
int headerLength;
|
|
|
|
UINT16 extraFlags;
|
|
|
|
INT16 orderLength;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
extraFlags = 0;
|
|
|
|
headerLength = 6;
|
|
|
|
orderType = ORDER_TYPE_BITMAP_COMPRESSED_V3;
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_cache_bitmap_v3_order(s, cache_bitmap_v3, &extraFlags);
|
|
|
|
em = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
orderLength = (em - bm) - 13;
|
|
|
|
|
|
|
|
Stream_SetPosition(s, bm);
|
|
|
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, orderType); /* orderType (1 byte) */
|
|
|
|
Stream_SetPosition(s, em);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* temporary workaround to avoid PDUs exceeding maximum size
|
|
|
|
*/
|
|
|
|
|
|
|
|
update->EndPaint(context);
|
|
|
|
update->BeginPaint(context);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void update_send_cache_color_table(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cache_color_table)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
UINT16 flags;
|
|
|
|
int bm, em;
|
|
|
|
int headerLength;
|
|
|
|
INT16 orderLength;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
headerLength = 6;
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_cache_color_table_order(s, cache_color_table, &flags);
|
|
|
|
em = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
orderLength = (em - bm) - 13;
|
|
|
|
|
|
|
|
Stream_SetPosition(s, bm);
|
|
|
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_COLOR_TABLE); /* orderType (1 byte) */
|
|
|
|
Stream_SetPosition(s, em);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
}
|
|
|
|
|
2013-05-08 02:44:22 +04:00
|
|
|
static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
UINT16 flags;
|
2013-05-10 00:30:28 +04:00
|
|
|
int bm, em;
|
|
|
|
int headerLength;
|
2013-05-08 02:44:22 +04:00
|
|
|
INT16 orderLength;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2013-05-08 02:44:22 +04:00
|
|
|
|
|
|
|
flags = 0;
|
2013-05-10 00:30:28 +04:00
|
|
|
headerLength = 6;
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-08 02:44:22 +04:00
|
|
|
|
2013-05-08 06:35:33 +04:00
|
|
|
update_write_cache_glyph_order(s, cache_glyph, &flags);
|
2013-05-10 00:30:28 +04:00
|
|
|
em = Stream_GetPosition(s);
|
2013-05-08 02:44:22 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
orderLength = (em - bm) - 13;
|
2013-05-08 02:44:22 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_SetPosition(s, bm);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_SetPosition(s, em);
|
2013-05-08 02:44:22 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
update->numberOrders++;
|
2013-05-08 02:44:22 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
UINT16 flags;
|
2013-05-10 00:30:28 +04:00
|
|
|
int bm, em;
|
|
|
|
int headerLength;
|
2013-05-08 01:40:54 +04:00
|
|
|
INT16 orderLength;
|
2013-05-10 00:30:28 +04:00
|
|
|
rdpUpdate* update = context->update;
|
2013-05-07 19:41:32 +04:00
|
|
|
|
|
|
|
flags = 0;
|
2013-05-10 00:30:28 +04:00
|
|
|
headerLength = 6;
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
|
|
|
update_write_cache_glyph_v2_order(s, cache_glyph_v2, &flags);
|
2013-05-10 00:30:28 +04:00
|
|
|
em = Stream_GetPosition(s);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
orderLength = (em - bm) - 13;
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_SetPosition(s, bm);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
2013-05-10 00:30:28 +04:00
|
|
|
Stream_SetPosition(s, em);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
2013-05-10 00:30:28 +04:00
|
|
|
update->numberOrders++;
|
2013-05-07 19:41:32 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static void update_send_cache_brush(rdpContext* context, CACHE_BRUSH_ORDER* cache_brush)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
UINT16 flags;
|
|
|
|
int bm, em;
|
|
|
|
int headerLength;
|
|
|
|
INT16 orderLength;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
headerLength = 6;
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_cache_brush_order(s, cache_brush, &flags);
|
|
|
|
em = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
orderLength = (em - bm) - 13;
|
|
|
|
|
|
|
|
Stream_SetPosition(s, bm);
|
|
|
|
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_BRUSH); /* orderType (1 byte) */
|
|
|
|
Stream_SetPosition(s, em);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
}
|
|
|
|
|
2013-05-12 21:42:53 +04:00
|
|
|
static void update_send_create_offscreen_bitmap_order(rdpContext* context, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
int bm, em;
|
|
|
|
BYTE orderType;
|
|
|
|
BYTE controlFlags;
|
|
|
|
int headerLength;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
headerLength = 1;
|
|
|
|
orderType = ORDER_TYPE_CREATE_OFFSCREEN_BITMAP;
|
|
|
|
controlFlags = ORDER_SECONDARY | (orderType << 2);
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_create_offscreen_bitmap_order(s, create_offscreen_bitmap);
|
|
|
|
em = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_SetPosition(s, bm);
|
|
|
|
Stream_Write_UINT8(s, controlFlags); /* controlFlags (1 byte) */
|
|
|
|
Stream_SetPosition(s, em);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void update_send_switch_surface_order(rdpContext* context, SWITCH_SURFACE_ORDER* switch_surface)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
int bm, em;
|
|
|
|
BYTE orderType;
|
|
|
|
BYTE controlFlags;
|
|
|
|
int headerLength;
|
|
|
|
rdpUpdate* update = context->update;
|
|
|
|
|
|
|
|
headerLength = 1;
|
|
|
|
orderType = ORDER_TYPE_SWITCH_SURFACE;
|
|
|
|
controlFlags = ORDER_SECONDARY | (orderType << 2);
|
|
|
|
|
|
|
|
s = update->us;
|
|
|
|
bm = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_EnsureRemainingCapacity(s, headerLength);
|
|
|
|
Stream_Seek(s, headerLength);
|
|
|
|
|
|
|
|
update_write_switch_surface_order(s, switch_surface);
|
|
|
|
em = Stream_GetPosition(s);
|
|
|
|
|
|
|
|
Stream_SetPosition(s, bm);
|
|
|
|
Stream_Write_UINT8(s, controlFlags); /* controlFlags (1 byte) */
|
|
|
|
Stream_SetPosition(s, em);
|
|
|
|
|
|
|
|
update->numberOrders++;
|
|
|
|
}
|
|
|
|
|
2011-11-22 03:11:43 +04:00
|
|
|
static void update_send_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
|
2011-08-25 13:03:53 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE updateCode;
|
2011-11-22 03:11:43 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
2011-08-25 13:03:53 +04:00
|
|
|
|
|
|
|
s = fastpath_update_pdu_init(rdp->fastpath);
|
2012-09-17 05:05:51 +04:00
|
|
|
|
2011-08-25 13:03:53 +04:00
|
|
|
if (pointer_system->type == SYSPTR_NULL)
|
2011-12-03 10:42:13 +04:00
|
|
|
updateCode = FASTPATH_UPDATETYPE_PTR_NULL;
|
2011-08-25 13:03:53 +04:00
|
|
|
else
|
2011-12-03 10:42:13 +04:00
|
|
|
updateCode = FASTPATH_UPDATETYPE_PTR_DEFAULT;
|
2012-09-17 05:05:51 +04:00
|
|
|
|
2011-12-03 10:42:13 +04:00
|
|
|
fastpath_send_update_pdu(rdp->fastpath, updateCode, s);
|
2011-08-25 13:03:53 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void update_write_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
|
2011-12-03 04:54:02 +04:00
|
|
|
{
|
2013-05-02 02:15:55 +04:00
|
|
|
Stream_EnsureRemainingCapacity(s, 15 + (int) pointer_color->lengthAndMask + (int) pointer_color->lengthXorMask);
|
2012-09-17 05:05:51 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, pointer_color->cacheIndex);
|
|
|
|
Stream_Write_UINT16(s, pointer_color->xPos);
|
|
|
|
Stream_Write_UINT16(s, pointer_color->yPos);
|
|
|
|
Stream_Write_UINT16(s, pointer_color->width);
|
|
|
|
Stream_Write_UINT16(s, pointer_color->height);
|
|
|
|
Stream_Write_UINT16(s, pointer_color->lengthAndMask);
|
|
|
|
Stream_Write_UINT16(s, pointer_color->lengthXorMask);
|
2012-09-17 05:05:51 +04:00
|
|
|
|
2011-12-03 04:54:02 +04:00
|
|
|
if (pointer_color->lengthXorMask > 0)
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
2012-09-17 05:05:51 +04:00
|
|
|
|
2011-12-03 04:54:02 +04:00
|
|
|
if (pointer_color->lengthAndMask > 0)
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
|
2012-09-17 05:05:51 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, 0); /* pad (1 byte) */
|
2011-12-03 04:54:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void update_send_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
|
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-12-03 04:54:02 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
|
|
|
|
|
|
|
s = fastpath_update_pdu_init(rdp->fastpath);
|
|
|
|
update_write_pointer_color(s, pointer_color);
|
2011-12-03 10:42:13 +04:00
|
|
|
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_COLOR, s);
|
2011-12-03 04:54:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void update_send_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
|
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-12-03 04:54:02 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
|
|
|
|
|
|
|
s = fastpath_update_pdu_init(rdp->fastpath);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
|
2011-12-03 04:54:02 +04:00
|
|
|
update_write_pointer_color(s, &pointer_new->colorPtrAttr);
|
2011-12-03 10:42:13 +04:00
|
|
|
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_POINTER, s);
|
2011-12-03 04:54:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void update_send_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached)
|
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-12-03 04:54:02 +04:00
|
|
|
rdpRdp* rdp = context->rdp;
|
|
|
|
|
|
|
|
s = fastpath_update_pdu_init(rdp->fastpath);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
|
2011-12-03 10:42:13 +04:00
|
|
|
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_CACHED, s);
|
2011-12-03 04:54:02 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s)
|
2012-05-26 17:34:09 +04:00
|
|
|
{
|
2012-09-16 01:51:05 +04:00
|
|
|
int index;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE numberOfAreas;
|
2012-09-16 01:51:05 +04:00
|
|
|
RECTANGLE_16* areas;
|
2012-05-26 17:34:09 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2012-05-26 17:34:09 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, numberOfAreas);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, 3); /* pad3Octects */
|
2012-05-26 17:34:09 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < numberOfAreas * 4 * 2)
|
2013-01-14 02:37:50 +04:00
|
|
|
return FALSE;
|
2013-05-02 02:15:55 +04:00
|
|
|
|
2012-09-16 01:51:05 +04:00
|
|
|
areas = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * numberOfAreas);
|
|
|
|
|
|
|
|
for (index = 0; index < numberOfAreas; index++)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, areas[index].left);
|
|
|
|
Stream_Read_UINT16(s, areas[index].top);
|
|
|
|
Stream_Read_UINT16(s, areas[index].right);
|
|
|
|
Stream_Read_UINT16(s, areas[index].bottom);
|
2012-09-16 01:51:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
IFCALL(update->RefreshRect, update->context, numberOfAreas, areas);
|
|
|
|
|
|
|
|
free(areas);
|
2012-05-26 17:34:09 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2012-05-26 17:34:09 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_suppress_output(rdpUpdate* update, wStream* s)
|
2012-05-26 17:34:09 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE allowDisplayUpdates;
|
2012-05-26 17:34:09 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2012-05-26 17:34:09 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, allowDisplayUpdates);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, 3); /* pad3Octects */
|
2012-09-17 05:05:51 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (allowDisplayUpdates > 0 && Stream_GetRemainingLength(s) < 8)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2012-05-26 17:34:09 +04:00
|
|
|
|
|
|
|
IFCALL(update->SuppressOutput, update->context, allowDisplayUpdates,
|
2013-04-30 06:35:15 +04:00
|
|
|
allowDisplayUpdates > 0 ? (RECTANGLE_16*) Stream_Pointer(s) : NULL);
|
2012-05-26 17:34:09 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2012-05-26 17:34:09 +04:00
|
|
|
}
|
|
|
|
|
2011-08-23 16:37:08 +04:00
|
|
|
void update_register_server_callbacks(rdpUpdate* update)
|
|
|
|
{
|
|
|
|
update->BeginPaint = update_begin_paint;
|
|
|
|
update->EndPaint = update_end_paint;
|
2013-05-10 03:41:32 +04:00
|
|
|
update->SetBounds = update_set_bounds;
|
2011-08-25 13:03:53 +04:00
|
|
|
update->Synchronize = update_send_synchronize;
|
2011-09-06 13:19:16 +04:00
|
|
|
update->DesktopResize = update_send_desktop_resize;
|
2011-08-23 19:28:28 +04:00
|
|
|
update->SurfaceBits = update_send_surface_bits;
|
2011-12-16 03:26:32 +04:00
|
|
|
update->SurfaceFrameMarker = update_send_surface_frame_marker;
|
2011-08-27 05:44:37 +04:00
|
|
|
update->SurfaceCommand = update_send_surface_command;
|
2013-05-13 01:46:13 +04:00
|
|
|
update->primary->DstBlt = update_send_dstblt;
|
2013-05-07 20:45:52 +04:00
|
|
|
update->primary->PatBlt = update_send_patblt;
|
2011-11-24 20:47:40 +04:00
|
|
|
update->primary->ScrBlt = update_send_scrblt;
|
2013-05-07 06:27:19 +04:00
|
|
|
update->primary->OpaqueRect = update_send_opaque_rect;
|
2013-05-13 01:46:13 +04:00
|
|
|
update->primary->LineTo = update_send_line_to;
|
2013-05-07 19:41:32 +04:00
|
|
|
update->primary->MemBlt = update_send_memblt;
|
2013-05-07 20:45:52 +04:00
|
|
|
update->primary->GlyphIndex = update_send_glyph_index;
|
2013-05-13 01:46:13 +04:00
|
|
|
update->secondary->CacheBitmap = update_send_cache_bitmap;
|
2013-05-07 07:21:12 +04:00
|
|
|
update->secondary->CacheBitmapV2 = update_send_cache_bitmap_v2;
|
2013-05-13 01:46:13 +04:00
|
|
|
update->secondary->CacheBitmapV3 = update_send_cache_bitmap_v3;
|
|
|
|
update->secondary->CacheColorTable = update_send_cache_color_table;
|
2013-05-08 02:44:22 +04:00
|
|
|
update->secondary->CacheGlyph = update_send_cache_glyph;
|
2013-05-07 19:41:32 +04:00
|
|
|
update->secondary->CacheGlyphV2 = update_send_cache_glyph_v2;
|
2013-05-13 01:46:13 +04:00
|
|
|
update->secondary->CacheBrush = update_send_cache_brush;
|
2013-05-12 21:42:53 +04:00
|
|
|
update->altsec->CreateOffscreenBitmap = update_send_create_offscreen_bitmap_order;
|
|
|
|
update->altsec->SwitchSurface = update_send_switch_surface_order;
|
2011-11-22 02:48:03 +04:00
|
|
|
update->pointer->PointerSystem = update_send_pointer_system;
|
2011-12-03 04:54:02 +04:00
|
|
|
update->pointer->PointerColor = update_send_pointer_color;
|
|
|
|
update->pointer->PointerNew = update_send_pointer_new;
|
|
|
|
update->pointer->PointerCached = update_send_pointer_cached;
|
2011-08-23 16:37:08 +04:00
|
|
|
}
|
|
|
|
|
2012-05-26 17:34:09 +04:00
|
|
|
void update_register_client_callbacks(rdpUpdate* update)
|
|
|
|
{
|
|
|
|
update->RefreshRect = update_send_refresh_rect;
|
|
|
|
update->SuppressOutput = update_send_suppress_output;
|
2013-01-17 08:58:01 +04:00
|
|
|
update->SurfaceFrameAcknowledge = update_send_frame_acknowledge;
|
2012-05-26 17:34:09 +04:00
|
|
|
}
|
|
|
|
|
2013-01-25 21:08:00 +04:00
|
|
|
int update_process_messages(rdpUpdate* update)
|
|
|
|
{
|
2013-02-04 23:56:54 +04:00
|
|
|
return update_message_queue_process_pending_messages(update);
|
2013-01-25 21:08:00 +04:00
|
|
|
}
|
|
|
|
|
2011-07-28 08:38:25 +04:00
|
|
|
rdpUpdate* update_new(rdpRdp* rdp)
|
2011-07-27 02:32:14 +04:00
|
|
|
{
|
|
|
|
rdpUpdate* update;
|
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
update = (rdpUpdate*) malloc(sizeof(rdpUpdate));
|
2011-07-27 02:32:14 +04:00
|
|
|
|
2013-05-07 06:27:19 +04:00
|
|
|
if (update)
|
2011-07-27 02:32:14 +04:00
|
|
|
{
|
2012-01-01 00:36:04 +04:00
|
|
|
OFFSCREEN_DELETE_LIST* deleteList;
|
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
ZeroMemory(update, sizeof(rdpUpdate));
|
|
|
|
|
2011-10-03 07:09:13 +04:00
|
|
|
update->bitmap_update.count = 64;
|
2012-11-22 04:22:41 +04:00
|
|
|
update->bitmap_update.rectangles = (BITMAP_DATA*) malloc(sizeof(BITMAP_DATA) * update->bitmap_update.count);
|
|
|
|
ZeroMemory(update->bitmap_update.rectangles, sizeof(BITMAP_DATA) * update->bitmap_update.count);
|
|
|
|
|
|
|
|
update->pointer = (rdpPointerUpdate*) malloc(sizeof(rdpPointerUpdate));
|
|
|
|
ZeroMemory(update->pointer, sizeof(rdpPointerUpdate));
|
|
|
|
|
|
|
|
update->primary = (rdpPrimaryUpdate*) malloc(sizeof(rdpPrimaryUpdate));
|
|
|
|
ZeroMemory(update->primary, sizeof(rdpPrimaryUpdate));
|
2011-11-22 02:48:03 +04:00
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
update->secondary = (rdpSecondaryUpdate*) malloc(sizeof(rdpSecondaryUpdate));
|
|
|
|
ZeroMemory(update->secondary, sizeof(rdpSecondaryUpdate));
|
|
|
|
|
|
|
|
update->altsec = (rdpAltSecUpdate*) malloc(sizeof(rdpAltSecUpdate));
|
|
|
|
ZeroMemory(update->altsec, sizeof(rdpAltSecUpdate));
|
|
|
|
|
|
|
|
update->window = (rdpWindowUpdate*) malloc(sizeof(rdpWindowUpdate));
|
|
|
|
ZeroMemory(update->window, sizeof(rdpWindowUpdate));
|
2012-01-01 00:36:04 +04:00
|
|
|
|
|
|
|
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
|
|
|
|
deleteList->sIndices = 64;
|
2012-10-09 07:21:26 +04:00
|
|
|
deleteList->indices = malloc(deleteList->sIndices * 2);
|
2012-01-01 00:36:04 +04:00
|
|
|
deleteList->cIndices = 0;
|
2012-01-31 20:11:22 +04:00
|
|
|
|
|
|
|
update->SuppressOutput = update_send_suppress_output;
|
2013-01-09 02:18:10 +04:00
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
update->initialState = TRUE;
|
2011-07-27 02:32:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return update;
|
|
|
|
}
|
|
|
|
|
|
|
|
void update_free(rdpUpdate* update)
|
|
|
|
{
|
|
|
|
if (update != NULL)
|
|
|
|
{
|
2012-01-01 00:36:04 +04:00
|
|
|
OFFSCREEN_DELETE_LIST* deleteList;
|
2012-11-22 04:22:41 +04:00
|
|
|
|
2012-01-01 00:36:04 +04:00
|
|
|
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
|
2012-10-09 07:21:26 +04:00
|
|
|
free(deleteList->indices);
|
|
|
|
|
|
|
|
free(update->bitmap_update.rectangles);
|
2013-01-30 01:18:17 +04:00
|
|
|
|
|
|
|
free(update->pointer->pointer_color.andMaskData);
|
|
|
|
free(update->pointer->pointer_color.xorMaskData);
|
|
|
|
free(update->pointer->pointer_new.colorPtrAttr.andMaskData);
|
|
|
|
free(update->pointer->pointer_new.colorPtrAttr.xorMaskData);
|
2012-10-09 07:21:26 +04:00
|
|
|
free(update->pointer);
|
2013-01-30 01:18:17 +04:00
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
free(update->primary->polyline.points);
|
|
|
|
free(update->primary->polygon_sc.points);
|
|
|
|
free(update->primary);
|
2013-01-30 01:18:17 +04:00
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
free(update->secondary);
|
|
|
|
free(update->altsec);
|
|
|
|
free(update->window);
|
2013-01-09 02:18:10 +04:00
|
|
|
|
2013-01-24 23:09:44 +04:00
|
|
|
if (update->asynchronous)
|
2013-02-04 20:05:24 +04:00
|
|
|
update_message_proxy_free(update->proxy);
|
2013-01-18 22:50:35 +04:00
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
free(update);
|
2011-07-27 02:32:14 +04:00
|
|
|
}
|
|
|
|
}
|