Merge branch 'awakecoding-staging' of github.com:vworkspace/FreeRDP

This commit is contained in:
Marc-André Moreau 2014-10-22 20:17:13 -04:00
commit 25dd984812
5 changed files with 52 additions and 7 deletions

View File

@ -3290,6 +3290,8 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa
UINT16 length;
BYTE *bm, *em;
BOOL foundMultifragmentUpdate = FALSE;
Stream_GetPointer(s, mark);
count = numberCapabilities;
@ -3436,6 +3438,7 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa
case CAPSET_TYPE_MULTI_FRAGMENT_UPDATE:
if (!rdp_read_multifragment_update_capability_set(s, length, settings))
return FALSE;
foundMultifragmentUpdate = TRUE;
break;
case CAPSET_TYPE_LARGE_POINTER:
@ -3484,6 +3487,15 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa
count-numberCapabilities, count);
}
/**
* If we never received a multifragment update capability set,
* then the peer doesn't support fragmentation.
*/
if (!foundMultifragmentUpdate)
{
settings->MultifragMaxRequestSize = 0;
}
#ifdef WITH_DEBUG_CAPABILITIES
Stream_GetPointer(s, em);
Stream_SetPointer(s, mark);

View File

@ -893,6 +893,34 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
maxLength -= 20;
}
totalLength = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
/**
* TEMPORARY FIX
*
* FreeRDP always sends updates using fast-path without regard to the client settings
* for 1) FASTPATH_OUTPUT_SUPPORTED in the extraFlags field of the general capability
* set or 2) the MaxRequestSize field in the Multifragment Update capability set.
*
* As a temporary workaround to clients that do not support fragmentation, this code
* determines if fragmentation is needed and/or exceeds the size advertised maximum
* request size from the client. In this case, slow-path is utilized.
*
*/
if ((totalLength > maxLength) && (totalLength > settings->MultifragMaxRequestSize))
{
wStream* sps;
/* Use slow-path to send the PDU */
sps = transport_send_stream_init(rdp->transport, totalLength + 50);
rdp_init_stream_data_pdu(rdp, sps);
Stream_Copy(sps, s, totalLength);
return rdp_send_data_pdu(rdp, sps, DATA_PDU_TYPE_UPDATE, MCS_GLOBAL_CHANNEL_ID);
}
if (rdp->do_crypt)
{
rdp->sec_flags |= SEC_ENCRYPT;
@ -901,9 +929,6 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
rdp->sec_flags |= SEC_SECURE_CHECKSUM;
}
totalLength = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
for (fragment = 0; (totalLength > 0) || (fragment == 0); fragment++)
{
BYTE* pSrcData;

View File

@ -292,7 +292,7 @@ void gcc_write_conference_create_response(wStream* s, wStream* userData)
per_write_object_identifier(s, t124_02_98_oid);
/* ConnectData::connectPDU (OCTET_STRING) */
per_write_length(s, Stream_GetPosition(userData) + 2);
per_write_length(s, 0x2A);
/* ConnectGCCPDU */
per_write_choice(s, 0x14);

View File

@ -192,6 +192,7 @@ int rdp_init_stream_pdu(rdpRdp* rdp, wStream* s);
BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id);
wStream* rdp_data_pdu_init(rdpRdp* rdp);
int rdp_init_stream_data_pdu(rdpRdp* rdp, wStream* s);
BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id);
int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s);

View File

@ -58,14 +58,11 @@ static INLINE UINT64 _rotr64(UINT64 value, int shift) {
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
#define _byteswap_ushort(_val) __builtin_bswap16(_val)
#define _byteswap_ulong(_val) __builtin_bswap32(_val)
#define _byteswap_uint64(_val) __builtin_bswap64(_val)
#else
#define _byteswap_ushort(_val) (((_val) >> 8) | ((_val) << 8))
#define _byteswap_ulong(_val) (((_val) >> 24) | \
(((_val) & 0x00FF0000) >> 8) | \
(((_val) & 0x0000FF00) << 8) | \
@ -82,6 +79,16 @@ static INLINE UINT64 _rotr64(UINT64 value, int shift) {
#endif
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))
#define _byteswap_ushort(_val) __builtin_bswap16(_val)
#else
#define _byteswap_ushort(_val) (((_val) >> 8) | ((_val) << 8))
#endif
/**
* __lzcnt16, __lzcnt, __lzcnt64:
* http://msdn.microsoft.com/en-us/library/bb384809/