From 7b30f732f2aab1237fa8a88e4eb5d7d49f9f2abf Mon Sep 17 00:00:00 2001 From: louyihua Date: Tue, 10 Jan 2012 05:18:31 +0800 Subject: [PATCH] libfreerdp-codec: RDVH may return more than one channels in TS_RFX_CHANNELS message. --- libfreerdp-codec/rfx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libfreerdp-codec/rfx.c b/libfreerdp-codec/rfx.c index 2934b4031..962aced4c 100644 --- a/libfreerdp-codec/rfx.c +++ b/libfreerdp-codec/rfx.c @@ -266,7 +266,10 @@ static void rfx_process_message_channels(RFX_CONTEXT* context, STREAM* s) stream_read_uint8(s, numChannels); /* numChannels (1 byte), must bet set to 0x01 */ - if (numChannels != 1) + /* In RDVH sessions, numChannels will represent the number of virtual monitors + * configured and does not always be set to 0x01 as [MS-RDPRFX] said. + */ + if (numChannels < 1) { DEBUG_WARN("numChannels:%d, expected:1", numChannels); return; @@ -277,6 +280,9 @@ static void rfx_process_message_channels(RFX_CONTEXT* context, STREAM* s) stream_read_uint16(s, context->width); /* width (2 bytes) */ stream_read_uint16(s, context->height); /* height (2 bytes) */ + /* Now, only the first monitor can be used, therefore the other channels will be ignored. */ + stream_seek(s, 5 * (numChannels - 1)); + DEBUG_RFX("numChannels %d id %d, %dx%d.", numChannels, channelId, context->width, context->height); }