diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index 2754d503f..854b5627b 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -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)) && diff --git a/channels/cliprdr/server/cliprdr_main.c b/channels/cliprdr/server/cliprdr_main.c index 80f099ba7..c210fed5e 100644 --- a/channels/cliprdr/server/cliprdr_main.c +++ b/channels/cliprdr/server/cliprdr_main.c @@ -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) { diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 65129d093..98e1d9297 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -26,6 +26,8 @@ #include #include +#include + #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; diff --git a/channels/drdynvc/server/drdynvc_main.c b/channels/drdynvc/server/drdynvc_main.c index 66440b27b..3fb2ff936 100644 --- a/channels/drdynvc/server/drdynvc_main.c +++ b/channels/drdynvc/server/drdynvc_main.c @@ -27,6 +27,7 @@ #include #include #include +#include #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) { diff --git a/channels/encomsp/client/encomsp_main.c b/channels/encomsp/client/encomsp_main.c index b384337fe..97f34515d 100644 --- a/channels/encomsp/client/encomsp_main.c +++ b/channels/encomsp/client/encomsp_main.c @@ -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)) && diff --git a/channels/encomsp/server/encomsp_main.c b/channels/encomsp/server/encomsp_main.c index 9b1693bbb..ead0d703b 100644 --- a/channels/encomsp/server/encomsp_main.c +++ b/channels/encomsp/server/encomsp_main.c @@ -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; diff --git a/channels/rail/client/rail_main.c b/channels/rail/client/rail_main.c index 06a749366..cd8f934e5 100644 --- a/channels/rail/client/rail_main.c +++ b/channels/rail/client/rail_main.c @@ -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; } diff --git a/channels/rdp2tcp/client/rdp2tcp_main.c b/channels/rdp2tcp/client/rdp2tcp_main.c index ae7e7acd0..3fe642c81 100644 --- a/channels/rdp2tcp/client/rdp2tcp_main.c +++ b/channels/rdp2tcp/client/rdp2tcp_main.c @@ -25,11 +25,10 @@ #include #include - -#define RDP2TCP_CHAN_NAME "rdp2tcp" +#include #include -#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; diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index 95fc2cd6e..beaa2873f 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -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 { diff --git a/channels/rdpsnd/server/rdpsnd_main.c b/channels/rdpsnd/server/rdpsnd_main.c index fa5fd7b59..ea4e9ee25 100644 --- a/channels/rdpsnd/server/rdpsnd_main.c +++ b/channels/rdpsnd/server/rdpsnd_main.c @@ -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) { diff --git a/channels/remdesk/client/remdesk_main.c b/channels/remdesk/client/remdesk_main.c index e6a0cc2c8..39f6a4ed0 100644 --- a/channels/remdesk/client/remdesk_main.c +++ b/channels/remdesk/client/remdesk_main.c @@ -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; diff --git a/channels/remdesk/server/remdesk_main.c b/channels/remdesk/server/remdesk_main.c index aeaa332e5..2be8056ca 100644 --- a/channels/remdesk/server/remdesk_main.c +++ b/channels/remdesk/server/remdesk_main.c @@ -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) { diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 825849d1b..2679a204e 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -34,6 +34,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include @@ -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; } diff --git a/client/common/compatibility.c b/client/common/compatibility.c index 6498ba678..efa7af18d 100644 --- a/client/common/compatibility.c +++ b/client/common/compatibility.c @@ -31,6 +31,10 @@ #include #include #include +#include +#include +#include +#include #include @@ -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++; diff --git a/client/common/test/TestClientChannels.c b/client/common/test/TestClientChannels.c index 28e25bece..07aaf6453 100644 --- a/client/common/test/TestClientChannels.c +++ b/client/common/test/TestClientChannels.c @@ -4,6 +4,7 @@ #include #include +#include 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++) { diff --git a/include/freerdp/channels/drdynvc.h b/include/freerdp/channels/drdynvc.h new file mode 100644 index 000000000..cf24746af --- /dev/null +++ b/include/freerdp/channels/drdynvc.h @@ -0,0 +1,30 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Dynamic Virtual Channel Virtual Channel + * + * Copyright 2021 Armin Novak + * 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 +#include +#include + +#define DRDYNVC_SVC_CHANNEL_NAME "drdynvc" + +#endif /* FREERDP_CHANNEL_DRDYNVC_H */ diff --git a/include/freerdp/channels/rdp2tcp.h b/include/freerdp/channels/rdp2tcp.h new file mode 100644 index 000000000..f332795e7 --- /dev/null +++ b/include/freerdp/channels/rdp2tcp.h @@ -0,0 +1,30 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * TCP redirection Virtual Channel + * + * Copyright 2021 Armin Novak + * 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 +#include +#include + +#define RDP2TCP_DVC_CHANNEL_NAME "rdp2tcp" + +#endif /* FREERDP_CHANNEL_RDP2TCP_H */ diff --git a/include/freerdp/channels/rdpsnd.h b/include/freerdp/channels/rdpsnd.h index 207375405..1f39fd869 100644 --- a/include/freerdp/channels/rdpsnd.h +++ b/include/freerdp/channels/rdpsnd.h @@ -25,4 +25,6 @@ #include +#define RDPSND_DVC_CHANNEL_NAME "rdpsnd" + #endif /* FREERDP_CHANNEL_RDPSND_H */ diff --git a/libfreerdp/core/client.c b/libfreerdp/core/client.c index 09a65fc49..16849a592 100644 --- a/libfreerdp/core/client.c +++ b/libfreerdp/core/client.c @@ -24,6 +24,7 @@ #endif #include +#include #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) { diff --git a/libfreerdp/core/server.c b/libfreerdp/core/server.c index 66bbafd73..c9b740b66 100644 --- a/libfreerdp/core/server.c +++ b/libfreerdp/core/server.c @@ -34,6 +34,7 @@ #include #include #include +#include #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; diff --git a/server/Sample/sfreerdp.c b/server/Sample/sfreerdp.c index e0ba9f202..2d340bd5a 100644 --- a/server/Sample/sfreerdp.c +++ b/server/Sample/sfreerdp.c @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -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)) { diff --git a/server/proxy/pf_channels.c b/server/proxy/pf_channels.c index a6b0ca073..b20a486f6 100644 --- a/server/proxy/pf_channels.c +++ b/server/proxy/pf_channels.c @@ -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; diff --git a/server/proxy/pf_client.c b/server/proxy/pf_client.c index 3f7b37c1c..c603bab9e 100644 --- a/server/proxy/pf_client.c +++ b/server/proxy/pf_client.c @@ -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"; diff --git a/server/shadow/shadow_channels.c b/server/shadow/shadow_channels.c index 983b16f1d..7e5ab608b 100644 --- a/server/shadow/shadow_channels.c +++ b/server/shadow/shadow_channels.c @@ -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); } diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c index be9e3d741..f0a75ce80 100644 --- a/server/shadow/shadow_client.c +++ b/server/shadow/shadow_client.c @@ -32,6 +32,7 @@ #include #include +#include #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)) {