[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.
This commit is contained in:
akallabeth
2024-02-12 13:32:28 +01:00
committed by akallabeth
parent cbab66a249
commit 53d88c1c96

View File

@@ -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;