--- sourceforge.net/trunk/rdesktop/rdp.c 2004/04/26 22:31:22 678 +++ sourceforge.net/trunk/rdesktop/rdp.c 2004/04/30 06:18:08 687 @@ -38,6 +38,8 @@ uint8 *g_next_packet; uint32 g_rdp_shareid; +extern RDPCOMP g_mppc_dict; + #if WITH_DEBUG static uint32 g_packetno; #endif @@ -175,7 +177,8 @@ time_t tzone; #if 0 - // enable rdp compression + /* enable rdp compression */ + /* some problems still exist with rdp5 */ flags |= RDP_COMPRESSION; #endif @@ -201,6 +204,7 @@ } else { + flags |= RDP_LOGON_BLOB; DEBUG_RDP5(("Sending RDP5-style Logon packet\n")); packetlen = 4 + /* Unknown uint32 */ @@ -437,7 +441,7 @@ order_caps[0] = 1; /* dest blt */ order_caps[1] = 1; /* pat blt */ order_caps[2] = 1; /* screen blt */ - order_caps[3] = (g_bitmap_cache ? 1 : 0); /* memblt */ + order_caps[3] = (g_bitmap_cache ? 1 : 0); /* memblt */ order_caps[8] = 1; /* line */ order_caps[9] = 1; /* line */ order_caps[10] = 1; /* rect */ @@ -954,12 +958,11 @@ uint8 data_pdu_type; uint8 ctype; uint16 clen; - int len; -#if 0 - int roff, rlen, ret; - static struct stream ns; - static signed char *dict = 0; -#endif + uint32 len; + + uint32 roff, rlen; + + struct stream *ns = &(g_mppc_dict.ns); in_uint8s(s, 6); /* shareid, pad, streamid */ in_uint16(s, len); @@ -968,31 +971,26 @@ in_uint16(s, clen); clen -= 18; -#if 0 - if (ctype & 0x20) + if (ctype & RDP_MPPC_COMPRESSED) { - if (!dict) - { - dict = (signed char *) malloc(8200 * sizeof(signed char)); - dict = (signed char *) memset(dict, 0, 8200 * sizeof(signed char)); - } - ret = decompress(s->p, clen, ctype, (signed char *) dict, &roff, &rlen); + if (mppc_expand(s->p, clen, ctype, &roff, &rlen) == -1) + error("error while decompressing packet\n"); - len -= 18; + //len -= 18; - ns.data = xrealloc(ns.data, len); + /* allocate memory and copy the uncompressed data into the temporary stream */ + ns->data = xrealloc(ns->data, rlen); - ns.data = (unsigned char *) memcpy(ns.data, (unsigned char *) (dict + roff), len); + memcpy((ns->data), (unsigned char *) (g_mppc_dict.hist + roff), rlen); - ns.size = len; - ns.end = ns.data + ns.size; - ns.p = ns.data; - ns.rdp_hdr = ns.p; + ns->size = rlen; + ns->end = (ns->data + ns->size); + ns->p = ns->data; + ns->rdp_hdr = ns->p; - s = &ns; + s = ns; } -#endif switch (data_pdu_type) {