/[rdesktop]/sourceforge.net/trunk/rdesktop/orders.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /sourceforge.net/trunk/rdesktop/orders.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations)
Tue Aug 15 10:23:24 2000 UTC (23 years, 8 months ago) by matty
File MIME type: text/plain
File size: 18282 byte(s)
Major commit of work from laptop - done in various free moments.
Implemented encryption layer and some basic licensing negotiation.
Reorganised code somewhat. While this is not quite as clean, it is
a lot faster - our parser speed was becoming a bottle-neck.

1 /*
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 #include "rdesktop.h"
22 #include "orders.h"
23
24 extern unsigned char *next_packet;
25 static RDP_ORDER_STATE order_state;
26
27 /* Read field indicating which parameters are present */
28 static void rdp_in_present(STREAM s, uint32 *present, uint8 flags, int size)
29 {
30 uint8 bits;
31 int i;
32
33 if (flags & RDP_ORDER_SMALL)
34 {
35 size--;
36 }
37
38 if (flags & RDP_ORDER_TINY)
39 {
40 if (size < 2)
41 size = 0;
42 else
43 size -= 2;
44 }
45
46 *present = 0;
47 for (i = 0; i < size; i++)
48 {
49 in_uint8(s, bits);
50 *present |= bits << (i * 8);
51 }
52 }
53
54 /* Read a co-ordinate (16-bit, or 8-bit delta) */
55 static void rdp_in_coord(STREAM s, uint16 *coord, BOOL delta)
56 {
57 uint8 change;
58
59 if (delta)
60 {
61 in_uint8(s, change);
62 *coord += (char)change;
63 }
64 else
65 {
66 in_uint16_le(s, *coord);
67 }
68 }
69
70 /* Read a colour entry */
71 static void rdp_in_colour(STREAM s, uint8 *colour)
72 {
73 in_uint8(s, *colour);
74 s->p += 2;
75 }
76
77 /* Parse bounds information */
78 static BOOL rdp_parse_bounds(STREAM s, BOUNDS *bounds)
79 {
80 uint8 present;
81
82 in_uint8(s, present);
83
84 if (present & 1)
85 rdp_in_coord(s, &bounds->left, False);
86 else if (present & 16)
87 rdp_in_coord(s, &bounds->left, True);
88
89 if (present & 2)
90 rdp_in_coord(s, &bounds->top, False);
91 else if (present & 32)
92 rdp_in_coord(s, &bounds->top, True);
93
94 if (present & 4)
95 rdp_in_coord(s, &bounds->right, False);
96 else if (present & 64)
97 rdp_in_coord(s, &bounds->right, True);
98
99 if (present & 8)
100 rdp_in_coord(s, &bounds->bottom, False);
101 else if (present & 128)
102 rdp_in_coord(s, &bounds->bottom, True);
103
104 return s_check(s);
105 }
106
107 /* Parse a pen */
108 static BOOL rdp_parse_pen(STREAM s, PEN *pen, uint32 present)
109 {
110 if (present & 1)
111 in_uint8(s, pen->style);
112
113 if (present & 2)
114 in_uint8(s, pen->width);
115
116 if (present & 4)
117 rdp_in_colour(s, &pen->colour);
118
119 return s_check(s);
120 }
121
122 /* Parse a brush */
123 static BOOL rdp_parse_brush(STREAM s, BRUSH *brush, uint32 present)
124 {
125 if (present & 1)
126 in_uint8(s, brush->xorigin);
127
128 if (present & 2)
129 in_uint8(s, brush->yorigin);
130
131 if (present & 4)
132 in_uint8(s, brush->style);
133
134 if (present & 8)
135 in_uint8(s, brush->pattern[0]);
136
137 if (present & 16)
138 in_uint8a(s, &brush->pattern[1], 7);
139
140 return s_check(s);
141 }
142
143 /* Process a destination blt order */
144 static void process_destblt(STREAM s, DESTBLT_ORDER *os,
145 uint32 present, BOOL delta)
146 {
147 if (present & 0x01)
148 rdp_in_coord(s, &os->x, delta);
149
150 if (present & 0x02)
151 rdp_in_coord(s, &os->y, delta);
152
153 if (present & 0x04)
154 rdp_in_coord(s, &os->cx, delta);
155
156 if (present & 0x08)
157 rdp_in_coord(s, &os->cy, delta);
158
159 if (present & 0x10)
160 in_uint8(s, os->opcode);
161
162 DEBUG("DESTBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d)\n",
163 os->opcode, os->x, os->y, os->cx, os->cy);
164
165 ui_destblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy);
166 }
167
168 /* Process a pattern blt order */
169 static void process_patblt(STREAM s, PATBLT_ORDER *os,
170 uint32 present, BOOL delta)
171 {
172 if (present & 0x0001)
173 rdp_in_coord(s, &os->x, delta);
174
175 if (present & 0x0002)
176 rdp_in_coord(s, &os->y, delta);
177
178 if (present & 0x0004)
179 rdp_in_coord(s, &os->cx, delta);
180
181 if (present & 0x0008)
182 rdp_in_coord(s, &os->cy, delta);
183
184 if (present & 0x0010)
185 in_uint8(s, os->opcode);
186
187 if (present & 0x0020)
188 rdp_in_colour(s, &os->bgcolour);
189
190 if (present & 0x0040)
191 rdp_in_colour(s, &os->fgcolour);
192
193 rdp_parse_brush(s, &os->brush, present >> 7);
194
195 DEBUG("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n",
196 os->opcode, os->x, os->y, os->cx, os->cy,
197 os->brush.style, os->bgcolour, os->fgcolour);
198
199 ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy,
200 &os->brush, os->bgcolour, os->fgcolour);
201 }
202
203 /* Process a screen blt order */
204 static void process_screenblt(STREAM s, SCREENBLT_ORDER *os,
205 uint32 present, BOOL delta)
206 {
207 if (present & 0x0001)
208 rdp_in_coord(s, &os->x, delta);
209
210 if (present & 0x0002)
211 rdp_in_coord(s, &os->y, delta);
212
213 if (present & 0x0004)
214 rdp_in_coord(s, &os->cx, delta);
215
216 if (present & 0x0008)
217 rdp_in_coord(s, &os->cy, delta);
218
219 if (present & 0x0010)
220 in_uint8(s, os->opcode);
221
222 if (present & 0x0020)
223 rdp_in_coord(s, &os->srcx, delta);
224
225 if (present & 0x0040)
226 rdp_in_coord(s, &os->srcy, delta);
227
228 DEBUG("SCREENBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,srcx=%d,srcy=%d)\n",
229 os->opcode, os->x, os->y, os->cx, os->cy, os->srcx, os->srcy);
230
231 ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy,
232 os->srcx, os->srcy);
233 }
234
235 /* Process a line order */
236 static void process_line(STREAM s, LINE_ORDER *os, uint32 present, BOOL delta)
237 {
238 if (present & 0x0001)
239 in_uint16_le(s, os->mixmode);
240
241 if (present & 0x0002)
242 rdp_in_coord(s, &os->startx, delta);
243
244 if (present & 0x0004)
245 rdp_in_coord(s, &os->starty, delta);
246
247 if (present & 0x0008)
248 rdp_in_coord(s, &os->endx, delta);
249
250 if (present & 0x0010)
251 rdp_in_coord(s, &os->endy, delta);
252
253 if (present & 0x0020)
254 rdp_in_colour(s, &os->bgcolour);
255
256 if (present & 0x0040)
257 in_uint8(s, os->opcode);
258
259 rdp_parse_pen(s, &os->pen, present >> 7);
260
261 DEBUG("LINE(op=0x%x,sx=%d,sy=%d,dx=%d,dx=%d,fg=0x%x)\n",
262 os->opcode, os->startx, os->starty, os->endx, os->endy,
263 os->pen.colour);
264
265 if (os->opcode < 0x01 || os->opcode > 0x10)
266 {
267 ERROR("bad ROP2 0x%x\n", os->opcode);
268 return;
269 }
270
271 ui_line(os->opcode-1, os->startx, os->starty,
272 os->endx, os->endy, &os->pen);
273 }
274
275 /* Process an opaque rectangle order */
276 static void process_rect(STREAM s, RECT_ORDER *os, uint32 present, BOOL delta)
277 {
278 if (present & 0x01)
279 rdp_in_coord(s, &os->x, delta);
280
281 if (present & 0x02)
282 rdp_in_coord(s, &os->y, delta);
283
284 if (present & 0x04)
285 rdp_in_coord(s, &os->cx, delta);
286
287 if (present & 0x08)
288 rdp_in_coord(s, &os->cy, delta);
289
290 if (present & 0x10)
291 in_uint8(s, os->colour);
292
293 DEBUG("RECT(x=%d,y=%d,cx=%d,cy=%d,fg=0x%x)\n",
294 os->x, os->y, os->cx, os->cy, os->colour);
295
296 ui_rect(os->x, os->y, os->cx, os->cy, os->colour);
297 }
298
299 /* Process a desktop save order */
300 static void process_desksave(STREAM s, DESKSAVE_ORDER *os,
301 uint32 present, BOOL delta)
302 {
303 int width, height;
304
305 if (present & 0x01)
306 in_uint32_le(s, os->offset);
307
308 if (present & 0x02)
309 rdp_in_coord(s, &os->left, delta);
310
311 if (present & 0x04)
312 rdp_in_coord(s, &os->top, delta);
313
314 if (present & 0x08)
315 rdp_in_coord(s, &os->right, delta);
316
317 if (present & 0x10)
318 rdp_in_coord(s, &os->bottom, delta);
319
320 if (present & 0x20)
321 in_uint8(s, os->action);
322
323 DEBUG("DESKSAVE(l=%d,t=%d,r=%d,b=%d,off=%d,op=%d)\n",
324 os->left, os->top, os->right, os->bottom, os->offset,
325 os->action);
326
327 width = os->right - os->left + 1;
328 height = os->bottom - os->top + 1;
329
330 if (os->action == 0)
331 ui_desktop_save(os->offset, os->left, os->top, width, height);
332 else
333 ui_desktop_restore(os->offset, os->left, os->top, width, height);
334 }
335
336 /* Process a memory blt order */
337 static void process_memblt(STREAM s, MEMBLT_ORDER *os,
338 uint32 present, BOOL delta)
339 {
340 HBITMAP bitmap;
341
342 if (present & 0x0001)
343 {
344 in_uint8(s, os->cache_id);
345 in_uint8(s, os->colour_table);
346 }
347
348 if (present & 0x0002)
349 rdp_in_coord(s, &os->x, delta);
350
351 if (present & 0x0004)
352 rdp_in_coord(s, &os->y, delta);
353
354 if (present & 0x0008)
355 rdp_in_coord(s, &os->cx, delta);
356
357 if (present & 0x0010)
358 rdp_in_coord(s, &os->cy, delta);
359
360 if (present & 0x0020)
361 in_uint8(s, os->opcode);
362
363 if (present & 0x0040)
364 rdp_in_coord(s, &os->srcx, delta);
365
366 if (present & 0x0080)
367 rdp_in_coord(s, &os->srcy, delta);
368
369 if (present & 0x0100)
370 in_uint16_le(s, os->cache_idx);
371
372 DEBUG("MEMBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d)\n",
373 os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id,
374 os->cache_idx);
375
376 bitmap = cache_get_bitmap(os->cache_id, os->cache_idx);
377 if (bitmap == NULL)
378 return;
379
380 ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy,
381 bitmap, os->srcx, os->srcy);
382 }
383
384 /* Process a 3-way blt order */
385 static void process_triblt(STREAM s, TRIBLT_ORDER *os,
386 uint32 present, BOOL delta)
387 {
388 HBITMAP bitmap;
389
390 if (present & 0x000001)
391 {
392 in_uint8(s, os->cache_id);
393 in_uint8(s, os->colour_table);
394 }
395
396 if (present & 0x000002)
397 rdp_in_coord(s, &os->x, delta);
398
399 if (present & 0x000004)
400 rdp_in_coord(s, &os->y, delta);
401
402 if (present & 0x000008)
403 rdp_in_coord(s, &os->cx, delta);
404
405 if (present & 0x000010)
406 rdp_in_coord(s, &os->cy, delta);
407
408 if (present & 0x000020)
409 in_uint8(s, os->opcode);
410
411 if (present & 0x000040)
412 rdp_in_coord(s, &os->srcx, delta);
413
414 if (present & 0x000080)
415 rdp_in_coord(s, &os->srcy, delta);
416
417 if (present & 0x000100)
418 rdp_in_colour(s, &os->bgcolour);
419
420 if (present & 0x000200)
421 rdp_in_colour(s, &os->fgcolour);
422
423 rdp_parse_brush(s, &os->brush, present >> 10);
424
425 if (present & 0x008000)
426 in_uint16_le(s, os->cache_idx);
427
428 if (present & 0x010000)
429 in_uint16_le(s, os->unknown);
430
431 DEBUG("TRIBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d,bs=%d,bg=0x%x,fg=0x%x)\n",
432 os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id,
433 os->cache_idx, os->brush.style, os->bgcolour, os->fgcolour);
434
435 bitmap = cache_get_bitmap(os->cache_id, os->cache_idx);
436 if (bitmap == NULL)
437 return;
438
439 ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy,
440 bitmap, os->srcx, os->srcy,
441 &os->brush, os->bgcolour, os->fgcolour);
442 }
443
444 /* Process a text order */
445 static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
446 {
447 DATABLOB *entry;
448 int i;
449
450 if (present & 0x000001)
451 in_uint8(s, os->font);
452
453 if (present & 0x000002)
454 in_uint8(s, os->flags);
455
456 if (present & 0x000004)
457 in_uint8(s, os->unknown);
458
459 if (present & 0x000008)
460 in_uint8(s, os->mixmode);
461
462 if (present & 0x000010)
463 rdp_in_colour(s, &os->fgcolour);
464
465 if (present & 0x000020)
466 rdp_in_colour(s, &os->bgcolour);
467
468 if (present & 0x000040)
469 in_uint16_le(s, os->clipleft);
470
471 if (present & 0x000080)
472 in_uint16_le(s, os->cliptop);
473
474 if (present & 0x000100)
475 in_uint16_le(s, os->clipright);
476
477 if (present & 0x000200)
478 in_uint16_le(s, os->clipbottom);
479
480 if (present & 0x000400)
481 in_uint16_le(s, os->boxleft);
482
483 if (present & 0x000800)
484 in_uint16_le(s, os->boxtop);
485
486 if (present & 0x001000)
487 in_uint16_le(s, os->boxright);
488
489 if (present & 0x002000)
490 in_uint16_le(s, os->boxbottom);
491
492 if (present & 0x080000)
493 in_uint16_le(s, os->x);
494
495 if (present & 0x100000)
496 in_uint16_le(s, os->y);
497
498 if (present & 0x200000)
499 {
500 in_uint8(s, os->length);
501 in_uint8a(s, os->text, os->length);
502 }
503
504 DEBUG("TEXT2(x=%d,y=%d,cl=%d,ct=%d,cr=%d,cb=%d,bl=%d,bt=%d,bb=%d,br=%d,fg=0x%x,bg=0x%x,font=%d,fl=0x%x,mix=%d,unk=0x%x,n=%d)\n",
505 os->x, os->y, os->clipleft, os->cliptop, os->clipright,
506 os->clipbottom, os->boxleft, os->boxtop, os->boxright,
507 os->boxbottom, os->fgcolour, os->bgcolour, os->font,
508 os->flags, os->mixmode, os->unknown, os->length);
509
510 DEBUG("Text: ");
511
512 for (i = 0; i < os->length; i++)
513 DEBUG("%02x ", os->text[i]);
514
515 DEBUG("\n");
516
517 /* Process special cache strings */
518 if ((os->length == 2) && (os->text[0] == 0xfe))
519 {
520 entry = cache_get_text(os->text[1]);
521
522 if (entry == NULL)
523 return;
524
525 memcpy(os->text, entry->data, entry->size);
526 os->length = entry->size;
527 }
528 else if ((os->length >= 3) && (os->text[os->length-3] == 0xff))
529 {
530 os->length -= 3;
531 cache_put_text(os->text[os->length+1], os->text, os->length);
532 }
533
534 ui_draw_text(os->font, os->flags, os->mixmode,
535 os->x, os->y, os->boxleft, os->boxtop,
536 os->boxright - os->boxleft,
537 os->boxbottom - os->boxtop,
538 os->bgcolour, os->fgcolour, os->text, os->length);
539 }
540
541 /* Process a raw bitmap cache order */
542 static void process_raw_bmpcache(STREAM s)
543 {
544 HBITMAP bitmap;
545 uint16 cache_idx, bufsize;
546 uint8 cache_id, width, height, bpp;
547 uint8 *data;
548
549 in_uint8(s, cache_id);
550 in_uint8s(s, 1); /* pad */
551 in_uint8(s, width);
552 in_uint8(s, height);
553 in_uint8(s, bpp);
554 in_uint16_le(s, bufsize);
555 in_uint16_le(s, cache_idx);
556 in_uint8p(s, data, bufsize);
557
558 DEBUG("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n",
559 width, height, cache_id, cache_idx);
560
561 bitmap = ui_create_bitmap(width, height, data);
562 cache_put_bitmap(cache_id, cache_idx, bitmap);
563 }
564
565 /* Process a bitmap cache order */
566 static void process_bmpcache(STREAM s)
567 {
568 HBITMAP bitmap;
569 uint16 cache_idx, size;
570 uint8 cache_id, width, height, bpp;
571 uint8 *data, *bmpdata;
572
573 in_uint8(s, cache_id);
574 in_uint8s(s, 1); /* pad */
575 in_uint8(s, width);
576 in_uint8(s, height);
577 in_uint8(s, bpp);
578 in_uint8s(s, 2); /* bufsize */
579 in_uint16_le(s, cache_idx);
580 in_uint8s(s, 2); /* pad */
581 in_uint16_le(s, size);
582 in_uint8s(s, 4); /* row_size, final_size */
583 in_uint8p(s, data, size);
584
585 DEBUG("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n",
586 width, height, cache_id, cache_idx);
587
588 bmpdata = xmalloc(width * height);
589
590 if (bitmap_decompress(bmpdata, width, height, data, size))
591 {
592 bitmap = ui_create_bitmap(width, height, bmpdata);
593 cache_put_bitmap(cache_id, cache_idx, bitmap);
594 }
595
596 xfree(bmpdata);
597 }
598
599 /* Process a colourmap cache order */
600 static void process_colcache(STREAM s)
601 {
602 COLOURENTRY *entry;
603 COLOURMAP map;
604 HCOLOURMAP hmap;
605 uint8 cache_id;
606 int i;
607
608 in_uint8(s, cache_id);
609 in_uint16_le(s, map.ncolours);
610
611 map.colours = xmalloc(3 * map.ncolours);
612
613 for (i = 0; i < map.ncolours; i++)
614 {
615 entry = &map.colours[i];
616 in_uint8(s, entry->blue);
617 in_uint8(s, entry->green);
618 in_uint8(s, entry->red);
619 in_uint8s(s, 1); /* pad */
620 }
621
622 DEBUG("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours);
623
624 hmap = ui_create_colourmap(&map);
625 ui_set_colourmap(hmap);
626
627 xfree(map.colours);
628 }
629
630 /* Process a font cache order */
631 static void process_fontcache(STREAM s)
632 {
633 HGLYPH bitmap;
634 uint8 font, nglyphs;
635 uint16 character, baseline, width, height;
636 uint8 *data, *rev_data, in, out;
637 int i, j, datasize;
638
639 in_uint8(s, font);
640 in_uint8(s, nglyphs);
641
642 DEBUG("FONTCACHE(font=%d,n=%d)\n", font, nglyphs);
643
644 for (i = 0; i < nglyphs; i++)
645 {
646 in_uint16_le(s, character);
647 in_uint8s(s, 2); /* unknown */
648 in_uint16_le(s, baseline);
649 in_uint16_le(s, width);
650 in_uint16_le(s, height);
651
652 datasize = (height * ((width + 7) / 8) + 3) & ~3;
653 in_uint8p(s, data, datasize);
654
655 /* Need to reverse bit order */
656 rev_data = xmalloc(datasize);
657
658 for (j = 0; j < datasize; j++)
659 {
660 in = data[j];
661 out = 0;
662 if (in & 1) out |= 128;
663 if (in & 2) out |= 64;
664 if (in & 4) out |= 32;
665 if (in & 8) out |= 16;
666 if (in & 16) out |= 8;
667 if (in & 32) out |= 4;
668 if (in & 64) out |= 2;
669 if (in & 128) out |= 1;
670 rev_data[j] = out;
671 }
672
673 bitmap = ui_create_glyph(width, height, rev_data);
674 xfree(rev_data);
675
676 cache_put_font(font, character, baseline, width, height, bitmap);
677 }
678 }
679
680 /* Process a secondary order */
681 static void process_secondary_order(STREAM s)
682 {
683 uint16 length;
684 uint8 type;
685 uint8 *next_order;
686
687 in_uint16_le(s, length);
688 in_uint8s(s, 2); /* flags */
689 in_uint8(s, type);
690
691 next_order = s->p + length + 7;
692
693 switch (type)
694 {
695 case RDP_ORDER_RAW_BMPCACHE:
696 process_raw_bmpcache(s);
697 break;
698
699 case RDP_ORDER_COLCACHE:
700 process_colcache(s);
701 break;
702
703 case RDP_ORDER_BMPCACHE:
704 process_bmpcache(s);
705 break;
706
707 case RDP_ORDER_FONTCACHE:
708 process_fontcache(s);
709 break;
710
711 default:
712 NOTIMP("secondary order %d\n", type);
713 }
714
715 s->p = next_order;
716 }
717
718 /* Process an order PDU */
719 void process_orders(STREAM s)
720 {
721 RDP_ORDER_STATE *os = &order_state;
722 uint32 present;
723 uint16 num_orders;
724 uint8 order_flags;
725 int size, processed = 0;
726 BOOL delta;
727
728 in_uint8s(s, 2); /* pad */
729 in_uint16_le(s, num_orders);
730 in_uint8s(s, 2); /* pad */
731
732 while (processed < num_orders)
733 {
734 in_uint8(s, order_flags);
735
736 if (!(order_flags & RDP_ORDER_STANDARD))
737 {
738 ERROR("order parsing failed\n");
739 break;
740 }
741
742 if (order_flags & RDP_ORDER_SECONDARY)
743 {
744 process_secondary_order(s);
745 }
746 else
747 {
748 if (order_flags & RDP_ORDER_CHANGE)
749 {
750 in_uint8(s, os->order_type);
751 }
752
753 switch (os->order_type)
754 {
755 case RDP_ORDER_TRIBLT:
756 case RDP_ORDER_TEXT2:
757 size = 3;
758 break;
759
760 case RDP_ORDER_PATBLT:
761 case RDP_ORDER_MEMBLT:
762 case RDP_ORDER_LINE:
763 size = 2;
764 break;
765
766 default:
767 size = 1;
768 }
769
770 rdp_in_present(s, &present, order_flags, size);
771
772 if (order_flags & RDP_ORDER_BOUNDS)
773 {
774 if (!(order_flags & RDP_ORDER_LASTBOUNDS))
775 rdp_parse_bounds(s, &os->bounds);
776
777 ui_set_clip(os->bounds.left,
778 os->bounds.top,
779 os->bounds.right - os->bounds.left + 1,
780 os->bounds.bottom - os->bounds.top + 1);
781 }
782
783 delta = order_flags & RDP_ORDER_DELTA;
784
785 switch (os->order_type)
786 {
787 case RDP_ORDER_DESTBLT:
788 process_destblt(s, &os->destblt,
789 present, delta);
790 break;
791
792 case RDP_ORDER_PATBLT:
793 process_patblt(s, &os->patblt,
794 present, delta);
795 break;
796
797 case RDP_ORDER_SCREENBLT:
798 process_screenblt(s, &os->screenblt,
799 present, delta);
800 break;
801
802 case RDP_ORDER_LINE:
803 process_line(s, &os->line,
804 present, delta);
805 break;
806
807 case RDP_ORDER_RECT:
808 process_rect(s, &os->rect,
809 present, delta);
810 break;
811
812 case RDP_ORDER_DESKSAVE:
813 process_desksave(s, &os->desksave,
814 present, delta);
815 break;
816
817 case RDP_ORDER_MEMBLT:
818 process_memblt(s, &os->memblt,
819 present, delta);
820 break;
821
822 case RDP_ORDER_TRIBLT:
823 process_triblt(s, &os->triblt,
824 present, delta);
825 break;
826
827 case RDP_ORDER_TEXT2:
828 process_text2(s, &os->text2,
829 present, delta);
830 break;
831
832 default:
833 NOTIMP("order %d\n", os->order_type);
834 return;
835 }
836
837 if (order_flags & RDP_ORDER_BOUNDS)
838 ui_reset_clip();
839 }
840
841 processed++;
842 }
843
844 if (s->p != next_packet)
845 WARN("%d bytes remaining\n", next_packet - s->p);
846 }
847
848 /* Reset order state */
849 void reset_order_state()
850 {
851 memset(&order_state, 0, sizeof(order_state));
852 }
853

  ViewVC Help
Powered by ViewVC 1.1.26