--- sourceforge.net/trunk/rdesktop/orders.c 2003/03/02 23:45:34 336 +++ sourceforge.net/trunk/rdesktop/orders.c 2003/03/28 09:09:17 355 @@ -1,4 +1,4 @@ -/* +/* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. RDP order processing Copyright (C) Matthew Chapman 1999-2002 @@ -23,6 +23,7 @@ extern uint8 *next_packet; static RDP_ORDER_STATE order_state; +extern BOOL use_rdp5; /* Read field indicating which parameters are present */ static void @@ -605,9 +606,9 @@ if (present & 0x002000) in_uint16_le(s, os->boxbottom); - if (present & 0x004000) /* fix for connecting to a server that */ - in_uint8s(s, 10); /* was disconnected with mstsc.exe */ - /* 0x008000, 0x020000, and 0x040000 are present too ??? */ + if (present & 0x004000) /* fix for connecting to a server that */ + in_uint8s(s, 10); /* was disconnected with mstsc.exe */ + /* 0x008000, 0x020000, and 0x040000 are present too ??? */ if (present & 0x080000) in_uint16_le(s, os->x); @@ -680,21 +681,36 @@ uint16 cache_idx, size; uint8 cache_id, width, height, bpp, Bpp; uint8 *data, *bmpdata; + uint16 bufsize, pad2, row_size, final_size; + uint8 pad1; in_uint8(s, cache_id); - in_uint8s(s, 1); /* pad */ + in_uint8(s, pad1); /* pad */ in_uint8(s, width); in_uint8(s, height); in_uint8(s, bpp); Bpp = (bpp + 7) / 8; - in_uint8s(s, 2); /* bufsize */ + in_uint16_le(s, bufsize); /* bufsize */ in_uint16_le(s, cache_idx); - in_uint8s(s, 2); /* pad */ - in_uint16_le(s, size); - in_uint8s(s, 4); /* row_size, final_size */ + + if (!use_rdp5) { + + /* Begin compressedBitmapData */ + in_uint16_le(s, pad2); /* pad */ + in_uint16_le(s, size); + // in_uint8s(s, 4); /* row_size, final_size */ + in_uint16_le(s, row_size); + in_uint16_le(s, final_size); + + } else { + size = bufsize; + } in_uint8p(s, data, size); - DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx)); + DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d,bpp=%d,size=%d,pad1=%d,bufsize=%d,pad2=%d,rs=%d,fs=%d)\n", + width, height, + cache_id, cache_idx, + bpp, size, pad1, bufsize, pad2, row_size, final_size)); bmpdata = xmalloc(width * height * Bpp); @@ -703,6 +719,10 @@ bitmap = ui_create_bitmap(width, height, bmpdata); cache_put_bitmap(cache_id, cache_idx, bitmap); } + else + { + DEBUG(("Failed to decompress bitmap data\n")); + } xfree(bmpdata); } @@ -811,19 +831,14 @@ /* Process an order PDU */ void -process_orders(STREAM s) +process_orders(STREAM s, uint16 num_orders) { RDP_ORDER_STATE *os = &order_state; uint32 present; - uint16 num_orders; uint8 order_flags; int size, processed = 0; BOOL delta; - in_uint8s(s, 2); /* pad */ - in_uint16_le(s, num_orders); - in_uint8s(s, 2); /* pad */ - while (processed < num_orders) { in_uint8(s, order_flags);