1 |
matty |
10 |
/* |
2 |
|
|
rdesktop: A Remote Desktop Protocol client. |
3 |
|
|
RDP order processing |
4 |
stargo |
828 |
Copyright (C) Matthew Chapman 1999-2005 |
5 |
matty |
10 |
|
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 |
matty |
28 |
RDP_ORDER_RECT = 10, |
37 |
matty |
10 |
RDP_ORDER_DESKSAVE = 11, |
38 |
|
|
RDP_ORDER_MEMBLT = 13, |
39 |
|
|
RDP_ORDER_TRIBLT = 14, |
40 |
matty |
15 |
RDP_ORDER_POLYLINE = 22, |
41 |
matty |
10 |
RDP_ORDER_TEXT2 = 27 |
42 |
|
|
}; |
43 |
|
|
|
44 |
|
|
enum RDP_SECONDARY_ORDER_TYPE |
45 |
|
|
{ |
46 |
|
|
RDP_ORDER_RAW_BMPCACHE = 0, |
47 |
|
|
RDP_ORDER_COLCACHE = 1, |
48 |
|
|
RDP_ORDER_BMPCACHE = 2, |
49 |
jsorg71 |
725 |
RDP_ORDER_FONTCACHE = 3, |
50 |
|
|
RDP_ORDER_RAW_BMPCACHE2 = 4, |
51 |
|
|
RDP_ORDER_BMPCACHE2 = 5 |
52 |
matty |
10 |
}; |
53 |
|
|
|
54 |
|
|
typedef struct _DESTBLT_ORDER |
55 |
|
|
{ |
56 |
jsorg71 |
375 |
sint16 x; |
57 |
|
|
sint16 y; |
58 |
|
|
sint16 cx; |
59 |
|
|
sint16 cy; |
60 |
matty |
10 |
uint8 opcode; |
61 |
|
|
|
62 |
astrand |
64 |
} |
63 |
|
|
DESTBLT_ORDER; |
64 |
matty |
10 |
|
65 |
|
|
typedef struct _PATBLT_ORDER |
66 |
|
|
{ |
67 |
jsorg71 |
375 |
sint16 x; |
68 |
|
|
sint16 y; |
69 |
|
|
sint16 cx; |
70 |
|
|
sint16 cy; |
71 |
matty |
10 |
uint8 opcode; |
72 |
jsorg71 |
309 |
uint32 bgcolour; |
73 |
|
|
uint32 fgcolour; |
74 |
matty |
10 |
BRUSH brush; |
75 |
|
|
|
76 |
astrand |
64 |
} |
77 |
|
|
PATBLT_ORDER; |
78 |
matty |
10 |
|
79 |
|
|
typedef struct _SCREENBLT_ORDER |
80 |
|
|
{ |
81 |
jsorg71 |
375 |
sint16 x; |
82 |
|
|
sint16 y; |
83 |
|
|
sint16 cx; |
84 |
|
|
sint16 cy; |
85 |
matty |
10 |
uint8 opcode; |
86 |
jsorg71 |
375 |
sint16 srcx; |
87 |
|
|
sint16 srcy; |
88 |
matty |
10 |
|
89 |
astrand |
64 |
} |
90 |
|
|
SCREENBLT_ORDER; |
91 |
matty |
10 |
|
92 |
|
|
typedef struct _LINE_ORDER |
93 |
|
|
{ |
94 |
|
|
uint16 mixmode; |
95 |
jsorg71 |
375 |
sint16 startx; |
96 |
|
|
sint16 starty; |
97 |
|
|
sint16 endx; |
98 |
|
|
sint16 endy; |
99 |
jsorg71 |
309 |
uint32 bgcolour; |
100 |
matty |
10 |
uint8 opcode; |
101 |
|
|
PEN pen; |
102 |
|
|
|
103 |
astrand |
64 |
} |
104 |
|
|
LINE_ORDER; |
105 |
matty |
10 |
|
106 |
|
|
typedef struct _RECT_ORDER |
107 |
|
|
{ |
108 |
jsorg71 |
375 |
sint16 x; |
109 |
|
|
sint16 y; |
110 |
|
|
sint16 cx; |
111 |
|
|
sint16 cy; |
112 |
jsorg71 |
309 |
uint32 colour; |
113 |
matty |
10 |
|
114 |
astrand |
64 |
} |
115 |
|
|
RECT_ORDER; |
116 |
matty |
10 |
|
117 |
|
|
typedef struct _DESKSAVE_ORDER |
118 |
|
|
{ |
119 |
|
|
uint32 offset; |
120 |
jsorg71 |
375 |
sint16 left; |
121 |
|
|
sint16 top; |
122 |
|
|
sint16 right; |
123 |
|
|
sint16 bottom; |
124 |
matty |
10 |
uint8 action; |
125 |
|
|
|
126 |
astrand |
64 |
} |
127 |
|
|
DESKSAVE_ORDER; |
128 |
matty |
10 |
|
129 |
|
|
typedef struct _TRIBLT_ORDER |
130 |
|
|
{ |
131 |
|
|
uint8 colour_table; |
132 |
|
|
uint8 cache_id; |
133 |
jsorg71 |
375 |
sint16 x; |
134 |
|
|
sint16 y; |
135 |
|
|
sint16 cx; |
136 |
|
|
sint16 cy; |
137 |
matty |
10 |
uint8 opcode; |
138 |
jsorg71 |
375 |
sint16 srcx; |
139 |
|
|
sint16 srcy; |
140 |
jsorg71 |
309 |
uint32 bgcolour; |
141 |
|
|
uint32 fgcolour; |
142 |
matty |
10 |
BRUSH brush; |
143 |
|
|
uint16 cache_idx; |
144 |
|
|
uint16 unknown; |
145 |
|
|
|
146 |
astrand |
64 |
} |
147 |
|
|
TRIBLT_ORDER; |
148 |
matty |
10 |
|
149 |
|
|
typedef struct _MEMBLT_ORDER |
150 |
|
|
{ |
151 |
|
|
uint8 colour_table; |
152 |
|
|
uint8 cache_id; |
153 |
jsorg71 |
375 |
sint16 x; |
154 |
|
|
sint16 y; |
155 |
|
|
sint16 cx; |
156 |
|
|
sint16 cy; |
157 |
matty |
10 |
uint8 opcode; |
158 |
jsorg71 |
375 |
sint16 srcx; |
159 |
|
|
sint16 srcy; |
160 |
matty |
10 |
uint16 cache_idx; |
161 |
|
|
|
162 |
astrand |
64 |
} |
163 |
|
|
MEMBLT_ORDER; |
164 |
matty |
10 |
|
165 |
matty |
15 |
#define MAX_DATA 256 |
166 |
|
|
|
167 |
|
|
typedef struct _POLYLINE_ORDER |
168 |
|
|
{ |
169 |
jsorg71 |
375 |
sint16 x; |
170 |
|
|
sint16 y; |
171 |
matthewc |
168 |
uint8 opcode; |
172 |
jsorg71 |
309 |
uint32 fgcolour; |
173 |
matty |
15 |
uint8 lines; |
174 |
|
|
uint8 datasize; |
175 |
|
|
uint8 data[MAX_DATA]; |
176 |
|
|
|
177 |
astrand |
64 |
} |
178 |
|
|
POLYLINE_ORDER; |
179 |
matty |
15 |
|
180 |
matty |
10 |
#define MAX_TEXT 256 |
181 |
|
|
|
182 |
|
|
typedef struct _TEXT2_ORDER |
183 |
|
|
{ |
184 |
|
|
uint8 font; |
185 |
|
|
uint8 flags; |
186 |
|
|
uint8 mixmode; |
187 |
|
|
uint8 unknown; |
188 |
jsorg71 |
309 |
uint32 fgcolour; |
189 |
|
|
uint32 bgcolour; |
190 |
jsorg71 |
375 |
sint16 clipleft; |
191 |
|
|
sint16 cliptop; |
192 |
|
|
sint16 clipright; |
193 |
|
|
sint16 clipbottom; |
194 |
|
|
sint16 boxleft; |
195 |
|
|
sint16 boxtop; |
196 |
|
|
sint16 boxright; |
197 |
|
|
sint16 boxbottom; |
198 |
|
|
sint16 x; |
199 |
|
|
sint16 y; |
200 |
matty |
10 |
uint8 length; |
201 |
|
|
uint8 text[MAX_TEXT]; |
202 |
|
|
|
203 |
astrand |
64 |
} |
204 |
|
|
TEXT2_ORDER; |
205 |
matty |
10 |
|
206 |
|
|
typedef struct _RDP_ORDER_STATE |
207 |
|
|
{ |
208 |
|
|
uint8 order_type; |
209 |
|
|
BOUNDS bounds; |
210 |
|
|
|
211 |
|
|
DESTBLT_ORDER destblt; |
212 |
|
|
PATBLT_ORDER patblt; |
213 |
|
|
SCREENBLT_ORDER screenblt; |
214 |
|
|
LINE_ORDER line; |
215 |
|
|
RECT_ORDER rect; |
216 |
|
|
DESKSAVE_ORDER desksave; |
217 |
|
|
MEMBLT_ORDER memblt; |
218 |
|
|
TRIBLT_ORDER triblt; |
219 |
matty |
15 |
POLYLINE_ORDER polyline; |
220 |
matty |
10 |
TEXT2_ORDER text2; |
221 |
|
|
|
222 |
astrand |
64 |
} |
223 |
|
|
RDP_ORDER_STATE; |
224 |
matty |
10 |
|
225 |
|
|
typedef struct _RDP_RAW_BMPCACHE_ORDER |
226 |
|
|
{ |
227 |
|
|
uint8 cache_id; |
228 |
|
|
uint8 pad1; |
229 |
|
|
uint8 width; |
230 |
|
|
uint8 height; |
231 |
|
|
uint8 bpp; |
232 |
|
|
uint16 bufsize; |
233 |
|
|
uint16 cache_idx; |
234 |
|
|
uint8 *data; |
235 |
|
|
|
236 |
astrand |
64 |
} |
237 |
|
|
RDP_RAW_BMPCACHE_ORDER; |
238 |
matty |
10 |
|
239 |
|
|
typedef struct _RDP_BMPCACHE_ORDER |
240 |
|
|
{ |
241 |
|
|
uint8 cache_id; |
242 |
|
|
uint8 pad1; |
243 |
|
|
uint8 width; |
244 |
|
|
uint8 height; |
245 |
|
|
uint8 bpp; |
246 |
|
|
uint16 bufsize; |
247 |
|
|
uint16 cache_idx; |
248 |
|
|
uint16 pad2; |
249 |
|
|
uint16 size; |
250 |
|
|
uint16 row_size; |
251 |
|
|
uint16 final_size; |
252 |
|
|
uint8 *data; |
253 |
|
|
|
254 |
astrand |
64 |
} |
255 |
|
|
RDP_BMPCACHE_ORDER; |
256 |
matty |
10 |
|
257 |
jsorg71 |
725 |
/* RDP_BMPCACHE2_ORDER */ |
258 |
|
|
#define ID_MASK 0x0007 |
259 |
|
|
#define MODE_MASK 0x0038 |
260 |
|
|
#define SQUARE 0x0080 |
261 |
|
|
#define PERSIST 0x0100 |
262 |
|
|
#define FLAG_51_UNKNOWN 0x0800 |
263 |
|
|
|
264 |
|
|
#define MODE_SHIFT 3 |
265 |
|
|
|
266 |
|
|
#define LONG_FORMAT 0x80 |
267 |
astrand |
738 |
#define BUFSIZE_MASK 0x3FFF /* or 0x1FFF? */ |
268 |
jsorg71 |
725 |
|
269 |
matty |
10 |
#define MAX_GLYPH 32 |
270 |
|
|
|
271 |
|
|
typedef struct _RDP_FONT_GLYPH |
272 |
|
|
{ |
273 |
|
|
uint16 character; |
274 |
|
|
uint16 unknown; |
275 |
|
|
uint16 baseline; |
276 |
|
|
uint16 width; |
277 |
|
|
uint16 height; |
278 |
|
|
uint8 data[MAX_GLYPH]; |
279 |
|
|
|
280 |
astrand |
64 |
} |
281 |
|
|
RDP_FONT_GLYPH; |
282 |
matty |
10 |
|
283 |
|
|
#define MAX_GLYPHS 256 |
284 |
|
|
|
285 |
|
|
typedef struct _RDP_FONTCACHE_ORDER |
286 |
|
|
{ |
287 |
|
|
uint8 font; |
288 |
|
|
uint8 nglyphs; |
289 |
|
|
RDP_FONT_GLYPH glyphs[MAX_GLYPHS]; |
290 |
|
|
|
291 |
astrand |
64 |
} |
292 |
|
|
RDP_FONTCACHE_ORDER; |
293 |
matty |
10 |
|
294 |
|
|
typedef struct _RDP_COLCACHE_ORDER |
295 |
|
|
{ |
296 |
|
|
uint8 cache_id; |
297 |
|
|
COLOURMAP map; |
298 |
|
|
|
299 |
astrand |
64 |
} |
300 |
|
|
RDP_COLCACHE_ORDER; |