From 46ccf6d0d7f307672487458fac60a466f363d727 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 25 May 2022 13:11:29 +0200 Subject: [PATCH] Fixed RDPGFX_CAPVERSION_106 according to errata (#7924) The [MS-RDPEGFX] spec is not really sure which value to use, so we just announce both, the one from the spec and the one from errata. --- channels/rdpgfx/client/rdpgfx_main.c | 18 +++++++++++++++--- include/freerdp/channels/rdpgfx.h | 5 +++-- server/shadow/shadow_client.c | 13 ++++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/channels/rdpgfx/client/rdpgfx_main.c b/channels/rdpgfx/client/rdpgfx_main.c index 66c781c45..7ede62537 100644 --- a/channels/rdpgfx/client/rdpgfx_main.c +++ b/channels/rdpgfx/client/rdpgfx_main.c @@ -161,9 +161,11 @@ fail: static BOOL rdpgfx_is_capability_filtered(RDPGFX_PLUGIN* gfx, UINT32 caps) { const UINT32 filter = gfx->capsFilter; - const UINT32 capList[] = { RDPGFX_CAPVERSION_8, RDPGFX_CAPVERSION_81, RDPGFX_CAPVERSION_10, - RDPGFX_CAPVERSION_101, RDPGFX_CAPVERSION_102, RDPGFX_CAPVERSION_103, - RDPGFX_CAPVERSION_104, RDPGFX_CAPVERSION_105, RDPGFX_CAPVERSION_106, + const UINT32 capList[] = { RDPGFX_CAPVERSION_8, RDPGFX_CAPVERSION_81, + RDPGFX_CAPVERSION_10, RDPGFX_CAPVERSION_101, + RDPGFX_CAPVERSION_102, RDPGFX_CAPVERSION_103, + RDPGFX_CAPVERSION_104, RDPGFX_CAPVERSION_105, + RDPGFX_CAPVERSION_106, RDPGFX_CAPVERSION_106_ERR, RDPGFX_CAPVERSION_107 }; UINT32 x; @@ -321,6 +323,14 @@ static UINT rdpgfx_send_supported_caps(RDPGFX_CHANNEL_CALLBACK* callback) capsSet->flags = caps10Flags; } + if (!rdpgfx_is_capability_filtered(gfx, RDPGFX_CAPVERSION_106_ERR)) + { + capsSet = &capsSets[pdu.capsSetCount++]; + capsSet->version = RDPGFX_CAPVERSION_106_ERR; + capsSet->length = 0x4; + capsSet->flags = caps10Flags; + } + if (!rdpgfx_is_capability_filtered(gfx, RDPGFX_CAPVERSION_107)) { capsSet = &capsSets[pdu.capsSetCount++]; @@ -874,6 +884,8 @@ static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream case RDPGFX_CAPVERSION_104: case RDPGFX_CAPVERSION_105: case RDPGFX_CAPVERSION_106: + case RDPGFX_CAPVERSION_106_ERR: + case RDPGFX_CAPVERSION_107: if (gfx->SendQoeAck) { RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU qoe; diff --git a/include/freerdp/channels/rdpgfx.h b/include/freerdp/channels/rdpgfx.h index bd480d85e..c179642c7 100644 --- a/include/freerdp/channels/rdpgfx.h +++ b/include/freerdp/channels/rdpgfx.h @@ -97,9 +97,10 @@ typedef struct #define RDPGFX_CAPVERSION_104 0x000A0400 /** [MS-RDPEGFX] 2.2.3.7 */ #define RDPGFX_CAPVERSION_105 0x000A0502 /** [MS-RDPEGFX] 2.2.3.8 */ #define RDPGFX_CAPVERSION_106 0x000A0601 /** [MS-RDPEGFX] 2.2.3.9 */ -#define RDPGFX_CAPVERSION_107 0x000A0701 /** [MS-RDPEGFX] 2.2.3.10 */ +#define RDPGFX_CAPVERSION_106_ERR 0x000A0600 /** [MS-RDPEGFX]-180912-errata] */ +#define RDPGFX_CAPVERSION_107 0x000A0701 /** [MS-RDPEGFX] 2.2.3.10 */ -#define RDPGFX_NUMBER_CAPSETS 10 +#define RDPGFX_NUMBER_CAPSETS 11 #define RDPGFX_CAPSET_BASE_SIZE 8 typedef struct diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c index 3ea80e7db..61e7e965a 100644 --- a/server/shadow/shadow_client.c +++ b/server/shadow/shadow_client.c @@ -731,9 +731,11 @@ shadow_client_rdpgfx_frame_acknowledge(RdpgfxServerContext* context, static BOOL shadow_are_caps_filtered(const rdpSettings* settings, UINT32 caps) { UINT32 filter; - const UINT32 capList[] = { RDPGFX_CAPVERSION_8, RDPGFX_CAPVERSION_81, RDPGFX_CAPVERSION_10, - RDPGFX_CAPVERSION_101, RDPGFX_CAPVERSION_102, RDPGFX_CAPVERSION_103, - RDPGFX_CAPVERSION_104, RDPGFX_CAPVERSION_105, RDPGFX_CAPVERSION_106, + const UINT32 capList[] = { RDPGFX_CAPVERSION_8, RDPGFX_CAPVERSION_81, + RDPGFX_CAPVERSION_10, RDPGFX_CAPVERSION_101, + RDPGFX_CAPVERSION_102, RDPGFX_CAPVERSION_103, + RDPGFX_CAPVERSION_104, RDPGFX_CAPVERSION_105, + RDPGFX_CAPVERSION_106, RDPGFX_CAPVERSION_106_ERR, RDPGFX_CAPVERSION_107 }; UINT32 x; @@ -878,6 +880,11 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context, capsAdvertise->capsSetCount, RDPGFX_CAPVERSION_106, &rc)) return rc; + if (shadow_client_caps_test_version(context, client, h264, capsAdvertise->capsSets, + capsAdvertise->capsSetCount, RDPGFX_CAPVERSION_106_ERR, + &rc)) + return rc; + if (shadow_client_caps_test_version(context, client, h264, capsAdvertise->capsSets, capsAdvertise->capsSetCount, RDPGFX_CAPVERSION_105, &rc)) return rc;