22 #include <freerdp/config.h>
26 #include <winpr/wtypes.h>
27 #include <winpr/crt.h>
28 #include <winpr/assert.h>
30 #include <freerdp/api.h>
31 #include <freerdp/log.h>
32 #include <freerdp/graphics.h>
33 #include <freerdp/codec/bitmap.h>
34 #include <freerdp/gdi/gdi.h>
39 #include "../cache/glyph.h"
40 #include "../cache/bitmap.h"
41 #include "../cache/brush.h"
42 #include "../cache/cache.h"
44 #define TAG FREERDP_TAG("core.orders")
46 static inline const char* gdi_rob3_code_string_checked(UINT32 rob)
48 WINPR_ASSERT((rob) <= UINT8_MAX);
49 return gdi_rop3_code_string((BYTE)rob);
52 static inline DWORD gdi_rop3_code_checked(UINT32 code)
54 WINPR_ASSERT(code <= UINT8_MAX);
55 return gdi_rop3_code((UINT8)code);
58 static const char primary_order_str[] =
"Primary Drawing Order";
59 static const char secondary_order_str[] =
"Secondary Drawing Order";
60 static const char alt_sec_order_str[] =
"Alternate Secondary Drawing Order";
62 BYTE get_primary_drawing_order_field_bytes(UINT32 orderType, BOOL* pValid)
69 return DSTBLT_ORDER_FIELD_BYTES;
71 return PATBLT_ORDER_FIELD_BYTES;
73 return SCRBLT_ORDER_FIELD_BYTES;
83 return DRAW_NINE_GRID_ORDER_FIELD_BYTES;
85 return MULTI_DRAW_NINE_GRID_ORDER_FIELD_BYTES;
87 return LINE_TO_ORDER_FIELD_BYTES;
89 return OPAQUE_RECT_ORDER_FIELD_BYTES;
91 return SAVE_BITMAP_ORDER_FIELD_BYTES;
95 return MEMBLT_ORDER_FIELD_BYTES;
97 return MEM3BLT_ORDER_FIELD_BYTES;
99 return MULTI_DSTBLT_ORDER_FIELD_BYTES;
101 return MULTI_PATBLT_ORDER_FIELD_BYTES;
103 return MULTI_SCRBLT_ORDER_FIELD_BYTES;
105 return MULTI_OPAQUE_RECT_ORDER_FIELD_BYTES;
107 return FAST_INDEX_ORDER_FIELD_BYTES;
109 return POLYGON_SC_ORDER_FIELD_BYTES;
111 return POLYGON_CB_ORDER_FIELD_BYTES;
113 return POLYLINE_ORDER_FIELD_BYTES;
117 return FAST_GLYPH_ORDER_FIELD_BYTES;
119 return ELLIPSE_SC_ORDER_FIELD_BYTES;
121 return ELLIPSE_CB_ORDER_FIELD_BYTES;
123 return GLYPH_INDEX_ORDER_FIELD_BYTES;
127 WLog_WARN(TAG,
"Invalid orderType 0x%08X received", orderType);
132 static BYTE get_cbr2_bpp(UINT32 bpp, BOOL* pValid)
147 WLog_WARN(TAG,
"Invalid bpp %" PRIu32, bpp);
154 static BYTE get_bmf_bpp(UINT32 bmf, BOOL* pValid)
159 switch (bmf & (~CACHED_BRUSH))
172 WLog_WARN(TAG,
"Invalid bmf %" PRIu32, bmf);
178 static BYTE get_bpp_bmf(UINT32 bpp, BOOL* pValid)
195 WLog_WARN(TAG,
"Invalid color depth %" PRIu32, bpp);
202 static BOOL check_order_activated(wLog* log, rdpSettings* settings,
const char* orderName,
203 BOOL condition,
const char* extendedMessage)
207 if (settings->AllowUnanouncedOrdersFromServer)
209 WLog_Print(log, WLOG_WARN,
210 "%s - SERVER BUG: The support for this feature was not announced!",
213 WLog_Print(log, WLOG_WARN,
"%s", extendedMessage);
218 WLog_Print(log, WLOG_ERROR,
219 "%s - SERVER BUG: The support for this feature was not announced! Use "
220 "/relax-order-checks to ignore",
223 WLog_Print(log, WLOG_WARN,
"%s", extendedMessage);
231 static BOOL check_alt_order_supported(wLog* log, rdpSettings* settings, BYTE orderType,
232 const char* orderName)
234 const char* extendedMessage = NULL;
235 BOOL condition = FALSE;
239 case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP:
240 case ORDER_TYPE_SWITCH_SURFACE:
241 condition = settings->OffscreenSupportLevel != 0;
242 extendedMessage =
"Adding /cache:offscreen might mitigate";
245 case ORDER_TYPE_CREATE_NINE_GRID_BITMAP:
246 condition = settings->DrawNineGridEnabled;
249 case ORDER_TYPE_FRAME_MARKER:
250 condition = settings->FrameMarkerCommandEnabled;
253 case ORDER_TYPE_GDIPLUS_FIRST:
254 case ORDER_TYPE_GDIPLUS_NEXT:
255 case ORDER_TYPE_GDIPLUS_END:
256 case ORDER_TYPE_GDIPLUS_CACHE_FIRST:
257 case ORDER_TYPE_GDIPLUS_CACHE_NEXT:
258 case ORDER_TYPE_GDIPLUS_CACHE_END:
259 condition = settings->DrawGdiPlusCacheEnabled;
262 case ORDER_TYPE_WINDOW:
263 condition = settings->RemoteWndSupportLevel != WINDOW_LEVEL_NOT_SUPPORTED;
266 case ORDER_TYPE_STREAM_BITMAP_FIRST:
267 case ORDER_TYPE_STREAM_BITMAP_NEXT:
268 case ORDER_TYPE_COMPDESK_FIRST:
273 WLog_Print(log, WLOG_WARN,
"%s - %s UNKNOWN", orderName, alt_sec_order_str);
278 return check_order_activated(log, settings, orderName, condition, extendedMessage);
281 static BOOL check_secondary_order_supported(wLog* log, rdpSettings* settings, BYTE orderType,
282 const char* orderName)
284 const char* extendedMessage = NULL;
285 BOOL condition = FALSE;
289 case ORDER_TYPE_BITMAP_UNCOMPRESSED:
290 case ORDER_TYPE_CACHE_BITMAP_COMPRESSED:
291 condition = settings->BitmapCacheEnabled;
292 extendedMessage =
"Adding /cache:bitmap might mitigate";
295 case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2:
296 case ORDER_TYPE_BITMAP_COMPRESSED_V2:
297 condition = settings->BitmapCacheEnabled;
298 extendedMessage =
"Adding /cache:bitmap might mitigate";
301 case ORDER_TYPE_BITMAP_COMPRESSED_V3:
302 condition = settings->BitmapCacheV3Enabled;
303 extendedMessage =
"Adding /cache:bitmap might mitigate";
306 case ORDER_TYPE_CACHE_COLOR_TABLE:
307 condition = (settings->OrderSupport[NEG_MEMBLT_INDEX] ||
308 settings->OrderSupport[NEG_MEM3BLT_INDEX]);
311 case ORDER_TYPE_CACHE_GLYPH:
313 switch (settings->GlyphSupportLevel)
315 case GLYPH_SUPPORT_PARTIAL:
316 case GLYPH_SUPPORT_FULL:
317 case GLYPH_SUPPORT_ENCODE:
321 case GLYPH_SUPPORT_NONE:
329 case ORDER_TYPE_CACHE_BRUSH:
334 WLog_Print(log, WLOG_WARN,
"SECONDARY ORDER %s not supported", orderName);
338 return check_order_activated(log, settings, orderName, condition, extendedMessage);
341 static BOOL check_primary_order_supported(wLog* log, rdpSettings* settings, UINT32 orderType,
342 const char* orderName)
344 const char* extendedMessage = NULL;
345 BOOL condition = FALSE;
349 case ORDER_TYPE_DSTBLT:
350 condition = settings->OrderSupport[NEG_DSTBLT_INDEX];
353 case ORDER_TYPE_SCRBLT:
354 condition = settings->OrderSupport[NEG_SCRBLT_INDEX];
357 case ORDER_TYPE_DRAW_NINE_GRID:
358 condition = settings->OrderSupport[NEG_DRAWNINEGRID_INDEX];
361 case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
362 condition = settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX];
365 case ORDER_TYPE_LINE_TO:
366 condition = settings->OrderSupport[NEG_LINETO_INDEX];
371 case ORDER_TYPE_PATBLT:
372 case ORDER_TYPE_OPAQUE_RECT:
373 condition = settings->OrderSupport[NEG_OPAQUE_RECT_INDEX] ||
374 settings->OrderSupport[NEG_PATBLT_INDEX];
377 case ORDER_TYPE_SAVE_BITMAP:
378 condition = settings->OrderSupport[NEG_SAVEBITMAP_INDEX];
381 case ORDER_TYPE_MEMBLT:
382 condition = settings->OrderSupport[NEG_MEMBLT_INDEX];
385 case ORDER_TYPE_MEM3BLT:
386 condition = settings->OrderSupport[NEG_MEM3BLT_INDEX];
389 case ORDER_TYPE_MULTI_DSTBLT:
390 condition = settings->OrderSupport[NEG_MULTIDSTBLT_INDEX];
393 case ORDER_TYPE_MULTI_PATBLT:
394 condition = settings->OrderSupport[NEG_MULTIPATBLT_INDEX];
397 case ORDER_TYPE_MULTI_SCRBLT:
398 condition = settings->OrderSupport[NEG_MULTIDSTBLT_INDEX];
401 case ORDER_TYPE_MULTI_OPAQUE_RECT:
402 condition = settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX];
405 case ORDER_TYPE_FAST_INDEX:
406 condition = settings->OrderSupport[NEG_FAST_INDEX_INDEX];
409 case ORDER_TYPE_POLYGON_SC:
410 condition = settings->OrderSupport[NEG_POLYGON_SC_INDEX];
413 case ORDER_TYPE_POLYGON_CB:
414 condition = settings->OrderSupport[NEG_POLYGON_CB_INDEX];
417 case ORDER_TYPE_POLYLINE:
418 condition = settings->OrderSupport[NEG_POLYLINE_INDEX];
421 case ORDER_TYPE_FAST_GLYPH:
422 condition = settings->OrderSupport[NEG_FAST_GLYPH_INDEX];
425 case ORDER_TYPE_ELLIPSE_SC:
426 condition = settings->OrderSupport[NEG_ELLIPSE_SC_INDEX];
429 case ORDER_TYPE_ELLIPSE_CB:
430 condition = settings->OrderSupport[NEG_ELLIPSE_CB_INDEX];
433 case ORDER_TYPE_GLYPH_INDEX:
434 condition = settings->OrderSupport[NEG_GLYPH_INDEX_INDEX];
438 WLog_Print(log, WLOG_ERROR,
"%s %s not supported", orderName, primary_order_str);
442 return check_order_activated(log, settings, orderName, condition, extendedMessage);
445 WINPR_PRAGMA_DIAG_PUSH
446 WINPR_PRAGMA_DIAG_IGNORED_FORMAT_NONLITERAL
447 static const char* primary_order_string(UINT32 orderType)
449 const char* orders[] = {
"[0x%02" PRIx8
"] DstBlt",
450 "[0x%02" PRIx8
"] PatBlt",
451 "[0x%02" PRIx8
"] ScrBlt",
452 "[0x%02" PRIx8
"] UNUSED",
453 "[0x%02" PRIx8
"] UNUSED",
454 "[0x%02" PRIx8
"] UNUSED",
455 "[0x%02" PRIx8
"] UNUSED",
456 "[0x%02" PRIx8
"] DrawNineGrid",
457 "[0x%02" PRIx8
"] MultiDrawNineGrid",
458 "[0x%02" PRIx8
"] LineTo",
459 "[0x%02" PRIx8
"] OpaqueRect",
460 "[0x%02" PRIx8
"] SaveBitmap",
461 "[0x%02" PRIx8
"] UNUSED",
462 "[0x%02" PRIx8
"] MemBlt",
463 "[0x%02" PRIx8
"] Mem3Blt",
464 "[0x%02" PRIx8
"] MultiDstBlt",
465 "[0x%02" PRIx8
"] MultiPatBlt",
466 "[0x%02" PRIx8
"] MultiScrBlt",
467 "[0x%02" PRIx8
"] MultiOpaqueRect",
468 "[0x%02" PRIx8
"] FastIndex",
469 "[0x%02" PRIx8
"] PolygonSC",
470 "[0x%02" PRIx8
"] PolygonCB",
471 "[0x%02" PRIx8
"] Polyline",
472 "[0x%02" PRIx8
"] UNUSED",
473 "[0x%02" PRIx8
"] FastGlyph",
474 "[0x%02" PRIx8
"] EllipseSC",
475 "[0x%02" PRIx8
"] EllipseCB",
476 "[0x%02" PRIx8
"] GlyphIndex" };
477 const char* fmt =
"[0x%02" PRIx8
"] UNKNOWN";
478 static char buffer[64] = { 0 };
480 if (orderType < ARRAYSIZE(orders))
481 fmt = orders[orderType];
483 (void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
486 static const char* secondary_order_string(UINT32 orderType)
488 const char* orders[] = {
"[0x%02" PRIx8
"] Cache Bitmap",
489 "[0x%02" PRIx8
"] Cache Color Table",
490 "[0x%02" PRIx8
"] Cache Bitmap (Compressed)",
491 "[0x%02" PRIx8
"] Cache Glyph",
492 "[0x%02" PRIx8
"] Cache Bitmap V2",
493 "[0x%02" PRIx8
"] Cache Bitmap V2 (Compressed)",
494 "[0x%02" PRIx8
"] UNUSED",
495 "[0x%02" PRIx8
"] Cache Brush",
496 "[0x%02" PRIx8
"] Cache Bitmap V3" };
497 const char* fmt =
"[0x%02" PRIx8
"] UNKNOWN";
498 static char buffer[64] = { 0 };
500 if (orderType < ARRAYSIZE(orders))
501 fmt = orders[orderType];
503 (void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
506 static const char* altsec_order_string(BYTE orderType)
508 const char* orders[] = {
509 "[0x%02" PRIx8
"] Switch Surface",
"[0x%02" PRIx8
"] Create Offscreen Bitmap",
510 "[0x%02" PRIx8
"] Stream Bitmap First",
"[0x%02" PRIx8
"] Stream Bitmap Next",
511 "[0x%02" PRIx8
"] Create NineGrid Bitmap",
"[0x%02" PRIx8
"] Draw GDI+ First",
512 "[0x%02" PRIx8
"] Draw GDI+ Next",
"[0x%02" PRIx8
"] Draw GDI+ End",
513 "[0x%02" PRIx8
"] Draw GDI+ Cache First",
"[0x%02" PRIx8
"] Draw GDI+ Cache Next",
514 "[0x%02" PRIx8
"] Draw GDI+ Cache End",
"[0x%02" PRIx8
"] Windowing",
515 "[0x%02" PRIx8
"] Desktop Composition",
"[0x%02" PRIx8
"] Frame Marker"
517 const char* fmt =
"[0x%02" PRIx8
"] UNKNOWN";
518 static char buffer[64] = { 0 };
520 if (orderType < ARRAYSIZE(orders))
521 fmt = orders[orderType];
523 (void)sprintf_s(buffer, ARRAYSIZE(buffer), fmt, orderType);
526 WINPR_PRAGMA_DIAG_POP
528 static INLINE BOOL update_read_coord(
wStream* s, INT32* coord, BOOL delta)
535 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
538 Stream_Read_INT8(s, lsi8);
543 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
546 Stream_Read_INT16(s, lsi16);
553 #define update_write_coord(s, coord) \
554 update_write_coord_int((s), (coord), #coord, __FILE__, __func__, __LINE__)
556 static INLINE BOOL update_write_coord_int(
wStream* s, INT32 coord,
const char* name,
557 const char* file,
const char* fkt,
size_t line)
559 if ((coord < 0) || (coord > UINT16_MAX))
561 const DWORD level = WLOG_WARN;
562 wLog* log = WLog_Get(TAG);
563 if (WLog_IsLevelActive(log, level))
565 WLog_PrintMessage(log, WLOG_MESSAGE_TEXT, level, line, file, fkt,
566 "[%s] 0 <= %" PRId32
" <= %" PRIu16, name, coord, UINT16_MAX);
571 Stream_Write_UINT16(s, (UINT16)coord);
574 static INLINE BOOL update_read_color(
wStream* s, UINT32* color)
578 if (!Stream_CheckAndLogRequiredLength(TAG, s, 3))
582 Stream_Read_UINT8(s,
byte);
583 *color = (UINT32)
byte;
584 Stream_Read_UINT8(s,
byte);
585 *color |= ((UINT32)
byte << 8) & 0xFF00;
586 Stream_Read_UINT8(s,
byte);
587 *color |= ((UINT32)
byte << 16) & 0xFF0000;
590 static INLINE BOOL update_write_color(
wStream* s, UINT32 color)
593 byte = (color & 0xFF);
594 Stream_Write_UINT8(s,
byte);
595 byte = ((color >> 8) & 0xFF);
596 Stream_Write_UINT8(s,
byte);
597 byte = ((color >> 16) & 0xFF);
598 Stream_Write_UINT8(s,
byte);
601 static INLINE BOOL update_read_colorref(
wStream* s, UINT32* color)
605 if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
609 Stream_Read_UINT8(s,
byte);
611 Stream_Read_UINT8(s,
byte);
612 *color |= ((UINT32)
byte << 8);
613 Stream_Read_UINT8(s,
byte);
614 *color |= ((UINT32)
byte << 16);
615 Stream_Seek_UINT8(s);
618 static INLINE BOOL update_read_color_quad(
wStream* s, UINT32* color)
620 return update_read_colorref(s, color);
622 static INLINE
void update_write_color_quad(
wStream* s, UINT32 color)
625 byte = (color >> 16) & 0xFF;
626 Stream_Write_UINT8(s,
byte);
627 byte = (color >> 8) & 0xFF;
628 Stream_Write_UINT8(s,
byte);
630 Stream_Write_UINT8(s,
byte);
632 static INLINE BOOL update_read_2byte_unsigned(
wStream* s, UINT32* value)
636 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
639 Stream_Read_UINT8(s,
byte);
643 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
646 *value = (
byte & 0x7F) << 8;
647 Stream_Read_UINT8(s,
byte);
652 *value = (
byte & 0x7F);
657 static INLINE BOOL update_write_2byte_unsigned(
wStream* s, UINT32 value)
666 byte = ((value & 0x7F00) >> 8);
667 Stream_Write_UINT8(s,
byte | 0x80);
668 byte = (value & 0xFF);
669 Stream_Write_UINT8(s,
byte);
673 byte = (value & 0x7F);
674 Stream_Write_UINT8(s,
byte);
679 static INLINE BOOL update_read_2byte_signed(
wStream* s, INT32* value)
684 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
687 Stream_Read_UINT8(s,
byte);
688 negative = (
byte & 0x40) ? TRUE : FALSE;
689 *value = (
byte & 0x3F);
693 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
696 Stream_Read_UINT8(s,
byte);
697 *value = (*value << 8) |
byte;
705 static INLINE BOOL update_write_2byte_signed(
wStream* s, INT32 value)
708 BOOL negative = FALSE;
721 byte = ((value & 0x3F00) >> 8);
726 Stream_Write_UINT8(s,
byte | 0x80);
727 byte = (value & 0xFF);
728 Stream_Write_UINT8(s,
byte);
732 byte = (value & 0x3F);
737 Stream_Write_UINT8(s,
byte);
742 static INLINE BOOL update_read_4byte_unsigned(
wStream* s, UINT32* value)
747 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
750 Stream_Read_UINT8(s,
byte);
751 count = (
byte & 0xC0) >> 6;
753 if (!Stream_CheckAndLogRequiredLength(TAG, s, count))
759 *value = (
byte & 0x3F);
763 *value = (
byte & 0x3F) << 8;
764 Stream_Read_UINT8(s,
byte);
769 *value = (
byte & 0x3F) << 16;
770 Stream_Read_UINT8(s,
byte);
771 *value |= (
byte << 8);
772 Stream_Read_UINT8(s,
byte);
777 *value = (
byte & 0x3F) << 24;
778 Stream_Read_UINT8(s,
byte);
779 *value |= (
byte << 16);
780 Stream_Read_UINT8(s,
byte);
781 *value |= (
byte << 8);
782 Stream_Read_UINT8(s,
byte);
792 static INLINE BOOL update_write_4byte_unsigned(
wStream* s, UINT32 value)
798 Stream_Write_UINT8(s, (UINT8)value);
800 else if (value <= 0x3FFF)
802 byte = (value >> 8) & 0x3F;
803 Stream_Write_UINT8(s,
byte | 0x40);
804 byte = (value & 0xFF);
805 Stream_Write_UINT8(s,
byte);
807 else if (value <= 0x3FFFFF)
809 byte = (value >> 16) & 0x3F;
810 Stream_Write_UINT8(s,
byte | 0x80);
811 byte = (value >> 8) & 0xFF;
812 Stream_Write_UINT8(s,
byte);
813 byte = (value & 0xFF);
814 Stream_Write_UINT8(s,
byte);
816 else if (value <= 0x3FFFFFFF)
818 byte = (value >> 24) & 0x3F;
819 Stream_Write_UINT8(s,
byte | 0xC0);
820 byte = (value >> 16) & 0xFF;
821 Stream_Write_UINT8(s,
byte);
822 byte = (value >> 8) & 0xFF;
823 Stream_Write_UINT8(s,
byte);
824 byte = (value & 0xFF);
825 Stream_Write_UINT8(s,
byte);
833 static INLINE BOOL update_read_delta(
wStream* s, INT32* value)
838 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
841 Stream_Read_UINT8(s,
byte);
844 uvalue = (
byte | ~0x3F);
846 uvalue = (
byte & 0x3F);
850 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
853 Stream_Read_UINT8(s,
byte);
854 uvalue = (uvalue << 8) |
byte;
856 *value = (INT32)uvalue;
861 static INLINE
void update_read_glyph_delta(
wStream* s, UINT16* value)
864 Stream_Read_UINT8(s,
byte);
867 Stream_Read_UINT16(s, *value);
869 *value = (
byte & 0x3F);
871 static INLINE
void update_seek_glyph_delta(
wStream* s)
874 Stream_Read_UINT8(s,
byte);
877 Stream_Seek_UINT8(s);
880 static INLINE BOOL update_read_brush(
wStream* s, rdpBrush* brush, BYTE fieldFlags)
882 if (fieldFlags & ORDER_FIELD_01)
884 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
887 Stream_Read_UINT8(s, brush->x);
890 if (fieldFlags & ORDER_FIELD_02)
892 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
895 Stream_Read_UINT8(s, brush->y);
898 if (fieldFlags & ORDER_FIELD_03)
900 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
903 Stream_Read_UINT8(s, brush->style);
906 if (fieldFlags & ORDER_FIELD_04)
908 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
911 Stream_Read_UINT8(s, brush->hatch);
914 if (brush->style & CACHED_BRUSH)
917 brush->index = brush->hatch;
918 brush->bpp = get_bmf_bpp(brush->style, &rc);
925 if (fieldFlags & ORDER_FIELD_05)
927 if (!Stream_CheckAndLogRequiredLength(TAG, s, 7))
930 brush->data = (BYTE*)brush->p8x8;
931 Stream_Read_UINT8(s, brush->data[7]);
932 Stream_Read_UINT8(s, brush->data[6]);
933 Stream_Read_UINT8(s, brush->data[5]);
934 Stream_Read_UINT8(s, brush->data[4]);
935 Stream_Read_UINT8(s, brush->data[3]);
936 Stream_Read_UINT8(s, brush->data[2]);
937 Stream_Read_UINT8(s, brush->data[1]);
938 brush->data[0] = brush->hatch;
943 static INLINE BOOL update_write_brush(
wStream* s, rdpBrush* brush, BYTE fieldFlags)
945 if (fieldFlags & ORDER_FIELD_01)
947 Stream_Write_UINT8(s, brush->x);
950 if (fieldFlags & ORDER_FIELD_02)
952 Stream_Write_UINT8(s, brush->y);
955 if (fieldFlags & ORDER_FIELD_03)
957 Stream_Write_UINT8(s, brush->style);
960 if (brush->style & CACHED_BRUSH)
963 brush->hatch = brush->index;
964 brush->bpp = get_bmf_bpp(brush->style, &rc);
971 if (fieldFlags & ORDER_FIELD_04)
973 Stream_Write_UINT8(s, brush->hatch);
976 if (fieldFlags & ORDER_FIELD_05)
978 brush->data = (BYTE*)brush->p8x8;
979 Stream_Write_UINT8(s, brush->data[7]);
980 Stream_Write_UINT8(s, brush->data[6]);
981 Stream_Write_UINT8(s, brush->data[5]);
982 Stream_Write_UINT8(s, brush->data[4]);
983 Stream_Write_UINT8(s, brush->data[3]);
984 Stream_Write_UINT8(s, brush->data[2]);
985 Stream_Write_UINT8(s, brush->data[1]);
986 brush->data[0] = brush->hatch;
991 static INLINE BOOL update_read_delta_rects(
wStream* s,
DELTA_RECT* rectangles,
const UINT32* nr)
995 BYTE* zeroBits = NULL;
996 UINT32 zeroBitsSize = 0;
1000 WLog_WARN(TAG,
"Invalid number of delta rectangles %" PRIu32, number);
1004 zeroBitsSize = ((number + 1) / 2);
1006 if (!Stream_CheckAndLogRequiredLength(TAG, s, zeroBitsSize))
1009 Stream_GetPointer(s, zeroBits);
1010 Stream_Seek(s, zeroBitsSize);
1011 ZeroMemory(rectangles,
sizeof(
DELTA_RECT) * number);
1013 for (UINT32 i = 0; i < number; i++)
1016 flags = zeroBits[i / 2];
1018 if ((~flags & 0x80) && !update_read_delta(s, &rectangles[i].left))
1021 if ((~flags & 0x40) && !update_read_delta(s, &rectangles[i].top))
1026 if (!update_read_delta(s, &rectangles[i].width))
1030 rectangles[i].width = rectangles[i - 1].width;
1032 rectangles[i].width = 0;
1036 if (!update_read_delta(s, &rectangles[i].height))
1040 rectangles[i].height = rectangles[i - 1].height;
1042 rectangles[i].height = 0;
1046 rectangles[i].left += rectangles[i - 1].left;
1047 rectangles[i].top += rectangles[i - 1].top;
1056 static INLINE BOOL update_read_delta_points(
wStream* s,
DELTA_POINT** points, UINT32 number,
1060 BYTE* zeroBits = NULL;
1061 UINT32 zeroBitsSize = ((number + 3) / 4);
1063 WINPR_ASSERT(points);
1068 *points = newpoints;
1070 if (!Stream_CheckAndLogRequiredLength(TAG, s, zeroBitsSize))
1073 Stream_GetPointer(s, zeroBits);
1074 Stream_Seek(s, zeroBitsSize);
1075 ZeroMemory(*points,
sizeof(
DELTA_POINT) * number);
1077 for (UINT32 i = 0; i < number; i++)
1080 flags = zeroBits[i / 4];
1082 if ((~flags & 0x80) && !update_read_delta(s, &newpoints[i].x))
1084 WLog_ERR(TAG,
"update_read_delta(x) failed");
1088 if ((~flags & 0x40) && !update_read_delta(s, &newpoints[i].y))
1090 WLog_ERR(TAG,
"update_read_delta(y) failed");
1100 static BOOL order_field_flag_is_set(
const ORDER_INFO* orderInfo, BYTE number)
1102 const UINT32 mask = (UINT32)(1UL << ((UINT32)number - 1UL));
1103 const BOOL set = (orderInfo->fieldFlags & mask) != 0;
1107 static INLINE BOOL read_order_field_byte(
const char* orderName,
const ORDER_INFO* orderInfo,
1108 wStream* s, BYTE number, UINT32* target, BOOL optional)
1110 WINPR_ASSERT(orderName);
1111 WINPR_ASSERT(orderInfo);
1112 WINPR_ASSERT(target);
1114 if (!order_field_flag_is_set(orderInfo, number))
1116 WLog_DBG(TAG,
"order %s field %" PRIu8
" not found [optional:%d]", orderName, number,
1120 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1122 Stream_Read_UINT8(s, *target);
1126 static INLINE BOOL read_order_field_2bytes(
const char* orderName,
const ORDER_INFO* orderInfo,
1127 wStream* s, BYTE number, UINT32* target1,
1128 UINT32* target2, BOOL optional)
1130 WINPR_ASSERT(orderName);
1131 WINPR_ASSERT(orderInfo);
1132 WINPR_ASSERT(target1);
1133 WINPR_ASSERT(target2);
1135 if (!order_field_flag_is_set(orderInfo, number))
1137 WLog_DBG(TAG,
"order %s field %" PRIu8
" not found [optional:%d]", orderName, number,
1141 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1143 Stream_Read_UINT8(s, *target1);
1144 Stream_Read_UINT8(s, *target2);
1148 static INLINE BOOL read_order_field_uint16(
const char* orderName,
const ORDER_INFO* orderInfo,
1149 wStream* s, BYTE number, UINT32* target, BOOL optional)
1151 WINPR_ASSERT(orderName);
1152 WINPR_ASSERT(orderInfo);
1153 WINPR_ASSERT(target);
1155 if (!order_field_flag_is_set(orderInfo, number))
1157 WLog_DBG(TAG,
"order %s field %" PRIu8
" not found [optional:%d]", orderName, number,
1162 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1165 Stream_Read_UINT16(s, *target);
1169 static INLINE BOOL read_order_field_int16(
const char* orderName,
const ORDER_INFO* orderInfo,
1170 wStream* s, BYTE number, INT32* target, BOOL optional)
1172 WINPR_ASSERT(orderName);
1173 WINPR_ASSERT(orderInfo);
1174 WINPR_ASSERT(target);
1176 if (!order_field_flag_is_set(orderInfo, number))
1178 WLog_DBG(TAG,
"order %s field %" PRIu8
" not found [optional:%d]", orderName, number,
1183 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1186 Stream_Read_INT16(s, *target);
1190 static INLINE BOOL read_order_field_uint32(
const char* orderName,
const ORDER_INFO* orderInfo,
1191 wStream* s, BYTE number, UINT32* target, BOOL optional)
1193 WINPR_ASSERT(orderName);
1194 WINPR_ASSERT(orderInfo);
1195 WINPR_ASSERT(target);
1197 if (!order_field_flag_is_set(orderInfo, number))
1199 WLog_DBG(TAG,
"order %s field %" PRIu8
" not found [optional:%d]", orderName, number,
1204 if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
1207 Stream_Read_UINT32(s, *target);
1211 static INLINE BOOL read_order_field_coord(
const char* orderName,
const ORDER_INFO* orderInfo,
1212 wStream* s, UINT32 NO, INT32* TARGET, BOOL optional)
1214 WINPR_ASSERT(orderName);
1215 WINPR_ASSERT(orderInfo);
1216 WINPR_ASSERT(TARGET);
1218 if (!order_field_flag_is_set(orderInfo, NO))
1220 WLog_DBG(TAG,
"order %s field %" PRIu8
" not found [optional:%d]", orderName, NO, optional);
1224 return update_read_coord(s, TARGET, orderInfo->deltaCoordinates);
1227 static INLINE BOOL read_order_field_color(
const char* orderName,
const ORDER_INFO* orderInfo,
1228 wStream* s, UINT32 NO, UINT32* TARGET, BOOL optional)
1230 WINPR_ASSERT(orderName);
1231 WINPR_ASSERT(orderInfo);
1232 WINPR_ASSERT(TARGET);
1234 if (!order_field_flag_is_set(orderInfo, NO))
1236 WLog_DBG(TAG,
"order %s field %" PRIu8
" not found [optional:%d]", orderName, NO, optional);
1240 if (!update_read_color(s, TARGET))
1245 static INLINE BOOL FIELD_SKIP_BUFFER16(
wStream* s, UINT32 TARGET_LEN)
1247 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1250 Stream_Read_UINT16(s, TARGET_LEN);
1252 if (!Stream_SafeSeek(s, TARGET_LEN))
1254 WLog_ERR(TAG,
"error skipping %" PRIu32
" bytes", TARGET_LEN);
1261 static BOOL update_read_dstblt_order(
const char* orderName,
wStream* s,
const ORDER_INFO* orderInfo,
1264 if (read_order_field_coord(orderName, orderInfo, s, 1, &dstblt->nLeftRect, FALSE) &&
1265 read_order_field_coord(orderName, orderInfo, s, 2, &dstblt->nTopRect, FALSE) &&
1266 read_order_field_coord(orderName, orderInfo, s, 3, &dstblt->nWidth, FALSE) &&
1267 read_order_field_coord(orderName, orderInfo, s, 4, &dstblt->nHeight, FALSE) &&
1268 read_order_field_byte(orderName, orderInfo, s, 5, &dstblt->bRop, TRUE))
1275 WINPR_UNUSED(orderInfo);
1276 WINPR_UNUSED(dstblt);
1282 if (!Stream_EnsureRemainingCapacity(s, update_approximate_dstblt_order(orderInfo, dstblt)))
1285 orderInfo->fieldFlags = 0;
1286 orderInfo->fieldFlags |= ORDER_FIELD_01;
1287 if (!update_write_coord(s, dstblt->nLeftRect))
1289 orderInfo->fieldFlags |= ORDER_FIELD_02;
1290 if (!update_write_coord(s, dstblt->nTopRect))
1292 orderInfo->fieldFlags |= ORDER_FIELD_03;
1293 if (!update_write_coord(s, dstblt->nWidth))
1295 orderInfo->fieldFlags |= ORDER_FIELD_04;
1296 if (!update_write_coord(s, dstblt->nHeight))
1298 orderInfo->fieldFlags |= ORDER_FIELD_05;
1299 Stream_Write_UINT8(s, dstblt->bRop);
1303 static BOOL update_read_patblt_order(
const char* orderName,
wStream* s,
const ORDER_INFO* orderInfo,
1306 if (read_order_field_coord(orderName, orderInfo, s, 1, &patblt->nLeftRect, FALSE) &&
1307 read_order_field_coord(orderName, orderInfo, s, 2, &patblt->nTopRect, FALSE) &&
1308 read_order_field_coord(orderName, orderInfo, s, 3, &patblt->nWidth, FALSE) &&
1309 read_order_field_coord(orderName, orderInfo, s, 4, &patblt->nHeight, FALSE) &&
1310 read_order_field_byte(orderName, orderInfo, s, 5, &patblt->bRop, TRUE) &&
1311 read_order_field_color(orderName, orderInfo, s, 6, &patblt->backColor, TRUE) &&
1312 read_order_field_color(orderName, orderInfo, s, 7, &patblt->foreColor, TRUE) &&
1313 update_read_brush(s, &patblt->brush, orderInfo->fieldFlags >> 7))
1320 WINPR_UNUSED(orderInfo);
1321 WINPR_UNUSED(patblt);
1327 if (!Stream_EnsureRemainingCapacity(s, update_approximate_patblt_order(orderInfo, patblt)))
1330 orderInfo->fieldFlags = 0;
1331 orderInfo->fieldFlags |= ORDER_FIELD_01;
1332 if (!update_write_coord(s, patblt->nLeftRect))
1334 orderInfo->fieldFlags |= ORDER_FIELD_02;
1335 if (!update_write_coord(s, patblt->nTopRect))
1337 orderInfo->fieldFlags |= ORDER_FIELD_03;
1338 if (!update_write_coord(s, patblt->nWidth))
1340 orderInfo->fieldFlags |= ORDER_FIELD_04;
1341 if (!update_write_coord(s, patblt->nHeight))
1343 orderInfo->fieldFlags |= ORDER_FIELD_05;
1344 Stream_Write_UINT8(s, patblt->bRop);
1345 orderInfo->fieldFlags |= ORDER_FIELD_06;
1346 update_write_color(s, patblt->backColor);
1347 orderInfo->fieldFlags |= ORDER_FIELD_07;
1348 update_write_color(s, patblt->foreColor);
1349 orderInfo->fieldFlags |= ORDER_FIELD_08;
1350 orderInfo->fieldFlags |= ORDER_FIELD_09;
1351 orderInfo->fieldFlags |= ORDER_FIELD_10;
1352 orderInfo->fieldFlags |= ORDER_FIELD_11;
1353 orderInfo->fieldFlags |= ORDER_FIELD_12;
1354 update_write_brush(s, &patblt->brush, orderInfo->fieldFlags >> 7);
1358 static BOOL update_read_scrblt_order(
const char* orderName,
wStream* s,
const ORDER_INFO* orderInfo,
1361 WINPR_ASSERT(orderInfo);
1362 WINPR_ASSERT(scrblt);
1363 if (read_order_field_coord(orderName, orderInfo, s, 1, &scrblt->nLeftRect, FALSE) &&
1364 read_order_field_coord(orderName, orderInfo, s, 2, &scrblt->nTopRect, FALSE) &&
1365 read_order_field_coord(orderName, orderInfo, s, 3, &scrblt->nWidth, FALSE) &&
1366 read_order_field_coord(orderName, orderInfo, s, 4, &scrblt->nHeight, FALSE) &&
1367 read_order_field_byte(orderName, orderInfo, s, 5, &scrblt->bRop, TRUE) &&
1368 read_order_field_coord(orderName, orderInfo, s, 6, &scrblt->nXSrc, FALSE) &&
1369 read_order_field_coord(orderName, orderInfo, s, 7, &scrblt->nYSrc, FALSE))
1376 WINPR_ASSERT(orderInfo);
1377 WINPR_ASSERT(scrblt);
1378 WINPR_UNUSED(orderInfo);
1379 WINPR_UNUSED(scrblt);
1385 WINPR_ASSERT(orderInfo);
1386 WINPR_ASSERT(scrblt);
1387 if (!Stream_EnsureRemainingCapacity(s, update_approximate_scrblt_order(orderInfo, scrblt)))
1390 orderInfo->fieldFlags = 0;
1391 orderInfo->fieldFlags |= ORDER_FIELD_01;
1392 if (!update_write_coord(s, scrblt->nLeftRect))
1394 orderInfo->fieldFlags |= ORDER_FIELD_02;
1395 if (!update_write_coord(s, scrblt->nTopRect))
1397 orderInfo->fieldFlags |= ORDER_FIELD_03;
1398 if (!update_write_coord(s, scrblt->nWidth))
1400 orderInfo->fieldFlags |= ORDER_FIELD_04;
1401 if (!update_write_coord(s, scrblt->nHeight))
1403 orderInfo->fieldFlags |= ORDER_FIELD_05;
1404 WINPR_ASSERT(scrblt->bRop <= UINT8_MAX);
1405 Stream_Write_UINT8(s, (UINT8)scrblt->bRop);
1406 orderInfo->fieldFlags |= ORDER_FIELD_06;
1407 if (!update_write_coord(s, scrblt->nXSrc))
1409 orderInfo->fieldFlags |= ORDER_FIELD_07;
1410 if (!update_write_coord(s, scrblt->nYSrc))
1414 static BOOL update_read_opaque_rect_order(
const char* orderName,
wStream* s,
1419 if (!read_order_field_coord(orderName, orderInfo, s, 1, &opaque_rect->nLeftRect, FALSE) ||
1420 !read_order_field_coord(orderName, orderInfo, s, 2, &opaque_rect->nTopRect, FALSE) ||
1421 !read_order_field_coord(orderName, orderInfo, s, 3, &opaque_rect->nWidth, FALSE) ||
1422 !read_order_field_coord(orderName, orderInfo, s, 4, &opaque_rect->nHeight, FALSE))
1425 if ((orderInfo->fieldFlags & ORDER_FIELD_05) != 0)
1427 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1430 Stream_Read_UINT8(s,
byte);
1431 opaque_rect->color = (opaque_rect->color & 0x00FFFF00) | ((UINT32)byte);
1434 if ((orderInfo->fieldFlags & ORDER_FIELD_06) != 0)
1436 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1439 Stream_Read_UINT8(s,
byte);
1440 opaque_rect->color = (opaque_rect->color & 0x00FF00FF) | ((UINT32)
byte << 8);
1443 if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
1445 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1448 Stream_Read_UINT8(s,
byte);
1449 opaque_rect->color = (opaque_rect->color & 0x0000FFFF) | ((UINT32)
byte << 16);
1455 size_t update_approximate_opaque_rect_order(
ORDER_INFO* orderInfo,
1458 WINPR_UNUSED(orderInfo);
1459 WINPR_UNUSED(opaque_rect);
1467 size_t inf = update_approximate_opaque_rect_order(orderInfo, opaque_rect);
1469 if (!Stream_EnsureRemainingCapacity(s, inf))
1473 orderInfo->fieldFlags = 0;
1474 orderInfo->fieldFlags |= ORDER_FIELD_01;
1475 if (!update_write_coord(s, opaque_rect->nLeftRect))
1477 orderInfo->fieldFlags |= ORDER_FIELD_02;
1478 if (!update_write_coord(s, opaque_rect->nTopRect))
1480 orderInfo->fieldFlags |= ORDER_FIELD_03;
1481 if (!update_write_coord(s, opaque_rect->nWidth))
1483 orderInfo->fieldFlags |= ORDER_FIELD_04;
1484 if (!update_write_coord(s, opaque_rect->nHeight))
1486 orderInfo->fieldFlags |= ORDER_FIELD_05;
1487 byte = opaque_rect->color & 0x000000FF;
1488 Stream_Write_UINT8(s,
byte);
1489 orderInfo->fieldFlags |= ORDER_FIELD_06;
1490 byte = (opaque_rect->color & 0x0000FF00) >> 8;
1491 Stream_Write_UINT8(s,
byte);
1492 orderInfo->fieldFlags |= ORDER_FIELD_07;
1493 byte = (opaque_rect->color & 0x00FF0000) >> 16;
1494 Stream_Write_UINT8(s,
byte);
1498 static BOOL update_read_draw_nine_grid_order(
const char* orderName,
wStream* s,
1502 if (read_order_field_coord(orderName, orderInfo, s, 1, &draw_nine_grid->srcLeft, FALSE) &&
1503 read_order_field_coord(orderName, orderInfo, s, 2, &draw_nine_grid->srcTop, FALSE) &&
1504 read_order_field_coord(orderName, orderInfo, s, 3, &draw_nine_grid->srcRight, FALSE) &&
1505 read_order_field_coord(orderName, orderInfo, s, 4, &draw_nine_grid->srcBottom, FALSE) &&
1506 read_order_field_uint16(orderName, orderInfo, s, 5, &draw_nine_grid->bitmapId, FALSE))
1511 static BOOL update_read_multi_dstblt_order(
const char* orderName,
wStream* s,
1515 UINT32 numRectangles = multi_dstblt->numRectangles;
1516 if (!read_order_field_coord(orderName, orderInfo, s, 1, &multi_dstblt->nLeftRect, FALSE) ||
1517 !read_order_field_coord(orderName, orderInfo, s, 2, &multi_dstblt->nTopRect, FALSE) ||
1518 !read_order_field_coord(orderName, orderInfo, s, 3, &multi_dstblt->nWidth, FALSE) ||
1519 !read_order_field_coord(orderName, orderInfo, s, 4, &multi_dstblt->nHeight, FALSE) ||
1520 !read_order_field_byte(orderName, orderInfo, s, 5, &multi_dstblt->bRop, TRUE) ||
1521 !read_order_field_byte(orderName, orderInfo, s, 6, &numRectangles, TRUE))
1524 if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
1526 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1529 multi_dstblt->numRectangles = numRectangles;
1530 Stream_Read_UINT16(s, multi_dstblt->cbData);
1531 return update_read_delta_rects(s, multi_dstblt->rectangles, &multi_dstblt->numRectangles);
1533 if (numRectangles > multi_dstblt->numRectangles)
1535 WLog_ERR(TAG,
"%s numRectangles %" PRIu32
" > %" PRIu32, orderName, numRectangles,
1536 multi_dstblt->numRectangles);
1539 multi_dstblt->numRectangles = numRectangles;
1543 static BOOL update_read_multi_patblt_order(
const char* orderName,
wStream* s,
1547 if (!read_order_field_coord(orderName, orderInfo, s, 1, &multi_patblt->nLeftRect, FALSE) ||
1548 !read_order_field_coord(orderName, orderInfo, s, 2, &multi_patblt->nTopRect, FALSE) ||
1549 !read_order_field_coord(orderName, orderInfo, s, 3, &multi_patblt->nWidth, FALSE) ||
1550 !read_order_field_coord(orderName, orderInfo, s, 4, &multi_patblt->nHeight, FALSE) ||
1551 !read_order_field_byte(orderName, orderInfo, s, 5, &multi_patblt->bRop, TRUE) ||
1552 !read_order_field_color(orderName, orderInfo, s, 6, &multi_patblt->backColor, TRUE) ||
1553 !read_order_field_color(orderName, orderInfo, s, 7, &multi_patblt->foreColor, TRUE))
1556 if (!update_read_brush(s, &multi_patblt->brush, orderInfo->fieldFlags >> 7))
1559 UINT32 numRectangles = multi_patblt->numRectangles;
1560 if (!read_order_field_byte(orderName, orderInfo, s, 13, &numRectangles, TRUE))
1563 if ((orderInfo->fieldFlags & ORDER_FIELD_14) != 0)
1565 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1568 multi_patblt->numRectangles = numRectangles;
1569 Stream_Read_UINT16(s, multi_patblt->cbData);
1571 if (!update_read_delta_rects(s, multi_patblt->rectangles, &multi_patblt->numRectangles))
1575 if (numRectangles > multi_patblt->numRectangles)
1577 WLog_ERR(TAG,
"%s numRectangles %" PRIu32
" > %" PRIu32, orderName, numRectangles,
1578 multi_patblt->numRectangles);
1581 multi_patblt->numRectangles = numRectangles;
1586 static BOOL update_read_multi_scrblt_order(
const char* orderName,
wStream* s,
1590 WINPR_ASSERT(orderInfo);
1591 WINPR_ASSERT(multi_scrblt);
1593 UINT32 numRectangles = multi_scrblt->numRectangles;
1594 if (!read_order_field_coord(orderName, orderInfo, s, 1, &multi_scrblt->nLeftRect, FALSE) ||
1595 !read_order_field_coord(orderName, orderInfo, s, 2, &multi_scrblt->nTopRect, FALSE) ||
1596 !read_order_field_coord(orderName, orderInfo, s, 3, &multi_scrblt->nWidth, FALSE) ||
1597 !read_order_field_coord(orderName, orderInfo, s, 4, &multi_scrblt->nHeight, FALSE) ||
1598 !read_order_field_byte(orderName, orderInfo, s, 5, &multi_scrblt->bRop, TRUE) ||
1599 !read_order_field_coord(orderName, orderInfo, s, 6, &multi_scrblt->nXSrc, FALSE) ||
1600 !read_order_field_coord(orderName, orderInfo, s, 7, &multi_scrblt->nYSrc, FALSE) ||
1601 !read_order_field_byte(orderName, orderInfo, s, 8, &numRectangles, TRUE))
1604 if ((orderInfo->fieldFlags & ORDER_FIELD_09) != 0)
1606 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1609 multi_scrblt->numRectangles = numRectangles;
1610 Stream_Read_UINT16(s, multi_scrblt->cbData);
1611 return update_read_delta_rects(s, multi_scrblt->rectangles, &multi_scrblt->numRectangles);
1614 if (numRectangles > multi_scrblt->numRectangles)
1616 WLog_ERR(TAG,
"%s numRectangles %" PRIu32
" > %" PRIu32, orderName, numRectangles,
1617 multi_scrblt->numRectangles);
1620 multi_scrblt->numRectangles = numRectangles;
1625 static BOOL update_read_multi_opaque_rect_order(
const char* orderName,
wStream* s,
1630 if (!read_order_field_coord(orderName, orderInfo, s, 1, &multi_opaque_rect->nLeftRect, FALSE) ||
1631 !read_order_field_coord(orderName, orderInfo, s, 2, &multi_opaque_rect->nTopRect, FALSE) ||
1632 !read_order_field_coord(orderName, orderInfo, s, 3, &multi_opaque_rect->nWidth, FALSE) ||
1633 !read_order_field_coord(orderName, orderInfo, s, 4, &multi_opaque_rect->nHeight, FALSE))
1636 if ((orderInfo->fieldFlags & ORDER_FIELD_05) != 0)
1638 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1641 Stream_Read_UINT8(s,
byte);
1642 multi_opaque_rect->color = (multi_opaque_rect->color & 0x00FFFF00) | ((UINT32)byte);
1645 if ((orderInfo->fieldFlags & ORDER_FIELD_06) != 0)
1647 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1650 Stream_Read_UINT8(s,
byte);
1651 multi_opaque_rect->color = (multi_opaque_rect->color & 0x00FF00FF) | ((UINT32)
byte << 8);
1654 if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
1656 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1659 Stream_Read_UINT8(s,
byte);
1660 multi_opaque_rect->color = (multi_opaque_rect->color & 0x0000FFFF) | ((UINT32)
byte << 16);
1663 UINT32 numRectangles = multi_opaque_rect->numRectangles;
1664 if (!read_order_field_byte(orderName, orderInfo, s, 8, &numRectangles, TRUE))
1667 if ((orderInfo->fieldFlags & ORDER_FIELD_09) != 0)
1669 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1672 multi_opaque_rect->numRectangles = numRectangles;
1673 Stream_Read_UINT16(s, multi_opaque_rect->cbData);
1674 return update_read_delta_rects(s, multi_opaque_rect->rectangles,
1675 &multi_opaque_rect->numRectangles);
1677 if (numRectangles > multi_opaque_rect->numRectangles)
1679 WLog_ERR(TAG,
"%s numRectangles %" PRIu32
" > %" PRIu32, orderName, numRectangles,
1680 multi_opaque_rect->numRectangles);
1683 multi_opaque_rect->numRectangles = numRectangles;
1688 static BOOL update_read_multi_draw_nine_grid_order(
const char* orderName,
wStream* s,
1692 UINT32 nDeltaEntries = multi_draw_nine_grid->nDeltaEntries;
1693 if (!read_order_field_coord(orderName, orderInfo, s, 1, &multi_draw_nine_grid->srcLeft,
1695 !read_order_field_coord(orderName, orderInfo, s, 2, &multi_draw_nine_grid->srcTop, FALSE) ||
1696 !read_order_field_coord(orderName, orderInfo, s, 3, &multi_draw_nine_grid->srcRight,
1698 !read_order_field_coord(orderName, orderInfo, s, 4, &multi_draw_nine_grid->srcBottom,
1700 !read_order_field_uint16(orderName, orderInfo, s, 5, &multi_draw_nine_grid->bitmapId,
1702 !read_order_field_byte(orderName, orderInfo, s, 6, &nDeltaEntries, TRUE))
1705 if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
1707 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
1710 multi_draw_nine_grid->nDeltaEntries = nDeltaEntries;
1711 Stream_Read_UINT16(s, multi_draw_nine_grid->cbData);
1712 return update_read_delta_rects(s, multi_draw_nine_grid->rectangles,
1713 &multi_draw_nine_grid->nDeltaEntries);
1716 if (nDeltaEntries > multi_draw_nine_grid->nDeltaEntries)
1718 WLog_ERR(TAG,
"%s nDeltaEntries %" PRIu32
" > %" PRIu32, orderName, nDeltaEntries,
1719 multi_draw_nine_grid->nDeltaEntries);
1722 multi_draw_nine_grid->nDeltaEntries = nDeltaEntries;
1726 static BOOL update_read_line_to_order(
const char* orderName,
wStream* s,
1729 if (read_order_field_uint16(orderName, orderInfo, s, 1, &line_to->backMode, TRUE) &&
1730 read_order_field_coord(orderName, orderInfo, s, 2, &line_to->nXStart, FALSE) &&
1731 read_order_field_coord(orderName, orderInfo, s, 3, &line_to->nYStart, FALSE) &&
1732 read_order_field_coord(orderName, orderInfo, s, 4, &line_to->nXEnd, FALSE) &&
1733 read_order_field_coord(orderName, orderInfo, s, 5, &line_to->nYEnd, FALSE) &&
1734 read_order_field_color(orderName, orderInfo, s, 6, &line_to->backColor, TRUE) &&
1735 read_order_field_byte(orderName, orderInfo, s, 7, &line_to->bRop2, TRUE) &&
1736 read_order_field_byte(orderName, orderInfo, s, 8, &line_to->penStyle, TRUE) &&
1737 read_order_field_byte(orderName, orderInfo, s, 9, &line_to->penWidth, TRUE) &&
1738 read_order_field_color(orderName, orderInfo, s, 10, &line_to->penColor, TRUE))
1745 WINPR_UNUSED(orderInfo);
1746 WINPR_UNUSED(line_to);
1752 if (!Stream_EnsureRemainingCapacity(s, update_approximate_line_to_order(orderInfo, line_to)))
1755 orderInfo->fieldFlags = 0;
1756 orderInfo->fieldFlags |= ORDER_FIELD_01;
1757 Stream_Write_UINT16(s, line_to->backMode);
1758 orderInfo->fieldFlags |= ORDER_FIELD_02;
1759 if (!update_write_coord(s, line_to->nXStart))
1761 orderInfo->fieldFlags |= ORDER_FIELD_03;
1762 if (!update_write_coord(s, line_to->nYStart))
1764 orderInfo->fieldFlags |= ORDER_FIELD_04;
1765 if (!update_write_coord(s, line_to->nXEnd))
1767 orderInfo->fieldFlags |= ORDER_FIELD_05;
1768 if (!update_write_coord(s, line_to->nYEnd))
1770 orderInfo->fieldFlags |= ORDER_FIELD_06;
1771 update_write_color(s, line_to->backColor);
1772 orderInfo->fieldFlags |= ORDER_FIELD_07;
1773 Stream_Write_UINT8(s, line_to->bRop2);
1774 orderInfo->fieldFlags |= ORDER_FIELD_08;
1775 Stream_Write_UINT8(s, line_to->penStyle);
1776 orderInfo->fieldFlags |= ORDER_FIELD_09;
1777 Stream_Write_UINT8(s, line_to->penWidth);
1778 orderInfo->fieldFlags |= ORDER_FIELD_10;
1779 update_write_color(s, line_to->penColor);
1783 static BOOL update_read_polyline_order(
const char* orderName,
wStream* s,
1787 UINT32 new_num = polyline->numDeltaEntries;
1788 if (!read_order_field_coord(orderName, orderInfo, s, 1, &polyline->xStart, FALSE) ||
1789 !read_order_field_coord(orderName, orderInfo, s, 2, &polyline->yStart, FALSE) ||
1790 !read_order_field_byte(orderName, orderInfo, s, 3, &polyline->bRop2, TRUE) ||
1791 !read_order_field_uint16(orderName, orderInfo, s, 4, &word, TRUE) ||
1792 !read_order_field_color(orderName, orderInfo, s, 5, &polyline->penColor, TRUE) ||
1793 !read_order_field_byte(orderName, orderInfo, s, 6, &new_num, TRUE))
1796 if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
1801 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1804 Stream_Read_UINT8(s, polyline->cbData);
1806 polyline->numDeltaEntries = new_num;
1807 return update_read_delta_points(s, &polyline->points, polyline->numDeltaEntries,
1808 polyline->xStart, polyline->yStart);
1810 if (new_num > polyline->numDeltaEntries)
1812 WLog_ERR(TAG,
"%s numDeltaEntries %" PRIu32
" > %" PRIu32, orderName, new_num,
1813 polyline->numDeltaEntries);
1816 polyline->numDeltaEntries = new_num;
1821 static BOOL update_read_memblt_order(
const char* orderName,
wStream* s,
const ORDER_INFO* orderInfo,
1824 if (!s || !orderInfo || !memblt)
1827 if (!read_order_field_uint16(orderName, orderInfo, s, 1, &memblt->cacheId, TRUE) ||
1828 !read_order_field_coord(orderName, orderInfo, s, 2, &memblt->nLeftRect, FALSE) ||
1829 !read_order_field_coord(orderName, orderInfo, s, 3, &memblt->nTopRect, FALSE) ||
1830 !read_order_field_coord(orderName, orderInfo, s, 4, &memblt->nWidth, FALSE) ||
1831 !read_order_field_coord(orderName, orderInfo, s, 5, &memblt->nHeight, FALSE) ||
1832 !read_order_field_byte(orderName, orderInfo, s, 6, &memblt->bRop, TRUE) ||
1833 !read_order_field_coord(orderName, orderInfo, s, 7, &memblt->nXSrc, FALSE) ||
1834 !read_order_field_coord(orderName, orderInfo, s, 8, &memblt->nYSrc, FALSE) ||
1835 !read_order_field_uint16(orderName, orderInfo, s, 9, &memblt->cacheIndex, TRUE))
1837 memblt->colorIndex = (memblt->cacheId >> 8);
1838 memblt->cacheId = (memblt->cacheId & 0xFF);
1839 memblt->bitmap = NULL;
1845 WINPR_UNUSED(orderInfo);
1846 WINPR_UNUSED(memblt);
1854 if (!Stream_EnsureRemainingCapacity(s, update_approximate_memblt_order(orderInfo, memblt)))
1857 cacheId = (memblt->cacheId & 0xFF) | ((memblt->colorIndex & 0xFF) << 8);
1858 orderInfo->fieldFlags |= ORDER_FIELD_01;
1859 Stream_Write_UINT16(s, cacheId);
1860 orderInfo->fieldFlags |= ORDER_FIELD_02;
1861 if (!update_write_coord(s, memblt->nLeftRect))
1863 orderInfo->fieldFlags |= ORDER_FIELD_03;
1864 if (!update_write_coord(s, memblt->nTopRect))
1866 orderInfo->fieldFlags |= ORDER_FIELD_04;
1867 if (!update_write_coord(s, memblt->nWidth))
1869 orderInfo->fieldFlags |= ORDER_FIELD_05;
1870 if (!update_write_coord(s, memblt->nHeight))
1872 orderInfo->fieldFlags |= ORDER_FIELD_06;
1873 Stream_Write_UINT8(s, memblt->bRop);
1874 orderInfo->fieldFlags |= ORDER_FIELD_07;
1875 if (!update_write_coord(s, memblt->nXSrc))
1877 orderInfo->fieldFlags |= ORDER_FIELD_08;
1878 if (!update_write_coord(s, memblt->nYSrc))
1880 orderInfo->fieldFlags |= ORDER_FIELD_09;
1881 Stream_Write_UINT16(s, memblt->cacheIndex);
1884 static BOOL update_read_mem3blt_order(
const char* orderName,
wStream* s,
1887 if (!read_order_field_uint16(orderName, orderInfo, s, 1, &mem3blt->cacheId, TRUE) ||
1888 !read_order_field_coord(orderName, orderInfo, s, 2, &mem3blt->nLeftRect, FALSE) ||
1889 !read_order_field_coord(orderName, orderInfo, s, 3, &mem3blt->nTopRect, FALSE) ||
1890 !read_order_field_coord(orderName, orderInfo, s, 4, &mem3blt->nWidth, FALSE) ||
1891 !read_order_field_coord(orderName, orderInfo, s, 5, &mem3blt->nHeight, FALSE) ||
1892 !read_order_field_byte(orderName, orderInfo, s, 6, &mem3blt->bRop, TRUE) ||
1893 !read_order_field_coord(orderName, orderInfo, s, 7, &mem3blt->nXSrc, FALSE) ||
1894 !read_order_field_coord(orderName, orderInfo, s, 8, &mem3blt->nYSrc, FALSE) ||
1895 !read_order_field_color(orderName, orderInfo, s, 9, &mem3blt->backColor, TRUE) ||
1896 !read_order_field_color(orderName, orderInfo, s, 10, &mem3blt->foreColor, TRUE))
1899 if (!update_read_brush(s, &mem3blt->brush, orderInfo->fieldFlags >> 10) ||
1900 !read_order_field_uint16(orderName, orderInfo, s, 16, &mem3blt->cacheIndex, TRUE))
1902 mem3blt->colorIndex = (mem3blt->cacheId >> 8);
1903 mem3blt->cacheId = (mem3blt->cacheId & 0xFF);
1904 mem3blt->bitmap = NULL;
1907 static BOOL update_read_save_bitmap_order(
const char* orderName,
wStream* s,
1911 if (read_order_field_uint32(orderName, orderInfo, s, 1, &save_bitmap->savedBitmapPosition,
1913 read_order_field_coord(orderName, orderInfo, s, 2, &save_bitmap->nLeftRect, FALSE) &&
1914 read_order_field_coord(orderName, orderInfo, s, 3, &save_bitmap->nTopRect, FALSE) &&
1915 read_order_field_coord(orderName, orderInfo, s, 4, &save_bitmap->nRightRect, FALSE) &&
1916 read_order_field_coord(orderName, orderInfo, s, 5, &save_bitmap->nBottomRect, FALSE) &&
1917 read_order_field_byte(orderName, orderInfo, s, 6, &save_bitmap->operation, TRUE))
1921 static BOOL update_read_glyph_index_order(
const char* orderName,
wStream* s,
1925 if (!read_order_field_byte(orderName, orderInfo, s, 1, &glyph_index->cacheId, TRUE) ||
1926 !read_order_field_byte(orderName, orderInfo, s, 2, &glyph_index->flAccel, TRUE) ||
1927 !read_order_field_byte(orderName, orderInfo, s, 3, &glyph_index->ulCharInc, TRUE) ||
1928 !read_order_field_byte(orderName, orderInfo, s, 4, &glyph_index->fOpRedundant, TRUE) ||
1929 !read_order_field_color(orderName, orderInfo, s, 5, &glyph_index->backColor, TRUE) ||
1930 !read_order_field_color(orderName, orderInfo, s, 6, &glyph_index->foreColor, TRUE) ||
1931 !read_order_field_int16(orderName, orderInfo, s, 7, &glyph_index->bkLeft, TRUE) ||
1932 !read_order_field_int16(orderName, orderInfo, s, 8, &glyph_index->bkTop, TRUE) ||
1933 !read_order_field_int16(orderName, orderInfo, s, 9, &glyph_index->bkRight, TRUE) ||
1934 !read_order_field_int16(orderName, orderInfo, s, 10, &glyph_index->bkBottom, TRUE) ||
1935 !read_order_field_int16(orderName, orderInfo, s, 11, &glyph_index->opLeft, TRUE) ||
1936 !read_order_field_int16(orderName, orderInfo, s, 12, &glyph_index->opTop, TRUE) ||
1937 !read_order_field_int16(orderName, orderInfo, s, 13, &glyph_index->opRight, TRUE) ||
1938 !read_order_field_int16(orderName, orderInfo, s, 14, &glyph_index->opBottom, TRUE) ||
1939 !update_read_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14) ||
1940 !read_order_field_int16(orderName, orderInfo, s, 20, &glyph_index->x, TRUE) ||
1941 !read_order_field_int16(orderName, orderInfo, s, 21, &glyph_index->y, TRUE))
1944 if ((orderInfo->fieldFlags & ORDER_FIELD_22) != 0)
1946 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
1949 Stream_Read_UINT8(s, glyph_index->cbData);
1951 if (!Stream_CheckAndLogRequiredLength(TAG, s, glyph_index->cbData))
1954 CopyMemory(glyph_index->data, Stream_ConstPointer(s), glyph_index->cbData);
1955 Stream_Seek(s, glyph_index->cbData);
1961 size_t update_approximate_glyph_index_order(
ORDER_INFO* orderInfo,
1964 WINPR_UNUSED(orderInfo);
1965 WINPR_UNUSED(glyph_index);
1972 size_t inf = update_approximate_glyph_index_order(orderInfo, glyph_index);
1974 if (!Stream_EnsureRemainingCapacity(s, inf))
1977 orderInfo->fieldFlags = 0;
1978 orderInfo->fieldFlags |= ORDER_FIELD_01;
1979 Stream_Write_UINT8(s, glyph_index->cacheId);
1980 orderInfo->fieldFlags |= ORDER_FIELD_02;
1981 Stream_Write_UINT8(s, glyph_index->flAccel);
1982 orderInfo->fieldFlags |= ORDER_FIELD_03;
1983 Stream_Write_UINT8(s, glyph_index->ulCharInc);
1984 orderInfo->fieldFlags |= ORDER_FIELD_04;
1985 Stream_Write_UINT8(s, glyph_index->fOpRedundant);
1986 orderInfo->fieldFlags |= ORDER_FIELD_05;
1987 update_write_color(s, glyph_index->backColor);
1988 orderInfo->fieldFlags |= ORDER_FIELD_06;
1989 update_write_color(s, glyph_index->foreColor);
1990 orderInfo->fieldFlags |= ORDER_FIELD_07;
1991 Stream_Write_UINT16(s, glyph_index->bkLeft);
1992 orderInfo->fieldFlags |= ORDER_FIELD_08;
1993 Stream_Write_UINT16(s, glyph_index->bkTop);
1994 orderInfo->fieldFlags |= ORDER_FIELD_09;
1995 Stream_Write_UINT16(s, glyph_index->bkRight);
1996 orderInfo->fieldFlags |= ORDER_FIELD_10;
1997 Stream_Write_UINT16(s, glyph_index->bkBottom);
1998 orderInfo->fieldFlags |= ORDER_FIELD_11;
1999 Stream_Write_UINT16(s, glyph_index->opLeft);
2000 orderInfo->fieldFlags |= ORDER_FIELD_12;
2001 Stream_Write_UINT16(s, glyph_index->opTop);
2002 orderInfo->fieldFlags |= ORDER_FIELD_13;
2003 Stream_Write_UINT16(s, glyph_index->opRight);
2004 orderInfo->fieldFlags |= ORDER_FIELD_14;
2005 Stream_Write_UINT16(s, glyph_index->opBottom);
2006 orderInfo->fieldFlags |= ORDER_FIELD_15;
2007 orderInfo->fieldFlags |= ORDER_FIELD_16;
2008 orderInfo->fieldFlags |= ORDER_FIELD_17;
2009 orderInfo->fieldFlags |= ORDER_FIELD_18;
2010 orderInfo->fieldFlags |= ORDER_FIELD_19;
2011 update_write_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14);
2012 orderInfo->fieldFlags |= ORDER_FIELD_20;
2013 Stream_Write_UINT16(s, glyph_index->x);
2014 orderInfo->fieldFlags |= ORDER_FIELD_21;
2015 Stream_Write_UINT16(s, glyph_index->y);
2016 orderInfo->fieldFlags |= ORDER_FIELD_22;
2017 Stream_Write_UINT8(s, glyph_index->cbData);
2018 Stream_Write(s, glyph_index->data, glyph_index->cbData);
2021 static BOOL update_read_fast_index_order(
const char* orderName,
wStream* s,
2024 if (!read_order_field_byte(orderName, orderInfo, s, 1, &fast_index->cacheId, TRUE) ||
2025 !read_order_field_2bytes(orderName, orderInfo, s, 2, &fast_index->ulCharInc,
2026 &fast_index->flAccel, TRUE) ||
2027 !read_order_field_color(orderName, orderInfo, s, 3, &fast_index->backColor, TRUE) ||
2028 !read_order_field_color(orderName, orderInfo, s, 4, &fast_index->foreColor, TRUE) ||
2029 !read_order_field_coord(orderName, orderInfo, s, 5, &fast_index->bkLeft, FALSE) ||
2030 !read_order_field_coord(orderName, orderInfo, s, 6, &fast_index->bkTop, FALSE) ||
2031 !read_order_field_coord(orderName, orderInfo, s, 7, &fast_index->bkRight, FALSE) ||
2032 !read_order_field_coord(orderName, orderInfo, s, 8, &fast_index->bkBottom, FALSE) ||
2033 !read_order_field_coord(orderName, orderInfo, s, 9, &fast_index->opLeft, FALSE) ||
2034 !read_order_field_coord(orderName, orderInfo, s, 10, &fast_index->opTop, FALSE) ||
2035 !read_order_field_coord(orderName, orderInfo, s, 11, &fast_index->opRight, FALSE) ||
2036 !read_order_field_coord(orderName, orderInfo, s, 12, &fast_index->opBottom, FALSE) ||
2037 !read_order_field_coord(orderName, orderInfo, s, 13, &fast_index->x, FALSE) ||
2038 !read_order_field_coord(orderName, orderInfo, s, 14, &fast_index->y, FALSE))
2041 if ((orderInfo->fieldFlags & ORDER_FIELD_15) != 0)
2043 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
2046 Stream_Read_UINT8(s, fast_index->cbData);
2048 if (!Stream_CheckAndLogRequiredLength(TAG, s, fast_index->cbData))
2051 CopyMemory(fast_index->data, Stream_ConstPointer(s), fast_index->cbData);
2052 Stream_Seek(s, fast_index->cbData);
2057 static BOOL update_read_fast_glyph_order(
const char* orderName,
wStream* s,
2061 if (!read_order_field_byte(orderName, orderInfo, s, 1, &fastGlyph->cacheId, TRUE))
2063 if (fastGlyph->cacheId > 9)
2065 if (!read_order_field_2bytes(orderName, orderInfo, s, 2, &fastGlyph->ulCharInc,
2066 &fastGlyph->flAccel, TRUE) ||
2067 !read_order_field_color(orderName, orderInfo, s, 3, &fastGlyph->backColor, TRUE) ||
2068 !read_order_field_color(orderName, orderInfo, s, 4, &fastGlyph->foreColor, TRUE) ||
2069 !read_order_field_coord(orderName, orderInfo, s, 5, &fastGlyph->bkLeft, FALSE) ||
2070 !read_order_field_coord(orderName, orderInfo, s, 6, &fastGlyph->bkTop, FALSE) ||
2071 !read_order_field_coord(orderName, orderInfo, s, 7, &fastGlyph->bkRight, FALSE) ||
2072 !read_order_field_coord(orderName, orderInfo, s, 8, &fastGlyph->bkBottom, FALSE) ||
2073 !read_order_field_coord(orderName, orderInfo, s, 9, &fastGlyph->opLeft, FALSE) ||
2074 !read_order_field_coord(orderName, orderInfo, s, 10, &fastGlyph->opTop, FALSE) ||
2075 !read_order_field_coord(orderName, orderInfo, s, 11, &fastGlyph->opRight, FALSE) ||
2076 !read_order_field_coord(orderName, orderInfo, s, 12, &fastGlyph->opBottom, FALSE) ||
2077 !read_order_field_coord(orderName, orderInfo, s, 13, &fastGlyph->x, FALSE) ||
2078 !read_order_field_coord(orderName, orderInfo, s, 14, &fastGlyph->y, FALSE))
2081 if ((orderInfo->fieldFlags & ORDER_FIELD_15) != 0)
2083 const BYTE* src = NULL;
2086 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
2089 Stream_Read_UINT8(s, fastGlyph->cbData);
2091 src = Stream_ConstPointer(s);
2092 if (!Stream_SafeSeek(s, fastGlyph->cbData) || (fastGlyph->cbData == 0))
2095 CopyMemory(fastGlyph->data, src, fastGlyph->cbData);
2096 sub = Stream_StaticInit(&subbuffer, fastGlyph->data, fastGlyph->cbData);
2098 Stream_Read_UINT8(sub, glyph->cacheIndex);
2100 if (fastGlyph->cbData > 1)
2102 if (!update_read_2byte_signed(sub, &glyph->x) ||
2103 !update_read_2byte_signed(sub, &glyph->y) ||
2104 !update_read_2byte_unsigned(sub, &glyph->cx) ||
2105 !update_read_2byte_unsigned(sub, &glyph->cy))
2108 if ((glyph->cx == 0) || (glyph->cy == 0))
2110 WLog_ERR(TAG,
"GLYPH_DATA_V2::cx=%" PRIu32
", GLYPH_DATA_V2::cy=%" PRIu32,
2111 glyph->cx, glyph->cy);
2115 const size_t slen = Stream_GetRemainingLength(sub);
2116 if (slen > UINT32_MAX)
2118 glyph->cb = (UINT32)slen;
2121 BYTE* new_aj = (BYTE*)realloc(glyph->aj, glyph->cb);
2127 Stream_Read(sub, glyph->aj, glyph->cb);
2139 static BOOL update_read_polygon_sc_order(
const char* orderName,
wStream* s,
2142 UINT32 num = polygon_sc->numPoints;
2143 if (!read_order_field_coord(orderName, orderInfo, s, 1, &polygon_sc->xStart, FALSE) ||
2144 !read_order_field_coord(orderName, orderInfo, s, 2, &polygon_sc->yStart, FALSE) ||
2145 !read_order_field_byte(orderName, orderInfo, s, 3, &polygon_sc->bRop2, TRUE) ||
2146 !read_order_field_byte(orderName, orderInfo, s, 4, &polygon_sc->fillMode, TRUE) ||
2147 !read_order_field_color(orderName, orderInfo, s, 5, &polygon_sc->brushColor, TRUE) ||
2148 !read_order_field_byte(orderName, orderInfo, s, 6, &num, TRUE))
2151 if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
2156 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
2159 Stream_Read_UINT8(s, polygon_sc->cbData);
2161 polygon_sc->numPoints = num;
2162 return update_read_delta_points(s, &polygon_sc->points, polygon_sc->numPoints,
2163 polygon_sc->xStart, polygon_sc->yStart);
2165 if (num > polygon_sc->numPoints)
2167 WLog_ERR(TAG,
"%s numPoints %" PRIu32
" > %" PRIu32, orderName, num, polygon_sc->numPoints);
2170 polygon_sc->numPoints = num;
2174 static BOOL update_read_polygon_cb_order(
const char* orderName,
wStream* s,
2177 UINT32 num = polygon_cb->numPoints;
2178 if (!read_order_field_coord(orderName, orderInfo, s, 1, &polygon_cb->xStart, FALSE) ||
2179 !read_order_field_coord(orderName, orderInfo, s, 2, &polygon_cb->yStart, FALSE) ||
2180 !read_order_field_byte(orderName, orderInfo, s, 3, &polygon_cb->bRop2, TRUE) ||
2181 !read_order_field_byte(orderName, orderInfo, s, 4, &polygon_cb->fillMode, TRUE) ||
2182 !read_order_field_color(orderName, orderInfo, s, 5, &polygon_cb->backColor, TRUE) ||
2183 !read_order_field_color(orderName, orderInfo, s, 6, &polygon_cb->foreColor, TRUE))
2186 if (!update_read_brush(s, &polygon_cb->brush, orderInfo->fieldFlags >> 6))
2189 if (!read_order_field_byte(orderName, orderInfo, s, 12, &num, TRUE))
2192 if ((orderInfo->fieldFlags & ORDER_FIELD_13) != 0)
2197 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
2200 Stream_Read_UINT8(s, polygon_cb->cbData);
2201 polygon_cb->numPoints = num;
2203 if (!update_read_delta_points(s, &polygon_cb->points, polygon_cb->numPoints,
2204 polygon_cb->xStart, polygon_cb->yStart))
2208 if (num > polygon_cb->numPoints)
2210 WLog_ERR(TAG,
"%s numPoints %" PRIu32
" > %" PRIu32, orderName, num, polygon_cb->numPoints);
2213 polygon_cb->numPoints = num;
2215 polygon_cb->backMode = (polygon_cb->bRop2 & 0x80) ? BACKMODE_TRANSPARENT : BACKMODE_OPAQUE;
2216 polygon_cb->bRop2 = (polygon_cb->bRop2 & 0x1F);
2219 static BOOL update_read_ellipse_sc_order(
const char* orderName,
wStream* s,
2222 if (read_order_field_coord(orderName, orderInfo, s, 1, &ellipse_sc->leftRect, FALSE) &&
2223 read_order_field_coord(orderName, orderInfo, s, 2, &ellipse_sc->topRect, FALSE) &&
2224 read_order_field_coord(orderName, orderInfo, s, 3, &ellipse_sc->rightRect, FALSE) &&
2225 read_order_field_coord(orderName, orderInfo, s, 4, &ellipse_sc->bottomRect, FALSE) &&
2226 read_order_field_byte(orderName, orderInfo, s, 5, &ellipse_sc->bRop2, TRUE) &&
2227 read_order_field_byte(orderName, orderInfo, s, 6, &ellipse_sc->fillMode, TRUE) &&
2228 read_order_field_color(orderName, orderInfo, s, 7, &ellipse_sc->color, TRUE))
2232 static BOOL update_read_ellipse_cb_order(
const char* orderName,
wStream* s,
2235 if (read_order_field_coord(orderName, orderInfo, s, 1, &ellipse_cb->leftRect, FALSE) &&
2236 read_order_field_coord(orderName, orderInfo, s, 2, &ellipse_cb->topRect, FALSE) &&
2237 read_order_field_coord(orderName, orderInfo, s, 3, &ellipse_cb->rightRect, FALSE) &&
2238 read_order_field_coord(orderName, orderInfo, s, 4, &ellipse_cb->bottomRect, FALSE) &&
2239 read_order_field_byte(orderName, orderInfo, s, 5, &ellipse_cb->bRop2, TRUE) &&
2240 read_order_field_byte(orderName, orderInfo, s, 6, &ellipse_cb->fillMode, TRUE) &&
2241 read_order_field_color(orderName, orderInfo, s, 7, &ellipse_cb->backColor, TRUE) &&
2242 read_order_field_color(orderName, orderInfo, s, 8, &ellipse_cb->foreColor, TRUE) &&
2243 update_read_brush(s, &ellipse_cb->brush, orderInfo->fieldFlags >> 8))
2249 WINPR_ATTR_MALLOC(free_cache_bitmap_order, 2)
2251 BOOL compressed, UINT16 flags)
2264 if (!Stream_CheckAndLogRequiredLength(TAG, s, 9))
2267 Stream_Read_UINT8(s, cache_bitmap->cacheId);
2268 Stream_Seek_UINT8(s);
2269 Stream_Read_UINT8(s, cache_bitmap->bitmapWidth);
2270 Stream_Read_UINT8(s, cache_bitmap->bitmapHeight);
2271 Stream_Read_UINT8(s, cache_bitmap->bitmapBpp);
2273 if ((cache_bitmap->bitmapBpp < 1) || (cache_bitmap->bitmapBpp > 32))
2275 WLog_Print(up->log, WLOG_ERROR,
"invalid bitmap bpp %" PRIu32
"", cache_bitmap->bitmapBpp);
2279 Stream_Read_UINT16(s, cache_bitmap->bitmapLength);
2280 Stream_Read_UINT16(s, cache_bitmap->cacheIndex);
2284 if ((flags & NO_BITMAP_COMPRESSION_HDR) == 0)
2286 BYTE* bitmapComprHdr = (BYTE*)&(cache_bitmap->bitmapComprHdr);
2288 if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
2291 Stream_Read(s, bitmapComprHdr, 8);
2292 cache_bitmap->bitmapLength -= 8;
2296 if (cache_bitmap->bitmapLength == 0)
2299 if (!Stream_CheckAndLogRequiredLength(TAG, s, cache_bitmap->bitmapLength))
2302 cache_bitmap->bitmapDataStream = malloc(cache_bitmap->bitmapLength);
2304 if (!cache_bitmap->bitmapDataStream)
2307 Stream_Read(s, cache_bitmap->bitmapDataStream, cache_bitmap->bitmapLength);
2308 cache_bitmap->compressed = compressed;
2309 return cache_bitmap;
2311 WINPR_PRAGMA_DIAG_PUSH
2312 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2313 free_cache_bitmap_order(update->context, cache_bitmap);
2314 WINPR_PRAGMA_DIAG_POP
2319 BOOL compressed,
const UINT16* flags)
2321 WINPR_ASSERT(cache_bitmap);
2322 WINPR_UNUSED(compressed);
2323 WINPR_UNUSED(flags);
2324 return 64 + cache_bitmap->bitmapLength;
2328 BOOL compressed, UINT16* flags)
2330 UINT32 bitmapLength = cache_bitmap->bitmapLength;
2331 size_t inf = update_approximate_cache_bitmap_order(cache_bitmap, compressed, flags);
2333 if (!Stream_EnsureRemainingCapacity(s, inf))
2336 *flags = NO_BITMAP_COMPRESSION_HDR;
2338 if ((*flags & NO_BITMAP_COMPRESSION_HDR) == 0)
2341 Stream_Write_UINT8(s, cache_bitmap->cacheId);
2342 Stream_Write_UINT8(s, 0);
2343 Stream_Write_UINT8(s, cache_bitmap->bitmapWidth);
2344 Stream_Write_UINT8(s, cache_bitmap->bitmapHeight);
2345 Stream_Write_UINT8(s, cache_bitmap->bitmapBpp);
2346 Stream_Write_UINT16(s, bitmapLength);
2347 Stream_Write_UINT16(s, cache_bitmap->cacheIndex);
2351 if ((*flags & NO_BITMAP_COMPRESSION_HDR) == 0)
2353 const BYTE* bitmapComprHdr = (
const BYTE*)&(cache_bitmap->bitmapComprHdr);
2354 Stream_Write(s, bitmapComprHdr, 8);
2358 Stream_Write(s, cache_bitmap->bitmapDataStream, bitmapLength);
2362 Stream_Write(s, cache_bitmap->bitmapDataStream, bitmapLength);
2368 WINPR_ATTR_MALLOC(free_cache_bitmap_v2_order, 2)
2370 BOOL compressed, UINT16 flags)
2373 BYTE bitsPerPixelId = 0;
2381 if (!cache_bitmap_v2)
2384 cache_bitmap_v2->cacheId = flags & 0x0003;
2385 cache_bitmap_v2->flags = (flags & 0xFF80) >> 7;
2386 bitsPerPixelId = (flags & 0x0078) >> 3;
2387 cache_bitmap_v2->bitmapBpp = get_cbr2_bpp(bitsPerPixelId, &rc);
2391 if (cache_bitmap_v2->flags & CBR2_PERSISTENT_KEY_PRESENT)
2393 if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
2396 Stream_Read_UINT32(s, cache_bitmap_v2->key1);
2397 Stream_Read_UINT32(s, cache_bitmap_v2->key2);
2400 if (cache_bitmap_v2->flags & CBR2_HEIGHT_SAME_AS_WIDTH)
2402 if (!update_read_2byte_unsigned(s, &cache_bitmap_v2->bitmapWidth))
2405 cache_bitmap_v2->bitmapHeight = cache_bitmap_v2->bitmapWidth;
2409 if (!update_read_2byte_unsigned(s, &cache_bitmap_v2->bitmapWidth) ||
2410 !update_read_2byte_unsigned(s, &cache_bitmap_v2->bitmapHeight))
2414 if (!update_read_4byte_unsigned(s, &cache_bitmap_v2->bitmapLength) ||
2415 !update_read_2byte_unsigned(s, &cache_bitmap_v2->cacheIndex))
2418 if (cache_bitmap_v2->flags & CBR2_DO_NOT_CACHE)
2419 cache_bitmap_v2->cacheIndex = BITMAP_CACHE_WAITING_LIST_INDEX;
2423 if (!(cache_bitmap_v2->flags & CBR2_NO_BITMAP_COMPRESSION_HDR))
2425 if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
2429 s, cache_bitmap_v2->cbCompFirstRowSize);
2431 s, cache_bitmap_v2->cbCompMainBodySize);
2432 Stream_Read_UINT16(s, cache_bitmap_v2->cbScanWidth);
2434 s, cache_bitmap_v2->cbUncompressedSize);
2435 cache_bitmap_v2->bitmapLength = cache_bitmap_v2->cbCompMainBodySize;
2439 if (cache_bitmap_v2->bitmapLength == 0)
2442 if (!Stream_CheckAndLogRequiredLength(TAG, s, cache_bitmap_v2->bitmapLength))
2445 if (cache_bitmap_v2->bitmapLength == 0)
2448 cache_bitmap_v2->bitmapDataStream = malloc(cache_bitmap_v2->bitmapLength);
2450 if (!cache_bitmap_v2->bitmapDataStream)
2453 Stream_Read(s, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapLength);
2454 cache_bitmap_v2->compressed = compressed;
2455 return cache_bitmap_v2;
2457 WINPR_PRAGMA_DIAG_PUSH
2458 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2459 free_cache_bitmap_v2_order(update->context, cache_bitmap_v2);
2460 WINPR_PRAGMA_DIAG_POP
2465 BOOL compressed,
const UINT16* flags)
2467 WINPR_ASSERT(cache_bitmap_v2);
2468 WINPR_UNUSED(flags);
2469 WINPR_UNUSED(compressed);
2471 return 64 + cache_bitmap_v2->bitmapLength;
2475 BOOL compressed, UINT16* flags)
2478 BYTE bitsPerPixelId = 0;
2480 if (!Stream_EnsureRemainingCapacity(
2481 s, update_approximate_cache_bitmap_v2_order(cache_bitmap_v2, compressed, flags)))
2484 bitsPerPixelId = get_bpp_bmf(cache_bitmap_v2->bitmapBpp, &rc);
2487 *flags = (cache_bitmap_v2->cacheId & 0x0003) | (bitsPerPixelId << 3) |
2488 ((cache_bitmap_v2->flags << 7) & 0xFF80);
2490 if (cache_bitmap_v2->flags & CBR2_PERSISTENT_KEY_PRESENT)
2492 Stream_Write_UINT32(s, cache_bitmap_v2->key1);
2493 Stream_Write_UINT32(s, cache_bitmap_v2->key2);
2496 if (cache_bitmap_v2->flags & CBR2_HEIGHT_SAME_AS_WIDTH)
2498 if (!update_write_2byte_unsigned(s, cache_bitmap_v2->bitmapWidth))
2503 if (!update_write_2byte_unsigned(s, cache_bitmap_v2->bitmapWidth) ||
2504 !update_write_2byte_unsigned(s, cache_bitmap_v2->bitmapHeight))
2508 if (cache_bitmap_v2->flags & CBR2_DO_NOT_CACHE)
2509 cache_bitmap_v2->cacheIndex = BITMAP_CACHE_WAITING_LIST_INDEX;
2511 if (!update_write_4byte_unsigned(s, cache_bitmap_v2->bitmapLength) ||
2512 !update_write_2byte_unsigned(s, cache_bitmap_v2->cacheIndex))
2517 if (!(cache_bitmap_v2->flags & CBR2_NO_BITMAP_COMPRESSION_HDR))
2519 Stream_Write_UINT16(
2520 s, cache_bitmap_v2->cbCompFirstRowSize);
2521 Stream_Write_UINT16(
2522 s, cache_bitmap_v2->cbCompMainBodySize);
2523 Stream_Write_UINT16(s, cache_bitmap_v2->cbScanWidth);
2524 Stream_Write_UINT16(
2525 s, cache_bitmap_v2->cbUncompressedSize);
2526 cache_bitmap_v2->bitmapLength = cache_bitmap_v2->cbCompMainBodySize;
2529 if (!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength))
2532 Stream_Write(s, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapLength);
2536 if (!Stream_EnsureRemainingCapacity(s, cache_bitmap_v2->bitmapLength))
2539 Stream_Write(s, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapLength);
2542 cache_bitmap_v2->compressed = compressed;
2546 WINPR_ATTR_MALLOC(free_cache_bitmap_v3_order, 2)
2551 BYTE bitsPerPixelId = 0;
2554 BYTE* new_data = NULL;
2563 if (!cache_bitmap_v3)
2566 cache_bitmap_v3->cacheId = flags & 0x00000003;
2567 cache_bitmap_v3->flags = (flags & 0x0000FF80) >> 7;
2568 bitsPerPixelId = (flags & 0x00000078) >> 3;
2569 cache_bitmap_v3->bpp = get_cbr2_bpp(bitsPerPixelId, &rc);
2573 if (!Stream_CheckAndLogRequiredLength(TAG, s, 21))
2576 Stream_Read_UINT16(s, cache_bitmap_v3->cacheIndex);
2577 Stream_Read_UINT32(s, cache_bitmap_v3->key1);
2578 Stream_Read_UINT32(s, cache_bitmap_v3->key2);
2579 bitmapData = &cache_bitmap_v3->bitmapData;
2580 Stream_Read_UINT8(s, bitmapData->bpp);
2582 if ((bitmapData->bpp < 1) || (bitmapData->bpp > 32))
2584 WLog_Print(up->log, WLOG_ERROR,
"invalid bpp value %" PRIu32
"", bitmapData->bpp);
2588 Stream_Seek_UINT8(s);
2589 Stream_Seek_UINT8(s);
2590 Stream_Read_UINT8(s, bitmapData->codecID);
2591 Stream_Read_UINT16(s, bitmapData->width);
2592 Stream_Read_UINT16(s, bitmapData->height);
2593 Stream_Read_UINT32(s, new_len);
2595 if ((new_len == 0) || (!Stream_CheckAndLogRequiredLength(TAG, s, new_len)))
2598 new_data = (BYTE*)realloc(bitmapData->data, new_len);
2603 bitmapData->data = new_data;
2604 bitmapData->length = new_len;
2605 Stream_Read(s, bitmapData->data, bitmapData->length);
2606 return cache_bitmap_v3;
2608 WINPR_PRAGMA_DIAG_PUSH
2609 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2610 free_cache_bitmap_v3_order(update->context, cache_bitmap_v3);
2611 WINPR_PRAGMA_DIAG_POP
2619 return 64 + bitmapData->length;
2626 BYTE bitsPerPixelId = 0;
2629 if (!Stream_EnsureRemainingCapacity(
2630 s, update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, flags)))
2633 bitmapData = &cache_bitmap_v3->bitmapData;
2634 bitsPerPixelId = get_bpp_bmf(cache_bitmap_v3->bpp, &rc);
2637 *flags = (cache_bitmap_v3->cacheId & 0x00000003) |
2638 ((cache_bitmap_v3->flags << 7) & 0x0000FF80) | ((bitsPerPixelId << 3) & 0x00000078);
2639 Stream_Write_UINT16(s, cache_bitmap_v3->cacheIndex);
2640 Stream_Write_UINT32(s, cache_bitmap_v3->key1);
2641 Stream_Write_UINT32(s, cache_bitmap_v3->key2);
2642 Stream_Write_UINT8(s, bitmapData->bpp);
2643 Stream_Write_UINT8(s, 0);
2644 Stream_Write_UINT8(s, 0);
2645 Stream_Write_UINT8(s, bitmapData->codecID);
2646 Stream_Write_UINT16(s, bitmapData->width);
2647 Stream_Write_UINT16(s, bitmapData->height);
2648 Stream_Write_UINT32(s, bitmapData->length);
2649 Stream_Write(s, bitmapData->data, bitmapData->length);
2653 WINPR_ATTR_MALLOC(free_cache_color_table_order, 2)
2657 UINT32* colorTable = NULL;
2660 if (!cache_color_table)
2663 if (!Stream_CheckAndLogRequiredLength(TAG, s, 3))
2666 Stream_Read_UINT8(s, cache_color_table->cacheIndex);
2667 Stream_Read_UINT16(s, cache_color_table->numberColors);
2669 if (cache_color_table->numberColors != 256)
2675 if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, cache_color_table->numberColors, 4ull))
2678 colorTable = (UINT32*)&cache_color_table->colorTable;
2680 for (UINT32 i = 0; i < cache_color_table->numberColors; i++)
2681 update_read_color_quad(s, &colorTable[i]);
2683 return cache_color_table;
2685 WINPR_PRAGMA_DIAG_PUSH
2686 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2687 free_cache_color_table_order(update->context, cache_color_table);
2688 WINPR_PRAGMA_DIAG_POP
2693 const UINT16* flags)
2695 WINPR_UNUSED(cache_color_table);
2696 WINPR_UNUSED(flags);
2698 return 16 + (256 * 4);
2701 BOOL update_write_cache_color_table_order(
wStream* s,
2706 const UINT32* colorTable = NULL;
2708 if (cache_color_table->numberColors != 256)
2711 inf = update_approximate_cache_color_table_order(cache_color_table, flags);
2713 if (!Stream_EnsureRemainingCapacity(s, inf))
2716 Stream_Write_UINT8(s, cache_color_table->cacheIndex);
2717 Stream_Write_UINT16(s, cache_color_table->numberColors);
2718 colorTable = (
const UINT32*)&cache_color_table->colorTable;
2720 for (
size_t i = 0; i < cache_color_table->numberColors; i++)
2722 update_write_color_quad(s, colorTable[i]);
2731 WINPR_ASSERT(update);
2734 if (!cache_glyph_order)
2737 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
2740 Stream_Read_UINT8(s, cache_glyph_order->cacheId);
2741 Stream_Read_UINT8(s, cache_glyph_order->cGlyphs);
2743 for (UINT32 i = 0; i < cache_glyph_order->cGlyphs; i++)
2745 GLYPH_DATA* glyph = &cache_glyph_order->glyphData[i];
2747 if (!Stream_CheckAndLogRequiredLength(TAG, s, 10))
2750 Stream_Read_UINT16(s, glyph->cacheIndex);
2751 Stream_Read_INT16(s, glyph->x);
2752 Stream_Read_INT16(s, glyph->y);
2753 Stream_Read_UINT16(s, glyph->cx);
2754 Stream_Read_UINT16(s, glyph->cy);
2755 glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
2756 glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
2758 if (!Stream_CheckAndLogRequiredLength(TAG, s, glyph->cb))
2761 glyph->aj = (BYTE*)malloc(glyph->cb);
2766 Stream_Read(s, glyph->aj, glyph->cb);
2769 if ((flags & CG_GLYPH_UNICODE_PRESENT) && (cache_glyph_order->cGlyphs > 0))
2771 cache_glyph_order->unicodeCharacters = calloc(cache_glyph_order->cGlyphs,
sizeof(WCHAR));
2773 if (!cache_glyph_order->unicodeCharacters)
2776 if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, cache_glyph_order->cGlyphs,
2780 Stream_Read_UTF16_String(s, cache_glyph_order->unicodeCharacters,
2781 cache_glyph_order->cGlyphs);
2784 return cache_glyph_order;
2786 free_cache_glyph_order(update->context, cache_glyph_order);
2790 size_t update_approximate_cache_glyph_order(
const CACHE_GLYPH_ORDER* cache_glyph,
2791 const UINT16* flags)
2793 WINPR_ASSERT(cache_glyph);
2794 WINPR_UNUSED(flags);
2795 return 2 + cache_glyph->cGlyphs * 32;
2802 size_t inf = update_approximate_cache_glyph_order(cache_glyph, flags);
2804 if (!Stream_EnsureRemainingCapacity(s, inf))
2807 Stream_Write_UINT8(s, cache_glyph->cacheId);
2808 Stream_Write_UINT8(s, cache_glyph->cGlyphs);
2810 for (UINT32 i = 0; i < cache_glyph->cGlyphs; i++)
2813 glyph = &cache_glyph->glyphData[i];
2814 Stream_Write_UINT16(s, glyph->cacheIndex);
2816 Stream_Write_UINT16(s, lsi16);
2818 Stream_Write_UINT16(s, lsi16);
2819 Stream_Write_UINT16(s, glyph->cx);
2820 Stream_Write_UINT16(s, glyph->cy);
2821 cb = ((glyph->cx + 7) / 8) * glyph->cy;
2822 cb += ((cb % 4) > 0) ? 4 - (cb % 4) : 0;
2823 Stream_Write(s, glyph->aj, cb);
2826 if (*flags & CG_GLYPH_UNICODE_PRESENT)
2828 Stream_Zero(s, 2ULL * cache_glyph->cGlyphs);
2839 if (!cache_glyph_v2)
2842 cache_glyph_v2->cacheId = (flags & 0x000F);
2843 cache_glyph_v2->flags = (flags & 0x00F0) >> 4;
2844 cache_glyph_v2->cGlyphs = (flags & 0xFF00) >> 8;
2846 for (UINT32 i = 0; i < cache_glyph_v2->cGlyphs; i++)
2850 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
2853 Stream_Read_UINT8(s, glyph->cacheIndex);
2855 if (!update_read_2byte_signed(s, &glyph->x) || !update_read_2byte_signed(s, &glyph->y) ||
2856 !update_read_2byte_unsigned(s, &glyph->cx) ||
2857 !update_read_2byte_unsigned(s, &glyph->cy))
2862 glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
2863 glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
2865 if (!Stream_CheckAndLogRequiredLength(TAG, s, glyph->cb))
2868 glyph->aj = (BYTE*)malloc(glyph->cb);
2873 Stream_Read(s, glyph->aj, glyph->cb);
2876 if ((flags & CG_GLYPH_UNICODE_PRESENT) && (cache_glyph_v2->cGlyphs > 0))
2878 cache_glyph_v2->unicodeCharacters = calloc(cache_glyph_v2->cGlyphs,
sizeof(WCHAR));
2880 if (!cache_glyph_v2->unicodeCharacters)
2883 if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, cache_glyph_v2->cGlyphs,
sizeof(WCHAR)))
2886 Stream_Read_UTF16_String(s, cache_glyph_v2->unicodeCharacters, cache_glyph_v2->cGlyphs);
2889 return cache_glyph_v2;
2891 free_cache_glyph_v2_order(update->context, cache_glyph_v2);
2896 const UINT16* flags)
2898 WINPR_ASSERT(cache_glyph_v2);
2899 WINPR_UNUSED(flags);
2900 return 8 + cache_glyph_v2->cGlyphs * 32;
2906 size_t inf = update_approximate_cache_glyph_v2_order(cache_glyph_v2, flags);
2908 if (!Stream_EnsureRemainingCapacity(s, inf))
2911 *flags = (cache_glyph_v2->cacheId & 0x000F) | ((cache_glyph_v2->flags & 0x000F) << 4) |
2912 ((cache_glyph_v2->cGlyphs & 0x00FF) << 8);
2914 for (UINT32 i = 0; i < cache_glyph_v2->cGlyphs; i++)
2918 Stream_Write_UINT8(s, glyph->cacheIndex);
2920 if (!update_write_2byte_signed(s, glyph->x) || !update_write_2byte_signed(s, glyph->y) ||
2921 !update_write_2byte_unsigned(s, glyph->cx) ||
2922 !update_write_2byte_unsigned(s, glyph->cy))
2927 cb = ((glyph->cx + 7) / 8) * glyph->cy;
2928 cb += ((cb % 4) > 0) ? 4 - (cb % 4) : 0;
2929 Stream_Write(s, glyph->aj, cb);
2932 if (*flags & CG_GLYPH_UNICODE_PRESENT)
2934 Stream_Zero(s, 2ULL * cache_glyph_v2->cGlyphs);
2939 static BOOL update_decompress_brush(
wStream* s, BYTE* output,
size_t outSize, BYTE bpp)
2942 const BYTE* palette = Stream_PointerAs(s,
const BYTE) + 16;
2943 const size_t bytesPerPixel = ((bpp + 1) / 8);
2945 if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, 4ULL + bytesPerPixel, 4ULL))
2948 for (INT8 y = 7; y >= 0; y--)
2950 for (
size_t x = 0; x < 8; x++)
2954 Stream_Read_UINT8(s,
byte);
2956 index = ((
byte >> ((3 - (x % 4)) * 2)) & 0x03);
2958 for (
size_t k = 0; k < bytesPerPixel; k++)
2960 const size_t dstIndex = ((8ULL * y + x) * bytesPerPixel) + k;
2961 const size_t srcIndex = (index * bytesPerPixel) + k;
2962 if (dstIndex >= outSize)
2964 output[dstIndex] = palette[srcIndex];
2971 static BOOL update_compress_brush(
wStream* s,
const BYTE* input, BYTE bpp)
2978 BYTE iBitmapFormat = 0;
2979 BOOL compressed = FALSE;
2986 if (!Stream_CheckAndLogRequiredLength(TAG, s, 6))
2989 Stream_Read_UINT8(s, cache_brush->index);
2990 Stream_Read_UINT8(s, iBitmapFormat);
2992 cache_brush->bpp = get_bmf_bpp(iBitmapFormat, &rc);
2996 Stream_Read_UINT8(s, cache_brush->cx);
2997 Stream_Read_UINT8(s, cache_brush->cy);
3000 Stream_Read_UINT8(s, cache_brush->style);
3001 Stream_Read_UINT8(s, cache_brush->length);
3003 if ((cache_brush->cx == 8) && (cache_brush->cy == 8))
3005 if (cache_brush->bpp == 1)
3007 if (cache_brush->length != 8)
3009 WLog_Print(up->log, WLOG_ERROR,
"incompatible 1bpp brush of length:%" PRIu32
"",
3010 cache_brush->length);
3014 if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
3018 for (
int i = 7; i >= 0; i--)
3019 Stream_Read_UINT8(s, cache_brush->data[i]);
3023 if ((iBitmapFormat == BMF_8BPP) && (cache_brush->length == 20))
3025 else if ((iBitmapFormat == BMF_16BPP) && (cache_brush->length == 24))
3027 else if ((iBitmapFormat == BMF_24BPP) && (cache_brush->length == 28))
3029 else if ((iBitmapFormat == BMF_32BPP) && (cache_brush->length == 32))
3032 if (compressed != FALSE)
3035 if (!update_decompress_brush(s, cache_brush->data,
sizeof(cache_brush->data),
3042 UINT32 scanline = (cache_brush->bpp / 8) * 8;
3044 if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, scanline, 8ull))
3047 for (
int i = 7; i >= 0; i--)
3049 Stream_Read(s, &cache_brush->data[1LL * i * scanline], scanline);
3057 free_cache_brush_order(update->context, cache_brush);
3061 size_t update_approximate_cache_brush_order(
const CACHE_BRUSH_ORDER* cache_brush,
3062 const UINT16* flags)
3064 WINPR_UNUSED(cache_brush);
3065 WINPR_UNUSED(flags);
3072 BYTE iBitmapFormat = 0;
3074 BOOL compressed = FALSE;
3076 if (!Stream_EnsureRemainingCapacity(s,
3077 update_approximate_cache_brush_order(cache_brush, flags)))
3080 iBitmapFormat = get_bpp_bmf(cache_brush->bpp, &rc);
3083 Stream_Write_UINT8(s, cache_brush->index);
3084 Stream_Write_UINT8(s, iBitmapFormat);
3085 Stream_Write_UINT8(s, cache_brush->cx);
3086 Stream_Write_UINT8(s, cache_brush->cy);
3087 Stream_Write_UINT8(s, cache_brush->style);
3088 Stream_Write_UINT8(s, cache_brush->length);
3090 if ((cache_brush->cx == 8) && (cache_brush->cy == 8))
3092 if (cache_brush->bpp == 1)
3094 if (cache_brush->length != 8)
3096 WLog_ERR(TAG,
"incompatible 1bpp brush of length:%" PRIu32
"", cache_brush->length);
3100 for (
int i = 7; i >= 0; i--)
3102 Stream_Write_UINT8(s, cache_brush->data[i]);
3107 if ((iBitmapFormat == BMF_8BPP) && (cache_brush->length == 20))
3109 else if ((iBitmapFormat == BMF_16BPP) && (cache_brush->length == 24))
3111 else if ((iBitmapFormat == BMF_32BPP) && (cache_brush->length == 32))
3114 if (compressed != FALSE)
3117 if (!update_compress_brush(s, cache_brush->data, cache_brush->bpp))
3123 int scanline = (cache_brush->bpp / 8) * 8;
3125 for (
int i = 7; i >= 0; i--)
3127 Stream_Write(s, &cache_brush->data[1LL * i * scanline], scanline);
3137 update_read_create_offscreen_bitmap_order(
wStream* s,
3141 BOOL deleteListPresent = 0;
3144 if (!Stream_CheckAndLogRequiredLength(TAG, s, 6))
3147 Stream_Read_UINT16(s, flags);
3148 create_offscreen_bitmap->id = flags & 0x7FFF;
3149 deleteListPresent = (flags & 0x8000) ? TRUE : FALSE;
3150 Stream_Read_UINT16(s, create_offscreen_bitmap->cx);
3151 Stream_Read_UINT16(s, create_offscreen_bitmap->cy);
3152 deleteList = &(create_offscreen_bitmap->deleteList);
3154 if ((create_offscreen_bitmap->cx == 0) || (create_offscreen_bitmap->cy == 0))
3156 WLog_ERR(TAG,
"Invalid OFFSCREEN_DELETE_LIST: cx=%" PRIu16
", cy=%" PRIu16,
3157 create_offscreen_bitmap->cx, create_offscreen_bitmap->cy);
3161 if (deleteListPresent)
3163 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
3166 Stream_Read_UINT16(s, deleteList->cIndices);
3168 if (deleteList->cIndices > deleteList->sIndices)
3170 UINT16* new_indices = NULL;
3171 new_indices = (UINT16*)realloc(deleteList->indices, 2ULL * deleteList->cIndices);
3176 deleteList->sIndices = deleteList->cIndices;
3177 deleteList->indices = new_indices;
3180 if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, deleteList->cIndices, 2ull))
3183 for (UINT32 i = 0; i < deleteList->cIndices; i++)
3185 Stream_Read_UINT16(s, deleteList->indices[i]);
3190 deleteList->cIndices = 0;
3196 size_t update_approximate_create_offscreen_bitmap_order(
3201 WINPR_ASSERT(create_offscreen_bitmap);
3203 deleteList = &(create_offscreen_bitmap->deleteList);
3204 WINPR_ASSERT(deleteList);
3206 return 32 + deleteList->cIndices * 2;
3209 BOOL update_write_create_offscreen_bitmap_order(
3213 BOOL deleteListPresent = 0;
3216 if (!Stream_EnsureRemainingCapacity(
3217 s, update_approximate_create_offscreen_bitmap_order(create_offscreen_bitmap)))
3220 deleteList = &(create_offscreen_bitmap->deleteList);
3221 flags = create_offscreen_bitmap->id & 0x7FFF;
3222 deleteListPresent = (deleteList->cIndices > 0) ? TRUE : FALSE;
3224 if (deleteListPresent)
3227 Stream_Write_UINT16(s, flags);
3228 Stream_Write_UINT16(s, create_offscreen_bitmap->cx);
3229 Stream_Write_UINT16(s, create_offscreen_bitmap->cy);
3231 if (deleteListPresent)
3233 Stream_Write_UINT16(s, deleteList->cIndices);
3235 for (
size_t i = 0; i < deleteList->cIndices; i++)
3237 Stream_Write_UINT16(s, deleteList->indices[i]);
3245 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
3248 Stream_Read_UINT16(s, switch_surface->bitmapId);
3257 size_t inf = update_approximate_switch_surface_order(switch_surface);
3259 if (!Stream_EnsureRemainingCapacity(s, inf))
3262 WINPR_ASSERT(switch_surface->bitmapId <= UINT16_MAX);
3263 Stream_Write_UINT16(s, (UINT16)switch_surface->bitmapId);
3267 update_read_create_nine_grid_bitmap_order(
wStream* s,
3272 if (!Stream_CheckAndLogRequiredLength(TAG, s, 19))
3275 Stream_Read_UINT8(s, create_nine_grid_bitmap->bitmapBpp);
3277 if ((create_nine_grid_bitmap->bitmapBpp < 1) || (create_nine_grid_bitmap->bitmapBpp > 32))
3279 WLog_ERR(TAG,
"invalid bpp value %" PRIu32
"", create_nine_grid_bitmap->bitmapBpp);
3283 Stream_Read_UINT16(s, create_nine_grid_bitmap->bitmapId);
3284 nineGridInfo = &(create_nine_grid_bitmap->nineGridInfo);
3285 Stream_Read_UINT32(s, nineGridInfo->flFlags);
3286 Stream_Read_UINT16(s, nineGridInfo->ulLeftWidth);
3287 Stream_Read_UINT16(s, nineGridInfo->ulRightWidth);
3288 Stream_Read_UINT16(s, nineGridInfo->ulTopHeight);
3289 Stream_Read_UINT16(s, nineGridInfo->ulBottomHeight);
3290 update_read_colorref(s, &nineGridInfo->crTransparent);
3295 if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
3298 Stream_Read_UINT32(s, frame_marker->action);
3301 static BOOL update_read_stream_bitmap_first_order(
wStream* s,
3304 if (!Stream_CheckAndLogRequiredLength(TAG, s, 10))
3307 Stream_Read_UINT8(s, stream_bitmap_first->bitmapFlags);
3308 Stream_Read_UINT8(s, stream_bitmap_first->bitmapBpp);
3310 if ((stream_bitmap_first->bitmapBpp < 1) || (stream_bitmap_first->bitmapBpp > 32))
3312 WLog_ERR(TAG,
"invalid bpp value %" PRIu32
"", stream_bitmap_first->bitmapBpp);
3316 Stream_Read_UINT16(s, stream_bitmap_first->bitmapType);
3317 Stream_Read_UINT16(s, stream_bitmap_first->bitmapWidth);
3318 Stream_Read_UINT16(s, stream_bitmap_first->bitmapHeight);
3320 if (stream_bitmap_first->bitmapFlags & STREAM_BITMAP_V2)
3322 if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
3325 Stream_Read_UINT32(s, stream_bitmap_first->bitmapSize);
3329 if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
3332 Stream_Read_UINT16(s, stream_bitmap_first->bitmapSize);
3335 FIELD_SKIP_BUFFER16(
3336 s, stream_bitmap_first->bitmapBlockSize);
3339 static BOOL update_read_stream_bitmap_next_order(
wStream* s,
3342 if (!Stream_CheckAndLogRequiredLength(TAG, s, 5))
3345 Stream_Read_UINT8(s, stream_bitmap_next->bitmapFlags);
3346 Stream_Read_UINT16(s, stream_bitmap_next->bitmapType);
3347 FIELD_SKIP_BUFFER16(
3348 s, stream_bitmap_next->bitmapBlockSize);
3351 static BOOL update_read_draw_gdiplus_first_order(
wStream* s,
3354 if (!Stream_CheckAndLogRequiredLength(TAG, s, 11))
3357 Stream_Seek_UINT8(s);
3358 Stream_Read_UINT16(s, draw_gdiplus_first->cbSize);
3359 Stream_Read_UINT32(s, draw_gdiplus_first->cbTotalSize);
3360 Stream_Read_UINT32(s, draw_gdiplus_first->cbTotalEmfSize);
3361 return Stream_SafeSeek(s, draw_gdiplus_first->cbSize);
3363 static BOOL update_read_draw_gdiplus_next_order(
wStream* s,
3366 if (!Stream_CheckAndLogRequiredLength(TAG, s, 3))
3369 Stream_Seek_UINT8(s);
3370 FIELD_SKIP_BUFFER16(s, draw_gdiplus_next->cbSize);
3375 if (!Stream_CheckAndLogRequiredLength(TAG, s, 11))
3378 Stream_Seek_UINT8(s);
3379 Stream_Read_UINT16(s, draw_gdiplus_end->cbSize);
3380 Stream_Read_UINT32(s, draw_gdiplus_end->cbTotalSize);
3381 Stream_Read_UINT32(s, draw_gdiplus_end->cbTotalEmfSize);
3382 return Stream_SafeSeek(s, draw_gdiplus_end->cbSize);
3385 update_read_draw_gdiplus_cache_first_order(
wStream* s,
3388 if (!Stream_CheckAndLogRequiredLength(TAG, s, 11))
3391 Stream_Read_UINT8(s, draw_gdiplus_cache_first->flags);
3392 Stream_Read_UINT16(s, draw_gdiplus_cache_first->cacheType);
3393 Stream_Read_UINT16(s, draw_gdiplus_cache_first->cacheIndex);
3394 Stream_Read_UINT16(s, draw_gdiplus_cache_first->cbSize);
3395 Stream_Read_UINT32(s, draw_gdiplus_cache_first->cbTotalSize);
3396 return Stream_SafeSeek(s, draw_gdiplus_cache_first->cbSize);
3399 update_read_draw_gdiplus_cache_next_order(
wStream* s,
3402 if (!Stream_CheckAndLogRequiredLength(TAG, s, 7))
3405 Stream_Read_UINT8(s, draw_gdiplus_cache_next->flags);
3406 Stream_Read_UINT16(s, draw_gdiplus_cache_next->cacheType);
3407 Stream_Read_UINT16(s, draw_gdiplus_cache_next->cacheIndex);
3408 FIELD_SKIP_BUFFER16(s, draw_gdiplus_cache_next->cbSize);
3412 update_read_draw_gdiplus_cache_end_order(
wStream* s,
3415 if (!Stream_CheckAndLogRequiredLength(TAG, s, 11))
3418 Stream_Read_UINT8(s, draw_gdiplus_cache_end->flags);
3419 Stream_Read_UINT16(s, draw_gdiplus_cache_end->cacheType);
3420 Stream_Read_UINT16(s, draw_gdiplus_cache_end->cacheIndex);
3421 Stream_Read_UINT16(s, draw_gdiplus_cache_end->cbSize);
3422 Stream_Read_UINT32(s, draw_gdiplus_cache_end->cbTotalSize);
3423 return Stream_SafeSeek(s, draw_gdiplus_cache_end->cbSize);
3425 static BOOL update_read_field_flags(
wStream* s, UINT32* fieldFlags, BYTE flags, BYTE fieldBytes)
3429 if (flags & ORDER_ZERO_FIELD_BYTE_BIT0)
3432 if (flags & ORDER_ZERO_FIELD_BYTE_BIT1)
3440 if (!Stream_CheckAndLogRequiredLength(TAG, s, fieldBytes))
3445 for (
int i = 0; i < fieldBytes; i++)
3447 Stream_Read_UINT8(s,
byte);
3448 *fieldFlags |=
byte << (i * 8);
3453 BOOL update_write_field_flags(
wStream* s, UINT32 fieldFlags, BYTE flags, BYTE fieldBytes)
3457 if (fieldBytes == 1)
3459 byte = fieldFlags & 0xFF;
3460 Stream_Write_UINT8(s,
byte);
3462 else if (fieldBytes == 2)
3464 byte = fieldFlags & 0xFF;
3465 Stream_Write_UINT8(s,
byte);
3466 byte = (fieldFlags >> 8) & 0xFF;
3467 Stream_Write_UINT8(s,
byte);
3469 else if (fieldBytes == 3)
3471 byte = fieldFlags & 0xFF;
3472 Stream_Write_UINT8(s,
byte);
3473 byte = (fieldFlags >> 8) & 0xFF;
3474 Stream_Write_UINT8(s,
byte);
3475 byte = (fieldFlags >> 16) & 0xFF;
3476 Stream_Write_UINT8(s,
byte);
3485 static BOOL update_read_bounds(
wStream* s, rdpBounds* bounds)
3489 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
3492 Stream_Read_UINT8(s, flags);
3494 if (flags & BOUND_LEFT)
3496 if (!update_read_coord(s, &bounds->left, FALSE))
3499 else if (flags & BOUND_DELTA_LEFT)
3501 if (!update_read_coord(s, &bounds->left, TRUE))
3505 if (flags & BOUND_TOP)
3507 if (!update_read_coord(s, &bounds->top, FALSE))
3510 else if (flags & BOUND_DELTA_TOP)
3512 if (!update_read_coord(s, &bounds->top, TRUE))
3516 if (flags & BOUND_RIGHT)
3518 if (!update_read_coord(s, &bounds->right, FALSE))
3521 else if (flags & BOUND_DELTA_RIGHT)
3523 if (!update_read_coord(s, &bounds->right, TRUE))
3527 if (flags & BOUND_BOTTOM)
3529 if (!update_read_coord(s, &bounds->bottom, FALSE))
3532 else if (flags & BOUND_DELTA_BOTTOM)
3534 if (!update_read_coord(s, &bounds->bottom, TRUE))
3542 if (!(orderInfo->controlFlags & ORDER_BOUNDS))
3545 if (orderInfo->controlFlags & ORDER_ZERO_BOUNDS_DELTAS)
3548 Stream_Write_UINT8(s, orderInfo->boundsFlags);
3550 if (orderInfo->boundsFlags & BOUND_LEFT)
3552 if (!update_write_coord(s, orderInfo->bounds.left))
3555 else if (orderInfo->boundsFlags & BOUND_DELTA_LEFT)
3559 if (orderInfo->boundsFlags & BOUND_TOP)
3561 if (!update_write_coord(s, orderInfo->bounds.top))
3564 else if (orderInfo->boundsFlags & BOUND_DELTA_TOP)
3568 if (orderInfo->boundsFlags & BOUND_RIGHT)
3570 if (!update_write_coord(s, orderInfo->bounds.right))
3573 else if (orderInfo->boundsFlags & BOUND_DELTA_RIGHT)
3577 if (orderInfo->boundsFlags & BOUND_BOTTOM)
3579 if (!update_write_coord(s, orderInfo->bounds.bottom))
3582 else if (orderInfo->boundsFlags & BOUND_DELTA_BOTTOM)
3589 static BOOL read_primary_order(wLog* log,
const char* orderName,
wStream* s,
3590 const ORDER_INFO* orderInfo, rdpPrimaryUpdate* primary_pub)
3595 if (!s || !orderInfo || !orderName)
3598 switch (orderInfo->orderType)
3600 case ORDER_TYPE_DSTBLT:
3601 rc = update_read_dstblt_order(orderName, s, orderInfo, &(primary->dstblt));
3604 case ORDER_TYPE_PATBLT:
3605 rc = update_read_patblt_order(orderName, s, orderInfo, &(primary->patblt));
3608 case ORDER_TYPE_SCRBLT:
3609 rc = update_read_scrblt_order(orderName, s, orderInfo, &(primary->scrblt));
3612 case ORDER_TYPE_OPAQUE_RECT:
3613 rc = update_read_opaque_rect_order(orderName, s, orderInfo, &(primary->opaque_rect));
3616 case ORDER_TYPE_DRAW_NINE_GRID:
3617 rc = update_read_draw_nine_grid_order(orderName, s, orderInfo,
3618 &(primary->draw_nine_grid));
3621 case ORDER_TYPE_MULTI_DSTBLT:
3622 rc = update_read_multi_dstblt_order(orderName, s, orderInfo, &(primary->multi_dstblt));
3625 case ORDER_TYPE_MULTI_PATBLT:
3626 rc = update_read_multi_patblt_order(orderName, s, orderInfo, &(primary->multi_patblt));
3629 case ORDER_TYPE_MULTI_SCRBLT:
3630 rc = update_read_multi_scrblt_order(orderName, s, orderInfo, &(primary->multi_scrblt));
3633 case ORDER_TYPE_MULTI_OPAQUE_RECT:
3634 rc = update_read_multi_opaque_rect_order(orderName, s, orderInfo,
3635 &(primary->multi_opaque_rect));
3638 case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
3639 rc = update_read_multi_draw_nine_grid_order(orderName, s, orderInfo,
3640 &(primary->multi_draw_nine_grid));
3643 case ORDER_TYPE_LINE_TO:
3644 rc = update_read_line_to_order(orderName, s, orderInfo, &(primary->line_to));
3647 case ORDER_TYPE_POLYLINE:
3648 rc = update_read_polyline_order(orderName, s, orderInfo, &(primary->polyline));
3651 case ORDER_TYPE_MEMBLT:
3652 rc = update_read_memblt_order(orderName, s, orderInfo, &(primary->memblt));
3655 case ORDER_TYPE_MEM3BLT:
3656 rc = update_read_mem3blt_order(orderName, s, orderInfo, &(primary->mem3blt));
3659 case ORDER_TYPE_SAVE_BITMAP:
3660 rc = update_read_save_bitmap_order(orderName, s, orderInfo, &(primary->save_bitmap));
3663 case ORDER_TYPE_GLYPH_INDEX:
3664 rc = update_read_glyph_index_order(orderName, s, orderInfo, &(primary->glyph_index));
3667 case ORDER_TYPE_FAST_INDEX:
3668 rc = update_read_fast_index_order(orderName, s, orderInfo, &(primary->fast_index));
3671 case ORDER_TYPE_FAST_GLYPH:
3672 rc = update_read_fast_glyph_order(orderName, s, orderInfo, &(primary->fast_glyph));
3675 case ORDER_TYPE_POLYGON_SC:
3676 rc = update_read_polygon_sc_order(orderName, s, orderInfo, &(primary->polygon_sc));
3679 case ORDER_TYPE_POLYGON_CB:
3680 rc = update_read_polygon_cb_order(orderName, s, orderInfo, &(primary->polygon_cb));
3683 case ORDER_TYPE_ELLIPSE_SC:
3684 rc = update_read_ellipse_sc_order(orderName, s, orderInfo, &(primary->ellipse_sc));
3687 case ORDER_TYPE_ELLIPSE_CB:
3688 rc = update_read_ellipse_cb_order(orderName, s, orderInfo, &(primary->ellipse_cb));
3692 WLog_Print(log, WLOG_WARN,
"%s %s not supported, ignoring", primary_order_str,
3700 WLog_Print(log, WLOG_ERROR,
"%s %s failed", primary_order_str, orderName);
3707 static BOOL update_recv_primary_order(rdpUpdate* update,
wStream* s, BYTE flags)
3712 rdpContext* context = update->context;
3715 rdpSettings* settings = NULL;
3716 const char* orderName = NULL;
3717 BOOL defaultReturn = 0;
3721 orderInfo = &(primary->order_info);
3722 WINPR_ASSERT(orderInfo);
3723 WINPR_ASSERT(context);
3725 settings = context->settings;
3726 WINPR_ASSERT(settings);
3730 if (flags & ORDER_TYPE_CHANGE)
3732 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
3735 Stream_Read_UINT8(s, orderInfo->orderType);
3738 orderName = primary_order_string(orderInfo->orderType);
3739 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3741 if (!check_primary_order_supported(up->log, settings, orderInfo->orderType, orderName))
3744 field = get_primary_drawing_order_field_bytes(orderInfo->orderType, &rc);
3748 if (!update_read_field_flags(s, &(orderInfo->fieldFlags), flags, field))
3750 WLog_Print(up->log, WLOG_ERROR,
"update_read_field_flags() failed");
3754 if (flags & ORDER_BOUNDS)
3756 if (!(flags & ORDER_ZERO_BOUNDS_DELTAS))
3758 if (!update_read_bounds(s, &orderInfo->bounds))
3760 WLog_Print(up->log, WLOG_ERROR,
"update_read_bounds() failed");
3765 rc = IFCALLRESULT(defaultReturn, update->SetBounds, context, &orderInfo->bounds);
3771 orderInfo->deltaCoordinates = (flags & ORDER_DELTA_COORDINATES) ? TRUE : FALSE;
3773 if (!read_primary_order(up->log, orderName, s, orderInfo, &primary->common))
3776 rc = IFCALLRESULT(TRUE, primary->common.OrderInfo, context, orderInfo, orderName);
3780 switch (orderInfo->orderType)
3782 case ORDER_TYPE_DSTBLT:
3784 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3785 orderName, gdi_rob3_code_string_checked(primary->dstblt.bRop),
3786 gdi_rop3_code_checked(primary->dstblt.bRop));
3787 rc = IFCALLRESULT(defaultReturn, primary->common.DstBlt, context, &primary->dstblt);
3791 case ORDER_TYPE_PATBLT:
3793 WINPR_ASSERT(primary->patblt.bRop <= UINT8_MAX);
3794 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3795 orderName, gdi_rob3_code_string_checked(primary->patblt.bRop),
3796 gdi_rop3_code_checked(primary->patblt.bRop));
3797 rc = IFCALLRESULT(defaultReturn, primary->common.PatBlt, context, &primary->patblt);
3801 case ORDER_TYPE_SCRBLT:
3803 WINPR_ASSERT(primary->scrblt.bRop <= UINT8_MAX);
3804 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3805 orderName, gdi_rob3_code_string_checked((UINT8)primary->scrblt.bRop),
3806 gdi_rop3_code_checked(primary->scrblt.bRop));
3807 rc = IFCALLRESULT(defaultReturn, primary->common.ScrBlt, context, &primary->scrblt);
3811 case ORDER_TYPE_OPAQUE_RECT:
3813 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3814 rc = IFCALLRESULT(defaultReturn, primary->common.OpaqueRect, context,
3815 &primary->opaque_rect);
3819 case ORDER_TYPE_DRAW_NINE_GRID:
3821 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3822 rc = IFCALLRESULT(defaultReturn, primary->common.DrawNineGrid, context,
3823 &primary->draw_nine_grid);
3827 case ORDER_TYPE_MULTI_DSTBLT:
3829 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3830 orderName, gdi_rob3_code_string_checked(primary->multi_dstblt.bRop),
3831 gdi_rop3_code_checked(primary->multi_dstblt.bRop));
3832 rc = IFCALLRESULT(defaultReturn, primary->common.MultiDstBlt, context,
3833 &primary->multi_dstblt);
3837 case ORDER_TYPE_MULTI_PATBLT:
3839 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3840 orderName, gdi_rob3_code_string_checked(primary->multi_patblt.bRop),
3841 gdi_rop3_code_checked(primary->multi_patblt.bRop));
3842 rc = IFCALLRESULT(defaultReturn, primary->common.MultiPatBlt, context,
3843 &primary->multi_patblt);
3847 case ORDER_TYPE_MULTI_SCRBLT:
3849 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3850 orderName, gdi_rob3_code_string_checked(primary->multi_scrblt.bRop),
3851 gdi_rop3_code_checked(primary->multi_scrblt.bRop));
3852 rc = IFCALLRESULT(defaultReturn, primary->common.MultiScrBlt, context,
3853 &primary->multi_scrblt);
3857 case ORDER_TYPE_MULTI_OPAQUE_RECT:
3859 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3860 rc = IFCALLRESULT(defaultReturn, primary->common.MultiOpaqueRect, context,
3861 &primary->multi_opaque_rect);
3865 case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
3867 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3868 rc = IFCALLRESULT(defaultReturn, primary->common.MultiDrawNineGrid, context,
3869 &primary->multi_draw_nine_grid);
3873 case ORDER_TYPE_LINE_TO:
3875 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3876 rc = IFCALLRESULT(defaultReturn, primary->common.LineTo, context, &primary->line_to);
3880 case ORDER_TYPE_POLYLINE:
3882 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3883 rc = IFCALLRESULT(defaultReturn, primary->common.Polyline, context, &primary->polyline);
3887 case ORDER_TYPE_MEMBLT:
3889 WINPR_ASSERT(primary->memblt.bRop <= UINT8_MAX);
3890 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3891 orderName, gdi_rob3_code_string_checked(primary->memblt.bRop),
3892 gdi_rop3_code_checked(primary->memblt.bRop));
3893 rc = IFCALLRESULT(defaultReturn, primary->common.MemBlt, context, &primary->memblt);
3897 case ORDER_TYPE_MEM3BLT:
3899 WINPR_ASSERT(primary->mem3blt.bRop <= UINT8_MAX);
3900 WLog_Print(up->log, WLOG_DEBUG,
"%s %s rop=%s [0x%08" PRIx32
"]", primary_order_str,
3901 orderName, gdi_rob3_code_string_checked(primary->mem3blt.bRop),
3902 gdi_rop3_code_checked(primary->mem3blt.bRop));
3903 rc = IFCALLRESULT(defaultReturn, primary->common.Mem3Blt, context, &primary->mem3blt);
3907 case ORDER_TYPE_SAVE_BITMAP:
3909 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3910 rc = IFCALLRESULT(defaultReturn, primary->common.SaveBitmap, context,
3911 &primary->save_bitmap);
3915 case ORDER_TYPE_GLYPH_INDEX:
3917 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3918 rc = IFCALLRESULT(defaultReturn, primary->common.GlyphIndex, context,
3919 &primary->glyph_index);
3923 case ORDER_TYPE_FAST_INDEX:
3925 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3926 rc = IFCALLRESULT(defaultReturn, primary->common.FastIndex, context,
3927 &primary->fast_index);
3931 case ORDER_TYPE_FAST_GLYPH:
3933 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3934 rc = IFCALLRESULT(defaultReturn, primary->common.FastGlyph, context,
3935 &primary->fast_glyph);
3939 case ORDER_TYPE_POLYGON_SC:
3941 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3942 rc = IFCALLRESULT(defaultReturn, primary->common.PolygonSC, context,
3943 &primary->polygon_sc);
3947 case ORDER_TYPE_POLYGON_CB:
3949 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3950 rc = IFCALLRESULT(defaultReturn, primary->common.PolygonCB, context,
3951 &primary->polygon_cb);
3955 case ORDER_TYPE_ELLIPSE_SC:
3957 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3958 rc = IFCALLRESULT(defaultReturn, primary->common.EllipseSC, context,
3959 &primary->ellipse_sc);
3963 case ORDER_TYPE_ELLIPSE_CB:
3965 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", primary_order_str, orderName);
3966 rc = IFCALLRESULT(defaultReturn, primary->common.EllipseCB, context,
3967 &primary->ellipse_cb);
3972 WLog_Print(up->log, WLOG_WARN,
"%s %s not supported", primary_order_str, orderName);
3978 WLog_Print(up->log, WLOG_ERROR,
"%s %s failed", primary_order_str, orderName);
3982 if (flags & ORDER_BOUNDS)
3984 rc = IFCALLRESULT(defaultReturn, update->SetBounds, context, NULL);
3990 static BOOL update_recv_secondary_order(rdpUpdate* update,
wStream* s, BYTE flags)
3998 UINT16 extraFlags = 0;
3999 INT16 orderLength = 0;
4000 INT32 orderLengthFull = 0;
4002 rdpContext* context = update->context;
4003 rdpSettings* settings = context->settings;
4004 rdpSecondaryUpdate* secondary = update->secondary;
4005 const char* name = NULL;
4006 BOOL defaultReturn = 0;
4010 if (!Stream_CheckAndLogRequiredLength(TAG, s, 5))
4013 Stream_Read_INT16(s, orderLength);
4014 Stream_Read_UINT16(s, extraFlags);
4015 Stream_Read_UINT8(s, orderType);
4017 start = Stream_GetPosition(s);
4018 name = secondary_order_string(orderType);
4019 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", secondary_order_str, name);
4020 rc = IFCALLRESULT(TRUE, secondary->CacheOrderInfo, context, orderLength, extraFlags, orderType,
4033 orderLengthFull = orderLength + 7;
4034 if (orderLengthFull < 0)
4036 WLog_Print(up->log, WLOG_ERROR,
"orderLength %" PRIu16
" must be >= 7", orderLength);
4040 if (!Stream_CheckAndLogRequiredLength(TAG, s, (
size_t)orderLengthFull))
4043 if (!check_secondary_order_supported(up->log, settings, orderType, name))
4048 case ORDER_TYPE_BITMAP_UNCOMPRESSED:
4049 case ORDER_TYPE_CACHE_BITMAP_COMPRESSED:
4051 const BOOL compressed = (orderType == ORDER_TYPE_CACHE_BITMAP_COMPRESSED);
4053 update_read_cache_bitmap_order(update, s, compressed, extraFlags);
4057 rc = IFCALLRESULT(defaultReturn, secondary->CacheBitmap, context, order);
4058 free_cache_bitmap_order(context, order);
4063 case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2:
4064 case ORDER_TYPE_BITMAP_COMPRESSED_V2:
4066 const BOOL compressed = (orderType == ORDER_TYPE_BITMAP_COMPRESSED_V2);
4068 update_read_cache_bitmap_v2_order(update, s, compressed, extraFlags);
4072 rc = IFCALLRESULT(defaultReturn, secondary->CacheBitmapV2, context, order);
4073 free_cache_bitmap_v2_order(context, order);
4078 case ORDER_TYPE_BITMAP_COMPRESSED_V3:
4084 rc = IFCALLRESULT(defaultReturn, secondary->CacheBitmapV3, context, order);
4085 free_cache_bitmap_v3_order(context, order);
4090 case ORDER_TYPE_CACHE_COLOR_TABLE:
4093 update_read_cache_color_table_order(update, s, extraFlags);
4097 rc = IFCALLRESULT(defaultReturn, secondary->CacheColorTable, context, order);
4098 free_cache_color_table_order(context, order);
4103 case ORDER_TYPE_CACHE_GLYPH:
4105 switch (settings->GlyphSupportLevel)
4107 case GLYPH_SUPPORT_PARTIAL:
4108 case GLYPH_SUPPORT_FULL:
4110 CACHE_GLYPH_ORDER* order = update_read_cache_glyph_order(update, s, extraFlags);
4114 rc = IFCALLRESULT(defaultReturn, secondary->CacheGlyph, context, order);
4115 free_cache_glyph_order(context, order);
4120 case GLYPH_SUPPORT_ENCODE:
4123 update_read_cache_glyph_v2_order(update, s, extraFlags);
4127 rc = IFCALLRESULT(defaultReturn, secondary->CacheGlyphV2, context, order);
4128 free_cache_glyph_v2_order(context, order);
4133 case GLYPH_SUPPORT_NONE:
4140 case ORDER_TYPE_CACHE_BRUSH:
4143 CACHE_BRUSH_ORDER* order = update_read_cache_brush_order(update, s, extraFlags);
4147 rc = IFCALLRESULT(defaultReturn, secondary->CacheBrush, context, order);
4148 free_cache_brush_order(context, order);
4154 WLog_Print(up->log, WLOG_WARN,
"%s %s not supported", secondary_order_str, name);
4160 WLog_Print(up->log, WLOG_ERROR,
"%s %s failed", secondary_order_str, name);
4163 end = start + orderLengthFull;
4164 pos = Stream_GetPosition(s);
4167 WLog_Print(up->log, WLOG_WARN,
"%s %s: read %" PRIuz
"bytes too much", secondary_order_str,
4174 WLog_Print(up->log, WLOG_DEBUG,
"%s %s: read %" PRIuz
"bytes short, skipping",
4175 secondary_order_str, name, diff);
4176 if (!Stream_SafeSeek(s, diff))
4182 static BOOL read_altsec_order(wLog* log,
wStream* s, BYTE orderType, rdpAltSecUpdate* altsec_pub)
4191 case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP:
4192 rc = update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap));
4195 case ORDER_TYPE_SWITCH_SURFACE:
4196 rc = update_read_switch_surface_order(s, &(altsec->switch_surface));
4199 case ORDER_TYPE_CREATE_NINE_GRID_BITMAP:
4200 rc = update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap));
4203 case ORDER_TYPE_FRAME_MARKER:
4204 rc = update_read_frame_marker_order(s, &(altsec->frame_marker));
4207 case ORDER_TYPE_STREAM_BITMAP_FIRST:
4208 rc = update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first));
4211 case ORDER_TYPE_STREAM_BITMAP_NEXT:
4212 rc = update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next));
4215 case ORDER_TYPE_GDIPLUS_FIRST:
4216 rc = update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first));
4219 case ORDER_TYPE_GDIPLUS_NEXT:
4220 rc = update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next));
4223 case ORDER_TYPE_GDIPLUS_END:
4224 rc = update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end));
4227 case ORDER_TYPE_GDIPLUS_CACHE_FIRST:
4228 rc = update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first));
4231 case ORDER_TYPE_GDIPLUS_CACHE_NEXT:
4232 rc = update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next));
4235 case ORDER_TYPE_GDIPLUS_CACHE_END:
4236 rc = update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end));
4239 case ORDER_TYPE_WINDOW:
4244 case ORDER_TYPE_COMPDESK_FIRST:
4254 WLog_Print(log, WLOG_ERROR,
"Read %s %s failed", alt_sec_order_str,
4255 altsec_order_string(orderType));
4261 static BOOL update_recv_altsec_order(rdpUpdate* update,
wStream* s, BYTE flags)
4263 BYTE orderType = flags >> 2;
4266 rdpContext* context = update->context;
4267 rdpSettings* settings = context->settings;
4269 const char* orderName = altsec_order_string(orderType);
4272 WINPR_ASSERT(context);
4273 WINPR_ASSERT(settings);
4275 WLog_Print(up->log, WLOG_DEBUG,
"%s %s", alt_sec_order_str, orderName);
4277 rc = IFCALLRESULT(TRUE, altsec->common.DrawOrderInfo, context, orderType, orderName);
4281 if (!check_alt_order_supported(up->log, settings, orderType, orderName))
4284 if (!read_altsec_order(up->log, s, orderType, &altsec->common))
4289 case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP:
4290 IFCALLRET(altsec->common.CreateOffscreenBitmap, rc, context,
4291 &(altsec->create_offscreen_bitmap));
4294 case ORDER_TYPE_SWITCH_SURFACE:
4295 IFCALLRET(altsec->common.SwitchSurface, rc, context, &(altsec->switch_surface));
4298 case ORDER_TYPE_CREATE_NINE_GRID_BITMAP:
4299 IFCALLRET(altsec->common.CreateNineGridBitmap, rc, context,
4300 &(altsec->create_nine_grid_bitmap));
4303 case ORDER_TYPE_FRAME_MARKER:
4304 IFCALLRET(altsec->common.FrameMarker, rc, context, &(altsec->frame_marker));
4307 case ORDER_TYPE_STREAM_BITMAP_FIRST:
4308 IFCALLRET(altsec->common.StreamBitmapFirst, rc, context,
4309 &(altsec->stream_bitmap_first));
4312 case ORDER_TYPE_STREAM_BITMAP_NEXT:
4313 IFCALLRET(altsec->common.StreamBitmapNext, rc, context, &(altsec->stream_bitmap_next));
4316 case ORDER_TYPE_GDIPLUS_FIRST:
4317 IFCALLRET(altsec->common.DrawGdiPlusFirst, rc, context, &(altsec->draw_gdiplus_first));
4320 case ORDER_TYPE_GDIPLUS_NEXT:
4321 IFCALLRET(altsec->common.DrawGdiPlusNext, rc, context, &(altsec->draw_gdiplus_next));
4324 case ORDER_TYPE_GDIPLUS_END:
4325 IFCALLRET(altsec->common.DrawGdiPlusEnd, rc, context, &(altsec->draw_gdiplus_end));
4328 case ORDER_TYPE_GDIPLUS_CACHE_FIRST:
4329 IFCALLRET(altsec->common.DrawGdiPlusCacheFirst, rc, context,
4330 &(altsec->draw_gdiplus_cache_first));
4333 case ORDER_TYPE_GDIPLUS_CACHE_NEXT:
4334 IFCALLRET(altsec->common.DrawGdiPlusCacheNext, rc, context,
4335 &(altsec->draw_gdiplus_cache_next));
4338 case ORDER_TYPE_GDIPLUS_CACHE_END:
4339 IFCALLRET(altsec->common.DrawGdiPlusCacheEnd, rc, context,
4340 &(altsec->draw_gdiplus_cache_end));
4343 case ORDER_TYPE_WINDOW:
4344 rc = update_recv_altsec_window_order(update, s);
4347 case ORDER_TYPE_COMPDESK_FIRST:
4357 WLog_Print(up->log, WLOG_ERROR,
"%s %s failed", alt_sec_order_str, orderName);
4362 BOOL update_recv_order(rdpUpdate* update,
wStream* s)
4365 BYTE controlFlags = 0;
4368 if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
4371 Stream_Read_UINT8(s, controlFlags);
4373 if (!(controlFlags & ORDER_STANDARD))
4374 rc = update_recv_altsec_order(update, s, controlFlags);
4375 else if (controlFlags & ORDER_SECONDARY)
4376 rc = update_recv_secondary_order(update, s, controlFlags);
4378 rc = update_recv_primary_order(update, s, controlFlags);
4381 WLog_Print(up->log, WLOG_ERROR,
"order flags %02" PRIx8
" failed", controlFlags);
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.