1 |
matty |
10 |
/* |
2 |
|
|
rdesktop: A Remote Desktop Protocol client. |
3 |
|
|
RDP order processing |
4 |
|
|
Copyright (C) Matthew Chapman 1999-2000 |
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 |
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 |
|
|
RDP_ORDER_FONTCACHE = 3 |
50 |
|
|
}; |
51 |
|
|
|
52 |
|
|
typedef struct _DESTBLT_ORDER |
53 |
|
|
{ |
54 |
|
|
uint16 x; |
55 |
|
|
uint16 y; |
56 |
|
|
uint16 cx; |
57 |
|
|
uint16 cy; |
58 |
|
|
uint8 opcode; |
59 |
|
|
|
60 |
|
|
} DESTBLT_ORDER; |
61 |
|
|
|
62 |
|
|
typedef struct _PATBLT_ORDER |
63 |
|
|
{ |
64 |
|
|
uint16 x; |
65 |
|
|
uint16 y; |
66 |
|
|
uint16 cx; |
67 |
|
|
uint16 cy; |
68 |
|
|
uint8 opcode; |
69 |
|
|
uint8 bgcolour; |
70 |
|
|
uint8 fgcolour; |
71 |
|
|
BRUSH brush; |
72 |
|
|
|
73 |
|
|
} PATBLT_ORDER; |
74 |
|
|
|
75 |
|
|
typedef struct _SCREENBLT_ORDER |
76 |
|
|
{ |
77 |
|
|
uint16 x; |
78 |
|
|
uint16 y; |
79 |
|
|
uint16 cx; |
80 |
|
|
uint16 cy; |
81 |
|
|
uint8 opcode; |
82 |
|
|
uint16 srcx; |
83 |
|
|
uint16 srcy; |
84 |
|
|
|
85 |
|
|
} SCREENBLT_ORDER; |
86 |
|
|
|
87 |
|
|
typedef struct _LINE_ORDER |
88 |
|
|
{ |
89 |
|
|
uint16 mixmode; |
90 |
|
|
uint16 startx; |
91 |
|
|
uint16 starty; |
92 |
|
|
uint16 endx; |
93 |
|
|
uint16 endy; |
94 |
|
|
uint8 bgcolour; |
95 |
|
|
uint8 opcode; |
96 |
|
|
PEN pen; |
97 |
|
|
|
98 |
|
|
} LINE_ORDER; |
99 |
|
|
|
100 |
|
|
typedef struct _RECT_ORDER |
101 |
|
|
{ |
102 |
|
|
uint16 x; |
103 |
|
|
uint16 y; |
104 |
|
|
uint16 cx; |
105 |
|
|
uint16 cy; |
106 |
|
|
uint8 colour; |
107 |
|
|
|
108 |
|
|
} RECT_ORDER; |
109 |
|
|
|
110 |
|
|
typedef struct _DESKSAVE_ORDER |
111 |
|
|
{ |
112 |
|
|
uint32 offset; |
113 |
|
|
uint16 left; |
114 |
|
|
uint16 top; |
115 |
|
|
uint16 right; |
116 |
|
|
uint16 bottom; |
117 |
|
|
uint8 action; |
118 |
|
|
|
119 |
|
|
} DESKSAVE_ORDER; |
120 |
|
|
|
121 |
|
|
typedef struct _TRIBLT_ORDER |
122 |
|
|
{ |
123 |
|
|
uint8 colour_table; |
124 |
|
|
uint8 cache_id; |
125 |
|
|
uint16 x; |
126 |
|
|
uint16 y; |
127 |
|
|
uint16 cx; |
128 |
|
|
uint16 cy; |
129 |
|
|
uint8 opcode; |
130 |
|
|
uint16 srcx; |
131 |
|
|
uint16 srcy; |
132 |
|
|
uint8 bgcolour; |
133 |
|
|
uint8 fgcolour; |
134 |
|
|
BRUSH brush; |
135 |
|
|
uint16 cache_idx; |
136 |
|
|
uint16 unknown; |
137 |
|
|
|
138 |
|
|
} TRIBLT_ORDER; |
139 |
|
|
|
140 |
|
|
typedef struct _MEMBLT_ORDER |
141 |
|
|
{ |
142 |
|
|
uint8 colour_table; |
143 |
|
|
uint8 cache_id; |
144 |
|
|
uint16 x; |
145 |
|
|
uint16 y; |
146 |
|
|
uint16 cx; |
147 |
|
|
uint16 cy; |
148 |
|
|
uint8 opcode; |
149 |
|
|
uint16 srcx; |
150 |
|
|
uint16 srcy; |
151 |
|
|
uint16 cache_idx; |
152 |
|
|
|
153 |
|
|
} MEMBLT_ORDER; |
154 |
|
|
|
155 |
matty |
15 |
#define MAX_DATA 256 |
156 |
|
|
|
157 |
|
|
typedef struct _POLYLINE_ORDER |
158 |
|
|
{ |
159 |
|
|
uint16 x; |
160 |
|
|
uint16 y; |
161 |
|
|
uint8 flags; |
162 |
|
|
uint8 fgcolour; |
163 |
|
|
uint8 lines; |
164 |
|
|
uint8 datasize; |
165 |
|
|
uint8 data[MAX_DATA]; |
166 |
|
|
|
167 |
|
|
} POLYLINE_ORDER; |
168 |
|
|
|
169 |
matty |
10 |
#define MAX_TEXT 256 |
170 |
|
|
|
171 |
|
|
typedef struct _TEXT2_ORDER |
172 |
|
|
{ |
173 |
|
|
uint8 font; |
174 |
|
|
uint8 flags; |
175 |
|
|
uint8 mixmode; |
176 |
|
|
uint8 unknown; |
177 |
|
|
uint8 fgcolour; |
178 |
|
|
uint8 bgcolour; |
179 |
|
|
uint16 clipleft; |
180 |
|
|
uint16 cliptop; |
181 |
|
|
uint16 clipright; |
182 |
|
|
uint16 clipbottom; |
183 |
|
|
uint16 boxleft; |
184 |
|
|
uint16 boxtop; |
185 |
|
|
uint16 boxright; |
186 |
|
|
uint16 boxbottom; |
187 |
|
|
uint16 x; |
188 |
|
|
uint16 y; |
189 |
|
|
uint8 length; |
190 |
|
|
uint8 text[MAX_TEXT]; |
191 |
|
|
|
192 |
|
|
} TEXT2_ORDER; |
193 |
|
|
|
194 |
|
|
typedef struct _RDP_ORDER_STATE |
195 |
|
|
{ |
196 |
|
|
uint8 order_type; |
197 |
|
|
BOUNDS bounds; |
198 |
|
|
|
199 |
|
|
DESTBLT_ORDER destblt; |
200 |
|
|
PATBLT_ORDER patblt; |
201 |
|
|
SCREENBLT_ORDER screenblt; |
202 |
|
|
LINE_ORDER line; |
203 |
|
|
RECT_ORDER rect; |
204 |
|
|
DESKSAVE_ORDER desksave; |
205 |
|
|
MEMBLT_ORDER memblt; |
206 |
|
|
TRIBLT_ORDER triblt; |
207 |
matty |
15 |
POLYLINE_ORDER polyline; |
208 |
matty |
10 |
TEXT2_ORDER text2; |
209 |
|
|
|
210 |
|
|
} RDP_ORDER_STATE; |
211 |
|
|
|
212 |
|
|
typedef struct _RDP_RAW_BMPCACHE_ORDER |
213 |
|
|
{ |
214 |
|
|
uint8 cache_id; |
215 |
|
|
uint8 pad1; |
216 |
|
|
uint8 width; |
217 |
|
|
uint8 height; |
218 |
|
|
uint8 bpp; |
219 |
|
|
uint16 bufsize; |
220 |
|
|
uint16 cache_idx; |
221 |
|
|
uint8 *data; |
222 |
|
|
|
223 |
|
|
} RDP_RAW_BMPCACHE_ORDER; |
224 |
|
|
|
225 |
|
|
typedef struct _RDP_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 |
|
|
uint16 pad2; |
235 |
|
|
uint16 size; |
236 |
|
|
uint16 row_size; |
237 |
|
|
uint16 final_size; |
238 |
|
|
uint8 *data; |
239 |
|
|
|
240 |
|
|
} RDP_BMPCACHE_ORDER; |
241 |
|
|
|
242 |
|
|
#define MAX_GLYPH 32 |
243 |
|
|
|
244 |
|
|
typedef struct _RDP_FONT_GLYPH |
245 |
|
|
{ |
246 |
|
|
uint16 character; |
247 |
|
|
uint16 unknown; |
248 |
|
|
uint16 baseline; |
249 |
|
|
uint16 width; |
250 |
|
|
uint16 height; |
251 |
|
|
uint8 data[MAX_GLYPH]; |
252 |
|
|
|
253 |
|
|
} RDP_FONT_GLYPH; |
254 |
|
|
|
255 |
|
|
#define MAX_GLYPHS 256 |
256 |
|
|
|
257 |
|
|
typedef struct _RDP_FONTCACHE_ORDER |
258 |
|
|
{ |
259 |
|
|
uint8 font; |
260 |
|
|
uint8 nglyphs; |
261 |
|
|
RDP_FONT_GLYPH glyphs[MAX_GLYPHS]; |
262 |
|
|
|
263 |
|
|
} RDP_FONTCACHE_ORDER; |
264 |
|
|
|
265 |
|
|
typedef struct _RDP_COLCACHE_ORDER |
266 |
|
|
{ |
267 |
|
|
uint8 cache_id; |
268 |
|
|
COLOURMAP map; |
269 |
|
|
|
270 |
|
|
} RDP_COLCACHE_ORDER; |