libfreerdp-core: fix server-side color depth negotiation
This commit is contained in:
parent
e1d0fad519
commit
d8afffd3a8
@ -212,8 +212,9 @@ BOOL rdp_read_bitmap_capability_set(STREAM* s, UINT16 length, rdpSettings* setti
|
||||
UINT16 desktopResizeFlag;
|
||||
UINT16 preferredBitsPerPixel;
|
||||
|
||||
if(length < 28)
|
||||
if (length < 28)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */
|
||||
stream_seek_UINT16(s); /* receive1BitPerPixel (2 bytes) */
|
||||
stream_seek_UINT16(s); /* receive4BitsPerPixel (2 bytes) */
|
||||
@ -228,7 +229,7 @@ BOOL rdp_read_bitmap_capability_set(STREAM* s, UINT16 length, rdpSettings* setti
|
||||
stream_seek_UINT16(s); /* multipleRectangleSupport (2 bytes) */
|
||||
stream_seek_UINT16(s); /* pad2OctetsB (2 bytes) */
|
||||
|
||||
if (!settings->ServerMode && preferredBitsPerPixel != settings->ColorDepth)
|
||||
if (!settings->ServerMode && (preferredBitsPerPixel != settings->ColorDepth))
|
||||
{
|
||||
/* The client must respect the actual color depth used by the server */
|
||||
settings->ColorDepth = preferredBitsPerPixel;
|
||||
@ -243,6 +244,7 @@ BOOL rdp_read_bitmap_capability_set(STREAM* s, UINT16 length, rdpSettings* setti
|
||||
settings->DesktopWidth = desktopWidth;
|
||||
settings->DesktopHeight = desktopHeight;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1546,8 +1548,9 @@ BOOL rdp_read_bitmap_codecs_capability_set(STREAM* s, UINT16 length, rdpSettings
|
||||
UINT16 codecPropertiesLength;
|
||||
UINT16 remainingLength;
|
||||
|
||||
if(length < 5)
|
||||
if (length < 5)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */
|
||||
remainingLength = length - 5;
|
||||
|
||||
@ -1560,8 +1563,9 @@ BOOL rdp_read_bitmap_codecs_capability_set(STREAM* s, UINT16 length, rdpSettings
|
||||
|
||||
while (bitmapCodecCount > 0)
|
||||
{
|
||||
if(remainingLength < 19)
|
||||
if (remainingLength < 19)
|
||||
return FALSE;
|
||||
|
||||
if (settings->ServerMode && strncmp((char*) stream_get_tail(s), CODEC_GUID_REMOTEFX, 16) == 0)
|
||||
{
|
||||
stream_seek(s, 16); /* codecGUID (16 bytes) */
|
||||
@ -1582,7 +1586,8 @@ BOOL rdp_read_bitmap_codecs_capability_set(STREAM* s, UINT16 length, rdpSettings
|
||||
|
||||
stream_read_UINT16(s, codecPropertiesLength); /* codecPropertiesLength (2 bytes) */
|
||||
remainingLength -= 19;
|
||||
if(remainingLength < codecPropertiesLength)
|
||||
|
||||
if (remainingLength < codecPropertiesLength)
|
||||
return FALSE;
|
||||
|
||||
stream_seek(s, codecPropertiesLength); /* codecProperties */
|
||||
|
@ -597,6 +597,9 @@ BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLen
|
||||
|
||||
if (highColorDepth > 0)
|
||||
{
|
||||
if (earlyCapabilityFlags & RNS_UD_CS_WANT_32BPP_SESSION)
|
||||
color_depth = 32;
|
||||
else
|
||||
color_depth = highColorDepth;
|
||||
}
|
||||
else if (postBeta2ColorDepth > 0)
|
||||
@ -641,7 +644,7 @@ BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLen
|
||||
* If we are in server mode, accept client's color depth only if
|
||||
* it is smaller than ours. This is what Windows server does.
|
||||
*/
|
||||
if (color_depth < settings->ColorDepth || !settings->ServerMode)
|
||||
if ((color_depth < settings->ColorDepth) || !settings->ServerMode)
|
||||
settings->ColorDepth = color_depth;
|
||||
|
||||
return TRUE;
|
||||
|
@ -511,6 +511,7 @@ void* mf_peer_main_loop(void* arg)
|
||||
client->settings->PrivateKeyFile = _strdup("server.key");
|
||||
client->settings->NlaSecurity = FALSE;
|
||||
client->settings->RemoteFxCodec = TRUE;
|
||||
client->settings->ColorDepth = 32;
|
||||
client->settings->SuppressOutput = TRUE;
|
||||
client->settings->RefreshRect = FALSE;
|
||||
|
||||
|
@ -235,6 +235,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
|
||||
|
||||
settings = client->settings;
|
||||
settings->RemoteFxCodec = TRUE;
|
||||
settings->ColorDepth = 32;
|
||||
settings->NSCodec = FALSE;
|
||||
settings->JpegCodec = FALSE;
|
||||
wf_peer_read_settings(client);
|
||||
|
@ -647,6 +647,7 @@ void* xf_peer_main_loop(void* arg)
|
||||
settings->PrivateKeyFile = freerdp_construct_path(server_file_path, "server.key");
|
||||
|
||||
settings->RemoteFxCodec = TRUE;
|
||||
settings->ColorDepth = 32;
|
||||
|
||||
client->Capabilities = xf_peer_capabilities;
|
||||
client->PostConnect = xf_peer_post_connect;
|
||||
|
Loading…
Reference in New Issue
Block a user