server: add WTSVirtualChannelManagerCheckFileDescriptorEx API

This commit is contained in:
Kobi Mizrachi 2020-08-09 13:38:50 +03:00 committed by kubistika
parent b37081a35c
commit e0fa47f3b3
2 changed files with 32 additions and 6 deletions

View File

@ -59,6 +59,7 @@ extern "C"
FREERDP_API void WTSVirtualChannelManagerGetFileDescriptor(HANDLE hServer, void** fds,
int* fds_count);
FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer);
FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptorEx(HANDLE hServer, BOOL autoOpen);
FREERDP_API HANDLE WTSVirtualChannelManagerGetEventHandle(HANDLE hServer);
FREERDP_API BOOL WTSVirtualChannelManagerIsChannelJoined(HANDLE hServer, const char* name);
FREERDP_API BYTE WTSVirtualChannelManagerGetDrdynvcState(HANDLE hServer);

View File

@ -450,16 +450,16 @@ void WTSVirtualChannelManagerGetFileDescriptor(HANDLE hServer, void** fds, int*
#endif
}
BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer)
static BOOL WTSVirtualChannelManagerOpen(WTSVirtualChannelManager* vcm)
{
wMessage message;
BOOL status = TRUE;
rdpPeerChannel* channel;
UINT32 dynvc_caps;
WTSVirtualChannelManager* vcm = (WTSVirtualChannelManager*)hServer;
if (!vcm)
return FALSE;
if ((vcm->drdynvc_state == DRDYNVC_STATE_NONE) && vcm->client->activated)
{
rdpPeerChannel* channel;
UINT32 dynvc_caps;
/* Initialize drdynvc channel once and only once. */
vcm->drdynvc_state = DRDYNVC_STATE_INITIALIZED;
channel =
@ -476,6 +476,26 @@ BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer)
}
}
return TRUE;
}
BOOL WTSVirtualChannelManagerCheckFileDescriptorEx(HANDLE hServer, BOOL autoOpen)
{
wMessage message;
BOOL status = TRUE;
WTSVirtualChannelManager* vcm;
if (!hServer || hServer == INVALID_HANDLE_VALUE)
return FALSE;
vcm = (WTSVirtualChannelManager*)hServer;
if (autoOpen)
{
if (!WTSVirtualChannelManagerOpen(vcm))
return FALSE;
}
while (MessageQueue_Peek(vcm->queue, &message, TRUE))
{
BYTE* buffer;
@ -499,6 +519,11 @@ BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer)
return status;
}
BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer)
{
return WTSVirtualChannelManagerCheckFileDescriptorEx(hServer, TRUE);
}
HANDLE WTSVirtualChannelManagerGetEventHandle(HANDLE hServer)
{
WTSVirtualChannelManager* vcm = (WTSVirtualChannelManager*)hServer;