FreeRDP/channels/rail/client/rail_orders.c

1289 lines
32 KiB
C
Raw Normal View History

2011-08-12 12:15:04 +04:00
/**
2012-10-09 07:02:04 +04:00
* FreeRDP: A Remote Desktop Protocol Implementation
2011-08-12 12:15:04 +04:00
* Remote Applications Integrated Locally (RAIL) Orders
*
* Copyright 2009 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2011 Roman Barabanov <romanbarabanov@gmail.com>
2015-06-08 19:04:05 +03:00
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
* Copyright 2017 Armin Novak <armin.novak@thincast.com>
* Copyright 2017 Thincast Technologies GmbH
2011-08-12 12:15:04 +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
#include <winpr/crt.h>
#include <freerdp/channels/log.h>
#include "rail_orders.h"
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_write_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
{
2017-12-20 17:00:21 +03:00
if (!s || !unicode_string)
return ERROR_INVALID_PARAMETER;
if (!Stream_EnsureRemainingCapacity(s, 2 + unicode_string->length))
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
return CHANNEL_RC_NO_MEMORY;
}
2014-11-12 18:18:53 +03:00
Stream_Write_UINT16(s, unicode_string->length); /* cbString (2 bytes) */
Stream_Write(s, unicode_string->string, unicode_string->length); /* string */
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
2014-11-12 18:18:53 +03:00
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT rail_write_unicode_string_value(wStream* s, RAIL_UNICODE_STRING* unicode_string)
2014-11-12 18:18:53 +03:00
{
2017-12-20 17:00:21 +03:00
if (!s || !unicode_string)
return ERROR_INVALID_PARAMETER;
2014-11-12 18:18:53 +03:00
if (unicode_string->length > 0)
{
if (!Stream_EnsureRemainingCapacity(s, unicode_string->length))
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
return CHANNEL_RC_NO_MEMORY;
}
2014-11-12 18:18:53 +03:00
Stream_Write(s, unicode_string->string, unicode_string->length); /* string */
}
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
2014-11-12 18:18:53 +03:00
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_pdu(railPlugin* rail, wStream* s, UINT16 orderType)
{
UINT16 orderLength;
2017-12-20 17:00:21 +03:00
if (!rail || !s)
return ERROR_INVALID_PARAMETER;
2014-02-10 10:06:11 +04:00
orderLength = (UINT16) Stream_GetPosition(s);
Stream_SetPosition(s, 0);
rail_write_pdu_header(s, orderType, orderLength);
Stream_SetPosition(s, orderLength);
WLog_Print(rail->log, WLOG_DEBUG, "Sending %s PDU, length: %"PRIu16"",
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
return rail_send_channel_data(rail, Stream_Buffer(s), orderLength);
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_write_high_contrast(wStream* s, RAIL_HIGH_CONTRAST* highContrast)
{
2017-12-20 17:00:21 +03:00
if (!s || !highContrast)
return ERROR_INVALID_PARAMETER;
2013-10-10 06:38:26 +04:00
highContrast->colorSchemeLength = highContrast->colorScheme.length + 2;
Stream_Write_UINT32(s, highContrast->flags); /* flags (4 bytes) */
Stream_Write_UINT32(s, highContrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */
return rail_write_unicode_string(s, &highContrast->colorScheme); /* colorScheme */
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_read_server_exec_result_order(wStream* s, RAIL_EXEC_RESULT_ORDER* execResult)
{
2017-12-20 17:00:21 +03:00
if (!s || !execResult)
return ERROR_INVALID_PARAMETER;
if (Stream_GetRemainingLength(s) < 8)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_GetRemainingLength failed!");
return ERROR_INVALID_DATA;
}
2013-10-10 06:38:26 +04:00
Stream_Read_UINT16(s, execResult->flags); /* flags (2 bytes) */
Stream_Read_UINT16(s, execResult->execResult); /* execResult (2 bytes) */
Stream_Read_UINT32(s, execResult->rawResult); /* rawResult (4 bytes) */
Stream_Seek_UINT16(s); /* padding (2 bytes) */
return rail_read_unicode_string(s,
&execResult->exeOrFile) ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR; /* exeOrFile */
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_read_server_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
{
BYTE body;
2017-12-20 17:00:21 +03:00
if (!s || !sysparam)
return ERROR_INVALID_PARAMETER;
if (Stream_GetRemainingLength(s) < 5)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_GetRemainingLength failed!");
return ERROR_INVALID_DATA;
}
2013-10-10 06:38:26 +04:00
2013-05-09 00:09:16 +04:00
Stream_Read_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
Stream_Read_UINT8(s, body); /* body (1 byte) */
switch (sysparam->param)
{
case SPI_SET_SCREEN_SAVE_ACTIVE:
sysparam->setScreenSaveActive = (body != 0) ? TRUE : FALSE;
break;
case SPI_SET_SCREEN_SAVE_SECURE:
sysparam->setScreenSaveSecure = (body != 0) ? TRUE : FALSE;
break;
default:
break;
}
2013-10-10 06:38:26 +04:00
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_read_server_minmaxinfo_order(wStream* s, RAIL_MINMAXINFO_ORDER* minmaxinfo)
{
2017-12-20 17:00:21 +03:00
if (!s || !minmaxinfo)
return ERROR_INVALID_PARAMETER;
if (Stream_GetRemainingLength(s) < 20)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_GetRemainingLength failed!");
return ERROR_INVALID_DATA;
}
2013-10-10 06:38:26 +04:00
2013-05-09 00:09:16 +04:00
Stream_Read_UINT32(s, minmaxinfo->windowId); /* windowId (4 bytes) */
Stream_Read_UINT16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */
Stream_Read_UINT16(s, minmaxinfo->maxHeight); /* maxHeight (2 bytes) */
Stream_Read_UINT16(s, minmaxinfo->maxPosX); /* maxPosX (2 bytes) */
Stream_Read_UINT16(s, minmaxinfo->maxPosY); /* maxPosY (2 bytes) */
Stream_Read_UINT16(s, minmaxinfo->minTrackWidth); /* minTrackWidth (2 bytes) */
Stream_Read_UINT16(s, minmaxinfo->minTrackHeight); /* minTrackHeight (2 bytes) */
Stream_Read_UINT16(s, minmaxinfo->maxTrackWidth); /* maxTrackWidth (2 bytes) */
Stream_Read_UINT16(s, minmaxinfo->maxTrackHeight); /* maxTrackHeight (2 bytes) */
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_read_server_localmovesize_order(wStream* s,
RAIL_LOCALMOVESIZE_ORDER* localMoveSize)
{
UINT16 isMoveSizeStart;
2013-10-10 06:38:26 +04:00
2017-12-20 17:00:21 +03:00
if (!s || !localMoveSize)
return ERROR_INVALID_PARAMETER;
if (Stream_GetRemainingLength(s) < 12)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_GetRemainingLength failed!");
return ERROR_INVALID_DATA;
}
2013-10-10 06:38:26 +04:00
Stream_Read_UINT32(s, localMoveSize->windowId); /* windowId (4 bytes) */
2013-05-09 00:09:16 +04:00
Stream_Read_UINT16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */
2013-10-10 06:38:26 +04:00
localMoveSize->isMoveSizeStart = (isMoveSizeStart != 0) ? TRUE : FALSE;
Stream_Read_UINT16(s, localMoveSize->moveSizeType); /* moveSizeType (2 bytes) */
Stream_Read_UINT16(s, localMoveSize->posX); /* posX (2 bytes) */
Stream_Read_UINT16(s, localMoveSize->posY); /* posY (2 bytes) */
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_read_server_get_appid_resp_order(wStream* s,
RAIL_GET_APPID_RESP_ORDER* getAppidResp)
{
2017-12-20 17:00:21 +03:00
if (!s || !getAppidResp)
return ERROR_INVALID_PARAMETER;
if (Stream_GetRemainingLength(s) < 516)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_GetRemainingLength failed!");
return ERROR_INVALID_DATA;
}
2013-10-10 06:38:26 +04:00
Stream_Read_UINT32(s, getAppidResp->windowId); /* windowId (4 bytes) */
Stream_Read(s, (BYTE*) & (getAppidResp->applicationId),
512); /* applicationId (256 UNICODE chars) */
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_read_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbarInfo)
{
2017-12-20 17:00:21 +03:00
if (!s || !langbarInfo)
return ERROR_INVALID_PARAMETER;
if (Stream_GetRemainingLength(s) < 4)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "Stream_GetRemainingLength failed!");
return ERROR_INVALID_DATA;
}
2013-10-10 06:38:26 +04:00
Stream_Read_UINT32(s, langbarInfo->languageBarStatus); /* languageBarStatus (4 bytes) */
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* clientStatus)
{
2017-12-20 17:00:21 +03:00
if (!s || !clientStatus)
return ERROR_INVALID_PARAMETER;
2013-10-10 06:38:26 +04:00
Stream_Write_UINT32(s, clientStatus->flags); /* flags (4 bytes) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_exec_order(wStream* s, RAIL_EXEC_ORDER* exec)
{
UINT error;
2017-12-20 17:00:21 +03:00
if (!s || !exec)
return ERROR_INVALID_PARAMETER;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT16(s, exec->flags); /* flags (2 bytes) */
Stream_Write_UINT16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */
Stream_Write_UINT16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */
Stream_Write_UINT16(s, exec->arguments.length); /* argumentsLength (2 bytes) */
2015-06-08 19:04:05 +03:00
if ((error = rail_write_unicode_string_value(s, &exec->exeOrFile)))
{
WLog_ERR(TAG, "rail_write_unicode_string_value failed with error %"PRIu32"", error);
2015-06-08 19:04:05 +03:00
return error;
}
2015-06-08 19:04:05 +03:00
if ((error = rail_write_unicode_string_value(s, &exec->workingDir)))
{
WLog_ERR(TAG, "rail_write_unicode_string_value failed with error %"PRIu32"", error);
2015-06-08 19:04:05 +03:00
return error;
}
2015-06-08 19:04:05 +03:00
if ((error = rail_write_unicode_string_value(s, &exec->arguments)))
{
WLog_ERR(TAG, "rail_write_unicode_string_value failed with error %"PRIu32"", error);
2015-06-08 19:04:05 +03:00
return error;
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_write_client_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
{
BYTE body;
UINT error = CHANNEL_RC_OK;
2017-12-20 17:00:21 +03:00
if (!s || !sysparam)
return ERROR_INVALID_PARAMETER;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
switch (sysparam->param)
{
case SPI_SET_DRAG_FULL_WINDOWS:
body = sysparam->dragFullWindows;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT8(s, body);
break;
case SPI_SET_KEYBOARD_CUES:
body = sysparam->keyboardCues;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT8(s, body);
break;
case SPI_SET_KEYBOARD_PREF:
body = sysparam->keyboardPref;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT8(s, body);
break;
case SPI_SET_MOUSE_BUTTON_SWAP:
body = sysparam->mouseButtonSwap;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT8(s, body);
break;
case SPI_SET_WORK_AREA:
2013-05-09 00:09:16 +04:00
Stream_Write_UINT16(s, sysparam->workArea.left); /* left (2 bytes) */
Stream_Write_UINT16(s, sysparam->workArea.top); /* top (2 bytes) */
Stream_Write_UINT16(s, sysparam->workArea.right); /* right (2 bytes) */
Stream_Write_UINT16(s, sysparam->workArea.bottom); /* bottom (2 bytes) */
break;
case SPI_DISPLAY_CHANGE:
2013-05-09 00:09:16 +04:00
Stream_Write_UINT16(s, sysparam->displayChange.left); /* left (2 bytes) */
Stream_Write_UINT16(s, sysparam->displayChange.top); /* top (2 bytes) */
Stream_Write_UINT16(s, sysparam->displayChange.right); /* right (2 bytes) */
Stream_Write_UINT16(s, sysparam->displayChange.bottom); /* bottom (2 bytes) */
break;
case SPI_TASKBAR_POS:
2013-05-09 00:09:16 +04:00
Stream_Write_UINT16(s, sysparam->taskbarPos.left); /* left (2 bytes) */
Stream_Write_UINT16(s, sysparam->taskbarPos.top); /* top (2 bytes) */
Stream_Write_UINT16(s, sysparam->taskbarPos.right); /* right (2 bytes) */
Stream_Write_UINT16(s, sysparam->taskbarPos.bottom); /* bottom (2 bytes) */
break;
case SPI_SET_HIGH_CONTRAST:
2015-06-08 19:04:05 +03:00
error = rail_write_high_contrast(s, &sysparam->highContrast);
break;
}
2015-06-08 19:04:05 +03:00
return error;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_activate_order(wStream* s, RAIL_ACTIVATE_ORDER* activate)
{
BYTE enabled;
2017-12-20 17:00:21 +03:00
if (!s || !activate)
return ERROR_INVALID_PARAMETER;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT32(s, activate->windowId); /* windowId (4 bytes) */
enabled = activate->enabled;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT8(s, enabled); /* enabled (1 byte) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_sysmenu_order(wStream* s, RAIL_SYSMENU_ORDER* sysmenu)
{
2017-12-20 17:00:21 +03:00
if (!s || !sysmenu)
return ERROR_INVALID_PARAMETER;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT32(s, sysmenu->windowId); /* windowId (4 bytes) */
Stream_Write_UINT16(s, sysmenu->left); /* left (2 bytes) */
Stream_Write_UINT16(s, sysmenu->top); /* top (2 bytes) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_syscommand_order(wStream* s, RAIL_SYSCOMMAND_ORDER* syscommand)
{
2017-12-20 17:00:21 +03:00
if (!s || !syscommand)
return ERROR_INVALID_PARAMETER;
2013-05-09 00:09:16 +04:00
Stream_Write_UINT32(s, syscommand->windowId); /* windowId (4 bytes) */
Stream_Write_UINT16(s, syscommand->command); /* command (2 bytes) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_notify_event_order(wStream* s, RAIL_NOTIFY_EVENT_ORDER* notifyEvent)
{
2017-12-20 17:00:21 +03:00
if (!s || !notifyEvent)
return ERROR_INVALID_PARAMETER;
2013-10-10 06:38:26 +04:00
Stream_Write_UINT32(s, notifyEvent->windowId); /* windowId (4 bytes) */
Stream_Write_UINT32(s, notifyEvent->notifyIconId); /* notifyIconId (4 bytes) */
Stream_Write_UINT32(s, notifyEvent->message); /* notifyIconId (4 bytes) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_window_move_order(wStream* s, RAIL_WINDOW_MOVE_ORDER* windowMove)
{
2017-12-20 17:00:21 +03:00
if (!s || !windowMove)
return ERROR_INVALID_PARAMETER;
2013-10-10 06:38:26 +04:00
Stream_Write_UINT32(s, windowMove->windowId); /* windowId (4 bytes) */
Stream_Write_UINT16(s, windowMove->left); /* left (2 bytes) */
Stream_Write_UINT16(s, windowMove->top); /* top (2 bytes) */
Stream_Write_UINT16(s, windowMove->right); /* right (2 bytes) */
Stream_Write_UINT16(s, windowMove->bottom); /* bottom (2 bytes) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_client_get_appid_req_order(wStream* s, RAIL_GET_APPID_REQ_ORDER* getAppidReq)
{
2017-12-20 17:00:21 +03:00
if (!s || !getAppidReq)
return ERROR_INVALID_PARAMETER;
2013-10-10 06:38:26 +04:00
Stream_Write_UINT32(s, getAppidReq->windowId); /* windowId (4 bytes) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
2017-12-20 17:00:21 +03:00
static UINT rail_write_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbarInfo)
{
2017-12-20 17:00:21 +03:00
if (!s || !langbarInfo)
return ERROR_INVALID_PARAMETER;
2013-10-10 06:38:26 +04:00
Stream_Write_UINT32(s, langbarInfo->languageBarStatus); /* languageBarStatus (4 bytes) */
2017-12-20 17:00:21 +03:00
return ERROR_SUCCESS;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_handshake_order(railPlugin* rail, RAIL_HANDSHAKE_ORDER* handshake, wStream* s)
2011-08-12 00:27:16 +04:00
{
2013-10-16 23:32:33 +04:00
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2013-10-15 07:16:40 +04:00
2017-12-20 17:00:21 +03:00
if (!context || !handshake || !s)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_handshake_order(s, handshake)))
{
WLog_ERR(TAG, "rail_read_handshake_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2011-08-12 00:27:16 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ServerHandshake, error, context, handshake);
if (error)
WLog_ERR(TAG, "context.ServerHandshake failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_handshake_ex_order(railPlugin* rail, RAIL_HANDSHAKE_EX_ORDER* handshakeEx,
wStream* s)
{
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2017-12-20 17:00:21 +03:00
if (!context || !handshakeEx || !s)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_handshake_ex_order(s, handshakeEx)))
{
WLog_ERR(TAG, "rail_read_handshake_ex_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-10-15 07:16:40 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ClientHandshakeEx, error, context, handshakeEx);
if (error)
WLog_ERR(TAG, "context.ClientHandshakeEx failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
2011-08-12 00:27:16 +04:00
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_exec_result_order(railPlugin* rail, RAIL_EXEC_RESULT_ORDER* execResult,
wStream* s)
{
2013-10-16 23:32:33 +04:00
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2017-12-20 17:00:21 +03:00
if (!context || !execResult || !s)
return ERROR_INVALID_PARAMETER;
2013-10-16 23:32:33 +04:00
ZeroMemory(execResult, sizeof(RAIL_EXEC_RESULT_ORDER));
2013-10-15 07:16:40 +04:00
2015-06-08 19:04:05 +03:00
if ((error = rail_read_server_exec_result_order(s, execResult)))
{
WLog_ERR(TAG, "rail_read_server_exec_result_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-10-15 07:16:40 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ServerExecuteResult, error, context, execResult);
if (error)
WLog_ERR(TAG, "context.ServerExecuteResult failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_server_sysparam_order(railPlugin* rail, RAIL_SYSPARAM_ORDER* sysparam,
wStream* s)
{
2013-10-16 23:32:33 +04:00
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2013-10-15 07:16:40 +04:00
2017-12-20 17:00:21 +03:00
if (!context || !sysparam || !s)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_server_sysparam_order(s, sysparam)))
{
WLog_ERR(TAG, "rail_read_server_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-10-15 07:16:40 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ServerSystemParam, error, context, sysparam);
if (error)
WLog_ERR(TAG, "context.ServerSystemParam failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_server_minmaxinfo_order(railPlugin* rail, RAIL_MINMAXINFO_ORDER* minMaxInfo,
wStream* s)
{
2013-10-16 23:32:33 +04:00
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2013-10-16 23:32:33 +04:00
2017-12-20 17:00:21 +03:00
if (!context || !minMaxInfo || !s)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_server_minmaxinfo_order(s, minMaxInfo)))
{
WLog_ERR(TAG, "rail_read_server_minmaxinfo_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-10-16 23:32:33 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ServerMinMaxInfo, error, context, minMaxInfo);
if (error)
WLog_ERR(TAG, "context.ServerMinMaxInfo failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_server_localmovesize_order(railPlugin* rail,
RAIL_LOCALMOVESIZE_ORDER* localMoveSize,
wStream* s)
{
2013-10-16 23:32:33 +04:00
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2013-10-16 23:32:33 +04:00
2017-12-20 17:00:21 +03:00
if (!context || !localMoveSize || !s)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_server_localmovesize_order(s, localMoveSize)))
{
WLog_ERR(TAG, "rail_read_server_localmovesize_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-10-16 23:32:33 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ServerLocalMoveSize, error, context, localMoveSize);
if (error)
WLog_ERR(TAG, "context.ServerLocalMoveSize failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_server_get_appid_resp_order(railPlugin* rail,
RAIL_GET_APPID_RESP_ORDER* getAppIdResp, wStream* s)
{
2013-10-16 23:32:33 +04:00
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2013-10-16 23:32:33 +04:00
2017-12-20 17:00:21 +03:00
if (!context || !getAppIdResp || !s)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_server_get_appid_resp_order(s, getAppIdResp)))
{
WLog_ERR(TAG, "rail_read_server_get_appid_resp_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-10-16 23:32:33 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ServerGetAppIdResponse, error, context, getAppIdResp);
if (error)
WLog_ERR(TAG, "context.ServerGetAppIdResponse failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 16:52:28 +03:00
static UINT rail_recv_langbar_info_order(railPlugin* rail, RAIL_LANGBAR_INFO_ORDER* langBarInfo,
wStream* s)
{
2013-10-16 23:32:33 +04:00
RailClientContext* context = rail_get_client_interface(rail);
UINT error;
2013-10-16 23:32:33 +04:00
2017-12-20 17:00:21 +03:00
if (!context || !langBarInfo)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_langbar_info_order(s, langBarInfo)))
{
WLog_ERR(TAG, "rail_read_langbar_info_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-10-16 23:32:33 +04:00
if (context->custom)
{
2015-06-08 19:04:05 +03:00
IFCALLRET(context->ServerLanguageBarInfo, error, context, langBarInfo);
if (error)
WLog_ERR(TAG, "context.ServerLanguageBarInfo failed with error %"PRIu32"", error);
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_order_recv(railPlugin* rail, wStream* s)
{
UINT16 orderType;
UINT16 orderLength;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !s)
return ERROR_INVALID_PARAMETER;
2015-06-08 19:04:05 +03:00
if ((error = rail_read_pdu_header(s, &orderType, &orderLength)))
{
WLog_ERR(TAG, "rail_read_pdu_header failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
WLog_Print(rail->log, WLOG_DEBUG, "Received %s PDU, length:%"PRIu16"",
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
2011-08-11 02:08:44 +04:00
switch (orderType)
{
case RDP_RAIL_ORDER_HANDSHAKE:
{
RAIL_HANDSHAKE_ORDER handshake;
return rail_recv_handshake_order(rail, &handshake, s);
}
case RDP_RAIL_ORDER_HANDSHAKE_EX:
{
RAIL_HANDSHAKE_EX_ORDER handshakeEx;
return rail_recv_handshake_ex_order(rail, &handshakeEx, s);
}
case RDP_RAIL_ORDER_EXEC_RESULT:
{
2018-05-04 13:36:18 +03:00
RAIL_EXEC_RESULT_ORDER execResult = { 0 };
error = rail_recv_exec_result_order(rail, &execResult, s);
free(execResult.exeOrFile.string);
return error;
}
case RDP_RAIL_ORDER_SYSPARAM:
{
RAIL_SYSPARAM_ORDER sysparam;
return rail_recv_server_sysparam_order(rail, &sysparam, s);
}
case RDP_RAIL_ORDER_MINMAXINFO:
{
RAIL_MINMAXINFO_ORDER minMaxInfo;
return rail_recv_server_minmaxinfo_order(rail, &minMaxInfo, s);
}
case RDP_RAIL_ORDER_LOCALMOVESIZE:
{
RAIL_LOCALMOVESIZE_ORDER localMoveSize;
return rail_recv_server_localmovesize_order(rail, &localMoveSize, s);
}
case RDP_RAIL_ORDER_GET_APPID_RESP:
{
RAIL_GET_APPID_RESP_ORDER getAppIdResp;
return rail_recv_server_get_appid_resp_order(rail, &getAppIdResp, s);
}
case RDP_RAIL_ORDER_LANGBARINFO:
{
RAIL_LANGBAR_INFO_ORDER langBarInfo;
return rail_recv_langbar_info_order(rail, &langBarInfo, s);
}
default:
WLog_ERR(TAG, "Unknown RAIL PDU order reveived.");
2015-06-08 19:04:05 +03:00
return ERROR_INVALID_DATA;
}
2013-10-10 06:38:26 +04:00
2015-06-08 19:04:05 +03:00
return CHANNEL_RC_OK;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_handshake_order(railPlugin* rail, RAIL_HANDSHAKE_ORDER* handshake)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !handshake)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_HANDSHAKE_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2013-10-16 22:58:45 +04:00
rail_write_handshake_order(s, handshake);
2015-06-08 19:04:05 +03:00
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_HANDSHAKE);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_handshake_ex_order(railPlugin* rail, RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !handshakeEx)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_HANDSHAKE_EX_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
rail_write_handshake_ex_order(s, handshakeEx);
2015-06-08 19:04:05 +03:00
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_HANDSHAKE_EX);
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_status_order(railPlugin* rail, RAIL_CLIENT_STATUS_ORDER* clientStatus)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !clientStatus)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_CLIENT_STATUS_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_client_status_order(s, clientStatus);
if (error == ERROR_SUCCESS)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_CLIENTSTATUS);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_exec_order(railPlugin* rail, RAIL_EXEC_ORDER* exec)
{
wStream* s;
UINT error;
2015-06-08 19:04:05 +03:00
size_t length;
2017-12-20 17:00:21 +03:00
if (!rail || !exec)
return ERROR_INVALID_PARAMETER;
length = RAIL_EXEC_ORDER_LENGTH +
exec->exeOrFile.length +
exec->workingDir.length +
exec->arguments.length;
s = rail_pdu_init(length);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2015-06-08 19:04:05 +03:00
if ((error = rail_write_client_exec_order(s, exec)))
{
WLog_ERR(TAG, "rail_write_client_exec_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2015-06-08 19:04:05 +03:00
if ((error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_EXEC)))
{
WLog_ERR(TAG, "rail_send_pdu failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_send_client_sysparam_order(railPlugin* rail, RAIL_SYSPARAM_ORDER* sysparam)
{
wStream* s;
2017-12-20 17:00:21 +03:00
size_t length = RAIL_SYSPARAM_ORDER_LENGTH;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !sysparam)
return ERROR_INVALID_PARAMETER;
2013-10-16 22:58:45 +04:00
switch (sysparam->param)
{
case SPI_SET_DRAG_FULL_WINDOWS:
case SPI_SET_KEYBOARD_CUES:
case SPI_SET_KEYBOARD_PREF:
case SPI_SET_MOUSE_BUTTON_SWAP:
length += 1;
break;
case SPI_SET_WORK_AREA:
case SPI_DISPLAY_CHANGE:
case SPI_TASKBAR_POS:
length += 8;
break;
case SPI_SET_HIGH_CONTRAST:
2013-10-16 22:58:45 +04:00
length += sysparam->highContrast.colorSchemeLength + 10;
break;
default:
length += 8;
break;
}
s = rail_pdu_init(length);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2015-06-08 19:04:05 +03:00
if ((error = rail_write_client_sysparam_order(s, sysparam)))
{
WLog_ERR(TAG, "rail_write_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
if ((error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_SYSPARAM)))
{
WLog_ERR(TAG, "rail_send_pdu failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
2017-12-20 17:00:21 +03:00
static UINT rail_send_client_sysparams_order(railPlugin* rail, RAIL_SYSPARAM_ORDER* sysparam)
{
UINT error = CHANNEL_RC_OK;
2017-12-20 17:00:21 +03:00
if (!rail || !sysparam)
return ERROR_INVALID_PARAMETER;
2013-10-16 22:58:45 +04:00
if (sysparam->params & SPI_MASK_SET_HIGH_CONTRAST)
{
2013-10-16 22:58:45 +04:00
sysparam->param = SPI_SET_HIGH_CONTRAST;
2015-06-08 19:04:05 +03:00
if ((error = rail_send_client_sysparam_order(rail, sysparam)))
{
WLog_ERR(TAG, "rail_send_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
}
2013-10-16 22:58:45 +04:00
if (sysparam->params & SPI_MASK_TASKBAR_POS)
{
2013-10-16 22:58:45 +04:00
sysparam->param = SPI_TASKBAR_POS;
2015-06-08 19:04:05 +03:00
if ((error = rail_send_client_sysparam_order(rail, sysparam)))
{
WLog_ERR(TAG, "rail_send_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
}
2013-10-16 22:58:45 +04:00
if (sysparam->params & SPI_MASK_SET_MOUSE_BUTTON_SWAP)
{
2013-10-16 22:58:45 +04:00
sysparam->param = SPI_SET_MOUSE_BUTTON_SWAP;
2015-06-08 19:04:05 +03:00
if ((error = rail_send_client_sysparam_order(rail, sysparam)))
{
WLog_ERR(TAG, "rail_send_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
}
2013-10-16 22:58:45 +04:00
if (sysparam->params & SPI_MASK_SET_KEYBOARD_PREF)
{
2013-10-16 22:58:45 +04:00
sysparam->param = SPI_SET_KEYBOARD_PREF;
2015-06-08 19:04:05 +03:00
if ((error = rail_send_client_sysparam_order(rail, sysparam)))
{
WLog_ERR(TAG, "rail_send_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
}
2013-10-16 22:58:45 +04:00
if (sysparam->params & SPI_MASK_SET_DRAG_FULL_WINDOWS)
{
2013-10-16 22:58:45 +04:00
sysparam->param = SPI_SET_DRAG_FULL_WINDOWS;
2015-06-08 19:04:05 +03:00
if ((error = rail_send_client_sysparam_order(rail, sysparam)))
{
WLog_ERR(TAG, "rail_send_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
}
2013-10-16 22:58:45 +04:00
if (sysparam->params & SPI_MASK_SET_KEYBOARD_CUES)
{
2013-10-16 22:58:45 +04:00
sysparam->param = SPI_SET_KEYBOARD_CUES;
2015-06-08 19:04:05 +03:00
if ((error = rail_send_client_sysparam_order(rail, sysparam)))
{
WLog_ERR(TAG, "rail_send_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
}
2013-10-16 22:58:45 +04:00
if (sysparam->params & SPI_MASK_SET_WORK_AREA)
{
2013-10-16 22:58:45 +04:00
sysparam->param = SPI_SET_WORK_AREA;
2015-06-08 19:04:05 +03:00
if ((error = rail_send_client_sysparam_order(rail, sysparam)))
{
WLog_ERR(TAG, "rail_send_client_sysparam_order failed with error %"PRIu32"!", error);
2015-06-08 19:04:05 +03:00
return error;
}
}
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_activate_order(railPlugin* rail, RAIL_ACTIVATE_ORDER* activate)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !activate)
return ERROR_INVALID_PARAMETER;
2017-12-23 12:26:25 +03:00
s = rail_pdu_init(RAIL_ACTIVATE_ORDER_LENGTH);
2017-12-20 17:00:21 +03:00
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_client_activate_order(s, activate);
if (error == ERROR_SUCCESS)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_ACTIVATE);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_sysmenu_order(railPlugin* rail, RAIL_SYSMENU_ORDER* sysmenu)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !sysmenu)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_SYSMENU_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_client_sysmenu_order(s, sysmenu);
if (error == ERROR_SUCCESS)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_SYSMENU);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_syscommand_order(railPlugin* rail, RAIL_SYSCOMMAND_ORDER* syscommand)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !syscommand)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_SYSCOMMAND_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_client_syscommand_order(s, syscommand);
if (error == ERROR_SUCCESS)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_SYSCOMMAND);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_notify_event_order(railPlugin* rail, RAIL_NOTIFY_EVENT_ORDER* notifyEvent)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !notifyEvent)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_NOTIFY_EVENT_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_client_notify_event_order(s, notifyEvent);
if (ERROR_SUCCESS == error)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_NOTIFY_EVENT);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_window_move_order(railPlugin* rail, RAIL_WINDOW_MOVE_ORDER* windowMove)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !windowMove)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_WINDOW_MOVE_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_client_window_move_order(s, windowMove);
if (error == ERROR_SUCCESS)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_WINDOWMOVE);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_get_appid_req_order(railPlugin* rail, RAIL_GET_APPID_REQ_ORDER* getAppIdReq)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !getAppIdReq)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_GET_APPID_REQ_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_client_get_appid_req_order(s, getAppIdReq);
if (error == ERROR_SUCCESS)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_GET_APPID_REQ);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rail_send_client_langbar_info_order(railPlugin* rail, RAIL_LANGBAR_INFO_ORDER* langBarInfo)
{
wStream* s;
UINT error;
2017-12-20 17:00:21 +03:00
if (!rail || !langBarInfo)
return ERROR_INVALID_PARAMETER;
s = rail_pdu_init(RAIL_LANGBAR_INFO_ORDER_LENGTH);
if (!s)
2015-06-08 19:04:05 +03:00
{
WLog_ERR(TAG, "rail_pdu_init failed!");
return CHANNEL_RC_NO_MEMORY;
}
2017-12-20 17:00:21 +03:00
error = rail_write_langbar_info_order(s, langBarInfo);
if (ERROR_SUCCESS == error)
error = rail_send_pdu(rail, s, RDP_RAIL_ORDER_LANGBARINFO);
2013-05-09 01:48:30 +04:00
Stream_Free(s, TRUE);
2015-06-08 19:04:05 +03:00
return error;
}