From 53d88c1c964cf3102fcd36137984589818c01998 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 12 Feb 2024 13:32:28 +0100 Subject: [PATCH] [server,sample] delay WTSVirtualChannelManagerCheckFileDescriptor Only call WTSVirtualChannelManagerCheckFileDescriptor if there was a event pending on WTSVirtualChannelManagerGetEventHandle This ensures that the drdynvc channel is not opened before it is initialized. --- server/Sample/sfreerdp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/Sample/sfreerdp.c b/server/Sample/sfreerdp.c index e56c7b19d..ffe0701ac 100644 --- a/server/Sample/sfreerdp.c +++ b/server/Sample/sfreerdp.c @@ -1159,7 +1159,9 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg) count += tmp; } - handles[count++] = WTSVirtualChannelManagerGetEventHandle(context->vcm); + + HANDLE channelHandle = WTSVirtualChannelManagerGetEventHandle(context->vcm); + handles[count++] = channelHandle; status = WaitForMultipleObjects(count, handles, FALSE, INFINITE); if (status == WAIT_FAILED) @@ -1172,6 +1174,9 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg) if (client->CheckFileDescriptor(client) != TRUE) break; + if (WaitForSingleObject(channelHandle, 0) != WAIT_OBJECT_0) + continue; + if (WTSVirtualChannelManagerCheckFileDescriptor(context->vcm) != TRUE) break;