Use defines instad of channel names

This commit is contained in:
Armin Novak 2021-08-25 10:02:46 +02:00 committed by akallabeth
parent d9ea91361c
commit 054f0ea260
25 changed files with 151 additions and 58 deletions

View File

@ -912,8 +912,8 @@ static UINT cliprdr_virtual_channel_event_connected(cliprdrPlugin* cliprdr, LPVO
return status;
}
cliprdr->MsgsHandle = channel_client_create_handler(cliprdr->context->rdpcontext, cliprdr,
cliprdr_order_recv, "cliprdr");
cliprdr->MsgsHandle = channel_client_create_handler(
cliprdr->context->rdpcontext, cliprdr, cliprdr_order_recv, CLIPRDR_SVC_CHANNEL_NAME);
return CHANNEL_RC_OK;
}
@ -1025,7 +1025,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
cliprdr->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name), "cliprdr");
sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name),
CLIPRDR_SVC_CHANNEL_NAME);
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&

View File

@ -1215,7 +1215,8 @@ static UINT cliprdr_server_open(CliprdrServerContext* context)
void* buffer = NULL;
DWORD BytesReturned = 0;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*)context->handle;
cliprdr->ChannelHandle = WTSVirtualChannelOpen(cliprdr->vcm, WTS_CURRENT_SESSION, "cliprdr");
cliprdr->ChannelHandle =
WTSVirtualChannelOpen(cliprdr->vcm, WTS_CURRENT_SESSION, CLIPRDR_SVC_CHANNEL_NAME);
if (!cliprdr->ChannelHandle)
{

View File

@ -26,6 +26,8 @@
#include <winpr/crt.h>
#include <winpr/stream.h>
#include <freerdp/channels/drdynvc.h>
#include "drdynvc_main.h"
#define TAG CHANNELS_TAG("drdynvc.client")
@ -1780,7 +1782,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
drdynvc->channelDef.options =
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP;
sprintf_s(drdynvc->channelDef.name, ARRAYSIZE(drdynvc->channelDef.name), "drdynvc");
sprintf_s(drdynvc->channelDef.name, ARRAYSIZE(drdynvc->channelDef.name),
DRDYNVC_SVC_CHANNEL_NAME);
drdynvc->state = DRDYNVC_STATE_INITIAL;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;

View File

@ -27,6 +27,7 @@
#include <winpr/print.h>
#include <winpr/stream.h>
#include <freerdp/channels/log.h>
#include <freerdp/channels/drdynvc.h>
#include "drdynvc_main.h"
@ -121,7 +122,7 @@ static DWORD WINAPI drdynvc_server_thread(LPVOID arg)
static UINT drdynvc_server_start(DrdynvcServerContext* context)
{
context->priv->ChannelHandle =
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "drdynvc");
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, DRDYNVC_SVC_CHANNEL_NAME);
if (!context->priv->ChannelHandle)
{

View File

@ -1293,7 +1293,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
encomsp->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(encomsp->channelDef.name, ARRAYSIZE(encomsp->channelDef.name), "encomsp");
sprintf_s(encomsp->channelDef.name, ARRAYSIZE(encomsp->channelDef.name),
ENCOMSP_SVC_CHANNEL_NAME);
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&

View File

@ -298,7 +298,7 @@ out:
static UINT encomsp_server_start(EncomspServerContext* context)
{
context->priv->ChannelHandle =
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "encomsp");
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, ENCOMSP_SVC_CHANNEL_NAME);
if (!context->priv->ChannelHandle)
return CHANNEL_RC_BAD_CHANNEL;

View File

@ -590,8 +590,8 @@ static UINT rail_virtual_channel_event_connected(railPlugin* rail, LPVOID pData,
WLog_ERR(TAG, "context->OnOpen failed with %s [%08" PRIX32 "]",
WTSErrorToString(status), status);
}
rail->MsgsHandle =
channel_client_create_handler(rail->rdpcontext, rail, rail_order_recv, "rail");
rail->MsgsHandle = channel_client_create_handler(rail->rdpcontext, rail, rail_order_recv,
RAIL_SVC_CHANNEL_NAME);
return CHANNEL_RC_OK;
}

