FreeRDP
client_rails.c
1 
2 #include <freerdp/freerdp.h>
3 #include <freerdp/client/rail.h>
4 
5 #include "rail_main.h"
6 
7 UINT client_rail_server_start_cmd(RailClientContext* context)
8 {
9  UINT status = 0;
10  char argsAndFile[520] = { 0 };
11  RAIL_EXEC_ORDER exec = { 0 };
12  RAIL_SYSPARAM_ORDER sysparam = { 0 };
13  RAIL_CLIENT_STATUS_ORDER clientStatus = { 0 };
14 
15  WINPR_ASSERT(context);
16  railPlugin* rail = context->handle;
17  WINPR_ASSERT(rail);
18  WINPR_ASSERT(rail->rdpcontext);
19 
20  const rdpSettings* settings = rail->rdpcontext->settings;
21  WINPR_ASSERT(settings);
22 
23  clientStatus.flags = TS_RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE;
24 
25  if (freerdp_settings_get_bool(settings, FreeRDP_AutoReconnectionEnabled))
26  clientStatus.flags |= TS_RAIL_CLIENTSTATUS_AUTORECONNECT;
27 
28  clientStatus.flags |= TS_RAIL_CLIENTSTATUS_ZORDER_SYNC;
29  clientStatus.flags |= TS_RAIL_CLIENTSTATUS_WINDOW_RESIZE_MARGIN_SUPPORTED;
30  clientStatus.flags |= TS_RAIL_CLIENTSTATUS_APPBAR_REMOTING_SUPPORTED;
31  clientStatus.flags |= TS_RAIL_CLIENTSTATUS_POWER_DISPLAY_REQUEST_SUPPORTED;
32  clientStatus.flags |= TS_RAIL_CLIENTSTATUS_BIDIRECTIONAL_CLOAK_SUPPORTED;
33  status = context->ClientInformation(context, &clientStatus);
34 
35  if (status != CHANNEL_RC_OK)
36  return status;
37 
38  if (freerdp_settings_get_bool(settings, FreeRDP_RemoteAppLanguageBarSupported))
39  {
40  RAIL_LANGBAR_INFO_ORDER langBarInfo;
41  langBarInfo.languageBarStatus = 0x00000008; /* TF_SFT_HIDDEN */
42  status = context->ClientLanguageBarInfo(context, &langBarInfo);
43 
44  /* We want the language bar, but the server might not support it. */
45  switch (status)
46  {
47  case CHANNEL_RC_OK:
48  case ERROR_BAD_CONFIGURATION:
49  break;
50  default:
51  return status;
52  }
53  }
54 
55  sysparam.params = 0;
56  sysparam.params |= SPI_MASK_SET_HIGH_CONTRAST;
57  sysparam.highContrast.colorScheme.string = NULL;
58  sysparam.highContrast.colorScheme.length = 0;
59  sysparam.highContrast.flags = 0x7E;
60  sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
61  sysparam.mouseButtonSwap = FALSE;
62  sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
63  sysparam.keyboardPref = FALSE;
64  sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
65  sysparam.dragFullWindows = FALSE;
66  sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
67  sysparam.keyboardCues = FALSE;
68  sysparam.params |= SPI_MASK_SET_WORK_AREA;
69  sysparam.workArea.left = 0;
70  sysparam.workArea.top = 0;
71  sysparam.workArea.right = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
72  sysparam.workArea.bottom = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
73  sysparam.dragFullWindows = FALSE;
74  status = context->ClientSystemParam(context, &sysparam);
75 
76  if (status != CHANNEL_RC_OK)
77  return status;
78 
79  const char* RemoteApplicationFile =
80  freerdp_settings_get_string(settings, FreeRDP_RemoteApplicationFile);
81  const char* RemoteApplicationCmdLine =
82  freerdp_settings_get_string(settings, FreeRDP_RemoteApplicationCmdLine);
83  if (RemoteApplicationFile && RemoteApplicationCmdLine)
84  {
85  (void)_snprintf(argsAndFile, ARRAYSIZE(argsAndFile), "%s %s", RemoteApplicationCmdLine,
86  RemoteApplicationFile);
87  exec.RemoteApplicationArguments = argsAndFile;
88  }
89  else if (RemoteApplicationFile)
90  exec.RemoteApplicationArguments = RemoteApplicationFile;
91  else
92  exec.RemoteApplicationArguments = RemoteApplicationCmdLine;
93  exec.RemoteApplicationProgram =
94  freerdp_settings_get_string(settings, FreeRDP_RemoteApplicationProgram);
95  exec.RemoteApplicationWorkingDir =
96  freerdp_settings_get_string(settings, FreeRDP_ShellWorkingDirectory);
97  return context->ClientExecute(context, &exec);
98 }
FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
FREERDP_API const char * freerdp_settings_get_string(const rdpSettings *settings, FreeRDP_Settings_Keys_String id)
Returns a immutable string settings value.