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; }
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; }
/** * 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; }