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>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2011-08-11 22:06:19 +04:00
|
|
|
#include <freerdp/utils/rail.h>
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
#include "rail_orders.h"
|
|
|
|
|
2011-08-11 02:08:44 +04:00
|
|
|
#define RAIL_ORDER_TYPE_EXEC 0x0001
|
|
|
|
#define RAIL_ORDER_TYPE_ACTIVATE 0x0002
|
|
|
|
#define RAIL_ORDER_TYPE_SYSPARAM 0x0003
|
|
|
|
#define RAIL_ORDER_TYPE_SYSCOMMAND 0x0004
|
|
|
|
#define RAIL_ORDER_TYPE_HANDSHAKE 0x0005
|
|
|
|
#define RAIL_ORDER_TYPE_NOTIFY_EVENT 0x0006
|
|
|
|
#define RAIL_ORDER_TYPE_WINDOW_MOVE 0x0008
|
|
|
|
#define RAIL_ORDER_TYPE_LOCALMOVESIZE 0x0009
|
|
|
|
#define RAIL_ORDER_TYPE_MINMAXINFO 0x000A
|
|
|
|
#define RAIL_ORDER_TYPE_CLIENT_STATUS 0x000B
|
|
|
|
#define RAIL_ORDER_TYPE_SYSMENU 0x000C
|
|
|
|
#define RAIL_ORDER_TYPE_LANGBAR_INFO 0x000D
|
|
|
|
#define RAIL_ORDER_TYPE_EXEC_RESULT 0x0080
|
|
|
|
#define RAIL_ORDER_TYPE_GET_APPID_REQ 0x000E
|
|
|
|
#define RAIL_ORDER_TYPE_GET_APPID_RESP 0x000F
|
|
|
|
|
2011-12-01 04:11:27 +04:00
|
|
|
static const char* const RAIL_ORDER_TYPE_STRINGS[] =
|
2011-08-11 02:08:44 +04:00
|
|
|
{
|
|
|
|
"",
|
|
|
|
"Execute",
|
|
|
|
"Activate",
|
|
|
|
"System Parameters Update",
|
|
|
|
"System Command",
|
|
|
|
"Handshake",
|
|
|
|
"Notify Event",
|
|
|
|
"",
|
|
|
|
"Window Move",
|
|
|
|
"Local Move/Size",
|
|
|
|
"Min Max Info",
|
|
|
|
"Client Status",
|
|
|
|
"System Menu",
|
|
|
|
"Language Bar Info",
|
|
|
|
"Get Application ID Request",
|
|
|
|
"Get Application ID Response",
|
|
|
|
"Execute Result"
|
|
|
|
};
|
|
|
|
|
2012-06-20 01:26:37 +04:00
|
|
|
void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_UNICODE_STRING* unicode_string)
|
2011-08-12 00:27:16 +04:00
|
|
|
{
|
2013-01-11 00:30:32 +04:00
|
|
|
WCHAR* buffer = NULL;
|
2012-09-24 03:49:13 +04:00
|
|
|
int length = 0;
|
2011-08-12 00:27:16 +04:00
|
|
|
|
2011-08-13 07:16:44 +04:00
|
|
|
if (unicode_string->string != NULL)
|
2012-10-09 07:21:26 +04:00
|
|
|
free(unicode_string->string);
|
2011-08-13 07:16:44 +04:00
|
|
|
|
2011-08-12 00:27:16 +04:00
|
|
|
unicode_string->string = NULL;
|
|
|
|
unicode_string->length = 0;
|
|
|
|
|
2011-08-13 07:16:44 +04:00
|
|
|
if (string == NULL || strlen(string) < 1)
|
2011-08-12 00:27:16 +04:00
|
|
|
return;
|
|
|
|
|
2012-12-17 19:20:25 +04:00
|
|
|
length = ConvertToUnicode(CP_UTF8, 0, string, -1, &buffer, 0) * 2;
|
2011-08-12 00:27:16 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
unicode_string->string = (BYTE*) buffer;
|
|
|
|
unicode_string->length = (UINT16) length;
|
2011-08-12 00:27:16 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, *orderType); /* orderType (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_pdu_header(wStream* s, UINT16 orderType, UINT16 orderLength)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, orderType); /* orderType (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* rail_pdu_init(int length)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2013-05-09 01:48:30 +04:00
|
|
|
s = Stream_New(NULL, length + RAIL_PDU_HEADER_LENGTH);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, RAIL_PDU_HEADER_LENGTH);
|
2011-08-11 00:33:15 +04:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_send_pdu(rdpRailOrder* rail_order, wStream* s, UINT16 orderType)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 orderLength;
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
orderLength = Stream_GetPosition(s);
|
|
|
|
Stream_SetPosition(s, 0);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
rail_write_pdu_header(s, orderType, orderLength);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_SetPosition(s, orderLength);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
/* send */
|
2011-09-02 21:29:17 +04:00
|
|
|
DEBUG_RAIL("Sending %s PDU, length:%d",
|
2011-08-11 22:06:19 +04:00
|
|
|
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
2011-08-11 02:08:44 +04:00
|
|
|
|
2013-05-15 20:14:26 +04:00
|
|
|
rail_send_channel_data(rail_order->plugin, Stream_Buffer(s), orderLength);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_high_contrast(wStream* s, HIGH_CONTRAST* high_contrast)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2011-08-11 22:06:19 +04:00
|
|
|
high_contrast->colorSchemeLength = high_contrast->colorScheme.length + 2;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, high_contrast->flags); /* flags (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, high_contrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */
|
2011-08-11 22:06:19 +04:00
|
|
|
rail_write_unicode_string(s, &high_contrast->colorScheme); /* colorScheme */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_server_exec_result_order(wStream* s, RAIL_EXEC_RESULT_ORDER* exec_result)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, exec_result->flags); /* flags (2 bytes) */
|
|
|
|
Stream_Read_UINT16(s, exec_result->execResult); /* execResult (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, exec_result->rawResult); /* rawResult (4 bytes) */
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* padding (2 bytes) */
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_read_unicode_string(s, &exec_result->exeOrFile); /* exeOrFile */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_server_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE body;
|
2013-01-11 04:31:48 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 5)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
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) */
|
2011-08-18 05:33:22 +04:00
|
|
|
|
|
|
|
switch (sysparam->param)
|
|
|
|
{
|
|
|
|
case SPI_SET_SCREEN_SAVE_ACTIVE:
|
2012-10-09 10:31:28 +04:00
|
|
|
sysparam->setScreenSaveActive = (body != 0) ? TRUE : FALSE;
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SPI_SET_SCREEN_SAVE_SECURE:
|
2012-10-09 10:31:28 +04:00
|
|
|
sysparam->setScreenSaveSecure = (body != 0) ? TRUE : FALSE;
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_server_minmaxinfo_order(wStream* s, RAIL_MINMAXINFO_ORDER* minmaxinfo)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 20)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
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) */
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_server_localmovesize_order(wStream* s, RAIL_LOCALMOVESIZE_ORDER* localmovesize)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 isMoveSizeStart;
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 12)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, localmovesize->windowId); /* windowId (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */
|
2012-10-09 10:31:28 +04:00
|
|
|
localmovesize->isMoveSizeStart = (isMoveSizeStart != 0) ? TRUE : FALSE;
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
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) */
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_server_get_appid_resp_order(wStream* s, RAIL_GET_APPID_RESP_ORDER* get_appid_resp)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 516)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, get_appid_resp->windowId); /* windowId (4 bytes) */
|
|
|
|
Stream_Read(s, &get_appid_resp->applicationIdBuffer[0], 512); /* applicationId (256 UNICODE chars) */
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2011-08-21 05:09:13 +04:00
|
|
|
get_appid_resp->applicationId.length = 512;
|
2011-08-22 03:01:40 +04:00
|
|
|
get_appid_resp->applicationId.string = &get_appid_resp->applicationIdBuffer[0];
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_read_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* client_status)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, client_status->flags); /* flags (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_exec_order(wStream* s, RAIL_EXEC_ORDER* exec)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
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) */
|
2011-08-11 02:08:44 +04:00
|
|
|
rail_write_unicode_string_value(s, &exec->exeOrFile); /* exeOrFile */
|
|
|
|
rail_write_unicode_string_value(s, &exec->workingDir); /* workingDir */
|
|
|
|
rail_write_unicode_string_value(s, &exec->arguments); /* arguments */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE body;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2011-08-18 05:33:22 +04:00
|
|
|
switch (sysparam->param)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
|
|
|
case SPI_SET_DRAG_FULL_WINDOWS:
|
2011-08-18 05:33:22 +04:00
|
|
|
body = sysparam->dragFullWindows;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, body);
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-11 00:33:15 +04:00
|
|
|
case SPI_SET_KEYBOARD_CUES:
|
2011-08-18 05:33:22 +04:00
|
|
|
body = sysparam->keyboardCues;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, body);
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-11 00:33:15 +04:00
|
|
|
case SPI_SET_KEYBOARD_PREF:
|
2011-08-18 05:33:22 +04:00
|
|
|
body = sysparam->keyboardPref;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, body);
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-11 00:33:15 +04:00
|
|
|
case SPI_SET_MOUSE_BUTTON_SWAP:
|
2011-08-18 05:33:22 +04:00
|
|
|
body = sysparam->mouseButtonSwap;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, body);
|
2011-08-11 00:33:15 +04:00
|
|
|
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) */
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-11 00:33:15 +04:00
|
|
|
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) */
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
|
|
|
|
2011-08-11 00:33:15 +04:00
|
|
|
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) */
|
2011-08-11 00:33:15 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SPI_SET_HIGH_CONTRAST:
|
2011-08-11 22:06:19 +04:00
|
|
|
rail_write_high_contrast(s, &sysparam->highContrast);
|
2011-08-11 00:33:15 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_activate_order(wStream* s, RAIL_ACTIVATE_ORDER* activate)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE enabled;
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, activate->windowId); /* windowId (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
enabled = activate->enabled;
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT8(s, enabled); /* enabled (1 byte) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_sysmenu_order(wStream* s, RAIL_SYSMENU_ORDER* sysmenu)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
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) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_syscommand_order(wStream* s, RAIL_SYSCOMMAND_ORDER* syscommand)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
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) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_notify_event_order(wStream* s, RAIL_NOTIFY_EVENT_ORDER* notify_event)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, notify_event->windowId); /* windowId (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, notify_event->notifyIconId); /* notifyIconId (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, notify_event->message); /* notifyIconId (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_window_move_order(wStream* s, RAIL_WINDOW_MOVE_ORDER* window_move)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, window_move->windowId); /* windowId (4 bytes) */
|
|
|
|
Stream_Write_UINT16(s, window_move->left); /* left (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, window_move->top); /* top (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, window_move->right); /* right (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, window_move->bottom); /* bottom (2 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_client_get_appid_req_order(wStream* s, RAIL_GET_APPID_REQ_ORDER* get_appid_req)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, get_appid_req->windowId); /* windowId (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rail_write_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_recv_handshake_order(rdpRailOrder* rail_order, wStream* s)
|
2011-08-12 00:27:16 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_handshake_order(s, &rail_order->handshake))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2011-08-12 00:27:16 +04:00
|
|
|
|
2011-08-15 01:05:34 +04:00
|
|
|
rail_order->handshake.buildNumber = 0x00001DB0;
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_send_handshake_order(rail_order);
|
2011-08-12 00:27:16 +04:00
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_order->client_status.flags = RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE;
|
|
|
|
rail_send_client_status_order(rail_order);
|
2011-08-12 00:27:16 +04:00
|
|
|
|
|
|
|
/* sysparam update */
|
|
|
|
|
2011-08-18 05:33:22 +04:00
|
|
|
rail_order->sysparam.params = 0;
|
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
rail_order->sysparam.params |= SPI_MASK_SET_HIGH_CONTRAST;
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_order->sysparam.highContrast.colorScheme.string = NULL;
|
|
|
|
rail_order->sysparam.highContrast.colorScheme.length = 0;
|
|
|
|
rail_order->sysparam.highContrast.flags = 0x7E;
|
2011-08-12 00:27:16 +04:00
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
rail_order->sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
|
2012-10-09 10:31:28 +04:00
|
|
|
rail_order->sysparam.mouseButtonSwap = FALSE;
|
2011-08-18 05:33:22 +04:00
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
rail_order->sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
|
2012-10-09 10:31:28 +04:00
|
|
|
rail_order->sysparam.keyboardPref = FALSE;
|
2011-08-18 05:33:22 +04:00
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
rail_order->sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
|
2012-10-09 10:31:28 +04:00
|
|
|
rail_order->sysparam.dragFullWindows = FALSE;
|
2011-08-18 05:33:22 +04:00
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
rail_order->sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
|
2012-10-09 10:31:28 +04:00
|
|
|
rail_order->sysparam.keyboardCues = FALSE;
|
2011-08-18 05:33:22 +04:00
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
rail_order->sysparam.params |= SPI_MASK_SET_WORK_AREA;
|
2011-08-18 05:33:22 +04:00
|
|
|
rail_order->sysparam.workArea.left = 0;
|
|
|
|
rail_order->sysparam.workArea.top = 0;
|
|
|
|
rail_order->sysparam.workArea.right = 1024;
|
|
|
|
rail_order->sysparam.workArea.bottom = 768;
|
|
|
|
|
2011-08-19 16:42:14 +04:00
|
|
|
rail_send_channel_event(rail_order->plugin,
|
2013-03-29 04:23:16 +04:00
|
|
|
RailChannel_GetSystemParam, &rail_order->sysparam);
|
|
|
|
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-12 00:27:16 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_recv_exec_result_order(rdpRailOrder* rail_order, wStream* s)
|
2011-08-19 18:10:08 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_server_exec_result_order(s, &rail_order->exec_result))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-03-29 04:23:16 +04:00
|
|
|
|
2011-08-19 18:10:08 +04:00
|
|
|
rail_send_channel_event(rail_order->plugin,
|
2013-03-29 04:23:16 +04:00
|
|
|
RailChannel_ServerExecuteResult, &rail_order->exec_result);
|
|
|
|
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_recv_server_sysparam_order(rdpRailOrder* rail_order, wStream* s)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_server_sysparam_order(s, &rail_order->sysparam))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-03-29 04:23:16 +04:00
|
|
|
|
2011-08-20 02:46:10 +04:00
|
|
|
rail_send_channel_event(rail_order->plugin,
|
2013-03-29 04:23:16 +04:00
|
|
|
RailChannel_ServerSystemParam, &rail_order->sysparam);
|
|
|
|
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_recv_server_minmaxinfo_order(rdpRailOrder* rail_order, wStream* s)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_server_minmaxinfo_order(s, &rail_order->minmaxinfo))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-03-29 04:23:16 +04:00
|
|
|
|
2011-08-20 02:46:10 +04:00
|
|
|
rail_send_channel_event(rail_order->plugin,
|
2013-03-29 04:23:16 +04:00
|
|
|
RailChannel_ServerMinMaxInfo, &rail_order->minmaxinfo);
|
|
|
|
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_recv_server_localmovesize_order(rdpRailOrder* rail_order, wStream* s)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_server_localmovesize_order(s, &rail_order->localmovesize))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-03-29 04:23:16 +04:00
|
|
|
|
2011-08-20 02:46:10 +04:00
|
|
|
rail_send_channel_event(rail_order->plugin,
|
2013-03-29 04:23:16 +04:00
|
|
|
RailChannel_ServerLocalMoveSize, &rail_order->localmovesize);
|
|
|
|
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_recv_server_get_appid_resp_order(rdpRailOrder* rail_order, wStream* s)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_server_get_appid_resp_order(s, &rail_order->get_appid_resp))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-03-29 04:23:16 +04:00
|
|
|
|
2011-08-20 02:46:10 +04:00
|
|
|
rail_send_channel_event(rail_order->plugin,
|
2013-03-29 04:23:16 +04:00
|
|
|
RailChannel_ServerGetAppIdResponse, &rail_order->get_appid_resp);
|
|
|
|
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_recv_langbar_info_order(rdpRailOrder* rail_order, wStream* s)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_langbar_info_order(s, &rail_order->langbar_info))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2013-03-29 04:23:16 +04:00
|
|
|
|
2011-08-20 02:46:10 +04:00
|
|
|
rail_send_channel_event(rail_order->plugin,
|
2013-03-29 04:23:16 +04:00
|
|
|
RailChannel_ServerLanguageBarInfo, &rail_order->langbar_info);
|
|
|
|
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-19 18:10:08 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rail_order_recv(rdpRailOrder* rail_order, wStream* s)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 orderType;
|
|
|
|
UINT16 orderLength;
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
if (!rail_read_pdu_header(s, &orderType, &orderLength))
|
2013-01-11 04:31:48 +04:00
|
|
|
return FALSE;
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2011-09-02 21:29:17 +04:00
|
|
|
DEBUG_RAIL("Received %s PDU, length:%d",
|
2011-08-11 22:06:19 +04:00
|
|
|
RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
|
2011-08-11 02:08:44 +04:00
|
|
|
|
2011-08-11 00:33:15 +04:00
|
|
|
switch (orderType)
|
|
|
|
{
|
|
|
|
case RDP_RAIL_ORDER_HANDSHAKE:
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_recv_handshake_order(rail_order, s);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
case RDP_RAIL_ORDER_EXEC_RESULT:
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_recv_exec_result_order(rail_order, s);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
case RDP_RAIL_ORDER_SYSPARAM:
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_recv_server_sysparam_order(rail_order, s);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
case RDP_RAIL_ORDER_MINMAXINFO:
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_recv_server_minmaxinfo_order(rail_order, s);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
case RDP_RAIL_ORDER_LOCALMOVESIZE:
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_recv_server_localmovesize_order(rail_order, s);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
case RDP_RAIL_ORDER_GET_APPID_RESP:
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_recv_server_get_appid_resp_order(rail_order, s);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
case RDP_RAIL_ORDER_LANGBARINFO:
|
2013-01-11 04:31:48 +04:00
|
|
|
return rail_recv_langbar_info_order(rail_order, s);
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
default:
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "Unknown RAIL PDU order reveived.");
|
2011-08-11 00:33:15 +04:00
|
|
|
break;
|
|
|
|
}
|
2013-01-11 04:31:48 +04:00
|
|
|
return TRUE;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_handshake_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_HANDSHAKE_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_handshake_order(s, &rail_order->handshake);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_HANDSHAKE);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_status_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_CLIENT_STATUS_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_status_order(s, &rail_order->client_status);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_CLIENT_STATUS);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_exec_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
int length;
|
|
|
|
|
|
|
|
length = RAIL_EXEC_ORDER_LENGTH +
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_order->exec.exeOrFile.length +
|
|
|
|
rail_order->exec.workingDir.length +
|
|
|
|
rail_order->exec.arguments.length;
|
2011-08-11 00:33:15 +04:00
|
|
|
|
|
|
|
s = rail_pdu_init(RAIL_EXEC_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_exec_order(s, &rail_order->exec);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_EXEC);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_sysparam_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
int length;
|
|
|
|
|
|
|
|
length = RAIL_SYSPARAM_ORDER_LENGTH;
|
|
|
|
|
2011-08-18 05:33:22 +04:00
|
|
|
switch (rail_order->sysparam.param)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
|
|
|
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:
|
2011-08-12 12:15:04 +04:00
|
|
|
length += rail_order->sysparam.highContrast.colorSchemeLength + 10;
|
2011-08-11 00:33:15 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-08-12 12:46:40 +04:00
|
|
|
s = rail_pdu_init(RAIL_SYSPARAM_ORDER_LENGTH + 8);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_sysparam_order(s, &rail_order->sysparam);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_SYSPARAM);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-18 05:33:22 +04:00
|
|
|
void rail_send_client_sysparams_order(rdpRailOrder* rail_order)
|
|
|
|
{
|
2011-08-19 17:42:58 +04:00
|
|
|
if (rail_order->sysparam.params & SPI_MASK_SET_HIGH_CONTRAST)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
|
|
|
rail_order->sysparam.param = SPI_SET_HIGH_CONTRAST;
|
|
|
|
rail_send_client_sysparam_order(rail_order);
|
|
|
|
}
|
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
if (rail_order->sysparam.params & SPI_MASK_TASKBAR_POS)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
|
|
|
rail_order->sysparam.param = SPI_TASKBAR_POS;
|
|
|
|
rail_send_client_sysparam_order(rail_order);
|
|
|
|
}
|
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
if (rail_order->sysparam.params & SPI_MASK_SET_MOUSE_BUTTON_SWAP)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
|
|
|
rail_order->sysparam.param = SPI_SET_MOUSE_BUTTON_SWAP;
|
|
|
|
rail_send_client_sysparam_order(rail_order);
|
|
|
|
}
|
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
if (rail_order->sysparam.params & SPI_MASK_SET_KEYBOARD_PREF)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
|
|
|
rail_order->sysparam.param = SPI_SET_KEYBOARD_PREF;
|
|
|
|
rail_send_client_sysparam_order(rail_order);
|
|
|
|
}
|
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
if (rail_order->sysparam.params & SPI_MASK_SET_DRAG_FULL_WINDOWS)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
|
|
|
rail_order->sysparam.param = SPI_SET_DRAG_FULL_WINDOWS;
|
|
|
|
rail_send_client_sysparam_order(rail_order);
|
|
|
|
}
|
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
if (rail_order->sysparam.params & SPI_MASK_SET_KEYBOARD_CUES)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
|
|
|
rail_order->sysparam.param = SPI_SET_KEYBOARD_CUES;
|
|
|
|
rail_send_client_sysparam_order(rail_order);
|
|
|
|
}
|
|
|
|
|
2011-08-19 17:42:58 +04:00
|
|
|
if (rail_order->sysparam.params & SPI_MASK_SET_WORK_AREA)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
|
|
|
rail_order->sysparam.param = SPI_SET_WORK_AREA;
|
|
|
|
rail_send_client_sysparam_order(rail_order);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_activate_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_ACTIVATE_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_activate_order(s, &rail_order->activate);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_ACTIVATE);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_sysmenu_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_SYSMENU_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_sysmenu_order(s, &rail_order->sysmenu);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_SYSMENU);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_syscommand_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_SYSCOMMAND_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_syscommand_order(s, &rail_order->syscommand);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_SYSCOMMAND);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_notify_event_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_NOTIFY_EVENT_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_notify_event_order(s, &rail_order->notify_event);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_NOTIFY_EVENT);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_window_move_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_WINDOW_MOVE_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_window_move_order(s, &rail_order->window_move);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_WINDOW_MOVE);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_get_appid_req_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_GET_APPID_REQ_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_client_get_appid_req_order(s, &rail_order->get_appid_req);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_GET_APPID_REQ);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_send_client_langbar_info_order(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-11 00:33:15 +04:00
|
|
|
s = rail_pdu_init(RAIL_LANGBAR_INFO_ORDER_LENGTH);
|
2011-08-12 12:15:04 +04:00
|
|
|
rail_write_langbar_info_order(s, &rail_order->langbar_info);
|
|
|
|
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_LANGBAR_INFO);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
rdpRailOrder* rail_order_new()
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2011-08-12 12:15:04 +04:00
|
|
|
rdpRailOrder* rail_order;
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
rail_order = (rdpRailOrder*) malloc(sizeof(rdpRailOrder));
|
|
|
|
ZeroMemory(rail_order, sizeof(rdpRailOrder));
|
2011-08-11 00:33:15 +04:00
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
if (rail_order != NULL)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-09-24 02:41:07 +04:00
|
|
|
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
return rail_order;
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:15:04 +04:00
|
|
|
void rail_order_free(rdpRailOrder* rail_order)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2011-08-12 12:15:04 +04:00
|
|
|
if (rail_order != NULL)
|
2011-08-11 00:33:15 +04:00
|
|
|
{
|
2012-09-24 02:41:07 +04:00
|
|
|
|
2012-10-09 07:21:26 +04:00
|
|
|
free(rail_order);
|
2011-08-11 00:33:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|