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