Moved rail application start to client common

This commit is contained in:
Armin Novak 2022-02-22 16:14:28 +01:00 committed by akallabeth
parent 3bb36f4caa
commit 538b34c51d
5 changed files with 207 additions and 245 deletions

View File

@ -22,6 +22,7 @@
#include <winpr/crt.h>
#include <freerdp/log.h>
#include <freerdp/client/rail.h>
#include <winpr/tchar.h>
#include <winpr/print.h>
@ -871,76 +872,6 @@ static UINT wf_rail_server_system_param(RailClientContext* context,
return CHANNEL_RC_OK;
}
static UINT wf_rail_server_start_cmd(RailClientContext* context)
{
UINT status;
RAIL_EXEC_ORDER exec = { 0 };
RAIL_SYSPARAM_ORDER sysparam = { 0 };
RAIL_CLIENT_STATUS_ORDER clientStatus = { 0 };
wfContext* wfc = (wfContext*)context->custom;
rdpSettings* settings = wfc->common.context.settings;
clientStatus.flags = TS_RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE;
if (settings->AutoReconnectionEnabled)
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_AUTORECONNECT;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_ZORDER_SYNC;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_WINDOW_RESIZE_MARGIN_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_APPBAR_REMOTING_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_POWER_DISPLAY_REQUEST_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_BIDIRECTIONAL_CLOAK_SUPPORTED;
status = context->ClientInformation(context, &clientStatus);
if (status != CHANNEL_RC_OK)
return status;
if (settings->RemoteAppLanguageBarSupported)
{
RAIL_LANGBAR_INFO_ORDER langBarInfo;
langBarInfo.languageBarStatus = 0x00000008; /* TF_SFT_HIDDEN */
status = context->ClientLanguageBarInfo(context, &langBarInfo);
/* We want the language bar, but the server might not support it. */
switch (status)
{
case CHANNEL_RC_OK:
case ERROR_BAD_CONFIGURATION:
break;
default:
return status;
}
}
sysparam.params = 0;
sysparam.params |= SPI_MASK_SET_HIGH_CONTRAST;
sysparam.highContrast.colorScheme.string = NULL;
sysparam.highContrast.colorScheme.length = 0;
sysparam.highContrast.flags = 0x7E;
sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
sysparam.mouseButtonSwap = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
sysparam.keyboardPref = FALSE;
sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
sysparam.dragFullWindows = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
sysparam.keyboardCues = FALSE;
sysparam.params |= SPI_MASK_SET_WORK_AREA;
sysparam.workArea.left = 0;
sysparam.workArea.top = 0;
sysparam.workArea.right = settings->DesktopWidth;
sysparam.workArea.bottom = settings->DesktopHeight;
sysparam.dragFullWindows = FALSE;
status = context->ClientSystemParam(context, &sysparam);
if (status != CHANNEL_RC_OK)
return status;
exec.RemoteApplicationProgram = settings->RemoteApplicationProgram;
exec.RemoteApplicationWorkingDir = settings->ShellWorkingDirectory;
exec.RemoteApplicationArguments = settings->RemoteApplicationCmdLine;
return context->ClientExecute(context, &exec);
}
/**
* Function description
*
@ -949,7 +880,7 @@ static UINT wf_rail_server_start_cmd(RailClientContext* context)
static UINT wf_rail_server_handshake(RailClientContext* context,
const RAIL_HANDSHAKE_ORDER* handshake)
{
return wf_rail_server_start_cmd(context);
return client_rail_server_start_cmd(context);
}
/**
@ -960,7 +891,7 @@ static UINT wf_rail_server_handshake(RailClientContext* context,
static UINT wf_rail_server_handshake_ex(RailClientContext* context,
const RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
{
return wf_rail_server_start_cmd(context);
return client_rail_server_start_cmd(context);
}
/**

View File

@ -29,6 +29,8 @@
#include <winpr/wlog.h>
#include <winpr/print.h>
#include <freerdp/client/rail.h>
#include "xf_window.h"
#include "xf_rail.h"
@ -833,84 +835,6 @@ static UINT xf_rail_server_system_param(RailClientContext* context,
return CHANNEL_RC_OK;
}
static UINT xf_rail_server_start_cmd(RailClientContext* context)
{
UINT status;
RAIL_EXEC_ORDER exec = { 0 };
RAIL_SYSPARAM_ORDER sysparam = { 0 };
RAIL_CLIENT_STATUS_ORDER clientStatus = { 0 };
xfContext* xfc;
rdpSettings* settings;
WINPR_ASSERT(context);
xfc = (xfContext*)context->custom;
WINPR_ASSERT(xfc);
settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
clientStatus.flags = TS_RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE;
if (settings->AutoReconnectionEnabled)
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_AUTORECONNECT;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_ZORDER_SYNC;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_WINDOW_RESIZE_MARGIN_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_APPBAR_REMOTING_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_POWER_DISPLAY_REQUEST_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_BIDIRECTIONAL_CLOAK_SUPPORTED;
status = context->ClientInformation(context, &clientStatus);
if (status != CHANNEL_RC_OK)
return status;
if (settings->RemoteAppLanguageBarSupported)
{
RAIL_LANGBAR_INFO_ORDER langBarInfo;
langBarInfo.languageBarStatus = 0x00000008; /* TF_SFT_HIDDEN */
status = context->ClientLanguageBarInfo(context, &langBarInfo);
/* We want the language bar, but the server might not support it. */
switch (status)
{
case CHANNEL_RC_OK:
case ERROR_BAD_CONFIGURATION:
break;
default:
return status;
}
}
sysparam.params = 0;
sysparam.params |= SPI_MASK_SET_HIGH_CONTRAST;
sysparam.highContrast.colorScheme.string = NULL;
sysparam.highContrast.colorScheme.length = 0;
sysparam.highContrast.flags = 0x7E;
sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
sysparam.mouseButtonSwap = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
sysparam.keyboardPref = FALSE;
sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
sysparam.dragFullWindows = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
sysparam.keyboardCues = FALSE;
sysparam.params |= SPI_MASK_SET_WORK_AREA;
sysparam.workArea.left = 0;
sysparam.workArea.top = 0;
sysparam.workArea.right = settings->DesktopWidth;
sysparam.workArea.bottom = settings->DesktopHeight;
sysparam.dragFullWindows = FALSE;
status = context->ClientSystemParam(context, &sysparam);
if (status != CHANNEL_RC_OK)
return status;
exec.RemoteApplicationProgram = settings->RemoteApplicationProgram;
exec.RemoteApplicationWorkingDir = settings->ShellWorkingDirectory;
exec.RemoteApplicationArguments = settings->RemoteApplicationCmdLine;
return context->ClientExecute(context, &exec);
}
/**
* Function description
*
@ -919,7 +843,7 @@ static UINT xf_rail_server_start_cmd(RailClientContext* context)
static UINT xf_rail_server_handshake(RailClientContext* context,
const RAIL_HANDSHAKE_ORDER* handshake)
{
return xf_rail_server_start_cmd(context);
return client_rail_server_start_cmd(context);
}
/**
@ -930,7 +854,7 @@ static UINT xf_rail_server_handshake(RailClientContext* context,
static UINT xf_rail_server_handshake_ex(RailClientContext* context,
const RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
{
return xf_rail_server_start_cmd(context);
return client_rail_server_start_cmd(context);
}
/**

View File

@ -27,6 +27,7 @@ endif()
set(${MODULE_PREFIX}_SRCS
client.c
client_rails.c
cmdline.c
file.c
geometry.c)

View File

@ -0,0 +1,93 @@
#include <freerdp/freerdp.h>
#include <freerdp/client/rail.h>
UINT client_rail_server_start_cmd(RailClientContext* context)
{
UINT status;
char argsAndFile[520] = { 0 };
RAIL_EXEC_ORDER exec = { 0 };
RAIL_SYSPARAM_ORDER sysparam = { 0 };
RAIL_CLIENT_STATUS_ORDER clientStatus = { 0 };
rdpClientContext* ctx;
rdpSettings* settings;
WINPR_ASSERT(context);
ctx = (rdpClientContext*)context->custom;
WINPR_ASSERT(ctx);
settings = ctx->context.settings;
WINPR_ASSERT(settings);
clientStatus.flags = TS_RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE;
if (settings->AutoReconnectionEnabled)
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_AUTORECONNECT;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_ZORDER_SYNC;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_WINDOW_RESIZE_MARGIN_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_APPBAR_REMOTING_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_POWER_DISPLAY_REQUEST_SUPPORTED;
clientStatus.flags |= TS_RAIL_CLIENTSTATUS_BIDIRECTIONAL_CLOAK_SUPPORTED;
status = context->ClientInformation(context, &clientStatus);
if (status != CHANNEL_RC_OK)
return status;
if (settings->RemoteAppLanguageBarSupported)
{
RAIL_LANGBAR_INFO_ORDER langBarInfo;
langBarInfo.languageBarStatus = 0x00000008; /* TF_SFT_HIDDEN */
status = context->ClientLanguageBarInfo(context, &langBarInfo);
/* We want the language bar, but the server might not support it. */
switch (status)
{
case CHANNEL_RC_OK:
case ERROR_BAD_CONFIGURATION:
break;
default:
return status;
}
}
sysparam.params = 0;
sysparam.params |= SPI_MASK_SET_HIGH_CONTRAST;
sysparam.highContrast.colorScheme.string = NULL;
sysparam.highContrast.colorScheme.length = 0;
sysparam.highContrast.flags = 0x7E;
sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
sysparam.mouseButtonSwap = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
sysparam.keyboardPref = FALSE;
sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
sysparam.dragFullWindows = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
sysparam.keyboardCues = FALSE;
sysparam.params |= SPI_MASK_SET_WORK_AREA;
sysparam.workArea.left = 0;
sysparam.workArea.top = 0;
sysparam.workArea.right = settings->DesktopWidth;
sysparam.workArea.bottom = settings->DesktopHeight;
sysparam.dragFullWindows = FALSE;
status = context->ClientSystemParam(context, &sysparam);
if (status != CHANNEL_RC_OK)
return status;
if (settings->RemoteApplicationFile && settings->RemoteApplicationCmdLine)
{
_snprintf(argsAndFile, ARRAYSIZE(argsAndFile), "%s %s", settings->RemoteApplicationCmdLine,
settings->RemoteApplicationFile);
exec.RemoteApplicationArguments = argsAndFile;
}
else if (settings->RemoteApplicationFile)
exec.RemoteApplicationArguments = settings->RemoteApplicationFile;
else
exec.RemoteApplicationArguments = settings->RemoteApplicationCmdLine;
exec.RemoteApplicationProgram = settings->RemoteApplicationProgram;
exec.RemoteApplicationWorkingDir = settings->ShellWorkingDirectory;
return context->ClientExecute(context, &exec);
}

