diff --git a/libfreerdp/core/server.c b/libfreerdp/core/server.c index a81693771..692da3d6f 100644 --- a/libfreerdp/core/server.c +++ b/libfreerdp/core/server.c @@ -192,6 +192,7 @@ static BOOL wts_read_drdynvc_create_response(rdpPeerChannel* channel, wStream* s channel->dvc_open_state = DVC_OPEN_STATE_SUCCEEDED; } + channel->creationStatus = (INT32)CreationStatus; IFCALLRET(channel->vcm->dvc_creation_status, status, channel->vcm->dvc_creation_status_userdata, channel->channelId, (INT32)CreationStatus); if (!status) @@ -1216,6 +1217,8 @@ static rdpPeerChannel* channel_new(WTSVirtualChannelManager* vcm, freerdp_peer* channel->channelId = ChannelId; channel->index = index; channel->channelType = type; + channel->creationStatus = + (type == RDP_PEER_CHANNEL_TYPE_SVC) ? ERROR_SUCCESS : ERROR_OPERATION_IN_PROGRESS; channel->receiveData = Stream_New(NULL, chunkSize); if (!channel->receiveData) @@ -1628,11 +1631,10 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CL WINPR_ASSERT(channel); - hEvent = MessageQueue_Event(channel->queue); - switch ((UINT32)WtsVirtualClass) { case WTSVirtualFileHandle: + hEvent = MessageQueue_Event(channel->queue); pfd = GetEventWaitObject(hEvent); if (pfd) @@ -1657,6 +1659,8 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CL break; case WTSVirtualEventHandle: + hEvent = MessageQueue_Event(channel->queue); + *ppBuffer = malloc(sizeof(HANDLE)); if (!*ppBuffer) @@ -1713,7 +1717,24 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CL } break; + case WTSVirtualChannelOpenStatus: + { + INT32 value = channel->creationStatus; + status = TRUE; + *ppBuffer = malloc(sizeof(value)); + if (!*ppBuffer) + { + SetLastError(E_OUTOFMEMORY); + status = FALSE; + } + else + { + CopyMemory(*ppBuffer, &value, sizeof(value)); + *pBytesReturned = sizeof(value); + } + break; + } default: break; } diff --git a/libfreerdp/core/server.h b/libfreerdp/core/server.h index ef7ab3542..b190ade1d 100644 --- a/libfreerdp/core/server.h +++ b/libfreerdp/core/server.h @@ -64,6 +64,7 @@ struct rdp_peer_channel wMessageQueue* queue; BYTE dvc_open_state; + INT32 creationStatus; UINT32 dvc_total_length; rdpMcsChannel* mcsChannel; diff --git a/winpr/include/winpr/wtsapi.h b/winpr/include/winpr/wtsapi.h index d8c69fd82..ac3b38176 100644 --- a/winpr/include/winpr/wtsapi.h +++ b/winpr/include/winpr/wtsapi.h @@ -760,8 +760,9 @@ typedef enum { WTSVirtualClientData, WTSVirtualFileHandle, - WTSVirtualEventHandle, /* Extended */ - WTSVirtualChannelReady /* Extended */ + WTSVirtualEventHandle, /* Extended */ + WTSVirtualChannelReady, /* Extended */ + WTSVirtualChannelOpenStatus /* Extended */ } WTS_VIRTUAL_CLASS; typedef struct