wfreerdp-server: fix negotiation of codecs

This commit is contained in:
Marc-André Moreau 2012-09-15 17:51:05 -04:00
parent 174d070471
commit c62a82e228
3 changed files with 23 additions and 5 deletions

View File

@ -1434,6 +1434,7 @@ void rdp_read_bitmap_codecs_capability_set(STREAM* s, uint16 length, rdpSettings
{ {
settings->rfx_codec = false; settings->rfx_codec = false;
settings->ns_codec = false; settings->ns_codec = false;
settings->jpeg_codec = false;
} }
while (bitmapCodecCount > 0) while (bitmapCodecCount > 0)
@ -1444,7 +1445,7 @@ void rdp_read_bitmap_codecs_capability_set(STREAM* s, uint16 length, rdpSettings
stream_read_uint8(s, settings->rfx_codec_id); stream_read_uint8(s, settings->rfx_codec_id);
settings->rfx_codec = true; settings->rfx_codec = true;
} }
else if (settings->server_mode && strncmp((char*)stream_get_tail(s),CODEC_GUID_NSCODEC, 16) == 0) else if (settings->server_mode && strncmp((char*)stream_get_tail(s), CODEC_GUID_NSCODEC, 16) == 0)
{ {
stream_seek(s, 16); /*codec GUID (16 bytes) */ stream_seek(s, 16); /*codec GUID (16 bytes) */
stream_read_uint8(s, settings->ns_codec_id); stream_read_uint8(s, settings->ns_codec_id);
@ -1562,7 +1563,6 @@ void rdp_write_nsc_server_capability_container(STREAM* s, rdpSettings* settings)
stream_write_uint32(s, 0); /* reserved */ stream_write_uint32(s, 0); /* reserved */
} }
/** /**
* Write bitmap codecs capability set.\n * Write bitmap codecs capability set.\n
* @msdn{dd891377} * @msdn{dd891377}
@ -1578,6 +1578,7 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings)
header = rdp_capability_set_start(s); header = rdp_capability_set_start(s);
bitmapCodecCount = 0; bitmapCodecCount = 0;
if (settings->rfx_codec) if (settings->rfx_codec)
bitmapCodecCount++; bitmapCodecCount++;
if (settings->ns_codec) if (settings->ns_codec)

View File

@ -530,17 +530,29 @@ static void update_send_pointer_cached(rdpContext* context, POINTER_CACHED_UPDAT
boolean update_read_refresh_rect(rdpUpdate* update, STREAM* s) boolean update_read_refresh_rect(rdpUpdate* update, STREAM* s)
{ {
int index;
uint8 numberOfAreas; uint8 numberOfAreas;
RECTANGLE_16* areas;
if (stream_get_left(s) < 4) if (stream_get_left(s) < 4)
return false; return false;
stream_read_uint8(s, numberOfAreas); stream_read_uint8(s, numberOfAreas);
stream_seek(s, 3); /* pad3Octects */ stream_seek(s, 3); /* pad3Octects */
if (stream_get_left(s) < numberOfAreas * 8)
return false;
IFCALL(update->RefreshRect, update->context, numberOfAreas, (RECTANGLE_16*) stream_get_tail(s)); areas = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * numberOfAreas);
for (index = 0; index < numberOfAreas; index++)
{
stream_read_uint16(s, areas[index].left);
stream_read_uint16(s, areas[index].top);
stream_read_uint16(s, areas[index].right);
stream_read_uint16(s, areas[index].bottom);
}
IFCALL(update->RefreshRect, update->context, numberOfAreas, areas);
free(areas);
return true; return true;
} }

View File

@ -176,11 +176,16 @@ static DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
DWORD nCount; DWORD nCount;
DWORD status; DWORD status;
HANDLE handles[32]; HANDLE handles[32];
rdpSettings* settings;
wfPeerContext* context; wfPeerContext* context;
freerdp_peer* client = (freerdp_peer*) lpParam; freerdp_peer* client = (freerdp_peer*) lpParam;
wf_peer_init(client); wf_peer_init(client);
settings = client->settings;
settings->rfx_codec = true;
settings->ns_codec = false;
settings->jpeg_codec = false;
wf_peer_read_settings(client); wf_peer_read_settings(client);
client->PostConnect = wf_peer_post_connect; client->PostConnect = wf_peer_post_connect;