[channel,server] fix unguarded use of functions

If functions of channel_<name>_server are used guard them so the code
compiles if the channel is not compiled in.
This commit is contained in:
Armin Novak 2024-06-12 09:26:48 +02:00
parent 0d2a94f373
commit 1806daa375
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105
4 changed files with 38 additions and 15 deletions

View File

@ -45,14 +45,22 @@
#include <freerdp/server/cliprdr.h>
#include <freerdp/server/echo.h>
#include <freerdp/server/rdpdr.h>
#if defined(CHANNEL_RAIL_SERVER)
#include <freerdp/server/rdpei.h>
#endif
#include <freerdp/server/drdynvc.h>
#include <freerdp/server/remdesk.h>
#include <freerdp/server/encomsp.h>
#if defined(CHANNEL_RAIL_SERVER)
#include <freerdp/server/rail.h>
#endif
#include <freerdp/server/telemetry.h>
#if defined(CHANNEL_RDPGFX_SERVER)
#include <freerdp/server/rdpgfx.h>
#endif
#if defined(CHANNEL_DISP_SERVER)
#include <freerdp/server/disp.h>
#endif
#if defined(CHANNEL_RDPEMSC_SERVER)
#include <freerdp/server/rdpemsc.h>
@ -87,13 +95,21 @@ void freerdp_channels_dummy(void)
echo_server_context* echo = NULL;
RdpdrServerContext* rdpdr = NULL;
DrdynvcServerContext* drdynvc = NULL;
#if defined(CHANNEL_RDPEI_SERVER)
RdpeiServerContext* rdpei = NULL;
#endif
RemdeskServerContext* remdesk = NULL;
EncomspServerContext* encomsp = NULL;
#if defined(CHANNEL_RAIL_SERVER)
RailServerContext* rail = NULL;
#endif
TelemetryServerContext* telemetry = NULL;
#if defined(CHANNEL_RDPGFX_SERVER)
RdpgfxServerContext* rdpgfx = NULL;
#endif
#if defined(CHANNEL_DISP_SERVER)
DispServerContext* disp = NULL;
#endif
#if defined(CHANNEL_RDPEMSC_SERVER)
MouseCursorServerContext* mouse_cursor = NULL;
#endif /* CHANNEL_RDPEMSC_SERVER */
@ -123,21 +139,28 @@ void freerdp_channels_dummy(void)
rdpdr_server_context_free(rdpdr);
drdynvc = drdynvc_server_context_new(NULL);
drdynvc_server_context_free(drdynvc);
#if defined(CHANNEL_RDPEI_SERVER)
rdpei = rdpei_server_context_new(NULL);
rdpei_server_context_free(rdpei);
#endif
remdesk = remdesk_server_context_new(NULL);
remdesk_server_context_free(remdesk);
encomsp = encomsp_server_context_new(NULL);
encomsp_server_context_free(encomsp);
#if defined(CHANNEL_RAIL_SERVER)
rail = rail_server_context_new(NULL);
rail_server_context_free(rail);
#endif
telemetry = telemetry_server_context_new(NULL);
telemetry_server_context_free(telemetry);
#if defined(CHANNEL_RDPGFX_SERVER)
rdpgfx = rdpgfx_server_context_new(NULL);
rdpgfx_server_context_free(rdpgfx);
#endif
#if defined(CHANNEL_DISP_SERVER)
disp = disp_server_context_new(NULL);
disp_server_context_free(disp);
#endif
#if defined(CHANNEL_RDPEMSC_SERVER)
mouse_cursor = mouse_cursor_server_context_new(NULL);
mouse_cursor_server_context_free(mouse_cursor);

View File

@ -41,26 +41,16 @@ UINT shadow_client_channels_post_connect(rdpShadowClient* client)
shadow_client_audin_init(client);
if (freerdp_settings_get_bool(client->context.settings, FreeRDP_SupportGraphicsPipeline))
{
shadow_client_rdpgfx_init(client);
}
shadow_client_rdpgfx_init(client);
return CHANNEL_RC_OK;
}
void shadow_client_channels_free(rdpShadowClient* client)
{
if (freerdp_settings_get_bool(client->context.settings, FreeRDP_SupportGraphicsPipeline))
{
shadow_client_rdpgfx_uninit(client);
}
shadow_client_rdpgfx_uninit(client);
shadow_client_audin_uninit(client);
shadow_client_rdpsnd_uninit(client);
shadow_client_remdesk_uninit(client);
shadow_client_encomsp_uninit(client);
}

View File

@ -2196,10 +2196,12 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
events[nCount++] = ChannelEvent;
events[nCount++] = MessageQueue_Event(MsgQueue);
#if defined(CHANNEL_RDPGFX_SERVER)
HANDLE gfxevent = rdpgfx_server_get_event_handle(client->rdpgfx);
if (gfxevent)
events[nCount++] = gfxevent;
#endif
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
@ -2329,6 +2331,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
}
}
#if defined(CHANNEL_RDPGFX_SERVER)
if (gfxevent)
{
if (WaitForSingleObject(gfxevent, 0) == WAIT_OBJECT_0)
@ -2336,6 +2339,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
rdpgfx_server_handle_messages(client->rdpgfx);
}
}
#endif
if (WaitForSingleObject(MessageQueue_Event(MsgQueue), 0) == WAIT_OBJECT_0)
{

View File

@ -29,11 +29,13 @@ int shadow_client_rdpgfx_init(rdpShadowClient* client)
{
WINPR_ASSERT(client);
if (!freerdp_settings_get_bool(client->context.settings, FreeRDP_SupportGraphicsPipeline))
return 1;
#if defined(CHANNEL_RDPGFX_SERVER)
RdpgfxServerContext* rdpgfx = client->rdpgfx = rdpgfx_server_context_new(client->vcm);
if (!rdpgfx)
{
return 0;
}
rdpgfx->rdpcontext = &client->context;
@ -41,15 +43,19 @@ int shadow_client_rdpgfx_init(rdpShadowClient* client)
if (!IFCALLRESULT(CHANNEL_RC_OK, rdpgfx->Initialize, rdpgfx, TRUE))
return -1;
#endif
return 1;
}
void shadow_client_rdpgfx_uninit(rdpShadowClient* client)
{
WINPR_ASSERT(client);
if (client->rdpgfx)
{
#if defined(CHANNEL_RDPGFX_SERVER)
rdpgfx_server_context_free(client->rdpgfx);
#endif
client->rdpgfx = NULL;
}
}