ReactOS 0.4.15-dev-7788-g1ad9096
orders.c
Go to the documentation of this file.
1/* -*- c-basic-offset: 8 -*-
2 rdesktop: A Remote Desktop Protocol client.
3 RDP order processing
4 Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008
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 3 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, see <http://www.gnu.org/licenses/>.
18*/
19
20#include "precomp.h"
21#include "orders.h"
22
23extern uint8 *g_next_packet;
26
27/* Read field indicating which parameters are present */
28static void
30{
31 uint8 bits;
32 int i;
33
35 {
36 size--;
37 }
38
40 {
41 if (size < 2)
42 size = 0;
43 else
44 size -= 2;
45 }
46
47 *present = 0;
48 for (i = 0; i < size; i++)
49 {
50 in_uint8(s, bits);
51 *present |= bits << (i * 8);
52 }
53}
54
55/* Read a co-ordinate (16-bit, or 8-bit delta) */
56static void
58{
59 sint8 change;
60
61 if (delta)
62 {
63 in_uint8(s, change);
64 *coord += change;
65 }
66 else
67 {
69 }
70}
71
72/* Parse a delta co-ordinate in polyline/polygon order form */
73static int
75{
76 int value = buffer[(*offset)++];
77 int two_byte = value & 0x80;
78
79 if (value & 0x40) /* sign bit */
80 value |= ~0x3f;
81 else
82 value &= 0x3f;
83
84 if (two_byte)
85 value = (value << 8) | buffer[(*offset)++];
86
87 return value;
88}
89
90/* Read a colour entry */
91static void
93{
94 uint32 i;
95 in_uint8(s, i);
96 *colour = i;
97 in_uint8(s, i);
98 *colour |= i << 8;
99 in_uint8(s, i);
100 *colour |= i << 16;
101}
102
103/* Parse bounds information */
104static RD_BOOL
106{
107 uint8 present;
108
109 in_uint8(s, present);
110
111 if (present & 1)
112 rdp_in_coord(s, &bounds->left, False);
113 else if (present & 16)
114 rdp_in_coord(s, &bounds->left, True);
115
116 if (present & 2)
117 rdp_in_coord(s, &bounds->top, False);
118 else if (present & 32)
119 rdp_in_coord(s, &bounds->top, True);
120
121 if (present & 4)
122 rdp_in_coord(s, &bounds->right, False);
123 else if (present & 64)
124 rdp_in_coord(s, &bounds->right, True);
125
126 if (present & 8)
127 rdp_in_coord(s, &bounds->bottom, False);
128 else if (present & 128)
129 rdp_in_coord(s, &bounds->bottom, True);
130
131 return s_check(s);
132}
133
134/* Parse a pen */
135static RD_BOOL
137{
138 if (present & 1)
139 in_uint8(s, pen->style);
140
141 if (present & 2)
142 in_uint8(s, pen->width);
143
144 if (present & 4)
145 rdp_in_colour(s, &pen->colour);
146
147 return s_check(s);
148}
149
150static void
151setup_brush(BRUSH * out_brush, BRUSH * in_brush)
152{
153 BRUSHDATA *brush_data;
154 uint8 cache_idx;
155 uint8 colour_code;
156
157 memcpy(out_brush, in_brush, sizeof(BRUSH));
158 if (out_brush->style & 0x80)
159 {
160 colour_code = out_brush->style & 0x0f;
161 cache_idx = out_brush->pattern[0];
162 brush_data = cache_get_brush_data(colour_code, cache_idx);
163 if ((brush_data == NULL) || (brush_data->data == NULL))
164 {
165 error("error getting brush data, style %x\n", out_brush->style);
166 out_brush->bd = NULL;
167 memset(out_brush->pattern, 0, 8);
168 }
169 else
170 {
171 out_brush->bd = brush_data;
172 }
173 out_brush->style = 3;
174 }
175}
176
177/* Parse a brush */
178static RD_BOOL
180{
181 if (present & 1)
182 in_uint8(s, brush->xorigin);
183
184 if (present & 2)
185 in_uint8(s, brush->yorigin);
186
187 if (present & 4)
188 in_uint8(s, brush->style);
189
190 if (present & 8)
191 in_uint8(s, brush->pattern[0]);
192
193 if (present & 16)
194 in_uint8a(s, &brush->pattern[1], 7);
195
196 return s_check(s);
197}
198
199/* Process a destination blt order */
200static void
202{
203 if (present & 0x01)
204 rdp_in_coord(s, &os->x, delta);
205
206 if (present & 0x02)
207 rdp_in_coord(s, &os->y, delta);
208
209 if (present & 0x04)
210 rdp_in_coord(s, &os->cx, delta);
211
212 if (present & 0x08)
213 rdp_in_coord(s, &os->cy, delta);
214
215 if (present & 0x10)
216 in_uint8(s, os->opcode);
217
218 DEBUG(("DESTBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d)\n",
219 os->opcode, os->x, os->y, os->cx, os->cy));
220
221 ui_destblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy);
222}
223
224/* Process a pattern blt order */
225static void
227{
228 BRUSH brush;
229
230 if (present & 0x0001)
231 rdp_in_coord(s, &os->x, delta);
232
233 if (present & 0x0002)
234 rdp_in_coord(s, &os->y, delta);
235
236 if (present & 0x0004)
237 rdp_in_coord(s, &os->cx, delta);
238
239 if (present & 0x0008)
240 rdp_in_coord(s, &os->cy, delta);
241
242 if (present & 0x0010)
243 in_uint8(s, os->opcode);
244
245 if (present & 0x0020)
246 rdp_in_colour(s, &os->bgcolour);
247
248 if (present & 0x0040)
249 rdp_in_colour(s, &os->fgcolour);
250
251 rdp_parse_brush(s, &os->brush, present >> 7);
252
253 DEBUG(("PATBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,bs=%d,bg=0x%x,fg=0x%x)\n", os->opcode, os->x,
254 os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour));
255
256 setup_brush(&brush, &os->brush);
257
258 ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy,
259 &brush, os->bgcolour, os->fgcolour);
260}
261
262/* Process a screen blt order */
263static void
265{
266 if (present & 0x0001)
267 rdp_in_coord(s, &os->x, delta);
268
269 if (present & 0x0002)
270 rdp_in_coord(s, &os->y, delta);
271
272 if (present & 0x0004)
273 rdp_in_coord(s, &os->cx, delta);
274
275 if (present & 0x0008)
276 rdp_in_coord(s, &os->cy, delta);
277
278 if (present & 0x0010)
279 in_uint8(s, os->opcode);
280
281 if (present & 0x0020)
282 rdp_in_coord(s, &os->srcx, delta);
283
284 if (present & 0x0040)
285 rdp_in_coord(s, &os->srcy, delta);
286
287 DEBUG(("SCREENBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,srcx=%d,srcy=%d)\n",
288 os->opcode, os->x, os->y, os->cx, os->cy, os->srcx, os->srcy));
289
290 ui_screenblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, os->srcx, os->srcy);
291}
292
293/* Process a line order */
294static void
296{
297 if (present & 0x0001)
298 in_uint16_le(s, os->mixmode);
299
300 if (present & 0x0002)
301 rdp_in_coord(s, &os->startx, delta);
302
303 if (present & 0x0004)
304 rdp_in_coord(s, &os->starty, delta);
305
306 if (present & 0x0008)
307 rdp_in_coord(s, &os->endx, delta);
308
309 if (present & 0x0010)
310 rdp_in_coord(s, &os->endy, delta);
311
312 if (present & 0x0020)
313 rdp_in_colour(s, &os->bgcolour);
314
315 if (present & 0x0040)
316 in_uint8(s, os->opcode);
317
318 rdp_parse_pen(s, &os->pen, present >> 7);
319
320 DEBUG(("LINE(op=0x%x,sx=%d,sy=%d,dx=%d,dy=%d,fg=0x%x)\n",
321 os->opcode, os->startx, os->starty, os->endx, os->endy, os->pen.colour));
322
323 if (os->opcode < 0x01 || os->opcode > 0x10)
324 {
325 error("bad ROP2 0x%x\n", os->opcode);
326 return;
327 }
328
329 ui_line(os->opcode - 1, os->startx, os->starty, os->endx, os->endy, &os->pen);
330}
331
332/* Process an opaque rectangle order */
333static void
335{
336 uint32 i;
337 if (present & 0x01)
338 rdp_in_coord(s, &os->x, delta);
339
340 if (present & 0x02)
341 rdp_in_coord(s, &os->y, delta);
342
343 if (present & 0x04)
344 rdp_in_coord(s, &os->cx, delta);
345
346 if (present & 0x08)
347 rdp_in_coord(s, &os->cy, delta);
348
349 if (present & 0x10)
350 {
351 in_uint8(s, i);
352 os->colour = (os->colour & 0xffffff00) | i;
353 }
354
355 if (present & 0x20)
356 {
357 in_uint8(s, i);
358 os->colour = (os->colour & 0xffff00ff) | (i << 8);
359 }
360
361 if (present & 0x40)
362 {
363 in_uint8(s, i);
364 os->colour = (os->colour & 0xff00ffff) | (i << 16);
365 }
366
367 DEBUG(("RECT(x=%d,y=%d,cx=%d,cy=%d,fg=0x%x)\n", os->x, os->y, os->cx, os->cy, os->colour));
368
369 ui_rect(os->x, os->y, os->cx, os->cy, os->colour);
370}
371
372/* Process a desktop save order */
373static void
375{
376 int width, height;
377
378 if (present & 0x01)
379 in_uint32_le(s, os->offset);
380
381 if (present & 0x02)
382 rdp_in_coord(s, &os->left, delta);
383
384 if (present & 0x04)
385 rdp_in_coord(s, &os->top, delta);
386
387 if (present & 0x08)
388 rdp_in_coord(s, &os->right, delta);
389
390 if (present & 0x10)
391 rdp_in_coord(s, &os->bottom, delta);
392
393 if (present & 0x20)
394 in_uint8(s, os->action);
395
396 DEBUG(("DESKSAVE(l=%d,t=%d,r=%d,b=%d,off=%d,op=%d)\n",
397 os->left, os->top, os->right, os->bottom, os->offset, os->action));
398
399 width = os->right - os->left + 1;
400 height = os->bottom - os->top + 1;
401
402 if (os->action == 0)
403 ui_desktop_save(os->offset, os->left, os->top, width, height);
404 else
405 ui_desktop_restore(os->offset, os->left, os->top, width, height);
406}
407
408/* Process a memory blt order */
409static void
411{
413
414 if (present & 0x0001)
415 {
416 in_uint8(s, os->cache_id);
417 in_uint8(s, os->colour_table);
418 }
419
420 if (present & 0x0002)
421 rdp_in_coord(s, &os->x, delta);
422
423 if (present & 0x0004)
424 rdp_in_coord(s, &os->y, delta);
425
426 if (present & 0x0008)
427 rdp_in_coord(s, &os->cx, delta);
428
429 if (present & 0x0010)
430 rdp_in_coord(s, &os->cy, delta);
431
432 if (present & 0x0020)
433 in_uint8(s, os->opcode);
434
435 if (present & 0x0040)
436 rdp_in_coord(s, &os->srcx, delta);
437
438 if (present & 0x0080)
439 rdp_in_coord(s, &os->srcy, delta);
440
441 if (present & 0x0100)
443
444 DEBUG(("MEMBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d)\n",
445 os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx));
446
448 if (bitmap == NULL)
449 return;
450
451 ui_memblt(ROP2_S(os->opcode), os->x, os->y, os->cx, os->cy, bitmap, os->srcx, os->srcy);
452}
453
454/* Process a 3-way blt order */
455static void
457{
459 BRUSH brush;
460
461 if (present & 0x000001)
462 {
463 in_uint8(s, os->cache_id);
464 in_uint8(s, os->colour_table);
465 }
466
467 if (present & 0x000002)
468 rdp_in_coord(s, &os->x, delta);
469
470 if (present & 0x000004)
471 rdp_in_coord(s, &os->y, delta);
472
473 if (present & 0x000008)
474 rdp_in_coord(s, &os->cx, delta);
475
476 if (present & 0x000010)
477 rdp_in_coord(s, &os->cy, delta);
478
479 if (present & 0x000020)
480 in_uint8(s, os->opcode);
481
482 if (present & 0x000040)
483 rdp_in_coord(s, &os->srcx, delta);
484
485 if (present & 0x000080)
486 rdp_in_coord(s, &os->srcy, delta);
487
488 if (present & 0x000100)
489 rdp_in_colour(s, &os->bgcolour);
490
491 if (present & 0x000200)
492 rdp_in_colour(s, &os->fgcolour);
493
494 rdp_parse_brush(s, &os->brush, present >> 10);
495
496 if (present & 0x008000)
498
499 if (present & 0x010000)
500 in_uint16_le(s, os->unknown);
501
502 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",
503 os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx,
504 os->brush.style, os->bgcolour, os->fgcolour));
505
507 if (bitmap == NULL)
508 return;
509
510 setup_brush(&brush, &os->brush);
511
512 ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy,
513 bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour);
514}
515
516/* Process a polygon order */
517static void
519{
520 int index, data, next;
521 uint8 flags = 0;
523
524 if (present & 0x01)
525 rdp_in_coord(s, &os->x, delta);
526
527 if (present & 0x02)
528 rdp_in_coord(s, &os->y, delta);
529
530 if (present & 0x04)
531 in_uint8(s, os->opcode);
532
533 if (present & 0x08)
534 in_uint8(s, os->fillmode);
535
536 if (present & 0x10)
537 rdp_in_colour(s, &os->fgcolour);
538
539 if (present & 0x20)
540 in_uint8(s, os->npoints);
541
542 if (present & 0x40)
543 {
544 in_uint8(s, os->datasize);
545 in_uint8a(s, os->data, os->datasize);
546 }
547
548 DEBUG(("POLYGON(x=%d,y=%d,op=0x%x,fm=%d,fg=0x%x,n=%d,sz=%d)\n",
549 os->x, os->y, os->opcode, os->fillmode, os->fgcolour, os->npoints, os->datasize));
550
551 DEBUG(("Data: "));
552
553 for (index = 0; index < os->datasize; index++)
554 DEBUG(("%02x ", os->data[index]));
555
556 DEBUG(("\n"));
557
558 if (os->opcode < 0x01 || os->opcode > 0x10)
559 {
560 error("bad ROP2 0x%x\n", os->opcode);
561 return;
562 }
563
564 points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT));
565 memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT));
566
567 points[0].x = os->x;
568 points[0].y = os->y;
569
570 index = 0;
571 data = ((os->npoints - 1) / 4) + 1;
572 for (next = 1; (next <= os->npoints) && (next < 256) && (data < os->datasize); next++)
573 {
574 if ((next - 1) % 4 == 0)
575 flags = os->data[index++];
576
577 if (~flags & 0x80)
578 points[next].x = parse_delta(os->data, &data);
579
580 if (~flags & 0x40)
581 points[next].y = parse_delta(os->data, &data);
582
583 flags <<= 2;
584 }
585
586 if (next - 1 == os->npoints)
587 ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1, NULL, 0,
588 os->fgcolour);
589 else
590 error("polygon parse error\n");
591
592 xfree(points);
593}
594
595/* Process a polygon2 order */
596static void
598{
599 int index, data, next;
600 uint8 flags = 0;
602 BRUSH brush;
603
604 if (present & 0x0001)
605 rdp_in_coord(s, &os->x, delta);
606
607 if (present & 0x0002)
608 rdp_in_coord(s, &os->y, delta);
609
610 if (present & 0x0004)
611 in_uint8(s, os->opcode);
612
613 if (present & 0x0008)
614 in_uint8(s, os->fillmode);
615
616 if (present & 0x0010)
617 rdp_in_colour(s, &os->bgcolour);
618
619 if (present & 0x0020)
620 rdp_in_colour(s, &os->fgcolour);
621
622 rdp_parse_brush(s, &os->brush, present >> 6);
623
624 if (present & 0x0800)
625 in_uint8(s, os->npoints);
626
627 if (present & 0x1000)
628 {
629 in_uint8(s, os->datasize);
630 in_uint8a(s, os->data, os->datasize);
631 }
632
633 DEBUG(("POLYGON2(x=%d,y=%d,op=0x%x,fm=%d,bs=%d,bg=0x%x,fg=0x%x,n=%d,sz=%d)\n",
634 os->x, os->y, os->opcode, os->fillmode, os->brush.style, os->bgcolour, os->fgcolour,
635 os->npoints, os->datasize));
636
637 DEBUG(("Data: "));
638
639 for (index = 0; index < os->datasize; index++)
640 DEBUG(("%02x ", os->data[index]));
641
642 DEBUG(("\n"));
643
644 if (os->opcode < 0x01 || os->opcode > 0x10)
645 {
646 error("bad ROP2 0x%x\n", os->opcode);
647 return;
648 }
649
650 setup_brush(&brush, &os->brush);
651
652 points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT));
653 memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT));
654
655 points[0].x = os->x;
656 points[0].y = os->y;
657
658 index = 0;
659 data = ((os->npoints - 1) / 4) + 1;
660 for (next = 1; (next <= os->npoints) && (next < 256) && (data < os->datasize); next++)
661 {
662 if ((next - 1) % 4 == 0)
663 flags = os->data[index++];
664
665 if (~flags & 0x80)
666 points[next].x = parse_delta(os->data, &data);
667
668 if (~flags & 0x40)
669 points[next].y = parse_delta(os->data, &data);
670
671 flags <<= 2;
672 }
673
674 if (next - 1 == os->npoints)
675 ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1,
676 &brush, os->bgcolour, os->fgcolour);
677 else
678 error("polygon2 parse error\n");
679
680 xfree(points);
681}
682
683/* Process a polyline order */
684static void
686{
687 int index, next, data;
688 uint8 flags = 0;
689 PEN pen;
691
692 if (present & 0x01)
693 rdp_in_coord(s, &os->x, delta);
694
695 if (present & 0x02)
696 rdp_in_coord(s, &os->y, delta);
697
698 if (present & 0x04)
699 in_uint8(s, os->opcode);
700
701 if (present & 0x10)
702 rdp_in_colour(s, &os->fgcolour);
703
704 if (present & 0x20)
705 in_uint8(s, os->lines);
706
707 if (present & 0x40)
708 {
709 in_uint8(s, os->datasize);
710 in_uint8a(s, os->data, os->datasize);
711 }
712
713 DEBUG(("POLYLINE(x=%d,y=%d,op=0x%x,fg=0x%x,n=%d,sz=%d)\n",
714 os->x, os->y, os->opcode, os->fgcolour, os->lines, os->datasize));
715
716 DEBUG(("Data: "));
717
718 for (index = 0; index < os->datasize; index++)
719 DEBUG(("%02x ", os->data[index]));
720
721 DEBUG(("\n"));
722
723 if (os->opcode < 0x01 || os->opcode > 0x10)
724 {
725 error("bad ROP2 0x%x\n", os->opcode);
726 return;
727 }
728
729 points = (RD_POINT *) xmalloc((os->lines + 1) * sizeof(RD_POINT));
730 memset(points, 0, (os->lines + 1) * sizeof(RD_POINT));
731
732 points[0].x = os->x;
733 points[0].y = os->y;
734 pen.style = pen.width = 0;
735 pen.colour = os->fgcolour;
736
737 index = 0;
738 data = ((os->lines - 1) / 4) + 1;
739 for (next = 1; (next <= os->lines) && (data < os->datasize); next++)
740 {
741 if ((next - 1) % 4 == 0)
742 flags = os->data[index++];
743
744 if (~flags & 0x80)
745 points[next].x = parse_delta(os->data, &data);
746
747 if (~flags & 0x40)
748 points[next].y = parse_delta(os->data, &data);
749
750 flags <<= 2;
751 }
752
753 if (next - 1 == os->lines)
754 ui_polyline(os->opcode - 1, points, os->lines + 1, &pen);
755 else
756 error("polyline parse error\n");
757
758 xfree(points);
759}
760
761/* Process an ellipse order */
762static void
764{
765 if (present & 0x01)
766 rdp_in_coord(s, &os->left, delta);
767
768 if (present & 0x02)
769 rdp_in_coord(s, &os->top, delta);
770
771 if (present & 0x04)
772 rdp_in_coord(s, &os->right, delta);
773
774 if (present & 0x08)
775 rdp_in_coord(s, &os->bottom, delta);
776
777 if (present & 0x10)
778 in_uint8(s, os->opcode);
779
780 if (present & 0x20)
781 in_uint8(s, os->fillmode);
782
783 if (present & 0x40)
784 rdp_in_colour(s, &os->fgcolour);
785
786 DEBUG(("ELLIPSE(l=%d,t=%d,r=%d,b=%d,op=0x%x,fm=%d,fg=0x%x)\n", os->left, os->top,
787 os->right, os->bottom, os->opcode, os->fillmode, os->fgcolour));
788
789 ui_ellipse(os->opcode - 1, os->fillmode, os->left, os->top, os->right - os->left,
790 os->bottom - os->top, NULL, 0, os->fgcolour);
791}
792
793/* Process an ellipse2 order */
794static void
796{
797 BRUSH brush;
798
799 if (present & 0x0001)
800 rdp_in_coord(s, &os->left, delta);
801
802 if (present & 0x0002)
803 rdp_in_coord(s, &os->top, delta);
804
805 if (present & 0x0004)
806 rdp_in_coord(s, &os->right, delta);
807
808 if (present & 0x0008)
809 rdp_in_coord(s, &os->bottom, delta);
810
811 if (present & 0x0010)
812 in_uint8(s, os->opcode);
813
814 if (present & 0x0020)
815 in_uint8(s, os->fillmode);
816
817 if (present & 0x0040)
818 rdp_in_colour(s, &os->bgcolour);
819
820 if (present & 0x0080)
821 rdp_in_colour(s, &os->fgcolour);
822
823 rdp_parse_brush(s, &os->brush, present >> 8);
824
825 DEBUG(("ELLIPSE2(l=%d,t=%d,r=%d,b=%d,op=0x%x,fm=%d,bs=%d,bg=0x%x,fg=0x%x)\n",
826 os->left, os->top, os->right, os->bottom, os->opcode, os->fillmode, os->brush.style,
827 os->bgcolour, os->fgcolour));
828
829 setup_brush(&brush, &os->brush);
830
831 ui_ellipse(os->opcode - 1, os->fillmode, os->left, os->top, os->right - os->left,
832 os->bottom - os->top, &brush, os->bgcolour, os->fgcolour);
833}
834
835/* Process a text order */
836static void
838{
839 int i;
840 BRUSH brush;
841
842 if (present & 0x000001)
843 in_uint8(s, os->font);
844
845 if (present & 0x000002)
846 in_uint8(s, os->flags);
847
848 if (present & 0x000004)
849 in_uint8(s, os->opcode);
850
851 if (present & 0x000008)
852 in_uint8(s, os->mixmode);
853
854 if (present & 0x000010)
855 rdp_in_colour(s, &os->fgcolour);
856
857 if (present & 0x000020)
858 rdp_in_colour(s, &os->bgcolour);
859
860 if (present & 0x000040)
861 in_uint16_le(s, os->clipleft);
862
863 if (present & 0x000080)
864 in_uint16_le(s, os->cliptop);
865
866 if (present & 0x000100)
868
869 if (present & 0x000200)
871
872 if (present & 0x000400)
873 in_uint16_le(s, os->boxleft);
874
875 if (present & 0x000800)
876 in_uint16_le(s, os->boxtop);
877
878 if (present & 0x001000)
879 in_uint16_le(s, os->boxright);
880
881 if (present & 0x002000)
883
884 rdp_parse_brush(s, &os->brush, present >> 14);
885
886 if (present & 0x080000)
887 in_uint16_le(s, os->x);
888
889 if (present & 0x100000)
890 in_uint16_le(s, os->y);
891
892 if (present & 0x200000)
893 {
894 in_uint8(s, os->length);
895 in_uint8a(s, os->text, os->length);
896 }
897
898 DEBUG(("TEXT2(x=%d,y=%d,cl=%d,ct=%d,cr=%d,cb=%d,bl=%d,bt=%d,br=%d,bb=%d,bs=%d,bg=0x%x,fg=0x%x,font=%d,fl=0x%x,op=0x%x,mix=%d,n=%d)\n", os->x, os->y, os->clipleft, os->cliptop, os->clipright, os->clipbottom, os->boxleft, os->boxtop, os->boxright, os->boxbottom, os->brush.style, os->bgcolour, os->fgcolour, os->font, os->flags, os->opcode, os->mixmode, os->length));
899
900 DEBUG(("Text: "));
901
902 for (i = 0; i < os->length; i++)
903 DEBUG(("%02x ", os->text[i]));
904
905 DEBUG(("\n"));
906
907 setup_brush(&brush, &os->brush);
908
909 ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y,
910 os->clipleft, os->cliptop, os->clipright - os->clipleft,
911 os->clipbottom - os->cliptop, os->boxleft, os->boxtop,
912 os->boxright - os->boxleft, os->boxbottom - os->boxtop,
913 &brush, os->bgcolour, os->fgcolour, os->text, os->length);
914}
915
916/* Process a raw bitmap cache order */
917static void
919{
921 uint16 cache_idx, bufsize;
922 uint8 cache_id, width, height, bpp, Bpp;
923 uint8 *data, *inverted;
924 int y;
925
926 in_uint8(s, cache_id);
927 in_uint8s(s, 1); /* pad */
928 in_uint8(s, width);
929 in_uint8(s, height);
930 in_uint8(s, bpp);
931 Bpp = (bpp + 7) / 8;
933 in_uint16_le(s, cache_idx);
935
936 DEBUG(("RAW_BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d)\n", width, height, cache_id, cache_idx));
937 inverted = (uint8 *) xmalloc(width * height * Bpp);
938 for (y = 0; y < height; y++)
939 {
940 memcpy(&inverted[(height - y - 1) * (width * Bpp)], &data[y * (width * Bpp)],
941 width * Bpp);
942 }
943
944 bitmap = ui_create_bitmap(width, height, inverted);
945 xfree(inverted);
946 cache_put_bitmap(cache_id, cache_idx, bitmap);
947}
948
949/* Process a bitmap cache order */
950static void
952{
954 uint16 cache_idx, size;
955 uint8 cache_id, width, height, bpp, Bpp;
956 uint8 *data, *bmpdata;
957 uint16 bufsize, pad2, row_size, final_size;
958 uint8 pad1;
959
960 pad2 = row_size = final_size = 0xffff; /* Shut the compiler up */
961
962 in_uint8(s, cache_id);
963 in_uint8(s, pad1); /* pad */
964 in_uint8(s, width);
965 in_uint8(s, height);
966 in_uint8(s, bpp);
967 Bpp = (bpp + 7) / 8;
968 in_uint16_le(s, bufsize); /* bufsize */
969 in_uint16_le(s, cache_idx);
970
971 if (g_rdp_version >= RDP_V5)
972 {
973 size = bufsize;
974 }
975 else
976 {
977
978 /* Begin compressedBitmapData */
979 in_uint16_le(s, pad2); /* pad */
981 /* in_uint8s(s, 4); *//* row_size, final_size */
982 in_uint16_le(s, row_size);
983 in_uint16_le(s, final_size);
984
985 }
986 in_uint8p(s, data, size);
987
988 DEBUG(("BMPCACHE(cx=%d,cy=%d,id=%d,idx=%d,bpp=%d,size=%d,pad1=%d,bufsize=%d,pad2=%d,rs=%d,fs=%d)\n", width, height, cache_id, cache_idx, bpp, size, pad1, bufsize, pad2, row_size, final_size));
989
990 bmpdata = (uint8 *) xmalloc(width * height * Bpp);
991
992 if (bitmap_decompress(bmpdata, width, height, data, size, Bpp))
993 {
994 bitmap = ui_create_bitmap(width, height, bmpdata);
995 cache_put_bitmap(cache_id, cache_idx, bitmap);
996 }
997 else
998 {
999 DEBUG(("Failed to decompress bitmap data\n"));
1000 }
1001 if (pad1 || pad2) {}
1002
1003 xfree(bmpdata);
1004}
1005
1006/* Process a bitmap cache v2 order */
1007static void
1009{
1011 int y;
1012 uint8 cache_id, cache_idx_low, width, height, Bpp;
1013 uint16 cache_idx, bufsize;
1014 uint8 *data, *bmpdata, *bitmap_id;
1015
1016 bitmap_id = NULL; /* prevent compiler warning */
1017 cache_id = flags & ID_MASK;
1018 Bpp = ((flags & MODE_MASK) >> MODE_SHIFT) - 2;
1019
1020 if (flags & PERSIST)
1021 {
1022 in_uint8p(s, bitmap_id, 8);
1023 }
1024
1025 if (flags & SQUARE)
1026 {
1027 in_uint8(s, width);
1028 height = width;
1029 }
1030 else
1031 {
1032 in_uint8(s, width);
1033 in_uint8(s, height);
1034 }
1035
1038 in_uint8(s, cache_idx);
1039
1040 if (cache_idx & LONG_FORMAT)
1041 {
1042 in_uint8(s, cache_idx_low);
1043 cache_idx = ((cache_idx ^ LONG_FORMAT) << 8) + cache_idx_low;
1044 }
1045
1047
1048 DEBUG(("BMPCACHE2(compr=%d,flags=%x,cx=%d,cy=%d,id=%d,idx=%d,Bpp=%d,bs=%d)\n",
1049 compressed, flags, width, height, cache_id, cache_idx, Bpp, bufsize));
1050
1051 bmpdata = (uint8 *) xmalloc(width * height * Bpp);
1052
1053 if (compressed)
1054 {
1055 if (!bitmap_decompress(bmpdata, width, height, data, bufsize, Bpp))
1056 {
1057 DEBUG(("Failed to decompress bitmap data\n"));
1058 xfree(bmpdata);
1059 return;
1060 }
1061 }
1062 else
1063 {
1064 for (y = 0; y < height; y++)
1065 memcpy(&bmpdata[(height - y - 1) * (width * Bpp)],
1066 &data[y * (width * Bpp)], width * Bpp);
1067 }
1068
1069 bitmap = ui_create_bitmap(width, height, bmpdata);
1070
1071 if (bitmap)
1072 {
1073 cache_put_bitmap(cache_id, cache_idx, bitmap);
1074 if (flags & PERSIST)
1075 pstcache_save_bitmap(cache_id, cache_idx, bitmap_id, width, height,
1076 width * height * Bpp, bmpdata);
1077 }
1078 else
1079 {
1080 DEBUG(("process_bmpcache2: ui_create_bitmap failed\n"));
1081 }
1082
1083 xfree(bmpdata);
1084}
1085
1086/* Process a colourmap cache order */
1087static void
1089{
1091 COLOURMAP map;
1092 RD_HCOLOURMAP hmap;
1093 uint8 cache_id;
1094 int i;
1095
1096 in_uint8(s, cache_id);
1097 in_uint16_le(s, map.ncolours);
1098
1099 map.colours = (COLOURENTRY *) xmalloc(sizeof(COLOURENTRY) * map.ncolours);
1100
1101 for (i = 0; i < map.ncolours; i++)
1102 {
1103 entry = &map.colours[i];
1104 in_uint8(s, entry->blue);
1105 in_uint8(s, entry->green);
1106 in_uint8(s, entry->red);
1107 in_uint8s(s, 1); /* pad */
1108 }
1109
1110 DEBUG(("COLCACHE(id=%d,n=%d)\n", cache_id, map.ncolours));
1111
1112 hmap = ui_create_colourmap(&map);
1113
1114 if (cache_id)
1115 ui_set_colourmap(hmap);
1116
1117 xfree(map.colours);
1118}
1119
1120/* Process a font cache order */
1121static void
1123{
1125 uint8 font, nglyphs;
1126 uint16 character, offset, baseline, width, height;
1127 int i, datasize;
1128 uint8 *data;
1129
1130 in_uint8(s, font);
1131 in_uint8(s, nglyphs);
1132
1133 DEBUG(("FONTCACHE(font=%d,n=%d)\n", font, nglyphs));
1134
1135 for (i = 0; i < nglyphs; i++)
1136 {
1137 in_uint16_le(s, character);
1139 in_uint16_le(s, baseline);
1142
1143 datasize = (height * ((width + 7) / 8) + 3) & ~3;
1145
1147 cache_put_font(font, character, offset, baseline, width, height, bitmap);
1148 }
1149}
1150
1151static void
1153{
1154 int x, y, pal_index, in_index, shift, do2, i;
1155 uint8 *pal;
1156
1157 in_index = 0;
1158 pal = in + 16;
1159 /* read it bottom up */
1160 for (y = 7; y >= 0; y--)
1161 {
1162 /* 2 bytes per row */
1163 x = 0;
1164 for (do2 = 0; do2 < 2; do2++)
1165 {
1166 /* 4 pixels per byte */
1167 shift = 6;
1168 while (shift >= 0)
1169 {
1170 pal_index = (in[in_index] >> shift) & 3;
1171 /* size of palette entries depends on Bpp */
1172 for (i = 0; i < Bpp; i++)
1173 {
1174 out[(y * 8 + x) * Bpp + i] = pal[pal_index * Bpp + i];
1175 }
1176 x++;
1177 shift -= 2;
1178 }
1179 in_index++;
1180 }
1181 }
1182}
1183
1184/* Process a brush cache order */
1185static void
1187{
1188 BRUSHDATA brush_data;
1189 uint8 cache_idx, colour_code, width, height, size, type;
1190 uint8 *comp_brush;
1191 int index;
1192 int Bpp;
1193
1194 in_uint8(s, cache_idx);
1195 in_uint8(s, colour_code);
1196 in_uint8(s, width);
1197 in_uint8(s, height);
1198 in_uint8(s, type); /* type, 0x8x = cached */
1199 in_uint8(s, size);
1200
1201 DEBUG(("BRUSHCACHE(idx=%d,wd=%d,ht=%d,sz=%d)\n", cache_idx, width, height, size));
1202
1203 if ((width == 8) && (height == 8))
1204 {
1205 if (colour_code == 1)
1206 {
1207 brush_data.colour_code = 1;
1208 brush_data.data_size = 8;
1209 brush_data.data = xmalloc(8);
1210 if (size == 8)
1211 {
1212 /* read it bottom up */
1213 for (index = 7; index >= 0; index--)
1214 {
1215 in_uint8(s, brush_data.data[index]);
1216 }
1217 }
1218 else
1219 {
1220 warning("incompatible brush, colour_code %d size %d\n", colour_code,
1221 size);
1222 }
1223 cache_put_brush_data(1, cache_idx, &brush_data);
1224 }
1225 else if ((colour_code >= 3) && (colour_code <= 6))
1226 {
1227 Bpp = colour_code - 2;
1228 brush_data.colour_code = colour_code;
1229 brush_data.data_size = 8 * 8 * Bpp;
1230 brush_data.data = xmalloc(8 * 8 * Bpp);
1231 if (size == 16 + 4 * Bpp)
1232 {
1233 in_uint8p(s, comp_brush, 16 + 4 * Bpp);
1234 process_compressed_8x8_brush_data(comp_brush, brush_data.data, Bpp);
1235 }
1236 else
1237 {
1238 in_uint8a(s, brush_data.data, 8 * 8 * Bpp);
1239 }
1240 cache_put_brush_data(colour_code, cache_idx, &brush_data);
1241 }
1242 else
1243 {
1244 warning("incompatible brush, colour_code %d size %d\n", colour_code, size);
1245 }
1246 }
1247 else
1248 {
1249 warning("incompatible brush, width height %d %d\n", width, height);
1250 }
1251 if (type) {}
1252}
1253
1254/* Process a secondary order */
1255static void
1257{
1258 /* The length isn't calculated correctly by the server.
1259 * For very compact orders the length becomes negative
1260 * so a signed integer must be used. */
1261 uint16 length;
1262 uint16 flags;
1263 uint8 type;
1264 uint8 *next_order;
1265
1267 in_uint16_le(s, flags); /* used by bmpcache2 */
1268 in_uint8(s, type);
1269
1270 next_order = s->p + (sint16) length + 7;
1271
1272 switch (type)
1273 {
1276 break;
1277
1278 case RDP_ORDER_COLCACHE:
1280 break;
1281
1282 case RDP_ORDER_BMPCACHE:
1284 break;
1285
1288 break;
1289
1291 process_bmpcache2(s, flags, False); /* uncompressed */
1292 break;
1293
1295 process_bmpcache2(s, flags, True); /* compressed */
1296 break;
1297
1300 break;
1301
1302 default:
1303 unimpl("secondary order %d\n", type);
1304 }
1305
1306 s->p = next_order;
1307}
1308
1309/* Process an order PDU */
1310void
1312{
1314 uint32 present;
1315 uint8 order_flags;
1316 int size, processed = 0;
1317 RD_BOOL delta;
1318
1319 while (processed < num_orders)
1320 {
1321 in_uint8(s, order_flags);
1322
1323 if (!(order_flags & RDP_ORDER_STANDARD))
1324 {
1325 error("order parsing failed\n");
1326 break;
1327 }
1328
1329 if (order_flags & RDP_ORDER_SECONDARY)
1330 {
1332 }
1333 else
1334 {
1335 if (order_flags & RDP_ORDER_CHANGE)
1336 {
1337 in_uint8(s, os->order_type);
1338 }
1339
1340 switch (os->order_type)
1341 {
1342 case RDP_ORDER_TRIBLT:
1343 case RDP_ORDER_TEXT2:
1344 size = 3;
1345 break;
1346
1347 case RDP_ORDER_PATBLT:
1348 case RDP_ORDER_MEMBLT:
1349 case RDP_ORDER_LINE:
1350 case RDP_ORDER_POLYGON2:
1351 case RDP_ORDER_ELLIPSE2:
1352 size = 2;
1353 break;
1354
1355 default:
1356 size = 1;
1357 }
1358
1359 rdp_in_present(s, &present, order_flags, size);
1360
1361 if (order_flags & RDP_ORDER_BOUNDS)
1362 {
1363 if (!(order_flags & RDP_ORDER_LASTBOUNDS))
1364 rdp_parse_bounds(s, &os->bounds);
1365
1367 os->bounds.top,
1368 os->bounds.right -
1369 os->bounds.left + 1,
1370 os->bounds.bottom - os->bounds.top + 1);
1371 }
1372
1373 delta = order_flags & RDP_ORDER_DELTA;
1374
1375 switch (os->order_type)
1376 {
1377 case RDP_ORDER_DESTBLT:
1378 process_destblt(s, &os->destblt, present, delta);
1379 break;
1380
1381 case RDP_ORDER_PATBLT:
1382 process_patblt(s, &os->patblt, present, delta);
1383 break;
1384
1386 process_screenblt(s, &os->screenblt, present, delta);
1387 break;
1388
1389 case RDP_ORDER_LINE:
1390 process_line(s, &os->line, present, delta);
1391 break;
1392
1393 case RDP_ORDER_RECT:
1394 process_rect(s, &os->rect, present, delta);
1395 break;
1396
1397 case RDP_ORDER_DESKSAVE:
1398 process_desksave(s, &os->desksave, present, delta);
1399 break;
1400
1401 case RDP_ORDER_MEMBLT:
1402 process_memblt(s, &os->memblt, present, delta);
1403 break;
1404
1405 case RDP_ORDER_TRIBLT:
1406 process_triblt(s, &os->triblt, present, delta);
1407 break;
1408
1409 case RDP_ORDER_POLYGON:
1410 process_polygon(s, &os->polygon, present, delta);
1411 break;
1412
1413 case RDP_ORDER_POLYGON2:
1414 process_polygon2(s, &os->polygon2, present, delta);
1415 break;
1416
1417 case RDP_ORDER_POLYLINE:
1418 process_polyline(s, &os->polyline, present, delta);
1419 break;
1420
1421 case RDP_ORDER_ELLIPSE:
1422 process_ellipse(s, &os->ellipse, present, delta);
1423 break;
1424
1425 case RDP_ORDER_ELLIPSE2:
1426 process_ellipse2(s, &os->ellipse2, present, delta);
1427 break;
1428
1429 case RDP_ORDER_TEXT2:
1430 process_text2(s, &os->text2, present, delta);
1431 break;
1432
1433 default:
1434 unimpl("order %d\n", os->order_type);
1435 return;
1436 }
1437
1438 if (order_flags & RDP_ORDER_BOUNDS)
1439 ui_reset_clip();
1440 }
1441
1442 processed++;
1443 }
1444#if 0
1445 /* not true when RDP_COMPRESSION is set */
1446 if (s->p != g_next_packet)
1447 error("%d bytes remaining\n", (int) (g_next_packet - s->p));
1448#endif
1449
1450}
1451
1452/* Reset order state */
1453void
1455{
1456 memset(&g_order_state, 0, sizeof(g_order_state));
1458}
RD_BOOL bitmap_decompress(uint8 *output, int width, int height, uint8 *input, int size, int Bpp)
Definition: bitmap.c:884
void cache_put_font(uint8 font, uint16 character, uint16 offset, uint16 baseline, uint16 width, uint16 height, RD_HGLYPH pixmap)
Definition: cache.c:296
BRUSHDATA * cache_get_brush_data(uint8 colour_code, uint8 idx)
Definition: cache.c:441
RD_HBITMAP cache_get_bitmap(uint8 id, uint16 idx)
Definition: cache.c:195
void cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap)
Definition: cache.c:218
void cache_put_brush_data(uint8 colour_code, uint8 idx, BRUSHDATA *brush_data)
Definition: cache.c:455
#define ROP2_P(rop3)
Definition: constants.h:264
#define ROP2_S(rop3)
Definition: constants.h:263
static RD_BOOL rdp_parse_brush(STREAM s, BRUSH *brush, uint32 present)
Definition: orders.c:179
static void process_rect(STREAM s, RECT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:334
static int parse_delta(uint8 *buffer, int *offset)
Definition: orders.c:74
static void process_bmpcache(STREAM s)
Definition: orders.c:951
void process_orders(STREAM s, uint16 num_orders)
Definition: orders.c:1311
static void process_polygon2(STREAM s, POLYGON2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:597
static void process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed)
Definition: orders.c:1008
static void process_desksave(STREAM s, DESKSAVE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:374
static void process_triblt(STREAM s, TRIBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:456
static void process_ellipse2(STREAM s, ELLIPSE2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:795
static void rdp_in_colour(STREAM s, uint32 *colour)
Definition: orders.c:92
static void process_destblt(STREAM s, DESTBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:201
static void process_compressed_8x8_brush_data(uint8 *in, uint8 *out, int Bpp)
Definition: orders.c:1152
static void process_polygon(STREAM s, POLYGON_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:518
uint8 * g_next_packet
Definition: rdp.c:45
static void rdp_in_coord(STREAM s, sint16 *coord, RD_BOOL delta)
Definition: orders.c:57
RDP_VERSION g_rdp_version
Definition: uimain.c:74
static void process_ellipse(STREAM s, ELLIPSE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:763
static void process_brushcache(STREAM s, uint16 flags)
Definition: orders.c:1186
static void rdp_in_present(STREAM s, uint32 *present, uint8 flags, int size)
Definition: orders.c:29
static void process_fontcache(STREAM s)
Definition: orders.c:1122
static void process_raw_bmpcache(STREAM s)
Definition: orders.c:918
static RDP_ORDER_STATE g_order_state
Definition: orders.c:24
static void process_screenblt(STREAM s, SCREENBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:264
void reset_order_state(void)
Definition: orders.c:1454
static void setup_brush(BRUSH *out_brush, BRUSH *in_brush)
Definition: orders.c:151
static void process_memblt(STREAM s, MEMBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:410
static void process_colcache(STREAM s)
Definition: orders.c:1088
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:837
static void process_polyline(STREAM s, POLYLINE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:685
static RD_BOOL rdp_parse_pen(STREAM s, PEN *pen, uint32 present)
Definition: orders.c:136
static RD_BOOL rdp_parse_bounds(STREAM s, BOUNDS *bounds)
Definition: orders.c:105
static void process_secondary_order(STREAM s)
Definition: orders.c:1256
static void process_patblt(STREAM s, PATBLT_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:226
static void process_line(STREAM s, LINE_ORDER *os, uint32 present, RD_BOOL delta)
Definition: orders.c:295
#define RDP_ORDER_TINY
Definition: orders.h:27
#define RDP_ORDER_BOUNDS
Definition: orders.h:22
#define MODE_SHIFT
Definition: orders.h:331
@ RDP_ORDER_POLYLINE
Definition: orders.h:41
@ RDP_ORDER_RECT
Definition: orders.h:35
@ RDP_ORDER_ELLIPSE
Definition: orders.h:42
@ RDP_ORDER_LINE
Definition: orders.h:34
@ RDP_ORDER_TRIBLT
Definition: orders.h:38
@ RDP_ORDER_DESTBLT
Definition: orders.h:31
@ RDP_ORDER_ELLIPSE2
Definition: orders.h:43
@ RDP_ORDER_TEXT2
Definition: orders.h:44
@ RDP_ORDER_PATBLT
Definition: orders.h:32
@ RDP_ORDER_MEMBLT
Definition: orders.h:37
@ RDP_ORDER_DESKSAVE
Definition: orders.h:36
@ RDP_ORDER_SCREENBLT
Definition: orders.h:33
@ RDP_ORDER_POLYGON2
Definition: orders.h:40
@ RDP_ORDER_POLYGON
Definition: orders.h:39
#define BUFSIZE_MASK
Definition: orders.h:334
#define RDP_ORDER_CHANGE
Definition: orders.h:23
#define RDP_ORDER_SECONDARY
Definition: orders.h:21
#define RDP_ORDER_SMALL
Definition: orders.h:26
#define RDP_ORDER_STANDARD
Definition: orders.h:20
#define RDP_ORDER_LASTBOUNDS
Definition: orders.h:25
#define RDP_ORDER_DELTA
Definition: orders.h:24
#define ID_MASK
Definition: orders.h:325
#define PERSIST
Definition: orders.h:328
#define MODE_MASK
Definition: orders.h:326
#define LONG_FORMAT
Definition: orders.h:333
@ RDP_ORDER_RAW_BMPCACHE2
Definition: orders.h:53
@ RDP_ORDER_BRUSHCACHE
Definition: orders.h:55
@ RDP_ORDER_BMPCACHE2
Definition: orders.h:54
@ RDP_ORDER_COLCACHE
Definition: orders.h:50
@ RDP_ORDER_FONTCACHE
Definition: orders.h:52
@ RDP_ORDER_RAW_BMPCACHE
Definition: orders.h:49
@ RDP_ORDER_BMPCACHE
Definition: orders.h:51
#define SQUARE
Definition: orders.h:327
#define s_check(s)
Definition: parse.h:42
#define in_uint16_le(s, v)
Definition: parse.h:55
#define in_uint8p(s, v, n)
Definition: parse.h:89
#define in_uint8a(s, v, n)
Definition: parse.h:90
#define in_uint8s(s, n)
Definition: parse.h:91
#define in_uint8(s, v)
Definition: parse.h:88
#define in_uint16_be(s, v)
Definition: parse.h:75
#define in_uint32_le(s, v)
Definition: parse.h:56
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy)
void ui_rect(int x, int y, int cx, int cy, int colour)
Definition: uimain.c:573
void xfree(void *mem)
Definition: uimain.c:758
void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
Definition: uimain.c:597
RD_HBITMAP ui_create_bitmap(int width, int height, uint8 *data)
Definition: uimain.c:277
RD_BOOL pstcache_save_bitmap(uint8 cache_id, uint16 cache_idx, uint8 *key, uint8 width, uint8 height, uint16 length, uint8 *data)
Definition: pstcache.c:82
void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
Definition: uimain.c:671
void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
Definition: uimain.c:581
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
Definition: uimain.c:567
void ui_ellipse(uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
Definition: uimain.c:699
RD_HGLYPH ui_create_glyph(int width, int height, uint8 *data)
Definition: uimain.c:234
void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH *brush, int bgcolour, int fgcolour, uint8 *text, uint8 length)
Definition: uimain.c:412
void ui_set_colourmap(RD_HCOLOURMAP map)
Definition: qtewin.cpp:1527
void unimpl(char *format,...)
Definition: uimain.c:801
void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
Definition: uimain.c:513
void ui_destblt(uint8 opcode, int x, int y, int cx, int cy)
Definition: uimain.c:607
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
Definition: uimain.c:561
void ui_set_clip(int x, int y, int cx, int cy)
Definition: uimain.c:320
void ui_reset_clip(void)
Definition: uimain.c:328
void ui_polyline(uint8 opcode, RD_POINT *points, int npoints, PEN *pen)
Definition: uimain.c:679
void * xmalloc(int size)
Definition: uimain.c:747
RD_HCOLOURMAP ui_create_colourmap(COLOURMAP *colours)
Definition: uimain.c:336
void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
#define DEBUG(args)
Definition: rdesktop.h:129
unsigned short uint16
Definition: types.h:30
unsigned int uint32
Definition: types.h:32
signed char sint8
Definition: types.h:29
struct _RD_POINT RD_POINT
#define False
Definition: types.h:25
signed short sint16
Definition: types.h:31
@ RDP_V5
Definition: types.h:44
enum _RDP_VERSION RDP_VERSION
int RD_BOOL
Definition: types.h:21
#define True
Definition: types.h:24
unsigned char uint8
Definition: types.h:28
#define index(s, c)
Definition: various.h:29
Definition: brush.hpp:16
Definition: _map.h:48
static SIZE_T datasize
Definition: asm.c:30
#define NULL
Definition: types.h:112
DWORD bpp
Definition: surface.c:185
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
GLuint coord
Definition: glext.h:9511
GLuint index
Definition: glext.h:6031
GLuint in
Definition: glext.h:9616
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLsizei const GLfloat * points
Definition: glext.h:8112
GLintptr offset
Definition: glext.h:5920
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define bits
Definition: infblock.c:15
uint32_t entry
Definition: isohybrid.c:63
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define shift
Definition: input.c:1755
Definition: mk_font.cpp:20
static unsigned __int64 next
Definition: rand_nt.c:6
static FILE * out
Definition: regtests2xml.c:44
#define warning(s)
Definition: debug.h:83
#define memset(x, y, z)
Definition: compat.h:39
Definition: types.h:73
sint16 left
Definition: types.h:74
sint16 top
Definition: types.h:75
sint16 right
Definition: types.h:76
sint16 bottom
Definition: types.h:77
uint32 data_size
Definition: types.h:95
uint8 * data
Definition: types.h:96
uint32 colour_code
Definition: types.h:94
sint16 top
Definition: orders.h:125
uint8 action
Definition: orders.h:128
sint16 left
Definition: orders.h:124
sint16 right
Definition: orders.h:126
uint32 offset
Definition: orders.h:123
sint16 bottom
Definition: orders.h:127
sint16 cy
Definition: orders.h:63
sint16 y
Definition: orders.h:61
sint16 x
Definition: orders.h:60
uint8 opcode
Definition: orders.h:64
sint16 cx
Definition: orders.h:62
sint16 top
Definition: orders.h:230
uint8 fillmode
Definition: orders.h:234
sint16 bottom
Definition: orders.h:232
uint32 bgcolour
Definition: orders.h:236
uint8 opcode
Definition: orders.h:233
sint16 right
Definition: orders.h:231
uint32 fgcolour
Definition: orders.h:237
sint16 left
Definition: orders.h:229
BRUSH brush
Definition: orders.h:235
sint16 left
Definition: orders.h:216
sint16 top
Definition: orders.h:217
sint16 bottom
Definition: orders.h:219
uint8 fillmode
Definition: orders.h:221
uint8 opcode
Definition: orders.h:220
uint32 fgcolour
Definition: orders.h:222
sint16 right
Definition: orders.h:218
uint8 opcode
Definition: orders.h:104
uint16 mixmode
Definition: orders.h:98
sint16 startx
Definition: orders.h:99
PEN pen
Definition: orders.h:105
sint16 endy
Definition: orders.h:102
sint16 endx
Definition: orders.h:101
sint16 starty
Definition: orders.h:100
uint32 bgcolour
Definition: orders.h:103
uint8 opcode
Definition: orders.h:161
uint8 cache_id
Definition: orders.h:156
uint8 colour_table
Definition: orders.h:155
sint16 srcy
Definition: orders.h:163
sint16 y
Definition: orders.h:158
sint16 cx
Definition: orders.h:159
sint16 cy
Definition: orders.h:160
sint16 x
Definition: orders.h:157
uint16 cache_idx
Definition: orders.h:164
sint16 srcx
Definition: orders.h:162
BRUSH brush
Definition: orders.h:78
sint16 y
Definition: orders.h:72
uint32 fgcolour
Definition: orders.h:77
sint16 cy
Definition: orders.h:74
uint32 bgcolour
Definition: orders.h:76
sint16 x
Definition: orders.h:71
uint8 opcode
Definition: orders.h:75
sint16 cx
Definition: orders.h:73
Definition: types.h:83
uint8 style
Definition: types.h:84
uint8 width
Definition: types.h:85
uint32 colour
Definition: types.h:86
sint16 y
Definition: orders.h:188
uint8 npoints
Definition: orders.h:194
uint8 fillmode
Definition: orders.h:190
uint32 bgcolour
Definition: orders.h:191
BRUSH brush
Definition: orders.h:193
uint8 opcode
Definition: orders.h:189
uint8 data[MAX_DATA]
Definition: orders.h:196
sint16 x
Definition: orders.h:187
uint8 datasize
Definition: orders.h:195
uint32 fgcolour
Definition: orders.h:192
sint16 x
Definition: orders.h:173
uint8 data[MAX_DATA]
Definition: orders.h:180
uint8 opcode
Definition: orders.h:175
uint8 datasize
Definition: orders.h:179
uint8 npoints
Definition: orders.h:178
uint32 fgcolour
Definition: orders.h:177
uint8 fillmode
Definition: orders.h:176
sint16 y
Definition: orders.h:174
uint8 lines
Definition: orders.h:207
sint16 y
Definition: orders.h:204
sint16 x
Definition: orders.h:203
uint32 fgcolour
Definition: orders.h:206
uint8 datasize
Definition: orders.h:208
uint8 data[MAX_DATA]
Definition: orders.h:209
uint8 opcode
Definition: orders.h:205
ELLIPSE2_ORDER ellipse2
Definition: orders.h:286
DESKSAVE_ORDER desksave
Definition: orders.h:279
BOUNDS bounds
Definition: orders.h:272
POLYGON_ORDER polygon
Definition: orders.h:282
DESTBLT_ORDER destblt
Definition: orders.h:274
RECT_ORDER rect
Definition: orders.h:278
MEMBLT_ORDER memblt
Definition: orders.h:280
LINE_ORDER line
Definition: orders.h:277
TRIBLT_ORDER triblt
Definition: orders.h:281
POLYGON2_ORDER polygon2
Definition: orders.h:283
PATBLT_ORDER patblt
Definition: orders.h:275
POLYLINE_ORDER polyline
Definition: orders.h:284
SCREENBLT_ORDER screenblt
Definition: orders.h:276
ELLIPSE_ORDER ellipse
Definition: orders.h:285
TEXT2_ORDER text2
Definition: orders.h:287
uint8 order_type
Definition: orders.h:271
sint16 cx
Definition: orders.h:114
sint16 x
Definition: orders.h:112
sint16 cy
Definition: orders.h:115
uint32 colour
Definition: orders.h:116
sint16 y
Definition: orders.h:113
sint16 x
Definition: orders.h:85
sint16 cx
Definition: orders.h:87
sint16 srcx
Definition: orders.h:90
sint16 cy
Definition: orders.h:88
uint8 opcode
Definition: orders.h:89
sint16 srcy
Definition: orders.h:91
sint16 y
Definition: orders.h:86
uint8 text[MAX_TEXT]
Definition: orders.h:264
uint8 flags
Definition: orders.h:247
sint16 boxbottom
Definition: orders.h:259
sint16 cliptop
Definition: orders.h:253
uint8 mixmode
Definition: orders.h:249
uint32 bgcolour
Definition: orders.h:250
sint16 boxleft
Definition: orders.h:256
sint16 clipleft
Definition: orders.h:252
uint32 fgcolour
Definition: orders.h:251
sint16 y
Definition: orders.h:262
sint16 x
Definition: orders.h:261
sint16 clipright
Definition: orders.h:254
sint16 clipbottom
Definition: orders.h:255
sint16 boxtop
Definition: orders.h:257
uint8 length
Definition: orders.h:263
uint8 opcode
Definition: orders.h:248
sint16 boxright
Definition: orders.h:258
uint8 font
Definition: orders.h:246
BRUSH brush
Definition: orders.h:260
sint16 srcx
Definition: orders.h:142
uint16 cache_idx
Definition: orders.h:147
BRUSH brush
Definition: orders.h:146
sint16 cx
Definition: orders.h:139
sint16 srcy
Definition: orders.h:143
uint8 opcode
Definition: orders.h:141
uint8 colour_table
Definition: orders.h:135
sint16 cy
Definition: orders.h:140
uint32 bgcolour
Definition: orders.h:144
uint8 cache_id
Definition: orders.h:136
sint16 y
Definition: orders.h:138
uint16 unknown
Definition: orders.h:148
uint32 fgcolour
Definition: orders.h:145
sint16 x
Definition: orders.h:137
Definition: uimain.c:89
Definition: parse.h:23
static int processed(const type_t *type)
Definition: typegen.c:2254
Definition: pdh_main.c:94