예제 #1
0
int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, uint32 ChannelId)
{
	DVCMAN_CHANNEL* channel;
	IWTSVirtualChannel* ichannel;

	channel = dvcman_find_channel_by_id(pChannelMgr, ChannelId);

	if (channel == NULL)
	{
		DEBUG_WARN("ChannelId %d not found!", ChannelId);
		return 1;
	}

	if (channel->dvc_data)
	{
		stream_free(channel->dvc_data);
		channel->dvc_data = NULL;
	}

	DEBUG_DVC("dvcman_close_channel: channel %d closed", ChannelId);
	ichannel = (IWTSVirtualChannel*)channel;
	ichannel->Close(ichannel);

	return 0;
}
예제 #2
0
파일: dvcman.c 프로젝트: Auto-Droid/FreeRDP
int dvcman_close_channel(IWTSVirtualChannelManager *pChannelMgr, UINT32 ChannelId)
{
	DVCMAN_CHANNEL *channel;
	IWTSVirtualChannel *ichannel;
	DrdynvcClientContext *context;
	DVCMAN *dvcman = (DVCMAN *) pChannelMgr;
	assert(dvcman);
	channel = (DVCMAN_CHANNEL *) dvcman_find_channel_by_id(pChannelMgr, ChannelId);

	if (!channel)
	{
		DEBUG_WARN("ChannelId %d not found!", ChannelId);
		return 1;
	}

	if (channel->dvc_data)
	{
		Stream_Free(channel->dvc_data, TRUE);
		channel->dvc_data = NULL;
	}

	if (channel->status == 0)
	{
		assert(dvcman->drdynvc);
		context = dvcman->drdynvc->context;
		IFCALL(context->OnChannelDisconnected, context, channel->channel_name, channel->pInterface);
		DEBUG_DVC("dvcman_close_channel: channel %d closed", ChannelId);
		ichannel = (IWTSVirtualChannel *) channel;
		ichannel->Close(ichannel);
	}

	return 0;
}
예제 #3
0
/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr,
				 UINT32 ChannelId)
{
	DVCMAN_CHANNEL* channel;
	IWTSVirtualChannel* ichannel;
	DrdynvcClientContext* context;
	DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
	UINT error = CHANNEL_RC_OK;

	channel = (DVCMAN_CHANNEL*) dvcman_find_channel_by_id(pChannelMgr, ChannelId);

	if (!channel)
	{
		//WLog_ERR(TAG, "ChannelId %d not found!", ChannelId);
		/**
		 * Windows 8 / Windows Server 2012 send close requests for channels that failed to be created.
		 * Do not warn, simply return success here.
		 */
		return CHANNEL_RC_OK;
	}

	if (channel->status == CHANNEL_RC_OK)
	{
		context = dvcman->drdynvc->context;

		IFCALLRET(context->OnChannelDisconnected, error, context, channel->channel_name, channel->pInterface);
		if (error)
		{
			WLog_ERR(TAG, "OnChannelDisconnected returned with error %lu!", error);
			return error;
		}

		WLog_DBG(TAG, "dvcman_close_channel: channel %d closed", ChannelId);

		ichannel = (IWTSVirtualChannel*) channel;

		if ((ichannel->Close) && (error = ichannel->Close(ichannel)))
		{
			WLog_ERR(TAG, "Close failed with eror %lu!", error);
			return error;
		}
	}

	ArrayList_Remove(dvcman->channels, channel);

	return CHANNEL_RC_OK;
}
예제 #4
0
static UINT video_control_send_client_notification(VideoClientContext *context, TSMM_CLIENT_NOTIFICATION *notif)
{
	BYTE buf[100];
	wStream *s;
	VIDEO_PLUGIN* video = (VIDEO_PLUGIN *)context->handle;
	IWTSVirtualChannel* channel;
	UINT ret;
	UINT32 cbSize;

	s = Stream_New(buf, 30);
	if (!s)
		return CHANNEL_RC_NO_MEMORY;

	cbSize = 16;
	Stream_Seek_UINT32(s); /* cbSize */
	Stream_Write_UINT32(s, TSMM_PACKET_TYPE_CLIENT_NOTIFICATION); /* PacketType */
	Stream_Write_UINT8(s, notif->PresentationId);
	Stream_Write_UINT8(s, notif->NotificationType);
	Stream_Zero(s, 2);
	if (notif->NotificationType == TSMM_CLIENT_NOTIFICATION_TYPE_FRAMERATE_OVERRIDE)
	{
		Stream_Write_UINT32(s, 16); /* cbData */

		/* TSMM_CLIENT_NOTIFICATION_FRAMERATE_OVERRIDE */
		Stream_Write_UINT32(s, notif->FramerateOverride.Flags);
		Stream_Write_UINT32(s, notif->FramerateOverride.DesiredFrameRate);
		Stream_Zero(s, 4 * 2);

		cbSize += 4 * 4;
	}
	else
	{
		Stream_Write_UINT32(s, 0); /* cbData */
	}

	Stream_SealLength(s);
	Stream_SetPosition(s, 0);
	Stream_Write_UINT32(s, cbSize);
	Stream_Free(s, FALSE);

	channel = video->control_callback->channel_callback->channel;
	ret = channel->Write(channel, cbSize, buf, NULL);

	return ret;
}
예제 #5
0
static UINT video_control_send_presentation_response(VideoClientContext *context, TSMM_PRESENTATION_RESPONSE *resp)
{
	BYTE buf[12];
	wStream *s;
	VIDEO_PLUGIN* video = (VIDEO_PLUGIN *)context->handle;
	IWTSVirtualChannel* channel;
	UINT ret;

	s = Stream_New(buf, 12);
	if (!s)
		return CHANNEL_RC_NO_MEMORY;

	Stream_Write_UINT32(s, 12); /* cbSize */
	Stream_Write_UINT32(s, TSMM_PACKET_TYPE_PRESENTATION_RESPONSE); /* PacketType */
	Stream_Write_UINT8(s, resp->PresentationId);
	Stream_Zero(s, 3);
	Stream_SealLength(s);

	channel = video->control_callback->channel_callback->channel;
	ret = channel->Write(channel, 12, buf, NULL);
	Stream_Free(s, FALSE);

	return ret;
}