View File

@ -25,11 +25,10 @@
#include <winpr/thread.h>
#include <freerdp/svc.h>
#define RDP2TCP_CHAN_NAME "rdp2tcp"
#include <freerdp/channels/rdp2tcp.h>
#include <freerdp/log.h>
#define TAG CLIENT_TAG(RDP2TCP_CHAN_NAME)
#define TAG CLIENT_TAG(RDP2TCP_DVC_CHANNEL_NAME)
static int const debug = 0;
@ -288,7 +287,7 @@ static VOID VCAPITYPE VirtualChannelInitEventEx(LPVOID lpUserParam, LPVOID pInit
puts("rdp2tcp connected");
if (plugin->channelEntryPoints.pVirtualChannelOpenEx(
pInitHandle, &plugin->openHandle, RDP2TCP_CHAN_NAME,
pInitHandle, &plugin->openHandle, RDP2TCP_DVC_CHANNEL_NAME,
VirtualChannelOpenEventEx) != CHANNEL_RC_OK)
return;
@ -332,7 +331,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
return FALSE;
}
strncpy(channelDef.name, RDP2TCP_CHAN_NAME, sizeof(channelDef.name));
strncpy(channelDef.name, RDP2TCP_DVC_CHANNEL_NAME, sizeof(channelDef.name));
channelDef.options =
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP;

View File

