Fixed MessageQueue and callers
This commit is contained in:
parent
4586450e27
commit
12f873f1f9
@ -901,8 +901,8 @@ static void cliprdr_virtual_channel_event_disconnected(cliprdrPlugin* cliprdr)
|
||||
{
|
||||
UINT rc;
|
||||
|
||||
MessageQueue_PostQuit(cliprdr->queue, 0);
|
||||
WaitForSingleObject(cliprdr->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(cliprdr->queue, 0))
|
||||
WaitForSingleObject(cliprdr->thread, INFINITE);
|
||||
|
||||
MessageQueue_Free(cliprdr->queue);
|
||||
CloseHandle(cliprdr->thread);
|
||||
|
@ -1097,8 +1097,8 @@ static void drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc)
|
||||
{
|
||||
UINT status;
|
||||
|
||||
MessageQueue_PostQuit(drdynvc->queue, 0);
|
||||
WaitForSingleObject(drdynvc->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(drdynvc->queue, 0))
|
||||
WaitForSingleObject(drdynvc->thread, INFINITE);
|
||||
|
||||
MessageQueue_Free(drdynvc->queue);
|
||||
CloseHandle(drdynvc->thread);
|
||||
|
@ -614,8 +614,8 @@ static void drive_free(DEVICE* device)
|
||||
{
|
||||
DRIVE_DEVICE* drive = (DRIVE_DEVICE*) device;
|
||||
|
||||
MessageQueue_PostQuit(drive->IrpQueue, 0);
|
||||
WaitForSingleObject(drive->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(drive->IrpQueue, 0))
|
||||
WaitForSingleObject(drive->thread, INFINITE);
|
||||
|
||||
CloseHandle(drive->thread);
|
||||
|
||||
|
@ -884,8 +884,9 @@ static void encomsp_virtual_channel_event_connected(encomspPlugin* encomsp, LPVO
|
||||
static void encomsp_virtual_channel_event_disconnected(encomspPlugin* encomsp)
|
||||
{
|
||||
UINT rc;
|
||||
MessageQueue_PostQuit(encomsp->queue, 0);
|
||||
WaitForSingleObject(encomsp->thread, INFINITE);
|
||||
|
||||
if (MessageQueue_PostQuit(encomsp->queue, 0))
|
||||
WaitForSingleObject(encomsp->thread, INFINITE);
|
||||
|
||||
MessageQueue_Free(encomsp->queue);
|
||||
CloseHandle(encomsp->thread);
|
||||
|
@ -272,8 +272,8 @@ static void parallel_free(DEVICE* device)
|
||||
{
|
||||
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;
|
||||
|
||||
MessageQueue_PostQuit(parallel->queue, 0);
|
||||
WaitForSingleObject(parallel->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(parallel->queue, 0))
|
||||
WaitForSingleObject(parallel->thread, INFINITE);
|
||||
CloseHandle(parallel->thread);
|
||||
|
||||
Stream_Free(parallel->device.data, TRUE);
|
||||
|
@ -505,8 +505,8 @@ static void rail_virtual_channel_event_connected(railPlugin* rail, LPVOID pData,
|
||||
static void rail_virtual_channel_event_disconnected(railPlugin* rail)
|
||||
{
|
||||
UINT rc;
|
||||
MessageQueue_PostQuit(rail->queue, 0);
|
||||
WaitForSingleObject(rail->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(rail->queue, 0))
|
||||
WaitForSingleObject(rail->thread, INFINITE);
|
||||
|
||||
MessageQueue_Free(rail->queue);
|
||||
CloseHandle(rail->thread);
|
||||
|
@ -1013,8 +1013,8 @@ static void rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
|
||||
{
|
||||
UINT rc;
|
||||
|
||||
MessageQueue_PostQuit(rdpdr->queue, 0);
|
||||
WaitForSingleObject(rdpdr->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(rdpdr->queue, 0))
|
||||
WaitForSingleObject(rdpdr->thread, INFINITE);
|
||||
|
||||
MessageQueue_Free(rdpdr->queue);
|
||||
CloseHandle(rdpdr->thread);
|
||||
|
@ -745,8 +745,8 @@ static void remdesk_virtual_channel_event_disconnected(remdeskPlugin* remdesk)
|
||||
{
|
||||
UINT rc;
|
||||
|
||||
MessageQueue_PostQuit(remdesk->queue, 0);
|
||||
WaitForSingleObject(remdesk->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(remdesk->queue, 0))
|
||||
WaitForSingleObject(remdesk->thread, INFINITE);
|
||||
|
||||
MessageQueue_Free(remdesk->queue);
|
||||
CloseHandle(remdesk->thread);
|
||||
|
@ -111,8 +111,8 @@ void smartcard_context_free(SMARTCARD_CONTEXT* pContext)
|
||||
/* cancel blocking calls like SCardGetStatusChange */
|
||||
SCardCancel(pContext->hContext);
|
||||
|
||||
MessageQueue_PostQuit(pContext->IrpQueue, 0);
|
||||
WaitForSingleObject(pContext->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(pContext->IrpQueue, 0))
|
||||
WaitForSingleObject(pContext->thread, INFINITE);
|
||||
CloseHandle(pContext->thread);
|
||||
|
||||
MessageQueue_Free(pContext->IrpQueue);
|
||||
@ -126,8 +126,8 @@ static void smartcard_free(DEVICE* device)
|
||||
|
||||
if (smartcard->IrpQueue)
|
||||
{
|
||||
MessageQueue_PostQuit(smartcard->IrpQueue, 0);
|
||||
WaitForSingleObject(smartcard->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(smartcard->IrpQueue, 0))
|
||||
WaitForSingleObject(smartcard->thread, INFINITE);
|
||||
|
||||
MessageQueue_Free(smartcard->IrpQueue);
|
||||
smartcard->IrpQueue = NULL;
|
||||
|
@ -607,8 +607,8 @@ disconnect:
|
||||
wMessageQueue* input_queue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
if (input_queue)
|
||||
{
|
||||
MessageQueue_PostQuit(input_queue, 0);
|
||||
WaitForSingleObject(input_thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(input_queue, 0))
|
||||
WaitForSingleObject(input_thread, INFINITE);
|
||||
}
|
||||
CloseHandle(input_thread);
|
||||
}
|
||||
|
@ -779,8 +779,8 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam)
|
||||
{
|
||||
wMessageQueue* input_queue;
|
||||
input_queue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
MessageQueue_PostQuit(input_queue, 0);
|
||||
WaitForSingleObject(input_thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(input_queue, 0))
|
||||
WaitForSingleObject(input_thread, INFINITE);
|
||||
CloseHandle(input_thread);
|
||||
}
|
||||
|
||||
|
@ -1532,8 +1532,8 @@ void* xf_client_thread(void* param)
|
||||
if (settings->AsyncInput)
|
||||
{
|
||||
wMessageQueue* inputQueue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
MessageQueue_PostQuit(inputQueue, 0);
|
||||
WaitForSingleObject(inputThread, INFINITE);
|
||||
if (MessageQueue_PostQuit(inputQueue, 0))
|
||||
WaitForSingleObject(inputThread, INFINITE);
|
||||
CloseHandle(inputThread);
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,8 @@ UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG
|
||||
pChannelOpenEvent->UserData = pUserData;
|
||||
pChannelOpenEvent->pChannelOpenData = pChannelOpenData;
|
||||
|
||||
MessageQueue_Post(channels->queue, (void*) channels, 0, (void*) pChannelOpenEvent, NULL);
|
||||
if (!MessageQueue_Post(channels->queue, (void*) channels, 0, (void*) pChannelOpenEvent, NULL))
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
@ -41,17 +41,14 @@
|
||||
|
||||
static BOOL update_message_BeginPaint(rdpContext* context)
|
||||
{
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, BeginPaint), NULL, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_EndPaint(rdpContext* context)
|
||||
{
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, EndPaint), NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SetBounds(rdpContext* context, rdpBounds* bounds)
|
||||
@ -66,23 +63,20 @@ static BOOL update_message_SetBounds(rdpContext* context, rdpBounds* bounds)
|
||||
CopyMemory(wParam, bounds, sizeof(rdpBounds));
|
||||
}
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, SetBounds), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_Synchronize(rdpContext* context)
|
||||
{
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, Synchronize), NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DesktopResize(rdpContext* context)
|
||||
{
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, DesktopResize), NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_BitmapUpdate(rdpContext* context, BITMAP_UPDATE* bitmap)
|
||||
@ -125,10 +119,9 @@ static BOOL update_message_BitmapUpdate(rdpContext* context, BITMAP_UPDATE* bitm
|
||||
wParam->rectangles[index].bitmapLength);
|
||||
#endif
|
||||
}
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, BitmapUpdate), (void*) wParam, NULL);
|
||||
|
||||
return TRUE;
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, BitmapUpdate), (void*) wParam, NULL);
|
||||
}
|
||||
|
||||
static BOOL update_message_Palette(rdpContext* context, PALETTE_UPDATE* palette)
|
||||
@ -140,9 +133,8 @@ static BOOL update_message_Palette(rdpContext* context, PALETTE_UPDATE* palette)
|
||||
return FALSE;
|
||||
CopyMemory(wParam, palette, sizeof(PALETTE_UPDATE));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, Palette), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_PlaySound(rdpContext* context, PLAY_SOUND_UPDATE* playSound)
|
||||
@ -154,16 +146,14 @@ static BOOL update_message_PlaySound(rdpContext* context, PLAY_SOUND_UPDATE* pla
|
||||
return FALSE;
|
||||
CopyMemory(wParam, playSound, sizeof(PLAY_SOUND_UPDATE));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, PlaySound), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SetKeyboardIndicators(rdpContext* context, UINT16 led_flags)
|
||||
{
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, SetKeyboardIndicators), (void*)(size_t)led_flags, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_RefreshRect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
|
||||
@ -175,9 +165,8 @@ static BOOL update_message_RefreshRect(rdpContext* context, BYTE count, RECTANGL
|
||||
return FALSE;
|
||||
CopyMemory(lParam, areas, sizeof(RECTANGLE_16) * count);
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, RefreshRect), (void*) (size_t) count, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SuppressOutput(rdpContext* context, BYTE allow, RECTANGLE_16* area)
|
||||
@ -192,9 +181,8 @@ static BOOL update_message_SuppressOutput(rdpContext* context, BYTE allow, RECTA
|
||||
CopyMemory(lParam, area, sizeof(RECTANGLE_16));
|
||||
}
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, SuppressOutput), (void*) (size_t) allow, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SurfaceCommand(rdpContext* context, wStream* s)
|
||||
@ -215,9 +203,8 @@ static BOOL update_message_SurfaceCommand(rdpContext* context, wStream* s)
|
||||
|
||||
wParam->pointer = wParam->buffer;
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, SurfaceCommand), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SurfaceBits(rdpContext* context, SURFACE_BITS_COMMAND* surfaceBitsCommand)
|
||||
@ -241,9 +228,8 @@ static BOOL update_message_SurfaceBits(rdpContext* context, SURFACE_BITS_COMMAND
|
||||
CopyMemory(wParam->bitmapData, surfaceBitsCommand->bitmapData, wParam->bitmapDataLength);
|
||||
#endif
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, SurfaceBits), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SurfaceFrameMarker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
|
||||
@ -255,18 +241,14 @@ static BOOL update_message_SurfaceFrameMarker(rdpContext* context, SURFACE_FRAME
|
||||
return FALSE;
|
||||
CopyMemory(wParam, surfaceFrameMarker, sizeof(SURFACE_FRAME_MARKER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, SurfaceFrameMarker), (void*) wParam, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SurfaceFrameAcknowledge(rdpContext* context, UINT32 frameId)
|
||||
{
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(Update, SurfaceFrameAcknowledge), (void*) (size_t) frameId, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Primary Update */
|
||||
@ -280,9 +262,8 @@ static BOOL update_message_DstBlt(rdpContext* context, DSTBLT_ORDER* dstBlt)
|
||||
return FALSE;
|
||||
CopyMemory(wParam, dstBlt, sizeof(DSTBLT_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, DstBlt), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_PatBlt(rdpContext* context, PATBLT_ORDER* patBlt)
|
||||
@ -296,9 +277,8 @@ static BOOL update_message_PatBlt(rdpContext* context, PATBLT_ORDER* patBlt)
|
||||
|
||||
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, PatBlt), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_ScrBlt(rdpContext* context, SCRBLT_ORDER* scrBlt)
|
||||
@ -310,10 +290,8 @@ static BOOL update_message_ScrBlt(rdpContext* context, SCRBLT_ORDER* scrBlt)
|
||||
return FALSE;
|
||||
CopyMemory(wParam, scrBlt, sizeof(SCRBLT_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, ScrBlt), (void*) wParam, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_OpaqueRect(rdpContext* context, OPAQUE_RECT_ORDER* opaqueRect)
|
||||
@ -325,9 +303,8 @@ static BOOL update_message_OpaqueRect(rdpContext* context, OPAQUE_RECT_ORDER* op
|
||||
return FALSE;
|
||||
CopyMemory(wParam, opaqueRect, sizeof(OPAQUE_RECT_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, OpaqueRect), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DrawNineGrid(rdpContext* context, DRAW_NINE_GRID_ORDER* drawNineGrid)
|
||||
@ -339,9 +316,8 @@ static BOOL update_message_DrawNineGrid(rdpContext* context, DRAW_NINE_GRID_ORDE
|
||||
return FALSE;
|
||||
CopyMemory(wParam, drawNineGrid, sizeof(DRAW_NINE_GRID_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, DrawNineGrid), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_MultiDstBlt(rdpContext* context, MULTI_DSTBLT_ORDER* multiDstBlt)
|
||||
@ -353,9 +329,8 @@ static BOOL update_message_MultiDstBlt(rdpContext* context, MULTI_DSTBLT_ORDER*
|
||||
return FALSE;
|
||||
CopyMemory(wParam, multiDstBlt, sizeof(MULTI_DSTBLT_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, MultiDstBlt), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_MultiPatBlt(rdpContext* context, MULTI_PATBLT_ORDER* multiPatBlt)
|
||||
@ -369,9 +344,8 @@ static BOOL update_message_MultiPatBlt(rdpContext* context, MULTI_PATBLT_ORDER*
|
||||
|
||||
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, MultiPatBlt), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_MultiScrBlt(rdpContext* context, MULTI_SCRBLT_ORDER* multiScrBlt)
|
||||
@ -383,9 +357,8 @@ static BOOL update_message_MultiScrBlt(rdpContext* context, MULTI_SCRBLT_ORDER*
|
||||
return FALSE;
|
||||
CopyMemory(wParam, multiScrBlt, sizeof(MULTI_SCRBLT_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, MultiScrBlt), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_MultiOpaqueRect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multiOpaqueRect)
|
||||
@ -397,9 +370,8 @@ static BOOL update_message_MultiOpaqueRect(rdpContext* context, MULTI_OPAQUE_REC
|
||||
return FALSE;
|
||||
CopyMemory(wParam, multiOpaqueRect, sizeof(MULTI_OPAQUE_RECT_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, MultiOpaqueRect), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_MultiDrawNineGrid(rdpContext* context, MULTI_DRAW_NINE_GRID_ORDER* multiDrawNineGrid)
|
||||
@ -413,9 +385,8 @@ static BOOL update_message_MultiDrawNineGrid(rdpContext* context, MULTI_DRAW_NIN
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, MultiDrawNineGrid), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_LineTo(rdpContext* context, LINE_TO_ORDER* lineTo)
|
||||
@ -427,9 +398,8 @@ static BOOL update_message_LineTo(rdpContext* context, LINE_TO_ORDER* lineTo)
|
||||
return FALSE;
|
||||
CopyMemory(wParam, lineTo, sizeof(LINE_TO_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, LineTo), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_Polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
||||
@ -449,9 +419,8 @@ static BOOL update_message_Polyline(rdpContext* context, POLYLINE_ORDER* polylin
|
||||
}
|
||||
CopyMemory(wParam->points, polyline->points, sizeof(DELTA_POINT) * wParam->numDeltaEntries);
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, Polyline), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_MemBlt(rdpContext* context, MEMBLT_ORDER* memBlt)
|
||||
@ -463,10 +432,8 @@ static BOOL update_message_MemBlt(rdpContext* context, MEMBLT_ORDER* memBlt)
|
||||
return FALSE;
|
||||
CopyMemory(wParam, memBlt, sizeof(MEMBLT_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, MemBlt), (void*) wParam, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_Mem3Blt(rdpContext* context, MEM3BLT_ORDER* mem3Blt)
|
||||
@ -480,9 +447,8 @@ static BOOL update_message_Mem3Blt(rdpContext* context, MEM3BLT_ORDER* mem3Blt)
|
||||
|
||||
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, Mem3Blt), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SaveBitmap(rdpContext* context, SAVE_BITMAP_ORDER* saveBitmap)
|
||||
@ -494,9 +460,8 @@ static BOOL update_message_SaveBitmap(rdpContext* context, SAVE_BITMAP_ORDER* sa
|
||||
return FALSE;
|
||||
CopyMemory(wParam, saveBitmap, sizeof(SAVE_BITMAP_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, SaveBitmap), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_GlyphIndex(rdpContext* context, GLYPH_INDEX_ORDER* glyphIndex)
|
||||
@ -510,9 +475,8 @@ static BOOL update_message_GlyphIndex(rdpContext* context, GLYPH_INDEX_ORDER* gl
|
||||
|
||||
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, GlyphIndex), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_FastIndex(rdpContext* context, FAST_INDEX_ORDER* fastIndex)
|
||||
@ -524,9 +488,8 @@ static BOOL update_message_FastIndex(rdpContext* context, FAST_INDEX_ORDER* fast
|
||||
return FALSE;
|
||||
CopyMemory(wParam, fastIndex, sizeof(FAST_INDEX_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, FastIndex), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_FastGlyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph)
|
||||
@ -553,9 +516,8 @@ static BOOL update_message_FastGlyph(rdpContext* context, FAST_GLYPH_ORDER* fast
|
||||
wParam->glyphData.aj = NULL;
|
||||
}
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, FastGlyph), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_PolygonSC(rdpContext* context, POLYGON_SC_ORDER* polygonSC)
|
||||
@ -575,9 +537,8 @@ static BOOL update_message_PolygonSC(rdpContext* context, POLYGON_SC_ORDER* poly
|
||||
}
|
||||
CopyMemory(wParam->points, polygonSC, sizeof(DELTA_POINT) * wParam->numPoints);
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, PolygonSC), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_PolygonCB(rdpContext* context, POLYGON_CB_ORDER* polygonCB)
|
||||
@ -599,9 +560,8 @@ static BOOL update_message_PolygonCB(rdpContext* context, POLYGON_CB_ORDER* poly
|
||||
|
||||
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, PolygonCB), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_EllipseSC(rdpContext* context, ELLIPSE_SC_ORDER* ellipseSC)
|
||||
@ -613,9 +573,8 @@ static BOOL update_message_EllipseSC(rdpContext* context, ELLIPSE_SC_ORDER* elli
|
||||
return FALSE;
|
||||
CopyMemory(wParam, ellipseSC, sizeof(ELLIPSE_SC_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, EllipseSC), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_EllipseCB(rdpContext* context, ELLIPSE_CB_ORDER* ellipseCB)
|
||||
@ -629,9 +588,8 @@ static BOOL update_message_EllipseCB(rdpContext* context, ELLIPSE_CB_ORDER* elli
|
||||
|
||||
wParam->brush.data = (BYTE*) wParam->brush.p8x8;
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PrimaryUpdate, EllipseCB), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Secondary Update */
|
||||
@ -653,9 +611,8 @@ static BOOL update_message_CacheBitmap(rdpContext* context, CACHE_BITMAP_ORDER*
|
||||
}
|
||||
CopyMemory(wParam->bitmapDataStream, cacheBitmapOrder, wParam->bitmapLength);
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(SecondaryUpdate, CacheBitmap), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_CacheBitmapV2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cacheBitmapV2Order)
|
||||
@ -675,9 +632,8 @@ static BOOL update_message_CacheBitmapV2(rdpContext* context, CACHE_BITMAP_V2_OR
|
||||
}
|
||||
CopyMemory(wParam->bitmapDataStream, cacheBitmapV2Order->bitmapDataStream, wParam->bitmapLength);
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(SecondaryUpdate, CacheBitmapV2), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_CacheBitmapV3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cacheBitmapV3Order)
|
||||
@ -697,9 +653,8 @@ static BOOL update_message_CacheBitmapV3(rdpContext* context, CACHE_BITMAP_V3_OR
|
||||
}
|
||||
CopyMemory(wParam->bitmapData.data, cacheBitmapV3Order->bitmapData.data, wParam->bitmapData.length);
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(SecondaryUpdate, CacheBitmapV3), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_CacheColorTable(rdpContext* context, CACHE_COLOR_TABLE_ORDER* cacheColorTableOrder)
|
||||
@ -711,9 +666,8 @@ static BOOL update_message_CacheColorTable(rdpContext* context, CACHE_COLOR_TABL
|
||||
return FALSE;
|
||||
CopyMemory(wParam, cacheColorTableOrder, sizeof(CACHE_COLOR_TABLE_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(SecondaryUpdate, CacheColorTable), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_CacheGlyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyphOrder)
|
||||
@ -725,9 +679,8 @@ static BOOL update_message_CacheGlyph(rdpContext* context, CACHE_GLYPH_ORDER* ca
|
||||
return FALSE;
|
||||
CopyMemory(wParam, cacheGlyphOrder, sizeof(CACHE_GLYPH_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(SecondaryUpdate, CacheGlyph), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_CacheGlyphV2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cacheGlyphV2Order)
|
||||
@ -739,9 +692,8 @@ static BOOL update_message_CacheGlyphV2(rdpContext* context, CACHE_GLYPH_V2_ORDE
|
||||
return FALSE;
|
||||
CopyMemory(wParam, cacheGlyphV2Order, sizeof(CACHE_GLYPH_V2_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(SecondaryUpdate, CacheGlyphV2), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_CacheBrush(rdpContext* context, CACHE_BRUSH_ORDER* cacheBrushOrder)
|
||||
@ -753,9 +705,8 @@ static BOOL update_message_CacheBrush(rdpContext* context, CACHE_BRUSH_ORDER* ca
|
||||
return FALSE;
|
||||
CopyMemory(wParam, cacheBrushOrder, sizeof(CACHE_BRUSH_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(SecondaryUpdate, CacheBrush), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Alternate Secondary Update */
|
||||
@ -779,9 +730,8 @@ static BOOL update_message_CreateOffscreenBitmap(rdpContext* context, CREATE_OFF
|
||||
}
|
||||
CopyMemory(wParam->deleteList.indices, createOffscreenBitmap->deleteList.indices, wParam->deleteList.cIndices);
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, CreateOffscreenBitmap), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_SwitchSurface(rdpContext* context, SWITCH_SURFACE_ORDER* switchSurface)
|
||||
@ -793,9 +743,8 @@ static BOOL update_message_SwitchSurface(rdpContext* context, SWITCH_SURFACE_ORD
|
||||
return FALSE;
|
||||
CopyMemory(wParam, switchSurface, sizeof(SWITCH_SURFACE_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, SwitchSurface), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_CreateNineGridBitmap(rdpContext* context, CREATE_NINE_GRID_BITMAP_ORDER* createNineGridBitmap)
|
||||
@ -807,9 +756,8 @@ static BOOL update_message_CreateNineGridBitmap(rdpContext* context, CREATE_NINE
|
||||
return FALSE;
|
||||
CopyMemory(wParam, createNineGridBitmap, sizeof(CREATE_NINE_GRID_BITMAP_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, CreateNineGridBitmap), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_FrameMarker(rdpContext* context, FRAME_MARKER_ORDER* frameMarker)
|
||||
@ -821,9 +769,8 @@ static BOOL update_message_FrameMarker(rdpContext* context, FRAME_MARKER_ORDER*
|
||||
return FALSE;
|
||||
CopyMemory(wParam, frameMarker, sizeof(FRAME_MARKER_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, FrameMarker), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_StreamBitmapFirst(rdpContext* context, STREAM_BITMAP_FIRST_ORDER* streamBitmapFirst)
|
||||
@ -837,9 +784,8 @@ static BOOL update_message_StreamBitmapFirst(rdpContext* context, STREAM_BITMAP_
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, StreamBitmapFirst), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_StreamBitmapNext(rdpContext* context, STREAM_BITMAP_NEXT_ORDER* streamBitmapNext)
|
||||
@ -853,9 +799,8 @@ static BOOL update_message_StreamBitmapNext(rdpContext* context, STREAM_BITMAP_N
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, StreamBitmapNext), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DrawGdiPlusFirst(rdpContext* context, DRAW_GDIPLUS_FIRST_ORDER* drawGdiPlusFirst)
|
||||
@ -869,9 +814,8 @@ static BOOL update_message_DrawGdiPlusFirst(rdpContext* context, DRAW_GDIPLUS_FI
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, DrawGdiPlusFirst), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DrawGdiPlusNext(rdpContext* context, DRAW_GDIPLUS_NEXT_ORDER* drawGdiPlusNext)
|
||||
@ -885,9 +829,8 @@ static BOOL update_message_DrawGdiPlusNext(rdpContext* context, DRAW_GDIPLUS_NEX
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, DrawGdiPlusNext), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DrawGdiPlusEnd(rdpContext* context, DRAW_GDIPLUS_END_ORDER* drawGdiPlusEnd)
|
||||
@ -901,9 +844,8 @@ static BOOL update_message_DrawGdiPlusEnd(rdpContext* context, DRAW_GDIPLUS_END_
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, DrawGdiPlusEnd), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DrawGdiPlusCacheFirst(rdpContext* context, DRAW_GDIPLUS_CACHE_FIRST_ORDER* drawGdiPlusCacheFirst)
|
||||
@ -917,9 +859,8 @@ static BOOL update_message_DrawGdiPlusCacheFirst(rdpContext* context, DRAW_GDIPL
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, DrawGdiPlusCacheFirst), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DrawGdiPlusCacheNext(rdpContext* context, DRAW_GDIPLUS_CACHE_NEXT_ORDER* drawGdiPlusCacheNext)
|
||||
@ -933,9 +874,8 @@ static BOOL update_message_DrawGdiPlusCacheNext(rdpContext* context, DRAW_GDIPLU
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, DrawGdiPlusCacheNext), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_DrawGdiPlusCacheEnd(rdpContext* context, DRAW_GDIPLUS_CACHE_END_ORDER* drawGdiPlusCacheEnd)
|
||||
@ -949,9 +889,8 @@ static BOOL update_message_DrawGdiPlusCacheEnd(rdpContext* context, DRAW_GDIPLUS
|
||||
|
||||
/* TODO: complete copy */
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(AltSecUpdate, DrawGdiPlusCacheEnd), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Window Update */
|
||||
@ -974,9 +913,8 @@ static BOOL update_message_WindowCreate(rdpContext* context, WINDOW_ORDER_INFO*
|
||||
}
|
||||
CopyMemory(lParam, windowState, sizeof(WINDOW_STATE_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, WindowCreate), (void*) wParam, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_WindowUpdate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
|
||||
@ -997,9 +935,8 @@ static BOOL update_message_WindowUpdate(rdpContext* context, WINDOW_ORDER_INFO*
|
||||
}
|
||||
CopyMemory(lParam, windowState, sizeof(WINDOW_STATE_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, WindowUpdate), (void*) wParam, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_WindowIcon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* windowIcon)
|
||||
@ -1046,9 +983,8 @@ static BOOL update_message_WindowIcon(rdpContext* context, WINDOW_ORDER_INFO* or
|
||||
CopyMemory(lParam->iconInfo->colorTable, windowIcon->iconInfo->colorTable, windowIcon->iconInfo->cbColorTable);
|
||||
}
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, WindowIcon), (void*) wParam, (void*) lParam);
|
||||
return TRUE;
|
||||
|
||||
out_fail:
|
||||
free(lParam->iconInfo->bitsColor);
|
||||
@ -1078,9 +1014,8 @@ static BOOL update_message_WindowCachedIcon(rdpContext* context, WINDOW_ORDER_IN
|
||||
}
|
||||
CopyMemory(lParam, windowCachedIcon, sizeof(WINDOW_CACHED_ICON_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, WindowCachedIcon), (void*) wParam, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_WindowDelete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
||||
@ -1092,9 +1027,8 @@ static BOOL update_message_WindowDelete(rdpContext* context, WINDOW_ORDER_INFO*
|
||||
return FALSE;
|
||||
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, WindowDelete), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_NotifyIconCreate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
|
||||
@ -1115,9 +1049,8 @@ static BOOL update_message_NotifyIconCreate(rdpContext* context, WINDOW_ORDER_IN
|
||||
}
|
||||
CopyMemory(lParam, notifyIconState, sizeof(NOTIFY_ICON_STATE_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, NotifyIconCreate), (void*) wParam, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_NotifyIconUpdate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
|
||||
@ -1138,9 +1071,8 @@ static BOOL update_message_NotifyIconUpdate(rdpContext* context, WINDOW_ORDER_IN
|
||||
}
|
||||
CopyMemory(lParam, notifyIconState, sizeof(NOTIFY_ICON_STATE_ORDER));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, NotifyIconUpdate), (void*) wParam, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_NotifyIconDelete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
||||
@ -1152,9 +1084,8 @@ static BOOL update_message_NotifyIconDelete(rdpContext* context, WINDOW_ORDER_IN
|
||||
return FALSE;
|
||||
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, NotifyIconDelete), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_MonitoredDesktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop)
|
||||
@ -1183,9 +1114,8 @@ static BOOL update_message_MonitoredDesktop(rdpContext* context, WINDOW_ORDER_IN
|
||||
CopyMemory(lParam->windowIds, monitoredDesktop->windowIds, lParam->numWindowIds);
|
||||
}
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, MonitoredDesktop), (void*) wParam, (void*) lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_NonMonitoredDesktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
||||
@ -1197,9 +1127,8 @@ static BOOL update_message_NonMonitoredDesktop(rdpContext* context, WINDOW_ORDER
|
||||
return FALSE;
|
||||
CopyMemory(wParam, orderInfo, sizeof(WINDOW_ORDER_INFO));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(WindowUpdate, NonMonitoredDesktop), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Pointer Update */
|
||||
@ -1213,9 +1142,8 @@ static BOOL update_message_PointerPosition(rdpContext* context, POINTER_POSITION
|
||||
return FALSE;
|
||||
CopyMemory(wParam, pointerPosition, sizeof(POINTER_POSITION_UPDATE));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PointerUpdate, PointerPosition), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_PointerSystem(rdpContext* context, POINTER_SYSTEM_UPDATE* pointerSystem)
|
||||
@ -1227,9 +1155,8 @@ static BOOL update_message_PointerSystem(rdpContext* context, POINTER_SYSTEM_UPD
|
||||
return FALSE;
|
||||
CopyMemory(wParam, pointerSystem, sizeof(POINTER_SYSTEM_UPDATE));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PointerUpdate, PointerSystem), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_message_PointerColor(rdpContext* context, POINTER_COLOR_UPDATE* pointerColor)
|
||||
@ -1259,9 +1186,8 @@ static BOOL update_message_PointerColor(rdpContext* context, POINTER_COLOR_UPDAT
|
||||
CopyMemory(wParam->xorMaskData, pointerColor->xorMaskData, wParam->lengthXorMask);
|
||||
}
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PointerUpdate, PointerColor), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
|
||||
out_fail:
|
||||
free(wParam->andMaskData);
|
||||
@ -1297,9 +1223,8 @@ static BOOL update_message_PointerNew(rdpContext* context, POINTER_NEW_UPDATE* p
|
||||
CopyMemory(wParam->colorPtrAttr.xorMaskData, pointerNew->colorPtrAttr.xorMaskData, wParam->colorPtrAttr.lengthXorMask);
|
||||
}
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PointerUpdate, PointerNew), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
|
||||
out_fail:
|
||||
free(wParam->colorPtrAttr.andMaskData);
|
||||
@ -1317,9 +1242,8 @@ static BOOL update_message_PointerCached(rdpContext* context, POINTER_CACHED_UPD
|
||||
return FALSE;
|
||||
CopyMemory(wParam, pointerCached, sizeof(POINTER_CACHED_UPDATE));
|
||||
|
||||
MessageQueue_Post(context->update->queue, (void*) context,
|
||||
return MessageQueue_Post(context->update->queue, (void*) context,
|
||||
MakeMessageId(PointerUpdate, PointerCached), (void*) wParam, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Message Queue */
|
||||
@ -2563,8 +2487,8 @@ void update_message_proxy_free(rdpUpdateProxy* message)
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
MessageQueue_PostQuit(message->update->queue, 0);
|
||||
WaitForSingleObject(message->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(message->update->queue, 0))
|
||||
WaitForSingleObject(message->thread, INFINITE);
|
||||
CloseHandle(message->thread);
|
||||
free(message);
|
||||
}
|
||||
@ -2574,55 +2498,48 @@ void update_message_proxy_free(rdpUpdateProxy* message)
|
||||
|
||||
static BOOL input_message_SynchronizeEvent(rdpInput* input, UINT32 flags)
|
||||
{
|
||||
MessageQueue_Post(input->queue, (void*) input,
|
||||
return MessageQueue_Post(input->queue, (void*) input,
|
||||
MakeMessageId(Input, SynchronizeEvent), (void*) (size_t) flags, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL input_message_KeyboardEvent(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
MessageQueue_Post(input->queue, (void*) input,
|
||||
return MessageQueue_Post(input->queue, (void*) input,
|
||||
MakeMessageId(Input, KeyboardEvent), (void*) (size_t) flags, (void*) (size_t) code);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL input_message_UnicodeKeyboardEvent(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
MessageQueue_Post(input->queue, (void*) input,
|
||||
return MessageQueue_Post(input->queue, (void*) input,
|
||||
MakeMessageId(Input, UnicodeKeyboardEvent), (void*) (size_t) flags, (void*) (size_t) code);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL input_message_MouseEvent(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
UINT32 pos = (x << 16) | y;
|
||||
|
||||
MessageQueue_Post(input->queue, (void*) input,
|
||||
return MessageQueue_Post(input->queue, (void*) input,
|
||||
MakeMessageId(Input, MouseEvent), (void*) (size_t) flags, (void*) (size_t) pos);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL input_message_ExtendedMouseEvent(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
UINT32 pos = (x << 16) | y;
|
||||
|
||||
MessageQueue_Post(input->queue, (void*) input,
|
||||
return MessageQueue_Post(input->queue, (void*) input,
|
||||
MakeMessageId(Input, ExtendedMouseEvent), (void*) (size_t) flags, (void*) (size_t) pos);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL input_message_FocusInEvent(rdpInput* input, UINT16 toggleStates)
|
||||
{
|
||||
MessageQueue_Post(input->queue, (void*) input,
|
||||
return MessageQueue_Post(input->queue, (void*) input,
|
||||
MakeMessageId(Input, FocusInEvent), (void*) (size_t) toggleStates, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL input_message_KeyboardPauseEvent(rdpInput* input)
|
||||
{
|
||||
MessageQueue_Post(input->queue, (void*) input,
|
||||
return MessageQueue_Post(input->queue, (void*) input,
|
||||
MakeMessageId(Input, KeyboardPauseEvent), NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Event Queue */
|
||||
|
@ -85,7 +85,7 @@ static rdpPeerChannel* wts_get_dvc_channel_by_id(WTSVirtualChannelManager* vcm,
|
||||
return found ? channel : NULL;
|
||||
}
|
||||
|
||||
static void wts_queue_receive_data(rdpPeerChannel* channel, const BYTE* Buffer, UINT32 Length)
|
||||
static BOOL wts_queue_receive_data(rdpPeerChannel* channel, const BYTE* Buffer, UINT32 Length)
|
||||
{
|
||||
BYTE* buffer;
|
||||
wtsChannelMessage* messageCtx;
|
||||
@ -97,10 +97,10 @@ static void wts_queue_receive_data(rdpPeerChannel* channel, const BYTE* Buffer,
|
||||
buffer = (BYTE*) (messageCtx + 1);
|
||||
CopyMemory(buffer, Buffer, Length);
|
||||
|
||||
MessageQueue_Post(channel->queue, messageCtx, 0, NULL, NULL);
|
||||
return MessageQueue_Post(channel->queue, messageCtx, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
static void wts_queue_send_item(rdpPeerChannel* channel, BYTE* Buffer, UINT32 Length)
|
||||
static BOOL wts_queue_send_item(rdpPeerChannel* channel, BYTE* Buffer, UINT32 Length)
|
||||
{
|
||||
BYTE* buffer;
|
||||
UINT32 length;
|
||||
@ -110,7 +110,7 @@ static void wts_queue_send_item(rdpPeerChannel* channel, BYTE* Buffer, UINT32 Le
|
||||
length = Length;
|
||||
channelId = channel->channelId;
|
||||
|
||||
MessageQueue_Post(channel->vcm->queue, (void*) (UINT_PTR) channelId, 0, (void*) buffer, (void*) (UINT_PTR) length);
|
||||
return MessageQueue_Post(channel->vcm->queue, (void*) (UINT_PTR) channelId, 0, (void*) buffer, (void*) (UINT_PTR) length);
|
||||
}
|
||||
|
||||
static int wts_read_variable_uint(wStream* s, int cbLen, UINT32* val)
|
||||
@ -137,12 +137,12 @@ static int wts_read_variable_uint(wStream* s, int cbLen, UINT32* val)
|
||||
}
|
||||
}
|
||||
|
||||
static void wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, UINT32 length)
|
||||
static BOOL wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, UINT32 length)
|
||||
{
|
||||
UINT16 Version;
|
||||
|
||||
if (length < 3)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
Stream_Seek_UINT8(channel->receiveData); /* Pad (1 byte) */
|
||||
Stream_Read_UINT16(channel->receiveData, Version);
|
||||
@ -150,14 +150,15 @@ static void wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, UINT
|
||||
DEBUG_DVC("Version: %d", Version);
|
||||
|
||||
channel->vcm->drdynvc_state = DRDYNVC_STATE_READY;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, wStream* s, UINT32 length)
|
||||
static BOOL wts_read_drdynvc_create_response(rdpPeerChannel* channel, wStream* s, UINT32 length)
|
||||
{
|
||||
UINT32 CreationStatus;
|
||||
|
||||
if (length < 4)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
Stream_Read_UINT32(s, CreationStatus);
|
||||
|
||||
@ -171,50 +172,55 @@ static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, wStream* s
|
||||
DEBUG_DVC("ChannelId %d creation succeeded", channel->channelId);
|
||||
channel->dvc_open_state = DVC_OPEN_STATE_SUCCEEDED;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, wStream* s, int cbLen, UINT32 length)
|
||||
static BOOL wts_read_drdynvc_data_first(rdpPeerChannel* channel, wStream* s, int cbLen, UINT32 length)
|
||||
{
|
||||
int value;
|
||||
|
||||
value = wts_read_variable_uint(s, cbLen, &channel->dvc_total_length);
|
||||
|
||||
if (value == 0)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
length -= value;
|
||||
|
||||
if (length > channel->dvc_total_length)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
Stream_SetPosition(channel->receiveData, 0);
|
||||
Stream_EnsureRemainingCapacity(channel->receiveData, (int) channel->dvc_total_length);
|
||||
if (!Stream_EnsureRemainingCapacity(channel->receiveData, (int) channel->dvc_total_length))
|
||||
return FALSE;
|
||||
Stream_Write(channel->receiveData, Stream_Pointer(s), length);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 length)
|
||||
static BOOL wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 length)
|
||||
{
|
||||
BOOL ret;
|
||||
if (channel->dvc_total_length > 0)
|
||||
{
|
||||
if (Stream_GetPosition(channel->receiveData) + length > channel->dvc_total_length)
|
||||
{
|
||||
channel->dvc_total_length = 0;
|
||||
WLog_ERR(TAG, "incorrect fragment data, discarded.");
|
||||
return;
|
||||
WLog_ERR(TAG, "incorrect fragment data, discarded.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Stream_Write(channel->receiveData, Stream_Pointer(s), length);
|
||||
|
||||
if (Stream_GetPosition(channel->receiveData) >= (int) channel->dvc_total_length)
|
||||
{
|
||||
wts_queue_receive_data(channel, Stream_Buffer(channel->receiveData), channel->dvc_total_length);
|
||||
ret = wts_queue_receive_data(channel, Stream_Buffer(channel->receiveData), channel->dvc_total_length);
|
||||
channel->dvc_total_length = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wts_queue_receive_data(channel, Stream_Pointer(s), length);
|
||||
ret = wts_queue_receive_data(channel, Stream_Pointer(s), length);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void wts_read_drdynvc_close_response(rdpPeerChannel* channel)
|
||||
@ -223,7 +229,7 @@ static void wts_read_drdynvc_close_response(rdpPeerChannel* channel)
|
||||
channel->dvc_open_state = DVC_OPEN_STATE_CLOSED;
|
||||
}
|
||||
|
||||
static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
||||
static BOOL wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
||||
{
|
||||
UINT32 length;
|
||||
int value;
|
||||
@ -236,7 +242,7 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
||||
length = Stream_GetPosition(channel->receiveData);
|
||||
|
||||
if (length < 1)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
Stream_SetPosition(channel->receiveData, 0);
|
||||
Stream_Read_UINT8(channel->receiveData, value);
|
||||
@ -248,14 +254,14 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
||||
|
||||
if (Cmd == CAPABILITY_REQUEST_PDU)
|
||||
{
|
||||
wts_read_drdynvc_capabilities_response(channel, length);
|
||||
return wts_read_drdynvc_capabilities_response(channel, length);
|
||||
}
|
||||
else if (channel->vcm->drdynvc_state == DRDYNVC_STATE_READY)
|
||||
{
|
||||
value = wts_read_variable_uint(channel->receiveData, cbChId, &ChannelId);
|
||||
|
||||
if (value == 0)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
length -= value;
|
||||
|
||||
@ -267,15 +273,13 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
||||
switch (Cmd)
|
||||
{
|
||||
case CREATE_REQUEST_PDU:
|
||||
wts_read_drdynvc_create_response(dvc, channel->receiveData, length);
|
||||
break;
|
||||
return wts_read_drdynvc_create_response(dvc, channel->receiveData, length);
|
||||
|
||||
case DATA_FIRST_PDU:
|
||||
wts_read_drdynvc_data_first(dvc, channel->receiveData, Sp, length);
|
||||
break;
|
||||
return wts_read_drdynvc_data_first(dvc, channel->receiveData, Sp, length);
|
||||
|
||||
case DATA_PDU:
|
||||
wts_read_drdynvc_data(dvc, channel->receiveData, length);
|
||||
return wts_read_drdynvc_data(dvc, channel->receiveData, length);
|
||||
break;
|
||||
|
||||
case CLOSE_REQUEST_PDU:
|
||||
@ -296,6 +300,7 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
||||
{
|
||||
WLog_ERR(TAG, "received Cmd %d but channel is not ready.", Cmd);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int wts_write_variable_uint(wStream* s, UINT32 val)
|
||||
@ -344,32 +349,37 @@ static BOOL wts_write_drdynvc_create_request(wStream *s, UINT32 ChannelId, const
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void WTSProcessChannelData(rdpPeerChannel* channel, UINT16 channelId, BYTE* data, int size, int flags, int totalSize)
|
||||
static BOOL WTSProcessChannelData(rdpPeerChannel* channel, UINT16 channelId, BYTE* data, int size, int flags, int totalSize)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
|
||||
if (flags & CHANNEL_FLAG_FIRST)
|
||||
{
|
||||
Stream_SetPosition(channel->receiveData, 0);
|
||||
}
|
||||
|
||||
Stream_EnsureRemainingCapacity(channel->receiveData, size);
|
||||
if (!Stream_EnsureRemainingCapacity(channel->receiveData, size))
|
||||
return FALSE;
|
||||
Stream_Write(channel->receiveData, data, size);
|
||||
|
||||
if (flags & CHANNEL_FLAG_LAST)
|
||||
{
|
||||
if (Stream_GetPosition(channel->receiveData) != totalSize)
|
||||
{
|
||||
WLog_ERR(TAG, "read error");
|
||||
WLog_ERR(TAG, "read error");
|
||||
}
|
||||
if (channel == channel->vcm->drdynvc_channel)
|
||||
{
|
||||
wts_read_drdynvc_pdu(channel);
|
||||
ret = wts_read_drdynvc_pdu(channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
wts_queue_receive_data(channel, Stream_Buffer(channel->receiveData), Stream_GetPosition(channel->receiveData));
|
||||
ret = wts_queue_receive_data(channel, Stream_Buffer(channel->receiveData), Stream_GetPosition(channel->receiveData));
|
||||
}
|
||||
Stream_SetPosition(channel->receiveData, 0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId, BYTE* data, int size, int flags, int totalSize)
|
||||
@ -1191,6 +1201,7 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer,
|
||||
UINT32 length;
|
||||
UINT32 written;
|
||||
rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
if (!channel)
|
||||
return FALSE;
|
||||
@ -1201,7 +1212,7 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer,
|
||||
buffer = (BYTE*) malloc(length);
|
||||
CopyMemory(buffer, Buffer, length);
|
||||
|
||||
wts_queue_send_item(channel, buffer, length);
|
||||
ret = wts_queue_send_item(channel, buffer, length);
|
||||
}
|
||||
else if (!channel->vcm->drdynvc_channel || (channel->vcm->drdynvc_state != DRDYNVC_STATE_READY))
|
||||
{
|
||||
@ -1220,6 +1231,7 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer,
|
||||
WLog_ERR(TAG, "Stream_New failed!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
buffer = Stream_Buffer(s);
|
||||
|
||||
Stream_Seek_UINT8(s);
|
||||
@ -1248,14 +1260,14 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelWrite(HANDLE hChannelHandle, PCHAR Buffer,
|
||||
Length -= written;
|
||||
Buffer += written;
|
||||
|
||||
wts_queue_send_item(channel->vcm->drdynvc_channel, buffer, length);
|
||||
ret = wts_queue_send_item(channel->vcm->drdynvc_channel, buffer, length);
|
||||
}
|
||||
}
|
||||
|
||||
if (pBytesWritten)
|
||||
*pBytesWritten = Length;
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI FreeRDP_WTSVirtualChannelPurgeInput(HANDLE hChannelHandle)
|
||||
|
@ -362,9 +362,7 @@ int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
|
||||
msg->xPos = subsystem->pointerX;
|
||||
msg->yPos = subsystem->pointerY;
|
||||
|
||||
MessageQueue_Post(MsgPipe->Out, NULL, msgId, (void*) msg, NULL);
|
||||
|
||||
return 1;
|
||||
return MessageQueue_Post(MsgPipe->Out, NULL, msgId, (void*) msg, NULL) ? 1 : -1;
|
||||
}
|
||||
|
||||
int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
|
||||
@ -395,9 +393,7 @@ int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
|
||||
CopyMemory(msg->pixels, subsystem->cursorPixels, msg->scanline * msg->height);
|
||||
msg->premultiplied = TRUE;
|
||||
|
||||
MessageQueue_Post(MsgPipe->Out, NULL, msgId, (void*) msg, NULL);
|
||||
|
||||
return 1;
|
||||
return MessageQueue_Post(MsgPipe->Out, NULL, msgId, (void*) msg, NULL) ? 1 : -1;
|
||||
}
|
||||
|
||||
int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
|
||||
@ -1295,8 +1291,8 @@ int x11_shadow_subsystem_stop(x11ShadowSubsystem* subsystem)
|
||||
|
||||
if (subsystem->thread)
|
||||
{
|
||||
MessageQueue_PostQuit(subsystem->MsgPipe->In, 0);
|
||||
WaitForSingleObject(subsystem->thread, INFINITE);
|
||||
if (MessageQueue_PostQuit(subsystem->MsgPipe->In, 0))
|
||||
WaitForSingleObject(subsystem->thread, INFINITE);
|
||||
CloseHandle(subsystem->thread);
|
||||
subsystem->thread = NULL;
|
||||
}
|
||||
|
@ -251,17 +251,17 @@ BOOL shadow_client_post_connect(freerdp_peer* peer)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECTANGLE_16* areas)
|
||||
BOOL shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECTANGLE_16* areas)
|
||||
{
|
||||
wMessage message = { 0 };
|
||||
SHADOW_MSG_IN_REFRESH_OUTPUT* wParam;
|
||||
wMessagePipe* MsgPipe = client->subsystem->MsgPipe;
|
||||
|
||||
if (!areas)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
if (!(wParam = (SHADOW_MSG_IN_REFRESH_OUTPUT*) calloc(1, sizeof(SHADOW_MSG_IN_REFRESH_OUTPUT))))
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
wParam->numRects = (UINT32) count;
|
||||
|
||||
@ -272,7 +272,7 @@ void shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECTANGLE_1
|
||||
if (!wParam->rects)
|
||||
{
|
||||
free (wParam);
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,19 +284,18 @@ void shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECTANGLE_1
|
||||
message.context = (void*) client;
|
||||
message.Free = shadow_client_message_free;
|
||||
|
||||
MessageQueue_Dispatch(MsgPipe->In, &message);
|
||||
return MessageQueue_Dispatch(MsgPipe->In, &message);
|
||||
}
|
||||
|
||||
void shadow_client_suppress_output(rdpShadowClient* client, BYTE allow, RECTANGLE_16* area)
|
||||
BOOL shadow_client_suppress_output(rdpShadowClient* client, BYTE allow, RECTANGLE_16* area)
|
||||
{
|
||||
wMessage message = { 0 };
|
||||
SHADOW_MSG_IN_SUPPRESS_OUTPUT* wParam;
|
||||
wMessagePipe* MsgPipe = client->subsystem->MsgPipe;
|
||||
|
||||
wParam = (SHADOW_MSG_IN_SUPPRESS_OUTPUT*) calloc(1, sizeof(SHADOW_MSG_IN_SUPPRESS_OUTPUT));
|
||||
|
||||
if (!wParam)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
wParam->allow = (UINT32) allow;
|
||||
|
||||
@ -309,7 +308,7 @@ void shadow_client_suppress_output(rdpShadowClient* client, BYTE allow, RECTANGL
|
||||
message.context = (void*) client;
|
||||
message.Free = shadow_client_message_free;
|
||||
|
||||
MessageQueue_Dispatch(MsgPipe->In, &message);
|
||||
return MessageQueue_Dispatch(MsgPipe->In, &message);
|
||||
}
|
||||
|
||||
BOOL shadow_client_activate(freerdp_peer* peer)
|
||||
@ -334,12 +333,10 @@ BOOL shadow_client_activate(freerdp_peer* peer)
|
||||
|
||||
shadow_encoder_reset(client->encoder);
|
||||
|
||||
shadow_client_refresh_rect(client, 0, NULL);
|
||||
|
||||
return TRUE;
|
||||
return shadow_client_refresh_rect(client, 0, NULL);
|
||||
}
|
||||
|
||||
void shadow_client_surface_frame_acknowledge(rdpShadowClient* client, UINT32 frameId)
|
||||
BOOL shadow_client_surface_frame_acknowledge(rdpShadowClient* client, UINT32 frameId)
|
||||
{
|
||||
SURFACE_FRAME* frame;
|
||||
wListDictionary* frameList;
|
||||
@ -352,6 +349,7 @@ void shadow_client_surface_frame_acknowledge(rdpShadowClient* client, UINT32 fra
|
||||
ListDictionary_Remove(frameList, (void*) (size_t) frameId);
|
||||
free(frame);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int shadow_client_send_surface_frame_marker(rdpShadowClient* client, UINT32 action, UINT32 id)
|
||||
@ -983,9 +981,9 @@ void* shadow_client_thread(rdpShadowClient* client)
|
||||
|
||||
peer->Initialize(peer);
|
||||
|
||||
peer->update->RefreshRect = (pRefreshRect) shadow_client_refresh_rect;
|
||||
peer->update->SuppressOutput = (pSuppressOutput) shadow_client_suppress_output;
|
||||
peer->update->SurfaceFrameAcknowledge = (pSurfaceFrameAcknowledge) shadow_client_surface_frame_acknowledge;
|
||||
peer->update->RefreshRect = (pRefreshRect)shadow_client_refresh_rect;
|
||||
peer->update->SuppressOutput = (pSuppressOutput)shadow_client_suppress_output;
|
||||
peer->update->SurfaceFrameAcknowledge = (pSurfaceFrameAcknowledge)shadow_client_surface_frame_acknowledge;
|
||||
|
||||
if ((!client->StopEvent) || (!client->vcm) || (!subsystem->updateEvent))
|
||||
goto out;
|
||||
|
@ -346,10 +346,12 @@ void* shadow_server_thread(rdpShadowServer* server)
|
||||
|
||||
/* Signal to the clients that server is being stopped and wait for them
|
||||
* to disconnect. */
|
||||
MessageQueue_PostQuit(subsystem->MsgPipe->Out, 0);
|
||||
while(ArrayList_Count(server->clients) > 0)
|
||||
if (MessageQueue_PostQuit(subsystem->MsgPipe->Out, 0))
|
||||
{
|
||||
Sleep(100);
|
||||
while(ArrayList_Count(server->clients) > 0)
|
||||
{
|
||||
Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
ExitThread(0);
|
||||
|
@ -477,9 +477,9 @@ WINPR_API HANDLE MessageQueue_Event(wMessageQueue* queue);
|
||||
WINPR_API BOOL MessageQueue_Wait(wMessageQueue* queue);
|
||||
WINPR_API int MessageQueue_Size(wMessageQueue* queue);
|
||||
|
||||
WINPR_API void MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message);
|
||||
WINPR_API void MessageQueue_Post(wMessageQueue* queue, void* context, UINT32 type, void* wParam, void* lParam);
|
||||
WINPR_API void MessageQueue_PostQuit(wMessageQueue* queue, int nExitCode);
|
||||
WINPR_API BOOL MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message);
|
||||
WINPR_API BOOL MessageQueue_Post(wMessageQueue* queue, void* context, UINT32 type, void* wParam, void* lParam);
|
||||
WINPR_API BOOL MessageQueue_PostQuit(wMessageQueue* queue, int nExitCode);
|
||||
|
||||
WINPR_API int MessageQueue_Get(wMessageQueue* queue, wMessage* message);
|
||||
WINPR_API int MessageQueue_Peek(wMessageQueue* queue, wMessage* message, BOOL remove);
|
||||
|
@ -67,8 +67,9 @@ BOOL MessageQueue_Wait(wMessageQueue* queue)
|
||||
return status;
|
||||
}
|
||||
|
||||
void MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message)
|
||||
BOOL MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
EnterCriticalSection(&queue->lock);
|
||||
|
||||
if (queue->size == queue->capacity)
|
||||
@ -82,7 +83,7 @@ void MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message)
|
||||
|
||||
new_arr = (wMessage*) realloc(queue->array, sizeof(wMessage) * new_capacity);
|
||||
if (!new_arr)
|
||||
return;
|
||||
goto out;
|
||||
queue->array = new_arr;
|
||||
queue->capacity = new_capacity;
|
||||
ZeroMemory(&(queue->array[old_capacity]), old_capacity * sizeof(wMessage));
|
||||
@ -104,10 +105,13 @@ void MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message)
|
||||
if (queue->size > 0)
|
||||
SetEvent(queue->event);
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
LeaveCriticalSection(&queue->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MessageQueue_Post(wMessageQueue* queue, void* context, UINT32 type, void* wParam, void* lParam)
|
||||
BOOL MessageQueue_Post(wMessageQueue* queue, void* context, UINT32 type, void* wParam, void* lParam)
|
||||
{
|
||||
wMessage message;
|
||||
|
||||
@ -117,12 +121,12 @@ void MessageQueue_Post(wMessageQueue* queue, void* context, UINT32 type, void* w
|
||||
message.lParam = lParam;
|
||||
message.Free = NULL;
|
||||
|
||||
MessageQueue_Dispatch(queue, &message);
|
||||
return MessageQueue_Dispatch(queue, &message);
|
||||
}
|
||||
|
||||
void MessageQueue_PostQuit(wMessageQueue* queue, int nExitCode)
|
||||
BOOL MessageQueue_PostQuit(wMessageQueue* queue, int nExitCode)
|
||||
{
|
||||
MessageQueue_Post(queue, NULL, WMQ_QUIT, (void*) (size_t) nExitCode, NULL);
|
||||
return MessageQueue_Post(queue, NULL, WMQ_QUIT, (void*) (size_t) nExitCode, NULL);
|
||||
}
|
||||
|
||||
int MessageQueue_Get(wMessageQueue* queue, wMessage* message)
|
||||
@ -187,43 +191,34 @@ wMessageQueue* MessageQueue_New(const wObject *callback)
|
||||
{
|
||||
wMessageQueue* queue = NULL;
|
||||
|
||||
queue = (wMessageQueue*) malloc(sizeof(wMessageQueue));
|
||||
queue = (wMessageQueue*) calloc(1, sizeof(wMessageQueue));
|
||||
if (!queue)
|
||||
return NULL;
|
||||
|
||||
if (queue)
|
||||
{
|
||||
queue->head = 0;
|
||||
queue->tail = 0;
|
||||
queue->size = 0;
|
||||
queue->capacity = 32;
|
||||
queue->array = (wMessage*) calloc(queue->capacity, sizeof(wMessage));
|
||||
if (!queue->array)
|
||||
goto error_array;
|
||||
|
||||
queue->capacity = 32;
|
||||
queue->array = (wMessage*) calloc(1, sizeof(wMessage) * queue->capacity);
|
||||
if (!queue->array)
|
||||
{
|
||||
free(queue);
|
||||
return NULL;
|
||||
}
|
||||
if (!InitializeCriticalSectionAndSpinCount(&queue->lock, 4000))
|
||||
goto error_spinlock;
|
||||
|
||||
if (!InitializeCriticalSectionAndSpinCount(&queue->lock, 4000))
|
||||
{
|
||||
free(queue);
|
||||
return NULL;
|
||||
}
|
||||
queue->event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
if (!queue->event)
|
||||
{
|
||||
free(queue->array);
|
||||
DeleteCriticalSection(&queue->lock);
|
||||
free(queue);
|
||||
return NULL;
|
||||
}
|
||||
queue->event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
if (!queue->event)
|
||||
goto error_event;
|
||||
|
||||
if (callback)
|
||||
queue->object = *callback;
|
||||
else
|
||||
ZeroMemory(&queue->object, sizeof(queue->object));
|
||||
}
|
||||
if (callback)
|
||||
queue->object = *callback;
|
||||
|
||||
return queue;
|
||||
|
||||
error_event:
|
||||
DeleteCriticalSection(&queue->lock);
|
||||
error_spinlock:
|
||||
free(queue->array);
|
||||
error_array:
|
||||
free(queue);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MessageQueue_Free(wMessageQueue* queue)
|
||||
|
@ -15,7 +15,8 @@ static void* message_echo_pipe_client_thread(void* arg)
|
||||
|
||||
while (index < 100)
|
||||
{
|
||||
MessageQueue_Post(pipe->In, NULL, 0, (void*) (size_t) index, NULL);
|
||||
if (!MessageQueue_Post(pipe->In, NULL, 0, (void*) (size_t) index, NULL))
|
||||
break;
|
||||
|
||||
if (!MessageQueue_Wait(pipe->Out))
|
||||
break;
|
||||
@ -56,7 +57,8 @@ static void* message_echo_pipe_server_thread(void* arg)
|
||||
|
||||
count = (int) (size_t) message.wParam;
|
||||
|
||||
MessageQueue_Dispatch(pipe->Out, &message);
|
||||
if (!MessageQueue_Dispatch(pipe->Out, &message))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,12 +42,12 @@ int TestMessageQueue(int argc, char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
MessageQueue_Post(queue, NULL, 123, NULL, NULL);
|
||||
MessageQueue_Post(queue, NULL, 456, NULL, NULL);
|
||||
MessageQueue_Post(queue, NULL, 789, NULL, NULL);
|
||||
MessageQueue_PostQuit(queue, 0);
|
||||
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
if (!MessageQueue_Post(queue, NULL, 123, NULL, NULL) ||
|
||||
!MessageQueue_Post(queue, NULL, 456, NULL, NULL) ||
|
||||
!MessageQueue_Post(queue, NULL, 789, NULL, NULL) ||
|
||||
!MessageQueue_PostQuit(queue, 0) ||
|
||||
WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0)
|
||||
return -1;
|
||||
|
||||
MessageQueue_Free(queue);
|
||||
CloseHandle(thread);
|
||||
|
Loading…
Reference in New Issue
Block a user