libfreerdp-core: fix asynchronous queueing of RemoteApp messages

This commit is contained in:
Marc-André Moreau 2013-10-22 16:28:23 -04:00
parent 3951a6e1c3
commit 3cd5652c7d
7 changed files with 88 additions and 51 deletions

View File

@ -269,6 +269,9 @@ int rail_client_execute(RailClientContext* context, RAIL_EXEC_ORDER* exec)
exeOrFile = exec->RemoteApplicationProgram;
if (!exeOrFile)
return -1;
if (strlen(exeOrFile) >= 2)
{
if (strncmp(exeOrFile, "||", 2) != 0)

View File

@ -138,10 +138,7 @@ BOOL rail_read_server_get_appid_resp_order(wStream* s, RAIL_GET_APPID_RESP_ORDER
return FALSE;
Stream_Read_UINT32(s, getAppidResp->windowId); /* windowId (4 bytes) */
Stream_Read(s, &getAppidResp->applicationIdBuffer[0], 512); /* applicationId (256 UNICODE chars) */
getAppidResp->applicationId.length = 512;
getAppidResp->applicationId.string = &getAppidResp->applicationIdBuffer[0];
Stream_Read(s, (BYTE*) &(getAppidResp->applicationId), 512); /* applicationId (256 UNICODE chars) */
return TRUE;
}

View File

@ -662,9 +662,9 @@ void xf_process_rail_appid_resp_event(xfContext* xfc, rdpChannels* channels, wMe
fprintf(stderr, "Server Application ID Response PDU: windowId=0x%X "
"applicationId=(length=%d dump)\n",
appid_resp->windowId, appid_resp->applicationId.length);
appid_resp->windowId, 512);
winpr_HexDump(appid_resp->applicationId.string, appid_resp->applicationId.length);
winpr_HexDump((BYTE*) &appid_resp->applicationId, 512);
}
void xf_process_rail_langbarinfo_event(xfContext* xfc, rdpChannels* channels, wMessage* event)

View File

@ -332,8 +332,7 @@ typedef struct _RAIL_GET_APPID_REQ_ORDER RAIL_GET_APPID_REQ_ORDER;
struct _RAIL_GET_APPID_RESP_ORDER
{
UINT32 windowId;
RAIL_UNICODE_STRING applicationId;
BYTE applicationIdBuffer[512];
WCHAR applicationId[256];
};
typedef struct _RAIL_GET_APPID_RESP_ORDER RAIL_GET_APPID_RESP_ORDER;

View File

@ -738,6 +738,26 @@ static void update_message_WindowIcon(rdpContext* context, WINDOW_ORDER_INFO* or
lParam = (WINDOW_ICON_ORDER*) malloc(sizeof(WINDOW_ICON_ORDER));
CopyMemory(lParam, windowIcon, sizeof(WINDOW_ICON_ORDER));
fprintf(stderr, "update_message_WindowIcon\n");
if (windowIcon->iconInfo->cbBitsColor > 0)
{
lParam->iconInfo->bitsColor = (BYTE*) malloc(windowIcon->iconInfo->cbBitsColor);
CopyMemory(lParam->iconInfo->bitsColor, windowIcon->iconInfo->bitsColor, windowIcon->iconInfo->cbBitsColor);
}
if (windowIcon->iconInfo->cbBitsMask > 0)
{
lParam->iconInfo->bitsMask = (BYTE*) malloc(windowIcon->iconInfo->cbBitsMask);
CopyMemory(lParam->iconInfo->bitsMask, windowIcon->iconInfo->bitsMask, windowIcon->iconInfo->cbBitsMask);
}
if (windowIcon->iconInfo->cbColorTable > 0)
{
lParam->iconInfo->colorTable = (BYTE*) malloc(windowIcon->iconInfo->cbColorTable);
CopyMemory(lParam->iconInfo->colorTable, windowIcon->iconInfo->colorTable, windowIcon->iconInfo->cbColorTable);
}
MessageQueue_Post(context->update->queue, (void*) context,
MakeMessageId(WindowUpdate, WindowIcon), (void*) wParam, (void*) lParam);
}
@ -1356,10 +1376,30 @@ int update_message_process_window_update_class(rdpUpdateProxy* proxy, wMessage*
break;
case WindowUpdate_WindowIcon:
IFCALL(proxy->WindowIcon, msg->context, (WINDOW_ORDER_INFO*) msg->wParam,
(WINDOW_ICON_ORDER*) msg->lParam);
free(msg->wParam);
free(msg->lParam);
{
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);
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);
}
break;
case WindowUpdate_WindowCachedIcon:

View File

