/[rdesktop]/sourceforge.net/trunk/rdesktop/rdp5.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdp5.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 508 by astrand, Wed Oct 22 10:55:11 2003 UTC revision 687 by n-ki, Fri Apr 30 06:18:08 2004 UTC
# Line 23  Line 23 
23    
24  extern uint8 *g_next_packet;  extern uint8 *g_next_packet;
25    
26    extern RDPCOMP g_mppc_dict;
27    
28  void  void
29  rdp5_process(STREAM s, BOOL encryption)  rdp5_process(STREAM s, BOOL encryption)
30  {  {
31          uint16 length, count, x, y;          uint16 length, count, x, y;
32          uint8 type;          uint8 type, ctype;
33          uint8 *next;          uint8 *next;
34    
35            uint32 roff, rlen;
36            struct stream *ns = &(g_mppc_dict.ns);
37            struct stream *ts;
38    
39          if (encryption)          if (encryption)
40          {          {
41                  in_uint8s(s, 8);        /* signature */                  in_uint8s(s, 8);        /* signature */
# Line 44  rdp5_process(STREAM s, BOOL encryption) Line 50  rdp5_process(STREAM s, BOOL encryption)
50          while (s->p < s->end)          while (s->p < s->end)
51          {          {
52                  in_uint8(s, type);                  in_uint8(s, type);
53                  in_uint16_le(s, length);                  if (type & RDP_COMPRESSION)
54                    {
55                            in_uint8(s, ctype);
56                            in_uint16_le(s, length);
57                            type ^= RDP_COMPRESSION;
58                    }
59                    else
60                    {
61                            ctype = 0;
62                            in_uint16_le(s, length);
63                    }
64                  g_next_packet = next = s->p + length;                  g_next_packet = next = s->p + length;
65    
66                    if (ctype & RDP_MPPC_COMPRESSED)
67                    {
68    
69                            if (mppc_expand(s->p, length, ctype, &roff, &rlen) == -1)
70                                    error("error while decompressing packet\n");
71    
72                            /* allocate memory and copy the uncompressed data into the temporary stream */
73                            ns->data = xrealloc(ns->data, rlen);
74    
75                            memcpy((ns->data), (unsigned char *) (g_mppc_dict.hist + roff), rlen);
76    
77                            ns->size = rlen;
78                            ns->end = (ns->data + ns->size);
79                            ns->p = ns->data;
80                            ns->rdp_hdr = ns->p;
81    
82                            ts = ns;
83                    }
84                    else
85                            ts = s;
86    
87                  switch (type)                  switch (type)
88                  {                  {
89                                  /* Thanks to Jeroen Meijer <jdmeijer at yahoo                                  /* Thanks to Jeroen Meijer <jdmeijer at yahoo
# Line 54  rdp5_process(STREAM s, BOOL encryption) Line 91  rdp5_process(STREAM s, BOOL encryption)
91                                     most of the opcodes here. Especially opcode                                     most of the opcodes here. Especially opcode
92                                     8! :) */                                     8! :) */
93                          case 0: /* orders */                          case 0: /* orders */
94                                  in_uint16_le(s, count);                                  in_uint16_le(ts, count);
95                                  process_orders(s, count);                                  process_orders(ts, count);
96                                  break;                                  break;
97                          case 1: /* bitmap update (???) */                          case 1: /* bitmap update (???) */
98                                  in_uint8s(s, 2);        /* part length */                                  in_uint8s(ts, 2);       /* part length */
99                                  process_bitmap_updates(s);                                  process_bitmap_updates(ts);
100                                  break;                                  break;
101                          case 2: /* palette */                          case 2: /* palette */
102                                  in_uint8s(s, 2);        /* uint16 = 2 */                                  in_uint8s(ts, 2);       /* uint16 = 2 */
103                                  process_palette(s);                                  process_palette(ts);
104                                  break;                                  break;
105                          case 3: /* probably an palette with offset 3. Weird */                          case 3: /* probably an palette with offset 3. Weird */
106                                  break;                                  break;
# Line 71  rdp5_process(STREAM s, BOOL encryption) Line 108  rdp5_process(STREAM s, BOOL encryption)
108                                  ui_set_null_cursor();                                  ui_set_null_cursor();
109                                  break;                                  break;
110                          case 8:                          case 8:
111                                  in_uint16_le(s, x);                                  in_uint16_le(ts, x);
112                                  in_uint16_le(s, y);                                  in_uint16_le(ts, y);
113                                  if (s_check(s))                                  if (s_check(ts))
114                                          ui_move_pointer(x, y);                                          ui_move_pointer(x, y);
115                                  break;                                  break;
116                          case 9:                          case 9:
117                                  process_colour_pointer_pdu(s);                                  process_colour_pointer_pdu(ts);
118                                  break;                                  break;
119                          case 10:                          case 10:
120                                  process_cached_pointer_pdu(s);                                  process_cached_pointer_pdu(ts);
121                                  break;                                  break;
122                          default:                          default:
123                                  unimpl("RDP5 opcode %d\n", type);                                  unimpl("RDP5 opcode %d\n", type);

Legend:
Removed from v.508  
changed lines
  Added in v.687

  ViewVC Help
Powered by ViewVC 1.1.26