Merge pull request #5750 from akallabeth/encomsp_auto

Encomsp automatic input control && cleanups
This commit is contained in:
David Fort 2020-01-15 13:56:00 +01:00 committed by GitHub
commit 30d6e25def
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 213 additions and 105 deletions

View File

@ -31,6 +31,21 @@
#include "encomsp_main.h"
struct encomsp_plugin
{
CHANNEL_DEF channelDef;
CHANNEL_ENTRY_POINTS_FREERDP_EX channelEntryPoints;
EncomspClientContext* context;
HANDLE thread;
wStream* data_in;
void* InitHandle;
DWORD OpenHandle;
wMessageQueue* queue;
rdpContext* rdpcontext;
};
/**
* Function description
*
@ -54,7 +69,7 @@ static UINT encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_write_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
static UINT encomsp_write_header(wStream* s, const ENCOMSP_ORDER_HEADER* header)
{
Stream_Write_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Write_UINT16(s, header->Length); /* Length (2 bytes) */
@ -138,9 +153,9 @@ static UINT encomsp_virtual_channel_write(encomspPlugin* encomsp, wStream* s)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_FILTER_UPDATED_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -149,7 +164,10 @@ static UINT encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s,
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 1)
@ -159,7 +177,7 @@ static UINT encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s,
}
Stream_Read_UINT8(s, pdu.Flags); /* Flags (1 byte) */
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -192,9 +210,9 @@ static UINT encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_APPLICATION_CREATED_PDU pdu;
UINT error;
@ -203,15 +221,18 @@ static UINT encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 6)
{
WLog_ERR(TAG, "Not enough data!");
return ERROR_INVALID_DATA;
}
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
Stream_Read_UINT16(s, pdu.Flags); /* Flags (2 bytes) */
Stream_Read_UINT32(s, pdu.AppId); /* AppId (4 bytes) */
@ -221,7 +242,7 @@ static UINT encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream
return error;
}
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -254,9 +275,9 @@ static UINT encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_APPLICATION_REMOVED_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -265,7 +286,10 @@ static UINT encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 4)
@ -275,7 +299,7 @@ static UINT encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream
}
Stream_Read_UINT32(s, pdu.AppId); /* AppId (4 bytes) */
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -308,9 +332,9 @@ static UINT encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_WINDOW_CREATED_PDU pdu;
UINT error;
@ -319,7 +343,10 @@ static UINT encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s,
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 10)
@ -338,7 +365,7 @@ static UINT encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s,
return error;
}
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -371,9 +398,9 @@ static UINT encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_WINDOW_REMOVED_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -382,7 +409,10 @@ static UINT encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s,
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 4)
@ -392,7 +422,7 @@ static UINT encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s,
}
Stream_Read_UINT32(s, pdu.WndId); /* WndId (4 bytes) */
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -425,9 +455,9 @@ static UINT encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_SHOW_WINDOW_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -436,7 +466,10 @@ static UINT encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s,
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 4)
@ -446,7 +479,7 @@ static UINT encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s,
}
Stream_Read_UINT32(s, pdu.WndId); /* WndId (4 bytes) */
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -479,9 +512,9 @@ static UINT encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_PARTICIPANT_CREATED_PDU pdu;
UINT error;
@ -490,7 +523,10 @@ static UINT encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 10)
@ -509,7 +545,7 @@ static UINT encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream
return error;
}
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -542,9 +578,9 @@ static UINT encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end;
EncomspClientContext* context;
ENCOMSP_PARTICIPANT_REMOVED_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -553,19 +589,19 @@ static UINT encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 12)
{
WLog_ERR(TAG, "Not enough data!");
return ERROR_INVALID_DATA;
}
beg = (Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
Stream_Read_UINT32(s, pdu.ParticipantId); /* ParticipantId (4 bytes) */
Stream_Read_UINT32(s, pdu.DiscType); /* DiscType (4 bytes) */
Stream_Read_UINT32(s, pdu.DiscCode); /* DiscCode (4 bytes) */
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -598,9 +634,9 @@ static UINT encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_change_participant_control_level_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -609,7 +645,10 @@ static UINT encomsp_recv_change_participant_control_level_pdu(encomspPlugin* enc
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 6)
@ -620,7 +659,7 @@ static UINT encomsp_recv_change_participant_control_level_pdu(encomspPlugin* enc
Stream_Read_UINT16(s, pdu.Flags); /* Flags (2 bytes) */
Stream_Read_UINT32(s, pdu.ParticipantId); /* ParticipantId (4 bytes) */
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -653,16 +692,17 @@ static UINT encomsp_recv_change_participant_control_level_pdu(encomspPlugin* enc
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT
encomsp_send_change_participant_control_level_pdu(EncomspClientContext* context,
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* pdu)
static UINT encomsp_send_change_participant_control_level_pdu(
EncomspClientContext* context, const ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* pdu)
{
wStream* s;
encomspPlugin* encomsp;
UINT error;
ENCOMSP_ORDER_HEADER header;
encomsp = (encomspPlugin*)context->handle;
pdu->Type = ODTYPE_PARTICIPANT_CTRL_CHANGED;
pdu->Length = ENCOMSP_ORDER_HEADER_SIZE + 6;
header.Type = ODTYPE_PARTICIPANT_CTRL_CHANGED;
header.Length = ENCOMSP_ORDER_HEADER_SIZE + 6;
s = Stream_New(NULL, pdu->Length);
if (!s)
@ -671,7 +711,7 @@ encomsp_send_change_participant_control_level_pdu(EncomspClientContext* context,
return CHANNEL_RC_NO_MEMORY;
}
if ((error = encomsp_write_header(s, (ENCOMSP_ORDER_HEADER*)pdu)))
if ((error = encomsp_write_header(s, &header)))
{
WLog_ERR(TAG, "encomsp_write_header failed with error %" PRIu32 "!", error);
return error;
@ -689,9 +729,9 @@ encomsp_send_change_participant_control_level_pdu(EncomspClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -700,9 +740,12 @@ static UINT encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStr
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -735,9 +778,9 @@ static UINT encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStr
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_recv_graphics_stream_resumed_pdu(encomspPlugin* encomsp, wStream* s,
ENCOMSP_ORDER_HEADER* header)
const ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
size_t beg, end, pos;
EncomspClientContext* context;
ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU pdu;
UINT error = CHANNEL_RC_OK;
@ -746,9 +789,12 @@ static UINT encomsp_recv_graphics_stream_resumed_pdu(encomspPlugin* encomsp, wSt
if (!context)
return ERROR_INVALID_HANDLE;
beg = ((int)Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
pos = Stream_GetPosition(s);
if (pos < ENCOMSP_ORDER_HEADER_SIZE)
return ERROR_INVALID_DATA;
beg = pos - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
end = (int)Stream_GetPosition(s);
end = Stream_GetPosition(s);
if ((beg + header->Length) < end)
{
@ -922,7 +968,6 @@ static UINT encomsp_process_receive(encomspPlugin* encomsp, wStream* s)
default:
WLog_ERR(TAG, "header.Type %" PRIu16 " not found", header.Type);
return ERROR_INVALID_DATA;
break;
}
}
@ -938,7 +983,7 @@ static void encomsp_process_connect(encomspPlugin* encomsp)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp, void* pData,
static UINT encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp, const void* pData,
UINT32 dataLength, UINT32 totalLength,
UINT32 dataFlags)
{
@ -963,7 +1008,7 @@ static UINT encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp,
data_in = encomsp->data_in;
if (!Stream_EnsureRemainingCapacity(data_in, (int)dataLength))
if (!Stream_EnsureRemainingCapacity(data_in, dataLength))
{
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
return ERROR_INTERNAL_ERROR;

View File

@ -37,20 +37,6 @@
#define TAG CHANNELS_TAG("encomsp.client")
struct encomsp_plugin
{
CHANNEL_DEF channelDef;
CHANNEL_ENTRY_POINTS_FREERDP_EX channelEntryPoints;
EncomspClientContext* context;
HANDLE thread;
wStream* data_in;
void* InitHandle;
DWORD OpenHandle;
wMessageQueue* queue;
rdpContext* rdpcontext;
};
typedef struct encomsp_plugin encomspPlugin;
#endif /* FREERDP_CHANNEL_ENCOMSP_CLIENT_MAIN_H */

View File

@ -326,9 +326,8 @@ static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
{
if (dest->instance == NULL)
{
rdpPrinter* current = printers[num_printers];
current = printer_cups_new_printer((rdpCupsPrinterDriver*)driver, dest->name, NULL,
dest->is_default);
rdpPrinter* current = printer_cups_new_printer((rdpCupsPrinterDriver*)driver,
dest->name, NULL, dest->is_default);
if (!current)
{
printer_cups_release_enum_printers(printers);

View File

@ -39,8 +39,9 @@
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT tf_encomsp_participant_created(EncomspClientContext* context,
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
static UINT
tf_encomsp_participant_created(EncomspClientContext* context,
const ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
{
WINPR_UNUSED(context);
WINPR_UNUSED(participantCreated);

View File

@ -28,14 +28,53 @@
#include "wlf_disp.h"
#include "wlfreerdp.h"
BOOL encomsp_toggle_control(EncomspClientContext* encomsp, BOOL control)
{
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU pdu;
if (!encomsp)
return FALSE;
pdu.ParticipantId = 0;
pdu.Flags = ENCOMSP_REQUEST_VIEW;
if (control)
pdu.Flags |= ENCOMSP_REQUEST_INTERACT;
encomsp->ChangeParticipantControlLevel(encomsp, &pdu);
return TRUE;
}
/**
* Function description
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT wlf_encomsp_participant_created(EncomspClientContext* context,
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
static UINT
wlf_encomsp_participant_created(EncomspClientContext* context,
const ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
{
wlfContext* wlf;
rdpSettings* settings;
BOOL request;
if (!context || !context->custom || !participantCreated)
return ERROR_INVALID_PARAMETER;
wlf = (wlfContext*)context->custom;
settings = wlf->context.settings;
if (!settings)
return ERROR_INVALID_PARAMETER;
request = freerdp_settings_get_bool(settings, FreeRDP_RemoteAssistanceRequestControl);
if (request && (participantCreated->Flags & ENCOMSP_MAY_VIEW) &&
!(participantCreated->Flags & ENCOMSP_MAY_INTERACT))
{
if (!encomsp_toggle_control(context, TRUE))
return ERROR_INTERNAL_ERROR;
}
return CHANNEL_RC_OK;
}

View File

@ -756,9 +756,28 @@ BOOL xf_toggle_control(xfContext* xfc)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT xf_encomsp_participant_created(EncomspClientContext* context,
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
static UINT
xf_encomsp_participant_created(EncomspClientContext* context,
const ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
{
xfContext* xfc;
rdpSettings* settings;
BOOL request;
if (!context || !context->custom || !participantCreated)
return ERROR_INVALID_PARAMETER;
xfc = context->custom;
settings = xfc->context.settings;
if (!settings)
return ERROR_INVALID_PARAMETER;
request = freerdp_settings_get_bool(settings, FreeRDP_RemoteAssistanceRequestControl);
if (request && (participantCreated->Flags & ENCOMSP_MAY_VIEW) &&
!(participantCreated->Flags & ENCOMSP_MAY_INTERACT))
xf_toggle_control(xfc);
return CHANNEL_RC_OK;
}

View File

@ -2894,6 +2894,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
else
settings->MaxTimeInCheckLoop = (UINT32)val;
}
CommandLineSwitchCase(arg, "auto-request-control")
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteAssistanceRequestControl,
enable))
return COMMAND_LINE_ERROR;
}
CommandLineSwitchCase(arg, "async-input")
{
settings->AsyncInput = enable;

View File

@ -46,6 +46,8 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
"Remote application workspace path" },
{ "assistance", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL,
"Remote assistance password" },
{ "auto-request-control", COMMAND_LINE_VALUE_FLAG, "", NULL, NULL, -1, NULL,
"Automatically request remote assistance input control" },
{ "async-channels", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
"Asynchronous channels (experimental)" },
{ "async-input", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,

View File

@ -31,28 +31,29 @@
typedef struct _encomsp_client_context EncomspClientContext;
typedef UINT (*pcEncomspFilterUpdated)(EncomspClientContext* context,
ENCOMSP_FILTER_UPDATED_PDU* filterUpdated);
typedef UINT (*pcEncomspApplicationCreated)(EncomspClientContext* context,
ENCOMSP_APPLICATION_CREATED_PDU* applicationCreated);
typedef UINT (*pcEncomspApplicationRemoved)(EncomspClientContext* context,
ENCOMSP_APPLICATION_REMOVED_PDU* applicationRemoved);
const ENCOMSP_FILTER_UPDATED_PDU* filterUpdated);
typedef UINT (*pcEncomspApplicationCreated)(
EncomspClientContext* context, const ENCOMSP_APPLICATION_CREATED_PDU* applicationCreated);
typedef UINT (*pcEncomspApplicationRemoved)(
EncomspClientContext* context, const ENCOMSP_APPLICATION_REMOVED_PDU* applicationRemoved);
typedef UINT (*pcEncomspWindowCreated)(EncomspClientContext* context,
ENCOMSP_WINDOW_CREATED_PDU* windowCreated);
const ENCOMSP_WINDOW_CREATED_PDU* windowCreated);
typedef UINT (*pcEncomspWindowRemoved)(EncomspClientContext* context,
ENCOMSP_WINDOW_REMOVED_PDU* windowRemoved);
const ENCOMSP_WINDOW_REMOVED_PDU* windowRemoved);
typedef UINT (*pcEncomspShowWindow)(EncomspClientContext* context,
ENCOMSP_SHOW_WINDOW_PDU* showWindow);
typedef UINT (*pcEncomspParticipantCreated)(EncomspClientContext* context,
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated);
typedef UINT (*pcEncomspParticipantRemoved)(EncomspClientContext* context,
ENCOMSP_PARTICIPANT_REMOVED_PDU* participantRemoved);
const ENCOMSP_SHOW_WINDOW_PDU* showWindow);
typedef UINT (*pcEncomspParticipantCreated)(
EncomspClientContext* context, const ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated);
typedef UINT (*pcEncomspParticipantRemoved)(
EncomspClientContext* context, const ENCOMSP_PARTICIPANT_REMOVED_PDU* participantRemoved);
typedef UINT (*pcEncomspChangeParticipantControlLevel)(
EncomspClientContext* context,
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* changeParticipantControlLevel);
const ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* changeParticipantControlLevel);
typedef UINT (*pcEncomspGraphicsStreamPaused)(
EncomspClientContext* context, ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU* graphicsStreamPaused);
EncomspClientContext* context, const ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU* graphicsStreamPaused);
typedef UINT (*pcEncomspGraphicsStreamResumed)(
EncomspClientContext* context, ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU* graphicsStreamResumed);
EncomspClientContext* context,
const ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU* graphicsStreamResumed);
struct _encomsp_client_context
{

View File

@ -634,6 +634,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_EncomspVirtualChannel (1029)
#define FreeRDP_RemdeskVirtualChannel (1030)
#define FreeRDP_LyncRdpMode (1031)
#define FreeRDP_RemoteAssistanceRequestControl (1032)
#define FreeRDP_TlsSecurity (1088)
#define FreeRDP_NlaSecurity (1089)
#define FreeRDP_RdpSecurity (1090)
@ -1064,15 +1065,16 @@ struct rdp_settings
UINT64 padding1024[1024 - 969]; /* 969 */
/* Remote Assistance */
ALIGN64 BOOL RemoteAssistanceMode; /* 1024 */
ALIGN64 char* RemoteAssistanceSessionId; /* 1025 */
ALIGN64 char* RemoteAssistancePassStub; /* 1026 */
ALIGN64 char* RemoteAssistancePassword; /* 1027 */
ALIGN64 char* RemoteAssistanceRCTicket; /* 1028 */
ALIGN64 BOOL EncomspVirtualChannel; /* 1029 */
ALIGN64 BOOL RemdeskVirtualChannel; /* 1030 */
ALIGN64 BOOL LyncRdpMode; /* 1031 */
UINT64 padding1088[1088 - 1032]; /* 1032 */
ALIGN64 BOOL RemoteAssistanceMode; /* 1024 */
ALIGN64 char* RemoteAssistanceSessionId; /* 1025 */
ALIGN64 char* RemoteAssistancePassStub; /* 1026 */
ALIGN64 char* RemoteAssistancePassword; /* 1027 */
ALIGN64 char* RemoteAssistanceRCTicket; /* 1028 */
ALIGN64 BOOL EncomspVirtualChannel; /* 1029 */
ALIGN64 BOOL RemdeskVirtualChannel; /* 1030 */
ALIGN64 BOOL LyncRdpMode; /* 1031 */
ALIGN64 BOOL RemoteAssistanceRequestControl; /* 1032 */
UINT64 padding1088[1088 - 1033]; /* 1033 */
/**
* X.224 Connection Request/Confirm

View File

@ -165,6 +165,9 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
case FreeRDP_LyncRdpMode:
return settings->LyncRdpMode;
case FreeRDP_RemoteAssistanceRequestControl:
return settings->RemoteAssistanceRequestControl;
case FreeRDP_TlsSecurity:
return settings->TlsSecurity;
@ -715,6 +718,10 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
settings->LyncRdpMode = val;
break;
case FreeRDP_RemoteAssistanceRequestControl:
settings->RemoteAssistanceRequestControl = val;
break;
case FreeRDP_TlsSecurity:
settings->TlsSecurity = val;
break;

View File

@ -54,6 +54,7 @@ static const size_t bool_list_indices[] = {
FreeRDP_EncomspVirtualChannel,
FreeRDP_RemdeskVirtualChannel,
FreeRDP_LyncRdpMode,
FreeRDP_RemoteAssistanceRequestControl,
FreeRDP_TlsSecurity,
FreeRDP_NlaSecurity,
FreeRDP_RdpSecurity,