2013-01-25 02:11:43 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* Asynchronous Message Queue
|
|
|
|
*
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2017-02-20 20:31:58 +03:00
|
|
|
* Copyright 2017 Armin Novak <armin.novak@thincast.com>
|
|
|
|
* Copyright 2017 Thincast Technologies GmbH
|
2013-01-25 02:11:43 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
#include <assert.h>
|
|
|
|
|
2013-04-13 01:05:42 +04:00
|
|
|
#include "rdp.h"
|
2013-01-25 02:11:43 +04:00
|
|
|
#include "message.h"
|
2013-04-13 01:05:42 +04:00
|
|
|
#include "transport.h"
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
#include <freerdp/log.h>
|
2013-04-13 01:05:42 +04:00
|
|
|
#include <freerdp/freerdp.h>
|
2013-01-25 02:11:43 +04:00
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
2013-04-13 01:05:42 +04:00
|
|
|
#include <winpr/stream.h>
|
2013-01-25 02:11:43 +04:00
|
|
|
#include <winpr/collections.h>
|
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
#define TAG FREERDP_TAG("core.message")
|
2013-04-30 20:20:03 +04:00
|
|
|
#define WITH_STREAM_POOL 1
|
2013-04-13 01:05:42 +04:00
|
|
|
|
2013-01-25 02:11:43 +04:00
|
|
|
/* Update */
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_BeginPaint(rdpContext* context)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, BeginPaint), NULL, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_EndPaint(rdpContext* context)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, EndPaint), NULL, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_SetBounds(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const rdpBounds* bounds)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-26 02:52:37 +04:00
|
|
|
rdpBounds* wParam = NULL;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-26 02:52:37 +04:00
|
|
|
if (bounds)
|
|
|
|
{
|
|
|
|
wParam = (rdpBounds*) malloc(sizeof(rdpBounds));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-01-26 02:52:37 +04:00
|
|
|
CopyMemory(wParam, bounds, sizeof(rdpBounds));
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, SetBounds), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_Synchronize(rdpContext* context)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, Synchronize), NULL, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_DesktopResize(rdpContext* context)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, DesktopResize), NULL, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_BitmapUpdate(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const BITMAP_UPDATE* bitmap)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 index;
|
2013-01-25 09:27:39 +04:00
|
|
|
BITMAP_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !bitmap)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (BITMAP_UPDATE*) malloc(sizeof(BITMAP_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
|
|
|
wParam->number = bitmap->number;
|
|
|
|
wParam->count = wParam->number;
|
2017-05-30 11:46:43 +03:00
|
|
|
wParam->rectangles = (BITMAP_DATA*) calloc(wParam->number, sizeof(BITMAP_DATA));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->rectangles)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
CopyMemory(wParam->rectangles, bitmap->rectangles, sizeof(BITMAP_DATA) * wParam->number);
|
|
|
|
|
|
|
|
for (index = 0; index < wParam->number; index++)
|
|
|
|
{
|
2013-04-13 01:05:42 +04:00
|
|
|
#ifdef WITH_STREAM_POOL
|
|
|
|
StreamPool_AddRef(context->rdp->transport->ReceivePool, bitmap->rectangles[index].bitmapDataStream);
|
|
|
|
#else
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam->rectangles[index].bitmapDataStream = (BYTE*) malloc(wParam->rectangles[index].bitmapLength);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->rectangles[index].bitmapDataStream)
|
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
while (index)
|
2015-06-25 11:33:54 +03:00
|
|
|
free(wParam->rectangles[--index].bitmapDataStream);
|
2015-06-24 13:26:13 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
free(wParam->rectangles);
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
CopyMemory(wParam->rectangles[index].bitmapDataStream, bitmap->rectangles[index].bitmapDataStream,
|
2017-02-20 20:31:58 +03:00
|
|
|
wParam->rectangles[index].bitmapLength);
|
2013-04-13 01:05:42 +04:00
|
|
|
#endif
|
2013-01-25 09:27:39 +04:00
|
|
|
}
|
2015-04-14 11:14:23 +03:00
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, BitmapUpdate), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_Palette(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const PALETTE_UPDATE* palette)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
PALETTE_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !palette)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (PALETTE_UPDATE*) malloc(sizeof(PALETTE_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, palette, sizeof(PALETTE_UPDATE));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, Palette), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_PlaySound(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const PLAY_SOUND_UPDATE* playSound)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
PLAY_SOUND_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !playSound)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (PLAY_SOUND_UPDATE*) malloc(sizeof(PLAY_SOUND_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, playSound, sizeof(PLAY_SOUND_UPDATE));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, PlaySound), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_SetKeyboardIndicators(rdpContext* context, UINT16 led_flags)
|
2014-09-30 20:18:29 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, SetKeyboardIndicators), (void*)(size_t)led_flags, NULL);
|
2014-09-30 20:18:29 +04:00
|
|
|
}
|
|
|
|
|
2017-11-14 15:58:08 +03:00
|
|
|
static BOOL update_message_SetKeyboardImeStatus(rdpContext* context, UINT16 imeId, UINT32 imeState,
|
|
|
|
UINT32 imeConvMode)
|
2017-05-12 10:43:58 +03:00
|
|
|
{
|
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-11-14 15:58:08 +03:00
|
|
|
MakeMessageId(Update, SetKeyboardImeStatus), (void*)(size_t)((imeId << 16UL) | imeState),
|
|
|
|
(void*)(size_t) imeConvMode);
|
2017-05-12 10:43:58 +03:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_RefreshRect(rdpContext* context, BYTE count,
|
2017-02-20 20:31:58 +03:00
|
|
|
const RECTANGLE_16* areas)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
RECTANGLE_16* lParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !areas)
|
|
|
|
return FALSE;
|
|
|
|
|
2017-05-30 11:46:43 +03:00
|
|
|
lParam = (RECTANGLE_16*) calloc(count, sizeof(RECTANGLE_16));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, areas, sizeof(RECTANGLE_16) * count);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, RefreshRect), (void*)(size_t) count, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_SuppressOutput(rdpContext* context, BYTE allow,
|
2017-02-20 20:31:58 +03:00
|
|
|
const RECTANGLE_16* area)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-02-12 05:38:19 +04:00
|
|
|
RECTANGLE_16* lParam = NULL;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-02-12 05:38:19 +04:00
|
|
|
if (area)
|
|
|
|
{
|
|
|
|
lParam = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
return FALSE;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-02-12 05:38:19 +04:00
|
|
|
CopyMemory(lParam, area, sizeof(RECTANGLE_16));
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, SuppressOutput), (void*)(size_t) allow, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_SurfaceCommand(rdpContext* context, wStream* s)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* wParam;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !s)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-02-25 21:37:20 +03:00
|
|
|
wParam = Stream_New(NULL, Stream_GetRemainingLength(s));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2016-03-01 13:39:21 +03:00
|
|
|
Stream_Copy(s, wParam, Stream_GetRemainingLength(s));
|
2016-02-25 21:37:20 +03:00
|
|
|
Stream_SetPosition(wParam, 0);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, SurfaceCommand), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_SurfaceBits(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const SURFACE_BITS_COMMAND* surfaceBitsCommand)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
SURFACE_BITS_COMMAND* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !surfaceBitsCommand)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (SURFACE_BITS_COMMAND*) malloc(sizeof(SURFACE_BITS_COMMAND));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, surfaceBitsCommand, sizeof(SURFACE_BITS_COMMAND));
|
2013-04-13 01:05:42 +04:00
|
|
|
#ifdef WITH_STREAM_POOL
|
2018-02-28 12:10:09 +03:00
|
|
|
StreamPool_AddRef(context->rdp->transport->ReceivePool, surfaceBitsCommand->bmp.bitmapData);
|
2013-04-13 01:05:42 +04:00
|
|
|
#else
|
2018-02-28 12:10:09 +03:00
|
|
|
wParam->bmp.bitmapData = (BYTE*) malloc(wParam->bmp.bitmapDataLength);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2018-02-28 12:10:09 +03:00
|
|
|
if (!wParam->bmp.bitmapData)
|
2015-04-14 11:14:23 +03:00
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2018-02-28 12:10:09 +03:00
|
|
|
CopyMemory(wParam->bmp.bitmapData, surfaceBitsCommand->bmp.bitmapData, wParam->bmp.bitmapDataLength);
|
2013-04-13 01:05:42 +04:00
|
|
|
#endif
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, SurfaceBits), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_SurfaceFrameMarker(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const SURFACE_FRAME_MARKER* surfaceFrameMarker)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
SURFACE_FRAME_MARKER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !surfaceFrameMarker)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (SURFACE_FRAME_MARKER*) malloc(sizeof(SURFACE_FRAME_MARKER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, surfaceFrameMarker, sizeof(SURFACE_FRAME_MARKER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, SurfaceFrameMarker), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_SurfaceFrameAcknowledge(rdpContext* context, UINT32 frameId)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Update, SurfaceFrameAcknowledge), (void*)(size_t) frameId, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Primary Update */
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DstBlt(rdpContext* context, const DSTBLT_ORDER* dstBlt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DSTBLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !dstBlt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DSTBLT_ORDER*) malloc(sizeof(DSTBLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, dstBlt, sizeof(DSTBLT_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, DstBlt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_PatBlt(rdpContext* context, PATBLT_ORDER* patBlt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
PATBLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !patBlt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (PATBLT_ORDER*) malloc(sizeof(PATBLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, patBlt, sizeof(PATBLT_ORDER));
|
2013-11-03 22:29:48 +04:00
|
|
|
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, PatBlt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_ScrBlt(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const SCRBLT_ORDER* scrBlt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
SCRBLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !scrBlt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (SCRBLT_ORDER*) malloc(sizeof(SCRBLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, scrBlt, sizeof(SCRBLT_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, ScrBlt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_OpaqueRect(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const OPAQUE_RECT_ORDER* opaqueRect)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
OPAQUE_RECT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !opaqueRect)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (OPAQUE_RECT_ORDER*) malloc(sizeof(OPAQUE_RECT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, opaqueRect, sizeof(OPAQUE_RECT_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, OpaqueRect), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DrawNineGrid(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const DRAW_NINE_GRID_ORDER* drawNineGrid)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DRAW_NINE_GRID_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !drawNineGrid)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DRAW_NINE_GRID_ORDER*) malloc(sizeof(DRAW_NINE_GRID_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, drawNineGrid, sizeof(DRAW_NINE_GRID_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, DrawNineGrid), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_MultiDstBlt(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const MULTI_DSTBLT_ORDER* multiDstBlt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
MULTI_DSTBLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !multiDstBlt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (MULTI_DSTBLT_ORDER*) malloc(sizeof(MULTI_DSTBLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, multiDstBlt, sizeof(MULTI_DSTBLT_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, MultiDstBlt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_MultiPatBlt(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const MULTI_PATBLT_ORDER* multiPatBlt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
MULTI_PATBLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !multiPatBlt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (MULTI_PATBLT_ORDER*) malloc(sizeof(MULTI_PATBLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, multiPatBlt, sizeof(MULTI_PATBLT_ORDER));
|
2013-11-03 22:29:48 +04:00
|
|
|
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, MultiPatBlt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_MultiScrBlt(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const MULTI_SCRBLT_ORDER* multiScrBlt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
MULTI_SCRBLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !multiScrBlt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (MULTI_SCRBLT_ORDER*) malloc(sizeof(MULTI_SCRBLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, multiScrBlt, sizeof(MULTI_SCRBLT_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, MultiScrBlt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_MultiOpaqueRect(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const MULTI_OPAQUE_RECT_ORDER* multiOpaqueRect)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
MULTI_OPAQUE_RECT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !multiOpaqueRect)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (MULTI_OPAQUE_RECT_ORDER*) malloc(sizeof(MULTI_OPAQUE_RECT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, multiOpaqueRect, sizeof(MULTI_OPAQUE_RECT_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, MultiOpaqueRect), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_MultiDrawNineGrid(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const MULTI_DRAW_NINE_GRID_ORDER* multiDrawNineGrid)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
MULTI_DRAW_NINE_GRID_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !multiDrawNineGrid)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (MULTI_DRAW_NINE_GRID_ORDER*) malloc(sizeof(MULTI_DRAW_NINE_GRID_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, multiDrawNineGrid, sizeof(MULTI_DRAW_NINE_GRID_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, MultiDrawNineGrid), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_LineTo(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const LINE_TO_ORDER* lineTo)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
LINE_TO_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !lineTo)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (LINE_TO_ORDER*) malloc(sizeof(LINE_TO_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, lineTo, sizeof(LINE_TO_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, LineTo), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_Polyline(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const POLYLINE_ORDER* polyline)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POLYLINE_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !polyline)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POLYLINE_ORDER*) malloc(sizeof(POLYLINE_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, polyline, sizeof(POLYLINE_ORDER));
|
2017-05-30 11:46:43 +03:00
|
|
|
wParam->points = (DELTA_POINT*) calloc(wParam->numDeltaEntries, sizeof(DELTA_POINT));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->points)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam->points, polyline->points, sizeof(DELTA_POINT) * wParam->numDeltaEntries);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, Polyline), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_MemBlt(rdpContext* context, MEMBLT_ORDER* memBlt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
MEMBLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !memBlt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (MEMBLT_ORDER*) malloc(sizeof(MEMBLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, memBlt, sizeof(MEMBLT_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, MemBlt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_Mem3Blt(rdpContext* context, MEM3BLT_ORDER* mem3Blt)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
MEM3BLT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !mem3Blt)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (MEM3BLT_ORDER*) malloc(sizeof(MEM3BLT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, mem3Blt, sizeof(MEM3BLT_ORDER));
|
2013-11-03 22:29:48 +04:00
|
|
|
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, Mem3Blt), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_SaveBitmap(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const SAVE_BITMAP_ORDER* saveBitmap)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
SAVE_BITMAP_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !saveBitmap)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (SAVE_BITMAP_ORDER*) malloc(sizeof(SAVE_BITMAP_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, saveBitmap, sizeof(SAVE_BITMAP_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, SaveBitmap), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_GlyphIndex(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
GLYPH_INDEX_ORDER* glyphIndex)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
GLYPH_INDEX_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !glyphIndex)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (GLYPH_INDEX_ORDER*) malloc(sizeof(GLYPH_INDEX_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, glyphIndex, sizeof(GLYPH_INDEX_ORDER));
|
2013-11-03 22:29:48 +04:00
|
|
|
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, GlyphIndex), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_FastIndex(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const FAST_INDEX_ORDER* fastIndex)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
FAST_INDEX_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !fastIndex)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (FAST_INDEX_ORDER*) malloc(sizeof(FAST_INDEX_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, fastIndex, sizeof(FAST_INDEX_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, FastIndex), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_FastGlyph(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const FAST_GLYPH_ORDER* fastGlyph)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
FAST_GLYPH_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !fastGlyph)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (FAST_GLYPH_ORDER*) malloc(sizeof(FAST_GLYPH_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
CopyMemory(wParam, fastGlyph, sizeof(FAST_GLYPH_ORDER));
|
|
|
|
|
2013-11-03 22:29:48 +04:00
|
|
|
if (wParam->cbData > 1)
|
|
|
|
{
|
|
|
|
wParam->glyphData.aj = (BYTE*) malloc(fastGlyph->glyphData.cb);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->glyphData.aj)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-11-03 22:29:48 +04:00
|
|
|
CopyMemory(wParam->glyphData.aj, fastGlyph->glyphData.aj, fastGlyph->glyphData.cb);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wParam->glyphData.aj = NULL;
|
|
|
|
}
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, FastGlyph), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_PolygonSC(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const POLYGON_SC_ORDER* polygonSC)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POLYGON_SC_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !polygonSC)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POLYGON_SC_ORDER*) malloc(sizeof(POLYGON_SC_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, polygonSC, sizeof(POLYGON_SC_ORDER));
|
2017-05-30 11:46:43 +03:00
|
|
|
wParam->points = (DELTA_POINT*) calloc(wParam->numPoints, sizeof(DELTA_POINT));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->points)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam->points, polygonSC, sizeof(DELTA_POINT) * wParam->numPoints);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, PolygonSC), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_PolygonCB(rdpContext* context, POLYGON_CB_ORDER* polygonCB)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POLYGON_CB_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !polygonCB)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POLYGON_CB_ORDER*) malloc(sizeof(POLYGON_CB_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, polygonCB, sizeof(POLYGON_CB_ORDER));
|
2017-05-30 11:46:43 +03:00
|
|
|
wParam->points = (DELTA_POINT*) calloc(wParam->numPoints, sizeof(DELTA_POINT));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->points)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam->points, polygonCB, sizeof(DELTA_POINT) * wParam->numPoints);
|
2013-11-03 22:29:48 +04:00
|
|
|
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, PolygonCB), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_EllipseSC(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const ELLIPSE_SC_ORDER* ellipseSC)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
ELLIPSE_SC_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !ellipseSC)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (ELLIPSE_SC_ORDER*) malloc(sizeof(ELLIPSE_SC_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, ellipseSC, sizeof(ELLIPSE_SC_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, EllipseSC), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_EllipseCB(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const ELLIPSE_CB_ORDER* ellipseCB)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
ELLIPSE_CB_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !ellipseCB)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (ELLIPSE_CB_ORDER*) malloc(sizeof(ELLIPSE_CB_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, ellipseCB, sizeof(ELLIPSE_CB_ORDER));
|
2013-11-03 22:29:48 +04:00
|
|
|
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PrimaryUpdate, EllipseCB), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Secondary Update */
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_CacheBitmap(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const CACHE_BITMAP_ORDER* cacheBitmapOrder)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CACHE_BITMAP_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !cacheBitmapOrder)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CACHE_BITMAP_ORDER*) malloc(sizeof(CACHE_BITMAP_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, cacheBitmapOrder, sizeof(CACHE_BITMAP_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam->bitmapDataStream = (BYTE*) malloc(wParam->bitmapLength);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->bitmapDataStream)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam->bitmapDataStream, cacheBitmapOrder, wParam->bitmapLength);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(SecondaryUpdate, CacheBitmap), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_CacheBitmapV2(rdpContext* context,
|
|
|
|
CACHE_BITMAP_V2_ORDER* cacheBitmapV2Order)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CACHE_BITMAP_V2_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !cacheBitmapV2Order)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CACHE_BITMAP_V2_ORDER*) malloc(sizeof(CACHE_BITMAP_V2_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, cacheBitmapV2Order, sizeof(CACHE_BITMAP_V2_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam->bitmapDataStream = (BYTE*) malloc(wParam->bitmapLength);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->bitmapDataStream)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam->bitmapDataStream, cacheBitmapV2Order->bitmapDataStream, wParam->bitmapLength);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(SecondaryUpdate, CacheBitmapV2), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_CacheBitmapV3(rdpContext* context,
|
|
|
|
CACHE_BITMAP_V3_ORDER* cacheBitmapV3Order)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CACHE_BITMAP_V3_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !cacheBitmapV3Order)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CACHE_BITMAP_V3_ORDER*) malloc(sizeof(CACHE_BITMAP_V3_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, cacheBitmapV3Order, sizeof(CACHE_BITMAP_V3_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam->bitmapData.data = (BYTE*) malloc(wParam->bitmapData.length);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->bitmapData.data)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam->bitmapData.data, cacheBitmapV3Order->bitmapData.data, wParam->bitmapData.length);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(SecondaryUpdate, CacheBitmapV3), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_CacheColorTable(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const CACHE_COLOR_TABLE_ORDER* cacheColorTableOrder)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CACHE_COLOR_TABLE_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !cacheColorTableOrder)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CACHE_COLOR_TABLE_ORDER*) malloc(sizeof(CACHE_COLOR_TABLE_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, cacheColorTableOrder, sizeof(CACHE_COLOR_TABLE_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(SecondaryUpdate, CacheColorTable), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_CacheGlyph(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const CACHE_GLYPH_ORDER* cacheGlyphOrder)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CACHE_GLYPH_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !cacheGlyphOrder)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CACHE_GLYPH_ORDER*) malloc(sizeof(CACHE_GLYPH_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, cacheGlyphOrder, sizeof(CACHE_GLYPH_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(SecondaryUpdate, CacheGlyph), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_CacheGlyphV2(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const CACHE_GLYPH_V2_ORDER* cacheGlyphV2Order)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CACHE_GLYPH_V2_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !cacheGlyphV2Order)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CACHE_GLYPH_V2_ORDER*) malloc(sizeof(CACHE_GLYPH_V2_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, cacheGlyphV2Order, sizeof(CACHE_GLYPH_V2_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(SecondaryUpdate, CacheGlyphV2), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_CacheBrush(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const CACHE_BRUSH_ORDER* cacheBrushOrder)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CACHE_BRUSH_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !cacheBrushOrder)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CACHE_BRUSH_ORDER*) malloc(sizeof(CACHE_BRUSH_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, cacheBrushOrder, sizeof(CACHE_BRUSH_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(SecondaryUpdate, CacheBrush), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Alternate Secondary Update */
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_CreateOffscreenBitmap(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CREATE_OFFSCREEN_BITMAP_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !createOffscreenBitmap)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CREATE_OFFSCREEN_BITMAP_ORDER*) malloc(sizeof(CREATE_OFFSCREEN_BITMAP_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, createOffscreenBitmap, sizeof(CREATE_OFFSCREEN_BITMAP_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam->deleteList.cIndices = createOffscreenBitmap->deleteList.cIndices;
|
|
|
|
wParam->deleteList.sIndices = wParam->deleteList.cIndices;
|
2017-05-30 11:46:43 +03:00
|
|
|
wParam->deleteList.indices = (UINT16*) calloc(wParam->deleteList.cIndices, sizeof(UINT16));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->deleteList.indices)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam->deleteList.indices, createOffscreenBitmap->deleteList.indices,
|
|
|
|
wParam->deleteList.cIndices);
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, CreateOffscreenBitmap), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_SwitchSurface(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const SWITCH_SURFACE_ORDER* switchSurface)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
SWITCH_SURFACE_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !switchSurface)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (SWITCH_SURFACE_ORDER*) malloc(sizeof(SWITCH_SURFACE_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, switchSurface, sizeof(SWITCH_SURFACE_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, SwitchSurface), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_CreateNineGridBitmap(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const CREATE_NINE_GRID_BITMAP_ORDER* createNineGridBitmap)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
CREATE_NINE_GRID_BITMAP_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !createNineGridBitmap)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (CREATE_NINE_GRID_BITMAP_ORDER*) malloc(sizeof(CREATE_NINE_GRID_BITMAP_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, createNineGridBitmap, sizeof(CREATE_NINE_GRID_BITMAP_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, CreateNineGridBitmap), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_FrameMarker(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const FRAME_MARKER_ORDER* frameMarker)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
FRAME_MARKER_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !frameMarker)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (FRAME_MARKER_ORDER*) malloc(sizeof(FRAME_MARKER_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, frameMarker, sizeof(FRAME_MARKER_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, FrameMarker), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_StreamBitmapFirst(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const STREAM_BITMAP_FIRST_ORDER* streamBitmapFirst)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
STREAM_BITMAP_FIRST_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !streamBitmapFirst)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (STREAM_BITMAP_FIRST_ORDER*) malloc(sizeof(STREAM_BITMAP_FIRST_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, streamBitmapFirst, sizeof(STREAM_BITMAP_FIRST_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, StreamBitmapFirst), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_StreamBitmapNext(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const STREAM_BITMAP_NEXT_ORDER* streamBitmapNext)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
STREAM_BITMAP_NEXT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !streamBitmapNext)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (STREAM_BITMAP_NEXT_ORDER*) malloc(sizeof(STREAM_BITMAP_NEXT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, streamBitmapNext, sizeof(STREAM_BITMAP_NEXT_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, StreamBitmapNext), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DrawGdiPlusFirst(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const DRAW_GDIPLUS_FIRST_ORDER* drawGdiPlusFirst)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DRAW_GDIPLUS_FIRST_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !drawGdiPlusFirst)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DRAW_GDIPLUS_FIRST_ORDER*) malloc(sizeof(DRAW_GDIPLUS_FIRST_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, drawGdiPlusFirst, sizeof(DRAW_GDIPLUS_FIRST_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, DrawGdiPlusFirst), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DrawGdiPlusNext(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const DRAW_GDIPLUS_NEXT_ORDER* drawGdiPlusNext)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DRAW_GDIPLUS_NEXT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !drawGdiPlusNext)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DRAW_GDIPLUS_NEXT_ORDER*) malloc(sizeof(DRAW_GDIPLUS_NEXT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, drawGdiPlusNext, sizeof(DRAW_GDIPLUS_NEXT_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, DrawGdiPlusNext), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DrawGdiPlusEnd(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const DRAW_GDIPLUS_END_ORDER* drawGdiPlusEnd)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DRAW_GDIPLUS_END_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !drawGdiPlusEnd)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DRAW_GDIPLUS_END_ORDER*) malloc(sizeof(DRAW_GDIPLUS_END_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, drawGdiPlusEnd, sizeof(DRAW_GDIPLUS_END_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, DrawGdiPlusEnd), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DrawGdiPlusCacheFirst(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const DRAW_GDIPLUS_CACHE_FIRST_ORDER* drawGdiPlusCacheFirst)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DRAW_GDIPLUS_CACHE_FIRST_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !drawGdiPlusCacheFirst)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DRAW_GDIPLUS_CACHE_FIRST_ORDER*) malloc(sizeof(DRAW_GDIPLUS_CACHE_FIRST_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, drawGdiPlusCacheFirst, sizeof(DRAW_GDIPLUS_CACHE_FIRST_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, DrawGdiPlusCacheFirst), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DrawGdiPlusCacheNext(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const DRAW_GDIPLUS_CACHE_NEXT_ORDER* drawGdiPlusCacheNext)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DRAW_GDIPLUS_CACHE_NEXT_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !drawGdiPlusCacheNext)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DRAW_GDIPLUS_CACHE_NEXT_ORDER*) malloc(sizeof(DRAW_GDIPLUS_CACHE_NEXT_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, drawGdiPlusCacheNext, sizeof(DRAW_GDIPLUS_CACHE_NEXT_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, DrawGdiPlusCacheNext), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_DrawGdiPlusCacheEnd(
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpContext* context,
|
|
|
|
const DRAW_GDIPLUS_CACHE_END_ORDER* drawGdiPlusCacheEnd)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
DRAW_GDIPLUS_CACHE_END_ORDER* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !drawGdiPlusCacheEnd)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (DRAW_GDIPLUS_CACHE_END_ORDER*) malloc(sizeof(DRAW_GDIPLUS_CACHE_END_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, drawGdiPlusCacheEnd, sizeof(DRAW_GDIPLUS_CACHE_END_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
/* TODO: complete copy */
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(AltSecUpdate, DrawGdiPlusCacheEnd), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Window Update */
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_WindowCreate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
WINDOW_STATE_ORDER* windowState)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
WINDOW_STATE_ORDER* lParam;
|
|
|
|
|
2017-03-03 15:44:07 +03:00
|
|
|
if (!context || !context->update || !orderInfo || !windowState)
|
2017-02-20 20:31:58 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2013-01-25 09:27:39 +04:00
|
|
|
lParam = (WINDOW_STATE_ORDER*) malloc(sizeof(WINDOW_STATE_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, windowState, sizeof(WINDOW_STATE_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, WindowCreate), (void*) wParam, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_WindowUpdate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
WINDOW_STATE_ORDER* windowState)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
WINDOW_STATE_ORDER* lParam;
|
|
|
|
|
2017-03-03 15:44:07 +03:00
|
|
|
if (!context || !context->update || !orderInfo || !windowState)
|
2017-02-20 20:31:58 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2013-01-25 09:27:39 +04:00
|
|
|
lParam = (WINDOW_STATE_ORDER*) malloc(sizeof(WINDOW_STATE_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, windowState, sizeof(WINDOW_STATE_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, WindowUpdate), (void*) wParam, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_WindowIcon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
WINDOW_ICON_ORDER* windowIcon)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
WINDOW_ICON_ORDER* lParam;
|
|
|
|
|
2017-03-03 15:44:07 +03:00
|
|
|
if (!context || !context->update || !orderInfo || !windowIcon)
|
2017-02-20 20:31:58 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2015-04-14 11:14:23 +03:00
|
|
|
lParam = (WINDOW_ICON_ORDER*) calloc(1, sizeof(WINDOW_ICON_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, windowIcon, sizeof(WINDOW_ICON_ORDER));
|
2014-09-15 21:55:21 +04:00
|
|
|
WLog_VRB(TAG, "update_message_WindowIcon");
|
2013-10-23 00:28:23 +04:00
|
|
|
|
|
|
|
if (windowIcon->iconInfo->cbBitsColor > 0)
|
|
|
|
{
|
|
|
|
lParam->iconInfo->bitsColor = (BYTE*) malloc(windowIcon->iconInfo->cbBitsColor);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam->iconInfo->bitsColor)
|
|
|
|
goto out_fail;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
|
|
|
CopyMemory(lParam->iconInfo->bitsColor, windowIcon->iconInfo->bitsColor,
|
|
|
|
windowIcon->iconInfo->cbBitsColor);
|
2013-10-23 00:28:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (windowIcon->iconInfo->cbBitsMask > 0)
|
|
|
|
{
|
|
|
|
lParam->iconInfo->bitsMask = (BYTE*) malloc(windowIcon->iconInfo->cbBitsMask);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam->iconInfo->bitsMask)
|
|
|
|
goto out_fail;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
|
|
|
CopyMemory(lParam->iconInfo->bitsMask, windowIcon->iconInfo->bitsMask,
|
|
|
|
windowIcon->iconInfo->cbBitsMask);
|
2013-10-23 00:28:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (windowIcon->iconInfo->cbColorTable > 0)
|
|
|
|
{
|
|
|
|
lParam->iconInfo->colorTable = (BYTE*) malloc(windowIcon->iconInfo->cbColorTable);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam->iconInfo->colorTable)
|
|
|
|
goto out_fail;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
|
|
|
CopyMemory(lParam->iconInfo->colorTable, windowIcon->iconInfo->colorTable,
|
|
|
|
windowIcon->iconInfo->cbColorTable);
|
2013-10-23 00:28:23 +04:00
|
|
|
}
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, WindowIcon), (void*) wParam, (void*) lParam);
|
2015-04-14 11:14:23 +03:00
|
|
|
out_fail:
|
|
|
|
free(lParam->iconInfo->bitsColor);
|
|
|
|
free(lParam->iconInfo->bitsMask);
|
|
|
|
free(lParam->iconInfo->colorTable);
|
|
|
|
free(lParam);
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_WindowCachedIcon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
WINDOW_CACHED_ICON_ORDER* lParam;
|
|
|
|
|
2017-03-03 15:44:07 +03:00
|
|
|
if (!context || !context->update || !orderInfo || !windowCachedIcon)
|
2017-02-20 20:31:58 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2013-01-25 09:27:39 +04:00
|
|
|
lParam = (WINDOW_CACHED_ICON_ORDER*) malloc(sizeof(WINDOW_CACHED_ICON_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, windowCachedIcon, sizeof(WINDOW_CACHED_ICON_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, WindowCachedIcon), (void*) wParam, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_WindowDelete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !orderInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, WindowDelete), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_NotifyIconCreate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
NOTIFY_ICON_STATE_ORDER* notifyIconState)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
NOTIFY_ICON_STATE_ORDER* lParam;
|
|
|
|
|
2017-03-03 15:44:07 +03:00
|
|
|
if (!context || !context->update || !orderInfo || !notifyIconState)
|
2017-02-20 20:31:58 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2013-01-25 09:27:39 +04:00
|
|
|
lParam = (NOTIFY_ICON_STATE_ORDER*) malloc(sizeof(NOTIFY_ICON_STATE_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, notifyIconState, sizeof(NOTIFY_ICON_STATE_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, NotifyIconCreate), (void*) wParam, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_NotifyIconUpdate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
NOTIFY_ICON_STATE_ORDER* notifyIconState)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
NOTIFY_ICON_STATE_ORDER* lParam;
|
|
|
|
|
2017-03-03 15:44:07 +03:00
|
|
|
if (!context || !context->update || !orderInfo || !notifyIconState)
|
2017-02-20 20:31:58 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2013-01-25 09:27:39 +04:00
|
|
|
lParam = (NOTIFY_ICON_STATE_ORDER*) malloc(sizeof(NOTIFY_ICON_STATE_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, notifyIconState, sizeof(NOTIFY_ICON_STATE_ORDER));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, NotifyIconUpdate), (void*) wParam, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_NotifyIconDelete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !orderInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, NotifyIconDelete), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_MonitoredDesktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo,
|
|
|
|
MONITORED_DESKTOP_ORDER* monitoredDesktop)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
MONITORED_DESKTOP_ORDER* lParam;
|
|
|
|
|
2017-03-03 15:44:07 +03:00
|
|
|
if (!context || !context->update || !orderInfo || !monitoredDesktop)
|
2017-02-20 20:31:58 +03:00
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2013-01-25 09:27:39 +04:00
|
|
|
lParam = (MONITORED_DESKTOP_ORDER*) malloc(sizeof(MONITORED_DESKTOP_ORDER));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!lParam)
|
|
|
|
{
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(lParam, monitoredDesktop, sizeof(MONITORED_DESKTOP_ORDER));
|
2013-01-25 09:27:39 +04:00
|
|
|
lParam->windowIds = NULL;
|
|
|
|
|
|
|
|
if (lParam->numWindowIds)
|
|
|
|
{
|
2017-05-30 11:46:43 +03:00
|
|
|
lParam->windowIds = (UINT32*) calloc(lParam->numWindowIds, sizeof(UINT32));
|
2013-01-25 09:27:39 +04:00
|
|
|
CopyMemory(lParam->windowIds, monitoredDesktop->windowIds, lParam->numWindowIds);
|
|
|
|
}
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, MonitoredDesktop), (void*) wParam, (void*) lParam);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL update_message_NonMonitoredDesktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
WINDOW_ORDER_INFO* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !orderInfo)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (WINDOW_ORDER_INFO*) malloc(sizeof(WINDOW_ORDER_INFO));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(WindowUpdate, NonMonitoredDesktop), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Pointer Update */
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_PointerPosition(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const POINTER_POSITION_UPDATE* pointerPosition)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POINTER_POSITION_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !pointerPosition)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POINTER_POSITION_UPDATE*) malloc(sizeof(POINTER_POSITION_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, pointerPosition, sizeof(POINTER_POSITION_UPDATE));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PointerUpdate, PointerPosition), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_PointerSystem(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const POINTER_SYSTEM_UPDATE* pointerSystem)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POINTER_SYSTEM_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !pointerSystem)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POINTER_SYSTEM_UPDATE*) malloc(sizeof(POINTER_SYSTEM_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, pointerSystem, sizeof(POINTER_SYSTEM_UPDATE));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PointerUpdate, PointerSystem), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_PointerColor(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const POINTER_COLOR_UPDATE* pointerColor)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POINTER_COLOR_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !pointerColor)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POINTER_COLOR_UPDATE*) malloc(sizeof(POINTER_COLOR_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, pointerColor, sizeof(POINTER_COLOR_UPDATE));
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam->andMaskData = wParam->xorMaskData = NULL;
|
|
|
|
|
|
|
|
if (wParam->lengthAndMask)
|
|
|
|
{
|
|
|
|
wParam->andMaskData = (BYTE*) malloc(wParam->lengthAndMask);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->andMaskData)
|
|
|
|
goto out_fail;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
CopyMemory(wParam->andMaskData, pointerColor->andMaskData, wParam->lengthAndMask);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wParam->lengthXorMask)
|
|
|
|
{
|
|
|
|
wParam->xorMaskData = (BYTE*) malloc(wParam->lengthXorMask);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->xorMaskData)
|
|
|
|
goto out_fail;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
CopyMemory(wParam->xorMaskData, pointerColor->xorMaskData, wParam->lengthXorMask);
|
|
|
|
}
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PointerUpdate, PointerColor), (void*) wParam, NULL);
|
2015-04-14 11:14:23 +03:00
|
|
|
out_fail:
|
|
|
|
free(wParam->andMaskData);
|
|
|
|
free(wParam->xorMaskData);
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_PointerNew(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const POINTER_NEW_UPDATE* pointerNew)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POINTER_NEW_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !pointerNew)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POINTER_NEW_UPDATE*) malloc(sizeof(POINTER_NEW_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, pointerNew, sizeof(POINTER_NEW_UPDATE));
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam->colorPtrAttr.andMaskData = wParam->colorPtrAttr.xorMaskData = NULL;
|
|
|
|
|
|
|
|
if (wParam->colorPtrAttr.lengthAndMask)
|
|
|
|
{
|
|
|
|
wParam->colorPtrAttr.andMaskData = (BYTE*) malloc(wParam->colorPtrAttr.lengthAndMask);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->colorPtrAttr.andMaskData)
|
|
|
|
goto out_fail;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
|
|
|
CopyMemory(wParam->colorPtrAttr.andMaskData, pointerNew->colorPtrAttr.andMaskData,
|
|
|
|
wParam->colorPtrAttr.lengthAndMask);
|
2013-01-25 09:27:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (wParam->colorPtrAttr.lengthXorMask)
|
|
|
|
{
|
|
|
|
wParam->colorPtrAttr.xorMaskData = (BYTE*) malloc(wParam->colorPtrAttr.lengthXorMask);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam->colorPtrAttr.xorMaskData)
|
|
|
|
goto out_fail;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
|
|
|
CopyMemory(wParam->colorPtrAttr.xorMaskData, pointerNew->colorPtrAttr.xorMaskData,
|
|
|
|
wParam->colorPtrAttr.lengthXorMask);
|
2013-01-25 09:27:39 +04:00
|
|
|
}
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PointerUpdate, PointerNew), (void*) wParam, NULL);
|
2015-04-14 11:14:23 +03:00
|
|
|
out_fail:
|
|
|
|
free(wParam->colorPtrAttr.andMaskData);
|
|
|
|
free(wParam->colorPtrAttr.xorMaskData);
|
|
|
|
free(wParam);
|
|
|
|
return FALSE;
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static BOOL update_message_PointerCached(rdpContext* context,
|
2017-02-20 20:31:58 +03:00
|
|
|
const POINTER_CACHED_UPDATE* pointerCached)
|
2013-01-25 02:11:43 +04:00
|
|
|
{
|
2013-01-25 09:27:39 +04:00
|
|
|
POINTER_CACHED_UPDATE* wParam;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!context || !context->update || !pointerCached)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-25 09:27:39 +04:00
|
|
|
wParam = (POINTER_CACHED_UPDATE*) malloc(sizeof(POINTER_CACHED_UPDATE));
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
if (!wParam)
|
|
|
|
return FALSE;
|
2013-01-25 09:27:39 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
CopyMemory(wParam, pointerCached, sizeof(POINTER_CACHED_UPDATE));
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(context->update->queue, (void*) context,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(PointerUpdate, PointerCached), (void*) wParam, NULL);
|
2013-01-25 02:11:43 +04:00
|
|
|
}
|
2013-01-25 04:08:30 +04:00
|
|
|
|
|
|
|
/* Message Queue */
|
2013-11-12 18:03:07 +04:00
|
|
|
static int update_message_free_update_class(wMessage* msg, int type)
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Update_BeginPaint:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_EndPaint:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SetBounds:
|
2015-05-11 10:07:39 +03:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_Synchronize:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_DesktopResize:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_BitmapUpdate:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 index;
|
2013-01-25 22:12:21 +04:00
|
|
|
BITMAP_UPDATE* wParam = (BITMAP_UPDATE*) msg->wParam;
|
|
|
|
|
|
|
|
for (index = 0; index < wParam->number; index++)
|
2013-04-13 01:05:42 +04:00
|
|
|
{
|
|
|
|
#ifdef WITH_STREAM_POOL
|
|
|
|
rdpContext* context = (rdpContext*) msg->context;
|
2017-02-20 20:31:58 +03:00
|
|
|
StreamPool_Release(context->rdp->transport->ReceivePool,
|
|
|
|
wParam->rectangles[index].bitmapDataStream);
|
2013-04-13 01:05:42 +04:00
|
|
|
#else
|
2013-01-25 22:12:21 +04:00
|
|
|
free(wParam->rectangles[index].bitmapDataStream);
|
2013-04-13 01:05:42 +04:00
|
|
|
#endif
|
|
|
|
}
|
2013-01-25 22:12:21 +04:00
|
|
|
|
2013-11-03 22:29:48 +04:00
|
|
|
free(wParam->rectangles);
|
2013-01-25 22:12:21 +04:00
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_Palette:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_PlaySound:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_RefreshRect:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SuppressOutput:
|
2015-05-11 10:07:39 +03:00
|
|
|
free(msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SurfaceCommand:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s = (wStream*) msg->wParam;
|
2013-05-15 20:14:26 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2013-01-25 22:12:21 +04:00
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SurfaceBits:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
2013-04-13 01:05:42 +04:00
|
|
|
#ifdef WITH_STREAM_POOL
|
|
|
|
rdpContext* context = (rdpContext*) msg->context;
|
|
|
|
SURFACE_BITS_COMMAND* wParam = (SURFACE_BITS_COMMAND*) msg->wParam;
|
2018-02-28 12:10:09 +03:00
|
|
|
StreamPool_Release(context->rdp->transport->ReceivePool, wParam->bmp.bitmapData);
|
2013-04-13 01:05:42 +04:00
|
|
|
#else
|
2013-01-25 22:12:21 +04:00
|
|
|
SURFACE_BITS_COMMAND* wParam = (SURFACE_BITS_COMMAND*) msg->wParam;
|
2018-02-28 12:10:09 +03:00
|
|
|
free(wParam->bmp.bitmapData);
|
2013-01-25 22:12:21 +04:00
|
|
|
free(wParam);
|
2013-04-13 01:05:42 +04:00
|
|
|
#endif
|
2013-01-25 22:12:21 +04:00
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SurfaceFrameMarker:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case Update_SurfaceFrameAcknowledge:
|
2014-09-30 20:18:29 +04:00
|
|
|
case Update_SetKeyboardIndicators:
|
2017-05-12 10:43:58 +03:00
|
|
|
case Update_SetKeyboardImeStatus:
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int update_message_process_update_class(rdpUpdateProxy* proxy, wMessage* msg, int type)
|
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Update_BeginPaint:
|
|
|
|
IFCALL(proxy->BeginPaint, msg->context);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_EndPaint:
|
|
|
|
IFCALL(proxy->EndPaint, msg->context);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SetBounds:
|
|
|
|
IFCALL(proxy->SetBounds, msg->context, (rdpBounds*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_Synchronize:
|
|
|
|
IFCALL(proxy->Synchronize, msg->context);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_DesktopResize:
|
|
|
|
IFCALL(proxy->DesktopResize, msg->context);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_BitmapUpdate:
|
|
|
|
IFCALL(proxy->BitmapUpdate, msg->context, (BITMAP_UPDATE*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_Palette:
|
|
|
|
IFCALL(proxy->Palette, msg->context, (PALETTE_UPDATE*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_PlaySound:
|
|
|
|
IFCALL(proxy->PlaySound, msg->context, (PLAY_SOUND_UPDATE*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_RefreshRect:
|
|
|
|
IFCALL(proxy->RefreshRect, msg->context,
|
2017-02-20 20:31:58 +03:00
|
|
|
(BYTE)(size_t) msg->wParam, (RECTANGLE_16*) msg->lParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SuppressOutput:
|
|
|
|
IFCALL(proxy->SuppressOutput, msg->context,
|
2017-02-20 20:31:58 +03:00
|
|
|
(BYTE)(size_t) msg->wParam, (RECTANGLE_16*) msg->lParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SurfaceCommand:
|
|
|
|
IFCALL(proxy->SurfaceCommand, msg->context, (wStream*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SurfaceBits:
|
|
|
|
IFCALL(proxy->SurfaceBits, msg->context, (SURFACE_BITS_COMMAND*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Update_SurfaceFrameMarker:
|
|
|
|
IFCALL(proxy->SurfaceFrameMarker, msg->context, (SURFACE_FRAME_MARKER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
case Update_SurfaceFrameAcknowledge:
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->SurfaceFrameAcknowledge, msg->context, (UINT32)(size_t) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2014-09-30 20:18:29 +04:00
|
|
|
case Update_SetKeyboardIndicators:
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->SetKeyboardIndicators, msg->context, (UINT16)(size_t) msg->wParam);
|
2014-09-30 20:18:29 +04:00
|
|
|
break;
|
|
|
|
|
2017-05-12 10:43:58 +03:00
|
|
|
case Update_SetKeyboardImeStatus:
|
|
|
|
{
|
|
|
|
const UINT16 imeId = ((size_t)msg->wParam) >> 16 & 0xFFFF;
|
|
|
|
const UINT32 imeState = ((size_t)msg->wParam) & 0xFFFF;
|
|
|
|
const UINT32 imeConvMode = ((size_t)msg->lParam);
|
|
|
|
IFCALL(proxy->SetKeyboardImeStatus, msg->context, imeId, imeState, imeConvMode);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
static int update_message_free_primary_update_class(wMessage* msg, int type)
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case PrimaryUpdate_DstBlt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_PatBlt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_ScrBlt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_OpaqueRect:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_DrawNineGrid:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiDstBlt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiPatBlt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiScrBlt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiOpaqueRect:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiDrawNineGrid:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_LineTo:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_Polyline:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
POLYLINE_ORDER* wParam = (POLYLINE_ORDER*) msg->wParam;
|
|
|
|
free(wParam->points);
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MemBlt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_Mem3Blt:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_SaveBitmap:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_GlyphIndex:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_FastIndex:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_FastGlyph:
|
2013-11-03 22:29:48 +04:00
|
|
|
{
|
|
|
|
FAST_GLYPH_ORDER* wParam = (FAST_GLYPH_ORDER*) msg->wParam;
|
2015-05-11 10:07:39 +03:00
|
|
|
free(wParam->glyphData.aj);
|
2013-11-03 22:29:48 +04:00
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_PolygonSC:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
POLYGON_SC_ORDER* wParam = (POLYGON_SC_ORDER*) msg->wParam;
|
|
|
|
free(wParam->points);
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_PolygonCB:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
POLYGON_CB_ORDER* wParam = (POLYGON_CB_ORDER*) msg->wParam;
|
|
|
|
free(wParam->points);
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_EllipseSC:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_EllipseCB:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int update_message_process_primary_update_class(rdpUpdateProxy* proxy, wMessage* msg,
|
|
|
|
int type)
|
2013-11-12 18:03:07 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case PrimaryUpdate_DstBlt:
|
|
|
|
IFCALL(proxy->DstBlt, msg->context, (DSTBLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_PatBlt:
|
|
|
|
IFCALL(proxy->PatBlt, msg->context, (PATBLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_ScrBlt:
|
|
|
|
IFCALL(proxy->ScrBlt, msg->context, (SCRBLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_OpaqueRect:
|
|
|
|
IFCALL(proxy->OpaqueRect, msg->context, (OPAQUE_RECT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_DrawNineGrid:
|
|
|
|
IFCALL(proxy->DrawNineGrid, msg->context, (DRAW_NINE_GRID_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiDstBlt:
|
|
|
|
IFCALL(proxy->MultiDstBlt, msg->context, (MULTI_DSTBLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiPatBlt:
|
|
|
|
IFCALL(proxy->MultiPatBlt, msg->context, (MULTI_PATBLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiScrBlt:
|
|
|
|
IFCALL(proxy->MultiScrBlt, msg->context, (MULTI_SCRBLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiOpaqueRect:
|
|
|
|
IFCALL(proxy->MultiOpaqueRect, msg->context, (MULTI_OPAQUE_RECT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MultiDrawNineGrid:
|
|
|
|
IFCALL(proxy->MultiDrawNineGrid, msg->context, (MULTI_DRAW_NINE_GRID_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_LineTo:
|
|
|
|
IFCALL(proxy->LineTo, msg->context, (LINE_TO_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_Polyline:
|
|
|
|
IFCALL(proxy->Polyline, msg->context, (POLYLINE_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_MemBlt:
|
|
|
|
IFCALL(proxy->MemBlt, msg->context, (MEMBLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_Mem3Blt:
|
|
|
|
IFCALL(proxy->Mem3Blt, msg->context, (MEM3BLT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_SaveBitmap:
|
|
|
|
IFCALL(proxy->SaveBitmap, msg->context, (SAVE_BITMAP_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_GlyphIndex:
|
|
|
|
IFCALL(proxy->GlyphIndex, msg->context, (GLYPH_INDEX_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_FastIndex:
|
|
|
|
IFCALL(proxy->FastIndex, msg->context, (FAST_INDEX_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_FastGlyph:
|
|
|
|
IFCALL(proxy->FastGlyph, msg->context, (FAST_GLYPH_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_PolygonSC:
|
|
|
|
IFCALL(proxy->PolygonSC, msg->context, (POLYGON_SC_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_PolygonCB:
|
|
|
|
IFCALL(proxy->PolygonCB, msg->context, (POLYGON_CB_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_EllipseSC:
|
|
|
|
IFCALL(proxy->EllipseSC, msg->context, (ELLIPSE_SC_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_EllipseCB:
|
|
|
|
IFCALL(proxy->EllipseCB, msg->context, (ELLIPSE_CB_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int update_message_free_secondary_update_class(wMessage* msg, int type)
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case SecondaryUpdate_CacheBitmap:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
CACHE_BITMAP_ORDER* wParam = (CACHE_BITMAP_ORDER*) msg->wParam;
|
|
|
|
free(wParam->bitmapDataStream);
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_CacheBitmapV2:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
CACHE_BITMAP_V2_ORDER* wParam = (CACHE_BITMAP_V2_ORDER*) msg->wParam;
|
2013-01-29 03:42:32 +04:00
|
|
|
free(wParam->bitmapDataStream);
|
2013-01-25 22:12:21 +04:00
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_CacheBitmapV3:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
CACHE_BITMAP_V3_ORDER* wParam = (CACHE_BITMAP_V3_ORDER*) msg->wParam;
|
|
|
|
free(wParam->bitmapData.data);
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_CacheColorTable:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
CACHE_COLOR_TABLE_ORDER* wParam = (CACHE_COLOR_TABLE_ORDER*) msg->wParam;
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_CacheGlyph:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
CACHE_GLYPH_ORDER* wParam = (CACHE_GLYPH_ORDER*) msg->wParam;
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_CacheGlyphV2:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
CACHE_GLYPH_V2_ORDER* wParam = (CACHE_GLYPH_V2_ORDER*) msg->wParam;
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_CacheBrush:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
CACHE_BRUSH_ORDER* wParam = (CACHE_BRUSH_ORDER*) msg->wParam;
|
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int update_message_process_secondary_update_class(rdpUpdateProxy* proxy, wMessage* msg,
|
|
|
|
int type)
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
2013-11-12 18:03:07 +04:00
|
|
|
case SecondaryUpdate_CacheBitmap:
|
|
|
|
IFCALL(proxy->CacheBitmap, msg->context, (CACHE_BITMAP_ORDER*) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case SecondaryUpdate_CacheBitmapV2:
|
|
|
|
IFCALL(proxy->CacheBitmapV2, msg->context, (CACHE_BITMAP_V2_ORDER*) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case SecondaryUpdate_CacheBitmapV3:
|
|
|
|
IFCALL(proxy->CacheBitmapV3, msg->context, (CACHE_BITMAP_V3_ORDER*) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case SecondaryUpdate_CacheColorTable:
|
|
|
|
IFCALL(proxy->CacheColorTable, msg->context, (CACHE_COLOR_TABLE_ORDER*) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case SecondaryUpdate_CacheGlyph:
|
|
|
|
IFCALL(proxy->CacheGlyph, msg->context, (CACHE_GLYPH_ORDER*) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case SecondaryUpdate_CacheGlyphV2:
|
|
|
|
IFCALL(proxy->CacheGlyphV2, msg->context, (CACHE_GLYPH_V2_ORDER*) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case SecondaryUpdate_CacheBrush:
|
|
|
|
IFCALL(proxy->CacheBrush, msg->context, (CACHE_BRUSH_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int update_message_free_altsec_update_class(wMessage* msg, int type)
|
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case AltSecUpdate_CreateOffscreenBitmap:
|
|
|
|
{
|
|
|
|
CREATE_OFFSCREEN_BITMAP_ORDER* wParam = (CREATE_OFFSCREEN_BITMAP_ORDER*) msg->wParam;
|
|
|
|
free(wParam->deleteList.indices);
|
|
|
|
free(wParam);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_SwitchSurface:
|
|
|
|
free(msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_CreateNineGridBitmap:
|
|
|
|
free(msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_FrameMarker:
|
|
|
|
free(msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_StreamBitmapFirst:
|
|
|
|
free(msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_StreamBitmapNext:
|
|
|
|
free(msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusFirst:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusNext:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusEnd:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusCacheFirst:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusCacheNext:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusCacheEnd:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int update_message_process_altsec_update_class(rdpUpdateProxy* proxy, wMessage* msg,
|
|
|
|
int type)
|
2013-11-12 18:03:07 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case AltSecUpdate_CreateOffscreenBitmap:
|
|
|
|
IFCALL(proxy->CreateOffscreenBitmap, msg->context, (CREATE_OFFSCREEN_BITMAP_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_SwitchSurface:
|
|
|
|
IFCALL(proxy->SwitchSurface, msg->context, (SWITCH_SURFACE_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_CreateNineGridBitmap:
|
|
|
|
IFCALL(proxy->CreateNineGridBitmap, msg->context, (CREATE_NINE_GRID_BITMAP_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_FrameMarker:
|
|
|
|
IFCALL(proxy->FrameMarker, msg->context, (FRAME_MARKER_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_StreamBitmapFirst:
|
|
|
|
IFCALL(proxy->StreamBitmapFirst, msg->context, (STREAM_BITMAP_FIRST_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_StreamBitmapNext:
|
|
|
|
IFCALL(proxy->StreamBitmapNext, msg->context, (STREAM_BITMAP_NEXT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusFirst:
|
|
|
|
IFCALL(proxy->DrawGdiPlusFirst, msg->context, (DRAW_GDIPLUS_FIRST_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusNext:
|
|
|
|
IFCALL(proxy->DrawGdiPlusNext, msg->context, (DRAW_GDIPLUS_NEXT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusEnd:
|
|
|
|
IFCALL(proxy->DrawGdiPlusEnd, msg->context, (DRAW_GDIPLUS_END_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusCacheFirst:
|
|
|
|
IFCALL(proxy->DrawGdiPlusCacheFirst, msg->context, (DRAW_GDIPLUS_CACHE_FIRST_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusCacheNext:
|
|
|
|
IFCALL(proxy->DrawGdiPlusCacheNext, msg->context, (DRAW_GDIPLUS_CACHE_NEXT_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_DrawGdiPlusCacheEnd:
|
|
|
|
IFCALL(proxy->DrawGdiPlusCacheEnd, msg->context, (DRAW_GDIPLUS_CACHE_END_ORDER*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int update_message_free_window_update_class(wMessage* msg, int type)
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case WindowUpdate_WindowCreate:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
|
|
|
free(msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowUpdate:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
|
|
|
free(msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowIcon:
|
2013-10-23 00:28:23 +04:00
|
|
|
{
|
|
|
|
WINDOW_ORDER_INFO* orderInfo = (WINDOW_ORDER_INFO*) msg->wParam;
|
|
|
|
WINDOW_ICON_ORDER* windowIcon = (WINDOW_ICON_ORDER*) msg->lParam;
|
|
|
|
|
|
|
|
if (windowIcon->iconInfo->cbBitsColor > 0)
|
|
|
|
{
|
|
|
|
free(windowIcon->iconInfo->bitsColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (windowIcon->iconInfo->cbBitsMask > 0)
|
|
|
|
{
|
|
|
|
free(windowIcon->iconInfo->bitsMask);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (windowIcon->iconInfo->cbColorTable > 0)
|
|
|
|
{
|
|
|
|
free(windowIcon->iconInfo->colorTable);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(orderInfo);
|
|
|
|
free(windowIcon);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowCachedIcon:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
|
|
|
free(msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowDelete:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_NotifyIconCreate:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
|
|
|
free(msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_NotifyIconUpdate:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
|
|
|
free(msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_NotifyIconDelete:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_MonitoredDesktop:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
MONITORED_DESKTOP_ORDER* lParam = (MONITORED_DESKTOP_ORDER*) msg->lParam;
|
|
|
|
free(msg->wParam);
|
|
|
|
free(lParam->windowIds);
|
|
|
|
free(lParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_NonMonitoredDesktop:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int update_message_process_window_update_class(rdpUpdateProxy* proxy, wMessage* msg,
|
|
|
|
int type)
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
2013-11-12 18:03:07 +04:00
|
|
|
case WindowUpdate_WindowCreate:
|
|
|
|
IFCALL(proxy->WindowCreate, msg->context, (WINDOW_ORDER_INFO*) msg->wParam,
|
2017-02-20 20:31:58 +03:00
|
|
|
(WINDOW_STATE_ORDER*) msg->lParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowUpdate:
|
|
|
|
IFCALL(proxy->WindowCreate, msg->context, (WINDOW_ORDER_INFO*) msg->wParam,
|
2017-02-20 20:31:58 +03:00
|
|
|
(WINDOW_STATE_ORDER*) msg->lParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowIcon:
|
|
|
|
{
|
|
|
|
WINDOW_ORDER_INFO* orderInfo = (WINDOW_ORDER_INFO*) msg->wParam;
|
|
|
|
WINDOW_ICON_ORDER* windowIcon = (WINDOW_ICON_ORDER*) msg->lParam;
|
|
|
|
IFCALL(proxy->WindowIcon, msg->context, orderInfo, windowIcon);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowCachedIcon:
|
|
|
|
IFCALL(proxy->WindowCachedIcon, msg->context, (WINDOW_ORDER_INFO*) msg->wParam,
|
2017-02-20 20:31:58 +03:00
|
|
|
(WINDOW_CACHED_ICON_ORDER*) msg->lParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_WindowDelete:
|
|
|
|
IFCALL(proxy->WindowDelete, msg->context, (WINDOW_ORDER_INFO*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_NotifyIconCreate:
|
|
|
|
IFCALL(proxy->NotifyIconCreate, msg->context, (WINDOW_ORDER_INFO*) msg->wParam,
|
2017-02-20 20:31:58 +03:00
|
|
|
(NOTIFY_ICON_STATE_ORDER*) msg->lParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_NotifyIconUpdate:
|
|
|
|
IFCALL(proxy->NotifyIconUpdate, msg->context, (WINDOW_ORDER_INFO*) msg->wParam,
|
2017-02-20 20:31:58 +03:00
|
|
|
(NOTIFY_ICON_STATE_ORDER*) msg->lParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
case WindowUpdate_NotifyIconDelete:
|
|
|
|
IFCALL(proxy->NotifyIconDelete, msg->context, (WINDOW_ORDER_INFO*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_MonitoredDesktop:
|
|
|
|
IFCALL(proxy->MonitoredDesktop, msg->context, (WINDOW_ORDER_INFO*) msg->wParam,
|
2017-02-20 20:31:58 +03:00
|
|
|
(MONITORED_DESKTOP_ORDER*) msg->lParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_NonMonitoredDesktop:
|
|
|
|
IFCALL(proxy->NonMonitoredDesktop, msg->context, (WINDOW_ORDER_INFO*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
int update_message_free_pointer_update_class(wMessage* msg, int type)
|
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!msg)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
switch (type)
|
2013-11-12 18:03:07 +04:00
|
|
|
{
|
|
|
|
case PointerUpdate_PointerPosition:
|
2013-01-25 07:38:13 +04:00
|
|
|
case PointerUpdate_PointerSystem:
|
2013-11-12 18:03:07 +04:00
|
|
|
case PointerUpdate_PointerCached:
|
2013-01-25 22:12:21 +04:00
|
|
|
free(msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PointerUpdate_PointerColor:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
POINTER_COLOR_UPDATE* wParam = (POINTER_COLOR_UPDATE*) msg->wParam;
|
2013-01-29 03:42:32 +04:00
|
|
|
free(wParam->andMaskData);
|
|
|
|
free(wParam->xorMaskData);
|
2013-01-25 22:12:21 +04:00
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
2016-02-25 21:37:20 +03:00
|
|
|
|
2013-01-25 07:38:13 +04:00
|
|
|
case PointerUpdate_PointerNew:
|
2013-01-25 22:12:21 +04:00
|
|
|
{
|
|
|
|
POINTER_NEW_UPDATE* wParam = (POINTER_NEW_UPDATE*) msg->wParam;
|
2013-01-29 03:42:32 +04:00
|
|
|
free(wParam->colorPtrAttr.andMaskData);
|
|
|
|
free(wParam->colorPtrAttr.xorMaskData);
|
2013-01-25 22:12:21 +04:00
|
|
|
free(wParam);
|
|
|
|
}
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int update_message_process_pointer_update_class(rdpUpdateProxy* proxy, wMessage* msg,
|
|
|
|
int type)
|
2013-11-12 18:03:07 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case PointerUpdate_PointerPosition:
|
|
|
|
IFCALL(proxy->PointerPosition, msg->context, (POINTER_POSITION_UPDATE*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PointerUpdate_PointerSystem:
|
|
|
|
IFCALL(proxy->PointerSystem, msg->context, (POINTER_SYSTEM_UPDATE*) msg->wParam);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PointerUpdate_PointerColor:
|
2016-02-25 21:37:20 +03:00
|
|
|
IFCALL(proxy->PointerColor, msg->context, (POINTER_COLOR_UPDATE*) msg->wParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PointerUpdate_PointerNew:
|
2016-02-25 21:37:20 +03:00
|
|
|
IFCALL(proxy->PointerNew, msg->context, (POINTER_NEW_UPDATE*) msg->wParam);
|
2013-11-12 18:03:07 +04:00
|
|
|
break;
|
2013-01-25 07:38:13 +04:00
|
|
|
|
|
|
|
case PointerUpdate_PointerCached:
|
2013-02-04 20:05:24 +04:00
|
|
|
IFCALL(proxy->PointerCached, msg->context, (POINTER_CACHED_UPDATE*) msg->wParam);
|
2013-01-25 07:38:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int update_message_free_class(wMessage* msg, int msgClass, int msgType)
|
2013-11-12 18:03:07 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
switch (msgClass)
|
|
|
|
{
|
|
|
|
case Update_Class:
|
|
|
|
status = update_message_free_update_class(msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_Class:
|
|
|
|
status = update_message_free_primary_update_class(msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_Class:
|
|
|
|
status = update_message_free_secondary_update_class(msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_Class:
|
|
|
|
status = update_message_free_altsec_update_class(msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_Class:
|
|
|
|
status = update_message_free_window_update_class(msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PointerUpdate_Class:
|
|
|
|
status = update_message_free_pointer_update_class(msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status < 0)
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "Unknown message: class: %d type: %d", msgClass, msgType);
|
2013-11-12 18:03:07 +04:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int update_message_process_class(rdpUpdateProxy* proxy, wMessage* msg, int msgClass,
|
|
|
|
int msgType)
|
2013-01-25 21:08:00 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
switch (msgClass)
|
|
|
|
{
|
|
|
|
case Update_Class:
|
2013-02-04 20:05:24 +04:00
|
|
|
status = update_message_process_update_class(proxy, msg, msgType);
|
2013-01-25 21:08:00 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PrimaryUpdate_Class:
|
2013-02-04 20:05:24 +04:00
|
|
|
status = update_message_process_primary_update_class(proxy, msg, msgType);
|
2013-01-25 21:08:00 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SecondaryUpdate_Class:
|
2013-02-04 20:05:24 +04:00
|
|
|
status = update_message_process_secondary_update_class(proxy, msg, msgType);
|
2013-01-25 21:08:00 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AltSecUpdate_Class:
|
2013-02-04 20:05:24 +04:00
|
|
|
status = update_message_process_altsec_update_class(proxy, msg, msgType);
|
2013-01-25 21:08:00 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WindowUpdate_Class:
|
2013-02-04 20:05:24 +04:00
|
|
|
status = update_message_process_window_update_class(proxy, msg, msgType);
|
2013-01-25 21:08:00 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PointerUpdate_Class:
|
2013-02-04 20:05:24 +04:00
|
|
|
status = update_message_process_pointer_update_class(proxy, msg, msgType);
|
2013-01-25 21:08:00 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status < 0)
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "Unknown message: class: %d type: %d", msgClass, msgType);
|
2013-01-25 21:08:00 +04:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-02-04 23:56:54 +04:00
|
|
|
int update_message_queue_process_message(rdpUpdate* update, wMessage* message)
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
int msgClass;
|
|
|
|
int msgType;
|
2013-02-04 23:56:54 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!update || !message)
|
|
|
|
return -1;
|
|
|
|
|
2013-02-04 23:56:54 +04:00
|
|
|
if (message->id == WMQ_QUIT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
msgClass = GetMessageClass(message->id);
|
|
|
|
msgType = GetMessageType(message->id);
|
|
|
|
status = update_message_process_class(update->proxy, message, msgClass, msgType);
|
2013-11-12 18:03:07 +04:00
|
|
|
update_message_free_class(message, msgClass, msgType);
|
|
|
|
|
|
|
|
if (status < 0)
|
2017-11-14 15:58:08 +03:00
|
|
|
return -1;
|
2013-11-12 18:03:07 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
int update_message_queue_free_message(wMessage* message)
|
2013-11-12 18:03:07 +04:00
|
|
|
{
|
|
|
|
int msgClass;
|
|
|
|
int msgType;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!message)
|
|
|
|
return -1;
|
2016-02-25 21:37:20 +03:00
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
if (message->id == WMQ_QUIT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
msgClass = GetMessageClass(message->id);
|
|
|
|
msgType = GetMessageType(message->id);
|
2017-02-20 20:31:58 +03:00
|
|
|
return update_message_free_class(message, msgClass, msgType);
|
2013-02-04 23:56:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int update_message_queue_process_pending_messages(rdpUpdate* update)
|
|
|
|
{
|
|
|
|
int status;
|
2013-01-25 07:38:13 +04:00
|
|
|
wMessage message;
|
|
|
|
wMessageQueue* queue;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!update || !update->queue)
|
|
|
|
return -1;
|
|
|
|
|
2013-02-12 05:38:19 +04:00
|
|
|
status = 1;
|
2013-01-25 07:38:13 +04:00
|
|
|
queue = update->queue;
|
|
|
|
|
2013-02-12 05:38:19 +04:00
|
|
|
while (MessageQueue_Peek(queue, &message, TRUE))
|
2013-01-25 07:38:13 +04:00
|
|
|
{
|
2013-02-04 23:56:54 +04:00
|
|
|
status = update_message_queue_process_message(update, &message);
|
2013-01-25 07:38:13 +04:00
|
|
|
|
2013-02-04 23:56:54 +04:00
|
|
|
if (!status)
|
|
|
|
break;
|
2013-01-25 07:38:13 +04:00
|
|
|
}
|
|
|
|
|
2013-02-04 23:56:54 +04:00
|
|
|
return status;
|
2013-01-25 05:05:03 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL update_message_register_interface(rdpUpdateProxy* message, rdpUpdate* update)
|
2013-01-28 03:22:46 +04:00
|
|
|
{
|
|
|
|
rdpPrimaryUpdate* primary;
|
|
|
|
rdpSecondaryUpdate* secondary;
|
|
|
|
rdpAltSecUpdate* altsec;
|
|
|
|
rdpWindowUpdate* window;
|
|
|
|
rdpPointerUpdate* pointer;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!message || !update)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-28 03:22:46 +04:00
|
|
|
primary = update->primary;
|
|
|
|
secondary = update->secondary;
|
|
|
|
altsec = update->altsec;
|
|
|
|
window = update->window;
|
|
|
|
pointer = update->pointer;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!primary || !secondary || !altsec || !window || !pointer)
|
|
|
|
return FALSE;
|
2013-01-28 03:22:46 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
/* Update */
|
2013-01-28 03:22:46 +04:00
|
|
|
message->BeginPaint = update->BeginPaint;
|
|
|
|
message->EndPaint = update->EndPaint;
|
|
|
|
message->SetBounds = update->SetBounds;
|
|
|
|
message->Synchronize = update->Synchronize;
|
|
|
|
message->DesktopResize = update->DesktopResize;
|
|
|
|
message->BitmapUpdate = update->BitmapUpdate;
|
|
|
|
message->Palette = update->Palette;
|
|
|
|
message->PlaySound = update->PlaySound;
|
2014-09-30 20:18:29 +04:00
|
|
|
message->SetKeyboardIndicators = update->SetKeyboardIndicators;
|
2017-05-12 10:43:58 +03:00
|
|
|
message->SetKeyboardImeStatus = update->SetKeyboardImeStatus;
|
2013-01-28 03:22:46 +04:00
|
|
|
message->RefreshRect = update->RefreshRect;
|
|
|
|
message->SuppressOutput = update->SuppressOutput;
|
|
|
|
message->SurfaceCommand = update->SurfaceCommand;
|
|
|
|
message->SurfaceBits = update->SurfaceBits;
|
|
|
|
message->SurfaceFrameMarker = update->SurfaceFrameMarker;
|
|
|
|
message->SurfaceFrameAcknowledge = update->SurfaceFrameAcknowledge;
|
2013-02-04 20:05:24 +04:00
|
|
|
update->BeginPaint = update_message_BeginPaint;
|
|
|
|
update->EndPaint = update_message_EndPaint;
|
|
|
|
update->SetBounds = update_message_SetBounds;
|
|
|
|
update->Synchronize = update_message_Synchronize;
|
|
|
|
update->DesktopResize = update_message_DesktopResize;
|
|
|
|
update->BitmapUpdate = update_message_BitmapUpdate;
|
|
|
|
update->Palette = update_message_Palette;
|
|
|
|
update->PlaySound = update_message_PlaySound;
|
2014-09-30 20:18:29 +04:00
|
|
|
update->SetKeyboardIndicators = update_message_SetKeyboardIndicators;
|
2017-05-12 10:43:58 +03:00
|
|
|
update->SetKeyboardImeStatus = update_message_SetKeyboardImeStatus;
|
2013-02-04 20:05:24 +04:00
|
|
|
update->RefreshRect = update_message_RefreshRect;
|
|
|
|
update->SuppressOutput = update_message_SuppressOutput;
|
|
|
|
update->SurfaceCommand = update_message_SurfaceCommand;
|
|
|
|
update->SurfaceBits = update_message_SurfaceBits;
|
|
|
|
update->SurfaceFrameMarker = update_message_SurfaceFrameMarker;
|
|
|
|
update->SurfaceFrameAcknowledge = update_message_SurfaceFrameAcknowledge;
|
2013-01-28 03:22:46 +04:00
|
|
|
/* Primary Update */
|
|
|
|
message->DstBlt = primary->DstBlt;
|
|
|
|
message->PatBlt = primary->PatBlt;
|
|
|
|
message->ScrBlt = primary->ScrBlt;
|
|
|
|
message->OpaqueRect = primary->OpaqueRect;
|
|
|
|
message->DrawNineGrid = primary->DrawNineGrid;
|
|
|
|
message->MultiDstBlt = primary->MultiDstBlt;
|
|
|
|
message->MultiPatBlt = primary->MultiPatBlt;
|
|
|
|
message->MultiScrBlt = primary->MultiScrBlt;
|
|
|
|
message->MultiOpaqueRect = primary->MultiOpaqueRect;
|
|
|
|
message->MultiDrawNineGrid = primary->MultiDrawNineGrid;
|
|
|
|
message->LineTo = primary->LineTo;
|
|
|
|
message->Polyline = primary->Polyline;
|
|
|
|
message->MemBlt = primary->MemBlt;
|
|
|
|
message->Mem3Blt = primary->Mem3Blt;
|
|
|
|
message->SaveBitmap = primary->SaveBitmap;
|
|
|
|
message->GlyphIndex = primary->GlyphIndex;
|
|
|
|
message->FastIndex = primary->FastIndex;
|
|
|
|
message->FastGlyph = primary->FastGlyph;
|
|
|
|
message->PolygonSC = primary->PolygonSC;
|
|
|
|
message->PolygonCB = primary->PolygonCB;
|
|
|
|
message->EllipseSC = primary->EllipseSC;
|
|
|
|
message->EllipseCB = primary->EllipseCB;
|
2013-02-04 20:05:24 +04:00
|
|
|
primary->DstBlt = update_message_DstBlt;
|
|
|
|
primary->PatBlt = update_message_PatBlt;
|
|
|
|
primary->ScrBlt = update_message_ScrBlt;
|
|
|
|
primary->OpaqueRect = update_message_OpaqueRect;
|
|
|
|
primary->DrawNineGrid = update_message_DrawNineGrid;
|
|
|
|
primary->MultiDstBlt = update_message_MultiDstBlt;
|
|
|
|
primary->MultiPatBlt = update_message_MultiPatBlt;
|
|
|
|
primary->MultiScrBlt = update_message_MultiScrBlt;
|
|
|
|
primary->MultiOpaqueRect = update_message_MultiOpaqueRect;
|
|
|
|
primary->MultiDrawNineGrid = update_message_MultiDrawNineGrid;
|
|
|
|
primary->LineTo = update_message_LineTo;
|
|
|
|
primary->Polyline = update_message_Polyline;
|
|
|
|
primary->MemBlt = update_message_MemBlt;
|
|
|
|
primary->Mem3Blt = update_message_Mem3Blt;
|
|
|
|
primary->SaveBitmap = update_message_SaveBitmap;
|
|
|
|
primary->GlyphIndex = update_message_GlyphIndex;
|
|
|
|
primary->FastIndex = update_message_FastIndex;
|
|
|
|
primary->FastGlyph = update_message_FastGlyph;
|
|
|
|
primary->PolygonSC = update_message_PolygonSC;
|
|
|
|
primary->PolygonCB = update_message_PolygonCB;
|
|
|
|
primary->EllipseSC = update_message_EllipseSC;
|
|
|
|
primary->EllipseCB = update_message_EllipseCB;
|
2013-01-28 03:22:46 +04:00
|
|
|
/* Secondary Update */
|
|
|
|
message->CacheBitmap = secondary->CacheBitmap;
|
|
|
|
message->CacheBitmapV2 = secondary->CacheBitmapV2;
|
|
|
|
message->CacheBitmapV3 = secondary->CacheBitmapV3;
|
|
|
|
message->CacheColorTable = secondary->CacheColorTable;
|
|
|
|
message->CacheGlyph = secondary->CacheGlyph;
|
|
|
|
message->CacheGlyphV2 = secondary->CacheGlyphV2;
|
|
|
|
message->CacheBrush = secondary->CacheBrush;
|
2013-02-04 20:05:24 +04:00
|
|
|
secondary->CacheBitmap = update_message_CacheBitmap;
|
|
|
|
secondary->CacheBitmapV2 = update_message_CacheBitmapV2;
|
|
|
|
secondary->CacheBitmapV3 = update_message_CacheBitmapV3;
|
|
|
|
secondary->CacheColorTable = update_message_CacheColorTable;
|
|
|
|
secondary->CacheGlyph = update_message_CacheGlyph;
|
|
|
|
secondary->CacheGlyphV2 = update_message_CacheGlyphV2;
|
|
|
|
secondary->CacheBrush = update_message_CacheBrush;
|
2013-01-28 03:22:46 +04:00
|
|
|
/* Alternate Secondary Update */
|
|
|
|
message->CreateOffscreenBitmap = altsec->CreateOffscreenBitmap;
|
|
|
|
message->SwitchSurface = altsec->SwitchSurface;
|
|
|
|
message->CreateNineGridBitmap = altsec->CreateNineGridBitmap;
|
|
|
|
message->FrameMarker = altsec->FrameMarker;
|
|
|
|
message->StreamBitmapFirst = altsec->StreamBitmapFirst;
|
|
|
|
message->StreamBitmapNext = altsec->StreamBitmapNext;
|
|
|
|
message->DrawGdiPlusFirst = altsec->DrawGdiPlusFirst;
|
|
|
|
message->DrawGdiPlusNext = altsec->DrawGdiPlusNext;
|
|
|
|
message->DrawGdiPlusEnd = altsec->DrawGdiPlusEnd;
|
|
|
|
message->DrawGdiPlusCacheFirst = altsec->DrawGdiPlusCacheFirst;
|
|
|
|
message->DrawGdiPlusCacheNext = altsec->DrawGdiPlusCacheNext;
|
|
|
|
message->DrawGdiPlusCacheEnd = altsec->DrawGdiPlusCacheEnd;
|
2013-02-04 20:05:24 +04:00
|
|
|
altsec->CreateOffscreenBitmap = update_message_CreateOffscreenBitmap;
|
|
|
|
altsec->SwitchSurface = update_message_SwitchSurface;
|
|
|
|
altsec->CreateNineGridBitmap = update_message_CreateNineGridBitmap;
|
|
|
|
altsec->FrameMarker = update_message_FrameMarker;
|
|
|
|
altsec->StreamBitmapFirst = update_message_StreamBitmapFirst;
|
|
|
|
altsec->StreamBitmapNext = update_message_StreamBitmapNext;
|
|
|
|
altsec->DrawGdiPlusFirst = update_message_DrawGdiPlusFirst;
|
|
|
|
altsec->DrawGdiPlusNext = update_message_DrawGdiPlusNext;
|
|
|
|
altsec->DrawGdiPlusEnd = update_message_DrawGdiPlusEnd;
|
|
|
|
altsec->DrawGdiPlusCacheFirst = update_message_DrawGdiPlusCacheFirst;
|
|
|
|
altsec->DrawGdiPlusCacheNext = update_message_DrawGdiPlusCacheNext;
|
|
|
|
altsec->DrawGdiPlusCacheEnd = update_message_DrawGdiPlusCacheEnd;
|
2013-01-28 03:22:46 +04:00
|
|
|
/* Window Update */
|
|
|
|
message->WindowCreate = window->WindowCreate;
|
|
|
|
message->WindowUpdate = window->WindowUpdate;
|
|
|
|
message->WindowIcon = window->WindowIcon;
|
|
|
|
message->WindowCachedIcon = window->WindowCachedIcon;
|
|
|
|
message->WindowDelete = window->WindowDelete;
|
|
|
|
message->NotifyIconCreate = window->NotifyIconCreate;
|
|
|
|
message->NotifyIconUpdate = window->NotifyIconUpdate;
|
|
|
|
message->NotifyIconDelete = window->NotifyIconDelete;
|
|
|
|
message->MonitoredDesktop = window->MonitoredDesktop;
|
|
|
|
message->NonMonitoredDesktop = window->NonMonitoredDesktop;
|
2013-02-04 20:05:24 +04:00
|
|
|
window->WindowCreate = update_message_WindowCreate;
|
|
|
|
window->WindowUpdate = update_message_WindowUpdate;
|
|
|
|
window->WindowIcon = update_message_WindowIcon;
|
|
|
|
window->WindowCachedIcon = update_message_WindowCachedIcon;
|
|
|
|
window->WindowDelete = update_message_WindowDelete;
|
|
|
|
window->NotifyIconCreate = update_message_NotifyIconCreate;
|
|
|
|
window->NotifyIconUpdate = update_message_NotifyIconUpdate;
|
|
|
|
window->NotifyIconDelete = update_message_NotifyIconDelete;
|
|
|
|
window->MonitoredDesktop = update_message_MonitoredDesktop;
|
|
|
|
window->NonMonitoredDesktop = update_message_NonMonitoredDesktop;
|
2013-01-28 03:22:46 +04:00
|
|
|
/* Pointer Update */
|
|
|
|
message->PointerPosition = pointer->PointerPosition;
|
|
|
|
message->PointerSystem = pointer->PointerSystem;
|
|
|
|
message->PointerColor = pointer->PointerColor;
|
|
|
|
message->PointerNew = pointer->PointerNew;
|
|
|
|
message->PointerCached = pointer->PointerCached;
|
2013-02-04 20:05:24 +04:00
|
|
|
pointer->PointerPosition = update_message_PointerPosition;
|
|
|
|
pointer->PointerSystem = update_message_PointerSystem;
|
|
|
|
pointer->PointerColor = update_message_PointerColor;
|
|
|
|
pointer->PointerNew = update_message_PointerNew;
|
|
|
|
pointer->PointerCached = update_message_PointerCached;
|
2017-02-20 20:31:58 +03:00
|
|
|
return TRUE;
|
2013-01-28 03:22:46 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static void* update_message_proxy_thread(void* arg)
|
2013-01-25 05:05:03 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpUpdate* update = (rdpUpdate*)arg;
|
2014-07-14 21:27:50 +04:00
|
|
|
wMessage message;
|
|
|
|
|
|
|
|
if (!update || !update->queue)
|
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
WLog_ERR(TAG, "update=%p, update->queue=%p", (void*) update,
|
|
|
|
(void*)(update ? update->queue : NULL));
|
2014-07-14 21:27:50 +04:00
|
|
|
ExitThread(-1);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (MessageQueue_Wait(update->queue))
|
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
if (MessageQueue_Peek(update->queue, &message, TRUE))
|
|
|
|
status = update_message_queue_process_message(update, &message);
|
2013-01-25 05:05:03 +04:00
|
|
|
|
2014-07-14 21:27:50 +04:00
|
|
|
if (!status)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ExitThread(0);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpUpdateProxy* update_message_proxy_new(rdpUpdate* update)
|
2014-07-14 21:27:50 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
rdpUpdateProxy* message;
|
|
|
|
|
|
|
|
if (!update)
|
|
|
|
return NULL;
|
2013-01-25 05:05:03 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!(message = (rdpUpdateProxy*) calloc(1, sizeof(rdpUpdateProxy))))
|
2015-05-05 14:55:48 +03:00
|
|
|
return NULL;
|
2013-01-28 06:07:17 +04:00
|
|
|
|
2015-05-05 14:55:48 +03:00
|
|
|
message->update = update;
|
|
|
|
update_message_register_interface(message, update);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
|
|
|
if (!(message->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) update_message_proxy_thread,
|
|
|
|
update, 0, NULL)))
|
2015-05-05 14:55:48 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Failed to create proxy thread");
|
|
|
|
free(message);
|
|
|
|
return NULL;
|
2013-01-28 03:22:46 +04:00
|
|
|
}
|
|
|
|
|
2013-01-25 05:05:03 +04:00
|
|
|
return message;
|
|
|
|
}
|
|
|
|
|
2013-02-04 20:05:24 +04:00
|
|
|
void update_message_proxy_free(rdpUpdateProxy* message)
|
2013-01-25 05:05:03 +04:00
|
|
|
{
|
|
|
|
if (message)
|
|
|
|
{
|
2015-05-23 23:47:18 +03:00
|
|
|
if (MessageQueue_PostQuit(message->update->queue, 0))
|
|
|
|
WaitForSingleObject(message->thread, INFINITE);
|
2017-02-20 20:31:58 +03:00
|
|
|
|
2014-07-14 21:27:50 +04:00
|
|
|
CloseHandle(message->thread);
|
2013-01-25 05:05:03 +04:00
|
|
|
free(message);
|
|
|
|
}
|
|
|
|
}
|
2013-02-04 20:05:24 +04:00
|
|
|
|
|
|
|
/* Input */
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL input_message_SynchronizeEvent(rdpInput* input, UINT32 flags)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(input->queue, (void*) input,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Input, SynchronizeEvent), (void*)(size_t) flags, NULL);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL input_message_KeyboardEvent(rdpInput* input, UINT16 flags, UINT16 code)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(input->queue, (void*) input,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Input, KeyboardEvent), (void*)(size_t) flags, (void*)(size_t) code);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL input_message_UnicodeKeyboardEvent(rdpInput* input, UINT16 flags, UINT16 code)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(input->queue, (void*) input,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Input, UnicodeKeyboardEvent), (void*)(size_t) flags, (void*)(size_t) code);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL input_message_MouseEvent(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
|
|
|
UINT32 pos = (x << 16) | y;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(input->queue, (void*) input,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Input, MouseEvent), (void*)(size_t) flags, (void*)(size_t) pos);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL input_message_ExtendedMouseEvent(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
|
|
|
UINT32 pos = (x << 16) | y;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(input->queue, (void*) input,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Input, ExtendedMouseEvent), (void*)(size_t) flags, (void*)(size_t) pos);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL input_message_FocusInEvent(rdpInput* input, UINT16 toggleStates)
|
2014-12-15 19:35:35 +03:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(input->queue, (void*) input,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Input, FocusInEvent), (void*)(size_t) toggleStates, NULL);
|
2014-12-15 19:35:35 +03:00
|
|
|
}
|
|
|
|
|
2015-04-14 11:14:23 +03:00
|
|
|
static BOOL input_message_KeyboardPauseEvent(rdpInput* input)
|
2014-12-15 19:35:35 +03:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-23 23:47:18 +03:00
|
|
|
return MessageQueue_Post(input->queue, (void*) input,
|
2017-02-20 20:31:58 +03:00
|
|
|
MakeMessageId(Input, KeyboardPauseEvent), NULL, NULL);
|
2014-12-15 19:35:35 +03:00
|
|
|
}
|
|
|
|
|
2013-02-04 20:05:24 +04:00
|
|
|
/* Event Queue */
|
2013-11-12 18:03:07 +04:00
|
|
|
static int input_message_free_input_class(wMessage* msg, int type)
|
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Input_SynchronizeEvent:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_KeyboardEvent:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_UnicodeKeyboardEvent:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_MouseEvent:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_ExtendedMouseEvent:
|
|
|
|
break;
|
|
|
|
|
2014-12-15 19:35:35 +03:00
|
|
|
case Input_FocusInEvent:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_KeyboardPauseEvent:
|
|
|
|
break;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
2013-02-04 20:05:24 +04:00
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
static int input_message_process_input_class(rdpInputProxy* proxy, wMessage* msg, int type)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !msg)
|
|
|
|
return -1;
|
|
|
|
|
2013-02-04 20:05:24 +04:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Input_SynchronizeEvent:
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->SynchronizeEvent, msg->context, (UINT32)(size_t) msg->wParam);
|
2013-02-04 20:05:24 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_KeyboardEvent:
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->KeyboardEvent, msg->context, (UINT16)(size_t) msg->wParam,
|
|
|
|
(UINT16)(size_t) msg->lParam);
|
2013-02-04 20:05:24 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_UnicodeKeyboardEvent:
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->UnicodeKeyboardEvent, msg->context, (UINT16)(size_t) msg->wParam,
|
|
|
|
(UINT16)(size_t) msg->lParam);
|
2013-02-04 20:05:24 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_MouseEvent:
|
|
|
|
{
|
|
|
|
UINT32 pos;
|
|
|
|
UINT16 x, y;
|
2017-02-20 20:31:58 +03:00
|
|
|
pos = (UINT32)(size_t) msg->lParam;
|
2013-02-04 20:05:24 +04:00
|
|
|
x = ((pos & 0xFFFF0000) >> 16);
|
|
|
|
y = (pos & 0x0000FFFF);
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->MouseEvent, msg->context, (UINT16)(size_t) msg->wParam, x, y);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_ExtendedMouseEvent:
|
|
|
|
{
|
|
|
|
UINT32 pos;
|
|
|
|
UINT16 x, y;
|
2017-02-20 20:31:58 +03:00
|
|
|
pos = (UINT32)(size_t) msg->lParam;
|
2013-02-04 20:05:24 +04:00
|
|
|
x = ((pos & 0xFFFF0000) >> 16);
|
|
|
|
y = (pos & 0x0000FFFF);
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->ExtendedMouseEvent, msg->context, (UINT16)(size_t) msg->wParam, x, y);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-12-15 19:35:35 +03:00
|
|
|
case Input_FocusInEvent:
|
2017-02-20 20:31:58 +03:00
|
|
|
IFCALL(proxy->FocusInEvent, msg->context, (UINT16)(size_t) msg->wParam);
|
2014-12-15 19:35:35 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Input_KeyboardPauseEvent:
|
|
|
|
IFCALL(proxy->KeyboardPauseEvent, msg->context);
|
|
|
|
break;
|
|
|
|
|
2013-02-04 20:05:24 +04:00
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
static int input_message_free_class(wMessage* msg, int msgClass, int msgType)
|
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
switch (msgClass)
|
|
|
|
{
|
|
|
|
case Input_Class:
|
|
|
|
status = input_message_free_input_class(msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status < 0)
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "Unknown event: class: %d type: %d", msgClass, msgType);
|
2013-11-12 18:03:07 +04:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static int input_message_process_class(rdpInputProxy* proxy, wMessage* msg, int msgClass,
|
|
|
|
int msgType)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
switch (msgClass)
|
|
|
|
{
|
|
|
|
case Input_Class:
|
|
|
|
status = input_message_process_input_class(proxy, msg, msgType);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
status = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status < 0)
|
2014-09-12 16:36:29 +04:00
|
|
|
WLog_ERR(TAG, "Unknown event: class: %d type: %d", msgClass, msgType);
|
2013-02-04 20:05:24 +04:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
int input_message_queue_free_message(wMessage* message)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
int msgClass;
|
|
|
|
int msgType;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!message)
|
|
|
|
return -1;
|
|
|
|
|
2013-11-12 18:03:07 +04:00
|
|
|
if (message->id == WMQ_QUIT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
msgClass = GetMessageClass(message->id);
|
|
|
|
msgType = GetMessageType(message->id);
|
|
|
|
status = input_message_free_class(message, msgClass, msgType);
|
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-02-04 23:56:54 +04:00
|
|
|
int input_message_queue_process_message(rdpInput* input, wMessage* message)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
int msgClass;
|
|
|
|
int msgType;
|
2013-02-04 23:56:54 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input || !message)
|
|
|
|
return -1;
|
|
|
|
|
2013-02-04 23:56:54 +04:00
|
|
|
if (message->id == WMQ_QUIT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
msgClass = GetMessageClass(message->id);
|
|
|
|
msgType = GetMessageType(message->id);
|
|
|
|
status = input_message_process_class(input->proxy, message, msgClass, msgType);
|
2013-11-12 18:03:07 +04:00
|
|
|
input_message_free_class(message, msgClass, msgType);
|
2013-02-04 23:56:54 +04:00
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int input_message_queue_process_pending_messages(rdpInput* input)
|
|
|
|
{
|
2013-02-10 02:13:53 +04:00
|
|
|
int count;
|
2013-02-04 23:56:54 +04:00
|
|
|
int status;
|
2013-02-04 20:05:24 +04:00
|
|
|
wMessage message;
|
|
|
|
wMessageQueue* queue;
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!input || !input->queue)
|
|
|
|
return -1;
|
|
|
|
|
2013-02-10 02:13:53 +04:00
|
|
|
count = 0;
|
2013-02-12 05:38:19 +04:00
|
|
|
status = 1;
|
2013-02-04 20:05:24 +04:00
|
|
|
queue = input->queue;
|
|
|
|
|
2013-02-10 02:13:53 +04:00
|
|
|
while (MessageQueue_Peek(queue, &message, TRUE))
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
2013-02-04 23:56:54 +04:00
|
|
|
status = input_message_queue_process_message(input, &message);
|
2013-02-04 20:05:24 +04:00
|
|
|
|
2013-02-04 23:56:54 +04:00
|
|
|
if (!status)
|
|
|
|
break;
|
2013-02-10 02:13:53 +04:00
|
|
|
|
|
|
|
count++;
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
2013-02-12 05:38:19 +04:00
|
|
|
return status;
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
static BOOL input_message_proxy_register(rdpInputProxy* proxy, rdpInput* input)
|
2013-02-04 20:05:24 +04:00
|
|
|
{
|
2017-02-20 20:31:58 +03:00
|
|
|
if (!proxy || !input)
|
|
|
|
return FALSE;
|
2013-02-04 20:05:24 +04:00
|
|
|
|
2017-02-20 20:31:58 +03:00
|
|
|
/* Input */
|
2013-02-04 20:05:24 +04:00
|
|
|
proxy->SynchronizeEvent = input->SynchronizeEvent;
|
|
|
|
proxy->KeyboardEvent = input->KeyboardEvent;
|
|
|
|
proxy->UnicodeKeyboardEvent = input->UnicodeKeyboardEvent;
|
|
|
|
proxy->MouseEvent = input->MouseEvent;
|
|
|
|
proxy->ExtendedMouseEvent = input->ExtendedMouseEvent;
|
2014-12-15 19:35:35 +03:00
|
|
|
proxy->FocusInEvent = input->FocusInEvent;
|
|
|
|
proxy->KeyboardPauseEvent = input->KeyboardPauseEvent;
|
2013-02-04 20:05:24 +04:00
|
|
|
input->SynchronizeEvent = input_message_SynchronizeEvent;
|
|
|
|
input->KeyboardEvent = input_message_KeyboardEvent;
|
|
|
|
input->UnicodeKeyboardEvent = input_message_UnicodeKeyboardEvent;
|
|
|
|
input->MouseEvent = input_message_MouseEvent;
|
|
|
|
input->ExtendedMouseEvent = input_message_ExtendedMouseEvent;
|
2014-12-15 19:35:35 +03:00
|
|
|
input->FocusInEvent = input_message_FocusInEvent;
|
|
|
|
input->KeyboardPauseEvent = input_message_KeyboardPauseEvent;
|
2017-02-20 20:31:58 +03:00
|
|
|
return TRUE;
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rdpInputProxy* input_message_proxy_new(rdpInput* input)
|
|
|
|
{
|
|
|
|
rdpInputProxy* proxy;
|
2015-06-16 16:42:07 +03:00
|
|
|
proxy = (rdpInputProxy*) calloc(1, sizeof(rdpInputProxy));
|
2013-02-04 20:05:24 +04:00
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
if (!proxy)
|
|
|
|
return NULL;
|
2013-02-04 20:05:24 +04:00
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
proxy->input = input;
|
2017-02-20 20:31:58 +03:00
|
|
|
|
|
|
|
if (!input_message_proxy_register(proxy, input))
|
|
|
|
{
|
|
|
|
free(proxy);
|
|
|
|
return NULL;
|
|
|
|
}
|
2013-02-04 20:05:24 +04:00
|
|
|
|
|
|
|
return proxy;
|
|
|
|
}
|
|
|
|
|
|
|
|
void input_message_proxy_free(rdpInputProxy* proxy)
|
|
|
|
{
|
2015-05-11 10:07:39 +03:00
|
|
|
free(proxy);
|
2013-02-04 20:05:24 +04:00
|
|
|
}
|