libfreerdp-core: hook new MPPC compressor successfully

This commit is contained in:
Marc-André Moreau 2014-03-11 20:58:35 -04:00
parent d52acf9099
commit 37e037ee71
4 changed files with 16 additions and 10 deletions

View File

@ -39,7 +39,6 @@ int bulk_decompress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstD
mppc_decompress(bulk->mppcRecv, pSrcData, ppDstData, &size, flags);
*pDstSize = size;
status = 1;
printf("BulkDecompress: SrcSize: %d DstSize: %d Flags: 0x%04X\n", SrcSize, *pDstSize, flags);
break;
case PACKET_COMPR_TYPE_64K:
@ -48,7 +47,6 @@ int bulk_decompress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstD
mppc_decompress(bulk->mppcRecv, pSrcData, ppDstData, &size, flags);
*pDstSize = size;
status = 1;
printf("BulkDecompress: SrcSize: %d DstSize: %d Flags: 0x%04X\n", SrcSize, *pDstSize, flags);
break;
case PACKET_COMPR_TYPE_RDP6:
@ -81,9 +79,7 @@ int bulk_compress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstDat
*pFlags = flags;
*pDstSize = size;
*ppDstData = bulk->OutputBuffer;
status = 0;
printf("BulkCompress: SrcSize: %d DstSize: %d Flags: 0x%04X\n", SrcSize, *pDstSize, flags);
status = 1;
return status;
}
@ -111,6 +107,8 @@ rdpBulk* bulk_new(rdpContext* context)
bulk->mppcRecv = mppc_context_new(1, FALSE);
bulk->mppc_dec = mppc_dec_new();
bulk->CompressionLevel = context->settings->CompressionLevel;
}
return bulk;

View File

@ -31,6 +31,7 @@ typedef struct rdp_bulk rdpBulk;
struct rdp_bulk
{
rdpContext* context;
UINT32 CompressionLevel;
MPPC_CONTEXT* mppcSend;
MPPC_CONTEXT* mppcRecv;
BYTE OutputBuffer[65536];

View File

@ -845,14 +845,13 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
FASTPATH_UPDATE_PDU_HEADER fpUpdatePduHeader = { 0 };
FASTPATH_UPDATE_HEADER fpUpdateHeader = { 0 };
fs = fastpath->fs;
settings = rdp->settings;
maxLength = FASTPATH_MAX_PACKET_SIZE - 20;
totalLength = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
fs = Stream_New(NULL, FASTPATH_MAX_PACKET_SIZE);
for (fragment = 0; (totalLength > 0) || (fragment == 0); fragment++)
{
BYTE* pSrcData;
@ -884,6 +883,12 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
}
}
if (!fpUpdateHeader.compression)
{
pDstData = Stream_Pointer(s);
DstSize = fpUpdateHeader.size;
}
fpUpdateHeader.size = DstSize;
totalLength -= SrcSize;
@ -903,7 +908,6 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
fastpath_write_update_header(fs, &fpUpdateHeader);
Stream_Write(fs, pDstData, DstSize);
Stream_Seek(s, SrcSize);
Stream_SealLength(fs);
if (transport_write(rdp->transport, fs) < 0)
@ -911,9 +915,9 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
status = FALSE;
break;
}
}
Stream_Free(fs, TRUE);
Stream_Seek(s, SrcSize);
}
return status;
}
@ -930,6 +934,7 @@ rdpFastPath* fastpath_new(rdpRdp* rdp)
fastpath->rdp = rdp;
fastpath->fragmentation = -1;
fastpath->fs = Stream_New(NULL, FASTPATH_MAX_PACKET_SIZE);
}
return fastpath;
@ -939,6 +944,7 @@ void fastpath_free(rdpFastPath* fastpath)
{
if (fastpath)
{
Stream_Free(fastpath->fs, TRUE);
free(fastpath);
}
}

View File

@ -124,6 +124,7 @@ typedef struct _FASTPATH_UPDATE_HEADER FASTPATH_UPDATE_HEADER;
struct rdp_fastpath
{
rdpRdp* rdp;
wStream* fs;
BYTE encryptionFlags;
BYTE numberEvents;
wStream* updateData;