/src/FreeRDP/libfreerdp/core/message.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /**  | 
2  |  |  * FreeRDP: A Remote Desktop Protocol Implementation  | 
3  |  |  * Asynchronous Message Queue  | 
4  |  |  *  | 
5  |  |  * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>  | 
6  |  |  * Copyright 2017 Armin Novak <armin.novak@thincast.com>  | 
7  |  |  * Copyright 2017 Thincast Technologies GmbH  | 
8  |  |  *  | 
9  |  |  * Licensed under the Apache License, Version 2.0 (the "License");  | 
10  |  |  * you may not use this file except in compliance with the License.  | 
11  |  |  * You may obtain a copy of the License at  | 
12  |  |  *  | 
13  |  |  *     http://www.apache.org/licenses/LICENSE-2.0  | 
14  |  |  *  | 
15  |  |  * Unless required by applicable law or agreed to in writing, software  | 
16  |  |  * distributed under the License is distributed on an "AS IS" BASIS,  | 
17  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
18  |  |  * See the License for the specific language governing permissions and  | 
19  |  |  * limitations under the License.  | 
20  |  |  */  | 
21  |  |  | 
22  |  | #include <freerdp/config.h>  | 
23  |  |  | 
24  |  | #include <winpr/assert.h>  | 
25  |  |  | 
26  |  | #include "rdp.h"  | 
27  |  | #include "message.h"  | 
28  |  | #include "transport.h"  | 
29  |  |  | 
30  |  | #include <freerdp/log.h>  | 
31  |  | #include <freerdp/freerdp.h>  | 
32  |  |  | 
33  |  | #include <winpr/crt.h>  | 
34  |  | #include <winpr/stream.h>  | 
35  |  | #include <winpr/collections.h>  | 
36  |  |  | 
37  |  | #include "../cache/pointer.h"  | 
38  |  | #include "../cache/bitmap.h"  | 
39  |  | #include "../cache/palette.h"  | 
40  |  | #include "../cache/glyph.h"  | 
41  |  | #include "../cache/brush.h"  | 
42  |  | #include "../cache/cache.h"  | 
43  |  |  | 
44  |  | #define TAG FREERDP_TAG("core.message") | 
45  |  |  | 
46  |  | /* Update */  | 
47  |  |  | 
48  |  | static BOOL update_message_BeginPaint(rdpContext* context)  | 
49  | 0  | { | 
50  | 0  |   rdp_update_internal* up = NULL;  | 
51  |  | 
  | 
52  | 0  |   if (!context || !context->update)  | 
53  | 0  |     return FALSE;  | 
54  |  |  | 
55  | 0  |   up = update_cast(context->update);  | 
56  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, BeginPaint), NULL,  | 
57  | 0  |                            NULL);  | 
58  | 0  | }  | 
59  |  |  | 
60  |  | static BOOL update_message_EndPaint(rdpContext* context)  | 
61  | 0  | { | 
62  | 0  |   rdp_update_internal* up = NULL;  | 
63  |  | 
  | 
64  | 0  |   if (!context || !context->update)  | 
65  | 0  |     return FALSE;  | 
66  |  |  | 
67  | 0  |   up = update_cast(context->update);  | 
68  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, EndPaint), NULL,  | 
69  | 0  |                            NULL);  | 
70  | 0  | }  | 
71  |  |  | 
72  |  | static BOOL update_message_SetBounds(rdpContext* context, const rdpBounds* bounds)  | 
73  | 0  | { | 
74  | 0  |   rdpBounds* wParam = NULL;  | 
75  | 0  |   rdp_update_internal* up = NULL;  | 
76  |  | 
  | 
77  | 0  |   if (!context || !context->update)  | 
78  | 0  |     return FALSE;  | 
79  |  |  | 
80  | 0  |   if (bounds)  | 
81  | 0  |   { | 
82  | 0  |     wParam = (rdpBounds*)malloc(sizeof(rdpBounds));  | 
83  |  | 
  | 
84  | 0  |     if (!wParam)  | 
85  | 0  |       return FALSE;  | 
86  |  |  | 
87  | 0  |     CopyMemory(wParam, bounds, sizeof(rdpBounds));  | 
88  | 0  |   }  | 
89  |  |  | 
90  | 0  |   up = update_cast(context->update);  | 
91  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, SetBounds),  | 
92  | 0  |                            (void*)wParam, NULL);  | 
93  | 0  | }  | 
94  |  |  | 
95  |  | static BOOL update_message_Synchronize(rdpContext* context)  | 
96  | 0  | { | 
97  | 0  |   rdp_update_internal* up = NULL;  | 
98  |  | 
  | 
99  | 0  |   if (!context || !context->update)  | 
100  | 0  |     return FALSE;  | 
101  |  |  | 
102  | 0  |   up = update_cast(context->update);  | 
103  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, Synchronize), NULL,  | 
104  | 0  |                            NULL);  | 
105  | 0  | }  | 
106  |  |  | 
107  |  | static BOOL update_message_DesktopResize(rdpContext* context)  | 
108  | 0  | { | 
109  | 0  |   rdp_update_internal* up = NULL;  | 
110  |  | 
  | 
111  | 0  |   if (!context || !context->update)  | 
112  | 0  |     return FALSE;  | 
113  |  |  | 
114  | 0  |   up = update_cast(context->update);  | 
115  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, DesktopResize), NULL,  | 
116  | 0  |                            NULL);  | 
117  | 0  | }  | 
118  |  |  | 
119  |  | static BOOL update_message_BitmapUpdate(rdpContext* context, const BITMAP_UPDATE* bitmap)  | 
120  | 0  | { | 
121  | 0  |   BITMAP_UPDATE* wParam = NULL;  | 
122  | 0  |   rdp_update_internal* up = NULL;  | 
123  |  | 
  | 
124  | 0  |   if (!context || !context->update || !bitmap)  | 
125  | 0  |     return FALSE;  | 
126  |  |  | 
127  | 0  |   wParam = copy_bitmap_update(context, bitmap);  | 
128  |  | 
  | 
129  | 0  |   if (!wParam)  | 
130  | 0  |     return FALSE;  | 
131  |  |  | 
132  | 0  |   up = update_cast(context->update);  | 
133  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, BitmapUpdate),  | 
134  | 0  |                            (void*)wParam, NULL);  | 
135  | 0  | }  | 
136  |  |  | 
137  |  | static BOOL update_message_Palette(rdpContext* context, const PALETTE_UPDATE* palette)  | 
138  | 0  | { | 
139  | 0  |   PALETTE_UPDATE* wParam = NULL;  | 
140  | 0  |   rdp_update_internal* up = NULL;  | 
141  |  | 
  | 
142  | 0  |   if (!context || !context->update || !palette)  | 
143  | 0  |     return FALSE;  | 
144  |  |  | 
145  | 0  |   wParam = copy_palette_update(context, palette);  | 
146  |  | 
  | 
147  | 0  |   if (!wParam)  | 
148  | 0  |     return FALSE;  | 
149  |  |  | 
150  | 0  |   up = update_cast(context->update);  | 
151  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, Palette),  | 
152  | 0  |                            (void*)wParam, NULL);  | 
153  | 0  | }  | 
154  |  |  | 
155  |  | static BOOL update_message_PlaySound(rdpContext* context, const PLAY_SOUND_UPDATE* playSound)  | 
156  | 0  | { | 
157  | 0  |   PLAY_SOUND_UPDATE* wParam = NULL;  | 
158  | 0  |   rdp_update_internal* up = NULL;  | 
159  |  | 
  | 
160  | 0  |   if (!context || !context->update || !playSound)  | 
161  | 0  |     return FALSE;  | 
162  |  |  | 
163  | 0  |   wParam = (PLAY_SOUND_UPDATE*)malloc(sizeof(PLAY_SOUND_UPDATE));  | 
164  |  | 
  | 
165  | 0  |   if (!wParam)  | 
166  | 0  |     return FALSE;  | 
167  |  |  | 
168  | 0  |   CopyMemory(wParam, playSound, sizeof(PLAY_SOUND_UPDATE));  | 
169  |  | 
  | 
170  | 0  |   up = update_cast(context->update);  | 
171  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, PlaySound),  | 
172  | 0  |                            (void*)wParam, NULL);  | 
173  | 0  | }  | 
174  |  |  | 
175  |  | static BOOL update_message_SetKeyboardIndicators(rdpContext* context, UINT16 led_flags)  | 
176  | 0  | { | 
177  | 0  |   rdp_update_internal* up = NULL;  | 
178  |  | 
  | 
179  | 0  |   if (!context || !context->update)  | 
180  | 0  |     return FALSE;  | 
181  |  |  | 
182  | 0  |   up = update_cast(context->update);  | 
183  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
184  | 0  |                            MakeMessageId(Update, SetKeyboardIndicators), (void*)(size_t)led_flags,  | 
185  | 0  |                            NULL);  | 
186  | 0  | }  | 
187  |  |  | 
188  |  | static BOOL update_message_SetKeyboardImeStatus(rdpContext* context, UINT16 imeId, UINT32 imeState,  | 
189  |  |                                                 UINT32 imeConvMode)  | 
190  | 0  | { | 
191  | 0  |   rdp_update_internal* up = NULL;  | 
192  |  | 
  | 
193  | 0  |   if (!context || !context->update)  | 
194  | 0  |     return FALSE;  | 
195  |  |  | 
196  | 0  |   up = update_cast(context->update);  | 
197  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, SetKeyboardImeStatus),  | 
198  | 0  |                            (void*)(size_t)((imeId << 16UL) | imeState),  | 
199  | 0  |                            (void*)(size_t)imeConvMode);  | 
200  | 0  | }  | 
201  |  |  | 
202  |  | static BOOL update_message_RefreshRect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)  | 
203  | 0  | { | 
204  | 0  |   RECTANGLE_16* lParam = NULL;  | 
205  | 0  |   rdp_update_internal* up = NULL;  | 
206  |  | 
  | 
207  | 0  |   if (!context || !context->update || !areas)  | 
208  | 0  |     return FALSE;  | 
209  |  |  | 
210  | 0  |   lParam = (RECTANGLE_16*)calloc(count, sizeof(RECTANGLE_16));  | 
211  |  | 
  | 
212  | 0  |   if (!lParam)  | 
213  | 0  |     return FALSE;  | 
214  |  |  | 
215  | 0  |   CopyMemory(lParam, areas, sizeof(RECTANGLE_16) * count);  | 
216  |  | 
  | 
217  | 0  |   up = update_cast(context->update);  | 
218  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, RefreshRect),  | 
219  | 0  |                            (void*)(size_t)count, (void*)lParam);  | 
220  | 0  | }  | 
221  |  |  | 
222  |  | static BOOL update_message_SuppressOutput(rdpContext* context, BYTE allow, const RECTANGLE_16* area)  | 
223  | 0  | { | 
224  | 0  |   RECTANGLE_16* lParam = NULL;  | 
225  | 0  |   rdp_update_internal* up = NULL;  | 
226  |  | 
  | 
227  | 0  |   if (!context || !context->update)  | 
228  | 0  |     return FALSE;  | 
229  |  |  | 
230  | 0  |   if (area)  | 
231  | 0  |   { | 
232  | 0  |     lParam = (RECTANGLE_16*)malloc(sizeof(RECTANGLE_16));  | 
233  |  | 
  | 
234  | 0  |     if (!lParam)  | 
235  | 0  |       return FALSE;  | 
236  |  |  | 
237  | 0  |     CopyMemory(lParam, area, sizeof(RECTANGLE_16));  | 
238  | 0  |   }  | 
239  |  |  | 
240  | 0  |   up = update_cast(context->update);  | 
241  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, SuppressOutput),  | 
242  | 0  |                            (void*)(size_t)allow, (void*)lParam);  | 
243  | 0  | }  | 
244  |  |  | 
245  |  | static BOOL update_message_SurfaceCommand(rdpContext* context, wStream* s)  | 
246  | 0  | { | 
247  | 0  |   wStream* wParam = NULL;  | 
248  | 0  |   rdp_update_internal* up = NULL;  | 
249  |  | 
  | 
250  | 0  |   if (!context || !context->update || !s)  | 
251  | 0  |     return FALSE;  | 
252  |  |  | 
253  | 0  |   wParam = Stream_New(NULL, Stream_GetRemainingLength(s));  | 
254  |  | 
  | 
255  | 0  |   if (!wParam)  | 
256  | 0  |     return FALSE;  | 
257  |  |  | 
258  | 0  |   Stream_Copy(s, wParam, Stream_GetRemainingLength(s));  | 
259  | 0  |   Stream_SetPosition(wParam, 0);  | 
260  |  | 
  | 
261  | 0  |   up = update_cast(context->update);  | 
262  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, SurfaceCommand),  | 
263  | 0  |                            (void*)wParam, NULL);  | 
264  | 0  | }  | 
265  |  |  | 
266  |  | static BOOL update_message_SurfaceBits(rdpContext* context,  | 
267  |  |                                        const SURFACE_BITS_COMMAND* surfaceBitsCommand)  | 
268  | 0  | { | 
269  | 0  |   SURFACE_BITS_COMMAND* wParam = NULL;  | 
270  | 0  |   rdp_update_internal* up = NULL;  | 
271  |  | 
  | 
272  | 0  |   if (!context || !context->update || !surfaceBitsCommand)  | 
273  | 0  |     return FALSE;  | 
274  |  |  | 
275  | 0  |   wParam = copy_surface_bits_command(context, surfaceBitsCommand);  | 
276  |  | 
  | 
277  | 0  |   if (!wParam)  | 
278  | 0  |     return FALSE;  | 
279  |  |  | 
280  | 0  |   up = update_cast(context->update);  | 
281  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, SurfaceBits),  | 
282  | 0  |                            (void*)wParam, NULL);  | 
283  | 0  | }  | 
284  |  |  | 
285  |  | static BOOL update_message_SurfaceFrameMarker(rdpContext* context,  | 
286  |  |                                               const SURFACE_FRAME_MARKER* surfaceFrameMarker)  | 
287  | 0  | { | 
288  | 0  |   SURFACE_FRAME_MARKER* wParam = NULL;  | 
289  | 0  |   rdp_update_internal* up = NULL;  | 
290  |  | 
  | 
291  | 0  |   if (!context || !context->update || !surfaceFrameMarker)  | 
292  | 0  |     return FALSE;  | 
293  |  |  | 
294  | 0  |   wParam = (SURFACE_FRAME_MARKER*)malloc(sizeof(SURFACE_FRAME_MARKER));  | 
295  |  | 
  | 
296  | 0  |   if (!wParam)  | 
297  | 0  |     return FALSE;  | 
298  |  |  | 
299  | 0  |   CopyMemory(wParam, surfaceFrameMarker, sizeof(SURFACE_FRAME_MARKER));  | 
300  |  | 
  | 
301  | 0  |   up = update_cast(context->update);  | 
302  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(Update, SurfaceFrameMarker),  | 
303  | 0  |                            (void*)wParam, NULL);  | 
304  | 0  | }  | 
305  |  |  | 
306  |  | static BOOL update_message_SurfaceFrameAcknowledge(rdpContext* context, UINT32 frameId)  | 
307  | 0  | { | 
308  | 0  |   rdp_update_internal* up = NULL;  | 
309  |  | 
  | 
310  | 0  |   if (!context || !context->update)  | 
311  | 0  |     return FALSE;  | 
312  |  |  | 
313  | 0  |   up = update_cast(context->update);  | 
314  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
315  | 0  |                            MakeMessageId(Update, SurfaceFrameAcknowledge), (void*)(size_t)frameId,  | 
316  | 0  |                            NULL);  | 
317  | 0  | }  | 
318  |  |  | 
319  |  | /* Primary Update */  | 
320  |  |  | 
321  |  | static BOOL update_message_DstBlt(rdpContext* context, const DSTBLT_ORDER* dstBlt)  | 
322  | 0  | { | 
323  | 0  |   DSTBLT_ORDER* wParam = NULL;  | 
324  | 0  |   rdp_update_internal* up = NULL;  | 
325  |  | 
  | 
326  | 0  |   if (!context || !context->update || !dstBlt)  | 
327  | 0  |     return FALSE;  | 
328  |  |  | 
329  | 0  |   wParam = (DSTBLT_ORDER*)malloc(sizeof(DSTBLT_ORDER));  | 
330  |  | 
  | 
331  | 0  |   if (!wParam)  | 
332  | 0  |     return FALSE;  | 
333  |  |  | 
334  | 0  |   CopyMemory(wParam, dstBlt, sizeof(DSTBLT_ORDER));  | 
335  |  | 
  | 
336  | 0  |   up = update_cast(context->update);  | 
337  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, DstBlt),  | 
338  | 0  |                            (void*)wParam, NULL);  | 
339  | 0  | }  | 
340  |  |  | 
341  |  | static BOOL update_message_PatBlt(rdpContext* context, PATBLT_ORDER* patBlt)  | 
342  | 0  | { | 
343  | 0  |   PATBLT_ORDER* wParam = NULL;  | 
344  | 0  |   rdp_update_internal* up = NULL;  | 
345  |  | 
  | 
346  | 0  |   if (!context || !context->update || !patBlt)  | 
347  | 0  |     return FALSE;  | 
348  |  |  | 
349  | 0  |   wParam = (PATBLT_ORDER*)malloc(sizeof(PATBLT_ORDER));  | 
350  |  | 
  | 
351  | 0  |   if (!wParam)  | 
352  | 0  |     return FALSE;  | 
353  |  |  | 
354  | 0  |   CopyMemory(wParam, patBlt, sizeof(PATBLT_ORDER));  | 
355  | 0  |   wParam->brush.data = (BYTE*)wParam->brush.p8x8;  | 
356  |  | 
  | 
357  | 0  |   up = update_cast(context->update);  | 
358  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, PatBlt),  | 
359  | 0  |                            (void*)wParam, NULL);  | 
360  | 0  | }  | 
361  |  |  | 
362  |  | static BOOL update_message_ScrBlt(rdpContext* context, const SCRBLT_ORDER* scrBlt)  | 
363  | 0  | { | 
364  | 0  |   SCRBLT_ORDER* wParam = NULL;  | 
365  | 0  |   rdp_update_internal* up = NULL;  | 
366  |  | 
  | 
367  | 0  |   if (!context || !context->update || !scrBlt)  | 
368  | 0  |     return FALSE;  | 
369  |  |  | 
370  | 0  |   wParam = (SCRBLT_ORDER*)malloc(sizeof(SCRBLT_ORDER));  | 
371  |  | 
  | 
372  | 0  |   if (!wParam)  | 
373  | 0  |     return FALSE;  | 
374  |  |  | 
375  | 0  |   CopyMemory(wParam, scrBlt, sizeof(SCRBLT_ORDER));  | 
376  |  | 
  | 
377  | 0  |   up = update_cast(context->update);  | 
378  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, ScrBlt),  | 
379  | 0  |                            (void*)wParam, NULL);  | 
380  | 0  | }  | 
381  |  |  | 
382  |  | static BOOL update_message_OpaqueRect(rdpContext* context, const OPAQUE_RECT_ORDER* opaqueRect)  | 
383  | 0  | { | 
384  | 0  |   OPAQUE_RECT_ORDER* wParam = NULL;  | 
385  | 0  |   rdp_update_internal* up = NULL;  | 
386  |  | 
  | 
387  | 0  |   if (!context || !context->update || !opaqueRect)  | 
388  | 0  |     return FALSE;  | 
389  |  |  | 
390  | 0  |   wParam = (OPAQUE_RECT_ORDER*)malloc(sizeof(OPAQUE_RECT_ORDER));  | 
391  |  | 
  | 
392  | 0  |   if (!wParam)  | 
393  | 0  |     return FALSE;  | 
394  |  |  | 
395  | 0  |   CopyMemory(wParam, opaqueRect, sizeof(OPAQUE_RECT_ORDER));  | 
396  |  | 
  | 
397  | 0  |   up = update_cast(context->update);  | 
398  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, OpaqueRect),  | 
399  | 0  |                            (void*)wParam, NULL);  | 
400  | 0  | }  | 
401  |  |  | 
402  |  | static BOOL update_message_DrawNineGrid(rdpContext* context,  | 
403  |  |                                         const DRAW_NINE_GRID_ORDER* drawNineGrid)  | 
404  | 0  | { | 
405  | 0  |   DRAW_NINE_GRID_ORDER* wParam = NULL;  | 
406  | 0  |   rdp_update_internal* up = NULL;  | 
407  |  | 
  | 
408  | 0  |   if (!context || !context->update || !drawNineGrid)  | 
409  | 0  |     return FALSE;  | 
410  |  |  | 
411  | 0  |   wParam = (DRAW_NINE_GRID_ORDER*)malloc(sizeof(DRAW_NINE_GRID_ORDER));  | 
412  |  | 
  | 
413  | 0  |   if (!wParam)  | 
414  | 0  |     return FALSE;  | 
415  |  |  | 
416  | 0  |   CopyMemory(wParam, drawNineGrid, sizeof(DRAW_NINE_GRID_ORDER));  | 
417  |  | 
  | 
418  | 0  |   up = update_cast(context->update);  | 
419  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, DrawNineGrid),  | 
420  | 0  |                            (void*)wParam, NULL);  | 
421  | 0  | }  | 
422  |  |  | 
423  |  | static BOOL update_message_MultiDstBlt(rdpContext* context, const MULTI_DSTBLT_ORDER* multiDstBlt)  | 
424  | 0  | { | 
425  | 0  |   MULTI_DSTBLT_ORDER* wParam = NULL;  | 
426  | 0  |   rdp_update_internal* up = NULL;  | 
427  |  | 
  | 
428  | 0  |   if (!context || !context->update || !multiDstBlt)  | 
429  | 0  |     return FALSE;  | 
430  |  |  | 
431  | 0  |   wParam = (MULTI_DSTBLT_ORDER*)malloc(sizeof(MULTI_DSTBLT_ORDER));  | 
432  |  | 
  | 
433  | 0  |   if (!wParam)  | 
434  | 0  |     return FALSE;  | 
435  |  |  | 
436  | 0  |   CopyMemory(wParam, multiDstBlt, sizeof(MULTI_DSTBLT_ORDER));  | 
437  |  | 
  | 
438  | 0  |   up = update_cast(context->update);  | 
439  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, MultiDstBlt),  | 
440  | 0  |                            (void*)wParam, NULL);  | 
441  | 0  | }  | 
442  |  |  | 
443  |  | static BOOL update_message_MultiPatBlt(rdpContext* context, const MULTI_PATBLT_ORDER* multiPatBlt)  | 
444  | 0  | { | 
445  | 0  |   MULTI_PATBLT_ORDER* wParam = NULL;  | 
446  | 0  |   rdp_update_internal* up = NULL;  | 
447  |  | 
  | 
448  | 0  |   if (!context || !context->update || !multiPatBlt)  | 
449  | 0  |     return FALSE;  | 
450  |  |  | 
451  | 0  |   wParam = (MULTI_PATBLT_ORDER*)malloc(sizeof(MULTI_PATBLT_ORDER));  | 
452  |  | 
  | 
453  | 0  |   if (!wParam)  | 
454  | 0  |     return FALSE;  | 
455  |  |  | 
456  | 0  |   CopyMemory(wParam, multiPatBlt, sizeof(MULTI_PATBLT_ORDER));  | 
457  | 0  |   wParam->brush.data = (BYTE*)wParam->brush.p8x8;  | 
458  |  | 
  | 
459  | 0  |   up = update_cast(context->update);  | 
460  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, MultiPatBlt),  | 
461  | 0  |                            (void*)wParam, NULL);  | 
462  | 0  | }  | 
463  |  |  | 
464  |  | static BOOL update_message_MultiScrBlt(rdpContext* context, const MULTI_SCRBLT_ORDER* multiScrBlt)  | 
465  | 0  | { | 
466  | 0  |   MULTI_SCRBLT_ORDER* wParam = NULL;  | 
467  | 0  |   rdp_update_internal* up = NULL;  | 
468  |  | 
  | 
469  | 0  |   if (!context || !context->update || !multiScrBlt)  | 
470  | 0  |     return FALSE;  | 
471  |  |  | 
472  | 0  |   wParam = (MULTI_SCRBLT_ORDER*)malloc(sizeof(MULTI_SCRBLT_ORDER));  | 
473  |  | 
  | 
474  | 0  |   if (!wParam)  | 
475  | 0  |     return FALSE;  | 
476  |  |  | 
477  | 0  |   CopyMemory(wParam, multiScrBlt, sizeof(MULTI_SCRBLT_ORDER));  | 
478  |  | 
  | 
479  | 0  |   up = update_cast(context->update);  | 
480  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, MultiScrBlt),  | 
481  | 0  |                            (void*)wParam, NULL);  | 
482  | 0  | }  | 
483  |  |  | 
484  |  | static BOOL update_message_MultiOpaqueRect(rdpContext* context,  | 
485  |  |                                            const MULTI_OPAQUE_RECT_ORDER* multiOpaqueRect)  | 
486  | 0  | { | 
487  | 0  |   MULTI_OPAQUE_RECT_ORDER* wParam = NULL;  | 
488  | 0  |   rdp_update_internal* up = NULL;  | 
489  |  | 
  | 
490  | 0  |   if (!context || !context->update || !multiOpaqueRect)  | 
491  | 0  |     return FALSE;  | 
492  |  |  | 
493  | 0  |   wParam = (MULTI_OPAQUE_RECT_ORDER*)malloc(sizeof(MULTI_OPAQUE_RECT_ORDER));  | 
494  |  | 
  | 
495  | 0  |   if (!wParam)  | 
496  | 0  |     return FALSE;  | 
497  |  |  | 
498  | 0  |   CopyMemory(wParam, multiOpaqueRect, sizeof(MULTI_OPAQUE_RECT_ORDER));  | 
499  |  | 
  | 
500  | 0  |   up = update_cast(context->update);  | 
501  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
502  | 0  |                            MakeMessageId(PrimaryUpdate, MultiOpaqueRect), (void*)wParam, NULL);  | 
503  | 0  | }  | 
504  |  |  | 
505  |  | static BOOL update_message_MultiDrawNineGrid(rdpContext* context,  | 
506  |  |                                              const MULTI_DRAW_NINE_GRID_ORDER* multiDrawNineGrid)  | 
507  | 0  | { | 
508  | 0  |   MULTI_DRAW_NINE_GRID_ORDER* wParam = NULL;  | 
509  | 0  |   rdp_update_internal* up = NULL;  | 
510  |  | 
  | 
511  | 0  |   if (!context || !context->update || !multiDrawNineGrid)  | 
512  | 0  |     return FALSE;  | 
513  |  |  | 
514  | 0  |   wParam = (MULTI_DRAW_NINE_GRID_ORDER*)malloc(sizeof(MULTI_DRAW_NINE_GRID_ORDER));  | 
515  |  | 
  | 
516  | 0  |   if (!wParam)  | 
517  | 0  |     return FALSE;  | 
518  |  |  | 
519  | 0  |   CopyMemory(wParam, multiDrawNineGrid, sizeof(MULTI_DRAW_NINE_GRID_ORDER));  | 
520  |  |   /* TODO: complete copy */  | 
521  |  | 
  | 
522  | 0  |   up = update_cast(context->update);  | 
523  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
524  | 0  |                            MakeMessageId(PrimaryUpdate, MultiDrawNineGrid), (void*)wParam, NULL);  | 
525  | 0  | }  | 
526  |  |  | 
527  |  | static BOOL update_message_LineTo(rdpContext* context, const LINE_TO_ORDER* lineTo)  | 
528  | 0  | { | 
529  | 0  |   LINE_TO_ORDER* wParam = NULL;  | 
530  | 0  |   rdp_update_internal* up = NULL;  | 
531  |  | 
  | 
532  | 0  |   if (!context || !context->update || !lineTo)  | 
533  | 0  |     return FALSE;  | 
534  |  |  | 
535  | 0  |   wParam = (LINE_TO_ORDER*)malloc(sizeof(LINE_TO_ORDER));  | 
536  |  | 
  | 
537  | 0  |   if (!wParam)  | 
538  | 0  |     return FALSE;  | 
539  |  |  | 
540  | 0  |   CopyMemory(wParam, lineTo, sizeof(LINE_TO_ORDER));  | 
541  |  | 
  | 
542  | 0  |   up = update_cast(context->update);  | 
543  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, LineTo),  | 
544  | 0  |                            (void*)wParam, NULL);  | 
545  | 0  | }  | 
546  |  |  | 
547  |  | static BOOL update_message_Polyline(rdpContext* context, const POLYLINE_ORDER* polyline)  | 
548  | 0  | { | 
549  | 0  |   POLYLINE_ORDER* wParam = NULL;  | 
550  | 0  |   rdp_update_internal* up = NULL;  | 
551  |  | 
  | 
552  | 0  |   if (!context || !context->update || !polyline)  | 
553  | 0  |     return FALSE;  | 
554  |  |  | 
555  | 0  |   wParam = (POLYLINE_ORDER*)malloc(sizeof(POLYLINE_ORDER));  | 
556  |  | 
  | 
557  | 0  |   if (!wParam)  | 
558  | 0  |     return FALSE;  | 
559  |  |  | 
560  | 0  |   CopyMemory(wParam, polyline, sizeof(POLYLINE_ORDER));  | 
561  | 0  |   wParam->points = (DELTA_POINT*)calloc(wParam->numDeltaEntries, sizeof(DELTA_POINT));  | 
562  |  | 
  | 
563  | 0  |   if (!wParam->points)  | 
564  | 0  |   { | 
565  | 0  |     free(wParam);  | 
566  | 0  |     return FALSE;  | 
567  | 0  |   }  | 
568  |  |  | 
569  | 0  |   CopyMemory(wParam->points, polyline->points, sizeof(DELTA_POINT) * wParam->numDeltaEntries);  | 
570  |  | 
  | 
571  | 0  |   up = update_cast(context->update);  | 
572  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, Polyline),  | 
573  | 0  |                            (void*)wParam, NULL);  | 
574  | 0  | }  | 
575  |  |  | 
576  |  | static BOOL update_message_MemBlt(rdpContext* context, MEMBLT_ORDER* memBlt)  | 
577  | 0  | { | 
578  | 0  |   MEMBLT_ORDER* wParam = NULL;  | 
579  | 0  |   rdp_update_internal* up = NULL;  | 
580  |  | 
  | 
581  | 0  |   if (!context || !context->update || !memBlt)  | 
582  | 0  |     return FALSE;  | 
583  |  |  | 
584  | 0  |   wParam = (MEMBLT_ORDER*)malloc(sizeof(MEMBLT_ORDER));  | 
585  |  | 
  | 
586  | 0  |   if (!wParam)  | 
587  | 0  |     return FALSE;  | 
588  |  |  | 
589  | 0  |   CopyMemory(wParam, memBlt, sizeof(MEMBLT_ORDER));  | 
590  |  | 
  | 
591  | 0  |   up = update_cast(context->update);  | 
592  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, MemBlt),  | 
593  | 0  |                            (void*)wParam, NULL);  | 
594  | 0  | }  | 
595  |  |  | 
596  |  | static BOOL update_message_Mem3Blt(rdpContext* context, MEM3BLT_ORDER* mem3Blt)  | 
597  | 0  | { | 
598  | 0  |   MEM3BLT_ORDER* wParam = NULL;  | 
599  | 0  |   rdp_update_internal* up = NULL;  | 
600  |  | 
  | 
601  | 0  |   if (!context || !context->update || !mem3Blt)  | 
602  | 0  |     return FALSE;  | 
603  |  |  | 
604  | 0  |   wParam = (MEM3BLT_ORDER*)malloc(sizeof(MEM3BLT_ORDER));  | 
605  |  | 
  | 
606  | 0  |   if (!wParam)  | 
607  | 0  |     return FALSE;  | 
608  |  |  | 
609  | 0  |   CopyMemory(wParam, mem3Blt, sizeof(MEM3BLT_ORDER));  | 
610  | 0  |   wParam->brush.data = (BYTE*)wParam->brush.p8x8;  | 
611  |  | 
  | 
612  | 0  |   up = update_cast(context->update);  | 
613  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, Mem3Blt),  | 
614  | 0  |                            (void*)wParam, NULL);  | 
615  | 0  | }  | 
616  |  |  | 
617  |  | static BOOL update_message_SaveBitmap(rdpContext* context, const SAVE_BITMAP_ORDER* saveBitmap)  | 
618  | 0  | { | 
619  | 0  |   SAVE_BITMAP_ORDER* wParam = NULL;  | 
620  | 0  |   rdp_update_internal* up = NULL;  | 
621  |  | 
  | 
622  | 0  |   if (!context || !context->update || !saveBitmap)  | 
623  | 0  |     return FALSE;  | 
624  |  |  | 
625  | 0  |   wParam = (SAVE_BITMAP_ORDER*)malloc(sizeof(SAVE_BITMAP_ORDER));  | 
626  |  | 
  | 
627  | 0  |   if (!wParam)  | 
628  | 0  |     return FALSE;  | 
629  |  |  | 
630  | 0  |   CopyMemory(wParam, saveBitmap, sizeof(SAVE_BITMAP_ORDER));  | 
631  |  | 
  | 
632  | 0  |   up = update_cast(context->update);  | 
633  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, SaveBitmap),  | 
634  | 0  |                            (void*)wParam, NULL);  | 
635  | 0  | }  | 
636  |  |  | 
637  |  | static BOOL update_message_GlyphIndex(rdpContext* context, GLYPH_INDEX_ORDER* glyphIndex)  | 
638  | 0  | { | 
639  | 0  |   GLYPH_INDEX_ORDER* wParam = NULL;  | 
640  | 0  |   rdp_update_internal* up = NULL;  | 
641  |  | 
  | 
642  | 0  |   if (!context || !context->update || !glyphIndex)  | 
643  | 0  |     return FALSE;  | 
644  |  |  | 
645  | 0  |   wParam = (GLYPH_INDEX_ORDER*)malloc(sizeof(GLYPH_INDEX_ORDER));  | 
646  |  | 
  | 
647  | 0  |   if (!wParam)  | 
648  | 0  |     return FALSE;  | 
649  |  |  | 
650  | 0  |   CopyMemory(wParam, glyphIndex, sizeof(GLYPH_INDEX_ORDER));  | 
651  | 0  |   wParam->brush.data = (BYTE*)wParam->brush.p8x8;  | 
652  |  | 
  | 
653  | 0  |   up = update_cast(context->update);  | 
654  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, GlyphIndex),  | 
655  | 0  |                            (void*)wParam, NULL);  | 
656  | 0  | }  | 
657  |  |  | 
658  |  | static BOOL update_message_FastIndex(rdpContext* context, const FAST_INDEX_ORDER* fastIndex)  | 
659  | 0  | { | 
660  | 0  |   FAST_INDEX_ORDER* wParam = NULL;  | 
661  | 0  |   rdp_update_internal* up = NULL;  | 
662  |  | 
  | 
663  | 0  |   if (!context || !context->update || !fastIndex)  | 
664  | 0  |     return FALSE;  | 
665  |  |  | 
666  | 0  |   wParam = (FAST_INDEX_ORDER*)malloc(sizeof(FAST_INDEX_ORDER));  | 
667  |  | 
  | 
668  | 0  |   if (!wParam)  | 
669  | 0  |     return FALSE;  | 
670  |  |  | 
671  | 0  |   CopyMemory(wParam, fastIndex, sizeof(FAST_INDEX_ORDER));  | 
672  |  | 
  | 
673  | 0  |   up = update_cast(context->update);  | 
674  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, FastIndex),  | 
675  | 0  |                            (void*)wParam, NULL);  | 
676  | 0  | }  | 
677  |  |  | 
678  |  | static BOOL update_message_FastGlyph(rdpContext* context, const FAST_GLYPH_ORDER* fastGlyph)  | 
679  | 0  | { | 
680  | 0  |   FAST_GLYPH_ORDER* wParam = NULL;  | 
681  | 0  |   rdp_update_internal* up = NULL;  | 
682  |  | 
  | 
683  | 0  |   if (!context || !context->update || !fastGlyph)  | 
684  | 0  |     return FALSE;  | 
685  |  |  | 
686  | 0  |   wParam = (FAST_GLYPH_ORDER*)malloc(sizeof(FAST_GLYPH_ORDER));  | 
687  |  | 
  | 
688  | 0  |   if (!wParam)  | 
689  | 0  |     return FALSE;  | 
690  |  |  | 
691  | 0  |   CopyMemory(wParam, fastGlyph, sizeof(FAST_GLYPH_ORDER));  | 
692  |  | 
  | 
693  | 0  |   if (wParam->cbData > 1)  | 
694  | 0  |   { | 
695  | 0  |     wParam->glyphData.aj = (BYTE*)malloc(fastGlyph->glyphData.cb);  | 
696  |  | 
  | 
697  | 0  |     if (!wParam->glyphData.aj)  | 
698  | 0  |     { | 
699  | 0  |       free(wParam);  | 
700  | 0  |       return FALSE;  | 
701  | 0  |     }  | 
702  |  |  | 
703  | 0  |     CopyMemory(wParam->glyphData.aj, fastGlyph->glyphData.aj, fastGlyph->glyphData.cb);  | 
704  | 0  |   }  | 
705  | 0  |   else  | 
706  | 0  |   { | 
707  | 0  |     wParam->glyphData.aj = NULL;  | 
708  | 0  |   }  | 
709  |  |  | 
710  | 0  |   up = update_cast(context->update);  | 
711  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, FastGlyph),  | 
712  | 0  |                            (void*)wParam, NULL);  | 
713  | 0  | }  | 
714  |  |  | 
715  |  | static BOOL update_message_PolygonSC(rdpContext* context, const POLYGON_SC_ORDER* polygonSC)  | 
716  | 0  | { | 
717  | 0  |   POLYGON_SC_ORDER* wParam = NULL;  | 
718  | 0  |   rdp_update_internal* up = NULL;  | 
719  |  | 
  | 
720  | 0  |   if (!context || !context->update || !polygonSC)  | 
721  | 0  |     return FALSE;  | 
722  |  |  | 
723  | 0  |   wParam = (POLYGON_SC_ORDER*)malloc(sizeof(POLYGON_SC_ORDER));  | 
724  |  | 
  | 
725  | 0  |   if (!wParam)  | 
726  | 0  |     return FALSE;  | 
727  |  |  | 
728  | 0  |   CopyMemory(wParam, polygonSC, sizeof(POLYGON_SC_ORDER));  | 
729  | 0  |   wParam->points = (DELTA_POINT*)calloc(wParam->numPoints, sizeof(DELTA_POINT));  | 
730  |  | 
  | 
731  | 0  |   if (!wParam->points)  | 
732  | 0  |   { | 
733  | 0  |     free(wParam);  | 
734  | 0  |     return FALSE;  | 
735  | 0  |   }  | 
736  |  |  | 
737  | 0  |   CopyMemory(wParam->points, polygonSC, sizeof(DELTA_POINT) * wParam->numPoints);  | 
738  |  | 
  | 
739  | 0  |   up = update_cast(context->update);  | 
740  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, PolygonSC),  | 
741  | 0  |                            (void*)wParam, NULL);  | 
742  | 0  | }  | 
743  |  |  | 
744  |  | static BOOL update_message_PolygonCB(rdpContext* context, POLYGON_CB_ORDER* polygonCB)  | 
745  | 0  | { | 
746  | 0  |   POLYGON_CB_ORDER* wParam = NULL;  | 
747  | 0  |   rdp_update_internal* up = NULL;  | 
748  |  | 
  | 
749  | 0  |   if (!context || !context->update || !polygonCB)  | 
750  | 0  |     return FALSE;  | 
751  |  |  | 
752  | 0  |   wParam = (POLYGON_CB_ORDER*)malloc(sizeof(POLYGON_CB_ORDER));  | 
753  |  | 
  | 
754  | 0  |   if (!wParam)  | 
755  | 0  |     return FALSE;  | 
756  |  |  | 
757  | 0  |   CopyMemory(wParam, polygonCB, sizeof(POLYGON_CB_ORDER));  | 
758  | 0  |   wParam->points = (DELTA_POINT*)calloc(wParam->numPoints, sizeof(DELTA_POINT));  | 
759  |  | 
  | 
760  | 0  |   if (!wParam->points)  | 
761  | 0  |   { | 
762  | 0  |     free(wParam);  | 
763  | 0  |     return FALSE;  | 
764  | 0  |   }  | 
765  |  |  | 
766  | 0  |   CopyMemory(wParam->points, polygonCB, sizeof(DELTA_POINT) * wParam->numPoints);  | 
767  | 0  |   wParam->brush.data = (BYTE*)wParam->brush.p8x8;  | 
768  |  | 
  | 
769  | 0  |   up = update_cast(context->update);  | 
770  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, PolygonCB),  | 
771  | 0  |                            (void*)wParam, NULL);  | 
772  | 0  | }  | 
773  |  |  | 
774  |  | static BOOL update_message_EllipseSC(rdpContext* context, const ELLIPSE_SC_ORDER* ellipseSC)  | 
775  | 0  | { | 
776  | 0  |   ELLIPSE_SC_ORDER* wParam = NULL;  | 
777  | 0  |   rdp_update_internal* up = NULL;  | 
778  |  | 
  | 
779  | 0  |   if (!context || !context->update || !ellipseSC)  | 
780  | 0  |     return FALSE;  | 
781  |  |  | 
782  | 0  |   wParam = (ELLIPSE_SC_ORDER*)malloc(sizeof(ELLIPSE_SC_ORDER));  | 
783  |  | 
  | 
784  | 0  |   if (!wParam)  | 
785  | 0  |     return FALSE;  | 
786  |  |  | 
787  | 0  |   CopyMemory(wParam, ellipseSC, sizeof(ELLIPSE_SC_ORDER));  | 
788  |  | 
  | 
789  | 0  |   up = update_cast(context->update);  | 
790  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, EllipseSC),  | 
791  | 0  |                            (void*)wParam, NULL);  | 
792  | 0  | }  | 
793  |  |  | 
794  |  | static BOOL update_message_EllipseCB(rdpContext* context, const ELLIPSE_CB_ORDER* ellipseCB)  | 
795  | 0  | { | 
796  | 0  |   ELLIPSE_CB_ORDER* wParam = NULL;  | 
797  | 0  |   rdp_update_internal* up = NULL;  | 
798  |  | 
  | 
799  | 0  |   if (!context || !context->update || !ellipseCB)  | 
800  | 0  |     return FALSE;  | 
801  |  |  | 
802  | 0  |   wParam = (ELLIPSE_CB_ORDER*)malloc(sizeof(ELLIPSE_CB_ORDER));  | 
803  |  | 
  | 
804  | 0  |   if (!wParam)  | 
805  | 0  |     return FALSE;  | 
806  |  |  | 
807  | 0  |   CopyMemory(wParam, ellipseCB, sizeof(ELLIPSE_CB_ORDER));  | 
808  | 0  |   wParam->brush.data = (BYTE*)wParam->brush.p8x8;  | 
809  |  | 
  | 
810  | 0  |   up = update_cast(context->update);  | 
811  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PrimaryUpdate, EllipseCB),  | 
812  | 0  |                            (void*)wParam, NULL);  | 
813  | 0  | }  | 
814  |  |  | 
815  |  | /* Secondary Update */  | 
816  |  |  | 
817  |  | static BOOL update_message_CacheBitmap(rdpContext* context,  | 
818  |  |                                        const CACHE_BITMAP_ORDER* cacheBitmapOrder)  | 
819  | 0  | { | 
820  | 0  |   CACHE_BITMAP_ORDER* wParam = NULL;  | 
821  | 0  |   rdp_update_internal* up = NULL;  | 
822  |  | 
  | 
823  | 0  |   if (!context || !context->update || !cacheBitmapOrder)  | 
824  | 0  |     return FALSE;  | 
825  |  |  | 
826  | 0  |   wParam = copy_cache_bitmap_order(context, cacheBitmapOrder);  | 
827  |  | 
  | 
828  | 0  |   if (!wParam)  | 
829  | 0  |     return FALSE;  | 
830  |  |  | 
831  | 0  |   up = update_cast(context->update);  | 
832  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(SecondaryUpdate, CacheBitmap),  | 
833  | 0  |                            (void*)wParam, NULL);  | 
834  | 0  | }  | 
835  |  |  | 
836  |  | static BOOL update_message_CacheBitmapV2(rdpContext* context,  | 
837  |  |                                          CACHE_BITMAP_V2_ORDER* cacheBitmapV2Order)  | 
838  | 0  | { | 
839  | 0  |   CACHE_BITMAP_V2_ORDER* wParam = NULL;  | 
840  | 0  |   rdp_update_internal* up = NULL;  | 
841  |  | 
  | 
842  | 0  |   if (!context || !context->update || !cacheBitmapV2Order)  | 
843  | 0  |     return FALSE;  | 
844  |  |  | 
845  | 0  |   wParam = copy_cache_bitmap_v2_order(context, cacheBitmapV2Order);  | 
846  |  | 
  | 
847  | 0  |   if (!wParam)  | 
848  | 0  |     return FALSE;  | 
849  |  |  | 
850  | 0  |   up = update_cast(context->update);  | 
851  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
852  | 0  |                            MakeMessageId(SecondaryUpdate, CacheBitmapV2), (void*)wParam, NULL);  | 
853  | 0  | }  | 
854  |  |  | 
855  |  | static BOOL update_message_CacheBitmapV3(rdpContext* context,  | 
856  |  |                                          CACHE_BITMAP_V3_ORDER* cacheBitmapV3Order)  | 
857  | 0  | { | 
858  | 0  |   CACHE_BITMAP_V3_ORDER* wParam = NULL;  | 
859  | 0  |   rdp_update_internal* up = NULL;  | 
860  |  | 
  | 
861  | 0  |   if (!context || !context->update || !cacheBitmapV3Order)  | 
862  | 0  |     return FALSE;  | 
863  |  |  | 
864  | 0  |   wParam = copy_cache_bitmap_v3_order(context, cacheBitmapV3Order);  | 
865  |  | 
  | 
866  | 0  |   if (!wParam)  | 
867  | 0  |     return FALSE;  | 
868  |  |  | 
869  | 0  |   up = update_cast(context->update);  | 
870  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
871  | 0  |                            MakeMessageId(SecondaryUpdate, CacheBitmapV3), (void*)wParam, NULL);  | 
872  | 0  | }  | 
873  |  |  | 
874  |  | static BOOL update_message_CacheColorTable(rdpContext* context,  | 
875  |  |                                            const CACHE_COLOR_TABLE_ORDER* cacheColorTableOrder)  | 
876  | 0  | { | 
877  | 0  |   CACHE_COLOR_TABLE_ORDER* wParam = NULL;  | 
878  | 0  |   rdp_update_internal* up = NULL;  | 
879  |  | 
  | 
880  | 0  |   if (!context || !context->update || !cacheColorTableOrder)  | 
881  | 0  |     return FALSE;  | 
882  |  |  | 
883  | 0  |   wParam = copy_cache_color_table_order(context, cacheColorTableOrder);  | 
884  |  | 
  | 
885  | 0  |   if (!wParam)  | 
886  | 0  |     return FALSE;  | 
887  |  |  | 
888  | 0  |   up = update_cast(context->update);  | 
889  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
890  | 0  |                            MakeMessageId(SecondaryUpdate, CacheColorTable), (void*)wParam, NULL);  | 
891  | 0  | }  | 
892  |  |  | 
893  |  | static BOOL update_message_CacheGlyph(rdpContext* context, const CACHE_GLYPH_ORDER* cacheGlyphOrder)  | 
894  | 0  | { | 
895  | 0  |   CACHE_GLYPH_ORDER* wParam = NULL;  | 
896  | 0  |   rdp_update_internal* up = NULL;  | 
897  |  | 
  | 
898  | 0  |   if (!context || !context->update || !cacheGlyphOrder)  | 
899  | 0  |     return FALSE;  | 
900  |  |  | 
901  | 0  |   wParam = copy_cache_glyph_order(context, cacheGlyphOrder);  | 
902  |  | 
  | 
903  | 0  |   if (!wParam)  | 
904  | 0  |     return FALSE;  | 
905  |  |  | 
906  | 0  |   up = update_cast(context->update);  | 
907  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(SecondaryUpdate, CacheGlyph),  | 
908  | 0  |                            (void*)wParam, NULL);  | 
909  | 0  | }  | 
910  |  |  | 
911  |  | static BOOL update_message_CacheGlyphV2(rdpContext* context,  | 
912  |  |                                         const CACHE_GLYPH_V2_ORDER* cacheGlyphV2Order)  | 
913  | 0  | { | 
914  | 0  |   CACHE_GLYPH_V2_ORDER* wParam = NULL;  | 
915  | 0  |   rdp_update_internal* up = NULL;  | 
916  |  | 
  | 
917  | 0  |   if (!context || !context->update || !cacheGlyphV2Order)  | 
918  | 0  |     return FALSE;  | 
919  |  |  | 
920  | 0  |   wParam = copy_cache_glyph_v2_order(context, cacheGlyphV2Order);  | 
921  |  | 
  | 
922  | 0  |   if (!wParam)  | 
923  | 0  |     return FALSE;  | 
924  |  |  | 
925  | 0  |   up = update_cast(context->update);  | 
926  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
927  | 0  |                            MakeMessageId(SecondaryUpdate, CacheGlyphV2), (void*)wParam, NULL);  | 
928  | 0  | }  | 
929  |  |  | 
930  |  | static BOOL update_message_CacheBrush(rdpContext* context, const CACHE_BRUSH_ORDER* cacheBrushOrder)  | 
931  | 0  | { | 
932  | 0  |   CACHE_BRUSH_ORDER* wParam = NULL;  | 
933  | 0  |   rdp_update_internal* up = NULL;  | 
934  |  | 
  | 
935  | 0  |   if (!context || !context->update || !cacheBrushOrder)  | 
936  | 0  |     return FALSE;  | 
937  |  |  | 
938  | 0  |   wParam = copy_cache_brush_order(context, cacheBrushOrder);  | 
939  |  | 
  | 
940  | 0  |   if (!wParam)  | 
941  | 0  |     return FALSE;  | 
942  |  |  | 
943  | 0  |   up = update_cast(context->update);  | 
944  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(SecondaryUpdate, CacheBrush),  | 
945  | 0  |                            (void*)wParam, NULL);  | 
946  | 0  | }  | 
947  |  |  | 
948  |  | /* Alternate Secondary Update */  | 
949  |  |  | 
950  |  | static BOOL  | 
951  |  | update_message_CreateOffscreenBitmap(rdpContext* context,  | 
952  |  |                                      const CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)  | 
953  | 0  | { | 
954  | 0  |   CREATE_OFFSCREEN_BITMAP_ORDER* wParam = NULL;  | 
955  | 0  |   rdp_update_internal* up = NULL;  | 
956  |  | 
  | 
957  | 0  |   if (!context || !context->update || !createOffscreenBitmap)  | 
958  | 0  |     return FALSE;  | 
959  |  |  | 
960  | 0  |   wParam = (CREATE_OFFSCREEN_BITMAP_ORDER*)malloc(sizeof(CREATE_OFFSCREEN_BITMAP_ORDER));  | 
961  |  | 
  | 
962  | 0  |   if (!wParam)  | 
963  | 0  |     return FALSE;  | 
964  |  |  | 
965  | 0  |   CopyMemory(wParam, createOffscreenBitmap, sizeof(CREATE_OFFSCREEN_BITMAP_ORDER));  | 
966  | 0  |   wParam->deleteList.cIndices = createOffscreenBitmap->deleteList.cIndices;  | 
967  | 0  |   wParam->deleteList.sIndices = wParam->deleteList.cIndices;  | 
968  | 0  |   wParam->deleteList.indices = (UINT16*)calloc(wParam->deleteList.cIndices, sizeof(UINT16));  | 
969  |  | 
  | 
970  | 0  |   if (!wParam->deleteList.indices)  | 
971  | 0  |   { | 
972  | 0  |     free(wParam);  | 
973  | 0  |     return FALSE;  | 
974  | 0  |   }  | 
975  |  |  | 
976  | 0  |   CopyMemory(wParam->deleteList.indices, createOffscreenBitmap->deleteList.indices,  | 
977  | 0  |              wParam->deleteList.cIndices);  | 
978  |  | 
  | 
979  | 0  |   up = update_cast(context->update);  | 
980  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
981  | 0  |                            MakeMessageId(AltSecUpdate, CreateOffscreenBitmap), (void*)wParam,  | 
982  | 0  |                            NULL);  | 
983  | 0  | }  | 
984  |  |  | 
985  |  | static BOOL update_message_SwitchSurface(rdpContext* context,  | 
986  |  |                                          const SWITCH_SURFACE_ORDER* switchSurface)  | 
987  | 0  | { | 
988  | 0  |   SWITCH_SURFACE_ORDER* wParam = NULL;  | 
989  | 0  |   rdp_update_internal* up = NULL;  | 
990  |  | 
  | 
991  | 0  |   if (!context || !context->update || !switchSurface)  | 
992  | 0  |     return FALSE;  | 
993  |  |  | 
994  | 0  |   wParam = (SWITCH_SURFACE_ORDER*)malloc(sizeof(SWITCH_SURFACE_ORDER));  | 
995  |  | 
  | 
996  | 0  |   if (!wParam)  | 
997  | 0  |     return FALSE;  | 
998  |  |  | 
999  | 0  |   CopyMemory(wParam, switchSurface, sizeof(SWITCH_SURFACE_ORDER));  | 
1000  |  | 
  | 
1001  | 0  |   up = update_cast(context->update);  | 
1002  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(AltSecUpdate, SwitchSurface),  | 
1003  | 0  |                            (void*)wParam, NULL);  | 
1004  | 0  | }  | 
1005  |  |  | 
1006  |  | static BOOL  | 
1007  |  | update_message_CreateNineGridBitmap(rdpContext* context,  | 
1008  |  |                                     const CREATE_NINE_GRID_BITMAP_ORDER* createNineGridBitmap)  | 
1009  | 0  | { | 
1010  | 0  |   CREATE_NINE_GRID_BITMAP_ORDER* wParam = NULL;  | 
1011  | 0  |   rdp_update_internal* up = NULL;  | 
1012  |  | 
  | 
1013  | 0  |   if (!context || !context->update || !createNineGridBitmap)  | 
1014  | 0  |     return FALSE;  | 
1015  |  |  | 
1016  | 0  |   wParam = (CREATE_NINE_GRID_BITMAP_ORDER*)malloc(sizeof(CREATE_NINE_GRID_BITMAP_ORDER));  | 
1017  |  | 
  | 
1018  | 0  |   if (!wParam)  | 
1019  | 0  |     return FALSE;  | 
1020  |  |  | 
1021  | 0  |   CopyMemory(wParam, createNineGridBitmap, sizeof(CREATE_NINE_GRID_BITMAP_ORDER));  | 
1022  |  | 
  | 
1023  | 0  |   up = update_cast(context->update);  | 
1024  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1025  | 0  |                            MakeMessageId(AltSecUpdate, CreateNineGridBitmap), (void*)wParam,  | 
1026  | 0  |                            NULL);  | 
1027  | 0  | }  | 
1028  |  |  | 
1029  |  | static BOOL update_message_FrameMarker(rdpContext* context, const FRAME_MARKER_ORDER* frameMarker)  | 
1030  | 0  | { | 
1031  | 0  |   FRAME_MARKER_ORDER* wParam = NULL;  | 
1032  | 0  |   rdp_update_internal* up = NULL;  | 
1033  |  | 
  | 
1034  | 0  |   if (!context || !context->update || !frameMarker)  | 
1035  | 0  |     return FALSE;  | 
1036  |  |  | 
1037  | 0  |   wParam = (FRAME_MARKER_ORDER*)malloc(sizeof(FRAME_MARKER_ORDER));  | 
1038  |  | 
  | 
1039  | 0  |   if (!wParam)  | 
1040  | 0  |     return FALSE;  | 
1041  |  |  | 
1042  | 0  |   CopyMemory(wParam, frameMarker, sizeof(FRAME_MARKER_ORDER));  | 
1043  |  | 
  | 
1044  | 0  |   up = update_cast(context->update);  | 
1045  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(AltSecUpdate, FrameMarker),  | 
1046  | 0  |                            (void*)wParam, NULL);  | 
1047  | 0  | }  | 
1048  |  |  | 
1049  |  | static BOOL update_message_StreamBitmapFirst(rdpContext* context,  | 
1050  |  |                                              const STREAM_BITMAP_FIRST_ORDER* streamBitmapFirst)  | 
1051  | 0  | { | 
1052  | 0  |   STREAM_BITMAP_FIRST_ORDER* wParam = NULL;  | 
1053  | 0  |   rdp_update_internal* up = NULL;  | 
1054  |  | 
  | 
1055  | 0  |   if (!context || !context->update || !streamBitmapFirst)  | 
1056  | 0  |     return FALSE;  | 
1057  |  |  | 
1058  | 0  |   wParam = (STREAM_BITMAP_FIRST_ORDER*)malloc(sizeof(STREAM_BITMAP_FIRST_ORDER));  | 
1059  |  | 
  | 
1060  | 0  |   if (!wParam)  | 
1061  | 0  |     return FALSE;  | 
1062  |  |  | 
1063  | 0  |   CopyMemory(wParam, streamBitmapFirst, sizeof(STREAM_BITMAP_FIRST_ORDER));  | 
1064  |  |   /* TODO: complete copy */  | 
1065  |  | 
  | 
1066  | 0  |   up = update_cast(context->update);  | 
1067  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1068  | 0  |                            MakeMessageId(AltSecUpdate, StreamBitmapFirst), (void*)wParam, NULL);  | 
1069  | 0  | }  | 
1070  |  |  | 
1071  |  | static BOOL update_message_StreamBitmapNext(rdpContext* context,  | 
1072  |  |                                             const STREAM_BITMAP_NEXT_ORDER* streamBitmapNext)  | 
1073  | 0  | { | 
1074  | 0  |   STREAM_BITMAP_NEXT_ORDER* wParam = NULL;  | 
1075  | 0  |   rdp_update_internal* up = NULL;  | 
1076  |  | 
  | 
1077  | 0  |   if (!context || !context->update || !streamBitmapNext)  | 
1078  | 0  |     return FALSE;  | 
1079  |  |  | 
1080  | 0  |   wParam = (STREAM_BITMAP_NEXT_ORDER*)malloc(sizeof(STREAM_BITMAP_NEXT_ORDER));  | 
1081  |  | 
  | 
1082  | 0  |   if (!wParam)  | 
1083  | 0  |     return FALSE;  | 
1084  |  |  | 
1085  | 0  |   CopyMemory(wParam, streamBitmapNext, sizeof(STREAM_BITMAP_NEXT_ORDER));  | 
1086  |  |   /* TODO: complete copy */  | 
1087  |  | 
  | 
1088  | 0  |   up = update_cast(context->update);  | 
1089  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1090  | 0  |                            MakeMessageId(AltSecUpdate, StreamBitmapNext), (void*)wParam, NULL);  | 
1091  | 0  | }  | 
1092  |  |  | 
1093  |  | static BOOL update_message_DrawGdiPlusFirst(rdpContext* context,  | 
1094  |  |                                             const DRAW_GDIPLUS_FIRST_ORDER* drawGdiPlusFirst)  | 
1095  | 0  | { | 
1096  | 0  |   DRAW_GDIPLUS_FIRST_ORDER* wParam = NULL;  | 
1097  | 0  |   rdp_update_internal* up = NULL;  | 
1098  |  | 
  | 
1099  | 0  |   if (!context || !context->update || !drawGdiPlusFirst)  | 
1100  | 0  |     return FALSE;  | 
1101  |  |  | 
1102  | 0  |   wParam = (DRAW_GDIPLUS_FIRST_ORDER*)malloc(sizeof(DRAW_GDIPLUS_FIRST_ORDER));  | 
1103  |  | 
  | 
1104  | 0  |   if (!wParam)  | 
1105  | 0  |     return FALSE;  | 
1106  |  |  | 
1107  | 0  |   CopyMemory(wParam, drawGdiPlusFirst, sizeof(DRAW_GDIPLUS_FIRST_ORDER));  | 
1108  |  |   /* TODO: complete copy */  | 
1109  | 0  |   up = update_cast(context->update);  | 
1110  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1111  | 0  |                            MakeMessageId(AltSecUpdate, DrawGdiPlusFirst), (void*)wParam, NULL);  | 
1112  | 0  | }  | 
1113  |  |  | 
1114  |  | static BOOL update_message_DrawGdiPlusNext(rdpContext* context,  | 
1115  |  |                                            const DRAW_GDIPLUS_NEXT_ORDER* drawGdiPlusNext)  | 
1116  | 0  | { | 
1117  | 0  |   DRAW_GDIPLUS_NEXT_ORDER* wParam = NULL;  | 
1118  | 0  |   rdp_update_internal* up = NULL;  | 
1119  |  | 
  | 
1120  | 0  |   if (!context || !context->update || !drawGdiPlusNext)  | 
1121  | 0  |     return FALSE;  | 
1122  |  |  | 
1123  | 0  |   wParam = (DRAW_GDIPLUS_NEXT_ORDER*)malloc(sizeof(DRAW_GDIPLUS_NEXT_ORDER));  | 
1124  |  | 
  | 
1125  | 0  |   if (!wParam)  | 
1126  | 0  |     return FALSE;  | 
1127  |  |  | 
1128  | 0  |   CopyMemory(wParam, drawGdiPlusNext, sizeof(DRAW_GDIPLUS_NEXT_ORDER));  | 
1129  |  |   /* TODO: complete copy */  | 
1130  |  | 
  | 
1131  | 0  |   up = update_cast(context->update);  | 
1132  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1133  | 0  |                            MakeMessageId(AltSecUpdate, DrawGdiPlusNext), (void*)wParam, NULL);  | 
1134  | 0  | }  | 
1135  |  |  | 
1136  |  | static BOOL update_message_DrawGdiPlusEnd(rdpContext* context,  | 
1137  |  |                                           const DRAW_GDIPLUS_END_ORDER* drawGdiPlusEnd)  | 
1138  | 0  | { | 
1139  | 0  |   DRAW_GDIPLUS_END_ORDER* wParam = NULL;  | 
1140  | 0  |   rdp_update_internal* up = NULL;  | 
1141  |  | 
  | 
1142  | 0  |   if (!context || !context->update || !drawGdiPlusEnd)  | 
1143  | 0  |     return FALSE;  | 
1144  |  |  | 
1145  | 0  |   wParam = (DRAW_GDIPLUS_END_ORDER*)malloc(sizeof(DRAW_GDIPLUS_END_ORDER));  | 
1146  |  | 
  | 
1147  | 0  |   if (!wParam)  | 
1148  | 0  |     return FALSE;  | 
1149  |  |  | 
1150  | 0  |   CopyMemory(wParam, drawGdiPlusEnd, sizeof(DRAW_GDIPLUS_END_ORDER));  | 
1151  |  |   /* TODO: complete copy */  | 
1152  |  | 
  | 
1153  | 0  |   up = update_cast(context->update);  | 
1154  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(AltSecUpdate, DrawGdiPlusEnd),  | 
1155  | 0  |                            (void*)wParam, NULL);  | 
1156  | 0  | }  | 
1157  |  |  | 
1158  |  | static BOOL  | 
1159  |  | update_message_DrawGdiPlusCacheFirst(rdpContext* context,  | 
1160  |  |                                      const DRAW_GDIPLUS_CACHE_FIRST_ORDER* drawGdiPlusCacheFirst)  | 
1161  | 0  | { | 
1162  | 0  |   DRAW_GDIPLUS_CACHE_FIRST_ORDER* wParam = NULL;  | 
1163  | 0  |   rdp_update_internal* up = NULL;  | 
1164  |  | 
  | 
1165  | 0  |   if (!context || !context->update || !drawGdiPlusCacheFirst)  | 
1166  | 0  |     return FALSE;  | 
1167  |  |  | 
1168  | 0  |   wParam = (DRAW_GDIPLUS_CACHE_FIRST_ORDER*)malloc(sizeof(DRAW_GDIPLUS_CACHE_FIRST_ORDER));  | 
1169  |  | 
  | 
1170  | 0  |   if (!wParam)  | 
1171  | 0  |     return FALSE;  | 
1172  |  |  | 
1173  | 0  |   CopyMemory(wParam, drawGdiPlusCacheFirst, sizeof(DRAW_GDIPLUS_CACHE_FIRST_ORDER));  | 
1174  |  |   /* TODO: complete copy */  | 
1175  |  | 
  | 
1176  | 0  |   up = update_cast(context->update);  | 
1177  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1178  | 0  |                            MakeMessageId(AltSecUpdate, DrawGdiPlusCacheFirst), (void*)wParam,  | 
1179  | 0  |                            NULL);  | 
1180  | 0  | }  | 
1181  |  |  | 
1182  |  | static BOOL  | 
1183  |  | update_message_DrawGdiPlusCacheNext(rdpContext* context,  | 
1184  |  |                                     const DRAW_GDIPLUS_CACHE_NEXT_ORDER* drawGdiPlusCacheNext)  | 
1185  | 0  | { | 
1186  | 0  |   DRAW_GDIPLUS_CACHE_NEXT_ORDER* wParam = NULL;  | 
1187  | 0  |   rdp_update_internal* up = NULL;  | 
1188  |  | 
  | 
1189  | 0  |   if (!context || !context->update || !drawGdiPlusCacheNext)  | 
1190  | 0  |     return FALSE;  | 
1191  |  |  | 
1192  | 0  |   wParam = (DRAW_GDIPLUS_CACHE_NEXT_ORDER*)malloc(sizeof(DRAW_GDIPLUS_CACHE_NEXT_ORDER));  | 
1193  |  | 
  | 
1194  | 0  |   if (!wParam)  | 
1195  | 0  |     return FALSE;  | 
1196  |  |  | 
1197  | 0  |   CopyMemory(wParam, drawGdiPlusCacheNext, sizeof(DRAW_GDIPLUS_CACHE_NEXT_ORDER));  | 
1198  |  |   /* TODO: complete copy */  | 
1199  |  | 
  | 
1200  | 0  |   up = update_cast(context->update);  | 
1201  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1202  | 0  |                            MakeMessageId(AltSecUpdate, DrawGdiPlusCacheNext), (void*)wParam,  | 
1203  | 0  |                            NULL);  | 
1204  | 0  | }  | 
1205  |  |  | 
1206  |  | static BOOL  | 
1207  |  | update_message_DrawGdiPlusCacheEnd(rdpContext* context,  | 
1208  |  |                                    const DRAW_GDIPLUS_CACHE_END_ORDER* drawGdiPlusCacheEnd)  | 
1209  | 0  | { | 
1210  | 0  |   DRAW_GDIPLUS_CACHE_END_ORDER* wParam = NULL;  | 
1211  | 0  |   rdp_update_internal* up = NULL;  | 
1212  |  | 
  | 
1213  | 0  |   if (!context || !context->update || !drawGdiPlusCacheEnd)  | 
1214  | 0  |     return FALSE;  | 
1215  |  |  | 
1216  | 0  |   wParam = (DRAW_GDIPLUS_CACHE_END_ORDER*)malloc(sizeof(DRAW_GDIPLUS_CACHE_END_ORDER));  | 
1217  |  | 
  | 
1218  | 0  |   if (!wParam)  | 
1219  | 0  |     return FALSE;  | 
1220  |  |  | 
1221  | 0  |   CopyMemory(wParam, drawGdiPlusCacheEnd, sizeof(DRAW_GDIPLUS_CACHE_END_ORDER));  | 
1222  |  |   /* TODO: complete copy */  | 
1223  |  | 
  | 
1224  | 0  |   up = update_cast(context->update);  | 
1225  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1226  | 0  |                            MakeMessageId(AltSecUpdate, DrawGdiPlusCacheEnd), (void*)wParam, NULL);  | 
1227  | 0  | }  | 
1228  |  |  | 
1229  |  | /* Window Update */  | 
1230  |  |  | 
1231  |  | static BOOL update_message_WindowCreate(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,  | 
1232  |  |                                         const WINDOW_STATE_ORDER* windowState)  | 
1233  | 0  | { | 
1234  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1235  | 0  |   WINDOW_STATE_ORDER* lParam = NULL;  | 
1236  | 0  |   rdp_update_internal* up = NULL;  | 
1237  |  | 
  | 
1238  | 0  |   if (!context || !context->update || !orderInfo || !windowState)  | 
1239  | 0  |     return FALSE;  | 
1240  |  |  | 
1241  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1242  |  | 
  | 
1243  | 0  |   if (!wParam)  | 
1244  | 0  |     return FALSE;  | 
1245  |  |  | 
1246  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1247  | 0  |   lParam = (WINDOW_STATE_ORDER*)malloc(sizeof(WINDOW_STATE_ORDER));  | 
1248  |  | 
  | 
1249  | 0  |   if (!lParam)  | 
1250  | 0  |   { | 
1251  | 0  |     free(wParam);  | 
1252  | 0  |     return FALSE;  | 
1253  | 0  |   }  | 
1254  |  |  | 
1255  | 0  |   CopyMemory(lParam, windowState, sizeof(WINDOW_STATE_ORDER));  | 
1256  |  | 
  | 
1257  | 0  |   up = update_cast(context->update);  | 
1258  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(WindowUpdate, WindowCreate),  | 
1259  | 0  |                            (void*)wParam, (void*)lParam);  | 
1260  | 0  | }  | 
1261  |  |  | 
1262  |  | static BOOL update_message_WindowUpdate(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,  | 
1263  |  |                                         const WINDOW_STATE_ORDER* windowState)  | 
1264  | 0  | { | 
1265  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1266  | 0  |   WINDOW_STATE_ORDER* lParam = NULL;  | 
1267  | 0  |   rdp_update_internal* up = NULL;  | 
1268  |  | 
  | 
1269  | 0  |   if (!context || !context->update || !orderInfo || !windowState)  | 
1270  | 0  |     return FALSE;  | 
1271  |  |  | 
1272  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1273  |  | 
  | 
1274  | 0  |   if (!wParam)  | 
1275  | 0  |     return FALSE;  | 
1276  |  |  | 
1277  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1278  | 0  |   lParam = (WINDOW_STATE_ORDER*)malloc(sizeof(WINDOW_STATE_ORDER));  | 
1279  |  | 
  | 
1280  | 0  |   if (!lParam)  | 
1281  | 0  |   { | 
1282  | 0  |     free(wParam);  | 
1283  | 0  |     return FALSE;  | 
1284  | 0  |   }  | 
1285  |  |  | 
1286  | 0  |   CopyMemory(lParam, windowState, sizeof(WINDOW_STATE_ORDER));  | 
1287  |  | 
  | 
1288  | 0  |   up = update_cast(context->update);  | 
1289  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(WindowUpdate, WindowUpdate),  | 
1290  | 0  |                            (void*)wParam, (void*)lParam);  | 
1291  | 0  | }  | 
1292  |  |  | 
1293  |  | static BOOL update_message_WindowIcon(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,  | 
1294  |  |                                       const WINDOW_ICON_ORDER* windowIcon)  | 
1295  | 0  | { | 
1296  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1297  | 0  |   WINDOW_ICON_ORDER* lParam = NULL;  | 
1298  | 0  |   rdp_update_internal* up = NULL;  | 
1299  |  | 
  | 
1300  | 0  |   if (!context || !context->update || !orderInfo || !windowIcon)  | 
1301  | 0  |     return FALSE;  | 
1302  |  |  | 
1303  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1304  |  | 
  | 
1305  | 0  |   if (!wParam)  | 
1306  | 0  |     return FALSE;  | 
1307  |  |  | 
1308  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1309  | 0  |   lParam = (WINDOW_ICON_ORDER*)calloc(1, sizeof(WINDOW_ICON_ORDER));  | 
1310  |  | 
  | 
1311  | 0  |   if (!lParam)  | 
1312  | 0  |     goto out_fail;  | 
1313  |  |  | 
1314  | 0  |   lParam->iconInfo = calloc(1, sizeof(ICON_INFO));  | 
1315  |  | 
  | 
1316  | 0  |   if (!lParam->iconInfo)  | 
1317  | 0  |     goto out_fail;  | 
1318  |  |  | 
1319  | 0  |   CopyMemory(lParam, windowIcon, sizeof(WINDOW_ICON_ORDER));  | 
1320  | 0  |   WLog_VRB(TAG, "update_message_WindowIcon");  | 
1321  |  | 
  | 
1322  | 0  |   if (windowIcon->iconInfo->cbBitsColor > 0)  | 
1323  | 0  |   { | 
1324  | 0  |     lParam->iconInfo->bitsColor = (BYTE*)malloc(windowIcon->iconInfo->cbBitsColor);  | 
1325  |  | 
  | 
1326  | 0  |     if (!lParam->iconInfo->bitsColor)  | 
1327  | 0  |       goto out_fail;  | 
1328  |  |  | 
1329  | 0  |     CopyMemory(lParam->iconInfo->bitsColor, windowIcon->iconInfo->bitsColor,  | 
1330  | 0  |                windowIcon->iconInfo->cbBitsColor);  | 
1331  | 0  |   }  | 
1332  |  |  | 
1333  | 0  |   if (windowIcon->iconInfo->cbBitsMask > 0)  | 
1334  | 0  |   { | 
1335  | 0  |     lParam->iconInfo->bitsMask = (BYTE*)malloc(windowIcon->iconInfo->cbBitsMask);  | 
1336  |  | 
  | 
1337  | 0  |     if (!lParam->iconInfo->bitsMask)  | 
1338  | 0  |       goto out_fail;  | 
1339  |  |  | 
1340  | 0  |     CopyMemory(lParam->iconInfo->bitsMask, windowIcon->iconInfo->bitsMask,  | 
1341  | 0  |                windowIcon->iconInfo->cbBitsMask);  | 
1342  | 0  |   }  | 
1343  |  |  | 
1344  | 0  |   if (windowIcon->iconInfo->cbColorTable > 0)  | 
1345  | 0  |   { | 
1346  | 0  |     lParam->iconInfo->colorTable = (BYTE*)malloc(windowIcon->iconInfo->cbColorTable);  | 
1347  |  | 
  | 
1348  | 0  |     if (!lParam->iconInfo->colorTable)  | 
1349  | 0  |       goto out_fail;  | 
1350  |  |  | 
1351  | 0  |     CopyMemory(lParam->iconInfo->colorTable, windowIcon->iconInfo->colorTable,  | 
1352  | 0  |                windowIcon->iconInfo->cbColorTable);  | 
1353  | 0  |   }  | 
1354  |  |  | 
1355  | 0  |   up = update_cast(context->update);  | 
1356  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(WindowUpdate, WindowIcon),  | 
1357  | 0  |                            (void*)wParam, (void*)lParam);  | 
1358  | 0  | out_fail:  | 
1359  |  | 
  | 