View File

@ -27,6 +27,11 @@
#include <freerdp/message.h>
#include <freerdp/channels/rail.h>
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Client Interface
*/
@ -76,12 +81,14 @@ typedef UINT (*pcRailClientGetAppIdRequest)(RailClientContext* context,
const RAIL_GET_APPID_REQ_ORDER* getAppIdReq);
typedef UINT (*pcRailServerGetAppIdResponse)(RailClientContext* context,
const RAIL_GET_APPID_RESP_ORDER* getAppIdResp);
typedef UINT (*pcRailServerZOrderSync)(RailClientContext* context, const RAIL_ZORDER_SYNC* zorder);
typedef UINT (*pcRailServerZOrderSync)(RailClientContext* context,
const RAIL_ZORDER_SYNC* zorder);
typedef UINT (*pcRailServerCloak)(RailClientContext* context, const RAIL_CLOAK* cloak);
typedef UINT (*pcRailClientCloak)(RailClientContext* context, const RAIL_CLOAK* cloak);
typedef UINT (*pcRailServerPowerDisplayRequest)(RailClientContext* context,
const RAIL_POWER_DISPLAY_REQUEST* power);
typedef UINT (*pcRailClientSnapArrange)(RailClientContext* context, const RAIL_SNAP_ARRANGE* snap);
typedef UINT (*pcRailClientSnapArrange)(RailClientContext* context,
const RAIL_SNAP_ARRANGE* snap);
typedef UINT (*pcRailServerGetAppidResponseExtended)(RailClientContext* context,
const RAIL_GET_APPID_RESP_EX* id);
typedef UINT (*pcRailClientCompartmentInfo)(RailClientContext* context,
@ -123,4 +130,10 @@ struct s_rail_client_context
pcRailOnOpen OnOpen;
};
FREERDP_API UINT client_rail_server_start_cmd(RailClientContext* context);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H */