2011-08-10 01:42:10 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-08-10 01:42:10 +04:00
|
|
|
* RAIL Virtual Channel Plugin
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
* Copyright 2011 Roman Barabanov <romanbarabanov@gmail.com>
|
|
|
|
* Copyright 2011 Vic Lee
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-08-10 01:42:10 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2012-08-15 01:09:01 +04:00
|
|
|
|
2012-10-09 04:26:11 +04:00
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2011-08-10 01:42:10 +04:00
|
|
|
#include <freerdp/types.h>
|
2012-10-09 04:26:11 +04:00
|
|
|
#include <freerdp/constants.h>
|
2011-08-10 01:42:10 +04:00
|
|
|
#include <freerdp/utils/svc_plugin.h>
|
2011-08-22 03:04:21 +04:00
|
|
|
#include <freerdp/utils/rail.h>
|
2011-08-10 01:42:10 +04:00
|
|
|
#include <freerdp/rail.h>
|
|
|
|
|
2011-08-12 00:27:16 +04:00
|
|
|
#include "rail_orders.h"
|
2011-08-10 01:42:10 +04:00
|
|
|
#include "rail_main.h"
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
RailClientContext* rail_get_client_interface(void* railObject)
|
|
|
|
{
|
|
|
|
RailClientContext* pInterface;
|
|
|
|
rdpSvcPlugin* plugin = (rdpSvcPlugin*) railObject;
|
2013-12-06 01:55:28 +04:00
|
|
|
pInterface = (RailClientContext*) plugin->channel_entry_points.pInterface;
|
2013-10-15 07:16:40 +04:00
|
|
|
return pInterface;
|
|
|
|
}
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
void rail_send_channel_data(void* railObject, void* data, size_t length)
|
2011-08-10 01:42:10 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s = NULL;
|
2013-10-12 01:09:36 +04:00
|
|
|
railPlugin* plugin = (railPlugin*) railObject;
|
2011-08-10 01:42:10 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
s = Stream_New(NULL, length);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write(s, data, length);
|
2011-08-10 01:42:10 +04:00
|
|
|
|
|
|
|
svc_plugin_send((rdpSvcPlugin*) plugin, s);
|
|
|
|
}
|
|
|
|
|
2013-03-29 05:13:56 +04:00
|
|
|
static void on_free_rail_channel_event(wMessage* event)
|
2011-08-10 01:42:10 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
rail_free_cloned_order(GetMessageType(event->id), event->wParam);
|
2011-08-10 01:42:10 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
void rail_send_channel_event(void* railObject, UINT16 eventType, void* param)
|
2011-08-10 01:42:10 +04:00
|
|
|
{
|
2013-10-12 01:09:36 +04:00
|
|
|
void* payload = NULL;
|
2013-03-29 05:13:56 +04:00
|
|
|
wMessage* out_event = NULL;
|
2013-10-15 07:16:40 +04:00
|
|
|
railPlugin* plugin = (railPlugin*) railObject;
|
2011-08-22 03:04:21 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
payload = rail_clone_order(eventType, param);
|
2011-10-21 22:08:31 +04:00
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
if (payload)
|
2011-08-22 03:04:21 +04:00
|
|
|
{
|
2013-10-15 07:16:40 +04:00
|
|
|
out_event = freerdp_event_new(RailChannel_Class, eventType,
|
2011-08-22 03:04:21 +04:00
|
|
|
on_free_rail_channel_event, payload);
|
2011-10-21 22:08:31 +04:00
|
|
|
|
2011-08-22 03:04:21 +04:00
|
|
|
svc_plugin_send_event((rdpSvcPlugin*) plugin, out_event);
|
|
|
|
}
|
2011-08-10 01:42:10 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:26:57 +04:00
|
|
|
static void rail_process_connect(rdpSvcPlugin* plugin)
|
2011-08-10 01:42:10 +04:00
|
|
|
{
|
2011-08-12 12:26:57 +04:00
|
|
|
railPlugin* rail = (railPlugin*) plugin;
|
2011-08-10 01:42:10 +04:00
|
|
|
|
2011-08-12 12:26:57 +04:00
|
|
|
rail->rail_order = rail_order_new();
|
2012-11-19 22:26:56 +04:00
|
|
|
rail->rail_order->settings = (rdpSettings*) plugin->channel_entry_points.pExtendedData;
|
2011-08-19 16:42:14 +04:00
|
|
|
rail->rail_order->plugin = rail;
|
2013-10-12 01:36:34 +04:00
|
|
|
|
|
|
|
WLog_Print(rail->log, WLOG_DEBUG, "Connect");
|
2011-08-10 01:42:10 +04:00
|
|
|
}
|
|
|
|
|
2011-08-12 12:26:57 +04:00
|
|
|
static void rail_process_terminate(rdpSvcPlugin* plugin)
|
2011-08-10 01:42:10 +04:00
|
|
|
{
|
2013-10-12 01:36:34 +04:00
|
|
|
railPlugin* rail = (railPlugin*) plugin;
|
2011-08-15 01:05:34 +04:00
|
|
|
|
2013-10-12 01:36:34 +04:00
|
|
|
WLog_Print(rail->log, WLOG_DEBUG, "Terminate");
|
2011-08-12 12:26:57 +04:00
|
|
|
}
|
2011-08-10 01:42:10 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
static void rail_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
2011-08-12 12:26:57 +04:00
|
|
|
{
|
|
|
|
railPlugin* rail = (railPlugin*) plugin;
|
2013-10-16 23:32:33 +04:00
|
|
|
rail_order_recv(rail, s);
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(s, TRUE);
|
2011-08-12 12:26:57 +04:00
|
|
|
}
|
2011-08-10 01:42:10 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_process_addin_args(rdpRailOrder* railOrder, rdpSettings* settings)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2011-10-21 22:08:31 +04:00
|
|
|
char* exeOrFile;
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
exeOrFile = settings->RemoteApplicationProgram;
|
2011-10-21 22:08:31 +04:00
|
|
|
|
|
|
|
if (strlen(exeOrFile) >= 2)
|
|
|
|
{
|
|
|
|
if (strncmp(exeOrFile, "||", 2) != 0)
|
2013-10-15 07:16:40 +04:00
|
|
|
railOrder->exec.flags |= RAIL_EXEC_FLAG_FILE;
|
2011-10-21 22:08:31 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
rail_string_to_unicode_string(settings->RemoteApplicationProgram, &railOrder->exec.exeOrFile);
|
|
|
|
rail_string_to_unicode_string(settings->ShellWorkingDirectory, &railOrder->exec.workingDir);
|
|
|
|
rail_string_to_unicode_string(settings->RemoteApplicationCmdLine, &railOrder->exec.arguments);
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
rail_send_client_exec_order((railPlugin*) railOrder->plugin, &railOrder->exec);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_recv_set_sysparams_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
2011-08-21 05:12:17 +04:00
|
|
|
RAIL_SYSPARAM_ORDER* sysparam;
|
2011-08-18 05:33:22 +04:00
|
|
|
|
|
|
|
/* Send System Parameters */
|
|
|
|
|
2013-03-29 05:13:56 +04:00
|
|
|
sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
|
2013-10-15 07:16:40 +04:00
|
|
|
memmove(&railOrder->sysparam, sysparam, sizeof(RAIL_SYSPARAM_ORDER));
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-16 22:58:45 +04:00
|
|
|
rail_send_client_sysparams_order((railPlugin*) railOrder->plugin, &railOrder->sysparam);
|
2011-08-18 05:33:22 +04:00
|
|
|
|
|
|
|
/* execute */
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
railOrder->exec.flags = RAIL_EXEC_FLAG_EXPAND_ARGUMENTS;
|
2011-08-18 05:33:22 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
rail_process_addin_args(railOrder, railOrder->settings);
|
2011-08-18 05:33:22 +04:00
|
|
|
}
|
|
|
|
|
2013-10-16 22:58:45 +04:00
|
|
|
static void rail_recv_exec_remote_app_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2012-11-19 22:26:56 +04:00
|
|
|
/**
|
|
|
|
* TODO: replace event system by an API to allow the execution
|
|
|
|
* of multiple remote apps over the same connection. RAIL is
|
|
|
|
* always built-in, so clients can safely link to it.
|
|
|
|
*/
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-16 22:58:45 +04:00
|
|
|
//rail_process_addin_args((railPlugin*) railOrder->plugin, data);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_recv_activate_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
RAIL_ACTIVATE_ORDER* activate = (RAIL_ACTIVATE_ORDER*) event->wParam;
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
CopyMemory(&railOrder->activate, activate, sizeof(RAIL_ACTIVATE_ORDER));
|
2013-10-16 22:58:45 +04:00
|
|
|
rail_send_client_activate_order((railPlugin*) railOrder->plugin, &railOrder->activate);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-16 22:58:45 +04:00
|
|
|
static void rail_recv_sysmenu_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
RAIL_SYSMENU_ORDER* sysmenu = (RAIL_SYSMENU_ORDER*) event->wParam;
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-16 22:58:45 +04:00
|
|
|
CopyMemory(&railOrder->sysmenu, sysmenu, sizeof(RAIL_SYSMENU_ORDER));
|
|
|
|
rail_send_client_sysmenu_order((railPlugin*) railOrder->plugin, &railOrder->sysmenu);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_recv_syscommand_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
RAIL_SYSCOMMAND_ORDER* syscommand = (RAIL_SYSCOMMAND_ORDER*) event->wParam;
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
CopyMemory(&railOrder->syscommand, syscommand, sizeof(RAIL_SYSCOMMAND_ORDER));
|
2013-10-16 22:58:45 +04:00
|
|
|
rail_send_client_syscommand_order((railPlugin*) railOrder->plugin, &railOrder->syscommand);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_recv_notify_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
RAIL_NOTIFY_EVENT_ORDER* notify = (RAIL_NOTIFY_EVENT_ORDER*) event->wParam;
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
CopyMemory(&railOrder->notify_event, notify, sizeof(RAIL_NOTIFY_EVENT_ORDER));
|
2013-10-16 22:58:45 +04:00
|
|
|
rail_send_client_notify_event_order((railPlugin*) railOrder->plugin, &railOrder->notify_event);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_recv_window_move_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
RAIL_WINDOW_MOVE_ORDER* window_move = (RAIL_WINDOW_MOVE_ORDER*) event->wParam;
|
2013-10-15 07:16:40 +04:00
|
|
|
CopyMemory(&railOrder->window_move, window_move, sizeof(RAIL_WINDOW_MOVE_ORDER));
|
2013-10-16 22:58:45 +04:00
|
|
|
rail_send_client_window_move_order((railPlugin*) railOrder->plugin, &railOrder->window_move);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_recv_app_req_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
RAIL_GET_APPID_REQ_ORDER* get_appid_req = (RAIL_GET_APPID_REQ_ORDER*) event->wParam;
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
CopyMemory(&railOrder->get_appid_req, get_appid_req, sizeof(RAIL_GET_APPID_REQ_ORDER));
|
2013-10-16 22:58:45 +04:00
|
|
|
rail_send_client_get_appid_req_order((railPlugin*) railOrder->plugin, &railOrder->get_appid_req);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
static void rail_recv_langbarinfo_event(rdpRailOrder* railOrder, wMessage* event)
|
2011-08-21 05:12:17 +04:00
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
RAIL_LANGBAR_INFO_ORDER* langbar_info = (RAIL_LANGBAR_INFO_ORDER*) event->wParam;
|
2011-08-21 05:12:17 +04:00
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
CopyMemory(&railOrder->langbar_info, langbar_info, sizeof(RAIL_LANGBAR_INFO_ORDER));
|
2013-10-16 22:58:45 +04:00
|
|
|
rail_send_client_langbar_info_order((railPlugin*) railOrder->plugin, &railOrder->langbar_info);
|
2011-08-21 05:12:17 +04:00
|
|
|
}
|
|
|
|
|
2013-03-29 05:13:56 +04:00
|
|
|
static void rail_process_event(rdpSvcPlugin* plugin, wMessage* event)
|
2011-08-12 12:26:57 +04:00
|
|
|
{
|
|
|
|
railPlugin* rail = NULL;
|
2011-08-18 05:33:22 +04:00
|
|
|
rail = (railPlugin*) plugin;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
switch (GetMessageType(event->id))
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientSystemParam:
|
2011-08-18 05:33:22 +04:00
|
|
|
rail_recv_set_sysparams_event(rail->rail_order, event);
|
|
|
|
break;
|
2011-08-10 01:42:10 +04:00
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientExecute:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_exec_remote_app_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientActivate:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_activate_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientSystemMenu:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_sysmenu_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientSystemCommand:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_syscommand_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientNotifyEvent:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_notify_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientWindowMove:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_window_move_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientGetAppIdRequest:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_app_req_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2013-03-29 04:23:16 +04:00
|
|
|
case RailChannel_ClientLanguageBarInfo:
|
2011-08-21 05:12:17 +04:00
|
|
|
rail_recv_langbarinfo_event(rail->rail_order, event);
|
|
|
|
break;
|
|
|
|
|
2011-08-18 05:33:22 +04:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2011-08-10 01:42:10 +04:00
|
|
|
|
2011-08-12 12:26:57 +04:00
|
|
|
freerdp_event_free(event);
|
2011-08-10 01:42:10 +04:00
|
|
|
}
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
/**
|
|
|
|
* Callback Interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
int rail_client_execute(RailClientContext* context, RAIL_EXEC_ORDER* exec)
|
|
|
|
{
|
2013-10-15 07:16:40 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
char* exeOrFile;
|
|
|
|
|
|
|
|
exeOrFile = exec->RemoteApplicationProgram;
|
|
|
|
|
2013-10-23 00:28:23 +04:00
|
|
|
if (!exeOrFile)
|
|
|
|
return -1;
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
if (strlen(exeOrFile) >= 2)
|
|
|
|
{
|
|
|
|
if (strncmp(exeOrFile, "||", 2) != 0)
|
|
|
|
exec->flags |= RAIL_EXEC_FLAG_FILE;
|
|
|
|
}
|
|
|
|
|
|
|
|
rail_string_to_unicode_string(exec->RemoteApplicationProgram, &exec->exeOrFile); /* RemoteApplicationProgram */
|
|
|
|
rail_string_to_unicode_string(exec->RemoteApplicationWorkingDir, &exec->workingDir); /* ShellWorkingDirectory */
|
|
|
|
rail_string_to_unicode_string(exec->RemoteApplicationArguments, &exec->arguments); /* RemoteApplicationCmdLine */
|
|
|
|
|
|
|
|
rail_send_client_exec_order(rail, exec);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_activate(RailClientContext* context, RAIL_ACTIVATE_ORDER* activate)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_activate_order(rail, activate);
|
2013-10-12 01:09:36 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-10-15 07:16:40 +04:00
|
|
|
void rail_send_client_sysparam(RailClientContext* context, RAIL_SYSPARAM_ORDER* sysparam)
|
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
int length;
|
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
length = RAIL_SYSPARAM_ORDER_LENGTH;
|
|
|
|
|
|
|
|
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:
|
|
|
|
length += sysparam->highContrast.colorSchemeLength + 10;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
s = rail_pdu_init(RAIL_SYSPARAM_ORDER_LENGTH + 8);
|
|
|
|
rail_write_client_sysparam_order(s, sysparam);
|
|
|
|
rail_send_pdu(rail, s, RDP_RAIL_ORDER_SYSPARAM);
|
|
|
|
Stream_Free(s, TRUE);
|
|
|
|
}
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
int rail_client_system_param(RailClientContext* context, RAIL_SYSPARAM_ORDER* sysparam)
|
|
|
|
{
|
2013-10-15 07:16:40 +04:00
|
|
|
if (sysparam->params & SPI_MASK_SET_HIGH_CONTRAST)
|
|
|
|
{
|
|
|
|
sysparam->param = SPI_SET_HIGH_CONTRAST;
|
|
|
|
rail_send_client_sysparam(context, sysparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sysparam->params & SPI_MASK_TASKBAR_POS)
|
|
|
|
{
|
|
|
|
sysparam->param = SPI_TASKBAR_POS;
|
|
|
|
rail_send_client_sysparam(context, sysparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sysparam->params & SPI_MASK_SET_MOUSE_BUTTON_SWAP)
|
|
|
|
{
|
|
|
|
sysparam->param = SPI_SET_MOUSE_BUTTON_SWAP;
|
|
|
|
rail_send_client_sysparam(context, sysparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sysparam->params & SPI_MASK_SET_KEYBOARD_PREF)
|
|
|
|
{
|
|
|
|
sysparam->param = SPI_SET_KEYBOARD_PREF;
|
|
|
|
rail_send_client_sysparam(context, sysparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sysparam->params & SPI_MASK_SET_DRAG_FULL_WINDOWS)
|
|
|
|
{
|
|
|
|
sysparam->param = SPI_SET_DRAG_FULL_WINDOWS;
|
|
|
|
rail_send_client_sysparam(context, sysparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sysparam->params & SPI_MASK_SET_KEYBOARD_CUES)
|
|
|
|
{
|
|
|
|
sysparam->param = SPI_SET_KEYBOARD_CUES;
|
|
|
|
rail_send_client_sysparam(context, sysparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sysparam->params & SPI_MASK_SET_WORK_AREA)
|
|
|
|
{
|
|
|
|
sysparam->param = SPI_SET_WORK_AREA;
|
|
|
|
rail_send_client_sysparam(context, sysparam);
|
|
|
|
}
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_system_param(RailClientContext* context, RAIL_SYSPARAM_ORDER* sysparam)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_system_command(RailClientContext* context, RAIL_SYSCOMMAND_ORDER* syscommand)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_syscommand_order(rail, syscommand);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_handshake(RailClientContext* context, RAIL_HANDSHAKE_ORDER* handshake)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_handshake_order(rail, handshake);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_handshake(RailClientContext* context, RAIL_HANDSHAKE_ORDER* handshake)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_handshake_ex(RailClientContext* context, RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_handshake_ex_order(rail, handshakeEx);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_handshake_ex(RailClientContext* context, RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_notify_event(RailClientContext* context, RAIL_NOTIFY_EVENT_ORDER* notifyEvent)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_notify_event_order(rail, notifyEvent);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_window_move(RailClientContext* context, RAIL_WINDOW_MOVE_ORDER* windowMove)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_window_move_order(rail, windowMove);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_local_move_size(RailClientContext* context, RAIL_LOCALMOVESIZE_ORDER* localMoveSize)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_min_max_info(RailClientContext* context, RAIL_MINMAXINFO_ORDER* minMaxInfo)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_information(RailClientContext* context, RAIL_CLIENT_STATUS_ORDER* clientStatus)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_status_order(rail, clientStatus);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_system_menu(RailClientContext* context, RAIL_SYSMENU_ORDER* sysmenu)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_sysmenu_order(rail, sysmenu);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_language_bar_info(RailClientContext* context, RAIL_LANGBAR_INFO_ORDER* langBarInfo)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_langbar_info_order(rail, langBarInfo);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_language_bar_info(RailClientContext* context, RAIL_LANGBAR_INFO_ORDER* langBarInfo)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_execute_result(RailClientContext* context, RAIL_EXEC_RESULT_ORDER* execResult)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int rail_client_get_appid_request(RailClientContext* context, RAIL_GET_APPID_REQ_ORDER* getAppIdReq)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
railPlugin* rail = (railPlugin*) context->handle;
|
|
|
|
|
|
|
|
rail_send_client_get_appid_req_order(rail, getAppIdReq);
|
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rail_server_get_appid_response(RailClientContext* context, RAIL_GET_APPID_RESP_ORDER* getAppIdResp)
|
|
|
|
{
|
2013-10-21 05:59:03 +04:00
|
|
|
return 0; /* stub - should be registered by client */
|
2013-10-12 01:09:36 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 06:48:17 +04:00
|
|
|
/* rail is always built-in */
|
2012-10-09 04:26:11 +04:00
|
|
|
#define VirtualChannelEntry rail_VirtualChannelEntry
|
|
|
|
|
2014-03-04 03:28:31 +04:00
|
|
|
BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
2012-10-09 04:26:11 +04:00
|
|
|
{
|
2013-12-06 01:55:28 +04:00
|
|
|
railPlugin* rail;
|
2013-10-12 01:09:36 +04:00
|
|
|
RailClientContext* context;
|
2014-02-17 02:38:59 +04:00
|
|
|
CHANNEL_ENTRY_POINTS_FREERDP* pEntryPointsEx;
|
2012-10-09 04:26:11 +04:00
|
|
|
|
2013-12-06 01:55:28 +04:00
|
|
|
rail = (railPlugin*) malloc(sizeof(railPlugin));
|
|
|
|
ZeroMemory(rail, sizeof(railPlugin));
|
2012-10-09 04:26:11 +04:00
|
|
|
|
2013-12-06 01:55:28 +04:00
|
|
|
rail->plugin.channel_def.options =
|
2012-10-09 04:26:11 +04:00
|
|
|
CHANNEL_OPTION_INITIALIZED |
|
|
|
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
|
|
|
CHANNEL_OPTION_COMPRESS_RDP |
|
|
|
|
CHANNEL_OPTION_SHOW_PROTOCOL;
|
|
|
|
|
2013-12-06 01:55:28 +04:00
|
|
|
strcpy(rail->plugin.channel_def.name, "rail");
|
2012-10-09 04:26:11 +04:00
|
|
|
|
2013-12-06 01:55:28 +04:00
|
|
|
rail->plugin.connect_callback = rail_process_connect;
|
|
|
|
rail->plugin.receive_callback = rail_process_receive;
|
|
|
|
rail->plugin.event_callback = rail_process_event;
|
|
|
|
rail->plugin.terminate_callback = rail_process_terminate;
|
2012-10-09 04:26:11 +04:00
|
|
|
|
2014-02-17 02:38:59 +04:00
|
|
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP*) pEntryPoints;
|
2013-10-12 01:09:36 +04:00
|
|
|
|
2014-02-17 02:38:59 +04:00
|
|
|
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP)) &&
|
2013-10-12 01:09:36 +04:00
|
|
|
(pEntryPointsEx->MagicNumber == FREERDP_CHANNEL_MAGIC_NUMBER))
|
|
|
|
{
|
|
|
|
context = (RailClientContext*) malloc(sizeof(RailClientContext));
|
|
|
|
|
2013-12-06 01:55:28 +04:00
|
|
|
context->handle = (void*) rail;
|
2013-10-15 07:16:40 +04:00
|
|
|
|
2013-10-12 01:09:36 +04:00
|
|
|
context->ClientExecute = rail_client_execute;
|
|
|
|
context->ClientActivate = rail_client_activate;
|
2013-10-15 07:16:40 +04:00
|
|
|
context->ClientSystemParam = rail_client_system_param;
|
2013-10-12 01:09:36 +04:00
|
|
|
context->ServerSystemParam = rail_server_system_param;
|
|
|
|
context->ClientSystemCommand = rail_client_system_command;
|
|
|
|
context->ClientHandshake = rail_client_handshake;
|
|
|
|
context->ServerHandshake = rail_server_handshake;
|
2013-10-21 05:59:03 +04:00
|
|
|
context->ClientHandshakeEx = rail_client_handshake_ex;
|
|
|
|
context->ServerHandshakeEx = rail_server_handshake_ex;
|
2013-10-12 01:09:36 +04:00
|
|
|
context->ClientNotifyEvent = rail_client_notify_event;
|
|
|
|
context->ClientWindowMove = rail_client_window_move;
|
|
|
|
context->ServerLocalMoveSize = rail_server_local_move_size;
|
|
|
|
context->ServerMinMaxInfo = rail_server_min_max_info;
|
|
|
|
context->ClientInformation = rail_client_information;
|
|
|
|
context->ClientSystemMenu = rail_client_system_menu;
|
|
|
|
context->ClientLanguageBarInfo = rail_client_language_bar_info;
|
|
|
|
context->ServerLanguageBarInfo = rail_server_language_bar_info;
|
|
|
|
context->ServerExecuteResult = rail_server_execute_result;
|
|
|
|
context->ClientGetAppIdRequest = rail_client_get_appid_request;
|
|
|
|
context->ServerGetAppIdResponse = rail_server_get_appid_response;
|
|
|
|
|
|
|
|
*(pEntryPointsEx->ppInterface) = (void*) context;
|
|
|
|
}
|
|
|
|
|
2013-10-12 01:36:34 +04:00
|
|
|
WLog_Init();
|
2013-12-06 01:55:28 +04:00
|
|
|
rail->log = WLog_Get("com.freerdp.channels.rail.client");
|
2013-10-12 01:36:34 +04:00
|
|
|
|
2013-12-06 01:55:28 +04:00
|
|
|
WLog_Print(rail->log, WLOG_DEBUG, "VirtualChannelEntry");
|
2013-10-12 01:36:34 +04:00
|
|
|
|
2013-12-06 01:55:28 +04:00
|
|
|
svc_plugin_init((rdpSvcPlugin*) rail, pEntryPoints);
|
2012-10-09 04:26:11 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|