@ -805,8 +805,8 @@ static UINT rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
DWORD flags = FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX;
if (rdpsnd->dynamic)
flags = FREERDP_ADDIN_CHANNEL_DYNAMIC;
entry =
(PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_channel_addin_entry("rdpsnd", name, NULL, flags);
entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_channel_addin_entry(RDPSND_DVC_CHANNEL_NAME,
name, NULL, flags);
if (!entry)
return ERROR_INTERNAL_ERROR;
@ -1422,7 +1422,7 @@ BOOL VCAPITYPE rdpsnd_VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints,
rdpsnd->attached = TRUE;
rdpsnd->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP;
sprintf_s(rdpsnd->channelDef.name, ARRAYSIZE(rdpsnd->channelDef.name), "rdpsnd");
sprintf_s(rdpsnd->channelDef.name, ARRAYSIZE(rdpsnd->channelDef.name), RDPSND_DVC_CHANNEL_NAME);
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
@ -1627,7 +1627,8 @@ static UINT rdpsnd_plugin_terminated(IWTSPlugin* pPlugin)
UINT rdpsnd_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
{
UINT error = CHANNEL_RC_OK;
rdpsndPlugin* rdpsnd = (rdpsndPlugin*)pEntryPoints->GetPlugin(pEntryPoints, "rdpsnd");
rdpsndPlugin* rdpsnd =
(rdpsndPlugin*)pEntryPoints->GetPlugin(pEntryPoints, RDPSND_DVC_CHANNEL_NAME);
if (!rdpsnd)
{
@ -1652,7 +1653,7 @@ UINT rdpsnd_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
/* user data pointer is not const, cast to avoid warning. */
rdpsnd->channelEntryPoints.pExtendedData = (void*)pEntryPoints->GetPluginData(pEntryPoints);
error = pEntryPoints->RegisterPlugin(pEntryPoints, "rdpsnd", &rdpsnd->iface);
error = pEntryPoints->RegisterPlugin(pEntryPoints, RDPSND_DVC_CHANNEL_NAME, &rdpsnd->iface);
}
else
{

View File

@ -673,7 +673,8 @@ static UINT rdpsnd_server_start(RdpsndServerContext* context)
DWORD bytesReturned;
RdpsndServerPrivate* priv = context->priv;
UINT error = ERROR_INTERNAL_ERROR;
priv->ChannelHandle = WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "rdpsnd");
priv->ChannelHandle =
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, RDPSND_DVC_CHANNEL_NAME);
if (!priv->ChannelHandle)
{

View File

@ -1028,7 +1028,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
remdesk->channelDef.options = CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL;
sprintf_s(remdesk->channelDef.name, ARRAYSIZE(remdesk->channelDef.name), "remdesk");
sprintf_s(remdesk->channelDef.name, ARRAYSIZE(remdesk->channelDef.name),
REMDESK_SVC_CHANNEL_NAME);
remdesk->Version = 2;
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*)pEntryPoints;

View File

@ -702,7 +702,7 @@ out:
static UINT remdesk_server_start(RemdeskServerContext* context)
{
context->priv->ChannelHandle =
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "remdesk");
WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, REMDESK_SVC_CHANNEL_NAME);
if (!context->priv->ChannelHandle)
{

View File

@ -34,6 +34,12 @@
#include <freerdp/addin.h>
#include <freerdp/settings.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/drdynvc.h>
#include <freerdp/channels/cliprdr.h>
#include <freerdp/channels/encomsp.h>
#include <freerdp/channels/rdp2tcp.h>
#include <freerdp/channels/remdesk.h>
#include <freerdp/channels/rdpsnd.h>
#include <freerdp/crypto/crypto.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/utils/passphrase.h>
@ -920,7 +926,7 @@ static int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_A
{
char** p;
size_t count;
p = CommandLineParseCommaSeparatedValuesEx("rdpsnd", arg->Value, &count);
p = CommandLineParseCommaSeparatedValuesEx(RDPSND_DVC_CHANNEL_NAME, arg->Value, &count);
status = freerdp_client_add_static_channel(settings, count, p);
if (status)
{
@ -3225,7 +3231,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
if (!copy_value(arg->Value, &settings->ActionScript))
return COMMAND_LINE_ERROR_MEMORY;
}
CommandLineSwitchCase(arg, "rdp2tcp")
CommandLineSwitchCase(arg, RDP2TCP_DVC_CHANNEL_NAME)
{
free(settings->RDP2TCPArgs);
@ -3474,7 +3480,7 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
if (settings->AudioPlayback)
{
char* p[] = { "rdpsnd" };
char* p[] = { RDPSND_DVC_CHANNEL_NAME };
if (!freerdp_client_add_static_channel(settings, ARRAYSIZE(p), p))
return FALSE;
@ -3483,7 +3489,7 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
/* for audio playback also load the dynamic sound channel */
if (settings->AudioPlayback)
{
char* p[] = { "rdpsnd" };
char* p[] = { RDPSND_DVC_CHANNEL_NAME };
if (!freerdp_client_add_dynamic_channel(settings, ARRAYSIZE(p), p))
return FALSE;
@ -3497,8 +3503,8 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
return FALSE;
}
if ((freerdp_static_channel_collection_find(settings, "rdpsnd")) ||
(freerdp_dynamic_channel_collection_find(settings, "rdpsnd"))
if ((freerdp_static_channel_collection_find(settings, RDPSND_DVC_CHANNEL_NAME)) ||
(freerdp_dynamic_channel_collection_find(settings, RDPSND_DVC_CHANNEL_NAME))
#if defined(CHANNEL_TSMF_CLIENT)
|| (freerdp_dynamic_channel_collection_find(settings, "tsmf"))
#endif
@ -3627,11 +3633,11 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
if (!freerdp_client_load_static_channel_addin(channels, settings, "rdpdr", settings))
return FALSE;
if (!freerdp_static_channel_collection_find(settings, "rdpsnd") &&
!freerdp_dynamic_channel_collection_find(settings, "rdpsnd"))
if (!freerdp_static_channel_collection_find(settings, RDPSND_DVC_CHANNEL_NAME) &&
!freerdp_dynamic_channel_collection_find(settings, RDPSND_DVC_CHANNEL_NAME))
{
char* params[2];
params[0] = "rdpsnd";
params[0] = RDPSND_DVC_CHANNEL_NAME;
params[1] = "sys:fake";
if (!freerdp_client_add_static_channel(settings, 2, (char**)params))
@ -3678,7 +3684,7 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
if (settings->RedirectClipboard)
{
char* params[1];
params[0] = "cliprdr";
params[0] = CLIPRDR_SVC_CHANNEL_NAME;
if (!freerdp_client_add_static_channel(settings, 1, (char**)params))
return FALSE;
@ -3700,19 +3706,21 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
if (settings->EncomspVirtualChannel)
{
if (!freerdp_client_load_static_channel_addin(channels, settings, "encomsp", settings))
if (!freerdp_client_load_static_channel_addin(channels, settings, ENCOMSP_SVC_CHANNEL_NAME,
settings))
return FALSE;
}
if (settings->RemdeskVirtualChannel)
{
if (!freerdp_client_load_static_channel_addin(channels, settings, "remdesk", settings))
if (!freerdp_client_load_static_channel_addin(channels, settings, REMDESK_SVC_CHANNEL_NAME,
settings))
return FALSE;
}
if (settings->RDP2TCPArgs)
{
if (!freerdp_client_load_static_channel_addin(channels, settings, "rdp2tcp",
if (!freerdp_client_load_static_channel_addin(channels, settings, RDP2TCP_DVC_CHANNEL_NAME,
settings->RDP2TCPArgs))
return FALSE;
}
@ -3727,7 +3735,8 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
if (settings->RemoteApplicationMode)
{
if (!freerdp_client_load_static_channel_addin(channels, settings, "rail", settings))
if (!freerdp_client_load_static_channel_addin(channels, settings, RAIL_SVC_CHANNEL_NAME,
settings))
return FALSE;
}
@ -3813,7 +3822,8 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
if (settings->SupportDynamicChannels)
{
if (!freerdp_client_load_static_channel_addin(channels, settings, "drdynvc", settings))
if (!freerdp_client_load_static_channel_addin(channels, settings, DRDYNVC_SVC_CHANNEL_NAME,
settings))
return FALSE;
}

View File

@ -31,6 +31,10 @@
#include <freerdp/addin.h>
#include <freerdp/settings.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/drdynvc.h>
#include <freerdp/channels/cliprdr.h>
#include <freerdp/channels/encomsp.h>
#include <freerdp/channels/rdpsnd.h>
#include <freerdp/locale/keyboard.h>
@ -180,7 +184,7 @@ static int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV*
{
int args_handled = 0;
if (strcmp(args->argv[0], "cliprdr") == 0)
if (strcmp(args->argv[0], CLIPRDR_SVC_CHANNEL_NAME) == 0)
{
args_handled++;
settings->RedirectClipboard = TRUE;
@ -218,12 +222,12 @@ static int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV*
freerdp_client_add_device_channel(settings, args->argc - 1, &args->argv[1]);
}
}
else if (strcmp(args->argv[0], "drdynvc") == 0)
else if (strcmp(args->argv[0], DRDYNVC_SVC_CHANNEL_NAME) == 0)
{
args_handled++;
freerdp_client_add_dynamic_channel(settings, args->argc - 1, &args->argv[1]);
}
else if (strcmp(args->argv[0], "rdpsnd") == 0)
else if (strcmp(args->argv[0], RDPSND_DVC_CHANNEL_NAME) == 0)
{
args_handled++;
@ -234,7 +238,7 @@ static int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV*
freerdp_addin_replace_argument_value(args, args->argv[1], "sys", args->argv[1]);
freerdp_client_add_static_channel(settings, args->argc, args->argv);
}
else if (strcmp(args->argv[0], "rail") == 0)
else if (strcmp(args->argv[0], RAIL_SVC_CHANNEL_NAME) == 0)
{
args_handled++;

View File

@ -4,6 +4,7 @@
#include <winpr/windows.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/rdpsnd.h>
int TestClientChannels(int argc, char* argv[])
{
@ -30,7 +31,7 @@ int TestClientChannels(int argc, char* argv[])
freerdp_channels_addin_list_free(ppAddins);
printf("Enumerate rdpsnd\n");
ppAddins = freerdp_channels_list_addins("rdpsnd", NULL, NULL, dwFlags);
ppAddins = freerdp_channels_list_addins(RDPSND_DVC_CHANNEL_NAME, NULL, NULL, dwFlags);
for (index = 0; ppAddins[index] != NULL; index++)
{

View File

@ -0,0 +1,30 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Dynamic Virtual Channel Virtual Channel
*
* Copyright 2021 Armin Novak <anovak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_DRDYNVC_H
#define FREERDP_CHANNEL_DRDYNVC_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#define DRDYNVC_SVC_CHANNEL_NAME "drdynvc"
#endif /* FREERDP_CHANNEL_DRDYNVC_H */

View File

@ -0,0 +1,30 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* TCP redirection Virtual Channel
*
* Copyright 2021 Armin Novak <anovak@thincast.com>
* Copyright 2021 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_RDP2TCP_H
#define FREERDP_CHANNEL_RDP2TCP_H
#include <freerdp/api.h>
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#define RDP2TCP_DVC_CHANNEL_NAME "rdp2tcp"
#endif /* FREERDP_CHANNEL_RDP2TCP_H */

View File

@ -25,4 +25,6 @@
#include <freerdp/codec/audio.h>
#define RDPSND_DVC_CHANNEL_NAME "rdpsnd"
#endif /* FREERDP_CHANNEL_RDPSND_H */

View File

@ -24,6 +24,7 @@
#endif
#include <freerdp/log.h>
#include <freerdp/channels/drdynvc.h>
#include "rdp.h"
@ -423,8 +424,8 @@ UINT freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
PubSub_OnChannelConnected(instance->context->pubSub, instance->context, &e);
}
channels->drdynvc =
(DrdynvcClientContext*)freerdp_channels_get_static_channel_interface(channels, "drdynvc");
channels->drdynvc = (DrdynvcClientContext*)freerdp_channels_get_static_channel_interface(
channels, DRDYNVC_SVC_CHANNEL_NAME);
if (channels->drdynvc)
{

View File

@ -34,6 +34,7 @@
#include <freerdp/log.h>
#include <freerdp/constants.h>
#include <freerdp/server/channels.h>
#include <freerdp/channels/drdynvc.h>
#include "rdp.h"
@ -507,8 +508,8 @@ static BOOL WTSVirtualChannelManagerOpen(WTSVirtualChannelManager* vcm)
/* Initialize drdynvc channel once and only once. */
vcm->drdynvc_state = DRDYNVC_STATE_INITIALIZED;
channel =
(rdpPeerChannel*)WTSVirtualChannelOpen((HANDLE)vcm, WTS_CURRENT_SESSION, "drdynvc");
channel = (rdpPeerChannel*)WTSVirtualChannelOpen((HANDLE)vcm, WTS_CURRENT_SESSION,
DRDYNVC_SVC_CHANNEL_NAME);
if (channel)
{
@ -1249,7 +1250,8 @@ HANDLE WINAPI FreeRDP_WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualNam
for (index = 0; index < mcs->channelCount; index++)
{
rdpMcsChannel* mchannel = &mcs->channels[index];
if (mchannel->joined && (strncmp(mchannel->Name, "drdynvc", CHANNEL_NAME_LEN + 1) == 0))
if (mchannel->joined &&
(strncmp(mchannel->Name, DRDYNVC_SVC_CHANNEL_NAME, CHANNEL_NAME_LEN + 1) == 0))
{
joined = TRUE;
break;

View File

@ -37,6 +37,7 @@
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/channels.h>
#include <freerdp/channels/drdynvc.h>
#include <freerdp/constants.h>
#include <freerdp/server/rdpsnd.h>
@ -619,7 +620,7 @@ static BOOL tf_peer_post_connect(freerdp_peer* client)
}
}
if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, "rdpsnd"))
if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, RDPSND_DVC_CHANNEL_NAME))
{
sf_peer_rdpsnd_init(context); /* Audio Output */
}
@ -856,7 +857,7 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
break;
/* Handle dynamic virtual channel intializations */
if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, "drdynvc"))
if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, DRDYNVC_SVC_CHANNEL_NAME))
{
switch (WTSVirtualChannelManagerGetDrdynvcState(context->vcm))
{

View File

@ -124,7 +124,7 @@ void pf_channels_on_client_channel_connect(void* data, ChannelConnectedEventArgs
pc->cliprdr = (CliprdrClientContext*)e->pInterface;
pf_cliprdr_register_callbacks(pc->cliprdr, ps->cliprdr, pc->pdata);
}
else if (strcmp(e->name, "rdpsnd") == 0)
else if (strcmp(e->name, RDPSND_DVC_CHANNEL_NAME) == 0)
{
/* sound is disabled */
if (ps->rdpsnd == NULL)
@ -178,7 +178,7 @@ void pf_channels_on_client_channel_disconnect(void* data, ChannelDisconnectedEve
pc->cliprdr = NULL;
}
else if (strcmp(e->name, "rdpsnd") == 0)
else if (strcmp(e->name, RDPSND_DVC_CHANNEL_NAME) == 0)
{
/* sound is disabled */
if (ps->rdpsnd == NULL)
@ -216,7 +216,8 @@ BOOL pf_server_channels_init(pServerContext* ps)
return FALSE;
}
if (config->AudioOutput && WTSVirtualChannelManagerIsChannelJoined(ps->vcm, "rdpsnd"))
if (config->AudioOutput &&
WTSVirtualChannelManagerIsChannelJoined(ps->vcm, RDPSND_DVC_CHANNEL_NAME))
{
if (!pf_server_rdpsnd_init(ps))
return FALSE;

View File

@ -95,12 +95,13 @@ static BOOL pf_client_load_rdpsnd(pClientContext* pc)
* if AudioOutput is enabled in proxy and client connected with rdpsnd, use proxy as rdpsnd
* backend. Otherwise, use sys:fake.
*/
if (!freerdp_static_channel_collection_find(context->settings, "rdpsnd"))
if (!freerdp_static_channel_collection_find(context->settings, RDPSND_DVC_CHANNEL_NAME))
{
char* params[2];
params[0] = "rdpsnd";
params[0] = RDPSND_DVC_CHANNEL_NAME;
if (config->AudioOutput && WTSVirtualChannelManagerIsChannelJoined(ps->vcm, "rdpsnd"))
if (config->AudioOutput &&
WTSVirtualChannelManagerIsChannelJoined(ps->vcm, RDPSND_DVC_CHANNEL_NAME))
params[1] = "sys:proxy";
else
params[1] = "sys:fake";

View File

@ -36,7 +36,7 @@ UINT shadow_client_channels_post_connect(rdpShadowClient* client)
shadow_client_remdesk_init(client);
}
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, "rdpsnd"))
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, RDPSND_DVC_CHANNEL_NAME))
{
shadow_client_rdpsnd_init(client);
}

View File

@ -32,6 +32,7 @@
#include <winpr/interlocked.h>
#include <freerdp/log.h>
#include <freerdp/channels/drdynvc.h>
#include "shadow.h"
@ -2185,7 +2186,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
}
else
{
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, "drdynvc"))
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, DRDYNVC_SVC_CHANNEL_NAME))
{
switch (WTSVirtualChannelManagerGetDrdynvcState(client->vcm))
{