1360  | 0  |   if (lParam && lParam->iconInfo)  | 
1361  | 0  |   { | 
1362  | 0  |     free(lParam->iconInfo->bitsColor);  | 
1363  | 0  |     free(lParam->iconInfo->bitsMask);  | 
1364  | 0  |     free(lParam->iconInfo->colorTable);  | 
1365  | 0  |     free(lParam->iconInfo);  | 
1366  | 0  |   }  | 
1367  |  | 
  | 
1368  | 0  |   free(lParam);  | 
1369  | 0  |   free(wParam);  | 
1370  | 0  |   return FALSE;  | 
1371  | 0  | }  | 
1372  |  |  | 
1373  |  | static BOOL update_message_WindowCachedIcon(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,  | 
1374  |  |                                             const WINDOW_CACHED_ICON_ORDER* windowCachedIcon)  | 
1375  | 0  | { | 
1376  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1377  | 0  |   WINDOW_CACHED_ICON_ORDER* lParam = NULL;  | 
1378  | 0  |   rdp_update_internal* up = NULL;  | 
1379  |  | 
  | 
1380  | 0  |   if (!context || !context->update || !orderInfo || !windowCachedIcon)  | 
1381  | 0  |     return FALSE;  | 
1382  |  |  | 
1383  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1384  |  | 
  | 
1385  | 0  |   if (!wParam)  | 
1386  | 0  |     return FALSE;  | 
1387  |  |  | 
1388  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1389  | 0  |   lParam = (WINDOW_CACHED_ICON_ORDER*)malloc(sizeof(WINDOW_CACHED_ICON_ORDER));  | 
1390  |  | 
  | 
1391  | 0  |   if (!lParam)  | 
1392  | 0  |   { | 
1393  | 0  |     free(wParam);  | 
1394  | 0  |     return FALSE;  | 
1395  | 0  |   }  | 
1396  |  |  | 
1397  | 0  |   CopyMemory(lParam, windowCachedIcon, sizeof(WINDOW_CACHED_ICON_ORDER));  | 
1398  |  | 
  | 
1399  | 0  |   up = update_cast(context->update);  | 
1400  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1401  | 0  |                            MakeMessageId(WindowUpdate, WindowCachedIcon), (void*)wParam,  | 
1402  | 0  |                            (void*)lParam);  | 
1403  | 0  | }  | 
1404  |  |  | 
1405  |  | static BOOL update_message_WindowDelete(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)  | 
1406  | 0  | { | 
1407  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1408  | 0  |   rdp_update_internal* up = NULL;  | 
1409  |  | 
  | 
1410  | 0  |   if (!context || !context->update || !orderInfo)  | 
1411  | 0  |     return FALSE;  | 
1412  |  |  | 
1413  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1414  |  | 
  | 
1415  | 0  |   if (!wParam)  | 
1416  | 0  |     return FALSE;  | 
1417  |  |  | 
1418  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1419  |  | 
  | 
1420  | 0  |   up = update_cast(context->update);  | 
1421  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(WindowUpdate, WindowDelete),  | 
1422  | 0  |                            (void*)wParam, NULL);  | 
1423  | 0  | }  | 
1424  |  |  | 
1425  |  | static BOOL update_message_NotifyIconCreate(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,  | 
1426  |  |                                             const NOTIFY_ICON_STATE_ORDER* notifyIconState)  | 
1427  | 0  | { | 
1428  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1429  | 0  |   NOTIFY_ICON_STATE_ORDER* lParam = NULL;  | 
1430  | 0  |   rdp_update_internal* up = NULL;  | 
1431  |  | 
  | 
1432  | 0  |   if (!context || !context->update || !orderInfo || !notifyIconState)  | 
1433  | 0  |     return FALSE;  | 
1434  |  |  | 
1435  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1436  |  | 
  | 
1437  | 0  |   if (!wParam)  | 
1438  | 0  |     return FALSE;  | 
1439  |  |  | 
1440  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1441  | 0  |   lParam = (NOTIFY_ICON_STATE_ORDER*)malloc(sizeof(NOTIFY_ICON_STATE_ORDER));  | 
1442  |  | 
  | 
1443  | 0  |   if (!lParam)  | 
1444  | 0  |   { | 
1445  | 0  |     free(wParam);  | 
1446  | 0  |     return FALSE;  | 
1447  | 0  |   }  | 
1448  |  |  | 
1449  | 0  |   CopyMemory(lParam, notifyIconState, sizeof(NOTIFY_ICON_STATE_ORDER));  | 
1450  |  | 
  | 
1451  | 0  |   up = update_cast(context->update);  | 
1452  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1453  | 0  |                            MakeMessageId(WindowUpdate, NotifyIconCreate), (void*)wParam,  | 
1454  | 0  |                            (void*)lParam);  | 
1455  | 0  | }  | 
1456  |  |  | 
1457  |  | static BOOL update_message_NotifyIconUpdate(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,  | 
1458  |  |                                             const NOTIFY_ICON_STATE_ORDER* notifyIconState)  | 
1459  | 0  | { | 
1460  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1461  | 0  |   NOTIFY_ICON_STATE_ORDER* lParam = NULL;  | 
1462  | 0  |   rdp_update_internal* up = NULL;  | 
1463  |  | 
  | 
1464  | 0  |   if (!context || !context->update || !orderInfo || !notifyIconState)  | 
1465  | 0  |     return FALSE;  | 
1466  |  |  | 
1467  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1468  |  | 
  | 
1469  | 0  |   if (!wParam)  | 
1470  | 0  |     return FALSE;  | 
1471  |  |  | 
1472  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1473  | 0  |   lParam = (NOTIFY_ICON_STATE_ORDER*)malloc(sizeof(NOTIFY_ICON_STATE_ORDER));  | 
1474  |  | 
  | 
1475  | 0  |   if (!lParam)  | 
1476  | 0  |   { | 
1477  | 0  |     free(wParam);  | 
1478  | 0  |     return FALSE;  | 
1479  | 0  |   }  | 
1480  |  |  | 
1481  | 0  |   CopyMemory(lParam, notifyIconState, sizeof(NOTIFY_ICON_STATE_ORDER));  | 
1482  |  | 
  | 
1483  | 0  |   up = update_cast(context->update);  | 
1484  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1485  | 0  |                            MakeMessageId(WindowUpdate, NotifyIconUpdate), (void*)wParam,  | 
1486  | 0  |                            (void*)lParam);  | 
1487  | 0  | }  | 
1488  |  |  | 
1489  |  | static BOOL update_message_NotifyIconDelete(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)  | 
1490  | 0  | { | 
1491  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1492  | 0  |   rdp_update_internal* up = NULL;  | 
1493  |  | 
  | 
1494  | 0  |   if (!context || !context->update || !orderInfo)  | 
1495  | 0  |     return FALSE;  | 
1496  |  |  | 
1497  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1498  |  | 
  | 
1499  | 0  |   if (!wParam)  | 
1500  | 0  |     return FALSE;  | 
1501  |  |  | 
1502  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1503  |  | 
  | 
1504  | 0  |   up = update_cast(context->update);  | 
1505  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1506  | 0  |                            MakeMessageId(WindowUpdate, NotifyIconDelete), (void*)wParam, NULL);  | 
1507  | 0  | }  | 
1508  |  |  | 
1509  |  | static BOOL update_message_MonitoredDesktop(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,  | 
1510  |  |                                             const MONITORED_DESKTOP_ORDER* monitoredDesktop)  | 
1511  | 0  | { | 
1512  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1513  | 0  |   MONITORED_DESKTOP_ORDER* lParam = NULL;  | 
1514  | 0  |   rdp_update_internal* up = NULL;  | 
1515  |  | 
  | 
1516  | 0  |   if (!context || !context->update || !orderInfo || !monitoredDesktop)  | 
1517  | 0  |     return FALSE;  | 
1518  |  |  | 
1519  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1520  |  | 
  | 
1521  | 0  |   if (!wParam)  | 
1522  | 0  |     return FALSE;  | 
1523  |  |  | 
1524  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1525  | 0  |   lParam = (MONITORED_DESKTOP_ORDER*)malloc(sizeof(MONITORED_DESKTOP_ORDER));  | 
1526  |  | 
  | 
1527  | 0  |   if (!lParam)  | 
1528  | 0  |   { | 
1529  | 0  |     free(wParam);  | 
1530  | 0  |     return FALSE;  | 
1531  | 0  |   }  | 
1532  |  |  | 
1533  | 0  |   CopyMemory(lParam, monitoredDesktop, sizeof(MONITORED_DESKTOP_ORDER));  | 
1534  | 0  |   lParam->windowIds = NULL;  | 
1535  |  | 
  | 
1536  | 0  |   if (lParam->numWindowIds)  | 
1537  | 0  |   { | 
1538  | 0  |     lParam->windowIds = (UINT32*)calloc(lParam->numWindowIds, sizeof(UINT32));  | 
1539  | 0  |     CopyMemory(lParam->windowIds, monitoredDesktop->windowIds, lParam->numWindowIds);  | 
1540  | 0  |   }  | 
1541  |  | 
  | 
1542  | 0  |   up = update_cast(context->update);  | 
1543  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1544  | 0  |                            MakeMessageId(WindowUpdate, MonitoredDesktop), (void*)wParam,  | 
1545  | 0  |                            (void*)lParam);  | 
1546  | 0  | }  | 
1547  |  |  | 
1548  |  | static BOOL update_message_NonMonitoredDesktop(rdpContext* context,  | 
1549  |  |                                                const WINDOW_ORDER_INFO* orderInfo)  | 
1550  | 0  | { | 
1551  | 0  |   WINDOW_ORDER_INFO* wParam = NULL;  | 
1552  | 0  |   rdp_update_internal* up = NULL;  | 
1553  |  | 
  | 
1554  | 0  |   if (!context || !context->update || !orderInfo)  | 
1555  | 0  |     return FALSE;  | 
1556  |  |  | 
1557  | 0  |   wParam = (WINDOW_ORDER_INFO*)malloc(sizeof(WINDOW_ORDER_INFO));  | 
1558  |  | 
  | 
1559  | 0  |   if (!wParam)  | 
1560  | 0  |     return FALSE;  | 
1561  |  |  | 
1562  | 0  |   CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));  | 
1563  |  | 
  | 
