[channels,settings] add a setting to ignore invalid devices

This commit is contained in:
Richard Markiewicz 2023-04-21 13:25:14 -04:00 committed by akallabeth
parent d1069b3bc1
commit 13e52cfae2
7 changed files with 17 additions and 3 deletions

View File

@ -107,7 +107,7 @@ IRP* irp_new(DEVMAN* devman, wStreamPool* pool, wStream* s, wLog* log, UINT* err
if (!device)
{
if (error)
*error = ERROR_INVALID_PARAMETER;
*error = ERROR_DEV_NOT_EXIST;
return NULL;
}

View File

@ -1067,6 +1067,8 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
settings = rdpdr->rdpcontext->settings;
WINPR_ASSERT(settings);
rdpdr->ignoreInvalidDevices = settings->IgnoreInvalidDevices;
if (settings->ClientHostname)
strncpy(rdpdr->computerName, settings->ClientHostname, sizeof(rdpdr->computerName) - 1);
else
@ -1411,7 +1413,7 @@ static UINT rdpdr_process_irp(rdpdrPlugin* rdpdr, wStream* s)
{
WLog_Print(rdpdr->log, WLOG_ERROR, "irp_new failed with %" PRIu32 "!", error);
if (error == CHANNEL_RC_OK)
if (error == CHANNEL_RC_OK || (error == ERROR_DEV_NOT_EXIST && rdpdr->ignoreInvalidDevices))
{
return dummy_irp_response(rdpdr, s);
}

View File

@ -54,6 +54,7 @@ typedef struct
wMessageQueue* queue;
DEVMAN* devman;
BOOL ignoreInvalidDevices;
UINT16 serverVersionMajor;
UINT16 serverVersionMinor;

View File

@ -875,6 +875,7 @@ typedef struct
#define FreeRDP_DeviceCount (4161)
#define FreeRDP_DeviceArraySize (4162)
#define FreeRDP_DeviceArray (4163)
#define FreeRDP_IgnoreInvalidDevices (4164)
#define FreeRDP_RedirectDrives (4288)
#define FreeRDP_RedirectHomeDrive (4289)
#define FreeRDP_DrivesToRedirect (4290)
@ -1569,7 +1570,8 @@ struct rdp_settings
ALIGN64 UINT32 DeviceCount; /* 4161 */
ALIGN64 UINT32 DeviceArraySize; /* 4162 */
ALIGN64 RDPDR_DEVICE** DeviceArray; /* 4163 */
UINT64 padding4288[4288 - 4164]; /* 4164 */
ALIGN64 BOOL IgnoreInvalidDevices; /* 4164 */
UINT64 padding4288[4288 - 4165]; /* 4165 */
/* Drive Redirection */
ALIGN64 BOOL RedirectDrives; /* 4288 */

View File

@ -306,6 +306,9 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
case FreeRDP_IgnoreCertificate:
return settings->IgnoreCertificate;
case FreeRDP_IgnoreInvalidDevices:
return settings->IgnoreInvalidDevices;
case FreeRDP_JpegCodec:
return settings->JpegCodec;
@ -949,6 +952,10 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
settings->IgnoreCertificate = cnv.c;
break;
case FreeRDP_IgnoreInvalidDevices:
settings->IgnoreInvalidDevices = cnv.c;
break;
case FreeRDP_JpegCodec:
settings->JpegCodec = cnv.c;
break;

View File

@ -130,6 +130,7 @@ static const struct settings_str_entry settings_map[] = {
{ FreeRDP_HiDefRemoteApp, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_HiDefRemoteApp" },
{ FreeRDP_IPv6Enabled, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_IPv6Enabled" },
{ FreeRDP_IgnoreCertificate, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_IgnoreCertificate" },
{ FreeRDP_IgnoreInvalidDevices, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_IgnoreInvalidDevices" },
{ FreeRDP_JpegCodec, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_JpegCodec" },
{ FreeRDP_KerberosRdgIsProxy, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_KerberosRdgIsProxy" },
{ FreeRDP_ListMonitors, FREERDP_SETTINGS_TYPE_BOOL, "FreeRDP_ListMonitors" },

View File

@ -86,6 +86,7 @@ static const size_t bool_list_indices[] = {
FreeRDP_HiDefRemoteApp,
FreeRDP_IPv6Enabled,
FreeRDP_IgnoreCertificate,
FreeRDP_IgnoreInvalidDevices,
FreeRDP_JpegCodec,
FreeRDP_KerberosRdgIsProxy,
FreeRDP_ListMonitors,