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