Added OrderInfo callback for primary, seconardy and altsec orders

This allows gathering statistics about which orders have been
received
This commit is contained in:
akallabeth
2021-01-26 15:25:06 +01:00
committed by akallabeth
parent 35acb4bdf4
commit dfec6228e4
4 changed files with 27 additions and 3 deletions

View File

@@ -187,6 +187,7 @@ typedef BOOL (*pDrawGdiPlusCacheNext)(rdpContext* context,
const DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
typedef BOOL (*pDrawGdiPlusCacheEnd)(rdpContext* context,
const DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
typedef BOOL (*pDrawOrderInfo)(rdpContext* context, UINT8 orderType, const char* orderName);
struct rdp_altsec_update
{
@@ -205,7 +206,9 @@ struct rdp_altsec_update
pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst; /* 25 */
pDrawGdiPlusCacheNext DrawGdiPlusCacheNext; /* 26 */
pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; /* 27 */
UINT32 paddingB[32 - 28]; /* 28 */
/* Statistics callback */
pDrawOrderInfo DrawOrderInfo; /* 28 */
UINT32 paddingB[32 - 29]; /* 29 */
/* internal */

View File

@@ -462,6 +462,8 @@ typedef BOOL (*pPolygonSC)(rdpContext* context, const POLYGON_SC_ORDER* polygon_
typedef BOOL (*pPolygonCB)(rdpContext* context, POLYGON_CB_ORDER* polygon_cb);
typedef BOOL (*pEllipseSC)(rdpContext* context, const ELLIPSE_SC_ORDER* ellipse_sc);
typedef BOOL (*pEllipseCB)(rdpContext* context, const ELLIPSE_CB_ORDER* ellipse_cb);
typedef BOOL (*pOrderInfo)(rdpContext* context, const ORDER_INFO* order_info,
const char* order_name);
struct rdp_primary_update
{
@@ -490,7 +492,9 @@ struct rdp_primary_update
pPolygonCB PolygonCB; /* 35 */
pEllipseSC EllipseSC; /* 36 */
pEllipseCB EllipseCB; /* 37 */
UINT32 paddingB[48 - 38]; /* 38 */
/* Statistics callback */
pOrderInfo OrderInfo; /* 38 */
UINT32 paddingB[48 - 39]; /* 39 */
/* internal */

View File

@@ -172,6 +172,8 @@ typedef BOOL (*pCacheGlyph)(rdpContext* context, const CACHE_GLYPH_ORDER* cache_
typedef BOOL (*pCacheGlyphV2)(rdpContext* context,
const CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order);
typedef BOOL (*pCacheBrush)(rdpContext* context, const CACHE_BRUSH_ORDER* cache_brush_order);
typedef BOOL (*pCacheOrderInfo)(rdpContext* context, UINT16 orderLength, UINT16 extraFlags,
UINT8 orderType, const char* orderName);
struct rdp_secondary_update
{
@@ -185,7 +187,9 @@ struct rdp_secondary_update
pCacheGlyph CacheGlyph; /* 20 */
pCacheGlyphV2 CacheGlyphV2; /* 21 */
pCacheBrush CacheBrush; /* 22 */
UINT32 paddingE[32 - 23]; /* 23 */
/* Statistics callback */
pCacheOrderInfo CacheOrderInfo; /* 23 */
UINT32 paddingE[32 - 24]; /* 24 */
/* internal */

View File

@@ -3464,6 +3464,10 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
if (!read_primary_order(update->log, orderName, s, orderInfo, primary))
return FALSE;
rc = IFCALLRESULT(TRUE, primary->OrderInfo, context, orderInfo, orderName);
if (!rc)
return FALSE;
switch (orderInfo->orderType)
{
case ORDER_TYPE_DSTBLT:
@@ -3682,6 +3686,11 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
start = Stream_GetPosition(s);
name = secondary_order_string(orderType);
WLog_Print(update->log, WLOG_DEBUG, "Secondary Drawing Order %s", name);
rc = IFCALLRESULT(FALSE, secondary->CacheOrderInfo, context, orderLength, extraFlags, orderType,
name);
if (!rc)
return FALSE;
/*
* According to [MS-RDPEGDI] 2.2.2.2.1.2.1.1 the order length must be increased by 13 bytes
* including the header. As we already read the header 7 left
@@ -3912,6 +3921,10 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
const char* orderName = altsec_order_string(orderType);
WLog_Print(update->log, WLOG_DEBUG, "Alternate Secondary Drawing Order %s", orderName);
rc = IFCALLRESULT(TRUE, altsec->DrawOrderInfo, context, orderType, orderName);
if (!rc)
return FALSE;
if (!check_alt_order_supported(update->log, settings, orderType, orderName))
return FALSE;