ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

rdp5.c
Go to the documentation of this file.
00001 /* -*- c-basic-offset: 8 -*-
00002    rdesktop: A Remote Desktop Protocol client.
00003    Protocol services - RDP5 short form PDU processing
00004    Copyright (C) Matthew Chapman 1999-2005
00005    Copyright (C) Erik Forsberg 2003
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License along
00018    with this program; if not, write to the Free Software Foundation, Inc.,
00019    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00020 */
00021 
00022 #include <precomp.h>
00023 
00024 extern uint8 *g_next_packet;
00025 
00026 extern RDPCOMP g_mppc_dict;
00027 
00028 void
00029 rdp5_process(STREAM s)
00030 {
00031     uint16 length, count, x, y;
00032     uint8 type, ctype;
00033     uint8 *next;
00034 
00035     uint32 roff, rlen;
00036     struct stream *ns = &(g_mppc_dict.ns);
00037     struct stream *ts;
00038 
00039 #if 0
00040     printf("RDP5 data:\n");
00041     hexdump(s->p, s->end - s->p);
00042 #endif
00043 
00044     ui_begin_update();
00045     while (s->p < s->end)
00046     {
00047         in_uint8(s, type);
00048         if (type & RDP5_COMPRESSED)
00049         {
00050             in_uint8(s, ctype);
00051             in_uint16_le(s, length);
00052             type ^= RDP5_COMPRESSED;
00053         }
00054         else
00055         {
00056             ctype = 0;
00057             in_uint16_le(s, length);
00058         }
00059         g_next_packet = next = s->p + length;
00060 
00061         if (ctype & RDP_MPPC_COMPRESSED)
00062         {
00063             if (mppc_expand(s->p, length, ctype, &roff, &rlen) == -1)
00064                 error("error while decompressing packet\n");
00065 
00066             /* allocate memory and copy the uncompressed data into the temporary stream */
00067             ns->data = (uint8 *) xrealloc(ns->data, rlen);
00068 
00069             memcpy((ns->data), (unsigned char *) (g_mppc_dict.hist + roff), rlen);
00070 
00071             ns->size = rlen;
00072             ns->end = (ns->data + ns->size);
00073             ns->p = ns->data;
00074             ns->rdp_hdr = ns->p;
00075 
00076             ts = ns;
00077         }
00078         else
00079             ts = s;
00080 
00081         switch (type)
00082         {
00083             case 0: /* update orders */
00084                 in_uint16_le(ts, count);
00085                 process_orders(ts, count);
00086                 break;
00087             case 1: /* update bitmap */
00088                 in_uint8s(ts, 2);   /* part length */
00089                 process_bitmap_updates(ts);
00090                 break;
00091             case 2: /* update palette */
00092                 in_uint8s(ts, 2);   /* uint16 = 2 */
00093                 process_palette(ts);
00094                 break;
00095             case 3: /* update synchronize */
00096                 break;
00097             case 5: /* null pointer */
00098                 ui_set_null_cursor();
00099                 break;
00100             case 6: /* default pointer */
00101                 break;
00102             case 8: /* pointer position */
00103                 in_uint16_le(ts, x);
00104                 in_uint16_le(ts, y);
00105                 if (s_check(ts))
00106                     ui_move_pointer(x, y);
00107                 break;
00108             case 9: /* color pointer */
00109                 process_colour_pointer_pdu(ts);
00110                 break;
00111             case 10:    /* cached pointer */
00112                 process_cached_pointer_pdu(ts);
00113                 break;
00114             default:
00115                 unimpl("RDP5 opcode %d\n", type);
00116         }
00117 
00118         s->p = next;
00119     }
00120     ui_end_update();
00121 }

Generated on Sat May 26 2012 04:16:06 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.