channels/server: provide error codes to distinguish between not-registered and not-ready state.

This commit is contained in:
Vic Lee 2013-05-19 16:46:02 -07:00
parent 8a1b59a127
commit 25229f520f
1 changed files with 22 additions and 0 deletions

View File

@ -552,9 +552,25 @@ void* WTSVirtualChannelOpenEx(
if ((flags & WTS_CHANNEL_OPTION_DYNAMIC) != 0)
{
for (i = 0; i < client->settings->ChannelCount; i++)
{
if (client->settings->ChannelDefArray[i].joined &&
strncmp(client->settings->ChannelDefArray[i].Name, "drdynvc", 7) == 0)
{
break;
}
}
if (i >= client->settings->ChannelCount)
{
DEBUG_DVC("Dynamic virtual channel not registered.");
SetLastError(ERROR_NOT_FOUND);
return NULL;
}
if (vcm->drdynvc_channel == NULL || vcm->drdynvc_state != DRDYNVC_STATE_READY)
{
DEBUG_DVC("Dynamic virtual channel not ready.");
SetLastError(ERROR_NOT_READY);
return NULL;
}
@ -586,7 +602,10 @@ void* WTSVirtualChannelOpenEx(
len = strlen(pVirtualName);
if (len > 8)
{
SetLastError(ERROR_NOT_FOUND);
return NULL;
}
for (i = 0; i < client->settings->ChannelCount; i++)
{
@ -598,7 +617,10 @@ void* WTSVirtualChannelOpenEx(
}
if (i >= client->settings->ChannelCount)
{
SetLastError(ERROR_NOT_FOUND);
return NULL;
}
channel = (rdpPeerChannel*) client->settings->ChannelDefArray[i].handle;