@ -28,98 +28,98 @@
#include "window.h"
BOOL update_read_icon_info(wStream* s, ICON_INFO* icon_info)
BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
{
if (Stream_GetRemainingLength(s) < 8)
return FALSE;
Stream_Read_UINT16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */
Stream_Read_UINT8(s, icon_info->cacheId); /* cacheId (1 byte) */
Stream_Read_UINT8(s, icon_info->bpp); /* bpp (1 byte) */
Stream_Read_UINT16(s, icon_info->width); /* width (2 bytes) */
Stream_Read_UINT16(s, icon_info->height); /* height (2 bytes) */
Stream_Read_UINT16(s, iconInfo->cacheEntry); /* cacheEntry (2 bytes) */
Stream_Read_UINT8(s, iconInfo->cacheId); /* cacheId (1 byte) */
Stream_Read_UINT8(s, iconInfo->bpp); /* bpp (1 byte) */
Stream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */
Stream_Read_UINT16(s, iconInfo->height); /* height (2 bytes) */
/* cbColorTable is only present when bpp is 1, 2 or 4 */
if (icon_info->bpp == 1 || icon_info->bpp == 2 || icon_info->bpp == 4)
if (iconInfo->bpp == 1 || iconInfo->bpp == 2 || iconInfo->bpp == 4)
{
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
Stream_Read_UINT16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */
Stream_Read_UINT16(s, iconInfo->cbColorTable); /* cbColorTable (2 bytes) */
}
else
{
icon_info->cbColorTable = 0;
iconInfo->cbColorTable = 0;
}
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT16(s, icon_info->cbBitsMask); /* cbBitsMask (2 bytes) */
Stream_Read_UINT16(s, icon_info->cbBitsColor); /* cbBitsColor (2 bytes) */
Stream_Read_UINT16(s, iconInfo->cbBitsMask); /* cbBitsMask (2 bytes) */
Stream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */
if (Stream_GetRemainingLength(s) < icon_info->cbBitsMask + icon_info->cbBitsColor)
if (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask + iconInfo->cbBitsColor)
return FALSE;
/* bitsMask */
if (icon_info->bitsMask == NULL)
icon_info->bitsMask = (BYTE*) malloc(icon_info->cbBitsMask);
if (iconInfo->bitsMask == NULL)
iconInfo->bitsMask = (BYTE*) malloc(iconInfo->cbBitsMask);
else
icon_info->bitsMask = (BYTE*) realloc(icon_info->bitsMask, icon_info->cbBitsMask);
iconInfo->bitsMask = (BYTE*) realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);
Stream_Read(s, icon_info->bitsMask, icon_info->cbBitsMask);
Stream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);
/* colorTable */
if (icon_info->colorTable == NULL)
if (iconInfo->colorTable == NULL)
{
if (icon_info->cbColorTable)
icon_info->colorTable = (BYTE*) malloc(icon_info->cbColorTable);
if (iconInfo->cbColorTable)
iconInfo->colorTable = (BYTE*) malloc(iconInfo->cbColorTable);
}
else if (icon_info->cbColorTable)
else if (iconInfo->cbColorTable)
{
icon_info->colorTable = (BYTE*) realloc(icon_info->colorTable, icon_info->cbColorTable);
iconInfo->colorTable = (BYTE*) realloc(iconInfo->colorTable, iconInfo->cbColorTable);
}
else
{
free(icon_info->colorTable);
icon_info->colorTable = NULL;
free(iconInfo->colorTable);
iconInfo->colorTable = NULL;
}
if (icon_info->colorTable)
Stream_Read(s, icon_info->colorTable, icon_info->cbColorTable);
if (iconInfo->colorTable)
Stream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);
/* bitsColor */
if (icon_info->bitsColor == NULL)
icon_info->bitsColor = (BYTE*) malloc(icon_info->cbBitsColor);
if (iconInfo->bitsColor == NULL)
iconInfo->bitsColor = (BYTE*) malloc(iconInfo->cbBitsColor);
else
icon_info->bitsColor = (BYTE*) realloc(icon_info->bitsColor, icon_info->cbBitsColor);
iconInfo->bitsColor = (BYTE*) realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
Stream_Read(s, icon_info->bitsColor, icon_info->cbBitsColor);
Stream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);
return TRUE;
}
BOOL update_read_cached_icon_info(wStream* s, CACHED_ICON_INFO* cached_icon_info)
BOOL update_read_cached_icon_info(wStream* s, CACHED_ICON_INFO* cachedIconInfo)
{
if (Stream_GetRemainingLength(s) < 3)
return FALSE;
Stream_Read_UINT16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */
Stream_Read_UINT8(s, cached_icon_info->cacheId); /* cacheId (1 byte) */
Stream_Read_UINT16(s, cachedIconInfo->cacheEntry); /* cacheEntry (2 bytes) */
Stream_Read_UINT8(s, cachedIconInfo->cacheId); /* cacheId (1 byte) */
return TRUE;
}
BOOL update_read_notify_icon_infotip(wStream* s, NOTIFY_ICON_INFOTIP* notify_icon_infotip)
BOOL update_read_notify_icon_infotip(wStream* s, NOTIFY_ICON_INFOTIP* notifyIconInfoTip)
{
if (Stream_GetRemainingLength(s) < 8)
return FALSE;
Stream_Read_UINT32(s, notify_icon_infotip->timeout); /* timeout (4 bytes) */
Stream_Read_UINT32(s, notify_icon_infotip->flags); /* infoFlags (4 bytes) */
Stream_Read_UINT32(s, notifyIconInfoTip->timeout); /* timeout (4 bytes) */
Stream_Read_UINT32(s, notifyIconInfoTip->flags); /* infoFlags (4 bytes) */
return rail_read_unicode_string(s, &notify_icon_infotip->text) && /* infoTipText */
rail_read_unicode_string(s, &notify_icon_infotip->title); /* title */
return rail_read_unicode_string(s, &notifyIconInfoTip->text) && /* infoTipText */
rail_read_unicode_string(s, &notifyIconInfoTip->title); /* title */
}
BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)

View File

@ -175,9 +175,7 @@ void* rail_clone_order(UINT32 event_type, void* order)
if (event_type == RailChannel_ServerGetAppIdResponse)
{
RAIL_GET_APPID_RESP_ORDER* new_app_resp = (RAIL_GET_APPID_RESP_ORDER*)new_order;
new_app_resp->applicationId.string = &new_app_resp->applicationIdBuffer[0];
}
return new_order;