libfreerdp-core: handle omission of bitmap compression header

This commit is contained in:
Marc-André Moreau 2011-12-19 20:31:37 -05:00
parent 0914eb071e
commit 15a2567e87
4 changed files with 31 additions and 13 deletions

View File

@ -48,7 +48,10 @@ struct _BITMAP_DATA
uint32 bitsPerPixel;
uint32 flags;
uint32 bitmapLength;
uint8 bitmapComprHdr[8];
uint32 cbCompFirstRowSize;
uint32 cbCompMainBodySize;
uint32 cbScanWidth;
uint32 cbUncompressedSize;
uint8* bitmapDataStream;
boolean compressed;
};

View File

@ -140,7 +140,7 @@ void rdp_write_general_capability_set(STREAM* s, rdpSettings* settings)
header = rdp_capability_set_start(s);
extraFlags = LONG_CREDENTIALS_SUPPORTED; /* | NO_BITMAP_COMPRESSION_HDR; */
extraFlags = LONG_CREDENTIALS_SUPPORTED | NO_BITMAP_COMPRESSION_HDR;
if (settings->auto_reconnection)
extraFlags |= AUTORECONNECT_SUPPORTED;
@ -155,8 +155,8 @@ void rdp_write_general_capability_set(STREAM* s, rdpSettings* settings)
settings->suppress_output = false;
}
stream_write_uint16(s, 0); /* osMajorType (2 bytes) */
stream_write_uint16(s, 0); /* osMinorType (2 bytes) */
stream_write_uint16(s, OSMAJORTYPE_WINDOWS); /* osMajorType (2 bytes) */
stream_write_uint16(s, OSMINORTYPE_WINDOWS_NT); /* osMinorType (2 bytes) */
stream_write_uint16(s, CAPS_PROTOCOL_VERSION); /* protocolVersion (2 bytes) */
stream_write_uint16(s, 0); /* pad2OctetsA (2 bytes) */
stream_write_uint16(s, 0); /* generalCompressionTypes (2 bytes) */

View File

@ -61,6 +61,22 @@
#define SOURCE_DESCRIPTOR "MSTSC"
#define OSMAJORTYPE_UNSPECIFIED 0x0000
#define OSMAJORTYPE_WINDOWS 0x0001
#define OSMAJORTYPE_OS2 0x0002
#define OSMAJORTYPE_MACINTOSH 0x0003
#define OSMAJORTYPE_UNIX 0x0004
#define OSMINORTYPE_UNSPECIFIED 0x0000
#define OSMINORTYPE_WINDOWS_31X 0x0001
#define OSMINORTYPE_WINDOWS_95 0x0002
#define OSMINORTYPE_WINDOWS_NT 0x0003
#define OSMINORTYPE_OS2_V21 0x0004
#define OSMINORTYPE_POWER_PC 0x0005
#define OSMINORTYPE_MACINTOSH 0x0006
#define OSMINORTYPE_NATIVE_XSERVER 0x0007
#define OSMINORTYPE_PSEUDO_XSERVER 0x0008
/* Capabilities Protocol Version */
#define CAPS_PROTOCOL_VERSION 0x0200

View File

@ -61,15 +61,14 @@ void update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
if (bitmap_data->flags & BITMAP_COMPRESSION)
{
uint16 cbCompMainBodySize;
uint16 cbUncompressedSize;
stream_seek_uint16(s); /* cbCompFirstRowSize (2 bytes) */
stream_read_uint16(s, cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
stream_seek_uint16(s); /* cbScanWidth (2 bytes) */
stream_read_uint16(s, cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
bitmap_data->bitmapLength = cbCompMainBodySize;
if (!(bitmap_data->flags & NO_BITMAP_COMPRESSION_HDR))
{
stream_read_uint16(s, bitmap_data->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
stream_read_uint16(s, bitmap_data->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
stream_read_uint16(s, bitmap_data->cbScanWidth); /* cbScanWidth (2 bytes) */
stream_read_uint16(s, bitmap_data->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
bitmap_data->bitmapLength = bitmap_data->cbCompMainBodySize;
}
bitmap_data->compressed = true;
stream_get_mark(s, bitmap_data->bitmapDataStream);