1564  | 0  |   up = update_cast(context->update);  | 
1565  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1566  | 0  |                            MakeMessageId(WindowUpdate, NonMonitoredDesktop), (void*)wParam, NULL);  | 
1567  | 0  | }  | 
1568  |  |  | 
1569  |  | /* Pointer Update */  | 
1570  |  |  | 
1571  |  | static BOOL update_message_PointerPosition(rdpContext* context,  | 
1572  |  |                                            const POINTER_POSITION_UPDATE* pointerPosition)  | 
1573  | 0  | { | 
1574  | 0  |   POINTER_POSITION_UPDATE* wParam = NULL;  | 
1575  | 0  |   rdp_update_internal* up = NULL;  | 
1576  |  | 
  | 
1577  | 0  |   if (!context || !context->update || !pointerPosition)  | 
1578  | 0  |     return FALSE;  | 
1579  |  |  | 
1580  | 0  |   wParam = copy_pointer_position_update(context, pointerPosition);  | 
1581  |  | 
  | 
1582  | 0  |   if (!wParam)  | 
1583  | 0  |     return FALSE;  | 
1584  |  |  | 
1585  | 0  |   up = update_cast(context->update);  | 
1586  | 0  |   return MessageQueue_Post(up->queue, (void*)context,  | 
1587  | 0  |                            MakeMessageId(PointerUpdate, PointerPosition), (void*)wParam, NULL);  | 
1588  | 0  | }  | 
1589  |  |  | 
1590  |  | static BOOL update_message_PointerSystem(rdpContext* context,  | 
1591  |  |                                          const POINTER_SYSTEM_UPDATE* pointerSystem)  | 
1592  | 0  | { | 
1593  | 0  |   POINTER_SYSTEM_UPDATE* wParam = NULL;  | 
1594  | 0  |   rdp_update_internal* up = NULL;  | 
1595  |  | 
  | 
1596  | 0  |   if (!context || !context->update || !pointerSystem)  | 
1597  | 0  |     return FALSE;  | 
1598  |  |  | 
1599  | 0  |   wParam = copy_pointer_system_update(context, pointerSystem);  | 
1600  |  | 
  | 
1601  | 0  |   if (!wParam)  | 
1602  | 0  |     return FALSE;  | 
1603  |  |  | 
1604  | 0  |   up = update_cast(context->update);  | 
1605  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PointerUpdate, PointerSystem),  | 
1606  | 0  |                            (void*)wParam, NULL);  | 
1607  | 0  | }  | 
1608  |  |  | 
1609  |  | static BOOL update_message_PointerColor(rdpContext* context,  | 
1610  |  |                                         const POINTER_COLOR_UPDATE* pointerColor)  | 
1611  | 0  | { | 
1612  | 0  |   POINTER_COLOR_UPDATE* wParam = NULL;  | 
1613  | 0  |   rdp_update_internal* up = NULL;  | 
1614  |  | 
  | 
1615  | 0  |   if (!context || !context->update || !pointerColor)  | 
1616  | 0  |     return FALSE;  | 
1617  |  |  | 
1618  | 0  |   wParam = copy_pointer_color_update(context, pointerColor);  | 
1619  |  | 
  | 
1620  | 0  |   if (!wParam)  | 
1621  | 0  |     return FALSE;  | 
1622  |  |  | 
1623  | 0  |   up = update_cast(context->update);  | 
1624  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PointerUpdate, PointerColor),  | 
1625  | 0  |                            (void*)wParam, NULL);  | 
1626  | 0  | }  | 
1627  |  |  | 
1628  |  | static BOOL update_message_PointerLarge(rdpContext* context, const POINTER_LARGE_UPDATE* pointer)  | 
1629  | 0  | { | 
1630  | 0  |   POINTER_LARGE_UPDATE* wParam = NULL;  | 
1631  | 0  |   rdp_update_internal* up = NULL;  | 
1632  |  | 
  | 
1633  | 0  |   if (!context || !context->update || !pointer)  | 
1634  | 0  |     return FALSE;  | 
1635  |  |  | 
1636  | 0  |   wParam = copy_pointer_large_update(context, pointer);  | 
1637  |  | 
  | 
1638  | 0  |   if (!wParam)  | 
1639  | 0  |     return FALSE;  | 
1640  |  |  | 
1641  | 0  |   up = update_cast(context->update);  | 
1642  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PointerUpdate, PointerLarge),  | 
1643  | 0  |                            (void*)wParam, NULL);  | 
1644  | 0  | }  | 
1645  |  |  | 
1646  |  | static BOOL update_message_PointerNew(rdpContext* context, const POINTER_NEW_UPDATE* pointerNew)  | 
1647  | 0  | { | 
1648  | 0  |   POINTER_NEW_UPDATE* wParam = NULL;  | 
1649  | 0  |   rdp_update_internal* up = NULL;  | 
1650  |  | 
  | 
1651  | 0  |   if (!context || !context->update || !pointerNew)  | 
1652  | 0  |     return FALSE;  | 
1653  |  |  | 
1654  | 0  |   wParam = copy_pointer_new_update(context, pointerNew);  | 
1655  |  | 
  | 
1656  | 0  |   if (!wParam)  | 
1657  | 0  |     return FALSE;  | 
1658  |  |  | 
1659  | 0  |   up = update_cast(context->update);  | 
1660  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PointerUpdate, PointerNew),  | 
1661  | 0  |                            (void*)wParam, NULL);  | 
1662  | 0  | }  | 
1663  |  |  | 
1664  |  | static BOOL update_message_PointerCached(rdpContext* context,  | 
1665  |  |                                          const POINTER_CACHED_UPDATE* pointerCached)  | 
1666  | 0  | { | 
1667  | 0  |   POINTER_CACHED_UPDATE* wParam = NULL;  | 
1668  | 0  |   rdp_update_internal* up = NULL;  | 
1669  |  | 
  | 
1670  | 0  |   if (!context || !context->update || !pointerCached)  | 
1671  | 0  |     return FALSE;  | 
1672  |  |  | 
1673  | 0  |   wParam = copy_pointer_cached_update(context, pointerCached);  | 
1674  |  | 
  | 
1675  | 0  |   if (!wParam)  | 
1676  | 0  |     return FALSE;  | 
1677  |  |  | 
1678  | 0  |   up = update_cast(context->update);  | 
1679  | 0  |   return MessageQueue_Post(up->queue, (void*)context, MakeMessageId(PointerUpdate, PointerCached),  | 
1680  | 0  |                            (void*)wParam, NULL);  | 
1681  | 0  | }  | 
1682  |  |  | 
1683  |  | /* Message Queue */  | 
1684  |  | static BOOL update_message_free_update_class(wMessage* msg, int type)  | 
1685  | 0  | { | 
1686  | 0  |   rdpContext* context = NULL;  | 
1687  |  | 
  | 
1688  | 0  |   if (!msg)  | 
1689  | 0  |     return FALSE;  | 
1690  |  |  | 
1691  | 0  |   context = (rdpContext*)msg->context;  | 
1692  |  | 
  | 
1693  | 0  |   switch (type)  | 
1694  | 0  |   { | 
1695  | 0  |     case Update_BeginPaint:  | 
1696  | 0  |       break;  | 
1697  |  |  | 
1698  | 0  |     case Update_EndPaint:  | 
1699  | 0  |       break;  | 
1700  |  |  | 
1701  | 0  |     case Update_SetBounds:  | 
1702  | 0  |       free(msg->wParam);  | 
1703  | 0  |       break;  | 
1704  |  |  | 
1705  | 0  |     case Update_Synchronize:  | 
1706  | 0  |       break;  | 
1707  |  |  | 
1708  | 0  |     case Update_DesktopResize:  | 
1709  | 0  |       break;  | 
1710  |  |  | 
1711  | 0  |     case Update_BitmapUpdate:  | 
1712  | 0  |     { | 
1713  | 0  |       BITMAP_UPDATE* wParam = (BITMAP_UPDATE*)msg->wParam;  | 
1714  | 0  |       free_bitmap_update(context, wParam);  | 
1715  | 0  |     }  | 
1716  | 0  |     break;  | 
1717  |  |  | 
1718  | 0  |     case Update_Palette:  | 
1719  | 0  |     { | 
1720  | 0  |       PALETTE_UPDATE* palette = (PALETTE_UPDATE*)msg->wParam;  | 
1721  | 0  |       free_palette_update(context, palette);  | 
1722  | 0  |     }  | 
1723  | 0  |     break;  | 
1724  |  |  | 
1725  | 0  |     case Update_PlaySound:  | 
1726  | 0  |       free(msg->wParam);  | 
1727  | 0  |       break;  | 
1728  |  |  | 
1729  | 0  |     case Update_RefreshRect:  | 
1730  | 0  |       free(msg->lParam);  | 
1731  | 0  |       break;  | 
1732  |  |  | 
1733  | 0  |     case Update_SuppressOutput:  | 
1734  | 0  |       free(msg->lParam);  | 
1735  | 0  |       break;  | 
1736  |  |  | 
1737  | 0  |     case Update_SurfaceCommand:  | 
1738  | 0  |     { | 
1739  | 0  |       wStream* s = (wStream*)msg->wParam;  | 
1740  | 0  |       Stream_Free(s, TRUE);  | 
1741  | 0  |     }  | 
1742  | 0  |     break;  | 
1743  |  |  | 
1744  | 0  |     case Update_SurfaceBits:  | 
1745  | 0  |     { | 
1746  | 0  |       SURFACE_BITS_COMMAND* wParam = (SURFACE_BITS_COMMAND*)msg->wParam;  | 
1747  | 0  |       free_surface_bits_command(context, wParam);  | 
1748  | 0  |     }  | 
1749  | 0  |     break;  | 
1750  |  |  | 
1751  | 0  |     case Update_SurfaceFrameMarker:  | 
1752  | 0  |       free(msg->wParam);  | 
1753  | 0  |       break;  | 
1754  |  |  | 
1755  | 0  |     case Update_SurfaceFrameAcknowledge:  | 
1756  | 0  |     case Update_SetKeyboardIndicators:  | 
1757  | 0  |     case Update_SetKeyboardImeStatus:  | 
1758  | 0  |       break;  | 
1759  |  |  | 
1760  | 0  |     default:  | 
1761  | 0  |       return FALSE;  | 
1762  | 0  |   }  | 
1763  |  |  | 
1764  | 0  |   return TRUE;  | 
1765  | 0  | }  | 
1766  |  |  | 
1767  |  | static BOOL update_message_process_update_class(rdpUpdateProxy* proxy, wMessage* msg, int type)  | 
1768  | 0  | { | 
1769  | 0  |   BOOL rc = FALSE;  | 
1770  |  | 
  | 
1771  | 0  |   if (!proxy || !msg)  | 
1772  | 0  |     return FALSE;  | 
1773  |  |  | 
1774  | 0  |   switch (type)  | 
1775  | 0  |   { | 
1776  | 0  |     case Update_BeginPaint:  | 
1777  | 0  |       rc = IFCALLRESULT(TRUE, proxy->BeginPaint, msg->context);  | 
1778  | 0  |       break;  | 
1779  |  |  | 
1780  | 0  |     case Update_EndPaint:  | 
1781  | 0  |       rc = IFCALLRESULT(TRUE, proxy->EndPaint, msg->context);  | 
1782  | 0  |       break;  | 
1783  |  |  | 
1784  | 0  |     case Update_SetBounds:  | 
1785  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SetBounds, msg->context, (rdpBounds*)msg->wParam);  | 
1786  | 0  |       break;  | 
1787  |  |  | 
1788  | 0  |     case Update_Synchronize:  | 
1789  | 0  |       rc = IFCALLRESULT(TRUE, proxy->Synchronize, msg->context);  | 
1790  | 0  |       break;  | 
1791  |  |  | 
1792  | 0  |     case Update_DesktopResize:  | 
1793  | 0  |       rc = IFCALLRESULT(TRUE, proxy->DesktopResize, msg->context);  | 
1794  | 0  |       break;  | 
1795  |  |  | 
1796  | 0  |     case Update_BitmapUpdate:  | 
1797  | 0  |       rc = IFCALLRESULT(TRUE, proxy->BitmapUpdate, msg->context, (BITMAP_UPDATE*)msg->wParam);  | 
1798  | 0  |       break;  | 
1799  |  |  | 
1800  | 0  |     case Update_Palette:  | 
1801  | 0  |       rc = IFCALLRESULT(TRUE, proxy->Palette, msg->context, (PALETTE_UPDATE*)msg->wParam);  | 
1802  | 0  |       break;  | 
1803  |  |  | 
1804  | 0  |     case Update_PlaySound:  | 
1805  | 0  |       rc =  | 
1806  | 0  |           IFCALLRESULT(TRUE, proxy->PlaySound, msg->context, (PLAY_SOUND_UPDATE*)msg->wParam);  | 
1807  | 0  |       break;  | 
1808  |  |  | 
1809  | 0  |     case Update_RefreshRect:  | 
1810  | 0  |       rc = IFCALLRESULT(TRUE, proxy->RefreshRect, msg->context, (BYTE)(size_t)msg->wParam,  | 
1811  | 0  |                         (RECTANGLE_16*)msg->lParam);  | 
1812  | 0  |       break;  | 
1813  |  |  | 
1814  | 0  |     case Update_SuppressOutput:  | 
1815  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SuppressOutput, msg->context, (BYTE)(size_t)msg->wParam,  | 
1816  | 0  |                         (RECTANGLE_16*)msg->lParam);  | 
1817  | 0  |       break;  | 
1818  |  |  | 
1819  | 0  |     case Update_SurfaceCommand:  | 
1820  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SurfaceCommand, msg->context, (wStream*)msg->wParam);  | 
1821  | 0  |       break;  | 
1822  |  |  | 
1823  | 0  |     case Update_SurfaceBits:  | 
1824  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SurfaceBits, msg->context,  | 
1825  | 0  |                         (SURFACE_BITS_COMMAND*)msg->wParam);  | 
1826  | 0  |       break;  | 
1827  |  |  | 
1828  | 0  |     case Update_SurfaceFrameMarker:  | 
1829  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SurfaceFrameMarker, msg->context,  | 
1830  | 0  |                         (SURFACE_FRAME_MARKER*)msg->wParam);  | 
1831  | 0  |       break;  | 
1832  |  |  | 
1833  | 0  |     case Update_SurfaceFrameAcknowledge:  | 
1834  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SurfaceFrameAcknowledge, msg->context,  | 
1835  | 0  |                         (UINT32)(size_t)msg->wParam);  | 
1836  | 0  |       break;  | 
1837  |  |  | 
1838  | 0  |     case Update_SetKeyboardIndicators:  | 
1839  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SetKeyboardIndicators, msg->context,  | 
1840  | 0  |                         (UINT16)(size_t)msg->wParam);  | 
1841  | 0  |       break;  | 
1842  |  |  | 
1843  | 0  |     case Update_SetKeyboardImeStatus:  | 
1844  | 0  |     { | 
1845  | 0  |       const UINT16 imeId = ((size_t)msg->wParam) >> 16 & 0xFFFF;  | 
1846  | 0  |       const UINT32 imeState = ((size_t)msg->wParam) & 0xFFFF;  | 
1847  | 0  |       const UINT32 imeConvMode = ((size_t)msg->lParam);  | 
1848  | 0  |       rc = IFCALLRESULT(TRUE, proxy->SetKeyboardImeStatus, msg->context, imeId, imeState,  | 
1849  | 0  |                         imeConvMode);  | 
1850  | 0  |     }  | 
1851  | 0  |     break;  | 
1852  |  |  | 
1853  | 0  |     default:  | 
1854  | 0  |       break;  | 
1855  | 0  |   }  | 
1856  |  |  | 
1857  | 0  |   return rc;  | 
1858  | 0  | }  | 
1859  |  |  | 
1860  |  | static BOOL update_message_free_primary_update_class(wMessage* msg, int type)  | 
1861  | 0  | { | 
1862  | 0  |   if (!msg)  | 
1863  | 0  |     return FALSE;  | 
1864  |  |  | 
1865  | 0  |   switch (type)  | 
1866  | 0  |   { | 
1867  | 0  |     case PrimaryUpdate_DstBlt:  | 
1868  | 0  |       free(msg->wParam);  | 
1869  | 0  |       break;  | 
1870  |  |  | 
1871  | 0  |     case PrimaryUpdate_PatBlt:  | 
1872  | 0  |       free(msg->wParam);  | 
1873  | 0  |       break;  | 
1874  |  |  | 
1875  | 0  |     case PrimaryUpdate_ScrBlt:  | 
1876  | 0  |       free(msg->wParam);  | 
1877  | 0  |       break;  | 
1878  |  |  | 
1879  | 0  |     case PrimaryUpdate_OpaqueRect:  | 
1880  | 0  |       free(msg->wParam);  | 
1881  | 0  |       break;  | 
1882  |  |  | 
1883  | 0  |     case PrimaryUpdate_DrawNineGrid:  | 
1884  | 0  |       free(msg->wParam);  | 
1885  | 0  |       break;  | 
1886  |  |  | 
1887  | 0  |     case PrimaryUpdate_MultiDstBlt:  | 
1888  | 0  |       free(msg->wParam);  | 
1889  | 0  |       break;  | 
1890  |  |  | 
1891  | 0  |     case PrimaryUpdate_MultiPatBlt:  | 
1892  | 0  |       free(msg->wParam);  | 
1893  | 0  |       break;  | 
1894  |  |  | 
1895  | 0  |     case PrimaryUpdate_MultiScrBlt:  | 
1896  | 0  |       free(msg->wParam);  | 
1897  | 0  |       break;  | 
1898  |  |  | 
1899  | 0  |     case PrimaryUpdate_MultiOpaqueRect:  | 
1900  | 0  |       free(msg->wParam);  | 
1901  | 0  |       break;  | 
1902  |  |  | 
1903  | 0  |     case PrimaryUpdate_MultiDrawNineGrid:  | 
1904  | 0  |       free(msg->wParam);  | 
1905  | 0  |       break;  | 
1906  |  |  | 
1907  | 0  |     case PrimaryUpdate_LineTo:  | 
1908  | 0  |       free(msg->wParam);  | 
1909  | 0  |       break;  | 
1910  |  |  | 
1911  | 0  |     case PrimaryUpdate_Polyline:  | 
1912  | 0  |     { | 
1913  | 0  |       POLYLINE_ORDER* wParam = (POLYLINE_ORDER*)msg->wParam;  | 
1914  | 0  |       free(wParam->points);  | 
1915  | 0  |       free(wParam);  | 
1916  | 0  |     }  | 
1917  | 0  |     break;  | 
1918  |  |  | 
1919  | 0  |     case PrimaryUpdate_MemBlt:  | 
1920  | 0  |       free(msg->wParam);  | 
1921  | 0  |       break;  | 
1922  |  |  | 
1923  | 0  |     case PrimaryUpdate_Mem3Blt:  | 
1924  | 0  |       free(msg->wParam);  | 
1925  | 0  |       break;  | 
1926  |  |  | 
1927  | 0  |     case PrimaryUpdate_SaveBitmap:  | 
1928  | 0  |       free(msg->wParam);  | 
1929  | 0  |       break;  | 
1930  |  |  | 
1931  | 0  |     case PrimaryUpdate_GlyphIndex:  | 
1932  | 0  |       free(msg->wParam);  | 
1933  | 0  |       break;  | 
1934  |  |  | 
1935  | 0  |     case PrimaryUpdate_FastIndex:  | 
1936  | 0  |       free(msg->wParam);  | 
1937  | 0  |       break;  | 
1938  |  |  | 
1939  | 0  |     case PrimaryUpdate_FastGlyph:  | 
1940  | 0  |     { | 
1941  | 0  |       FAST_GLYPH_ORDER* wParam = (FAST_GLYPH_ORDER*)msg->wParam;  | 
1942  | 0  |       free(wParam->glyphData.aj);  | 
1943  | 0  |       free(wParam);  | 
1944  | 0  |     }  | 
1945  | 0  |     break;  | 
1946  |  |  | 
1947  | 0  |     case PrimaryUpdate_PolygonSC:  | 
1948  | 0  |     { | 
1949  | 0  |       POLYGON_SC_ORDER* wParam = (POLYGON_SC_ORDER*)msg->wParam;  | 
1950  | 0  |       free(wParam->points);  | 
1951  | 0  |       free(wParam);  | 
1952  | 0  |     }  | 
1953  | 0  |     break;  | 
1954  |  |  | 
1955  | 0  |     case PrimaryUpdate_PolygonCB:  | 
1956  | 0  |     { | 
1957  | 0  |       POLYGON_CB_ORDER* wParam = (POLYGON_CB_ORDER*)msg->wParam;  | 
1958  | 0  |       free(wParam->points);  | 
1959  | 0  |       free(wParam);  | 
1960  | 0  |     }  | 
1961  | 0  |     break;  | 
1962  |  |  | 
1963  | 0  |     case PrimaryUpdate_EllipseSC:  | 
1964  | 0  |       free(msg->wParam);  | 
1965  | 0  |       break;  | 
1966  |  |  | 
1967  | 0  |     case PrimaryUpdate_EllipseCB:  | 
1968  | 0  |       free(msg->wParam);  | 
1969  | 0  |       break;  | 
1970  |  |  | 
1971  | 0  |     default:  | 
1972  | 0  |       return FALSE;  | 
1973  | 0  |   }  | 
1974  |  |  | 
1975  | 0  |   return TRUE;  | 
1976  | 0  | }  | 
1977  |  |  | 
1978  |  | static BOOL update_message_process_primary_update_class(rdpUpdateProxy* proxy, wMessage* msg,  | 
1979  |  |                                                         int type)  | 
1980  | 0  | { | 
1981  | 0  |   if (!proxy || !msg)  | 
1982  | 0  |     return FALSE;  | 
1983  |  |  | 
1984  | 0  |   switch (type)  | 
1985  | 0  |   { | 
1986  | 0  |     case PrimaryUpdate_DstBlt:  | 
1987  | 0  |       return IFCALLRESULT(TRUE, proxy->DstBlt, msg->context, (DSTBLT_ORDER*)msg->wParam);  | 
1988  |  |  | 
1989  | 0  |     case PrimaryUpdate_PatBlt:  | 
1990  | 0  |       return IFCALLRESULT(TRUE, proxy->PatBlt, msg->context, (PATBLT_ORDER*)msg->wParam);  | 
1991  |  |  | 
1992  | 0  |     case PrimaryUpdate_ScrBlt:  | 
1993  | 0  |       return IFCALLRESULT(TRUE, proxy->ScrBlt, msg->context, (SCRBLT_ORDER*)msg->wParam);  | 
1994  |  |  | 
1995  | 0  |     case PrimaryUpdate_OpaqueRect:  | 
1996  | 0  |       return IFCALLRESULT(TRUE, proxy->OpaqueRect, msg->context,  | 
1997  | 0  |                           (OPAQUE_RECT_ORDER*)msg->wParam);  | 
1998  |  |  | 
1999  | 0  |     case PrimaryUpdate_DrawNineGrid:  | 
2000  | 0  |       return IFCALLRESULT(TRUE, proxy->DrawNineGrid, msg->context,  | 
2001  | 0  |                           (DRAW_NINE_GRID_ORDER*)msg->wParam);  | 
2002  |  |  | 
2003  | 0  |     case PrimaryUpdate_MultiDstBlt:  | 
2004  | 0  |       return IFCALLRESULT(TRUE, proxy->MultiDstBlt, msg->context,  | 
2005  | 0  |                           (MULTI_DSTBLT_ORDER*)msg->wParam);  | 
2006  |  |  | 
2007  | 0  |     case PrimaryUpdate_MultiPatBlt:  | 
2008  | 0  |       return IFCALLRESULT(TRUE, proxy->MultiPatBlt, msg->context,  | 
2009  | 0  |                           (MULTI_PATBLT_ORDER*)msg->wParam);  | 
2010  |  |  | 
2011  | 0  |     case PrimaryUpdate_MultiScrBlt:  | 
2012  | 0  |       return IFCALLRESULT(TRUE, proxy->MultiScrBlt, msg->context,  | 
2013  | 0  |                           (MULTI_SCRBLT_ORDER*)msg->wParam);  | 
2014  |  |  | 
2015  | 0  |     case PrimaryUpdate_MultiOpaqueRect:  | 
2016  | 0  |       return IFCALLRESULT(TRUE, proxy->MultiOpaqueRect, msg->context,  | 
2017  | 0  |                           (MULTI_OPAQUE_RECT_ORDER*)msg->wParam);  | 
2018  |  |  | 
2019  | 0  |     case PrimaryUpdate_MultiDrawNineGrid:  | 
2020  | 0  |       return IFCALLRESULT(TRUE, proxy->MultiDrawNineGrid, msg->context,  | 
2021  | 0  |                           (MULTI_DRAW_NINE_GRID_ORDER*)msg->wParam);  | 
2022  |  |  | 
2023  | 0  |     case PrimaryUpdate_LineTo:  | 
2024  | 0  |       return IFCALLRESULT(TRUE, proxy->LineTo, msg->context, (LINE_TO_ORDER*)msg->wParam);  | 
2025  |  |  | 
2026  | 0  |     case PrimaryUpdate_Polyline:  | 
2027  | 0  |       return IFCALLRESULT(TRUE, proxy->Polyline, msg->context, (POLYLINE_ORDER*)msg->wParam);  | 
2028  |  |  | 
2029  | 0  |     case PrimaryUpdate_MemBlt:  | 
2030  | 0  |       return IFCALLRESULT(TRUE, proxy->MemBlt, msg->context, (MEMBLT_ORDER*)msg->wParam);  | 
2031  |  |  | 
2032  | 0  |     case PrimaryUpdate_Mem3Blt:  | 
2033  | 0  |       return IFCALLRESULT(TRUE, proxy->Mem3Blt, msg->context, (MEM3BLT_ORDER*)msg->wParam);  | 
2034  |  |  | 
2035  | 0  |     case PrimaryUpdate_SaveBitmap:  | 
2036  | 0  |       return IFCALLRESULT(TRUE, proxy->SaveBitmap, msg->context,  | 
2037  | 0  |                           (SAVE_BITMAP_ORDER*)msg->wParam);  | 
2038  |  |  | 
2039  | 0  |     case PrimaryUpdate_GlyphIndex:  | 
2040  | 0  |       return IFCALLRESULT(TRUE, proxy->GlyphIndex, msg->context,  | 
2041  | 0  |                           (GLYPH_INDEX_ORDER*)msg->wParam);  | 
2042  |  |  | 
2043  | 0  |     case PrimaryUpdate_FastIndex:  | 
2044  | 0  |       return IFCALLRESULT(TRUE, proxy->FastIndex, msg->context,  | 
2045  | 0  |                           (FAST_INDEX_ORDER*)msg->wParam);  | 
2046  |  |  | 
2047  | 0  |     case PrimaryUpdate_FastGlyph:  | 
2048  | 0  |       return IFCALLRESULT(TRUE, proxy->FastGlyph, msg->context,  | 
2049  | 0  |                           (FAST_GLYPH_ORDER*)msg->wParam);  | 
2050  |  |  | 
2051  | 0  |     case PrimaryUpdate_PolygonSC:  | 
2052  | 0  |       return IFCALLRESULT(TRUE, proxy->PolygonSC, msg->context,  | 
2053  | 0  |                           (POLYGON_SC_ORDER*)msg->wParam);  | 
2054  |  |  | 
2055  | 0  |     case PrimaryUpdate_PolygonCB:  | 
2056  | 0  |       return IFCALLRESULT(TRUE, proxy->PolygonCB, msg->context,  | 
2057  | 0  |                           (POLYGON_CB_ORDER*)msg->wParam);  | 
2058  |  |  | 
2059  | 0  |     case PrimaryUpdate_EllipseSC:  | 
2060  | 0  |       return IFCALLRESULT(TRUE, proxy->EllipseSC, msg->context,  | 
2061  | 0  |                           (ELLIPSE_SC_ORDER*)msg->wParam);  | 
2062  |  |  | 
2063  | 0  |     case PrimaryUpdate_EllipseCB:  | 
2064  | 0  |       return IFCALLRESULT(TRUE, proxy->EllipseCB, msg->context,  | 
2065  | 0  |                           (ELLIPSE_CB_ORDER*)msg->wParam);  | 
2066  |  |  | 
2067  | 0  |     default:  | 
2068  | 0  |       return FALSE;  | 
2069  | 0  |   }  | 
2070  | 0  | }  | 
2071  |  |  | 
2072  |  | static BOOL update_message_free_secondary_update_class(wMessage* msg, int type)  | 
2073  | 0  | { | 
2074  | 0  |   rdpContext* context = NULL;  | 
2075  |  | 
  | 
2076  | 0  |   if (!msg)  | 
2077  | 0  |     return FALSE;  | 
2078  |  |  | 
2079  | 0  |   context = msg->context;  | 
2080  |  | 
  | 
2081  | 0  |   switch (type)  | 
2082  | 0  |   { | 
2083  | 0  |     case SecondaryUpdate_CacheBitmap:  | 
2084  | 0  |     { | 
2085  | 0  |       CACHE_BITMAP_ORDER* wParam = (CACHE_BITMAP_ORDER*)msg->wParam;  | 
2086  | 0  |       free_cache_bitmap_order(context, wParam);  | 
2087  | 0  |     }  | 
2088  | 0  |     break;  | 
2089  |  |  | 
2090  | 0  |     case SecondaryUpdate_CacheBitmapV2:  | 
2091  | 0  |     { | 
2092  | 0  |       CACHE_BITMAP_V2_ORDER* wParam = (CACHE_BITMAP_V2_ORDER*)msg->wParam;  | 
2093  | 0  |       free_cache_bitmap_v2_order(context, wParam);  | 
2094  | 0  |     }  | 
2095  | 0  |     break;  | 
2096  |  |  | 
2097  | 0  |     case SecondaryUpdate_CacheBitmapV3:  | 
2098  | 0  |     { | 
2099  | 0  |       CACHE_BITMAP_V3_ORDER* wParam = (CACHE_BITMAP_V3_ORDER*)msg->wParam;  | 
2100  | 0  |       free_cache_bitmap_v3_order(context, wParam);  | 
2101  | 0  |     }  | 
2102  | 0  |     break;  | 
2103  |  |  | 
2104  | 0  |     case SecondaryUpdate_CacheColorTable:  | 
2105  | 0  |     { | 
2106  | 0  |       CACHE_COLOR_TABLE_ORDER* wParam = (CACHE_COLOR_TABLE_ORDER*)msg->wParam;  | 
2107  | 0  |       free_cache_color_table_order(context, wParam);  | 
2108  | 0  |     }  | 
2109  | 0  |     break;  | 
2110  |  |  | 
2111  | 0  |     case SecondaryUpdate_CacheGlyph:  | 
2112  | 0  |     { | 
2113  | 0  |       CACHE_GLYPH_ORDER* wParam = (CACHE_GLYPH_ORDER*)msg->wParam;  | 
2114  | 0  |       free_cache_glyph_order(context, wParam);  | 
2115  | 0  |     }  | 
2116  | 0  |     break;  | 
2117  |  |  | 
2118  | 0  |     case SecondaryUpdate_CacheGlyphV2:  | 
2119  | 0  |     { | 
2120  | 0  |       CACHE_GLYPH_V2_ORDER* wParam = (CACHE_GLYPH_V2_ORDER*)msg->wParam;  | 
2121  | 0  |       free_cache_glyph_v2_order(context, wParam);  | 
2122  | 0  |     }  | 
2123  | 0  |     break;  | 
2124  |  |  | 
2125  | 0  |     case SecondaryUpdate_CacheBrush:  | 
2126  | 0  |     { | 
2127  | 0  |       CACHE_BRUSH_ORDER* wParam = (CACHE_BRUSH_ORDER*)msg->wParam;  | 
2128  | 0  |       free_cache_brush_order(context, wParam);  | 
2129  | 0  |     }  | 
2130  | 0  |     break;  | 
2131  |  |  | 
2132  | 0  |     default:  | 
2133  | 0  |       return FALSE;  | 
2134  | 0  |   }  | 
2135  |  |  | 
2136  | 0  |   return TRUE;  | 
2137  | 0  | }  | 
2138  |  |  | 
2139  |  | static BOOL update_message_process_secondary_update_class(rdpUpdateProxy* proxy, wMessage* msg,  | 
2140  |  |                                                           int type)  | 
2141  | 0  | { | 
2142  | 0  |   if (!proxy || !msg)  | 
2143  | 0  |     return FALSE;  | 
2144  |  |  | 
2145  | 0  |   switch (type)  | 
2146  | 0  |   { | 
2147  | 0  |     case SecondaryUpdate_CacheBitmap:  | 
2148  | 0  |       return IFCALLRESULT(TRUE, proxy->CacheBitmap, msg->context,  | 
2149  | 0  |                           (CACHE_BITMAP_ORDER*)msg->wParam);  | 
2150  |  |  | 
2151  | 0  |     case SecondaryUpdate_CacheBitmapV2:  | 
2152  | 0  |       return IFCALLRESULT(TRUE, proxy->CacheBitmapV2, msg->context,  | 
2153  | 0  |                           (CACHE_BITMAP_V2_ORDER*)msg->wParam);  | 
2154  |  |  | 
2155  | 0  |     case SecondaryUpdate_CacheBitmapV3:  | 
2156  | 0  |       return IFCALLRESULT(TRUE, proxy->CacheBitmapV3, msg->context,  | 
2157  | 0  |                           (CACHE_BITMAP_V3_ORDER*)msg->wParam);  | 
2158  |  |  | 
2159  | 0  |     case SecondaryUpdate_CacheColorTable:  | 
2160  | 0  |       return IFCALLRESULT(TRUE, proxy->CacheColorTable, msg->context,  | 
2161  | 0  |                           (CACHE_COLOR_TABLE_ORDER*)msg->wParam);  | 
2162  |  |  | 
2163  | 0  |     case SecondaryUpdate_CacheGlyph:  | 
2164  | 0  |       return IFCALLRESULT(TRUE, proxy->CacheGlyph, msg->context,  | 
2165  | 0  |                           (CACHE_GLYPH_ORDER*)msg->wParam);  | 
2166  |  |  | 
2167  | 0  |     case SecondaryUpdate_CacheGlyphV2:  | 
2168  | 0  |       return IFCALLRESULT(TRUE, proxy->CacheGlyphV2, msg->context,  | 
2169  | 0  |                           (CACHE_GLYPH_V2_ORDER*)msg->wParam);  | 
2170  |  |  | 
2171  | 0  |     case SecondaryUpdate_CacheBrush:  | 
2172  | 0  |       return IFCALLRESULT(TRUE, proxy->CacheBrush, msg->context,  | 
2173  | 0  |                           (CACHE_BRUSH_ORDER*)msg->wParam);  | 
2174  |  |  | 
2175  | 0  |     default:  | 
2176  | 0  |       return FALSE;  | 
2177  | 0  |   }  | 
2178  | 0  | }  | 
2179  |  |  | 
2180  |  | static BOOL update_message_free_altsec_update_class(wMessage* msg, int type)  | 
2181  | 0  | { | 
2182  | 0  |   if (!msg)  | 
2183  | 0  |     return FALSE;  | 
2184  |  |  | 
2185  | 0  |   switch (type)  | 
2186  | 0  |   { | 
2187  | 0  |     case AltSecUpdate_CreateOffscreenBitmap:  | 
2188  | 0  |     { | 
2189  | 0  |       CREATE_OFFSCREEN_BITMAP_ORDER* wParam = (CREATE_OFFSCREEN_BITMAP_ORDER*)msg->wParam;  | 
2190  | 0  |       free(wParam->deleteList.indices);  | 
2191  | 0  |       free(wParam);  | 
2192  | 0  |     }  | 
2193  | 0  |     break;  | 
2194  |  |  | 
2195  | 0  |     case AltSecUpdate_SwitchSurface:  | 
2196  | 0  |       free(msg->wParam);  | 
2197  | 0  |       break;  | 
2198  |  |  | 
2199  | 0  |     case AltSecUpdate_CreateNineGridBitmap:  | 
2200  | 0  |       free(msg->wParam);  | 
2201  | 0  |       break;  | 
2202  |  |  | 
2203  | 0  |     case AltSecUpdate_FrameMarker:  | 
2204  | 0  |       free(msg->wParam);  | 
2205  | 0  |       break;  | 
2206  |  |  | 
2207  | 0  |     case AltSecUpdate_StreamBitmapFirst:  | 
2208  | 0  |       free(msg->wParam);  | 
2209  | 0  |       break;  | 
2210  |  |  | 
2211  | 0  |     case AltSecUpdate_StreamBitmapNext:  | 
2212  | 0  |       free(msg->wParam);  | 
2213  | 0  |       break;  | 
2214  |  |  | 
2215  | 0  |     case AltSecUpdate_DrawGdiPlusFirst:  | 
2216  | 0  |       free(msg->wParam);  | 
2217  | 0  |       break;  | 
2218  |  |  | 
2219  | 0  |     case AltSecUpdate_DrawGdiPlusNext:  | 
2220  | 0  |       free(msg->wParam);  | 
2221  | 0  |       break;  | 
2222  |  |  | 
2223  | 0  |     case AltSecUpdate_DrawGdiPlusEnd:  | 
2224  | 0  |       free(msg->wParam);  | 
2225  | 0  |       break;  | 
2226  |  |  | 
2227  | 0  |     case AltSecUpdate_DrawGdiPlusCacheFirst:  | 
2228  | 0  |       free(msg->wParam);  | 
2229  | 0  |       break;  | 
2230  |  |  | 
2231  | 0  |     case AltSecUpdate_DrawGdiPlusCacheNext:  | 
2232  | 0  |       free(msg->wParam);  | 
2233  | 0  |       break;  | 
2234  |  |  | 
2235  | 0  |     case AltSecUpdate_DrawGdiPlusCacheEnd:  | 
2236  | 0  |       free(msg->wParam);  | 
2237  | 0  |       break;  | 
2238  |  |  | 
2239  | 0  |     default:  | 
2240  | 0  |       return FALSE;  | 
2241  | 0  |   }  | 
2242  |  |  | 
2243  | 0  |   return TRUE;  | 
2244  | 0  | }  | 
2245  |  |  | 
2246  |  | static BOOL update_message_process_altsec_update_class(rdpUpdateProxy* proxy, wMessage* msg,  | 
2247  |  |                                                        int type)  | 
2248  | 0  | { | 
2249  | 0  |   if (!proxy || !msg)  | 
2250  | 0  |     return FALSE;  | 
2251  |  |  | 
2252  | 0  |   switch (type)  | 
2253  | 0  |   { | 
2254  | 0  |     case AltSecUpdate_CreateOffscreenBitmap:  | 
2255  | 0  |       return IFCALLRESULT(TRUE, proxy->CreateOffscreenBitmap, msg->context,  | 
2256  | 0  |                           (CREATE_OFFSCREEN_BITMAP_ORDER*)msg->wParam);  | 
2257  |  |  | 
2258  | 0  |     case AltSecUpdate_SwitchSurface:  | 
2259  | 0  |       return IFCALLRESULT(TRUE, proxy->SwitchSurface, msg->context,  | 
2260  | 0  |                           (SWITCH_SURFACE_ORDER*)msg->wParam);  | 
2261  |  |  | 
2262  | 0  |     case AltSecUpdate_CreateNineGridBitmap:  | 
2263  | 0  |       return IFCALLRESULT(TRUE, proxy->CreateNineGridBitmap, msg->context,  | 
2264  | 0  |                           (CREATE_NINE_GRID_BITMAP_ORDER*)msg->wParam);  | 
2265  |  |  | 
2266  | 0  |     case AltSecUpdate_FrameMarker:  | 
2267  | 0  |       return IFCALLRESULT(TRUE, proxy->FrameMarker, msg->context,  | 
2268  | 0  |                           (FRAME_MARKER_ORDER*)msg->wParam);  | 
2269  |  |  | 
2270  | 0  |     case AltSecUpdate_StreamBitmapFirst:  | 
2271  | 0  |       return IFCALLRESULT(TRUE, proxy->StreamBitmapFirst, msg->context,  | 
2272  | 0  |                           (STREAM_BITMAP_FIRST_ORDER*)msg->wParam);  | 
2273  |  |  | 
2274  | 0  |     case AltSecUpdate_StreamBitmapNext:  | 
2275  | 0  |       return IFCALLRESULT(TRUE, proxy->StreamBitmapNext, msg->context,  | 
2276  | 0  |                           (STREAM_BITMAP_NEXT_ORDER*)msg->wParam);  | 
2277  |  |  | 
2278  | 0  |     case AltSecUpdate_DrawGdiPlusFirst:  | 
2279  | 0  |       return IFCALLRESULT(TRUE, proxy->DrawGdiPlusFirst, msg->context,  | 
2280  | 0  |                           (DRAW_GDIPLUS_FIRST_ORDER*)msg->wParam);  | 
2281  |  |  | 
2282  | 0  |     case AltSecUpdate_DrawGdiPlusNext:  | 
2283  | 0  |       return IFCALLRESULT(TRUE, proxy->DrawGdiPlusNext, msg->context,  | 
2284  | 0  |                           (DRAW_GDIPLUS_NEXT_ORDER*)msg->wParam);  | 
2285  |  |  | 
2286  | 0  |     case AltSecUpdate_DrawGdiPlusEnd:  | 
2287  | 0  |       return IFCALLRESULT(TRUE, proxy->DrawGdiPlusEnd, msg->context,  | 
2288  | 0  |                           (DRAW_GDIPLUS_END_ORDER*)msg->wParam);  | 
2289  |  |  | 
2290  | 0  |     case AltSecUpdate_DrawGdiPlusCacheFirst:  | 
2291  | 0  |       return IFCALLRESULT(TRUE, proxy->DrawGdiPlusCacheFirst, msg->context,  | 
2292  | 0  |                           (DRAW_GDIPLUS_CACHE_FIRST_ORDER*)msg->wParam);  | 
2293  |  |  | 
2294  | 0  |     case AltSecUpdate_DrawGdiPlusCacheNext:  | 
2295  | 0  |       return IFCALLRESULT(TRUE, proxy->DrawGdiPlusCacheNext, msg->context,  | 
2296  | 0  |                           (DRAW_GDIPLUS_CACHE_NEXT_ORDER*)msg->wParam);  | 
2297  |  |  | 
2298  | 0  |     case AltSecUpdate_DrawGdiPlusCacheEnd:  | 
2299  | 0  |       return IFCALLRESULT(TRUE, proxy->DrawGdiPlusCacheEnd, msg->context,  | 
2300  | 0  |                           (DRAW_GDIPLUS_CACHE_END_ORDER*)msg->wParam);  | 
2301  |  |  | 
2302  | 0  |     default:  | 
2303  | 0  |       return FALSE;  | 
2304  | 0  |   }  | 
2305  | 0  | }  | 
2306  |  |  | 
2307  |  | static BOOL update_message_free_window_update_class(wMessage* msg, int type)  | 
2308  | 0  | { | 
2309  | 0  |   if (!msg)  | 
2310  | 0  |     return FALSE;  | 
2311  |  |  | 
2312  | 0  |   switch (type)  | 
2313  | 0  |   { | 
2314  | 0  |     case WindowUpdate_WindowCreate:  | 
2315  | 0  |       free(msg->wParam);  | 
2316  | 0  |       free(msg->lParam);  | 
2317  | 0  |       break;  | 
2318  |  |  | 
2319  | 0  |     case WindowUpdate_WindowUpdate:  | 
2320  | 0  |       free(msg->wParam);  | 
2321  | 0  |       free(msg->lParam);  | 
2322  | 0  |       break;  | 
2323  |  |  | 
2324  | 0  |     case WindowUpdate_WindowIcon:  | 
2325  | 0  |     { | 
2326  | 0  |       WINDOW_ORDER_INFO* orderInfo = (WINDOW_ORDER_INFO*)msg->wParam;  | 
2327  | 0  |       WINDOW_ICON_ORDER* windowIcon = (WINDOW_ICON_ORDER*)msg->lParam;  | 
2328  |  | 
  | 
2329  | 0  |       if (windowIcon->iconInfo->cbBitsColor > 0)  | 
2330  | 0  |       { | 
2331  | 0  |         free(windowIcon->iconInfo->bitsColor);  | 
2332  | 0  |       }  | 
2333  |  | 
  | 
2334  | 0  |       if (windowIcon->iconInfo->cbBitsMask > 0)  | 
2335  | 0  |       { | 
2336  | 0  |         free(windowIcon->iconInfo->bitsMask);  | 
2337  | 0  |       }  | 
2338  |  | 
  | 
2339  | 0  |       if (windowIcon->iconInfo->cbColorTable > 0)  | 
2340  | 0  |       { | 
2341  | 0  |         free(windowIcon->iconInfo->colorTable);  | 
2342  | 0  |       }  | 
2343  |  | 
  | 
2344  | 0  |       free(orderInfo);  | 
2345  | 0  |       free(windowIcon->iconInfo);  | 
2346  | 0  |       free(windowIcon);  | 
2347  | 0  |     }  | 
2348  | 0  |     break;  | 
2349  |  |  | 
2350  | 0  |     case WindowUpdate_WindowCachedIcon:  | 
2351  | 0  |       free(msg->wParam);  | 
2352  | 0  |       free(msg->lParam);  | 
2353  | 0  |       break;  | 
2354  |  |  | 
2355  | 0  |     case WindowUpdate_WindowDelete:  | 
2356  | 0  |       free(msg->wParam);  | 
2357  | 0  |       break;  | 
2358  |  |  | 
2359  | 0  |     case WindowUpdate_NotifyIconCreate:  | 
2360  | 0  |       free(msg->wParam);  | 
2361  | 0  |       free(msg->lParam);  | 
2362  | 0  |       break;  | 
2363  |  |  | 
2364  | 0  |     case WindowUpdate_NotifyIconUpdate:  | 
2365  | 0  |       free(msg->wParam);  | 
2366  | 0  |       free(msg->lParam);  | 
2367  | 0  |       break;  | 
2368  |  |  | 
2369  | 0  |     case WindowUpdate_NotifyIconDelete:  | 
2370  | 0  |       free(msg->wParam);  | 
2371  | 0  |       break;  | 
2372  |  |  | 
2373  | 0  |     case WindowUpdate_MonitoredDesktop:  | 
2374  | 0  |     { | 
2375  | 0  |       MONITORED_DESKTOP_ORDER* lParam = (MONITORED_DESKTOP_ORDER*)msg->lParam;  | 
2376  | 0  |       free(msg->wParam);  | 
2377  | 0  |       free(lParam->windowIds);  | 
2378  | 0  |       free(lParam);  | 
2379  | 0  |     }  | 
2380  | 0  |     break;  | 
2381  |  |  | 
2382  | 0  |     case WindowUpdate_NonMonitoredDesktop:  | 
2383  | 0  |       free(msg->wParam);  | 
2384  | 0  |       break;  | 
2385  |  |  | 
2386  | 0  |     default:  | 
2387  | 0  |       return FALSE;  | 
2388  | 0  |   }  | 
2389  |  |  | 
2390  | 0  |   return TRUE;  | 
2391  | 0  | }  | 
2392  |  |  | 
2393  |  | static BOOL update_message_process_window_update_class(rdpUpdateProxy* proxy, wMessage* msg,  | 
2394  |  |                                                        int type)  | 
2395  | 0  | { | 
2396  | 0  |   if (!proxy || !msg)  | 
2397  | 0  |     return FALSE;  | 
2398  |  |  | 
2399  | 0  |   switch (type)  | 
2400  | 0  |   { | 
2401  | 0  |     case WindowUpdate_WindowCreate:  | 
2402  | 0  |       return IFCALLRESULT(TRUE, proxy->WindowCreate, msg->context,  | 
2403  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam, (WINDOW_STATE_ORDER*)msg->lParam);  | 
2404  |  |  | 
2405  | 0  |     case WindowUpdate_WindowUpdate:  | 
2406  | 0  |       return IFCALLRESULT(TRUE, proxy->WindowCreate, msg->context,  | 
2407  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam, (WINDOW_STATE_ORDER*)msg->lParam);  | 
2408  |  |  | 
2409  | 0  |     case WindowUpdate_WindowIcon:  | 
2410  | 0  |     { | 
2411  | 0  |       WINDOW_ORDER_INFO* orderInfo = (WINDOW_ORDER_INFO*)msg->wParam;  | 
2412  | 0  |       WINDOW_ICON_ORDER* windowIcon = (WINDOW_ICON_ORDER*)msg->lParam;  | 
2413  | 0  |       return IFCALLRESULT(TRUE, proxy->WindowIcon, msg->context, orderInfo, windowIcon);  | 
2414  | 0  |     }  | 
2415  |  |  | 
2416  | 0  |     case WindowUpdate_WindowCachedIcon:  | 
2417  | 0  |       return IFCALLRESULT(TRUE, proxy->WindowCachedIcon, msg->context,  | 
2418  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam,  | 
2419  | 0  |                           (WINDOW_CACHED_ICON_ORDER*)msg->lParam);  | 
2420  |  |  | 
2421  | 0  |     case WindowUpdate_WindowDelete:  | 
2422  | 0  |       return IFCALLRESULT(TRUE, proxy->WindowDelete, msg->context,  | 
2423  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam);  | 
2424  |  |  | 
2425  | 0  |     case WindowUpdate_NotifyIconCreate:  | 
2426  | 0  |       return IFCALLRESULT(TRUE, proxy->NotifyIconCreate, msg->context,  | 
2427  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam,  | 
2428  | 0  |                           (NOTIFY_ICON_STATE_ORDER*)msg->lParam);  | 
2429  |  |  | 
2430  | 0  |     case WindowUpdate_NotifyIconUpdate:  | 
2431  | 0  |       return IFCALLRESULT(TRUE, proxy->NotifyIconUpdate, msg->context,  | 
2432  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam,  | 
2433  | 0  |                           (NOTIFY_ICON_STATE_ORDER*)msg->lParam);  | 
2434  |  |  | 
2435  | 0  |     case WindowUpdate_NotifyIconDelete:  | 
2436  | 0  |       return IFCALLRESULT(TRUE, proxy->NotifyIconDelete, msg->context,  | 
2437  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam);  | 
2438  |  |  | 
2439  | 0  |     case WindowUpdate_MonitoredDesktop:  | 
2440  | 0  |       return IFCALLRESULT(TRUE, proxy->MonitoredDesktop, msg->context,  | 
2441  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam,  | 
2442  | 0  |                           (MONITORED_DESKTOP_ORDER*)msg->lParam);  | 
2443  |  |  | 
2444  | 0  |     case WindowUpdate_NonMonitoredDesktop:  | 
2445  | 0  |       return IFCALLRESULT(TRUE, proxy->NonMonitoredDesktop, msg->context,  | 
2446  | 0  |                           (WINDOW_ORDER_INFO*)msg->wParam);  | 
2447  |  |  | 
2448  | 0  |     default:  | 
2449  | 0  |       return FALSE;  | 
2450  | 0  |   }  | 
2451  | 0  | }  | 
2452  |  |  | 
2453  |  | static BOOL update_message_free_pointer_update_class(wMessage* msg, int type)  | 
2454  | 0  | { | 
2455  | 0  |   rdpContext* context = NULL;  | 
2456  |  | 
  | 
2457  | 0  |   if (!msg)  | 
2458  | 0  |     return FALSE;  | 
2459  |  |  | 
2460  | 0  |   context = msg->context;  | 
2461  |  | 
  | 
2462  | 0  |   switch (type)  | 
2463  | 0  |   { | 
2464  | 0  |     case PointerUpdate_PointerPosition:  | 
2465  | 0  |     { | 
2466  | 0  |       POINTER_POSITION_UPDATE* wParam = (POINTER_POSITION_UPDATE*)msg->wParam;  | 
2467  | 0  |       free_pointer_position_update(context, wParam);  | 
2468  | 0  |     }  | 
2469  | 0  |     break;  | 
2470  |  |  | 
2471  | 0  |     case PointerUpdate_PointerSystem:  | 
2472  | 0  |     { | 
2473  | 0  |       POINTER_SYSTEM_UPDATE* wParam = (POINTER_SYSTEM_UPDATE*)msg->wParam;  | 
2474  | 0  |       free_pointer_system_update(context, wParam);  | 
2475  | 0  |     }  | 
2476  | 0  |     break;  | 
2477  |  |  | 
2478  | 0  |     case PointerUpdate_PointerCached:  | 
2479  | 0  |     { | 
2480  | 0  |       POINTER_CACHED_UPDATE* wParam = (POINTER_CACHED_UPDATE*)msg->wParam;  | 
2481  | 0  |       free_pointer_cached_update(context, wParam);  | 
2482  | 0  |     }  | 
2483  | 0  |     break;  | 
2484  |  |  | 
2485  | 0  |     case PointerUpdate_PointerColor:  | 
2486  | 0  |     { | 
2487  | 0  |       POINTER_COLOR_UPDATE* wParam = (POINTER_COLOR_UPDATE*)msg->wParam;  | 
2488  | 0  |       free_pointer_color_update(context, wParam);  | 
2489  | 0  |     }  | 
2490  | 0  |     break;  | 
2491  |  |  | 
2492  | 0  |     case PointerUpdate_PointerNew:  | 
2493  | 0  |     { | 
2494  | 0  |       POINTER_NEW_UPDATE* wParam = (POINTER_NEW_UPDATE*)msg->wParam;  | 
2495  | 0  |       free_pointer_new_update(context, wParam);  | 
2496  | 0  |     }  | 
2497  | 0  |     break;  | 
2498  |  |  | 
2499  | 0  |     default:  | 
2500  | 0  |       return FALSE;  | 
2501  | 0  |   }  | 
2502  |  |  | 
2503  | 0  |   return TRUE;  | 
2504  | 0  | }  | 
2505  |  |  | 
2506  |  | static BOOL update_message_process_pointer_update_class(rdpUpdateProxy* proxy, wMessage* msg,  | 
2507  |  |                                                         int type)  | 
2508  | 0  | { | 
2509  | 0  |   if (!proxy || !msg)  | 
2510  | 0  |     return FALSE;  | 
2511  |  |  | 
2512  | 0  |   switch (type)  | 
2513  | 0  |   { | 
2514  | 0  |     case PointerUpdate_PointerPosition:  | 
2515  | 0  |       return IFCALLRESULT(TRUE, proxy->PointerPosition, msg->context,  | 
2516  | 0  |                           (POINTER_POSITION_UPDATE*)msg->wParam);  | 
2517  |  |  | 
2518  | 0  |     case PointerUpdate_PointerSystem:  | 
2519  | 0  |       return IFCALLRESULT(TRUE, proxy->PointerSystem, msg->context,  | 
2520  | 0  |                           (POINTER_SYSTEM_UPDATE*)msg->wParam);  | 
2521  |  |  | 
2522  | 0  |     case PointerUpdate_PointerColor:  | 
2523  | 0  |       return IFCALLRESULT(TRUE, proxy->PointerColor, msg->context,  | 
2524  | 0  |                           (POINTER_COLOR_UPDATE*)msg->wParam);  | 
2525  |  |  | 
2526  | 0  |     case PointerUpdate_PointerNew:  | 
2527  | 0  |       return IFCALLRESULT(TRUE, proxy->PointerNew, msg->context,  | 
2528  | 0  |                           (POINTER_NEW_UPDATE*)msg->wParam);  | 
2529  |  |  | 
2530  | 0  |     case PointerUpdate_PointerCached:  | 
2531  | 0  |       return IFCALLRESULT(TRUE, proxy->PointerCached, msg->context,  | 
2532  | 0  |                           (POINTER_CACHED_UPDATE*)msg->wParam);  | 
2533  |  |  | 
2534  | 0  |     default:  | 
2535  | 0  |       return FALSE;  | 
2536  | 0  |   }  | 
2537  | 0  | }  | 
2538  |  |  | 
2539  |  | static BOOL update_message_free_class(wMessage* msg, int msgClass, int msgType)  | 
2540  | 0  | { | 
2541  | 0  |   BOOL status = FALSE;  | 
2542  |  | 
  | 
2543  | 0  |   switch (msgClass)  | 
2544  | 0  |   { | 
2545  | 0  |     case Update_Class:  | 
2546  | 0  |       status = update_message_free_update_class(msg, msgType);  | 
2547  | 0  |       break;  | 
2548  |  |  | 
2549  | 0  |     case PrimaryUpdate_Class:  | 
2550  | 0  |       status = update_message_free_primary_update_class(msg, msgType);  | 
2551  | 0  |       break;  | 
2552  |  |  | 
2553  | 0  |     case SecondaryUpdate_Class:  | 
2554  | 0  |       status = update_message_free_secondary_update_class(msg, msgType);  | 
2555  | 0  |       break;  | 
2556  |  |  | 
2557  | 0  |     case AltSecUpdate_Class:  | 
2558  | 0  |       status = update_message_free_altsec_update_class(msg, msgType);  | 
2559  | 0  |       break;  | 
2560  |  |  | 
2561  | 0  |     case WindowUpdate_Class:  | 
2562  | 0  |       status = update_message_free_window_update_class(msg, msgType);  | 
2563  | 0  |       break;  | 
2564  |  |  | 
2565  | 0  |     case PointerUpdate_Class:  | 
2566  | 0  |       status = update_message_free_pointer_update_class(msg, msgType);  | 
2567  | 0  |       break;  | 
2568  |  |  | 
2569  | 0  |     default:  | 
2570  | 0  |       break;  | 
2571  | 0  |   }  | 
2572  |  |  | 
2573  | 0  |   if (!status)  | 
2574  | 0  |     WLog_ERR(TAG, "Unknown message: class: %d type: %d", msgClass, msgType);  | 
2575  |  | 
  | 
2576  | 0  |   return status;  | 
2577  | 0  | }  | 
2578  |  |  | 
2579  |  | static int update_message_process_class(rdpUpdateProxy* proxy, wMessage* msg, int msgClass,  | 
2580  |  |                                         int msgType)  | 
2581  | 0  | { | 
2582  | 0  |   BOOL status = FALSE;  | 
2583  |  | 
  | 
2584  | 0  |   switch (msgClass)  | 
2585  | 0  |   { | 
2586  | 0  |     case Update_Class:  | 
2587  | 0  |       status = update_message_process_update_class(proxy, msg, msgType);  | 
2588  | 0  |       break;  | 
2589  |  |  | 
2590  | 0  |     case PrimaryUpdate_Class:  | 
2591  | 0  |       status = update_message_process_primary_update_class(proxy, msg, msgType);  | 
2592  | 0  |       break;  | 
2593  |  |  | 
2594  | 0  |     case SecondaryUpdate_Class:  | 
2595  | 0  |       status = update_message_process_secondary_update_class(proxy, msg, msgType);  | 
2596  | 0  |       break;  | 
2597  |  |  | 
2598  | 0  |     case AltSecUpdate_Class:  | 
2599  | 0  |       status = update_message_process_altsec_update_class(proxy, msg, msgType);  | 
2600  | 0  |       break;  | 
2601  |  |  | 
2602  | 0  |     case WindowUpdate_Class:  | 
2603  | 0  |       status = update_message_process_window_update_class(proxy, msg, msgType);  | 
2604  | 0  |       break;  | 
2605  |  |  | 
2606  | 0  |     case PointerUpdate_Class:  | 
2607  | 0  |       status = update_message_process_pointer_update_class(proxy, msg, msgType);  | 
2608  | 0  |       break;  | 
2609  |  |  | 
2610  | 0  |     default:  | 
2611  | 0  |       status = FALSE;  | 
2612  | 0  |       break;  | 
2613  | 0  |   }  | 
2614  |  |  | 
2615  | 0  |   if (!status)  | 
2616  | 0  |   { | 
2617  | 0  |     WLog_ERR(TAG, "message: class: %d type: %d failed", msgClass, msgType);  | 
2618  | 0  |     return -1;  | 
2619  | 0  |   }  | 
2620  |  |  | 
2621  | 0  |   return 0;  | 
2622  | 0  | }  | 
2623  |  |  | 
2624  |  | int update_message_queue_process_message(rdpUpdate* update, wMessage* message)  | 
2625  | 0  | { | 
2626  | 0  |   int status = 0;  | 
2627  | 0  |   int msgClass = 0;  | 
2628  | 0  |   int msgType = 0;  | 
2629  | 0  |   rdp_update_internal* up = update_cast(update);  | 
2630  |  | 
  | 
2631  | 0  |   if (!update || !message)  | 
2632  | 0  |     return -1;  | 
2633  |  |  | 
2634  | 0  |   if (message->id == WMQ_QUIT)  | 
2635  | 0  |     return 0;  | 
2636  |  |  | 
2637  | 0  |   msgClass = GetMessageClass(message->id);  | 
2638  | 0  |   msgType = GetMessageType(message->id);  | 
2639  | 0  |   status = update_message_process_class(up->proxy, message, msgClass, msgType);  | 
2640  | 0  |   update_message_free_class(message, msgClass, msgType);  | 
2641  |  | 
  | 
2642  | 0  |   if (status < 0)  | 
2643  | 0  |     return -1;  | 
2644  |  |  | 
2645  | 0  |   return 1;  | 
2646  | 0  | }  | 
2647  |  |  | 
2648  |  | int update_message_queue_free_message(wMessage* message)  | 
2649  | 0  | { | 
2650  | 0  |   int msgClass = 0;  | 
2651  | 0  |   int msgType = 0;  | 
2652  |  | 
  | 
2653  | 0  |   if (!message)  | 
2654  | 0  |     return -1;  | 
2655  |  |  | 
2656  | 0  |   if (message->id == WMQ_QUIT)  | 
2657  | 0  |     return 0;  | 
2658  |  |  | 
2659  | 0  |   msgClass = GetMessageClass(message->id);  | 
2660  | 0  |   msgType = GetMessageType(message->id);  | 
2661  | 0  |   return update_message_free_class(message, msgClass, msgType);  | 
2662  | 0  | }  | 
2663  |  |  | 
2664  |  | int update_message_queue_process_pending_messages(rdpUpdate* update)  | 
2665  | 0  | { | 
2666  | 0  |   int status = 1;  | 
2667  | 0  |   wMessage message = { 0 }; | 
2668  | 0  |   rdp_update_internal* up = update_cast(update);  | 
2669  |  | 
  | 
2670  | 0  |   wMessageQueue* queue = up->queue;  | 
2671  |  | 
  | 
2672  | 0  |   while (MessageQueue_Peek(queue, &message, TRUE))  | 
2673  | 0  |   { | 
2674  | 0  |     status = update_message_queue_process_message(update, &message);  | 
2675  |  | 
  | 
2676  | 0  |     if (!status)  | 
2677  | 0  |       break;  | 
2678  | 0  |   }  | 
2679  |  | 
  | 
2680  | 0  |   return status;  | 
2681  | 0  | }  | 
2682  |  |  | 
2683  |  | static BOOL update_message_register_interface(rdpUpdateProxy* message, rdpUpdate* update)  | 
2684  | 0  | { | 
2685  | 0  |   rdpPrimaryUpdate* primary = NULL;  | 
2686  | 0  |   rdpSecondaryUpdate* secondary = NULL;  | 
2687  | 0  |   rdpAltSecUpdate* altsec = NULL;  | 
2688  | 0  |   rdpWindowUpdate* window = NULL;  | 
2689  | 0  |   rdpPointerUpdate* pointer = NULL;  | 
2690  |  | 
  | 
2691  | 0  |   if (!message || !update)  | 
2692  | 0  |     return FALSE;  | 
2693  |  |  | 
2694  | 0  |   primary = update->primary;  | 
2695  | 0  |   secondary = update->secondary;  | 
2696  | 0  |   altsec = update->altsec;  | 
2697  | 0  |   window = update->window;  | 
2698  | 0  |   pointer = update->pointer;  | 
2699  |  | 
  | 
2700  | 0  |   if (!primary || !secondary || !altsec || !window || !pointer)  | 
2701  | 0  |     return FALSE;  | 
2702  |  |  | 
2703  |  |   /* Update */  | 
2704  | 0  |   message->BeginPaint = update->BeginPaint;  | 
2705  | 0  |   message->EndPaint = update->EndPaint;  | 
2706  | 0  |   message->SetBounds = update->SetBounds;  | 
2707  | 0  |   message->Synchronize = update->Synchronize;  | 
2708  | 0  |   message->DesktopResize = update->DesktopResize;  | 
2709  | 0  |   message->BitmapUpdate = update->BitmapUpdate;  | 
2710  | 0  |   message->Palette = update->Palette;  | 
2711  | 0  |   message->PlaySound = update->PlaySound;  | 
2712  | 0  |   message->SetKeyboardIndicators = update->SetKeyboardIndicators;  | 
2713  | 0  |   message->SetKeyboardImeStatus = update->SetKeyboardImeStatus;  | 
2714  | 0  |   message->RefreshRect = update->RefreshRect;  | 
2715  | 0  |   message->SuppressOutput = update->SuppressOutput;  | 
2716  | 0  |   message->SurfaceCommand = update->SurfaceCommand;  | 
2717  | 0  |   message->SurfaceBits = update->SurfaceBits;  | 
2718  | 0  |   message->SurfaceFrameMarker = update->SurfaceFrameMarker;  | 
2719  | 0  |   message->SurfaceFrameAcknowledge = update->SurfaceFrameAcknowledge;  | 
2720  | 0  |   update->BeginPaint = update_message_BeginPaint;  | 
2721  | 0  |   update->EndPaint = update_message_EndPaint;  | 
2722  | 0  |   update->SetBounds = update_message_SetBounds;  | 
2723  | 0  |   update->Synchronize = update_message_Synchronize;  | 
2724  | 0  |   update->DesktopResize = update_message_DesktopResize;  | 
2725  | 0  |   update->BitmapUpdate = update_message_BitmapUpdate;  | 
2726  | 0  |   update->Palette = update_message_Palette;  | 
2727  | 0  |   update->PlaySound = update_message_PlaySound;  | 
2728  | 0  |   update->SetKeyboardIndicators = update_message_SetKeyboardIndicators;  | 
2729  | 0  |   update->SetKeyboardImeStatus = update_message_SetKeyboardImeStatus;  | 
2730  | 0  |   update->RefreshRect = update_message_RefreshRect;  | 
2731  | 0  |   update->SuppressOutput = update_message_SuppressOutput;  | 
2732  | 0  |   update->SurfaceCommand = update_message_SurfaceCommand;  | 
2733  | 0  |   update->SurfaceBits = update_message_SurfaceBits;  | 
2734  | 0  |   update->SurfaceFrameMarker = update_message_SurfaceFrameMarker;  | 
2735  | 0  |   update->SurfaceFrameAcknowledge = update_message_SurfaceFrameAcknowledge;  | 
2736  |  |   /* Primary Update */  | 
2737  | 0  |   message->DstBlt = primary->DstBlt;  | 
2738  | 0  |   message->PatBlt = primary->PatBlt;  | 
2739  | 0  |   message->ScrBlt = primary->ScrBlt;  | 
2740  | 0  |   message->OpaqueRect = primary->OpaqueRect;  | 
2741  | 0  |   message->DrawNineGrid = primary->DrawNineGrid;  | 
2742  | 0  |   message->MultiDstBlt = primary->MultiDstBlt;  | 
2743  | 0  |   message->MultiPatBlt = primary->MultiPatBlt;  | 
2744  | 0  |   message->MultiScrBlt = primary->MultiScrBlt;  | 
2745  | 0  |   message->MultiOpaqueRect = primary->MultiOpaqueRect;  | 
2746  | 0  |   message->MultiDrawNineGrid = primary->MultiDrawNineGrid;  | 
2747  | 0  |   message->LineTo = primary->LineTo;  | 
2748  | 0  |   message->Polyline = primary->Polyline;  | 
2749  | 0  |   message->MemBlt = primary->MemBlt;  | 
2750  | 0  |   message->Mem3Blt = primary->Mem3Blt;  | 
2751  | 0  |   message->SaveBitmap = primary->SaveBitmap;  | 
2752  | 0  |   message->GlyphIndex = primary->GlyphIndex;  | 
2753  | 0  |   message->FastIndex = primary->FastIndex;  | 
2754  | 0  |   message->FastGlyph = primary->FastGlyph;  | 
2755  | 0  |   message->PolygonSC = primary->PolygonSC;  | 
2756  | 0  |   message->PolygonCB = primary->PolygonCB;  | 
2757  | 0  |   message->EllipseSC = primary->EllipseSC;  | 
2758  | 0  |   message->EllipseCB = primary->EllipseCB;  | 
2759  | 0  |   primary->DstBlt = update_message_DstBlt;  | 
2760  | 0  |   primary->PatBlt = update_message_PatBlt;  | 
2761  | 0  |   primary->ScrBlt = update_message_ScrBlt;  | 
2762  | 0  |   primary->OpaqueRect = update_message_OpaqueRect;  | 
2763  | 0  |   primary->DrawNineGrid = update_message_DrawNineGrid;  | 
2764  | 0  |   primary->MultiDstBlt = update_message_MultiDstBlt;  | 
2765  | 0  |   primary->MultiPatBlt = update_message_MultiPatBlt;  | 
2766  | 0  |   primary->MultiScrBlt = update_message_MultiScrBlt;  | 
2767  | 0  |   primary->MultiOpaqueRect = update_message_MultiOpaqueRect;  | 
2768  | 0  |   primary->MultiDrawNineGrid = update_message_MultiDrawNineGrid;  | 
2769  | 0  |   primary->LineTo = update_message_LineTo;  | 
2770  | 0  |   primary->Polyline = update_message_Polyline;  | 
2771  | 0  |   primary->MemBlt = update_message_MemBlt;  | 
2772  | 0  |   primary->Mem3Blt = update_message_Mem3Blt;  | 
2773  | 0  |   primary->SaveBitmap = update_message_SaveBitmap;  | 
2774  | 0  |   primary->GlyphIndex = update_message_GlyphIndex;  | 
2775  | 0  |   primary->FastIndex = update_message_FastIndex;  | 
2776  | 0  |   primary->FastGlyph = update_message_FastGlyph;  | 
2777  | 0  |   primary->PolygonSC = update_message_PolygonSC;  | 
2778  | 0  |   primary->PolygonCB = update_message_PolygonCB;  | 
2779  | 0  |   primary->EllipseSC = update_message_EllipseSC;  | 
2780  | 0  |   primary->EllipseCB = update_message_EllipseCB;  | 
2781  |  |   /* Secondary Update */  | 
2782  | 0  |   message->CacheBitmap = secondary->CacheBitmap;  | 
2783  | 0  |   message->CacheBitmapV2 = secondary->CacheBitmapV2;  | 
2784  | 0  |   message->CacheBitmapV3 = secondary->CacheBitmapV3;  | 
2785  | 0  |   message->CacheColorTable = secondary->CacheColorTable;  | 
2786  | 0  |   message->CacheGlyph = secondary->CacheGlyph;  | 
2787  | 0  |   message->CacheGlyphV2 = secondary->CacheGlyphV2;  | 
2788  | 0  |   message->CacheBrush = secondary->CacheBrush;  | 
2789  | 0  |   secondary->CacheBitmap = update_message_CacheBitmap;  | 
2790  | 0  |   secondary->CacheBitmapV2 = update_message_CacheBitmapV2;  | 
2791  | 0  |   secondary->CacheBitmapV3 = update_message_CacheBitmapV3;  | 
2792  | 0  |   secondary->CacheColorTable = update_message_CacheColorTable;  | 
2793  | 0  |   secondary->CacheGlyph = update_message_CacheGlyph;  | 
2794  | 0  |   secondary->CacheGlyphV2 = update_message_CacheGlyphV2;  | 
2795  | 0  |   secondary->CacheBrush = update_message_CacheBrush;  | 
2796  |  |   /* Alternate Secondary Update */  | 
2797  | 0  |   message->CreateOffscreenBitmap = altsec->CreateOffscreenBitmap;  | 
2798  | 0  |   message->SwitchSurface = altsec->SwitchSurface;  | 
2799  | 0  |   message->CreateNineGridBitmap = altsec->CreateNineGridBitmap;  | 
2800  | 0  |   message->FrameMarker = altsec->FrameMarker;  | 
2801  | 0  |   message->StreamBitmapFirst = altsec->StreamBitmapFirst;  | 
2802  | 0  |   message->StreamBitmapNext = altsec->StreamBitmapNext;  | 
2803  | 0  |   message->DrawGdiPlusFirst = altsec->DrawGdiPlusFirst;  | 
2804  | 0  |   message->DrawGdiPlusNext = altsec->DrawGdiPlusNext;  | 
2805  | 0  |   message->DrawGdiPlusEnd = altsec->DrawGdiPlusEnd;  | 
2806  | 0  |   message->DrawGdiPlusCacheFirst = altsec->DrawGdiPlusCacheFirst;  | 
2807  | 0  |   message->DrawGdiPlusCacheNext = altsec->DrawGdiPlusCacheNext;  | 
2808  | 0  |   message->DrawGdiPlusCacheEnd = altsec->DrawGdiPlusCacheEnd;  | 
2809  | 0  |   altsec->CreateOffscreenBitmap = update_message_CreateOffscreenBitmap;  | 
2810  | 0  |   altsec->SwitchSurface = update_message_SwitchSurface;  | 
2811  | 0  |   altsec->CreateNineGridBitmap = update_message_CreateNineGridBitmap;  | 
2812  | 0  |   altsec->FrameMarker = update_message_FrameMarker;  | 
2813  | 0  |   altsec->StreamBitmapFirst = update_message_StreamBitmapFirst;  | 
2814  | 0  |   altsec->StreamBitmapNext = update_message_StreamBitmapNext;  | 
2815  | 0  |   altsec->DrawGdiPlusFirst = update_message_DrawGdiPlusFirst;  | 
2816  | 0  |   altsec->DrawGdiPlusNext = update_message_DrawGdiPlusNext;  | 
2817  | 0  |   altsec->DrawGdiPlusEnd = update_message_DrawGdiPlusEnd;  | 
2818  | 0  |   altsec->DrawGdiPlusCacheFirst = update_message_DrawGdiPlusCacheFirst;  | 
2819  | 0  |   altsec->DrawGdiPlusCacheNext = update_message_DrawGdiPlusCacheNext;  | 
2820  | 0  |   altsec->DrawGdiPlusCacheEnd = update_message_DrawGdiPlusCacheEnd;  | 
2821  |  |   /* Window Update */  | 
2822  | 0  |   message->WindowCreate = window->WindowCreate;  | 
2823  | 0  |   message->WindowUpdate = window->WindowUpdate;  | 
2824  | 0  |   message->WindowIcon = window->WindowIcon;  | 
2825  | 0  |   message->WindowCachedIcon = window->WindowCachedIcon;  | 
2826  | 0  |   message->WindowDelete = window->WindowDelete;  | 
2827  | 0  |   message->NotifyIconCreate = window->NotifyIconCreate;  | 
2828  | 0  |   message->NotifyIconUpdate = window->NotifyIconUpdate;  | 
2829  | 0  |   message->NotifyIconDelete = window->NotifyIconDelete;  | 
2830  | 0  |   message->MonitoredDesktop = window->MonitoredDesktop;  | 
2831  | 0  |   message->NonMonitoredDesktop = window->NonMonitoredDesktop;  | 
2832  | 0  |   window->WindowCreate = update_message_WindowCreate;  | 
2833  | 0  |   window->WindowUpdate = update_message_WindowUpdate;  | 
2834  | 0  |   window->WindowIcon = update_message_WindowIcon;  | 
2835  | 0  |   window->WindowCachedIcon = update_message_WindowCachedIcon;  | 
2836  | 0  |   window->WindowDelete = update_message_WindowDelete;  | 
2837  | 0  |   window->NotifyIconCreate = update_message_NotifyIconCreate;  | 
2838  | 0  |   window->NotifyIconUpdate = update_message_NotifyIconUpdate;  | 
2839  | 0  |   window->NotifyIconDelete = update_message_NotifyIconDelete;  | 
2840  | 0  |   window->MonitoredDesktop = update_message_MonitoredDesktop;  | 
2841  | 0  |   window->NonMonitoredDesktop = update_message_NonMonitoredDesktop;  | 
2842  |  |   /* Pointer Update */  | 
2843  | 0  |   message->PointerPosition = pointer->PointerPosition;  | 
2844  | 0  |   message->PointerSystem = pointer->PointerSystem;  | 
2845  | 0  |   message->PointerColor = pointer->PointerColor;  | 
2846  | 0  |   message->PointerLarge = pointer->PointerLarge;  | 
2847  | 0  |   message->PointerNew = pointer->PointerNew;  | 
2848  | 0  |   message->PointerCached = pointer->PointerCached;  | 
2849  | 0  |   pointer->PointerPosition = update_message_PointerPosition;  | 
2850  | 0  |   pointer->PointerSystem = update_message_PointerSystem;  | 
2851  | 0  |   pointer->PointerColor = update_message_PointerColor;  | 
2852  | 0  |   pointer->PointerLarge = update_message_PointerLarge;  | 
2853  | 0  |   pointer->PointerNew = update_message_PointerNew;  | 
2854  | 0  |   pointer->PointerCached = update_message_PointerCached;  | 
2855  | 0  |   return TRUE;  | 
2856  | 0  | }  | 
2857  |  |  | 
2858  |  | static DWORD WINAPI update_message_proxy_thread(LPVOID arg)  | 
2859  | 0  | { | 
2860  | 0  |   rdpUpdate* update = (rdpUpdate*)arg;  | 
2861  | 0  |   wMessage message = { 0 }; | 
2862  | 0  |   rdp_update_internal* up = update_cast(update);  | 
2863  |  | 
  | 
2864  | 0  |   while (MessageQueue_Wait(up->queue))  | 
2865  | 0  |   { | 
2866  | 0  |     int status = 0;  | 
2867  |  | 
  | 
2868  | 0  |     if (MessageQueue_Peek(up->queue, &message, TRUE))  | 
2869  | 0  |       status = update_message_queue_process_message(update, &message);  | 
2870  |  | 
  | 
2871  | 0  |     if (!status)  | 
2872  | 0  |       break;  | 
2873  | 0  |   }  | 
2874  |  | 
  | 
2875  | 0  |   ExitThread(0);  | 
2876  | 0  |   return 0;  | 
2877  | 0  | }  | 
2878  |  |  | 
2879  |  | rdpUpdateProxy* update_message_proxy_new(rdpUpdate* update)  | 
2880  | 0  | { | 
2881  | 0  |   rdpUpdateProxy* message = NULL;  | 
2882  |  | 
  | 
2883  | 0  |   if (!update)  | 
2884  | 0  |     return NULL;  | 
2885  |  |  | 
2886  | 0  |   if (!(message = (rdpUpdateProxy*)calloc(1, sizeof(rdpUpdateProxy))))  | 
2887  | 0  |     return NULL;  | 
2888  |  |  | 
2889  | 0  |   message->update = update;  | 
2890  | 0  |   update_message_register_interface(message, update);  | 
2891  |  | 
  | 
2892  | 0  |   if (!(message->thread = CreateThread(NULL, 0, update_message_proxy_thread, update, 0, NULL)))  | 
2893  | 0  |   { | 
2894  | 0  |     WLog_ERR(TAG, "Failed to create proxy thread");  | 
2895  | 0  |     free(message);  | 
2896  | 0  |     return NULL;  | 
2897  | 0  |   }  | 
2898  |  |  | 
2899  | 0  |   return message;  | 
2900  | 0  | }  | 
2901  |  |  | 
2902  |  | void update_message_proxy_free(rdpUpdateProxy* message)  | 
2903  | 0  | { | 
2904  | 0  |   if (message)  | 
2905  | 0  |   { | 
2906  | 0  |     rdp_update_internal* up = update_cast(message->update);  | 
2907  | 0  |     if (MessageQueue_PostQuit(up->queue, 0))  | 
2908  | 0  |       WaitForSingleObject(message->thread, INFINITE);  | 
2909  |  | 
  | 
2910  | 0  |     CloseHandle(message->thread);  | 
2911  | 0  |     free(message);  | 
2912  | 0  |   }  | 
2913  | 0  | }  | 
2914  |  |  | 
2915  |  | /* Event Queue */  | 
2916  |  | static int input_message_free_input_class(wMessage* msg, int type)  | 
2917  | 0  | { | 
2918  | 0  |   int status = 0;  | 
2919  |  | 
  | 
2920  | 0  |   WINPR_UNUSED(msg);  | 
2921  |  | 
  | 
2922  | 0  |   switch (type)  | 
2923  | 0  |   { | 
2924  | 0  |     case Input_SynchronizeEvent:  | 
2925  | 0  |       break;  | 
2926  |  |  | 
2927  | 0  |     case Input_KeyboardEvent:  | 
2928  | 0  |       break;  | 
2929  |  |  | 
2930  | 0  |     case Input_UnicodeKeyboardEvent:  | 
2931  | 0  |       break;  | 
2932  |  |  | 
2933  | 0  |     case Input_MouseEvent:  | 
2934  | 0  |       break;  | 
2935  |  |  | 
2936  | 0  |     case Input_ExtendedMouseEvent:  | 
2937  | 0  |       break;  | 
2938  |  |  | 
2939  | 0  |     case Input_FocusInEvent:  | 
2940  | 0  |       break;  | 
2941  |  |  | 
2942  | 0  |     case Input_KeyboardPauseEvent:  | 
2943  | 0  |       break;  | 
2944  |  |  | 
2945  | 0  |     default:  | 
2946  | 0  |       status = -1;  | 
2947  | 0  |       break;  | 
2948  | 0  |   }  | 
2949  |  |  | 
2950  | 0  |   return status;  | 
2951  | 0  | }  | 
2952  |  |  | 
2953  |  | static int input_message_process_input_class(rdpInputProxy* proxy, wMessage* msg, int type)  | 
2954  | 0  | { | 
2955  | 0  |   int status = 0;  | 
2956  |  | 
  | 
2957  | 0  |   if (!proxy || !msg)  | 
2958  | 0  |     return -1;  | 
2959  |  |  | 
2960  | 0  |   switch (type)  | 
2961  | 0  |   { | 
2962  | 0  |     case Input_SynchronizeEvent:  | 
2963  | 0  |       IFCALL(proxy->SynchronizeEvent, msg->context, (UINT32)(size_t)msg->wParam);  | 
2964  | 0  |       break;  | 
2965  |  |  | 
2966  | 0  |     case Input_KeyboardEvent:  | 
2967  | 0  |       IFCALL(proxy->KeyboardEvent, msg->context, (UINT16)(size_t)msg->wParam,  | 
2968  | 0  |              (UINT8)(size_t)msg->lParam);  | 
2969  | 0  |       break;  | 
2970  |  |  | 
2971  | 0  |     case Input_UnicodeKeyboardEvent:  | 
2972  | 0  |       IFCALL(proxy->UnicodeKeyboardEvent, msg->context, (UINT16)(size_t)msg->wParam,  | 
2973  | 0  |              (UINT16)(size_t)msg->lParam);  | 
2974  | 0  |       break;  | 
2975  |  |  | 
2976  | 0  |     case Input_MouseEvent:  | 
2977  | 0  |     { | 
2978  | 0  |       UINT32 pos = 0;  | 
2979  | 0  |       UINT16 x = 0;  | 
2980  | 0  |       UINT16 y = 0;  | 
2981  | 0  |       pos = (UINT32)(size_t)msg->lParam;  | 
2982  | 0  |       x = ((pos & 0xFFFF0000) >> 16);  | 
2983  | 0  |       y = (pos & 0x0000FFFF);  | 
2984  | 0  |       IFCALL(proxy->MouseEvent, msg->context, (UINT16)(size_t)msg->wParam, x, y);  | 
2985  | 0  |     }  | 
2986  | 0  |     break;  | 
2987  |  |  | 
2988  | 0  |     case Input_ExtendedMouseEvent:  | 
2989  | 0  |     { | 
2990  | 0  |       UINT32 pos = 0;  | 
2991  | 0  |       UINT16 x = 0;  | 
2992  | 0  |       UINT16 y = 0;  | 
2993  | 0  |       pos = (UINT32)(size_t)msg->lParam;  | 
2994  | 0  |       x = ((pos & 0xFFFF0000) >> 16);  | 
2995  | 0  |       y = (pos & 0x0000FFFF);  | 
2996  | 0  |       IFCALL(proxy->ExtendedMouseEvent, msg->context, (UINT16)(size_t)msg->wParam, x, y);  | 
2997  | 0  |     }  | 
2998  | 0  |     break;  | 
2999  |  |  | 
3000  | 0  |     case Input_FocusInEvent:  | 
3001  | 0  |       IFCALL(proxy->FocusInEvent, msg->context, (UINT16)(size_t)msg->wParam);  | 
3002  | 0  |       break;  | 
3003  |  |  | 
3004  | 0  |     case Input_KeyboardPauseEvent:  | 
3005  | 0  |       IFCALL(proxy->KeyboardPauseEvent, msg->context);  | 
3006  | 0  |       break;  | 
3007  |  |  | 
3008  | 0  |     default:  | 
3009  | 0  |       status = -1;  | 
3010  | 0  |       break;  | 
3011  | 0  |   }  | 
3012  |  |  | 
3013  | 0  |   return status;  | 
3014  | 0  | }  | 
3015  |  |  | 
3016  |  | static int input_message_free_class(wMessage* msg, int msgClass, int msgType)  | 
3017  | 0  | { | 
3018  | 0  |   int status = 0;  | 
3019  |  | 
  | 
3020  | 0  |   switch (msgClass)  | 
3021  | 0  |   { | 
3022  | 0  |     case Input_Class:  | 
3023  | 0  |       status = input_message_free_input_class(msg, msgType);  | 
3024  | 0  |       break;  | 
3025  |  |  | 
3026  | 0  |     default:  | 
3027  | 0  |       status = -1;  | 
3028  | 0  |       break;  | 
3029  | 0  |   }  | 
3030  |  |  | 
3031  | 0  |   if (status < 0)  | 
3032  | 0  |     WLog_ERR(TAG, "Unknown event: class: %d type: %d", msgClass, msgType);  | 
3033  |  | 
  | 
3034  | 0  |   return status;  | 
3035  | 0  | }  | 
3036  |  |  | 
3037  |  | static int input_message_process_class(rdpInputProxy* proxy, wMessage* msg, int msgClass,  | 
3038  |  |                                        int msgType)  | 
3039  | 0  | { | 
3040  | 0  |   int status = 0;  | 
3041  |  | 
  | 
3042  | 0  |   switch (msgClass)  | 
3043  | 0  |   { | 
3044  | 0  |     case Input_Class:  | 
3045  | 0  |       status = input_message_process_input_class(proxy, msg, msgType);  | 
3046  | 0  |       break;  | 
3047  |  |  | 
3048  | 0  |     default:  | 
3049  | 0  |       status = -1;  | 
3050  | 0  |       break;  | 
3051  | 0  |   }  | 
3052  |  |  | 
3053  | 0  |   if (status < 0)  | 
3054  | 0  |     WLog_ERR(TAG, "Unknown event: class: %d type: %d", msgClass, msgType);  | 
3055  |  | 
  | 
3056  | 0  |   return status;  | 
3057  | 0  | }  | 
3058  |  |  | 
3059  |  | int input_message_queue_free_message(wMessage* message)  | 
3060  | 0  | { | 
3061  | 0  |   int status = 0;  | 
3062  | 0  |   int msgClass = 0;  | 
3063  | 0  |   int msgType = 0;  | 
3064  |  | 
  | 
3065  | 0  |   if (!message)  | 
3066  | 0  |     return -1;  | 
3067  |  |  | 
3068  | 0  |   if (message->id == WMQ_QUIT)  | 
3069  | 0  |     return 0;  | 
3070  |  |  | 
3071  | 0  |   msgClass = GetMessageClass(message->id);  | 
3072  | 0  |   msgType = GetMessageType(message->id);  | 
3073  | 0  |   status = input_message_free_class(message, msgClass, msgType);  | 
3074  |  | 
  | 
3075  | 0  |   if (status < 0)  | 
3076  | 0  |     return -1;  | 
3077  |  |  | 
3078  | 0  |   return 1;  | 
3079  | 0  | }  | 
3080  |  |  | 
3081  |  | int input_message_queue_process_message(rdpInput* input, wMessage* message)  | 
3082  | 0  | { | 
3083  | 0  |   int status = 0;  | 
3084  | 0  |   int msgClass = 0;  | 
3085  | 0  |   int msgType = 0;  | 
3086  | 0  |   rdp_input_internal* in = input_cast(input);  | 
3087  |  | 
  | 
3088  | 0  |   if (!message)  | 
3089  | 0  |     return -1;  | 
3090  |  |  | 
3091  | 0  |   if (message->id == WMQ_QUIT)  | 
3092  | 0  |     return 0;  | 
3093  |  |  | 
3094  | 0  |   msgClass = GetMessageClass(message->id);  | 
3095  | 0  |   msgType = GetMessageType(message->id);  | 
3096  | 0  |   status = input_message_process_class(in->proxy, message, msgClass, msgType);  | 
3097  | 0  |   input_message_free_class(message, msgClass, msgType);  | 
3098  |  | 
  | 
3099  | 0  |   if (status < 0)  | 
3100  | 0  |     return -1;  | 
3101  |  |  | 
3102  | 0  |   return 1;  | 
3103  | 0  | }  | 
3104  |  |  | 
3105  |  | int input_message_queue_process_pending_messages(rdpInput* input)  | 
3106  | 0  | { | 
3107  | 0  |   int count = 0;  | 
3108  | 0  |   int status = 1;  | 
3109  | 0  |   wMessage message = { 0 }; | 
3110  | 0  |   wMessageQueue* queue = NULL;  | 
3111  | 0  |   rdp_input_internal* in = input_cast(input);  | 
3112  |  | 
  | 
3113  | 0  |   if (!in->queue)  | 
3114  | 0  |     return -1;  | 
3115  |  |  | 
3116  | 0  |   queue = in->queue;  | 
3117  |  | 
  | 
3118  | 0  |   while (MessageQueue_Peek(queue, &message, TRUE))  | 
3119  | 0  |   { | 
3120  | 0  |     status = input_message_queue_process_message(input, &message);  | 
3121  |  | 
  | 
3122  | 0  |     if (!status)  | 
3123  | 0  |       break;  | 
3124  |  |  | 
3125  | 0  |     count++;  | 
3126  | 0  |   }  | 
3127  |  | 
  | 
3128  | 0  |   return status;  | 
3129  | 0  | }  |