ReactOS 0.4.16-dev-338-g34e76ad
rdp5.c
Go to the documentation of this file.
1/* -*- c-basic-offset: 8 -*-
2 rdesktop: A Remote Desktop Protocol client.
3 Protocol services - RDP5 short form PDU processing
4 Copyright (C) Matthew Chapman 1999-2005
5 Copyright (C) Erik Forsberg 2003
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20*/
21
22#include "rdesktop.h"
23
24BOOL
26{
29 uint8 *next;
30
31 uint32 roff, rlen;
32 struct stream *ns = &(This->mppc_dict.ns);
33 struct stream *ts;
34
35#if 0
36 printf("RDP5 data:\n");
37 hexdump(s->p, s->end - s->p);
38#endif
39
41 while (s->p < s->end)
42 {
43 in_uint8(s, type);
45 {
49 }
50 else
51 {
52 ctype = 0;
54 }
55 This->next_packet = next = s->p + length;
56
58 {
59 void * p;
60
61 if (mppc_expand(This, s->p, length, ctype, &roff, &rlen) == -1)
62 error("error while decompressing packet\n");
63
64 /* allocate memory and copy the uncompressed data into the temporary stream */
65 p = realloc(ns->data, rlen);
66
67 if(p == NULL)
68 {
69 This->disconnect_reason = 262;
70 return False;
71 }
72
73 ns->data = (uint8 *) p;
74
75 memcpy((ns->data), (unsigned char *) (This->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)
88 {
89 case 0: /* update orders */
92 break;
93 case 1: /* update bitmap */
94 in_uint8s(ts, 2); /* part length */
96 break;
97 case 2: /* update palette */
98 in_uint8s(ts, 2); /* uint16 = 2 */
100 break;
101 case 3: /* update synchronize */
102 break;
103 case 5: /* null pointer */
105 break;
106 case 6: /* default pointer */
107 break;
108 case 8: /* pointer position */
109 in_uint16_le(ts, x);
110 in_uint16_le(ts, y);
111 if (s_check(ts))
113 break;
114 case 9: /* color pointer */
116 break;
117 case 10: /* cached pointer */
119 break;
120 default:
121 unimpl("RDP5 opcode %d\n", type);
122 }
123
124 s->p = next;
125 }
127 return True;
128}
#define RDP_MPPC_COMPRESSED
Definition: constants.h:355
#define RDP5_COMPRESSED
Definition: constants.h:360
int mppc_expand(uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
Definition: mppc.c:58
void process_orders(STREAM s, uint16 num_orders)
Definition: orders.c:1311
#define s_check(s)
Definition: parse.h:42
#define in_uint16_le(s, v)
Definition: parse.h:55
#define in_uint8s(s, n)
Definition: parse.h:91
#define in_uint8(s, v)
Definition: parse.h:88
void process_bitmap_updates(STREAM s)
Definition: rdp.c:1224
void process_cached_pointer_pdu(STREAM s)
Definition: rdp.c:1156
void ui_set_null_cursor(void)
Definition: uimain.c:227
void process_palette(STREAM s)
Definition: rdp.c:1295
void unimpl(char *format,...)
Definition: uimain.c:801
void hexdump(unsigned char *p, unsigned int len)
Definition: shimdbg.c:234
void process_colour_pointer_pdu(STREAM s)
Definition: rdp.c:1139
void ui_begin_update(void)
Definition: uimain.c:657
void ui_move_pointer(int x, int y)
Definition: uimain.c:616
void ui_end_update(void)
Definition: uimain.c:664
void rdp5_process(STREAM s)
Definition: rdp5.c:28
unsigned short uint16
Definition: types.h:30
unsigned int uint32
Definition: types.h:32
#define False
Definition: types.h:25
#define True
Definition: types.h:24
unsigned char uint8
Definition: types.h:28
Definition: _ctype.h:58
#define realloc
Definition: debug_ros.c:6
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
#define printf
Definition: freeldr.h:97
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLfloat GLfloat p
Definition: glext.h:8902
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: mxnamespace.c:45
Definition: parse.h:23