in src/protocols/rdp/channels/rail.c [72:169]
static UINT guac_rdp_rail_complete_handshake(RailClientContext* rail) {
UINT status;
guac_client* client = (guac_client*) rail->custom;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
RAIL_HANDSHAKE_ORDER handshake = {
/* Build number 7600 (0x1DB0) apparently represents Windows 7 and
* compatibility with RDP 7.0. As of this writing, this is the same
* build number sent for RAIL connections by xfreerdp. */
.buildNumber = 7600
};
/* Send client handshake response */
pthread_mutex_lock(&(rdp_client->message_lock));
status = rail->ClientHandshake(rail, &handshake);
pthread_mutex_unlock(&(rdp_client->message_lock));
if (status != CHANNEL_RC_OK)
return status;
RAIL_CLIENT_STATUS_ORDER client_status = {
.flags = 0x00
};
/* Send client status */
pthread_mutex_lock(&(rdp_client->message_lock));
status = rail->ClientInformation(rail, &client_status);
pthread_mutex_unlock(&(rdp_client->message_lock));
if (status != CHANNEL_RC_OK)
return status;
RAIL_SYSPARAM_ORDER sysparam = {
.dragFullWindows = FALSE,
.highContrast = {
.flags =
HCF_AVAILABLE
| HCF_CONFIRMHOTKEY
| HCF_HOTKEYACTIVE
| HCF_HOTKEYAVAILABLE
| HCF_HOTKEYSOUND
| HCF_INDICATOR,
.colorScheme = {
.string = NULL,
.length = 0
}
},
.keyboardCues = FALSE,
.keyboardPref = FALSE,
.mouseButtonSwap = FALSE,
.workArea = {
.left = 0,
.top = 0,
.right = rdp_client->settings->width,
.bottom = rdp_client->settings->height
},
.params =
SPI_MASK_SET_DRAG_FULL_WINDOWS
| SPI_MASK_SET_HIGH_CONTRAST
| SPI_MASK_SET_KEYBOARD_CUES
| SPI_MASK_SET_KEYBOARD_PREF
| SPI_MASK_SET_MOUSE_BUTTON_SWAP
| SPI_MASK_SET_WORK_AREA
};
/* Send client system parameters */
pthread_mutex_lock(&(rdp_client->message_lock));
status = rail->ClientSystemParam(rail, &sysparam);
pthread_mutex_unlock(&(rdp_client->message_lock));
if (status != CHANNEL_RC_OK)
return status;
RAIL_EXEC_ORDER exec = {
.flags = RAIL_EXEC_FLAG_EXPAND_ARGUMENTS,
.RemoteApplicationProgram = rdp_client->settings->remote_app,
.RemoteApplicationWorkingDir = rdp_client->settings->remote_app_dir,
.RemoteApplicationArguments = rdp_client->settings->remote_app_args,
};
/* Execute desired RemoteApp command */
pthread_mutex_lock(&(rdp_client->message_lock));
status = rail->ClientExecute(rail, &exec);
pthread_mutex_unlock(&(rdp_client->message_lock));
return status;
}