Channel fixes (#7309)

* Added missing CHANNEL_NAME defines.

* Fixed FreeRDP_ChannelDefArray setter

* Fixed code duplication due to merge error

* Added public function freerdp_channels_from_mcs

* Fixed const correctness in mcs
This commit is contained in:
akallabeth 2021-09-22 14:27:21 +02:00 committed by GitHub
parent 1c84690c2f
commit e0a531f728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 54 additions and 13 deletions

View File

@ -2032,7 +2032,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
rdpdr->channelDef.options =
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP;
sprintf_s(rdpdr->channelDef.name, ARRAYSIZE(rdpdr->channelDef.name), "rdpdr");
sprintf_s(rdpdr->channelDef.name, ARRAYSIZE(rdpdr->channelDef.name), RDPDR_SVC_CHANNEL_NAME);
rdpdr->sequenceId = 0;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;

View File

@ -1272,7 +1272,7 @@ out:
static UINT rdpdr_server_start(RdpdrServerContext* context)
{
context->priv->ChannelHandle =
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "rdpdr");
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, RDPDR_SVC_CHANNEL_NAME);
if (!context->priv->ChannelHandle)
{

View File

@ -44,6 +44,7 @@
#include <freerdp/locale/keyboard.h>
#include <freerdp/utils/passphrase.h>
#include <freerdp/channels/urbdrc.h>
#include <freerdp/channels/rdpdr.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/version.h>
@ -3689,7 +3690,8 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
if (settings->DeviceRedirection)
{
if (!freerdp_client_load_static_channel_addin(channels, settings, "rdpdr", settings))
if (!freerdp_client_load_static_channel_addin(channels, settings, RDPDR_SVC_CHANNEL_NAME,
settings))
return FALSE;
if (!freerdp_static_channel_collection_find(settings, RDPSND_CHANNEL_NAME) &&

View File

@ -35,6 +35,8 @@
#include <freerdp/freerdp.h>
#define RDPDR_SVC_CHANNEL_NAME "rdpdr"
#define RDPDR_DEVICE_IO_REQUEST_LENGTH 24
#define RDPDR_DEVICE_IO_RESPONSE_LENGTH 16

View File

@ -26,5 +26,7 @@
#include <freerdp/codec/audio.h>
#define RDPSND_CHANNEL_NAME "rdpsnd"
#define RDPSND_DVC_CHANNEL_NAME "AUDIO_PLAYBACK_DVC"
#define RDPSND_LOSSY_DVC_CHANNEL_NAME "AUDIO_PLAYBACK_LOSSY_DVC"
#endif /* FREERDP_CHANNEL_RDPSND_H */

View File

@ -23,8 +23,6 @@
#include <freerdp/channels/rdpsnd.h>
#define RDPSND_DVC_CHANNEL_NAME "AUDIO_PLAYBACK_DVC"
/**
* Subsystem Interface
*/

View File

@ -569,6 +569,8 @@ fingerprint. DEPRECATED: Use VerifyChangedCertificateEx */
FREERDP_API CONNECTION_STATE freerdp_get_state(const rdpContext* context);
FREERDP_API const char* freerdp_state_string(CONNECTION_STATE state);
FREERDP_API BOOL freerdp_channels_from_mcs(rdpSettings* settings, const rdpContext* context);
#ifdef __cplusplus
}
#endif

View File

@ -1102,9 +1102,14 @@ BOOL freerdp_settings_set_pointer_len(rdpSettings* settings, size_t id, const vo
return freerdp_settings_set_pointer_len_(settings, FreeRDP_TargetNetPorts,
FreeRDP_TargetNetAddressCount, data, len,
sizeof(char));
case FreeRDP_ChannelDefArray:
if (!freerdp_settings_set_pointer_len_(settings, FreeRDP_ChannelDefArray,
FreeRDP_ChannelDefArraySize, data, len,
sizeof(CHANNEL_DEF)))
return FALSE;
return freerdp_settings_set_uint32(settings, FreeRDP_ChannelCount, len);
case FreeRDP_ClientAutoReconnectCookie:
case FreeRDP_ServerAutoReconnectCookie:
case FreeRDP_ChannelDefArray:
case FreeRDP_MonitorDefArray:
case FreeRDP_ReceivedCapabilities:
case FreeRDP_OrderSupport:

View File

@ -1561,3 +1561,31 @@ const char* rdp_get_state_string(rdpRdp* rdp)
int state = rdp_get_state(rdp);
return rdp_state_string(state);
}
BOOL rdp_channels_from_mcs(rdpSettings* settings, const rdpRdp* rdp)
{
size_t x;
const rdpMcs* mcs;
WINPR_ASSERT(rdp);
mcs = rdp->mcs;
WINPR_ASSERT(mcs);
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_ChannelDefArray, NULL,
mcs->channelCount))
return FALSE;
for (x = 0; x < mcs->channelCount; x++)
{
const rdpMcsChannel* mchannel = &mcs->channels[x];
CHANNEL_DEF cur = { 0 };
memcpy(cur.name, mchannel->Name, sizeof(cur.name));
cur.options = mchannel->options;
if (!freerdp_settings_set_pointer_array(settings, FreeRDP_ChannelDefArray, x, &cur))
return FALSE;
}
return TRUE;
}

View File

@ -64,4 +64,6 @@ FREERDP_LOCAL const char* rdp_get_state_string(rdpRdp* rdp);
FREERDP_LOCAL const char* rdp_client_connection_state_string(int state);
FREERDP_LOCAL BOOL rdp_channels_from_mcs(rdpSettings* settings, const rdpRdp* rdp);
#endif /* FREERDP_LIB_CORE_CONNECTION_H */

View File

@ -1086,3 +1086,9 @@ const char* freerdp_state_string(CONNECTION_STATE state)
{
return rdp_state_string(state);
}
BOOL freerdp_channels_from_mcs(rdpSettings* settings, const rdpContext* context)
{
WINPR_ASSERT(context);
return rdp_channels_from_mcs(settings, context->rdp);
}

View File

@ -202,7 +202,7 @@ static BOOL mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userDat
static BOOL mcs_read_domain_mcspdu_header(wStream* s, enum DomainMCSPDU* domainMCSPDU,
UINT16* length);
static int mcs_initialize_client_channels(rdpMcs* mcs, rdpSettings* settings)
static int mcs_initialize_client_channels(rdpMcs* mcs, const rdpSettings* settings)
{
UINT32 index;

View File

@ -1651,12 +1651,6 @@ BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx,
gfx->UpdateSurfaces = NULL;
gfx->SurfaceCommand = NULL;
}
if (freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding))
{
gfx->UpdateSurfaceArea = NULL;
gfx->UpdateSurfaces = NULL;
gfx->SurfaceCommand = NULL;
}
return TRUE;
}