1 |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
3 |
RDP order processing |
4 |
Copyright (C) Matthew Chapman 1999-2005 |
5 |
|
6 |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2 of the License, or |
9 |
(at your option) any later version. |
10 |
|
11 |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
15 |
|
16 |
You should have received a copy of the GNU General Public License |
17 |
along with this program; if not, write to the Free Software |
18 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
#define RDP_ORDER_STANDARD 0x01 |
22 |
#define RDP_ORDER_SECONDARY 0x02 |
23 |
#define RDP_ORDER_BOUNDS 0x04 |
24 |
#define RDP_ORDER_CHANGE 0x08 |
25 |
#define RDP_ORDER_DELTA 0x10 |
26 |
#define RDP_ORDER_LASTBOUNDS 0x20 |
27 |
#define RDP_ORDER_SMALL 0x40 |
28 |
#define RDP_ORDER_TINY 0x80 |
29 |
|
30 |
enum RDP_ORDER_TYPE |
31 |
{ |
32 |
RDP_ORDER_DESTBLT = 0, |
33 |
RDP_ORDER_PATBLT = 1, |
34 |
RDP_ORDER_SCREENBLT = 2, |
35 |
RDP_ORDER_LINE = 9, |
36 |
RDP_ORDER_RECT = 10, |
37 |
RDP_ORDER_DESKSAVE = 11, |
38 |
RDP_ORDER_MEMBLT = 13, |
39 |
RDP_ORDER_TRIBLT = 14, |
40 |
RDP_ORDER_POLYGON = 20, |
41 |
RDP_ORDER_POLYGON2 = 21, |
42 |
RDP_ORDER_POLYLINE = 22, |
43 |
RDP_ORDER_ELLIPSE = 25, |
44 |
RDP_ORDER_ELLIPSE2 = 26, |
45 |
RDP_ORDER_TEXT2 = 27 |
46 |
}; |
47 |
|
48 |
enum RDP_SECONDARY_ORDER_TYPE |
49 |
{ |
50 |
RDP_ORDER_RAW_BMPCACHE = 0, |
51 |
RDP_ORDER_COLCACHE = 1, |
52 |
RDP_ORDER_BMPCACHE = 2, |
53 |
RDP_ORDER_FONTCACHE = 3, |
54 |
RDP_ORDER_RAW_BMPCACHE2 = 4, |
55 |
RDP_ORDER_BMPCACHE2 = 5, |
56 |
RDP_ORDER_BRUSHCACHE = 7 |
57 |
}; |
58 |
|
59 |
typedef struct _DESTBLT_ORDER |
60 |
{ |
61 |
sint16 x; |
62 |
sint16 y; |
63 |
sint16 cx; |
64 |
sint16 cy; |
65 |
uint8 opcode; |
66 |
|
67 |
} |
68 |
DESTBLT_ORDER; |
69 |
|
70 |
typedef struct _PATBLT_ORDER |
71 |
{ |
72 |
sint16 x; |
73 |
sint16 y; |
74 |
sint16 cx; |
75 |
sint16 cy; |
76 |
uint8 opcode; |
77 |
uint32 bgcolour; |
78 |
uint32 fgcolour; |
79 |
BRUSH brush; |
80 |
|
81 |
} |
82 |
PATBLT_ORDER; |
83 |
|
84 |
typedef struct _SCREENBLT_ORDER |
85 |
{ |
86 |
sint16 x; |
87 |
sint16 y; |
88 |
sint16 cx; |
89 |
sint16 cy; |
90 |
uint8 opcode; |
91 |
sint16 srcx; |
92 |
sint16 srcy; |
93 |
|
94 |
} |
95 |
SCREENBLT_ORDER; |
96 |
|
97 |
typedef struct _LINE_ORDER |
98 |
{ |
99 |
uint16 mixmode; |
100 |
sint16 startx; |
101 |
sint16 starty; |
102 |
sint16 endx; |
103 |
sint16 endy; |
104 |
uint32 bgcolour; |
105 |
uint8 opcode; |
106 |
PEN pen; |
107 |
|
108 |
} |
109 |
LINE_ORDER; |
110 |
|
111 |
typedef struct _RECT_ORDER |
112 |
{ |
113 |
sint16 x; |
114 |
sint16 y; |
115 |
sint16 cx; |
116 |
sint16 cy; |
117 |
uint32 colour; |
118 |
|
119 |
} |
120 |
RECT_ORDER; |
121 |
|
122 |
typedef struct _DESKSAVE_ORDER |
123 |
{ |
124 |
uint32 offset; |
125 |
sint16 left; |
126 |
sint16 top; |
127 |
sint16 right; |
128 |
sint16 bottom; |
129 |
uint8 action; |
130 |
|
131 |
} |
132 |
DESKSAVE_ORDER; |
133 |
|
134 |
typedef struct _TRIBLT_ORDER |
135 |
{ |
136 |
uint8 colour_table; |
137 |
uint8 cache_id; |
138 |
sint16 x; |
139 |
sint16 y; |
140 |
sint16 cx; |
141 |
sint16 cy; |
142 |
uint8 opcode; |
143 |
sint16 srcx; |
144 |
sint16 srcy; |
145 |
uint32 bgcolour; |
146 |
uint32 fgcolour; |
147 |
BRUSH brush; |
148 |
uint16 cache_idx; |
149 |
uint16 unknown; |
150 |
|
151 |
} |
152 |
TRIBLT_ORDER; |
153 |
|
154 |
typedef struct _MEMBLT_ORDER |
155 |
{ |
156 |
uint8 colour_table; |
157 |
uint8 cache_id; |
158 |
sint16 x; |
159 |
sint16 y; |
160 |
sint16 cx; |
161 |
sint16 cy; |
162 |
uint8 opcode; |
163 |
sint16 srcx; |
164 |
sint16 srcy; |
165 |
uint16 cache_idx; |
166 |
|
167 |
} |
168 |
MEMBLT_ORDER; |
169 |
|
170 |
#define MAX_DATA 256 |
171 |
|
172 |
typedef struct _POLYGON_ORDER |
173 |
{ |
174 |
sint16 x; |
175 |
sint16 y; |
176 |
uint8 opcode; |
177 |
uint8 fillmode; |
178 |
uint32 fgcolour; |
179 |
uint8 npoints; |
180 |
uint8 datasize; |
181 |
uint8 data[MAX_DATA]; |
182 |
|
183 |
} |
184 |
POLYGON_ORDER; |
185 |
|
186 |
typedef struct _POLYGON2_ORDER |
187 |
{ |
188 |
sint16 x; |
189 |
sint16 y; |
190 |
uint8 opcode; |
191 |
uint8 fillmode; |
192 |
uint32 bgcolour; |
193 |
uint32 fgcolour; |
194 |
BRUSH brush; |
195 |
uint8 npoints; |
196 |
uint8 datasize; |
197 |
uint8 data[MAX_DATA]; |
198 |
|
199 |
} |
200 |
POLYGON2_ORDER; |
201 |
|
202 |
typedef struct _POLYLINE_ORDER |
203 |
{ |
204 |
sint16 x; |
205 |
sint16 y; |
206 |
uint8 opcode; |
207 |
uint32 fgcolour; |
208 |
uint8 lines; |
209 |
uint8 datasize; |
210 |
uint8 data[MAX_DATA]; |
211 |
|
212 |
} |
213 |
POLYLINE_ORDER; |
214 |
|
215 |
typedef struct _ELLIPSE_ORDER |
216 |
{ |
217 |
sint16 left; |
218 |
sint16 top; |
219 |
sint16 right; |
220 |
sint16 bottom; |
221 |
uint8 opcode; |
222 |
uint8 fillmode; |
223 |
uint32 fgcolour; |
224 |
|
225 |
} |
226 |
ELLIPSE_ORDER; |
227 |
|
228 |
typedef struct _ELLIPSE2_ORDER |
229 |
{ |
230 |
sint16 left; |
231 |
sint16 top; |
232 |
sint16 right; |
233 |
sint16 bottom; |
234 |
uint8 opcode; |
235 |
uint8 fillmode; |
236 |
BRUSH brush; |
237 |
uint32 bgcolour; |
238 |
uint32 fgcolour; |
239 |
|
240 |
} |
241 |
ELLIPSE2_ORDER; |
242 |
|
243 |
#define MAX_TEXT 256 |
244 |
|
245 |
typedef struct _TEXT2_ORDER |
246 |
{ |
247 |
uint8 font; |
248 |
uint8 flags; |
249 |
uint8 opcode; |
250 |
uint8 mixmode; |
251 |
uint32 bgcolour; |
252 |
uint32 fgcolour; |
253 |
sint16 clipleft; |
254 |
sint16 cliptop; |
255 |
sint16 clipright; |
256 |
sint16 clipbottom; |
257 |
sint16 boxleft; |
258 |
sint16 boxtop; |
259 |
sint16 boxright; |
260 |
sint16 boxbottom; |
261 |
BRUSH brush; |
262 |
sint16 x; |
263 |
sint16 y; |
264 |
uint8 length; |
265 |
uint8 text[MAX_TEXT]; |
266 |
|
267 |
} |
268 |
TEXT2_ORDER; |
269 |
|
270 |
typedef struct _RDP_ORDER_STATE |
271 |
{ |
272 |
uint8 order_type; |
273 |
BOUNDS bounds; |
274 |
|
275 |
DESTBLT_ORDER destblt; |
276 |
PATBLT_ORDER patblt; |
277 |
SCREENBLT_ORDER screenblt; |
278 |
LINE_ORDER line; |
279 |
RECT_ORDER rect; |
280 |
DESKSAVE_ORDER desksave; |
281 |
MEMBLT_ORDER memblt; |
282 |
TRIBLT_ORDER triblt; |
283 |
POLYGON_ORDER polygon; |
284 |
POLYGON2_ORDER polygon2; |
285 |
POLYLINE_ORDER polyline; |
286 |
ELLIPSE_ORDER ellipse; |
287 |
ELLIPSE2_ORDER ellipse2; |
288 |
TEXT2_ORDER text2; |
289 |
|
290 |
} |
291 |
RDP_ORDER_STATE; |
292 |
|
293 |
typedef struct _RDP_RAW_BMPCACHE_ORDER |
294 |
{ |
295 |
uint8 cache_id; |
296 |
uint8 pad1; |
297 |
uint8 width; |
298 |
uint8 height; |
299 |
uint8 bpp; |
300 |
uint16 bufsize; |
301 |
uint16 cache_idx; |
302 |
uint8 *data; |
303 |
|
304 |
} |
305 |
RDP_RAW_BMPCACHE_ORDER; |
306 |
|
307 |
typedef struct _RDP_BMPCACHE_ORDER |
308 |
{ |
309 |
uint8 cache_id; |
310 |
uint8 pad1; |
311 |
uint8 width; |
312 |
uint8 height; |
313 |
uint8 bpp; |
314 |
uint16 bufsize; |
315 |
uint16 cache_idx; |
316 |
uint16 pad2; |
317 |
uint16 size; |
318 |
uint16 row_size; |
319 |
uint16 final_size; |
320 |
uint8 *data; |
321 |
|
322 |
} |
323 |
RDP_BMPCACHE_ORDER; |
324 |
|
325 |
/* RDP_BMPCACHE2_ORDER */ |
326 |
#define ID_MASK 0x0007 |
327 |
#define MODE_MASK 0x0038 |
328 |
#define SQUARE 0x0080 |
329 |
#define PERSIST 0x0100 |
330 |
#define FLAG_51_UNKNOWN 0x0800 |
331 |
|
332 |
#define MODE_SHIFT 3 |
333 |
|
334 |
#define LONG_FORMAT 0x80 |
335 |
#define BUFSIZE_MASK 0x3FFF /* or 0x1FFF? */ |
336 |
|
337 |
#define MAX_GLYPH 32 |
338 |
|
339 |
typedef struct _RDP_FONT_GLYPH |
340 |
{ |
341 |
uint16 character; |
342 |
uint16 unknown; |
343 |
uint16 baseline; |
344 |
uint16 width; |
345 |
uint16 height; |
346 |
uint8 data[MAX_GLYPH]; |
347 |
|
348 |
} |
349 |
RDP_FONT_GLYPH; |
350 |
|
351 |
#define MAX_GLYPHS 256 |
352 |
|
353 |
typedef struct _RDP_FONTCACHE_ORDER |
354 |
{ |
355 |
uint8 font; |
356 |
uint8 nglyphs; |
357 |
RDP_FONT_GLYPH glyphs[MAX_GLYPHS]; |
358 |
|
359 |
} |
360 |
RDP_FONTCACHE_ORDER; |
361 |
|
362 |
typedef struct _RDP_COLCACHE_ORDER |
363 |
{ |
364 |
uint8 cache_id; |
365 |
COLOURMAP map; |
366 |
|
367 |
} |
368 |
RDP_COLCACHE_ORDER; |