1 |
/* |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
RDP order processing |
RDP order processing |
4 |
Copyright (C) Matthew Chapman 1999-2000 |
Copyright (C) Matthew Chapman 1999-2002 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
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 |
it under the terms of the GNU General Public License as published by |
33 |
RDP_ORDER_PATBLT = 1, |
RDP_ORDER_PATBLT = 1, |
34 |
RDP_ORDER_SCREENBLT = 2, |
RDP_ORDER_SCREENBLT = 2, |
35 |
RDP_ORDER_LINE = 9, |
RDP_ORDER_LINE = 9, |
36 |
RDP_ORDER_RECT = 10, |
RDP_ORDER_RECT = 10, |
37 |
RDP_ORDER_DESKSAVE = 11, |
RDP_ORDER_DESKSAVE = 11, |
38 |
RDP_ORDER_MEMBLT = 13, |
RDP_ORDER_MEMBLT = 13, |
39 |
RDP_ORDER_TRIBLT = 14, |
RDP_ORDER_TRIBLT = 14, |
40 |
|
RDP_ORDER_POLYLINE = 22, |
41 |
RDP_ORDER_TEXT2 = 27 |
RDP_ORDER_TEXT2 = 27 |
42 |
}; |
}; |
43 |
|
|
46 |
RDP_ORDER_RAW_BMPCACHE = 0, |
RDP_ORDER_RAW_BMPCACHE = 0, |
47 |
RDP_ORDER_COLCACHE = 1, |
RDP_ORDER_COLCACHE = 1, |
48 |
RDP_ORDER_BMPCACHE = 2, |
RDP_ORDER_BMPCACHE = 2, |
49 |
RDP_ORDER_FONTCACHE = 3 |
RDP_ORDER_FONTCACHE = 3, |
50 |
|
RDP_ORDER_RAW_BMPCACHE2 = 4, |
51 |
|
RDP_ORDER_BMPCACHE2 = 5 |
52 |
}; |
}; |
53 |
|
|
54 |
typedef struct _DESTBLT_ORDER |
typedef struct _DESTBLT_ORDER |
55 |
{ |
{ |
56 |
uint16 x; |
sint16 x; |
57 |
uint16 y; |
sint16 y; |
58 |
uint16 cx; |
sint16 cx; |
59 |
uint16 cy; |
sint16 cy; |
60 |
uint8 opcode; |
uint8 opcode; |
61 |
|
|
62 |
} DESTBLT_ORDER; |
} |
63 |
|
DESTBLT_ORDER; |
64 |
|
|
65 |
typedef struct _PATBLT_ORDER |
typedef struct _PATBLT_ORDER |
66 |
{ |
{ |
67 |
uint16 x; |
sint16 x; |
68 |
uint16 y; |
sint16 y; |
69 |
uint16 cx; |
sint16 cx; |
70 |
uint16 cy; |
sint16 cy; |
71 |
uint8 opcode; |
uint8 opcode; |
72 |
uint8 bgcolour; |
uint32 bgcolour; |
73 |
uint8 fgcolour; |
uint32 fgcolour; |
74 |
BRUSH brush; |
BRUSH brush; |
75 |
|
|
76 |
} PATBLT_ORDER; |
} |
77 |
|
PATBLT_ORDER; |
78 |
|
|
79 |
typedef struct _SCREENBLT_ORDER |
typedef struct _SCREENBLT_ORDER |
80 |
{ |
{ |
81 |
uint16 x; |
sint16 x; |
82 |
uint16 y; |
sint16 y; |
83 |
uint16 cx; |
sint16 cx; |
84 |
uint16 cy; |
sint16 cy; |
85 |
uint8 opcode; |
uint8 opcode; |
86 |
uint16 srcx; |
sint16 srcx; |
87 |
uint16 srcy; |
sint16 srcy; |
88 |
|
|
89 |
} SCREENBLT_ORDER; |
} |
90 |
|
SCREENBLT_ORDER; |
91 |
|
|
92 |
typedef struct _LINE_ORDER |
typedef struct _LINE_ORDER |
93 |
{ |
{ |
94 |
uint16 mixmode; |
uint16 mixmode; |
95 |
uint16 startx; |
sint16 startx; |
96 |
uint16 starty; |
sint16 starty; |
97 |
uint16 endx; |
sint16 endx; |
98 |
uint16 endy; |
sint16 endy; |
99 |
uint8 bgcolour; |
uint32 bgcolour; |
100 |
uint8 opcode; |
uint8 opcode; |
101 |
PEN pen; |
PEN pen; |
102 |
|
|
103 |
} LINE_ORDER; |
} |
104 |
|
LINE_ORDER; |
105 |
|
|
106 |
typedef struct _RECT_ORDER |
typedef struct _RECT_ORDER |
107 |
{ |
{ |
108 |
uint16 x; |
sint16 x; |
109 |
uint16 y; |
sint16 y; |
110 |
uint16 cx; |
sint16 cx; |
111 |
uint16 cy; |
sint16 cy; |
112 |
uint8 colour; |
uint32 colour; |
113 |
|
|
114 |
} RECT_ORDER; |
} |
115 |
|
RECT_ORDER; |
116 |
|
|
117 |
typedef struct _DESKSAVE_ORDER |
typedef struct _DESKSAVE_ORDER |
118 |
{ |
{ |
119 |
uint32 offset; |
uint32 offset; |
120 |
uint16 left; |
sint16 left; |
121 |
uint16 top; |
sint16 top; |
122 |
uint16 right; |
sint16 right; |
123 |
uint16 bottom; |
sint16 bottom; |
124 |
uint8 action; |
uint8 action; |
125 |
|
|
126 |
} DESKSAVE_ORDER; |
} |
127 |
|
DESKSAVE_ORDER; |
128 |
|
|
129 |
typedef struct _TRIBLT_ORDER |
typedef struct _TRIBLT_ORDER |
130 |
{ |
{ |
131 |
uint8 colour_table; |
uint8 colour_table; |
132 |
uint8 cache_id; |
uint8 cache_id; |
133 |
uint16 x; |
sint16 x; |
134 |
uint16 y; |
sint16 y; |
135 |
uint16 cx; |
sint16 cx; |
136 |
uint16 cy; |
sint16 cy; |
137 |
uint8 opcode; |
uint8 opcode; |
138 |
uint16 srcx; |
sint16 srcx; |
139 |
uint16 srcy; |
sint16 srcy; |
140 |
uint8 bgcolour; |
uint32 bgcolour; |
141 |
uint8 fgcolour; |
uint32 fgcolour; |
142 |
BRUSH brush; |
BRUSH brush; |
143 |
uint16 cache_idx; |
uint16 cache_idx; |
144 |
uint16 unknown; |
uint16 unknown; |
145 |
|
|
146 |
} TRIBLT_ORDER; |
} |
147 |
|
TRIBLT_ORDER; |
148 |
|
|
149 |
typedef struct _MEMBLT_ORDER |
typedef struct _MEMBLT_ORDER |
150 |
{ |
{ |
151 |
uint8 colour_table; |
uint8 colour_table; |
152 |
uint8 cache_id; |
uint8 cache_id; |
153 |
uint16 x; |
sint16 x; |
154 |
uint16 y; |
sint16 y; |
155 |
uint16 cx; |
sint16 cx; |
156 |
uint16 cy; |
sint16 cy; |
157 |
uint8 opcode; |
uint8 opcode; |
158 |
uint16 srcx; |
sint16 srcx; |
159 |
uint16 srcy; |
sint16 srcy; |
160 |
uint16 cache_idx; |
uint16 cache_idx; |
161 |
|
|
162 |
} MEMBLT_ORDER; |
} |
163 |
|
MEMBLT_ORDER; |
164 |
|
|
165 |
|
#define MAX_DATA 256 |
166 |
|
|
167 |
|
typedef struct _POLYLINE_ORDER |
168 |
|
{ |
169 |
|
sint16 x; |
170 |
|
sint16 y; |
171 |
|
uint8 opcode; |
172 |
|
uint32 fgcolour; |
173 |
|
uint8 lines; |
174 |
|
uint8 datasize; |
175 |
|
uint8 data[MAX_DATA]; |
176 |
|
|
177 |
|
} |
178 |
|
POLYLINE_ORDER; |
179 |
|
|
180 |
#define MAX_TEXT 256 |
#define MAX_TEXT 256 |
181 |
|
|
185 |
uint8 flags; |
uint8 flags; |
186 |
uint8 mixmode; |
uint8 mixmode; |
187 |
uint8 unknown; |
uint8 unknown; |
188 |
uint8 fgcolour; |
uint32 fgcolour; |
189 |
uint8 bgcolour; |
uint32 bgcolour; |
190 |
uint16 clipleft; |
sint16 clipleft; |
191 |
uint16 cliptop; |
sint16 cliptop; |
192 |
uint16 clipright; |
sint16 clipright; |
193 |
uint16 clipbottom; |
sint16 clipbottom; |
194 |
uint16 boxleft; |
sint16 boxleft; |
195 |
uint16 boxtop; |
sint16 boxtop; |
196 |
uint16 boxright; |
sint16 boxright; |
197 |
uint16 boxbottom; |
sint16 boxbottom; |
198 |
uint16 x; |
sint16 x; |
199 |
uint16 y; |
sint16 y; |
200 |
uint8 length; |
uint8 length; |
201 |
uint8 text[MAX_TEXT]; |
uint8 text[MAX_TEXT]; |
202 |
|
|
203 |
} TEXT2_ORDER; |
} |
204 |
|
TEXT2_ORDER; |
205 |
|
|
206 |
typedef struct _RDP_ORDER_STATE |
typedef struct _RDP_ORDER_STATE |
207 |
{ |
{ |
216 |
DESKSAVE_ORDER desksave; |
DESKSAVE_ORDER desksave; |
217 |
MEMBLT_ORDER memblt; |
MEMBLT_ORDER memblt; |
218 |
TRIBLT_ORDER triblt; |
TRIBLT_ORDER triblt; |
219 |
|
POLYLINE_ORDER polyline; |
220 |
TEXT2_ORDER text2; |
TEXT2_ORDER text2; |
221 |
|
|
222 |
} RDP_ORDER_STATE; |
} |
223 |
|
RDP_ORDER_STATE; |
224 |
|
|
225 |
typedef struct _RDP_RAW_BMPCACHE_ORDER |
typedef struct _RDP_RAW_BMPCACHE_ORDER |
226 |
{ |
{ |
233 |
uint16 cache_idx; |
uint16 cache_idx; |
234 |
uint8 *data; |
uint8 *data; |
235 |
|
|
236 |
} RDP_RAW_BMPCACHE_ORDER; |
} |
237 |
|
RDP_RAW_BMPCACHE_ORDER; |
238 |
|
|
239 |
typedef struct _RDP_BMPCACHE_ORDER |
typedef struct _RDP_BMPCACHE_ORDER |
240 |
{ |
{ |
251 |
uint16 final_size; |
uint16 final_size; |
252 |
uint8 *data; |
uint8 *data; |
253 |
|
|
254 |
} RDP_BMPCACHE_ORDER; |
} |
255 |
|
RDP_BMPCACHE_ORDER; |
256 |
|
|
257 |
|
/* 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 |
|
#define BUFSIZE_MASK 0x3FFF /* or 0x1FFF? */ |
268 |
|
|
269 |
#define MAX_GLYPH 32 |
#define MAX_GLYPH 32 |
270 |
|
|
277 |
uint16 height; |
uint16 height; |
278 |
uint8 data[MAX_GLYPH]; |
uint8 data[MAX_GLYPH]; |
279 |
|
|
280 |
} RDP_FONT_GLYPH; |
} |
281 |
|
RDP_FONT_GLYPH; |
282 |
|
|
283 |
#define MAX_GLYPHS 256 |
#define MAX_GLYPHS 256 |
284 |
|
|
288 |
uint8 nglyphs; |
uint8 nglyphs; |
289 |
RDP_FONT_GLYPH glyphs[MAX_GLYPHS]; |
RDP_FONT_GLYPH glyphs[MAX_GLYPHS]; |
290 |
|
|
291 |
} RDP_FONTCACHE_ORDER; |
} |
292 |
|
RDP_FONTCACHE_ORDER; |
293 |
|
|
294 |
typedef struct _RDP_COLCACHE_ORDER |
typedef struct _RDP_COLCACHE_ORDER |
295 |
{ |
{ |
296 |
uint8 cache_id; |
uint8 cache_id; |
297 |
COLOURMAP map; |
COLOURMAP map; |
298 |
|
|
299 |
} RDP_COLCACHE_ORDER; |
} |
300 |
|
RDP_COLCACHE_ORDER; |