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
|
|
|
* Drawing Orders
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2011-08-09 10:32:50 +04:00
|
|
|
#include "window.h"
|
2012-11-22 06:22:06 +04:00
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2011-09-05 00:49:22 +04:00
|
|
|
#include <freerdp/api.h>
|
2014-09-12 16:36:29 +04:00
|
|
|
#include <freerdp/log.h>
|
2011-10-21 01:28:59 +04:00
|
|
|
#include <freerdp/graphics.h>
|
2011-10-03 04:28:20 +04:00
|
|
|
#include <freerdp/codec/bitmap.h>
|
2011-08-09 10:32:50 +04:00
|
|
|
|
2011-07-25 09:45:25 +04:00
|
|
|
#include "orders.h"
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
#define TAG FREERDP_TAG("core.orders")
|
|
|
|
|
2011-12-01 02:40:36 +04:00
|
|
|
#ifdef WITH_DEBUG_ORDERS
|
|
|
|
|
|
|
|
static const char* const PRIMARY_DRAWING_ORDER_STRINGS[] =
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
|
|
|
"DstBlt",
|
|
|
|
"PatBlt",
|
|
|
|
"ScrBlt",
|
|
|
|
"", "", "", "",
|
|
|
|
"DrawNineGrid",
|
|
|
|
"MultiDrawNineGrid",
|
|
|
|
"LineTo",
|
|
|
|
"OpaqueRect",
|
|
|
|
"SaveBitmap",
|
2011-08-05 00:22:15 +04:00
|
|
|
"",
|
2011-07-25 09:45:25 +04:00
|
|
|
"MemBlt",
|
|
|
|
"Mem3Blt",
|
|
|
|
"MultiDstBlt",
|
|
|
|
"MultiPatBlt",
|
|
|
|
"MultiScrBlt",
|
|
|
|
"MultiOpaqueRect",
|
|
|
|
"FastIndex",
|
|
|
|
"PolygonSC",
|
|
|
|
"PolygonCB",
|
|
|
|
"Polyline",
|
2011-08-05 00:22:15 +04:00
|
|
|
"",
|
2011-07-25 09:45:25 +04:00
|
|
|
"FastGlyph",
|
|
|
|
"EllipseSC",
|
|
|
|
"EllipseCB",
|
|
|
|
"GlyphIndex"
|
|
|
|
};
|
|
|
|
|
2011-12-01 02:40:36 +04:00
|
|
|
static const char* const SECONDARY_DRAWING_ORDER_STRINGS[] =
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
|
|
|
"Cache Bitmap",
|
|
|
|
"Cache Color Table",
|
|
|
|
"Cache Bitmap (Compressed)",
|
|
|
|
"Cache Glyph",
|
|
|
|
"Cache Bitmap V2",
|
|
|
|
"Cache Bitmap V2 (Compressed)",
|
|
|
|
"",
|
|
|
|
"Cache Brush",
|
|
|
|
"Cache Bitmap V3"
|
|
|
|
};
|
|
|
|
|
2012-11-22 05:50:28 +04:00
|
|
|
#define SECONDARY_DRAWING_ORDER_COUNT (ARRAYSIZE(SECONDARY_DRAWING_ORDER_STRINGS))
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2011-12-01 02:40:36 +04:00
|
|
|
static const char* const ALTSEC_DRAWING_ORDER_STRINGS[] =
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
|
|
|
"Switch Surface",
|
|
|
|
"Create Offscreen Bitmap",
|
|
|
|
"Stream Bitmap First",
|
|
|
|
"Stream Bitmap Next",
|
|
|
|
"Create NineGrid Bitmap",
|
|
|
|
"Draw GDI+ First",
|
|
|
|
"Draw GDI+ Next",
|
|
|
|
"Draw GDI+ End",
|
|
|
|
"Draw GDI+ Cache First",
|
|
|
|
"Draw GDI+ Cache Next",
|
|
|
|
"Draw GDI+ Cache End",
|
|
|
|
"Windowing",
|
|
|
|
"Desktop Composition",
|
|
|
|
"Frame Marker"
|
|
|
|
};
|
|
|
|
|
2012-11-22 05:50:28 +04:00
|
|
|
#define ALTSEC_DRAWING_ORDER_COUNT (ARRAYSIZE(ALTSEC_DRAWING_ORDER_STRINGS))
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2011-12-01 02:40:36 +04:00
|
|
|
#endif /* WITH_DEBUG_ORDERS */
|
|
|
|
|
2013-05-07 23:33:52 +04:00
|
|
|
const BYTE PRIMARY_DRAWING_ORDER_FIELD_BYTES[] =
|
2011-07-26 07:51:13 +04:00
|
|
|
{
|
|
|
|
DSTBLT_ORDER_FIELD_BYTES,
|
|
|
|
PATBLT_ORDER_FIELD_BYTES,
|
|
|
|
SCRBLT_ORDER_FIELD_BYTES,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
DRAW_NINE_GRID_ORDER_FIELD_BYTES,
|
|
|
|
MULTI_DRAW_NINE_GRID_ORDER_FIELD_BYTES,
|
|
|
|
LINE_TO_ORDER_FIELD_BYTES,
|
|
|
|
OPAQUE_RECT_ORDER_FIELD_BYTES,
|
|
|
|
SAVE_BITMAP_ORDER_FIELD_BYTES,
|
2011-08-05 09:21:32 +04:00
|
|
|
0,
|
2011-07-26 07:51:13 +04:00
|
|
|
MEMBLT_ORDER_FIELD_BYTES,
|
|
|
|
MEM3BLT_ORDER_FIELD_BYTES,
|
|
|
|
MULTI_DSTBLT_ORDER_FIELD_BYTES,
|
|
|
|
MULTI_PATBLT_ORDER_FIELD_BYTES,
|
|
|
|
MULTI_SCRBLT_ORDER_FIELD_BYTES,
|
|
|
|
MULTI_OPAQUE_RECT_ORDER_FIELD_BYTES,
|
|
|
|
FAST_INDEX_ORDER_FIELD_BYTES,
|
|
|
|
POLYGON_SC_ORDER_FIELD_BYTES,
|
|
|
|
POLYGON_CB_ORDER_FIELD_BYTES,
|
|
|
|
POLYLINE_ORDER_FIELD_BYTES,
|
2011-08-05 09:21:32 +04:00
|
|
|
0,
|
2011-07-26 07:51:13 +04:00
|
|
|
FAST_GLYPH_ORDER_FIELD_BYTES,
|
|
|
|
ELLIPSE_SC_ORDER_FIELD_BYTES,
|
|
|
|
ELLIPSE_CB_ORDER_FIELD_BYTES,
|
|
|
|
GLYPH_INDEX_ORDER_FIELD_BYTES
|
|
|
|
};
|
|
|
|
|
2012-11-22 05:50:28 +04:00
|
|
|
#define PRIMARY_DRAWING_ORDER_COUNT (ARRAYSIZE(PRIMARY_DRAWING_ORDER_FIELD_BYTES))
|
2012-02-11 17:30:09 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
static const BYTE CBR2_BPP[] =
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
|
|
|
0, 0, 0, 8, 16, 24, 32
|
|
|
|
};
|
|
|
|
|
2013-05-07 07:21:12 +04:00
|
|
|
static const BYTE BPP_CBR2[] =
|
|
|
|
{
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
3, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
4, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
5, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
6, 0, 0, 0, 0, 0, 0, 0
|
|
|
|
};
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
static const BYTE CBR23_BPP[] =
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
|
|
|
0, 0, 0, 8, 16, 24, 32
|
|
|
|
};
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static const BYTE BPP_CBR23[] =
|
|
|
|
{
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
3, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
4, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
5, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
6, 0, 0, 0, 0, 0, 0, 0
|
|
|
|
};
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
static const BYTE BMF_BPP[] =
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
|
|
|
0, 1, 0, 8, 16, 24, 32
|
|
|
|
};
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static const BYTE BPP_BMF[] =
|
|
|
|
{
|
|
|
|
0, 1, 0, 0, 0, 0, 0, 0,
|
|
|
|
3, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
4, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
5, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
6, 0, 0, 0, 0, 0, 0, 0
|
|
|
|
};
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_coord(wStream* s, INT32* coord, BOOL delta)
|
2011-07-27 00:58:10 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
INT8 lsi8;
|
|
|
|
INT16 lsi16;
|
2011-07-27 00:58:10 +04:00
|
|
|
|
|
|
|
if (delta)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, lsi8);
|
2011-11-24 00:48:49 +04:00
|
|
|
*coord += lsi8;
|
2011-07-27 00:58:10 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, lsi16);
|
2011-11-24 00:48:49 +04:00
|
|
|
*coord = lsi16;
|
2011-07-27 00:58:10 +04:00
|
|
|
}
|
2013-05-07 06:27:19 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INLINE BOOL update_write_coord(wStream* s, INT32 coord)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, coord);
|
2013-05-07 06:27:19 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-04-29 18:02:31 +04:00
|
|
|
#if 0
|
2013-05-07 06:27:19 +04:00
|
|
|
static INLINE BOOL update_write_coord_delta(wStream* s, INT32 prevCoord, INT32 nextCoord)
|
|
|
|
{
|
|
|
|
INT8 lsi8;
|
|
|
|
|
|
|
|
lsi8 = nextCoord - prevCoord;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, lsi8);
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-27 00:58:10 +04:00
|
|
|
}
|
2014-04-29 18:02:31 +04:00
|
|
|
#endif
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_color(wStream* s, UINT32* color)
|
2011-07-27 00:58:10 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 3)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
*color = (UINT32) byte << 16;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
*color |= ((UINT32) byte << 8);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
*color |= (UINT32) byte;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INLINE BOOL update_write_color(wStream* s, UINT32 color)
|
|
|
|
{
|
|
|
|
BYTE byte;
|
|
|
|
|
|
|
|
byte = (color & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 20:45:52 +04:00
|
|
|
byte = ((color >> 8) & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 20:45:52 +04:00
|
|
|
byte = ((color >> 16) & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-27 00:58:10 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE void update_read_colorref(wStream* s, UINT32* color)
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 00:58:42 +04:00
|
|
|
*color = byte;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 00:58:42 +04:00
|
|
|
*color |= (byte << 8);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 00:58:42 +04:00
|
|
|
*color |= (byte << 16);
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s);
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE void update_read_color_quad(wStream* s, UINT32* color)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 11:29:56 +04:00
|
|
|
*color = (byte << 16);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 11:29:56 +04:00
|
|
|
*color |= (byte << 8);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 11:29:56 +04:00
|
|
|
*color |= byte;
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
static INLINE void update_write_color_quad(wStream* s, UINT32 color)
|
|
|
|
{
|
|
|
|
BYTE byte;
|
|
|
|
|
|
|
|
byte = (color << 16) & 0xFF;
|
|
|
|
Stream_Write_UINT8(s, byte);
|
|
|
|
byte = (color << 8) & 0xFF;
|
|
|
|
Stream_Write_UINT8(s, byte);
|
|
|
|
byte = color & 0xFF;
|
|
|
|
Stream_Write_UINT8(s, byte);
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_2byte_unsigned(wStream* s, UINT32* value)
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2011-08-04 01:09:12 +04:00
|
|
|
if (byte & 0x80)
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-08-04 01:09:12 +04:00
|
|
|
*value = (byte & 0x7F) << 8;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 00:58:42 +04:00
|
|
|
*value |= byte;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-04 01:09:12 +04:00
|
|
|
*value = (byte & 0x7F);
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
2013-05-07 07:21:12 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INLINE BOOL update_write_2byte_unsigned(wStream* s, UINT32 value)
|
|
|
|
{
|
|
|
|
BYTE byte;
|
|
|
|
|
|
|
|
if (value > 0x7FFF)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (value >= 0x7F)
|
|
|
|
{
|
|
|
|
byte = ((value & 0x7F00) >> 8);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte | 0x80);
|
2013-05-07 07:21:12 +04:00
|
|
|
byte = (value & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-07 19:41:32 +04:00
|
|
|
byte = (value & 0x7F);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_2byte_signed(wStream* s, INT32* value)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL negative;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
negative = (byte & 0x40) ? TRUE : FALSE;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2011-08-04 11:23:53 +04:00
|
|
|
*value = (byte & 0x3F);
|
|
|
|
|
2011-08-04 01:09:12 +04:00
|
|
|
if (byte & 0x80)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 19:41:32 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 11:23:53 +04:00
|
|
|
*value = (*value << 8) | byte;
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (negative)
|
|
|
|
*value *= -1;
|
2013-05-07 19:41:32 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INLINE BOOL update_write_2byte_signed(wStream* s, INT32 value)
|
|
|
|
{
|
|
|
|
BYTE byte;
|
|
|
|
BOOL negative = FALSE;
|
|
|
|
|
|
|
|
if (value < 0)
|
|
|
|
{
|
|
|
|
negative = TRUE;
|
|
|
|
value *= -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value > 0x3FFF)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (value >= 0x3F)
|
|
|
|
{
|
|
|
|
byte = ((value & 0x3F00) >> 8);
|
|
|
|
|
|
|
|
if (negative)
|
|
|
|
byte |= 0x40;
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte | 0x80);
|
2013-05-07 19:41:32 +04:00
|
|
|
byte = (value & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 19:41:32 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
byte = (value & 0x3F);
|
|
|
|
|
|
|
|
if (negative)
|
|
|
|
byte |= 0x40;
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 19:41:32 +04:00
|
|
|
}
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_4byte_unsigned(wStream* s, UINT32* value)
|
2011-08-04 07:33:44 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
|
|
|
BYTE count;
|
2011-08-04 07:33:44 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-08 07:41:39 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 07:33:44 +04:00
|
|
|
|
|
|
|
count = (byte & 0xC0) >> 6;
|
2013-05-08 07:41:39 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < count)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-04 07:33:44 +04:00
|
|
|
|
|
|
|
switch (count)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
*value = (byte & 0x3F);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
*value = (byte & 0x3F) << 8;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 07:33:44 +04:00
|
|
|
*value |= byte;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
*value = (byte & 0x3F) << 16;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 07:33:44 +04:00
|
|
|
*value |= (byte << 8);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 07:33:44 +04:00
|
|
|
*value |= byte;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
*value = (byte & 0x3F) << 24;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 07:33:44 +04:00
|
|
|
*value |= (byte << 16);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 07:33:44 +04:00
|
|
|
*value |= (byte << 8);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 07:33:44 +04:00
|
|
|
*value |= byte;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-05-07 07:21:12 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INLINE BOOL update_write_4byte_unsigned(wStream* s, UINT32 value)
|
|
|
|
{
|
|
|
|
BYTE byte;
|
|
|
|
|
|
|
|
if (value <= 0x3F)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, value);
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
|
|
|
else if (value <= 0x3FFF)
|
|
|
|
{
|
|
|
|
byte = (value >> 8) & 0x3F;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte | 0x40);
|
2013-05-07 07:21:12 +04:00
|
|
|
byte = (value & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
|
|
|
else if (value <= 0x3FFFFF)
|
|
|
|
{
|
|
|
|
byte = (value >> 16) & 0x3F;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte | 0x80);
|
2013-05-07 07:21:12 +04:00
|
|
|
byte = (value >> 8) & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
byte = (value & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
2014-04-28 01:21:30 +04:00
|
|
|
else if (value <= 0x3FFFFFFF)
|
2013-05-07 07:21:12 +04:00
|
|
|
{
|
|
|
|
byte = (value >> 24) & 0x3F;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte | 0xC0);
|
2013-05-07 07:21:12 +04:00
|
|
|
byte = (value >> 16) & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
byte = (value >> 8) & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
byte = (value & 0xFF);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-04 07:33:44 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_delta(wStream* s, INT32* value)
|
2011-08-04 11:23:53 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 1");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
if (byte & 0x40)
|
|
|
|
*value = (byte | ~0x3F);
|
|
|
|
else
|
|
|
|
*value = (byte & 0x3F);
|
|
|
|
|
|
|
|
if (byte & 0x80)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 1");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-04 11:23:53 +04:00
|
|
|
*value = (*value << 8) | byte;
|
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-04 11:23:53 +04:00
|
|
|
}
|
|
|
|
|
2014-04-29 18:02:31 +04:00
|
|
|
#if 0
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE void update_read_glyph_delta(wStream* s, UINT16* value)
|
2011-09-05 00:49:22 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-09-05 00:49:22 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-09-05 00:49:22 +04:00
|
|
|
|
|
|
|
if (byte == 0x80)
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, *value);
|
2011-09-05 00:49:22 +04:00
|
|
|
else
|
|
|
|
*value = (byte & 0x3F);
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE void update_seek_glyph_delta(wStream* s)
|
2011-09-05 00:49:22 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-09-05 00:49:22 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-09-05 00:49:22 +04:00
|
|
|
|
|
|
|
if (byte & 0x80)
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s);
|
2011-09-05 00:49:22 +04:00
|
|
|
}
|
2014-04-29 18:02:31 +04:00
|
|
|
#endif
|
2011-09-05 00:49:22 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_brush(wStream* s, rdpBrush* brush, BYTE fieldFlags)
|
2011-08-08 05:12:36 +04:00
|
|
|
{
|
|
|
|
if (fieldFlags & ORDER_FIELD_01)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, brush->x);
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2011-08-08 05:12:36 +04:00
|
|
|
|
|
|
|
if (fieldFlags & ORDER_FIELD_02)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, brush->y);
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2011-08-08 05:12:36 +04:00
|
|
|
|
|
|
|
if (fieldFlags & ORDER_FIELD_03)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, brush->style);
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2011-08-08 05:12:36 +04:00
|
|
|
|
|
|
|
if (fieldFlags & ORDER_FIELD_04)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, brush->hatch);
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2011-08-08 05:12:36 +04:00
|
|
|
|
|
|
|
if (brush->style & CACHED_BRUSH)
|
|
|
|
{
|
|
|
|
brush->index = brush->hatch;
|
|
|
|
|
|
|
|
brush->bpp = BMF_BPP[brush->style & 0x0F];
|
|
|
|
|
|
|
|
if (brush->bpp == 0)
|
|
|
|
brush->bpp = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & ORDER_FIELD_05)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 7)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
brush->data = (BYTE*) brush->p8x8;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, brush->data[7]);
|
|
|
|
Stream_Read_UINT8(s, brush->data[6]);
|
|
|
|
Stream_Read_UINT8(s, brush->data[5]);
|
|
|
|
Stream_Read_UINT8(s, brush->data[4]);
|
|
|
|
Stream_Read_UINT8(s, brush->data[3]);
|
|
|
|
Stream_Read_UINT8(s, brush->data[2]);
|
|
|
|
Stream_Read_UINT8(s, brush->data[1]);
|
2011-08-08 05:12:36 +04:00
|
|
|
brush->data[0] = brush->hatch;
|
|
|
|
}
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INLINE BOOL update_write_brush(wStream* s, rdpBrush* brush, BYTE fieldFlags)
|
|
|
|
{
|
|
|
|
if (fieldFlags & ORDER_FIELD_01)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, brush->x);
|
2013-05-07 20:45:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & ORDER_FIELD_02)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, brush->y);
|
2013-05-07 20:45:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & ORDER_FIELD_03)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, brush->style);
|
2013-05-07 20:45:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (brush->style & CACHED_BRUSH)
|
|
|
|
{
|
2013-05-08 02:44:22 +04:00
|
|
|
brush->hatch = brush->index;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
brush->bpp = BMF_BPP[brush->style & 0x0F];
|
|
|
|
|
|
|
|
if (brush->bpp == 0)
|
|
|
|
brush->bpp = 1;
|
|
|
|
}
|
|
|
|
|
2013-05-08 02:44:22 +04:00
|
|
|
if (fieldFlags & ORDER_FIELD_04)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, brush->hatch);
|
2013-05-08 02:44:22 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
if (fieldFlags & ORDER_FIELD_05)
|
|
|
|
{
|
|
|
|
brush->data = (BYTE*) brush->p8x8;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, brush->data[7]);
|
|
|
|
Stream_Write_UINT8(s, brush->data[6]);
|
|
|
|
Stream_Write_UINT8(s, brush->data[5]);
|
|
|
|
Stream_Write_UINT8(s, brush->data[4]);
|
|
|
|
Stream_Write_UINT8(s, brush->data[3]);
|
|
|
|
Stream_Write_UINT8(s, brush->data[2]);
|
|
|
|
Stream_Write_UINT8(s, brush->data[1]);
|
2013-05-07 20:45:52 +04:00
|
|
|
brush->data[0] = brush->hatch;
|
|
|
|
}
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-08 05:12:36 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles, int number)
|
2011-08-04 11:23:53 +04:00
|
|
|
{
|
|
|
|
int i;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE flags = 0;
|
|
|
|
BYTE* zeroBits;
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 zeroBitsSize;
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
if (number > 45)
|
|
|
|
number = 45;
|
|
|
|
|
|
|
|
zeroBitsSize = ((number + 1) / 2);
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < zeroBitsSize)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-15 22:42:37 +04:00
|
|
|
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_GetPointer(s, zeroBits);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, zeroBitsSize);
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2013-05-15 22:42:37 +04:00
|
|
|
ZeroMemory(rectangles, sizeof(DELTA_RECT) * (number + 1));
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
for (i = 1; i < number + 1; i++)
|
|
|
|
{
|
|
|
|
if ((i - 1) % 2 == 0)
|
|
|
|
flags = zeroBits[(i - 1) / 2];
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
if ((~flags & 0x80) && !update_read_delta(s, &rectangles[i].left))
|
|
|
|
return FALSE;
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
if ((~flags & 0x40) && !update_read_delta(s, &rectangles[i].top))
|
|
|
|
return FALSE;
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
if (~flags & 0x20)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_delta(s, &rectangles[i].width))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-04 11:23:53 +04:00
|
|
|
else
|
2013-05-15 22:42:37 +04:00
|
|
|
{
|
2011-08-04 11:23:53 +04:00
|
|
|
rectangles[i].width = rectangles[i - 1].width;
|
2013-05-15 22:42:37 +04:00
|
|
|
}
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
if (~flags & 0x10)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_delta(s, &rectangles[i].height))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-04 11:23:53 +04:00
|
|
|
else
|
2013-05-15 22:42:37 +04:00
|
|
|
{
|
2011-08-04 11:23:53 +04:00
|
|
|
rectangles[i].height = rectangles[i - 1].height;
|
2013-05-15 22:42:37 +04:00
|
|
|
}
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
rectangles[i].left = rectangles[i].left + rectangles[i - 1].left;
|
|
|
|
rectangles[i].top = rectangles[i].top + rectangles[i - 1].top;
|
|
|
|
|
|
|
|
flags <<= 4;
|
|
|
|
}
|
2013-05-15 22:42:37 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-04 11:23:53 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static INLINE BOOL update_read_delta_points(wStream* s, DELTA_POINT* points, int number, INT16 x, INT16 y)
|
2011-08-04 11:23:53 +04:00
|
|
|
{
|
|
|
|
int i;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE flags = 0;
|
|
|
|
BYTE* zeroBits;
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 zeroBitsSize;
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
zeroBitsSize = ((number + 3) / 4);
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < zeroBitsSize)
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < %i", zeroBitsSize);
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-05-15 22:42:37 +04:00
|
|
|
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_GetPointer(s, zeroBits);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, zeroBitsSize);
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2013-05-15 22:42:37 +04:00
|
|
|
ZeroMemory(points, sizeof(DELTA_POINT) * number);
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2011-09-10 15:32:09 +04:00
|
|
|
for (i = 0; i < number; i++)
|
2011-08-04 11:23:53 +04:00
|
|
|
{
|
2011-09-10 15:32:09 +04:00
|
|
|
if (i % 4 == 0)
|
|
|
|
flags = zeroBits[i / 4];
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
if ((~flags & 0x80) && !update_read_delta(s, &points[i].x))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "update_read_delta(x) failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
if ((~flags & 0x40) && !update_read_delta(s, &points[i].y))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "update_read_delta(y) failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
flags <<= 2;
|
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-04 11:23:53 +04:00
|
|
|
}
|
|
|
|
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
#define ORDER_FIELD_BYTE(NO, TARGET) \
|
|
|
|
do {\
|
|
|
|
if (orderInfo->fieldFlags & (1 << (NO-1))) \
|
|
|
|
{ \
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1) {\
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error reading %s", #TARGET); \
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE; \
|
2013-01-18 17:36:49 +04:00
|
|
|
} \
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, TARGET); \
|
2013-01-12 03:17:45 +04:00
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define ORDER_FIELD_2BYTE(NO, TARGET1, TARGET2) \
|
|
|
|
do {\
|
|
|
|
if (orderInfo->fieldFlags & (1 << (NO-1))) \
|
|
|
|
{ \
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2) { \
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error reading %s or %s", #TARGET1, #TARGET2); \
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE; \
|
2013-01-18 17:36:49 +04:00
|
|
|
} \
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, TARGET1); \
|
|
|
|
Stream_Read_UINT8(s, TARGET2); \
|
2013-01-12 03:17:45 +04:00
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define ORDER_FIELD_UINT16(NO, TARGET) \
|
|
|
|
do {\
|
|
|
|
if (orderInfo->fieldFlags & (1 << (NO-1))) \
|
|
|
|
{ \
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2) { \
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error reading %s", #TARGET); \
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE; \
|
2013-01-18 17:36:49 +04:00
|
|
|
} \
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, TARGET); \
|
2013-01-12 03:17:45 +04:00
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
#define ORDER_FIELD_UINT32(NO, TARGET) \
|
|
|
|
do {\
|
|
|
|
if (orderInfo->fieldFlags & (1 << (NO-1))) \
|
|
|
|
{ \
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4) { \
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error reading %s", #TARGET); \
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE; \
|
2013-01-18 17:36:49 +04:00
|
|
|
} \
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, TARGET); \
|
2013-01-12 03:17:45 +04:00
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#define ORDER_FIELD_COORD(NO, TARGET) \
|
2013-01-18 17:36:49 +04:00
|
|
|
do { \
|
|
|
|
if ((orderInfo->fieldFlags & (1 << (NO-1))) && !update_read_coord(s, &TARGET, orderInfo->deltaCoordinates)) { \
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error reading %s", #TARGET); \
|
2013-01-18 17:36:49 +04:00
|
|
|
return FALSE; \
|
|
|
|
} \
|
|
|
|
} while(0)
|
2013-01-12 03:17:45 +04:00
|
|
|
#define ORDER_FIELD_COLOR(NO, TARGET) \
|
2013-01-18 17:36:49 +04:00
|
|
|
do { \
|
|
|
|
if ((orderInfo->fieldFlags & (1 << (NO-1))) && !update_read_color(s, &TARGET)) { \
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error reading %s", #TARGET); \
|
2013-01-18 17:36:49 +04:00
|
|
|
return FALSE; \
|
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
|
|
|
|
#define FIELD_SKIP_BUFFER16(s, TARGET_LEN) \
|
2013-01-18 17:36:49 +04:00
|
|
|
do { \
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2) {\
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error reading length %s", #TARGET_LEN); \
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE; \
|
2013-01-18 17:36:49 +04:00
|
|
|
}\
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, TARGET_LEN); \
|
2013-05-09 01:48:30 +04:00
|
|
|
if (!Stream_SafeSeek(s, TARGET_LEN)) { \
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "error skipping %d bytes", TARGET_LEN); \
|
2013-01-18 17:36:49 +04:00
|
|
|
return FALSE; \
|
|
|
|
} \
|
|
|
|
} while(0)
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
/* Primary Drawing Orders */
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_dstblt_order(wStream* s, ORDER_INFO* orderInfo, DSTBLT_ORDER* dstblt)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
ORDER_FIELD_COORD(1, dstblt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, dstblt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, dstblt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, dstblt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(5, dstblt->bRop);
|
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_dstblt_order(ORDER_INFO* orderInfo, DSTBLT_ORDER* dstblt)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_dstblt_order(wStream* s, ORDER_INFO* orderInfo, DSTBLT_ORDER* dstblt)
|
|
|
|
{
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_dstblt_order(orderInfo, dstblt)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
orderInfo->fieldFlags = 0;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_01;
|
|
|
|
update_write_coord(s, dstblt->nLeftRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_02;
|
|
|
|
update_write_coord(s, dstblt->nTopRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_03;
|
|
|
|
update_write_coord(s, dstblt->nWidth);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_04;
|
|
|
|
update_write_coord(s, dstblt->nHeight);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_05;
|
|
|
|
Stream_Write_UINT8(s, dstblt->bRop);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_patblt_order(wStream* s, ORDER_INFO* orderInfo, PATBLT_ORDER* patblt)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, patblt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, patblt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, patblt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, patblt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(5, patblt->bRop);
|
|
|
|
ORDER_FIELD_COLOR(6, patblt->backColor);
|
|
|
|
ORDER_FIELD_COLOR(7, patblt->foreColor);
|
|
|
|
return update_read_brush(s, &patblt->brush, orderInfo->fieldFlags >> 7);
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_patblt_order(ORDER_INFO* orderInfo, PATBLT_ORDER* patblt)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
BOOL update_write_patblt_order(wStream* s, ORDER_INFO* orderInfo, PATBLT_ORDER* patblt)
|
|
|
|
{
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_patblt_order(orderInfo, patblt)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
orderInfo->fieldFlags = 0;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_01;
|
|
|
|
update_write_coord(s, patblt->nLeftRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_02;
|
|
|
|
update_write_coord(s, patblt->nTopRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_03;
|
|
|
|
update_write_coord(s, patblt->nWidth);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_04;
|
|
|
|
update_write_coord(s, patblt->nHeight);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_05;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, patblt->bRop);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_06;
|
2013-05-09 22:33:39 +04:00
|
|
|
update_write_color(s, patblt->backColor);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_07;
|
2013-05-09 22:33:39 +04:00
|
|
|
update_write_color(s, patblt->foreColor);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_08;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_09;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_10;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_11;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_12;
|
|
|
|
update_write_brush(s, &patblt->brush, orderInfo->fieldFlags >> 7);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_scrblt_order(wStream* s, ORDER_INFO* orderInfo, SCRBLT_ORDER* scrblt)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, scrblt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, scrblt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, scrblt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, scrblt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(5, scrblt->bRop);
|
|
|
|
ORDER_FIELD_COORD(6, scrblt->nXSrc);
|
|
|
|
ORDER_FIELD_COORD(7, scrblt->nYSrc);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_scrblt_order(ORDER_INFO* orderInfo, SCRBLT_ORDER* scrblt)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
BOOL update_write_scrblt_order(wStream* s, ORDER_INFO* orderInfo, SCRBLT_ORDER* scrblt)
|
|
|
|
{
|
|
|
|
|
2015-03-30 19:29:32 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_scrblt_order(orderInfo, scrblt)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
orderInfo->fieldFlags = 0;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_01;
|
|
|
|
update_write_coord(s, scrblt->nLeftRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_02;
|
|
|
|
update_write_coord(s, scrblt->nTopRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_03;
|
|
|
|
update_write_coord(s, scrblt->nWidth);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_04;
|
|
|
|
update_write_coord(s, scrblt->nHeight);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_05;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, scrblt->bRop);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_06;
|
|
|
|
update_write_coord(s, scrblt->nXSrc);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_07;
|
|
|
|
update_write_coord(s, scrblt->nYSrc);
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_opaque_rect_order(wStream* s, ORDER_INFO* orderInfo, OPAQUE_RECT_ORDER* opaque_rect)
|
2011-08-02 20:59:45 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, opaque_rect->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, opaque_rect->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, opaque_rect->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, opaque_rect->nHeight);
|
2011-08-02 20:59:45 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_05)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
opaque_rect->color = (opaque_rect->color & 0xFF00FFFF) | ((UINT32) byte << 16);
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 06:27:19 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_06)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
opaque_rect->color = (opaque_rect->color & 0xFFFF00FF) | ((UINT32) byte << 8);
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 06:27:19 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
opaque_rect->color = (opaque_rect->color & 0xFFFFFF00) | (UINT32) byte;
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
2013-05-07 06:27:19 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_opaque_rect_order(ORDER_INFO* orderInfo, OPAQUE_RECT_ORDER* opaque_rect)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-07 06:27:19 +04:00
|
|
|
BOOL update_write_opaque_rect_order(wStream* s, ORDER_INFO* orderInfo, OPAQUE_RECT_ORDER* opaque_rect)
|
|
|
|
{
|
|
|
|
BYTE byte;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_opaque_rect_order(orderInfo, opaque_rect)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 06:27:19 +04:00
|
|
|
orderInfo->fieldFlags = 0;
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_01;
|
|
|
|
update_write_coord(s, opaque_rect->nLeftRect);
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_02;
|
|
|
|
update_write_coord(s, opaque_rect->nTopRect);
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_03;
|
|
|
|
update_write_coord(s, opaque_rect->nWidth);
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_04;
|
|
|
|
update_write_coord(s, opaque_rect->nHeight);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_05;
|
|
|
|
byte = opaque_rect->color & 0x000000FF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 06:27:19 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_06;
|
|
|
|
byte = (opaque_rect->color & 0x0000FF00) >> 8;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 06:27:19 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_07;
|
|
|
|
byte = (opaque_rect->color & 0x00FF0000) >> 16;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_draw_nine_grid_order(wStream* s, ORDER_INFO* orderInfo, DRAW_NINE_GRID_ORDER* draw_nine_grid)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, draw_nine_grid->srcLeft);
|
|
|
|
ORDER_FIELD_COORD(2, draw_nine_grid->srcTop);
|
|
|
|
ORDER_FIELD_COORD(3, draw_nine_grid->srcRight);
|
|
|
|
ORDER_FIELD_COORD(4, draw_nine_grid->srcBottom);
|
|
|
|
ORDER_FIELD_UINT16(5, draw_nine_grid->bitmapId);
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_draw_nine_grid_order(ORDER_INFO* orderInfo, DRAW_NINE_GRID_ORDER* draw_nine_grid)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_draw_nine_grid_order(wStream* s, ORDER_INFO* orderInfo, DRAW_NINE_GRID_ORDER* draw_nine_grid)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_multi_dstblt_order(wStream* s, ORDER_INFO* orderInfo, MULTI_DSTBLT_ORDER* multi_dstblt)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, multi_dstblt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, multi_dstblt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, multi_dstblt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, multi_dstblt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(5, multi_dstblt->bRop);
|
|
|
|
ORDER_FIELD_BYTE(6, multi_dstblt->numRectangles);
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, multi_dstblt->cbData);
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_read_delta_rects(s, multi_dstblt->rectangles, multi_dstblt->numRectangles);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_multi_dstblt_order(ORDER_INFO* orderInfo, MULTI_DSTBLT_ORDER* multi_dstblt)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_multi_dstblt_order(wStream* s, ORDER_INFO* orderInfo, MULTI_DSTBLT_ORDER* multi_dstblt)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_multi_patblt_order(wStream* s, ORDER_INFO* orderInfo, MULTI_PATBLT_ORDER* multi_patblt)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, multi_patblt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, multi_patblt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, multi_patblt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, multi_patblt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(5, multi_patblt->bRop);
|
2013-01-12 19:12:50 +04:00
|
|
|
ORDER_FIELD_COLOR(6, multi_patblt->backColor);
|
|
|
|
ORDER_FIELD_COLOR(7, multi_patblt->foreColor);
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_brush(s, &multi_patblt->brush, orderInfo->fieldFlags >> 7))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_BYTE(13, multi_patblt->numRectangles);
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_14)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, multi_patblt->cbData);
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_delta_rects(s, multi_patblt->rectangles, multi_patblt->numRectangles))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_multi_patblt_order(ORDER_INFO* orderInfo, MULTI_PATBLT_ORDER* multi_patblt)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_multi_patblt_order(wStream* s, ORDER_INFO* orderInfo, MULTI_PATBLT_ORDER* multi_patblt)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_multi_scrblt_order(wStream* s, ORDER_INFO* orderInfo, MULTI_SCRBLT_ORDER* multi_scrblt)
|
2011-08-02 20:59:45 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, multi_scrblt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, multi_scrblt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, multi_scrblt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, multi_scrblt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(5, multi_scrblt->bRop);
|
|
|
|
ORDER_FIELD_COORD(6, multi_scrblt->nXSrc);
|
|
|
|
ORDER_FIELD_COORD(7, multi_scrblt->nYSrc);
|
|
|
|
ORDER_FIELD_BYTE(8, multi_scrblt->numRectangles);
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_09)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, multi_scrblt->cbData);
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_read_delta_rects(s, multi_scrblt->rectangles, multi_scrblt->numRectangles);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_multi_scrblt_order(wStream* s, ORDER_INFO* orderInfo, MULTI_SCRBLT_ORDER* multi_scrblt)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_multi_scrblt_order(wStream* s, ORDER_INFO* orderInfo, MULTI_SCRBLT_ORDER* multi_scrblt)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_multi_opaque_rect_order(wStream* s, ORDER_INFO* orderInfo, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2013-05-07 06:27:19 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, multi_opaque_rect->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(2, multi_opaque_rect->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(3, multi_opaque_rect->nWidth);
|
|
|
|
ORDER_FIELD_COORD(4, multi_opaque_rect->nHeight);
|
2011-07-27 00:58:10 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_05)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
multi_opaque_rect->color = (multi_opaque_rect->color & 0xFF00FFFF) | ((UINT32) byte << 16);
|
2011-07-27 00:58:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_06)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
multi_opaque_rect->color = (multi_opaque_rect->color & 0xFFFF00FF) | ((UINT32) byte << 8);
|
2011-07-27 00:58:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2014-08-07 01:58:58 +04:00
|
|
|
multi_opaque_rect->color = (multi_opaque_rect->color & 0xFFFFFF00) | (UINT32) byte;
|
2011-07-27 00:58:10 +04:00
|
|
|
}
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_BYTE(8, multi_opaque_rect->numRectangles);
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_09)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, multi_opaque_rect->cbData);
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_read_delta_rects(s, multi_opaque_rect->rectangles, multi_opaque_rect->numRectangles);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_multi_opaque_rect_order(ORDER_INFO* orderInfo, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_multi_opaque_rect_order(wStream* s, ORDER_INFO* orderInfo, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_multi_draw_nine_grid_order(wStream* s, ORDER_INFO* orderInfo, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
ORDER_FIELD_COORD(1, multi_draw_nine_grid->srcLeft);
|
|
|
|
ORDER_FIELD_COORD(2, multi_draw_nine_grid->srcTop);
|
|
|
|
ORDER_FIELD_COORD(3, multi_draw_nine_grid->srcRight);
|
|
|
|
ORDER_FIELD_COORD(4, multi_draw_nine_grid->srcBottom);
|
|
|
|
ORDER_FIELD_UINT16(5, multi_draw_nine_grid->bitmapId);
|
|
|
|
ORDER_FIELD_BYTE(6, multi_draw_nine_grid->nDeltaEntries);
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
FIELD_SKIP_BUFFER16(s, multi_draw_nine_grid->cbData);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_multi_draw_nine_grid_order(ORDER_INFO* orderInfo, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_multi_draw_nine_grid_order(wStream* s, ORDER_INFO* orderInfo, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_line_to_order(wStream* s, ORDER_INFO* orderInfo, LINE_TO_ORDER* line_to)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
ORDER_FIELD_UINT16(1, line_to->backMode);
|
|
|
|
ORDER_FIELD_COORD(2, line_to->nXStart);
|
|
|
|
ORDER_FIELD_COORD(3, line_to->nYStart);
|
|
|
|
ORDER_FIELD_COORD(4, line_to->nXEnd);
|
|
|
|
ORDER_FIELD_COORD(5, line_to->nYEnd);
|
|
|
|
ORDER_FIELD_COLOR(6, line_to->backColor);
|
|
|
|
ORDER_FIELD_BYTE(7, line_to->bRop2);
|
|
|
|
ORDER_FIELD_BYTE(8, line_to->penStyle);
|
|
|
|
ORDER_FIELD_BYTE(9, line_to->penWidth);
|
|
|
|
ORDER_FIELD_COLOR(10, line_to->penColor);
|
|
|
|
return TRUE;
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_line_to_order(ORDER_INFO* orderInfo, LINE_TO_ORDER* line_to)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_line_to_order(wStream* s, ORDER_INFO* orderInfo, LINE_TO_ORDER* line_to)
|
|
|
|
{
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_line_to_order(orderInfo, line_to)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags = 0;
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_01;
|
|
|
|
Stream_Write_UINT16(s, line_to->backMode);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_02;
|
|
|
|
update_write_coord(s, line_to->nXStart);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_03;
|
|
|
|
update_write_coord(s, line_to->nYStart);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_04;
|
|
|
|
update_write_coord(s, line_to->nXEnd);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_05;
|
|
|
|
update_write_coord(s, line_to->nYEnd);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_06;
|
|
|
|
update_write_color(s, line_to->backColor);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_07;
|
|
|
|
Stream_Write_UINT8(s, line_to->bRop2);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_08;
|
|
|
|
Stream_Write_UINT8(s, line_to->penStyle);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_09;
|
|
|
|
Stream_Write_UINT8(s, line_to->penWidth);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_10;
|
|
|
|
update_write_color(s, line_to->penColor);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_polyline_order(wStream* s, ORDER_INFO* orderInfo, POLYLINE_ORDER* polyline)
|
2011-08-02 20:59:45 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
UINT16 word;
|
2015-03-15 16:09:16 +03:00
|
|
|
UINT32 new_num = polyline->numDeltaEntries;
|
2011-08-02 20:59:45 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, polyline->xStart);
|
|
|
|
ORDER_FIELD_COORD(2, polyline->yStart);
|
|
|
|
ORDER_FIELD_BYTE(3, polyline->bRop2);
|
|
|
|
ORDER_FIELD_UINT16(4, word);
|
|
|
|
ORDER_FIELD_COLOR(5, polyline->penColor);
|
2015-03-11 08:40:20 +03:00
|
|
|
ORDER_FIELD_BYTE(6, new_num);
|
2011-08-04 11:23:53 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
2015-03-11 08:40:20 +03:00
|
|
|
DELTA_POINT *new_points;
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 1");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, polyline->cbData);
|
2011-09-02 19:08:50 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
new_points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * new_num);
|
|
|
|
if (!new_points)
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "realloc(%i) failed", new_num);
|
2015-03-11 08:40:20 +03:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2015-03-11 08:40:20 +03:00
|
|
|
polyline->points = new_points;
|
|
|
|
polyline->numDeltaEntries = new_num;
|
2011-08-04 11:23:53 +04:00
|
|
|
|
2014-10-09 14:11:38 +04:00
|
|
|
return update_read_delta_points(s, polyline->points, polyline->numDeltaEntries, polyline->xStart, polyline->yStart);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-05-07 23:33:52 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_polyline_order(ORDER_INFO* orderInfo, POLYLINE_ORDER* polyline)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_polyline_order(wStream* s, ORDER_INFO* orderInfo, POLYLINE_ORDER* polyline)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_memblt_order(wStream* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* memblt)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_UINT16(1, memblt->cacheId);
|
|
|
|
ORDER_FIELD_COORD(2, memblt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(3, memblt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(4, memblt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(5, memblt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(6, memblt->bRop);
|
|
|
|
ORDER_FIELD_COORD(7, memblt->nXSrc);
|
|
|
|
ORDER_FIELD_COORD(8, memblt->nYSrc);
|
|
|
|
ORDER_FIELD_UINT16(9, memblt->cacheIndex);
|
2011-10-21 20:17:04 +04:00
|
|
|
|
|
|
|
memblt->colorIndex = (memblt->cacheId >> 8);
|
|
|
|
memblt->cacheId = (memblt->cacheId & 0xFF);
|
2013-11-03 22:29:48 +04:00
|
|
|
memblt->bitmap = NULL;
|
2013-05-07 19:41:32 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_memblt_order(ORDER_INFO* orderInfo, MEMBLT_ORDER* memblt)
|
|
|
|
{
|
2013-07-29 18:21:32 +04:00
|
|
|
return 64;
|
2013-06-10 01:56:57 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
BOOL update_write_memblt_order(wStream* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* memblt)
|
|
|
|
{
|
|
|
|
UINT16 cacheId;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_memblt_order(orderInfo, memblt)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
cacheId = (memblt->cacheId & 0xFF) | ((memblt->colorIndex & 0xFF) << 8);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_01;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, cacheId);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_02;
|
|
|
|
update_write_coord(s, memblt->nLeftRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_03;
|
|
|
|
update_write_coord(s, memblt->nTopRect);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_04;
|
|
|
|
update_write_coord(s, memblt->nWidth);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_05;
|
|
|
|
update_write_coord(s, memblt->nHeight);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_06;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, memblt->bRop);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_07;
|
|
|
|
update_write_coord(s, memblt->nXSrc);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_08;
|
|
|
|
update_write_coord(s, memblt->nYSrc);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_09;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, memblt->cacheIndex);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_mem3blt_order(wStream* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER* mem3blt)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_UINT16(1, mem3blt->cacheId);
|
|
|
|
ORDER_FIELD_COORD(2, mem3blt->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(3, mem3blt->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(4, mem3blt->nWidth);
|
|
|
|
ORDER_FIELD_COORD(5, mem3blt->nHeight);
|
|
|
|
ORDER_FIELD_BYTE(6, mem3blt->bRop);
|
|
|
|
ORDER_FIELD_COORD(7, mem3blt->nXSrc);
|
|
|
|
ORDER_FIELD_COORD(8, mem3blt->nYSrc);
|
|
|
|
ORDER_FIELD_COLOR(9, mem3blt->backColor);
|
|
|
|
ORDER_FIELD_COLOR(10, mem3blt->foreColor);
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_brush(s, &mem3blt->brush, orderInfo->fieldFlags >> 10))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-10-21 20:17:04 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_UINT16(16, mem3blt->cacheIndex);
|
2011-10-21 20:17:04 +04:00
|
|
|
mem3blt->colorIndex = (mem3blt->cacheId >> 8);
|
|
|
|
mem3blt->cacheId = (mem3blt->cacheId & 0xFF);
|
2013-11-03 22:29:48 +04:00
|
|
|
mem3blt->bitmap = NULL;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_mem3blt_order(ORDER_INFO* orderInfo, MEM3BLT_ORDER* mem3blt)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_mem3blt_order(wStream* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER* mem3blt)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_save_bitmap_order(wStream* s, ORDER_INFO* orderInfo, SAVE_BITMAP_ORDER* save_bitmap)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_UINT32(1, save_bitmap->savedBitmapPosition);
|
|
|
|
ORDER_FIELD_COORD(2, save_bitmap->nLeftRect);
|
|
|
|
ORDER_FIELD_COORD(3, save_bitmap->nTopRect);
|
|
|
|
ORDER_FIELD_COORD(4, save_bitmap->nRightRect);
|
|
|
|
ORDER_FIELD_COORD(5, save_bitmap->nBottomRect);
|
|
|
|
ORDER_FIELD_BYTE(6, save_bitmap->operation);
|
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_save_bitmap_order(ORDER_INFO* orderInfo, SAVE_BITMAP_ORDER* save_bitmap)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_save_bitmap_order(wStream* s, ORDER_INFO* orderInfo, SAVE_BITMAP_ORDER* save_bitmap)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_glyph_index_order(wStream* s, ORDER_INFO* orderInfo, GLYPH_INDEX_ORDER* glyph_index)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
ORDER_FIELD_BYTE(1, glyph_index->cacheId);
|
|
|
|
ORDER_FIELD_BYTE(2, glyph_index->flAccel);
|
|
|
|
ORDER_FIELD_BYTE(3, glyph_index->ulCharInc);
|
|
|
|
ORDER_FIELD_BYTE(4, glyph_index->fOpRedundant);
|
|
|
|
ORDER_FIELD_COLOR(5, glyph_index->backColor);
|
|
|
|
ORDER_FIELD_COLOR(6, glyph_index->foreColor);
|
|
|
|
ORDER_FIELD_UINT16(7, glyph_index->bkLeft);
|
|
|
|
ORDER_FIELD_UINT16(8, glyph_index->bkTop);
|
|
|
|
ORDER_FIELD_UINT16(9, glyph_index->bkRight);
|
|
|
|
ORDER_FIELD_UINT16(10, glyph_index->bkBottom);
|
|
|
|
ORDER_FIELD_UINT16(11, glyph_index->opLeft);
|
|
|
|
ORDER_FIELD_UINT16(12, glyph_index->opTop);
|
|
|
|
ORDER_FIELD_UINT16(13, glyph_index->opRight);
|
|
|
|
ORDER_FIELD_UINT16(14, glyph_index->opBottom);
|
|
|
|
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_UINT16(20, glyph_index->x);
|
|
|
|
ORDER_FIELD_UINT16(21, glyph_index->y);
|
2011-08-03 11:29:56 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_22)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, glyph_index->cbData);
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < glyph_index->cbData)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 20:45:52 +04:00
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
CopyMemory(glyph_index->data, Stream_Pointer(s), glyph_index->cbData);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, glyph_index->cbData);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_glyph_index_order(ORDER_INFO* orderInfo, GLYPH_INDEX_ORDER* glyph_index)
|
|
|
|
{
|
|
|
|
return 64;
|
|
|
|
}
|
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
BOOL update_write_glyph_index_order(wStream* s, ORDER_INFO* orderInfo, GLYPH_INDEX_ORDER* glyph_index)
|
|
|
|
{
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_glyph_index_order(orderInfo, glyph_index)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
orderInfo->fieldFlags = 0;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 20:45:52 +04:00
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_01;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, glyph_index->cacheId);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_02;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, glyph_index->flAccel);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_03;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, glyph_index->ulCharInc);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_04;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, glyph_index->fOpRedundant);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_05;
|
|
|
|
update_write_color(s, glyph_index->backColor);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_06;
|
|
|
|
update_write_color(s, glyph_index->foreColor);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_07;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->bkLeft);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_08;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->bkTop);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_09;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->bkRight);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_10;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->bkBottom);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_11;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->opLeft);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_12;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->opTop);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_13;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->opRight);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_14;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->opBottom);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_15;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_16;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_17;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_18;
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_19;
|
|
|
|
update_write_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14);
|
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_20;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->x);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_21;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph_index->y);
|
2013-05-07 20:45:52 +04:00
|
|
|
|
|
|
|
orderInfo->fieldFlags |= ORDER_FIELD_22;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, glyph_index->cbData);
|
2013-05-07 20:45:52 +04:00
|
|
|
Stream_Write(s, glyph_index->data, glyph_index->cbData);
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_fast_index_order(wStream* s, ORDER_INFO* orderInfo, FAST_INDEX_ORDER* fast_index)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
ORDER_FIELD_BYTE(1, fast_index->cacheId);
|
|
|
|
ORDER_FIELD_2BYTE(2, fast_index->ulCharInc, fast_index->flAccel);
|
|
|
|
ORDER_FIELD_COLOR(3, fast_index->backColor);
|
|
|
|
ORDER_FIELD_COLOR(4, fast_index->foreColor);
|
|
|
|
ORDER_FIELD_COORD(5, fast_index->bkLeft);
|
|
|
|
ORDER_FIELD_COORD(6, fast_index->bkTop);
|
|
|
|
ORDER_FIELD_COORD(7, fast_index->bkRight);
|
|
|
|
ORDER_FIELD_COORD(8, fast_index->bkBottom);
|
|
|
|
ORDER_FIELD_COORD(9, fast_index->opLeft);
|
|
|
|
ORDER_FIELD_COORD(10, fast_index->opTop);
|
|
|
|
ORDER_FIELD_COORD(11, fast_index->opRight);
|
|
|
|
ORDER_FIELD_COORD(12, fast_index->opBottom);
|
|
|
|
ORDER_FIELD_COORD(13, fast_index->x);
|
|
|
|
ORDER_FIELD_COORD(14, fast_index->y);
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_15)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, fast_index->cbData);
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < fast_index->cbData)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
|
|
|
CopyMemory(fast_index->data, Stream_Pointer(s), fast_index->cbData);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, fast_index->cbData);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_fast_index_order(ORDER_INFO* orderInfo, FAST_INDEX_ORDER* fast_index)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_fast_index_order(wStream* s, ORDER_INFO* orderInfo, FAST_INDEX_ORDER* fast_index)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-12-03 22:17:27 +03:00
|
|
|
BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_ORDER* fastGlyph)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE* phold;
|
2014-12-03 22:17:27 +03:00
|
|
|
GLYPH_DATA_V2* glyph = &fastGlyph->glyphData;
|
|
|
|
|
|
|
|
ORDER_FIELD_BYTE(1, fastGlyph->cacheId);
|
|
|
|
ORDER_FIELD_2BYTE(2, fastGlyph->ulCharInc, fastGlyph->flAccel);
|
|
|
|
ORDER_FIELD_COLOR(3, fastGlyph->backColor);
|
|
|
|
ORDER_FIELD_COLOR(4, fastGlyph->foreColor);
|
|
|
|
ORDER_FIELD_COORD(5, fastGlyph->bkLeft);
|
|
|
|
ORDER_FIELD_COORD(6, fastGlyph->bkTop);
|
|
|
|
ORDER_FIELD_COORD(7, fastGlyph->bkRight);
|
|
|
|
ORDER_FIELD_COORD(8, fastGlyph->bkBottom);
|
|
|
|
ORDER_FIELD_COORD(9, fastGlyph->opLeft);
|
|
|
|
ORDER_FIELD_COORD(10, fastGlyph->opTop);
|
|
|
|
ORDER_FIELD_COORD(11, fastGlyph->opRight);
|
|
|
|
ORDER_FIELD_COORD(12, fastGlyph->opBottom);
|
|
|
|
ORDER_FIELD_COORD(13, fastGlyph->x);
|
|
|
|
ORDER_FIELD_COORD(14, fastGlyph->y);
|
2011-08-02 20:59:45 +04:00
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_15)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2014-12-03 22:17:27 +03:00
|
|
|
Stream_Read_UINT8(s, fastGlyph->cbData);
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2014-12-03 22:17:27 +03:00
|
|
|
if (Stream_GetRemainingLength(s) < fastGlyph->cbData)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2014-12-03 22:17:27 +03:00
|
|
|
CopyMemory(fastGlyph->data, Stream_Pointer(s), fastGlyph->cbData);
|
2013-05-15 20:14:26 +04:00
|
|
|
phold = Stream_Pointer(s);
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
if (!Stream_SafeSeek(s, 1))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2014-12-03 22:17:27 +03:00
|
|
|
if (fastGlyph->cbData > 1)
|
2011-11-25 03:32:49 +04:00
|
|
|
{
|
2015-03-11 08:40:20 +03:00
|
|
|
UINT32 new_cb;
|
2011-11-25 03:32:49 +04:00
|
|
|
/* parse optional glyph data */
|
2014-12-03 22:17:27 +03:00
|
|
|
glyph->cacheIndex = fastGlyph->data[0];
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_2byte_signed(s, &glyph->x) ||
|
2013-01-12 03:17:45 +04:00
|
|
|
!update_read_2byte_signed(s, &glyph->y) ||
|
|
|
|
!update_read_2byte_unsigned(s, &glyph->cx) ||
|
|
|
|
!update_read_2byte_unsigned(s, &glyph->cy))
|
|
|
|
return FALSE;
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2011-11-25 03:32:49 +04:00
|
|
|
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
2012-01-05 05:20:58 +04:00
|
|
|
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
new_cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
|
|
|
new_cb += ((new_cb % 4) > 0) ? 4 - (new_cb % 4) : 0;
|
|
|
|
if (Stream_GetRemainingLength(s) < new_cb)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
if (new_cb)
|
2013-11-01 07:35:24 +04:00
|
|
|
{
|
2015-03-11 08:40:20 +03:00
|
|
|
BYTE *new_aj;
|
|
|
|
new_aj = (BYTE*) realloc(glyph->aj, new_cb);
|
|
|
|
if (!new_aj)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
glyph->aj = new_aj;
|
|
|
|
glyph->cb = new_cb;
|
2014-12-03 22:17:27 +03:00
|
|
|
Stream_Read(s, glyph->aj, glyph->cb);
|
2013-11-01 07:35:24 +04:00
|
|
|
}
|
2011-11-25 03:32:49 +04:00
|
|
|
}
|
2013-02-03 21:41:59 +04:00
|
|
|
|
2014-12-03 22:17:27 +03:00
|
|
|
Stream_Pointer(s) = phold + fastGlyph->cbData;
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_fast_glyph_order(ORDER_INFO* orderInfo, FAST_GLYPH_ORDER* fast_glyph)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_ORDER* fast_glyph)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_polygon_sc_order(wStream* s, ORDER_INFO* orderInfo, POLYGON_SC_ORDER* polygon_sc)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2015-03-15 16:09:16 +03:00
|
|
|
UINT32 num = polygon_sc->numPoints;
|
2015-03-11 08:40:20 +03:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, polygon_sc->xStart);
|
|
|
|
ORDER_FIELD_COORD(2, polygon_sc->yStart);
|
|
|
|
ORDER_FIELD_BYTE(3, polygon_sc->bRop2);
|
|
|
|
ORDER_FIELD_BYTE(4, polygon_sc->fillMode);
|
|
|
|
ORDER_FIELD_COLOR(5, polygon_sc->brushColor);
|
2015-03-11 08:40:20 +03:00
|
|
|
ORDER_FIELD_BYTE(6, num);
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_07)
|
|
|
|
{
|
2015-03-11 08:40:20 +03:00
|
|
|
DELTA_POINT *newpoints;
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, polygon_sc->cbData);
|
2012-02-13 02:14:59 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
newpoints = (DELTA_POINT*) realloc(polygon_sc->points, sizeof(DELTA_POINT) * num);
|
|
|
|
if (!newpoints)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
polygon_sc->points = newpoints;
|
|
|
|
polygon_sc->numPoints = num;
|
2012-02-13 02:14:59 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_read_delta_points(s, polygon_sc->points, polygon_sc->numPoints, polygon_sc->xStart, polygon_sc->yStart);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_polygon_sc_order(ORDER_INFO* orderInfo, POLYGON_SC_ORDER* polygon_sc)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_polygon_sc_order(wStream* s, ORDER_INFO* orderInfo, POLYGON_SC_ORDER* polygon_sc)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_polygon_cb_order(wStream* s, ORDER_INFO* orderInfo, POLYGON_CB_ORDER* polygon_cb)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2015-03-15 16:09:16 +03:00
|
|
|
UINT32 num = polygon_cb->numPoints;
|
2015-03-11 08:40:20 +03:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, polygon_cb->xStart);
|
|
|
|
ORDER_FIELD_COORD(2, polygon_cb->yStart);
|
|
|
|
ORDER_FIELD_BYTE(3, polygon_cb->bRop2);
|
|
|
|
ORDER_FIELD_BYTE(4, polygon_cb->fillMode);
|
|
|
|
ORDER_FIELD_COLOR(5, polygon_cb->backColor);
|
|
|
|
ORDER_FIELD_COLOR(6, polygon_cb->foreColor);
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_brush(s, &polygon_cb->brush, orderInfo->fieldFlags >> 6))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
ORDER_FIELD_BYTE(12, num);
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
if (orderInfo->fieldFlags & ORDER_FIELD_13)
|
|
|
|
{
|
2015-03-11 08:40:20 +03:00
|
|
|
DELTA_POINT *newpoints;
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, polygon_cb->cbData);
|
2012-02-13 02:14:59 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
newpoints = (DELTA_POINT*) realloc(polygon_cb->points, sizeof(DELTA_POINT) * num);
|
|
|
|
if (!newpoints)
|
|
|
|
return FALSE;
|
2012-02-13 02:14:59 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
polygon_cb->points = newpoints;
|
|
|
|
polygon_cb->numPoints = num;
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_delta_points(s, polygon_cb->points, polygon_cb->numPoints, polygon_cb->xStart, polygon_cb->yStart))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2012-02-13 02:14:59 +04:00
|
|
|
|
|
|
|
polygon_cb->backMode = (polygon_cb->bRop2 & 0x80) ? BACKMODE_TRANSPARENT : BACKMODE_OPAQUE;
|
|
|
|
polygon_cb->bRop2 = (polygon_cb->bRop2 & 0x1F);
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_polygon_cb_order(ORDER_INFO* orderInfo, POLYGON_CB_ORDER* polygon_cb)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_polygon_cb_order(wStream* s, ORDER_INFO* orderInfo, POLYGON_CB_ORDER* polygon_cb)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_ellipse_sc_order(wStream* s, ORDER_INFO* orderInfo, ELLIPSE_SC_ORDER* ellipse_sc)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
ORDER_FIELD_COORD(1, ellipse_sc->leftRect);
|
|
|
|
ORDER_FIELD_COORD(2, ellipse_sc->topRect);
|
|
|
|
ORDER_FIELD_COORD(3, ellipse_sc->rightRect);
|
|
|
|
ORDER_FIELD_COORD(4, ellipse_sc->bottomRect);
|
|
|
|
ORDER_FIELD_BYTE(5, ellipse_sc->bRop2);
|
|
|
|
ORDER_FIELD_BYTE(6, ellipse_sc->fillMode);
|
|
|
|
ORDER_FIELD_COLOR(7, ellipse_sc->color);
|
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_ellipse_sc_order(ORDER_INFO* orderInfo, ELLIPSE_SC_ORDER* ellipse_sc)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_ellipse_sc_order(wStream* s, ORDER_INFO* orderInfo, ELLIPSE_SC_ORDER* ellipse_sc)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_ellipse_cb_order(wStream* s, ORDER_INFO* orderInfo, ELLIPSE_CB_ORDER* ellipse_cb)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
ORDER_FIELD_COORD(1, ellipse_cb->leftRect);
|
|
|
|
ORDER_FIELD_COORD(2, ellipse_cb->topRect);
|
|
|
|
ORDER_FIELD_COORD(3, ellipse_cb->rightRect);
|
|
|
|
ORDER_FIELD_COORD(4, ellipse_cb->bottomRect);
|
|
|
|
ORDER_FIELD_BYTE(5, ellipse_cb->bRop2);
|
|
|
|
ORDER_FIELD_BYTE(6, ellipse_cb->fillMode);
|
|
|
|
ORDER_FIELD_COLOR(7, ellipse_cb->backColor);
|
|
|
|
ORDER_FIELD_COLOR(8, ellipse_cb->foreColor);
|
|
|
|
return update_read_brush(s, &ellipse_cb->brush, orderInfo->fieldFlags >> 8);
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_ellipse_cb_order(ORDER_INFO* orderInfo, ELLIPSE_CB_ORDER* ellipse_cb)
|
|
|
|
{
|
|
|
|
return 32;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_ellipse_cb_order(wStream* s, ORDER_INFO* orderInfo, ELLIPSE_CB_ORDER* ellipse_cb)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-07-26 00:54:15 +04:00
|
|
|
/* Secondary Drawing Orders */
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_read_cache_bitmap_order(wStream* s, CACHE_BITMAP_ORDER* cache_bitmap, BOOL compressed, UINT16 flags)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 9)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT8(s, cache_bitmap->cacheId); /* cacheId (1 byte) */
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT8(s, cache_bitmap->bitmapWidth); /* bitmapWidth (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, cache_bitmap->bitmapHeight); /* bitmapHeight (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, cache_bitmap->bitmapBpp); /* bitmapBpp (1 byte) */
|
2014-05-29 12:12:02 +04:00
|
|
|
if ((cache_bitmap->bitmapBpp < 1) || (cache_bitmap->bitmapBpp > 32))
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "invalid bitmap bpp %d", cache_bitmap->bitmapBpp);
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT16(s, cache_bitmap->bitmapLength); /* bitmapLength (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, cache_bitmap->cacheIndex); /* cacheIndex (2 bytes) */
|
2011-08-03 00:58:42 +04:00
|
|
|
|
|
|
|
if (compressed)
|
|
|
|
{
|
2012-01-05 05:17:11 +04:00
|
|
|
if ((flags & NO_BITMAP_COMPRESSION_HDR) == 0)
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
2013-05-13 01:46:13 +04:00
|
|
|
BYTE* bitmapComprHdr = (BYTE*) &(cache_bitmap->bitmapComprHdr);
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, bitmapComprHdr, 8); /* bitmapComprHdr (8 bytes) */
|
2013-05-13 01:46:13 +04:00
|
|
|
cache_bitmap->bitmapLength -= 8;
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < cache_bitmap->bitmapLength)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_GetPointer(s, cache_bitmap->bitmapDataStream);
|
|
|
|
Stream_Seek(s, cache_bitmap->bitmapLength);
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-13 01:46:13 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < cache_bitmap->bitmapLength)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_GetPointer(s, cache_bitmap->bitmapDataStream);
|
|
|
|
Stream_Seek(s, cache_bitmap->bitmapLength); /* bitmapDataStream */
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
cache_bitmap->compressed = compressed;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_cache_bitmap_order(CACHE_BITMAP_ORDER* cache_bitmap, BOOL compressed, UINT16* flags)
|
|
|
|
{
|
|
|
|
return 64 + cache_bitmap->bitmapLength;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_cache_bitmap_order(wStream* s, CACHE_BITMAP_ORDER* cache_bitmap, BOOL compressed, UINT16* flags)
|
|
|
|
{
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_order(cache_bitmap, compressed, flags)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
*flags = NO_BITMAP_COMPRESSION_HDR;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
if ((*flags & NO_BITMAP_COMPRESSION_HDR) == 0)
|
|
|
|
cache_bitmap->bitmapLength += 8;
|
|
|
|
|
|
|
|
Stream_Write_UINT8(s, cache_bitmap->cacheId); /* cacheId (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, 0); /* pad1Octet (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, cache_bitmap->bitmapWidth); /* bitmapWidth (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, cache_bitmap->bitmapHeight); /* bitmapHeight (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, cache_bitmap->bitmapBpp); /* bitmapBpp (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, cache_bitmap->bitmapLength); /* bitmapLength (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, cache_bitmap->cacheIndex); /* cacheIndex (2 bytes) */
|
|
|
|
|
|
|
|
if (compressed)
|
|
|
|
{
|
|
|
|
if ((*flags & NO_BITMAP_COMPRESSION_HDR) == 0)
|
|
|
|
{
|
|
|
|
BYTE* bitmapComprHdr = (BYTE*) &(cache_bitmap->bitmapComprHdr);
|
|
|
|
Stream_Write(s, bitmapComprHdr, 8); /* bitmapComprHdr (8 bytes) */
|
|
|
|
cache_bitmap->bitmapLength -= 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
Stream_Write(s, cache_bitmap->bitmapDataStream, cache_bitmap->bitmapLength);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Stream_Write(s, cache_bitmap->bitmapDataStream, cache_bitmap->bitmapLength);
|
|
|
|
}
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
BOOL update_read_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2, BOOL compressed, UINT16 flags)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE bitsPerPixelId;
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
cache_bitmap_v2->cacheId = flags & 0x0003;
|
|
|
|
cache_bitmap_v2->flags = (flags & 0xFF80) >> 7;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2011-08-04 07:33:44 +04:00
|
|
|
bitsPerPixelId = (flags & 0x0078) >> 3;
|
2013-05-08 01:40:54 +04:00
|
|
|
cache_bitmap_v2->bitmapBpp = CBR2_BPP[bitsPerPixelId];
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
if (cache_bitmap_v2->flags & CBR2_PERSISTENT_KEY_PRESENT)
|
2011-08-04 07:33:44 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, cache_bitmap_v2->key1); /* key1 (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, cache_bitmap_v2->key2); /* key2 (4 bytes) */
|
2011-08-04 07:33:44 +04:00
|
|
|
}
|
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
if (cache_bitmap_v2->flags & CBR2_HEIGHT_SAME_AS_WIDTH)
|
2011-08-04 07:33:44 +04:00
|
|
|
{
|
2013-05-08 01:40:54 +04:00
|
|
|
if (!update_read_2byte_unsigned(s, &cache_bitmap_v2->bitmapWidth)) /* bitmapWidth */
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
cache_bitmap_v2->bitmapHeight = cache_bitmap_v2->bitmapWidth;
|
2011-08-04 07:33:44 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 01:40:54 +04:00
|
|
|
if (!update_read_2byte_unsigned(s, &cache_bitmap_v2->bitmapWidth) || /* bitmapWidth */
|
|
|
|
!update_read_2byte_unsigned(s, &cache_bitmap_v2->bitmapHeight)) /* bitmapHeight */
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-04 07:33:44 +04:00
|
|
|
}
|
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
if (!update_read_4byte_unsigned(s, &cache_bitmap_v2->bitmapLength) || /* bitmapLength */
|
|
|
|
!update_read_2byte_unsigned(s, &cache_bitmap_v2->cacheIndex)) /* cacheIndex */
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
if (cache_bitmap_v2->flags & CBR2_DO_NOT_CACHE)
|
|
|
|
cache_bitmap_v2->cacheIndex = BITMAP_CACHE_WAITING_LIST_INDEX;
|
2012-01-04 03:22:42 +04:00
|
|
|
|
2011-08-03 00:58:42 +04:00
|
|
|
if (compressed)
|
|
|
|
{
|
2013-05-08 01:40:54 +04:00
|
|
|
if (!(cache_bitmap_v2->flags & CBR2_NO_BITMAP_COMPRESSION_HDR))
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, cache_bitmap_v2->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, cache_bitmap_v2->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, cache_bitmap_v2->cbScanWidth); /* cbScanWidth (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, cache_bitmap_v2->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
|
2013-05-08 01:40:54 +04:00
|
|
|
cache_bitmap_v2->bitmapLength = cache_bitmap_v2->cbCompMainBodySize;
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
2011-09-12 07:35:33 +04:00
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < cache_bitmap_v2->bitmapLength)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_GetPointer(s, cache_bitmap_v2->bitmapDataStream);
|
2013-05-08 01:40:54 +04:00
|
|
|
Stream_Seek(s, cache_bitmap_v2->bitmapLength);
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-08 01:40:54 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < cache_bitmap_v2->bitmapLength)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_GetPointer(s, cache_bitmap_v2->bitmapDataStream);
|
2013-05-08 01:40:54 +04:00
|
|
|
Stream_Seek(s, cache_bitmap_v2->bitmapLength);
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
2013-05-07 07:21:12 +04:00
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
cache_bitmap_v2->compressed = compressed;
|
2013-05-07 07:21:12 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_cache_bitmap_v2_order(CACHE_BITMAP_V2_ORDER* cache_bitmap_v2, BOOL compressed, UINT16* flags)
|
|
|
|
{
|
|
|
|
return 64 + cache_bitmap_v2->bitmapLength;
|
|
|
|
}
|
|
|
|
|
2013-05-07 07:21:12 +04:00
|
|
|
BOOL update_write_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2, BOOL compressed, UINT16* flags)
|
|
|
|
{
|
|
|
|
BYTE bitsPerPixelId;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_v2_order(cache_bitmap_v2, compressed, flags)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 07:21:12 +04:00
|
|
|
bitsPerPixelId = BPP_CBR2[cache_bitmap_v2->bitmapBpp];
|
|
|
|
|
|
|
|
*flags = (cache_bitmap_v2->cacheId & 0x0003) |
|
|
|
|
(bitsPerPixelId << 3) | ((cache_bitmap_v2->flags << 7) & 0xFF80);
|
|
|
|
|
|
|
|
if (cache_bitmap_v2->flags & CBR2_PERSISTENT_KEY_PRESENT)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, cache_bitmap_v2->key1); /* key1 (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, cache_bitmap_v2->key2); /* key2 (4 bytes) */
|
2013-05-07 07:21:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cache_bitmap_v2->flags & CBR2_HEIGHT_SAME_AS_WIDTH)
|
|
|
|
{
|
|
|
|
if (!update_write_2byte_unsigned(s, cache_bitmap_v2->bitmapWidth)) /* bitmapWidth */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!update_write_2byte_unsigned(s, cache_bitmap_v2->bitmapWidth) || /* bitmapWidth */
|
|
|
|
!update_write_2byte_unsigned(s, cache_bitmap_v2->bitmapHeight)) /* bitmapHeight */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-05-08 07:41:39 +04:00
|
|
|
if (cache_bitmap_v2->flags & CBR2_DO_NOT_CACHE)
|
|
|
|
cache_bitmap_v2->cacheIndex = BITMAP_CACHE_WAITING_LIST_INDEX;
|
|
|
|
|
2013-05-07 07:21:12 +04:00
|
|
|
if (!update_write_4byte_unsigned(s, cache_bitmap_v2->bitmapLength) || /* bitmapLength */
|
|
|
|
!update_write_2byte_unsigned(s, cache_bitmap_v2->cacheIndex)) /* cacheIndex */
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (compressed)
|
|
|
|
{
|
|
|
|
if (!(cache_bitmap_v2->flags & CBR2_NO_BITMAP_COMPRESSION_HDR))
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, cache_bitmap_v2->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, cache_bitmap_v2->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, cache_bitmap_v2->cbScanWidth); /* cbScanWidth (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, cache_bitmap_v2->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
|
2013-05-07 07:21:12 +04:00
|
|
|
cache_bitmap_v2->bitmapLength = cache_bitmap_v2->cbCompMainBodySize;
|
|
|
|
}
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-07 07:21:12 +04:00
|
|
|
Stream_Write(s, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapLength);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-07 07:21:12 +04:00
|
|
|
Stream_Write(s, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapLength);
|
|
|
|
}
|
|
|
|
|
|
|
|
cache_bitmap_v2->compressed = compressed;
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_read_cache_bitmap_v3_order(wStream* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3, UINT16 flags)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE bitsPerPixelId;
|
2011-08-04 07:33:44 +04:00
|
|
|
BITMAP_DATA_EX* bitmapData;
|
2015-03-11 08:40:20 +03:00
|
|
|
UINT32 new_len;
|
|
|
|
BYTE *new_data;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
cache_bitmap_v3->cacheId = flags & 0x00000003;
|
|
|
|
cache_bitmap_v3->flags = (flags & 0x0000FF80) >> 7;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
|
|
|
bitsPerPixelId = (flags & 0x00000078) >> 3;
|
2013-05-13 01:46:13 +04:00
|
|
|
cache_bitmap_v3->bpp = CBR23_BPP[bitsPerPixelId];
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 21)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-04 07:33:44 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT16(s, cache_bitmap_v3->cacheIndex); /* cacheIndex (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, cache_bitmap_v3->key1); /* key1 (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, cache_bitmap_v3->key2); /* key2 (4 bytes) */
|
|
|
|
|
|
|
|
bitmapData = &cache_bitmap_v3->bitmapData;
|
2011-08-04 07:33:44 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, bitmapData->bpp);
|
2014-05-29 12:12:02 +04:00
|
|
|
if ((bitmapData->bpp < 1) || (bitmapData->bpp > 32))
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "invalid bpp value %d", bitmapData->bpp);
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s); /* reserved1 (1 byte) */
|
|
|
|
Stream_Seek_UINT8(s); /* reserved2 (1 byte) */
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, bitmapData->codecID); /* codecID (1 byte) */
|
|
|
|
Stream_Read_UINT16(s, bitmapData->width); /* width (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, bitmapData->height); /* height (2 bytes) */
|
2015-03-11 08:40:20 +03:00
|
|
|
Stream_Read_UINT32(s, new_len); /* length (4 bytes) */
|
2011-08-04 07:33:44 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
if (Stream_GetRemainingLength(s) < new_len)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2015-03-11 08:40:20 +03:00
|
|
|
new_data = (BYTE*) realloc(bitmapData->data, new_len);
|
|
|
|
if (!new_data)
|
|
|
|
return FALSE;
|
|
|
|
bitmapData->data = new_data;
|
|
|
|
bitmapData->length = new_len;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, bitmapData->data, bitmapData->length);
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_cache_bitmap_v3_order(CACHE_BITMAP_V3_ORDER* cache_bitmap_v3, UINT16* flags)
|
|
|
|
{
|
|
|
|
BITMAP_DATA_EX* bitmapData = &cache_bitmap_v3->bitmapData;
|
|
|
|
return 64 + bitmapData->length;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_cache_bitmap_v3_order(wStream* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3, UINT16* flags)
|
|
|
|
{
|
|
|
|
BYTE bitsPerPixelId;
|
|
|
|
BITMAP_DATA_EX* bitmapData;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, flags)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2015-03-26 19:09:47 +03:00
|
|
|
bitmapData = &cache_bitmap_v3->bitmapData;
|
2013-05-13 01:46:13 +04:00
|
|
|
bitsPerPixelId = BPP_CBR23[cache_bitmap_v3->bpp];
|
|
|
|
|
|
|
|
*flags = (cache_bitmap_v3->cacheId & 0x00000003) |
|
|
|
|
((cache_bitmap_v3->flags << 7) & 0x0000FF80) |
|
|
|
|
((bitsPerPixelId << 3) & 0x00000078);
|
|
|
|
|
|
|
|
Stream_Write_UINT16(s, cache_bitmap_v3->cacheIndex); /* cacheIndex (2 bytes) */
|
|
|
|
Stream_Write_UINT32(s, cache_bitmap_v3->key1); /* key1 (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, cache_bitmap_v3->key2); /* key2 (4 bytes) */
|
|
|
|
|
|
|
|
Stream_Write_UINT8(s, bitmapData->bpp);
|
|
|
|
Stream_Write_UINT8(s, 0); /* reserved1 (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, 0); /* reserved2 (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, bitmapData->codecID); /* codecID (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, bitmapData->width); /* width (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, bitmapData->height); /* height (2 bytes) */
|
|
|
|
Stream_Write_UINT32(s, bitmapData->length); /* length (4 bytes) */
|
|
|
|
|
|
|
|
Stream_Write(s, bitmapData->data, bitmapData->length);
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_read_cache_color_table_order(wStream* s, CACHE_COLOR_TABLE_ORDER* cache_color_table, UINT16 flags)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2011-08-03 11:29:56 +04:00
|
|
|
int i;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32* colorTable;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 3)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-02-04 01:19:25 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT8(s, cache_color_table->cacheIndex); /* cacheIndex (1 byte) */
|
|
|
|
Stream_Read_UINT16(s, cache_color_table->numberColors); /* numberColors (2 bytes) */
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
if (cache_color_table->numberColors != 256)
|
2013-02-04 01:19:25 +04:00
|
|
|
{
|
|
|
|
/* This field MUST be set to 256 */
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-02-04 01:19:25 +04:00
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < cache_color_table->numberColors * 4)
|
2013-02-04 01:19:25 +04:00
|
|
|
return FALSE;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
colorTable = (UINT32*) &cache_color_table->colorTable;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
for (i = 0; i < (int) cache_color_table->numberColors; i++)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
|
|
|
update_read_color_quad(s, &colorTable[i]);
|
|
|
|
}
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_cache_color_table_order(CACHE_COLOR_TABLE_ORDER* cache_color_table, UINT16* flags)
|
|
|
|
{
|
|
|
|
return 16 + (256 * 4);
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_cache_color_table_order(wStream* s, CACHE_COLOR_TABLE_ORDER* cache_color_table, UINT16* flags)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
UINT32* colorTable;
|
|
|
|
|
|
|
|
if (cache_color_table->numberColors != 256)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_color_table_order(cache_color_table, flags)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
Stream_Write_UINT8(s, cache_color_table->cacheIndex); /* cacheIndex (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, cache_color_table->numberColors); /* numberColors (2 bytes) */
|
|
|
|
|
|
|
|
colorTable = (UINT32*) &cache_color_table->colorTable;
|
|
|
|
|
|
|
|
for (i = 0; i < (int) cache_color_table->numberColors; i++)
|
|
|
|
{
|
|
|
|
update_write_color_quad(s, colorTable[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_cache_glyph_order(wStream* s, CACHE_GLYPH_ORDER* cache_glyph_order, UINT16 flags)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2011-08-03 11:29:56 +04:00
|
|
|
int i;
|
2012-10-09 11:01:37 +04:00
|
|
|
INT16 lsi16;
|
2011-08-03 11:29:56 +04:00
|
|
|
GLYPH_DATA* glyph;
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, cache_glyph_order->cacheId); /* cacheId (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, cache_glyph_order->cGlyphs); /* cGlyphs (1 byte) */
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2011-12-04 02:24:18 +04:00
|
|
|
for (i = 0; i < (int) cache_glyph_order->cGlyphs; i++)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
2013-01-29 03:42:32 +04:00
|
|
|
glyph = &cache_glyph_order->glyphData[i];
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 10)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, glyph->cacheIndex);
|
|
|
|
Stream_Read_UINT16(s, lsi16);
|
2011-11-24 00:48:49 +04:00
|
|
|
glyph->x = lsi16;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, lsi16);
|
2011-11-24 00:48:49 +04:00
|
|
|
glyph->y = lsi16;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, glyph->cx);
|
|
|
|
Stream_Read_UINT16(s, glyph->cy);
|
2011-08-03 11:29:56 +04:00
|
|
|
|
|
|
|
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
2011-09-07 21:45:25 +04:00
|
|
|
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < glyph->cb)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
glyph->aj = (BYTE*) malloc(glyph->cb);
|
2015-06-16 16:42:07 +03:00
|
|
|
if (!glyph->aj)
|
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, glyph->aj, glyph->cb);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2011-09-07 21:45:25 +04:00
|
|
|
|
2013-01-29 03:42:32 +04:00
|
|
|
if (flags & CG_GLYPH_UNICODE_PRESENT)
|
|
|
|
{
|
2013-05-09 01:48:30 +04:00
|
|
|
return Stream_SafeSeek(s, cache_glyph_order->cGlyphs * 2);
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_cache_glyph_order(CACHE_GLYPH_ORDER* cache_glyph, UINT16* flags)
|
|
|
|
{
|
|
|
|
return 2 + cache_glyph->cGlyphs * 32;
|
|
|
|
}
|
|
|
|
|
2013-05-08 02:44:22 +04:00
|
|
|
BOOL update_write_cache_glyph_order(wStream* s, CACHE_GLYPH_ORDER* cache_glyph, UINT16* flags)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
INT16 lsi16;
|
|
|
|
GLYPH_DATA* glyph;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_glyph_order(cache_glyph, flags)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, cache_glyph->cacheId); /* cacheId (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, cache_glyph->cGlyphs); /* cGlyphs (1 byte) */
|
2013-05-08 02:44:22 +04:00
|
|
|
|
|
|
|
for (i = 0; i < (int) cache_glyph->cGlyphs; i++)
|
|
|
|
{
|
|
|
|
glyph = &cache_glyph->glyphData[i];
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph->cacheIndex); /* cacheIndex (2 bytes) */
|
2013-05-08 02:44:22 +04:00
|
|
|
|
|
|
|
lsi16 = glyph->x;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, lsi16); /* x (2 bytes) */
|
2013-05-08 02:44:22 +04:00
|
|
|
|
|
|
|
lsi16 = glyph->y;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, lsi16); /* y (2 bytes) */
|
2013-05-08 02:44:22 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, glyph->cx); /* cx (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, glyph->cy); /* cy (2 bytes) */
|
2013-05-08 02:44:22 +04:00
|
|
|
|
|
|
|
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
|
|
|
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
|
|
|
|
|
|
|
|
Stream_Write(s, glyph->aj, glyph->cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*flags & CG_GLYPH_UNICODE_PRESENT)
|
|
|
|
{
|
|
|
|
Stream_Zero(s, cache_glyph->cGlyphs * 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
BOOL update_read_cache_glyph_v2_order(wStream* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2, UINT16 flags)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2011-08-03 11:29:56 +04:00
|
|
|
int i;
|
|
|
|
GLYPH_DATA_V2* glyph;
|
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
cache_glyph_v2->cacheId = (flags & 0x000F);
|
|
|
|
cache_glyph_v2->flags = (flags & 0x00F0) >> 4;
|
|
|
|
cache_glyph_v2->cGlyphs = (flags & 0xFF00) >> 8;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
for (i = 0; i < (int) cache_glyph_v2->cGlyphs; i++)
|
2011-08-03 11:29:56 +04:00
|
|
|
{
|
2013-05-07 19:41:32 +04:00
|
|
|
glyph = &cache_glyph_v2->glyphData[i];
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, glyph->cacheIndex);
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_2byte_signed(s, &glyph->x) ||
|
2013-01-12 03:17:45 +04:00
|
|
|
!update_read_2byte_signed(s, &glyph->y) ||
|
|
|
|
!update_read_2byte_unsigned(s, &glyph->cx) ||
|
|
|
|
!update_read_2byte_unsigned(s, &glyph->cy))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-03 11:29:56 +04:00
|
|
|
|
|
|
|
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
2012-01-05 05:20:58 +04:00
|
|
|
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < glyph->cb)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
glyph->aj = (BYTE*) malloc(glyph->cb);
|
2015-06-16 16:42:07 +03:00
|
|
|
if (!glyph->aj)
|
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read(s, glyph->aj, glyph->cb);
|
2011-08-03 11:29:56 +04:00
|
|
|
}
|
2012-01-05 05:20:58 +04:00
|
|
|
|
2013-01-29 03:42:32 +04:00
|
|
|
if (flags & CG_GLYPH_UNICODE_PRESENT)
|
|
|
|
{
|
2013-05-09 01:48:30 +04:00
|
|
|
return Stream_SafeSeek(s, cache_glyph_v2->cGlyphs * 2);
|
2013-05-07 19:41:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_cache_glyph_v2_order(CACHE_GLYPH_V2_ORDER* cache_glyph_v2, UINT16* flags)
|
|
|
|
{
|
|
|
|
return 8 + cache_glyph_v2->cGlyphs * 32;
|
|
|
|
}
|
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
BOOL update_write_cache_glyph_v2_order(wStream* s, CACHE_GLYPH_V2_ORDER* cache_glyph_v2, UINT16* flags)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
GLYPH_DATA_V2* glyph;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_glyph_v2_order(cache_glyph_v2, flags)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-10 00:30:28 +04:00
|
|
|
|
2013-05-07 19:41:32 +04:00
|
|
|
*flags = (cache_glyph_v2->cacheId & 0x000F) |
|
|
|
|
((cache_glyph_v2->flags & 0x000F) << 4) |
|
|
|
|
((cache_glyph_v2->cGlyphs & 0x00FF) << 8);
|
|
|
|
|
|
|
|
for (i = 0; i < (int) cache_glyph_v2->cGlyphs; i++)
|
|
|
|
{
|
|
|
|
glyph = &cache_glyph_v2->glyphData[i];
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, glyph->cacheIndex);
|
2013-05-07 19:41:32 +04:00
|
|
|
|
|
|
|
if (!update_write_2byte_signed(s, glyph->x) ||
|
|
|
|
!update_write_2byte_signed(s, glyph->y) ||
|
|
|
|
!update_write_2byte_unsigned(s, glyph->cx) ||
|
|
|
|
!update_write_2byte_unsigned(s, glyph->cy))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
|
|
|
|
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
|
2013-05-08 02:44:22 +04:00
|
|
|
Stream_Write(s, glyph->aj, glyph->cb);
|
2013-05-07 19:41:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*flags & CG_GLYPH_UNICODE_PRESENT)
|
|
|
|
{
|
|
|
|
Stream_Zero(s, cache_glyph_v2->cGlyphs * 2);
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_decompress_brush(wStream* s, BYTE* output, BYTE bpp)
|
2011-08-05 21:58:46 +04:00
|
|
|
{
|
|
|
|
int index;
|
|
|
|
int x, y, k;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte = 0;
|
|
|
|
BYTE* palette;
|
2011-12-30 23:23:47 +04:00
|
|
|
int bytesPerPixel;
|
2011-08-05 21:58:46 +04:00
|
|
|
|
2013-05-15 20:14:26 +04:00
|
|
|
palette = Stream_Pointer(s) + 16;
|
2011-12-30 23:23:47 +04:00
|
|
|
bytesPerPixel = ((bpp + 1) / 8);
|
2011-08-05 21:58:46 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 16) // 64 / 4
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-08-05 21:58:46 +04:00
|
|
|
for (y = 7; y >= 0; y--)
|
|
|
|
{
|
|
|
|
for (x = 0; x < 8; x++)
|
|
|
|
{
|
2011-12-30 23:23:47 +04:00
|
|
|
if ((x % 4) == 0)
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-08-05 21:58:46 +04:00
|
|
|
|
2011-12-30 23:23:47 +04:00
|
|
|
index = ((byte >> ((3 - (x % 4)) * 2)) & 0x03);
|
2011-08-05 21:58:46 +04:00
|
|
|
|
2011-12-30 23:23:47 +04:00
|
|
|
for (k = 0; k < bytesPerPixel; k++)
|
2011-08-05 21:58:46 +04:00
|
|
|
{
|
2011-12-30 23:23:47 +04:00
|
|
|
output[((y * 8 + x) * bytesPerPixel) + k] = palette[(index * bytesPerPixel) + k];
|
2011-08-05 21:58:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-08-05 21:58:46 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_compress_brush(wStream* s, BYTE* input, BYTE bpp)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL update_read_cache_brush_order(wStream* s, CACHE_BRUSH_ORDER* cache_brush, UINT16 flags)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2011-08-08 05:12:36 +04:00
|
|
|
int i;
|
2011-08-05 21:58:46 +04:00
|
|
|
int size;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE iBitmapFormat;
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL compressed = FALSE;
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 6)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT8(s, cache_brush->index); /* cacheEntry (1 byte) */
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, iBitmapFormat); /* iBitmapFormat (1 byte) */
|
2013-05-13 01:46:13 +04:00
|
|
|
cache_brush->bpp = BMF_BPP[iBitmapFormat];
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT8(s, cache_brush->cx); /* cx (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, cache_brush->cy); /* cy (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, cache_brush->style); /* style (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, cache_brush->length); /* iBytes (1 byte) */
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
if ((cache_brush->cx == 8) && (cache_brush->cy == 8))
|
2011-08-05 21:58:46 +04:00
|
|
|
{
|
2013-05-13 01:46:13 +04:00
|
|
|
size = (cache_brush->bpp == 1) ? 8 : 8 * 8 * cache_brush->bpp;
|
2011-08-05 21:58:46 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
if (cache_brush->bpp == 1)
|
2011-08-05 21:58:46 +04:00
|
|
|
{
|
2013-05-13 01:46:13 +04:00
|
|
|
if (cache_brush->length != 8)
|
2011-08-05 21:58:46 +04:00
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "incompatible 1bpp brush of length:%d", cache_brush->length);
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE; // should be FALSE ?
|
2011-08-05 21:58:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* rows are encoded in reverse order */
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-03 11:29:56 +04:00
|
|
|
|
2011-08-05 21:58:46 +04:00
|
|
|
for (i = 7; i >= 0; i--)
|
|
|
|
{
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read_UINT8(s, cache_brush->data[i]);
|
2011-08-05 21:58:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-13 01:46:13 +04:00
|
|
|
if ((iBitmapFormat == BMF_8BPP) && (cache_brush->length == 20))
|
2012-10-09 10:31:28 +04:00
|
|
|
compressed = TRUE;
|
2013-05-13 01:46:13 +04:00
|
|
|
else if ((iBitmapFormat == BMF_16BPP) && (cache_brush->length == 24))
|
2012-10-09 10:31:28 +04:00
|
|
|
compressed = TRUE;
|
2013-05-13 01:46:13 +04:00
|
|
|
else if ((iBitmapFormat == BMF_32BPP) && (cache_brush->length == 32))
|
2012-10-09 10:31:28 +04:00
|
|
|
compressed = TRUE;
|
2011-12-30 23:23:47 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
if (compressed != FALSE)
|
2011-08-05 21:58:46 +04:00
|
|
|
{
|
|
|
|
/* compressed brush */
|
2013-05-13 01:46:13 +04:00
|
|
|
if (!update_decompress_brush(s, cache_brush->data, cache_brush->bpp))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-05 21:58:46 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* uncompressed brush */
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 scanline = (cache_brush->bpp / 8) * 8;
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < scanline * 8)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2011-08-08 05:12:36 +04:00
|
|
|
|
|
|
|
for (i = 7; i >= 0; i--)
|
|
|
|
{
|
2013-05-13 01:46:13 +04:00
|
|
|
Stream_Read(s, &cache_brush->data[i * scanline], scanline);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_cache_brush_order(CACHE_BRUSH_ORDER* cache_brush, UINT16* flags)
|
|
|
|
{
|
|
|
|
return 64;
|
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_cache_brush_order(wStream* s, CACHE_BRUSH_ORDER* cache_brush, UINT16* flags)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int size;
|
|
|
|
BYTE iBitmapFormat;
|
|
|
|
BOOL compressed = FALSE;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_cache_brush_order(cache_brush, flags)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
iBitmapFormat = BPP_BMF[cache_brush->bpp];
|
|
|
|
|
|
|
|
Stream_Write_UINT8(s, cache_brush->index); /* cacheEntry (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, iBitmapFormat); /* iBitmapFormat (1 byte) */
|
|
|
|
|
|
|
|
Stream_Write_UINT8(s, cache_brush->cx); /* cx (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, cache_brush->cy); /* cy (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, cache_brush->style); /* style (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, cache_brush->length); /* iBytes (1 byte) */
|
|
|
|
|
|
|
|
if ((cache_brush->cx == 8) && (cache_brush->cy == 8))
|
|
|
|
{
|
|
|
|
size = (cache_brush->bpp == 1) ? 8 : 8 * 8 * cache_brush->bpp;
|
|
|
|
|
|
|
|
if (cache_brush->bpp == 1)
|
|
|
|
{
|
|
|
|
if (cache_brush->length != 8)
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "incompatible 1bpp brush of length:%d", cache_brush->length);
|
2013-05-13 01:46:13 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 7; i >= 0; i--)
|
|
|
|
{
|
|
|
|
Stream_Write_UINT8(s, cache_brush->data[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((iBitmapFormat == BMF_8BPP) && (cache_brush->length == 20))
|
|
|
|
compressed = TRUE;
|
|
|
|
else if ((iBitmapFormat == BMF_16BPP) && (cache_brush->length == 24))
|
|
|
|
compressed = TRUE;
|
|
|
|
else if ((iBitmapFormat == BMF_32BPP) && (cache_brush->length == 32))
|
|
|
|
compressed = TRUE;
|
|
|
|
|
|
|
|
if (compressed != FALSE)
|
|
|
|
{
|
|
|
|
/* compressed brush */
|
|
|
|
if (!update_compress_brush(s, cache_brush->data, cache_brush->bpp))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* uncompressed brush */
|
|
|
|
int scanline = (cache_brush->bpp / 8) * 8;
|
|
|
|
|
|
|
|
for (i = 7; i >= 0; i--)
|
|
|
|
{
|
|
|
|
Stream_Write(s, &cache_brush->data[i * scanline], scanline);
|
2011-08-08 05:12:36 +04:00
|
|
|
}
|
2011-08-05 21:58:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-29 03:42:32 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Alternate Secondary Drawing Orders */
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_create_offscreen_bitmap_order(wStream* s, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 flags;
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL deleteListPresent;
|
2012-01-11 22:24:01 +04:00
|
|
|
OFFSCREEN_DELETE_LIST* deleteList;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 6)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, flags); /* flags (2 bytes) */
|
2011-08-04 11:23:53 +04:00
|
|
|
create_offscreen_bitmap->id = flags & 0x7FFF;
|
2012-10-09 10:31:28 +04:00
|
|
|
deleteListPresent = (flags & 0x8000) ? TRUE : FALSE;
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, create_offscreen_bitmap->cx); /* cx (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, create_offscreen_bitmap->cy); /* cy (2 bytes) */
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2012-01-11 22:24:01 +04:00
|
|
|
deleteList = &(create_offscreen_bitmap->deleteList);
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2011-08-03 00:58:42 +04:00
|
|
|
if (deleteListPresent)
|
|
|
|
{
|
|
|
|
int i;
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, deleteList->cIndices);
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2012-01-01 00:36:04 +04:00
|
|
|
if (deleteList->cIndices > deleteList->sIndices)
|
|
|
|
{
|
2015-03-11 08:40:20 +03:00
|
|
|
UINT16 *new_indices;
|
|
|
|
|
2015-03-15 13:50:10 +03:00
|
|
|
new_indices = (UINT16 *)realloc(deleteList->indices, deleteList->sIndices * 2);
|
2015-03-11 08:40:20 +03:00
|
|
|
if (!new_indices)
|
|
|
|
return FALSE;
|
|
|
|
|
2012-01-01 00:36:04 +04:00
|
|
|
deleteList->sIndices = deleteList->cIndices;
|
2015-03-11 08:40:20 +03:00
|
|
|
deleteList->indices = new_indices;
|
2012-01-01 00:36:04 +04:00
|
|
|
}
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2 * deleteList->cIndices)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-12-04 02:24:18 +04:00
|
|
|
for (i = 0; i < (int) deleteList->cIndices; i++)
|
2011-08-03 00:58:42 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, deleteList->indices[i]);
|
2011-08-03 00:58:42 +04:00
|
|
|
}
|
|
|
|
}
|
2012-01-11 22:24:01 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
deleteList->cIndices = 0;
|
|
|
|
}
|
2013-05-12 21:42:53 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_create_offscreen_bitmap_order(CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
|
|
|
|
{
|
|
|
|
OFFSCREEN_DELETE_LIST* deleteList = &(create_offscreen_bitmap->deleteList);
|
2013-07-29 18:21:32 +04:00
|
|
|
return 32 + deleteList->cIndices * 2;
|
2013-06-10 01:56:57 +04:00
|
|
|
}
|
|
|
|
|
2013-05-12 21:42:53 +04:00
|
|
|
BOOL update_write_create_offscreen_bitmap_order(wStream* s, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap)
|
|
|
|
{
|
|
|
|
UINT16 flags;
|
|
|
|
BOOL deleteListPresent;
|
|
|
|
OFFSCREEN_DELETE_LIST* deleteList;
|
|
|
|
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_create_offscreen_bitmap_order(create_offscreen_bitmap)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2015-03-26 19:09:47 +03:00
|
|
|
deleteList = &(create_offscreen_bitmap->deleteList);
|
2013-05-12 21:42:53 +04:00
|
|
|
|
|
|
|
flags = create_offscreen_bitmap->id & 0x7FFF;
|
|
|
|
|
|
|
|
deleteListPresent = (deleteList->cIndices > 0) ? TRUE : FALSE;
|
|
|
|
|
|
|
|
if (deleteListPresent)
|
|
|
|
flags |= 0x8000;
|
|
|
|
|
|
|
|
Stream_Write_UINT16(s, flags); /* flags (2 bytes) */
|
|
|
|
|
|
|
|
Stream_Write_UINT16(s, create_offscreen_bitmap->cx); /* cx (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, create_offscreen_bitmap->cy); /* cy (2 bytes) */
|
|
|
|
|
|
|
|
if (deleteListPresent)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
Stream_Write_UINT16(s, deleteList->cIndices);
|
|
|
|
|
|
|
|
for (i = 0; i < (int) deleteList->cIndices; i++)
|
|
|
|
{
|
|
|
|
Stream_Write_UINT16(s, deleteList->indices[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_switch_surface_order(wStream* s, SWITCH_SURFACE_ORDER* switch_surface)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */
|
2013-05-12 21:42:53 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-06-10 01:56:57 +04:00
|
|
|
int update_approximate_switch_surface_order(SWITCH_SURFACE_ORDER* switch_surface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2013-05-12 21:42:53 +04:00
|
|
|
BOOL update_write_switch_surface_order(wStream* s, SWITCH_SURFACE_ORDER* switch_surface)
|
|
|
|
{
|
2015-03-30 18:15:45 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, update_approximate_switch_surface_order(switch_surface)))
|
2015-03-26 19:09:47 +03:00
|
|
|
return FALSE;
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2013-06-10 04:37:58 +04:00
|
|
|
Stream_Write_UINT16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_create_nine_grid_bitmap_order(wStream* s, CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2011-08-03 00:58:42 +04:00
|
|
|
NINE_GRID_BITMAP_INFO* nineGridInfo;
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 19)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-12 21:42:53 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, create_nine_grid_bitmap->bitmapBpp); /* bitmapBpp (1 byte) */
|
2014-05-29 12:12:02 +04:00
|
|
|
if ((create_nine_grid_bitmap->bitmapBpp < 1) || (create_nine_grid_bitmap->bitmapBpp > 32))
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "invalid bpp value %d", create_nine_grid_bitmap->bitmapBpp);
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, create_nine_grid_bitmap->bitmapId); /* bitmapId (2 bytes) */
|
2011-08-03 00:58:42 +04:00
|
|
|
|
|
|
|
nineGridInfo = &(create_nine_grid_bitmap->nineGridInfo);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, nineGridInfo->flFlags); /* flFlags (4 bytes) */
|
|
|
|
Stream_Read_UINT16(s, nineGridInfo->ulLeftWidth); /* ulLeftWidth (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, nineGridInfo->ulRightWidth); /* ulRightWidth (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, nineGridInfo->ulTopHeight); /* ulTopHeight (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, nineGridInfo->ulBottomHeight); /* ulBottomHeight (2 bytes) */
|
2011-08-03 00:58:42 +04:00
|
|
|
update_read_colorref(s, &nineGridInfo->crTransparent); /* crTransparent (4 bytes) */
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_frame_marker_order(wStream* s, FRAME_MARKER_ORDER* frame_marker)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, frame_marker->action); /* action (4 bytes) */
|
2013-06-10 01:56:57 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_frame_marker_order(wStream* s, FRAME_MARKER_ORDER* frame_marker)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_stream_bitmap_first_order(wStream* s, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 10) // 8 + 2 at least
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, stream_bitmap_first->bitmapFlags); /* bitmapFlags (1 byte) */
|
|
|
|
Stream_Read_UINT8(s, stream_bitmap_first->bitmapBpp); /* bitmapBpp (1 byte) */
|
2014-05-29 12:12:02 +04:00
|
|
|
if ((stream_bitmap_first->bitmapBpp < 1) || (stream_bitmap_first->bitmapBpp > 32))
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "invalid bpp value %d", stream_bitmap_first->bitmapBpp);
|
2014-05-29 12:12:02 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, stream_bitmap_first->bitmapType); /* bitmapType (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, stream_bitmap_first->bitmapWidth); /* bitmapWidth (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, stream_bitmap_first->bitmapHeight); /* bitmapHeigth (2 bytes) */
|
2011-08-03 00:58:42 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
if (stream_bitmap_first->bitmapFlags & STREAM_BITMAP_V2)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, stream_bitmap_first->bitmapSize); /* bitmapSize (4 bytes) */
|
2013-05-13 01:46:13 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, stream_bitmap_first->bitmapSize); /* bitmapSize (2 bytes) */
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2011-07-26 00:54:15 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
FIELD_SKIP_BUFFER16(s, stream_bitmap_first->bitmapBlockSize); /* bitmapBlockSize(2 bytes) + bitmapBlock */
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL update_write_stream_bitmap_first_order(wStream* s, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first)
|
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_stream_bitmap_next_order(wStream* s, STREAM_BITMAP_NEXT_ORDER* stream_bitmap_next)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 5)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, stream_bitmap_next->bitmapFlags); /* bitmapFlags (1 byte) */
|
|
|
|
Stream_Read_UINT16(s, stream_bitmap_next->bitmapType); /* bitmapType (2 bytes) */
|
2013-01-12 03:17:45 +04:00
|
|
|
FIELD_SKIP_BUFFER16(s, stream_bitmap_next->bitmapBlockSize); /* bitmapBlockSize(2 bytes) + bitmapBlock */
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL update_write_stream_bitmap_next_order(wStream* s, STREAM_BITMAP_NEXT_ORDER* stream_bitmap_next)
|
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_draw_gdiplus_first_order(wStream* s, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 11)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_first->cbSize); /* cbSize (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, draw_gdiplus_first->cbTotalSize); /* cbTotalSize (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, draw_gdiplus_first->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
return Stream_SafeSeek(s, draw_gdiplus_first->cbSize); /* emfRecords */
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_draw_gdiplus_first_order(wStream* s, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_draw_gdiplus_next_order(wStream* s, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 3)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
|
2013-01-12 03:17:45 +04:00
|
|
|
FIELD_SKIP_BUFFER16(s, draw_gdiplus_next->cbSize); /* cbSize(2 bytes) + emfRecords */
|
2013-05-13 01:46:13 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL update_write_draw_gdiplus_next_order(wStream* s, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next)
|
|
|
|
{
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_draw_gdiplus_end_order(wStream* s, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 11)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:27:21 +04:00
|
|
|
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_end->cbSize); /* cbSize (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, draw_gdiplus_end->cbTotalSize); /* cbTotalSize (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, draw_gdiplus_end->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
return Stream_SafeSeek(s, draw_gdiplus_end->cbSize); /* emfRecords */
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_draw_gdiplus_end_order(wStream* s, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_draw_gdiplus_cache_first_order(wStream* s, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 11)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, draw_gdiplus_cache_first->flags); /* flags (1 byte) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_first->cacheType); /* cacheType (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_first->cacheIndex); /* cacheIndex (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_first->cbSize); /* cbSize (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, draw_gdiplus_cache_first->cbTotalSize); /* cbTotalSize (4 bytes) */
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
return Stream_SafeSeek(s, draw_gdiplus_cache_first->cbSize); /* emfRecords */
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_draw_gdiplus_cache_first_order(wStream* s, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_draw_gdiplus_cache_next_order(wStream* s, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 7)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, draw_gdiplus_cache_next->flags); /* flags (1 byte) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_next->cacheType); /* cacheType (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_next->cacheIndex); /* cacheIndex (2 bytes) */
|
2013-01-12 03:17:45 +04:00
|
|
|
FIELD_SKIP_BUFFER16(s, draw_gdiplus_cache_next->cbSize); /* cbSize(2 bytes) + emfRecords */
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2013-05-13 01:46:13 +04:00
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_draw_gdiplus_cache_next_order(wStream* s, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next)
|
|
|
|
{
|
|
|
|
return TRUE;
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_draw_gdiplus_cache_end_order(wStream* s, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end)
|
2011-07-26 00:54:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 11)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-13 01:46:13 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, draw_gdiplus_cache_end->flags); /* flags (1 byte) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_end->cacheType); /* cacheType (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_end->cacheIndex); /* cacheIndex (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, draw_gdiplus_cache_end->cbSize); /* cbSize (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, draw_gdiplus_cache_end->cbTotalSize); /* cbTotalSize (4 bytes) */
|
2013-01-12 03:17:45 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
return Stream_SafeSeek(s, draw_gdiplus_cache_end->cbSize); /* emfRecords */
|
2011-07-26 00:54:15 +04:00
|
|
|
}
|
|
|
|
|
2013-05-13 01:46:13 +04:00
|
|
|
BOOL update_write_draw_gdiplus_cache_end_order(wStream* s, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_field_flags(wStream* s, UINT32* fieldFlags, BYTE flags, BYTE fieldBytes)
|
2011-07-26 07:51:13 +04:00
|
|
|
{
|
|
|
|
int i;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE byte;
|
2011-07-26 07:51:13 +04:00
|
|
|
|
|
|
|
if (flags & ORDER_ZERO_FIELD_BYTE_BIT0)
|
|
|
|
fieldBytes--;
|
|
|
|
|
|
|
|
if (flags & ORDER_ZERO_FIELD_BYTE_BIT1)
|
|
|
|
{
|
2011-08-08 05:12:36 +04:00
|
|
|
if (fieldBytes > 1)
|
2011-07-26 07:51:13 +04:00
|
|
|
fieldBytes -= 2;
|
2011-08-08 05:12:36 +04:00
|
|
|
else
|
|
|
|
fieldBytes = 0;
|
2011-07-26 07:51:13 +04:00
|
|
|
}
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < fieldBytes)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
|
2011-07-26 07:51:13 +04:00
|
|
|
*fieldFlags = 0;
|
|
|
|
for (i = 0; i < fieldBytes; i++)
|
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, byte);
|
2011-07-26 07:51:13 +04:00
|
|
|
*fieldFlags |= byte << (i * 8);
|
|
|
|
}
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 07:51:13 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 23:33:52 +04:00
|
|
|
BOOL update_write_field_flags(wStream* s, UINT32 fieldFlags, BYTE flags, BYTE fieldBytes)
|
|
|
|
{
|
|
|
|
BYTE byte;
|
|
|
|
|
2013-05-08 01:40:54 +04:00
|
|
|
if (fieldBytes == 1)
|
2013-05-07 23:33:52 +04:00
|
|
|
{
|
2013-05-08 01:40:54 +04:00
|
|
|
byte = fieldFlags & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-07 23:33:52 +04:00
|
|
|
}
|
2013-05-08 01:40:54 +04:00
|
|
|
else if (fieldBytes == 2)
|
|
|
|
{
|
|
|
|
byte = fieldFlags & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-08 01:40:54 +04:00
|
|
|
byte = (fieldFlags >> 8) & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-08 01:40:54 +04:00
|
|
|
}
|
|
|
|
else if (fieldBytes == 3)
|
|
|
|
{
|
|
|
|
byte = fieldFlags & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-08 01:40:54 +04:00
|
|
|
byte = (fieldFlags >> 8) & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-08 01:40:54 +04:00
|
|
|
byte = (fieldFlags >> 16) & 0xFF;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, byte);
|
2013-05-08 01:40:54 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-05-07 23:33:52 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_read_bounds(wStream* s, rdpBounds* bounds)
|
2011-07-26 07:51:13 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE flags;
|
2011-07-26 07:51:13 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2013-05-10 03:41:32 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, flags); /* field flags */
|
2011-07-26 07:51:13 +04:00
|
|
|
|
2011-08-05 10:19:17 +04:00
|
|
|
if (flags & BOUND_LEFT)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
if (!update_read_coord(s, &bounds->left, FALSE))
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-05 10:19:17 +04:00
|
|
|
else if (flags & BOUND_DELTA_LEFT)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
if (!update_read_coord(s, &bounds->left, TRUE))
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-05 10:19:17 +04:00
|
|
|
|
|
|
|
if (flags & BOUND_TOP)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
if (!update_read_coord(s, &bounds->top, FALSE))
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-05 10:19:17 +04:00
|
|
|
else if (flags & BOUND_DELTA_TOP)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_coord(s, &bounds->top, TRUE))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-05 10:19:17 +04:00
|
|
|
|
|
|
|
if (flags & BOUND_RIGHT)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_coord(s, &bounds->right, FALSE))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-05 10:19:17 +04:00
|
|
|
else if (flags & BOUND_DELTA_RIGHT)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_coord(s, &bounds->right, TRUE))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-05 10:19:17 +04:00
|
|
|
|
|
|
|
if (flags & BOUND_BOTTOM)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_coord(s, &bounds->bottom, FALSE))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2011-08-05 10:19:17 +04:00
|
|
|
else if (flags & BOUND_DELTA_BOTTOM)
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_coord(s, &bounds->bottom, TRUE))
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-05-10 03:41:32 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL update_write_bounds(wStream* s, ORDER_INFO* orderInfo)
|
|
|
|
{
|
|
|
|
if (!(orderInfo->controlFlags & ORDER_BOUNDS))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (orderInfo->controlFlags & ORDER_ZERO_BOUNDS_DELTAS)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
Stream_Write_UINT8(s, orderInfo->boundsFlags); /* field flags */
|
|
|
|
|
|
|
|
if (orderInfo->boundsFlags & BOUND_LEFT)
|
|
|
|
{
|
|
|
|
if (!update_write_coord(s, orderInfo->bounds.left))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (orderInfo->boundsFlags & BOUND_DELTA_LEFT)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->boundsFlags & BOUND_TOP)
|
|
|
|
{
|
|
|
|
if (!update_write_coord(s, orderInfo->bounds.top))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (orderInfo->boundsFlags & BOUND_DELTA_TOP)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->boundsFlags & BOUND_RIGHT)
|
|
|
|
{
|
|
|
|
if (!update_write_coord(s, orderInfo->bounds.right))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (orderInfo->boundsFlags & BOUND_DELTA_RIGHT)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->boundsFlags & BOUND_BOTTOM)
|
|
|
|
{
|
|
|
|
if (!update_write_coord(s, orderInfo->bounds.bottom))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (orderInfo->boundsFlags & BOUND_DELTA_BOTTOM)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-26 07:51:13 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2011-11-22 03:11:43 +04:00
|
|
|
ORDER_INFO* orderInfo;
|
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpPrimaryUpdate* primary = update->primary;
|
|
|
|
|
|
|
|
orderInfo = &(primary->order_info);
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-07-26 07:51:13 +04:00
|
|
|
if (flags & ORDER_TYPE_CHANGE)
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, orderInfo->orderType); /* orderType (1 byte) */
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2012-02-11 17:30:09 +04:00
|
|
|
if (orderInfo->orderType >= PRIMARY_DRAWING_ORDER_COUNT)
|
|
|
|
{
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "Invalid Primary Drawing Order (0x%02X)", orderInfo->orderType);
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2012-02-11 17:30:09 +04:00
|
|
|
}
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_field_flags(s, &(orderInfo->fieldFlags), flags,
|
|
|
|
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType]))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "update_read_field_flags() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-07-26 07:51:13 +04:00
|
|
|
if (flags & ORDER_BOUNDS)
|
|
|
|
{
|
|
|
|
if (!(flags & ORDER_ZERO_BOUNDS_DELTAS))
|
2013-01-12 03:17:45 +04:00
|
|
|
{
|
|
|
|
if (!update_read_bounds(s, &orderInfo->bounds))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "update_read_bounds() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
}
|
2011-07-28 22:32:16 +04:00
|
|
|
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->SetBounds, context, &orderInfo->bounds);
|
2011-07-26 07:51:13 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
orderInfo->deltaCoordinates = (flags & ORDER_DELTA_COORDINATES) ? TRUE : FALSE;
|
2011-07-26 07:51:13 +04:00
|
|
|
|
2011-08-21 22:54:08 +04:00
|
|
|
#ifdef WITH_DEBUG_ORDERS
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_DBG(TAG, "%s Primary Drawing Order (0x%02X)", PRIMARY_DRAWING_ORDER_STRINGS[orderInfo->orderType], orderInfo->orderType);
|
2011-08-17 22:13:44 +04:00
|
|
|
#endif
|
2011-07-26 07:51:13 +04:00
|
|
|
|
|
|
|
switch (orderInfo->orderType)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
|
|
|
case ORDER_TYPE_DSTBLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_dstblt_order(s, orderInfo, &(primary->dstblt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_DSTBLT - update_read_dstblt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DstBlt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->DstBlt, context, &primary->dstblt);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_PATBLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_patblt_order(s, orderInfo, &(primary->patblt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_PATBLT - update_read_patblt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "PatBlt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->PatBlt, context, &primary->patblt);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_SCRBLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_scrblt_order(s, orderInfo, &(primary->scrblt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_SCRBLT - update_read_scrblt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "ScrBlt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->ScrBlt, context, &primary->scrblt);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_OPAQUE_RECT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_opaque_rect_order(s, orderInfo, &(primary->opaque_rect)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_OPAQUE_RECT - update_read_opaque_rect_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "OpaqueRect");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->OpaqueRect, context, &primary->opaque_rect);
|
2011-08-02 20:59:45 +04:00
|
|
|
break;
|
|
|
|
|
2011-07-26 00:54:15 +04:00
|
|
|
case ORDER_TYPE_DRAW_NINE_GRID:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_draw_nine_grid_order(s, orderInfo, &(primary->draw_nine_grid)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_DRAW_NINE_GRID - update_read_draw_nine_grid_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DrawNineGrid");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->DrawNineGrid, context, &primary->draw_nine_grid);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_MULTI_DSTBLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_multi_dstblt_order(s, orderInfo, &(primary->multi_dstblt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_MULTI_DSTBLT - update_read_multi_dstblt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "MultiDstBlt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->MultiDstBlt, context, &primary->multi_dstblt);
|
2011-08-02 20:59:45 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_MULTI_PATBLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_multi_patblt_order(s, orderInfo, &(primary->multi_patblt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_MULTI_PATBLT - update_read_multi_patblt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "MultiPatBlt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->MultiPatBlt, context, &primary->multi_patblt);
|
2011-08-02 20:59:45 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_MULTI_SCRBLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_multi_scrblt_order(s, orderInfo, &(primary->multi_scrblt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_MULTI_SCRBLT - update_read_multi_scrblt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "MultiScrBlt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->MultiScrBlt, context, &primary->multi_scrblt);
|
2011-08-02 20:59:45 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_MULTI_OPAQUE_RECT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_multi_opaque_rect_order(s, orderInfo, &(primary->multi_opaque_rect)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_MULTI_OPAQUE_RECT - update_read_multi_opaque_rect_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "MultiOpaqueRect");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->MultiOpaqueRect, context, &primary->multi_opaque_rect);
|
2011-08-02 20:59:45 +04:00
|
|
|
break;
|
|
|
|
|
2011-07-26 00:54:15 +04:00
|
|
|
case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_multi_draw_nine_grid_order(s, orderInfo, &(primary->multi_draw_nine_grid)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_MULTI_DRAW_NINE_GRID - update_read_multi_draw_nine_grid_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "MultiDrawNineGrid");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-07-26 00:54:15 +04:00
|
|
|
case ORDER_TYPE_LINE_TO:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_line_to_order(s, orderInfo, &(primary->line_to)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_LINE_TO - update_read_line_to_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "LineTo");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->LineTo, context, &primary->line_to);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_POLYLINE:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_polyline_order(s, orderInfo, &(primary->polyline)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_POLYLINE - update_read_polyline_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "Polyline");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->Polyline, context, &primary->polyline);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_MEMBLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_memblt_order(s, orderInfo, &(primary->memblt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_MEMBLT - update_read_memblt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "MemBlt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->MemBlt, context, &primary->memblt);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_MEM3BLT:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_mem3blt_order(s, orderInfo, &(primary->mem3blt)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_MEM3BLT - update_read_mem3blt_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "Mem3Blt");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->Mem3Blt, context, &primary->mem3blt);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_SAVE_BITMAP:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_save_bitmap_order(s, orderInfo, &(primary->save_bitmap)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_SAVE_BITMAP - update_read_save_bitmap_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "SaveBitmap");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->SaveBitmap, context, &primary->save_bitmap);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-03 11:29:56 +04:00
|
|
|
case ORDER_TYPE_GLYPH_INDEX:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_glyph_index_order(s, orderInfo, &(primary->glyph_index)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_GLYPH_INDEX - update_read_glyph_index_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "GlyphIndex");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->GlyphIndex, context, &primary->glyph_index);
|
2011-08-03 11:29:56 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_FAST_INDEX:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_fast_index_order(s, orderInfo, &(primary->fast_index)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_FAST_INDEX - update_read_fast_index_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "FastIndex");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->FastIndex, context, &primary->fast_index);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_FAST_GLYPH:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_fast_glyph_order(s, orderInfo, &(primary->fast_glyph)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_FAST_GLYPH - update_read_fast_glyph_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "FastGlyph");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->FastGlyph, context, &primary->fast_glyph);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_POLYGON_SC:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_polygon_sc_order(s, orderInfo, &(primary->polygon_sc)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_POLYGON_SC - update_read_polygon_sc_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "PolygonSC");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->PolygonSC, context, &primary->polygon_sc);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_POLYGON_CB:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_polygon_cb_order(s, orderInfo, &(primary->polygon_cb)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_POLYGON_CB - update_read_polygon_cb_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "PolygonCB");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->PolygonCB, context, &primary->polygon_cb);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_ELLIPSE_SC:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_ellipse_sc_order(s, orderInfo, &(primary->ellipse_sc)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_ELLIPSE_SC - update_read_ellipse_sc_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "EllipseSC");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->EllipseSC, context, &primary->ellipse_sc);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_ELLIPSE_CB:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_ellipse_cb_order(s, orderInfo, &(primary->ellipse_cb)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_ELLIPSE_CB - update_read_ellipse_cb_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "EllipseCB");
|
2011-11-22 03:11:43 +04:00
|
|
|
IFCALL(primary->EllipseCB, context, &primary->ellipse_cb);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2011-07-28 22:32:16 +04:00
|
|
|
|
|
|
|
if (flags & ORDER_BOUNDS)
|
2011-08-05 10:19:17 +04:00
|
|
|
{
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(update->SetBounds, context, NULL);
|
2011-08-05 10:19:17 +04:00
|
|
|
}
|
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_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE* next;
|
|
|
|
BYTE orderType;
|
|
|
|
UINT16 extraFlags;
|
|
|
|
UINT16 orderLength;
|
2011-11-22 04:41:49 +04:00
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpSecondaryUpdate* secondary = update->secondary;
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 5)
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 5");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-05-08 01:40:54 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
|
|
|
Stream_Read_UINT8(s, orderType); /* orderType (1 byte) */
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-05-15 20:14:26 +04:00
|
|
|
next = Stream_Pointer(s) + ((INT16) orderLength) + 7;
|
2011-07-26 07:51:13 +04:00
|
|
|
|
2011-08-21 22:54:08 +04:00
|
|
|
#ifdef WITH_DEBUG_ORDERS
|
2011-08-03 00:58:42 +04:00
|
|
|
if (orderType < SECONDARY_DRAWING_ORDER_COUNT)
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_DBG(TAG, "%s Secondary Drawing Order (0x%02X)", SECONDARY_DRAWING_ORDER_STRINGS[orderType], orderType);
|
2011-08-03 00:58:42 +04:00
|
|
|
else
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_DBG(TAG, "Unknown Secondary Drawing Order (0x%02X)", orderType);
|
2011-08-17 22:13:44 +04:00
|
|
|
#endif
|
2011-07-25 09:45:25 +04:00
|
|
|
|
|
|
|
switch (orderType)
|
|
|
|
{
|
|
|
|
case ORDER_TYPE_BITMAP_UNCOMPRESSED:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), FALSE, extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED - update_read_cache_bitmap_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressed");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_CACHE_BITMAP_COMPRESSED:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), TRUE, extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_CACHE_BITMAP_COMPRESSED - update_read_cache_bitmap_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressed");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), FALSE, extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressedV2");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_BITMAP_COMPRESSED_V2:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), TRUE, extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV2");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_BITMAP_COMPRESSED_V3:
|
2013-05-13 01:46:13 +04:00
|
|
|
if (!update_read_cache_bitmap_v3_order(s, &(secondary->cache_bitmap_v3_order), extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V3 - update_read_cache_bitmap_v3_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV3");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheBitmapV3, context, &(secondary->cache_bitmap_v3_order));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_CACHE_COLOR_TABLE:
|
2013-01-12 03:17:45 +04:00
|
|
|
if (!update_read_cache_color_table_order(s, &(secondary->cache_color_table_order), extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_CACHE_COLOR_TABLE - update_read_cache_color_table_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheColorTable");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheColorTable, context, &(secondary->cache_color_table_order));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_CACHE_GLYPH:
|
2011-11-22 04:41:49 +04:00
|
|
|
if (secondary->glyph_v2)
|
2011-08-02 20:59:45 +04:00
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_cache_glyph_v2_order(s, &(secondary->cache_glyph_v2_order), extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_v2_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheGlyphV2");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheGlyphV2, context, &(secondary->cache_glyph_v2_order));
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_cache_glyph_order(s, &(secondary->cache_glyph_order), extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheGlyph");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheGlyph, context, &(secondary->cache_glyph_order));
|
2011-08-02 20:59:45 +04:00
|
|
|
}
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_CACHE_BRUSH:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_cache_brush_order(s, &(secondary->cache_brush_order), extraFlags))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_CACHE_BRUSH - update_read_cache_brush_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CacheBrush");
|
2011-11-22 04:41:49 +04:00
|
|
|
IFCALL(secondary->CacheBrush, context, &(secondary->cache_brush_order));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2011-07-26 07:51:13 +04:00
|
|
|
|
2013-05-15 20:14:26 +04:00
|
|
|
Stream_Pointer(s) = next;
|
|
|
|
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE orderType;
|
2011-11-22 04:53:38 +04:00
|
|
|
rdpContext* context = update->context;
|
|
|
|
rdpAltSecUpdate* altsec = update->altsec;
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-07-26 07:51:13 +04:00
|
|
|
orderType = flags >>= 2; /* orderType is in higher 6 bits of flags field */
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-08-21 22:54:08 +04:00
|
|
|
#ifdef WITH_DEBUG_ORDERS
|
2011-08-03 00:58:42 +04:00
|
|
|
if (orderType < ALTSEC_DRAWING_ORDER_COUNT)
|
2015-03-19 02:41:29 +03:00
|
|
|
WLog_DBG(TAG, "%s Alternate Secondary Drawing Order (0x%02X)", ALTSEC_DRAWING_ORDER_STRINGS[orderType], orderType);
|
2011-08-03 00:58:42 +04:00
|
|
|
else
|
2015-03-19 02:41:29 +03:00
|
|
|
WLog_DBG(TAG, "Unknown Alternate Secondary Drawing Order: 0x%02X", orderType);
|
2011-08-17 22:13:44 +04:00
|
|
|
#endif
|
2011-07-25 09:45:25 +04:00
|
|
|
|
|
|
|
switch (orderType)
|
|
|
|
{
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_CREATE_OFFSCREEN_BITMAP - update_read_create_offscreen_bitmap_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CreateOffscreenBitmap");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->CreateOffscreenBitmap, context, &(altsec->create_offscreen_bitmap));
|
2011-08-02 20:59:45 +04:00
|
|
|
break;
|
|
|
|
|
2011-07-25 09:45:25 +04:00
|
|
|
case ORDER_TYPE_SWITCH_SURFACE:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_switch_surface_order(s, &(altsec->switch_surface)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_SWITCH_SURFACE - update_read_switch_surface_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "SwitchSurface");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->SwitchSurface, context, &(altsec->switch_surface));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_CREATE_NINE_GRID_BITMAP:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_CREATE_NINE_GRID_BITMAP - update_read_create_nine_grid_bitmap_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "CreateNineGridBitmap");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->CreateNineGridBitmap, context, &(altsec->create_nine_grid_bitmap));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_FRAME_MARKER:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_frame_marker_order(s, &(altsec->frame_marker)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_FRAME_MARKER - update_read_frame_marker_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "AltSecFrameMarker: action: %s (%d)",
|
|
|
|
(!altsec->frame_marker.action) ? "Begin" : "End", altsec->frame_marker.action);
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->FrameMarker, context, &(altsec->frame_marker));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_STREAM_BITMAP_FIRST:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_STREAM_BITMAP_FIRST - update_read_stream_bitmap_first_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapFirst");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->StreamBitmapFirst, context, &(altsec->stream_bitmap_first));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-02 20:59:45 +04:00
|
|
|
case ORDER_TYPE_STREAM_BITMAP_NEXT:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_STREAM_BITMAP_NEXT - update_read_stream_bitmap_next_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapNext");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->StreamBitmapNext, context, &(altsec->stream_bitmap_next));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_GDIPLUS_FIRST:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_GDIPLUS_FIRST - update_read_draw_gdiplus_first_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusFirst");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->DrawGdiPlusFirst, context, &(altsec->draw_gdiplus_first));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_GDIPLUS_NEXT:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_GDIPLUS_NEXT - update_read_draw_gdiplus_next_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusNext");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->DrawGdiPlusNext, context, &(altsec->draw_gdiplus_next));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_GDIPLUS_END:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_GDIPLUS_END - update_read_draw_gdiplus_end_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusEnd");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->DrawGdiPlusEnd, context, &(altsec->draw_gdiplus_end));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_GDIPLUS_CACHE_FIRST:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_GDIPLUS_CACHE_FIRST - update_read_draw_gdiplus_cache_first_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheFirst");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->DrawGdiPlusCacheFirst, context, &(altsec->draw_gdiplus_cache_first));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_GDIPLUS_CACHE_NEXT:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_GDIPLUS_CACHE_NEXT - update_read_draw_gdiplus_cache_next_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheNext");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->DrawGdiPlusCacheNext, context, &(altsec->draw_gdiplus_cache_next));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_GDIPLUS_CACHE_END:
|
2013-01-19 01:50:25 +04:00
|
|
|
if (!update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end)))
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "ORDER_TYPE_GDIPLUS_CACHE_END - update_read_draw_gdiplus_cache_end_order() failed");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-10-10 21:00:04 +04:00
|
|
|
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheEnd");
|
2011-11-22 04:53:38 +04:00
|
|
|
IFCALL(altsec->DrawGdiPlusCacheEnd, context, &(altsec->draw_gdiplus_cache_end));
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_WINDOW:
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_recv_altsec_window_order(update, s);
|
2011-07-25 09:45:25 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ORDER_TYPE_COMPDESK_FIRST:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-01-12 03:17:45 +04:00
|
|
|
return TRUE;
|
2011-07-25 09:45:25 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL update_recv_order(rdpUpdate* update, wStream* s)
|
2011-07-25 09:45:25 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE controlFlags;
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 1)
|
2015-05-02 06:26:08 +03:00
|
|
|
{
|
2015-06-23 12:08:44 +03:00
|
|
|
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 1");
|
2013-01-12 03:17:45 +04:00
|
|
|
return FALSE;
|
2015-03-19 02:41:29 +03:00
|
|
|
}
|
2013-01-19 01:50:25 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT8(s, controlFlags); /* controlFlags (1 byte) */
|
2011-07-25 09:45:25 +04:00
|
|
|
|
2011-08-05 00:22:15 +04:00
|
|
|
if (!(controlFlags & ORDER_STANDARD))
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_recv_altsec_order(update, s, controlFlags);
|
2011-08-05 00:22:15 +04:00
|
|
|
else if (controlFlags & ORDER_SECONDARY)
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_recv_secondary_order(update, s, controlFlags);
|
2011-08-05 00:22:15 +04:00
|
|
|
else
|
2013-01-12 03:17:45 +04:00
|
|
|
return update_recv_primary_order(update, s, controlFlags);
|
2011-07-27 00:58:10 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2012-02-11 17:30:09 +04:00
|
|
|
}
|