Blame channels/disp/client/disp_main.c

Packit 1fb8d4
/**
Packit 1fb8d4
 * FreeRDP: A Remote Desktop Protocol Implementation
Packit 1fb8d4
 * Display Update Virtual Channel Extension
Packit 1fb8d4
 *
Packit 1fb8d4
 * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
Packit 1fb8d4
 * Copyright 2015 Thincast Technologies GmbH
Packit 1fb8d4
 * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
Packit 1fb8d4
 * Copyright 2016 David PHAM-VAN <d.phamvan@inuvika.com>
Packit 1fb8d4
 *
Packit 1fb8d4
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
 * you may not use this file except in compliance with the License.
Packit 1fb8d4
 * You may obtain a copy of the License at
Packit 1fb8d4
 *
Packit 1fb8d4
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
 *
Packit 1fb8d4
 * Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
 * See the License for the specific language governing permissions and
Packit 1fb8d4
 * limitations under the License.
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
#ifdef HAVE_CONFIG_H
Packit 1fb8d4
#include "config.h"
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#include <stdio.h>
Packit 1fb8d4
#include <stdlib.h>
Packit 1fb8d4
#include <string.h>
Packit 1fb8d4
Packit 1fb8d4
#include <winpr/crt.h>
Packit 1fb8d4
#include <winpr/synch.h>
Packit 1fb8d4
#include <winpr/print.h>
Packit 1fb8d4
#include <winpr/thread.h>
Packit 1fb8d4
#include <winpr/stream.h>
Packit 1fb8d4
#include <winpr/sysinfo.h>
Packit 1fb8d4
#include <winpr/cmdline.h>
Packit 1fb8d4
#include <winpr/collections.h>
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/addin.h>
Packit 1fb8d4
Packit 1fb8d4
#include "disp_main.h"
Packit Service 5a9772
#include "../disp_common.h"
Packit 1fb8d4
Packit 1fb8d4
struct _DISP_CHANNEL_CALLBACK
Packit 1fb8d4
{
Packit 1fb8d4
	IWTSVirtualChannelCallback iface;
Packit 1fb8d4
Packit 1fb8d4
	IWTSPlugin* plugin;
Packit 1fb8d4
	IWTSVirtualChannelManager* channel_mgr;
Packit 1fb8d4
	IWTSVirtualChannel* channel;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _DISP_CHANNEL_CALLBACK DISP_CHANNEL_CALLBACK;
Packit 1fb8d4
Packit 1fb8d4
struct _DISP_LISTENER_CALLBACK
Packit 1fb8d4
{
Packit 1fb8d4
	IWTSListenerCallback iface;
Packit 1fb8d4
Packit 1fb8d4
	IWTSPlugin* plugin;
Packit 1fb8d4
	IWTSVirtualChannelManager* channel_mgr;
Packit 1fb8d4
	DISP_CHANNEL_CALLBACK* channel_callback;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _DISP_LISTENER_CALLBACK DISP_LISTENER_CALLBACK;
Packit 1fb8d4
Packit 1fb8d4
struct _DISP_PLUGIN
Packit 1fb8d4
{
Packit 1fb8d4
	IWTSPlugin iface;
Packit 1fb8d4
Packit 1fb8d4
	IWTSListener* listener;
Packit 1fb8d4
	DISP_LISTENER_CALLBACK* listener_callback;
Packit 1fb8d4
Packit 1fb8d4
	UINT32 MaxNumMonitors;
Packit 1fb8d4
	UINT32 MaxMonitorAreaFactorA;
Packit 1fb8d4
	UINT32 MaxMonitorAreaFactorB;
Packit 1fb8d4
};
Packit 1fb8d4
typedef struct _DISP_PLUGIN DISP_PLUGIN;
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit Service 5a9772
static UINT disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback,
Packit Service 5a9772
                                                         UINT32 NumMonitors,
Packit Service 5a9772
                                                         DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors)
Packit 1fb8d4
{
Packit 1fb8d4
	UINT status;
Packit 1fb8d4
	wStream* s;
Packit 1fb8d4
	UINT32 index;
Packit 1fb8d4
	DISP_PLUGIN* disp;
Packit 1fb8d4
	UINT32 MonitorLayoutSize;
Packit Service 5a9772
	DISPLAY_CONTROL_HEADER header;
Packit Service 5a9772
	disp = (DISP_PLUGIN*)callback->plugin;
Packit Service 5a9772
	MonitorLayoutSize = DISPLAY_CONTROL_MONITOR_LAYOUT_SIZE;
Packit Service 5a9772
	header.length = 8 + 8 + (NumMonitors * MonitorLayoutSize);
Packit Service 5a9772
	header.type = DISPLAY_CONTROL_PDU_TYPE_MONITOR_LAYOUT;
Packit 1fb8d4
Packit Service 5a9772
	s = Stream_New(NULL, header.length);
Packit 1fb8d4
Packit Service 5a9772
	if (!s)
Packit 1fb8d4
	{
Packit 1fb8d4
		WLog_ERR(TAG, "Stream_New failed!");
Packit 1fb8d4
		return CHANNEL_RC_NO_MEMORY;
Packit 1fb8d4
	}
Packit 1fb8d4
Packit Service 5a9772
	if ((status = disp_write_header(s, &header)))
Packit Service 5a9772
	{
Packit Service 5a9772
		WLog_ERR(TAG, "Failed to write header with error %" PRIu32 "!", status);
Packit Service 5a9772
		goto out;
Packit Service 5a9772
	}
Packit 1fb8d4
Packit 1fb8d4
	if (NumMonitors > disp->MaxNumMonitors)
Packit 1fb8d4
		NumMonitors = disp->MaxNumMonitors;
Packit 1fb8d4
Packit 1fb8d4
	Stream_Write_UINT32(s, MonitorLayoutSize); /* MonitorLayoutSize (4 bytes) */
Packit Service 5a9772
	Stream_Write_UINT32(s, NumMonitors);       /* NumMonitors (4 bytes) */
Packit Service 5a9772
	WLog_DBG(TAG, "disp_send_display_control_monitor_layout_pdu: NumMonitors=%" PRIu32 "",
Packit Service 5a9772
	         NumMonitors);
Packit 1fb8d4
Packit 1fb8d4
	for (index = 0; index < NumMonitors; index++)
Packit 1fb8d4
	{
Packit 1fb8d4
		Monitors[index].Width -= (Monitors[index].Width % 2);
Packit 1fb8d4
Packit 1fb8d4
		if (Monitors[index].Width < 200)
Packit 1fb8d4
			Monitors[index].Width = 200;
Packit 1fb8d4
Packit 1fb8d4
		if (Monitors[index].Width > 8192)
Packit 1fb8d4
			Monitors[index].Width = 8192;
Packit 1fb8d4
Packit 1fb8d4
		if (Monitors[index].Width % 2)
Packit 1fb8d4
			Monitors[index].Width++;
Packit 1fb8d4
Packit 1fb8d4
		if (Monitors[index].Height < 200)
Packit 1fb8d4
			Monitors[index].Height = 200;
Packit 1fb8d4
Packit 1fb8d4
		if (Monitors[index].Height > 8192)
Packit 1fb8d4
			Monitors[index].Height = 8192;
Packit 1fb8d4
Packit Service 5a9772
		Stream_Write_UINT32(s, Monitors[index].Flags);          /* Flags (4 bytes) */
Packit Service 5a9772
		Stream_Write_UINT32(s, Monitors[index].Left);           /* Left (4 bytes) */
Packit Service 5a9772
		Stream_Write_UINT32(s, Monitors[index].Top);            /* Top (4 bytes) */
Packit Service 5a9772
		Stream_Write_UINT32(s, Monitors[index].Width);          /* Width (4 bytes) */
Packit Service 5a9772
		Stream_Write_UINT32(s, Monitors[index].Height);         /* Height (4 bytes) */
Packit Service 5a9772
		Stream_Write_UINT32(s, Monitors[index].PhysicalWidth);  /* PhysicalWidth (4 bytes) */
Packit 1fb8d4
		Stream_Write_UINT32(s, Monitors[index].PhysicalHeight); /* PhysicalHeight (4 bytes) */
Packit Service 5a9772
		Stream_Write_UINT32(s, Monitors[index].Orientation);    /* Orientation (4 bytes) */
Packit Service 5a9772
		Stream_Write_UINT32(s,
Packit Service 5a9772
		                    Monitors[index].DesktopScaleFactor); /* DesktopScaleFactor (4 bytes) */
Packit 1fb8d4
		Stream_Write_UINT32(s, Monitors[index].DeviceScaleFactor); /* DeviceScaleFactor (4 bytes) */
Packit Service 5a9772
		WLog_DBG(TAG,
Packit Service 5a9772
		         "\t%d : Flags: 0x%08" PRIX32 " Left/Top: (%" PRId32 ",%" PRId32 ") W/H=%" PRIu32
Packit Service 5a9772
		         "x%" PRIu32 ")",
Packit Service 5a9772
		         index, Monitors[index].Flags, Monitors[index].Left, Monitors[index].Top,
Packit Service 5a9772
		         Monitors[index].Width, Monitors[index].Height);
Packit Service 5a9772
		WLog_DBG(TAG,
Packit Service 5a9772
		         "\t   PhysicalWidth: %" PRIu32 " PhysicalHeight: %" PRIu32 " Orientation: %" PRIu32
Packit Service 5a9772
		         "",
Packit Service 5a9772
		         Monitors[index].PhysicalWidth, Monitors[index].PhysicalHeight,
Packit Service 5a9772
		         Monitors[index].Orientation);
Packit 1fb8d4
	}
Packit 1fb8d4
Packit Service 5a9772
out:
Packit 1fb8d4
	Stream_SealLength(s);
Packit Service 5a9772
	status = callback->channel->Write(callback->channel, (UINT32)Stream_Length(s), Stream_Buffer(s),
Packit Service 5a9772
	                                  NULL);
Packit 1fb8d4
	Stream_Free(s, TRUE);
Packit 1fb8d4
	return status;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit Service 5a9772
static UINT disp_recv_display_control_caps_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
Packit 1fb8d4
{
Packit 1fb8d4
	DISP_PLUGIN* disp;
Packit Service 5a9772
	DispClientContext* context;
Packit 1fb8d4
	UINT ret = CHANNEL_RC_OK;
Packit Service 5a9772
	disp = (DISP_PLUGIN*)callback->plugin;
Packit Service 5a9772
	context = (DispClientContext*)disp->iface.pInterface;
Packit 1fb8d4
Packit 1fb8d4
	if (Stream_GetRemainingLength(s) < 12)
Packit 1fb8d4
	{
Packit 1fb8d4
		WLog_ERR(TAG, "not enough remaining data");
Packit 1fb8d4
		return ERROR_INVALID_DATA;
Packit 1fb8d4
	}
Packit 1fb8d4
Packit Service 5a9772
	Stream_Read_UINT32(s, disp->MaxNumMonitors);        /* MaxNumMonitors (4 bytes) */
Packit 1fb8d4
	Stream_Read_UINT32(s, disp->MaxMonitorAreaFactorA); /* MaxMonitorAreaFactorA (4 bytes) */
Packit 1fb8d4
	Stream_Read_UINT32(s, disp->MaxMonitorAreaFactorB); /* MaxMonitorAreaFactorB (4 bytes) */
Packit 1fb8d4
Packit 1fb8d4
	if (context->DisplayControlCaps)
Packit Service 5a9772
		ret = context->DisplayControlCaps(context, disp->MaxNumMonitors,
Packit Service 5a9772
		                                  disp->MaxMonitorAreaFactorA, disp->MaxMonitorAreaFactorB);
Packit 1fb8d4
Packit 1fb8d4
	return ret;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit Service 5a9772
static UINT disp_recv_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
Packit 1fb8d4
{
Packit Service 5a9772
	UINT32 error;
Packit Service 5a9772
	DISPLAY_CONTROL_HEADER header;
Packit 1fb8d4
Packit 1fb8d4
	if (Stream_GetRemainingLength(s) < 8)
Packit 1fb8d4
	{
Packit 1fb8d4
		WLog_ERR(TAG, "not enough remaining data");
Packit 1fb8d4
		return ERROR_INVALID_DATA;
Packit 1fb8d4
	}
Packit 1fb8d4
Packit Service 5a9772
	if ((error = disp_read_header(s, &header)))
Packit Service 5a9772
	{
Packit Service 5a9772
		WLog_ERR(TAG, "disp_read_header failed with error %" PRIu32 "!", error);
Packit Service 5a9772
		return error;
Packit Service 5a9772
	}
Packit 1fb8d4
Packit Service 5a9772
	if (!Stream_EnsureRemainingCapacity(s, header.length))
Packit Service 5a9772
	{
Packit Service 5a9772
		WLog_ERR(TAG, "not enough remaining data");
Packit Service 5a9772
		return ERROR_INVALID_DATA;
Packit Service 5a9772
	}
Packit 1fb8d4
Packit Service 5a9772
	switch (header.type)
Packit 1fb8d4
	{
Packit 1fb8d4
		case DISPLAY_CONTROL_PDU_TYPE_CAPS:
Packit 1fb8d4
			return disp_recv_display_control_caps_pdu(callback, s);
Packit 1fb8d4
Packit 1fb8d4
		default:
Packit Service 5a9772
			WLog_ERR(TAG, "Type %" PRIu32 " not recognized!", header.type);
Packit 1fb8d4
			return ERROR_INTERNAL_ERROR;
Packit 1fb8d4
	}
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit Service 5a9772
static UINT disp_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data)
Packit 1fb8d4
{
Packit Service 5a9772
	DISP_CHANNEL_CALLBACK* callback = (DISP_CHANNEL_CALLBACK*)pChannelCallback;
Packit 1fb8d4
	return disp_recv_pdu(callback, data);
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit 1fb8d4
static UINT disp_on_close(IWTSVirtualChannelCallback* pChannelCallback)
Packit 1fb8d4
{
Packit 1fb8d4
	free(pChannelCallback);
Packit 1fb8d4
	return CHANNEL_RC_OK;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit 1fb8d4
static UINT disp_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
Packit Service 5a9772
                                           IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
Packit Service 5a9772
                                           IWTSVirtualChannelCallback** ppCallback)
Packit 1fb8d4
{
Packit 1fb8d4
	DISP_CHANNEL_CALLBACK* callback;
Packit Service 5a9772
	DISP_LISTENER_CALLBACK* listener_callback = (DISP_LISTENER_CALLBACK*)pListenerCallback;
Packit Service 5a9772
	callback = (DISP_CHANNEL_CALLBACK*)calloc(1, sizeof(DISP_CHANNEL_CALLBACK));
Packit 1fb8d4
Packit 1fb8d4
	if (!callback)
Packit 1fb8d4
	{
Packit 1fb8d4
		WLog_ERR(TAG, "calloc failed!");
Packit 1fb8d4
		return CHANNEL_RC_NO_MEMORY;
Packit 1fb8d4
	}
Packit 1fb8d4
Packit 1fb8d4
	callback->iface.OnDataReceived = disp_on_data_received;
Packit 1fb8d4
	callback->iface.OnClose = disp_on_close;
Packit 1fb8d4
	callback->plugin = listener_callback->plugin;
Packit 1fb8d4
	callback->channel_mgr = listener_callback->channel_mgr;
Packit 1fb8d4
	callback->channel = pChannel;
Packit 1fb8d4
	listener_callback->channel_callback = callback;
Packit Service 5a9772
	*ppCallback = (IWTSVirtualChannelCallback*)callback;
Packit 1fb8d4
	return CHANNEL_RC_OK;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit 1fb8d4
static UINT disp_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManager* pChannelMgr)
Packit 1fb8d4
{
Packit 1fb8d4
	UINT status;
Packit Service 5a9772
	DISP_PLUGIN* disp = (DISP_PLUGIN*)pPlugin;
Packit Service 5a9772
	disp->listener_callback = (DISP_LISTENER_CALLBACK*)calloc(1, sizeof(DISP_LISTENER_CALLBACK));
Packit 1fb8d4
Packit 1fb8d4
	if (!disp->listener_callback)
Packit 1fb8d4
	{
Packit 1fb8d4
		WLog_ERR(TAG, "calloc failed!");
Packit 1fb8d4
		return CHANNEL_RC_NO_MEMORY;
Packit 1fb8d4
	}
Packit 1fb8d4
Packit 1fb8d4
	disp->listener_callback->iface.OnNewChannelConnection = disp_on_new_channel_connection;
Packit 1fb8d4
	disp->listener_callback->plugin = pPlugin;
Packit 1fb8d4
	disp->listener_callback->channel_mgr = pChannelMgr;
Packit 1fb8d4
	status = pChannelMgr->CreateListener(pChannelMgr, DISP_DVC_CHANNEL_NAME, 0,
Packit Service 5a9772
	                                     &disp->listener_callback->iface, &(disp->listener));
Packit 1fb8d4
	disp->listener->pInterface = disp->iface.pInterface;
Packit 1fb8d4
	return status;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit 1fb8d4
static UINT disp_plugin_terminated(IWTSPlugin* pPlugin)
Packit 1fb8d4
{
Packit Service 5a9772
	DISP_PLUGIN* disp = (DISP_PLUGIN*)pPlugin;
Packit Service 5a9772
Packit Service 5a9772
	if (disp && disp->listener_callback)
Packit Service 5a9772
	{
Packit Service 5a9772
		IWTSVirtualChannelManager* mgr = disp->listener_callback->channel_mgr;
Packit Service 5a9772
		if (mgr)
Packit Service 5a9772
			IFCALL(mgr->DestroyListener, mgr, disp->listener);
Packit Service 5a9772
	}
Packit Service 5a9772
Packit 1fb8d4
	free(disp->listener_callback);
Packit 1fb8d4
	free(disp->iface.pInterface);
Packit 1fb8d4
	free(pPlugin);
Packit 1fb8d4
	return CHANNEL_RC_OK;
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Channel Client Interface
Packit 1fb8d4
 */
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit Service 5a9772
static UINT disp_send_monitor_layout(DispClientContext* context, UINT32 NumMonitors,
Packit Service 5a9772
                                     DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors)
Packit 1fb8d4
{
Packit Service 5a9772
	DISP_PLUGIN* disp = (DISP_PLUGIN*)context->handle;
Packit 1fb8d4
	DISP_CHANNEL_CALLBACK* callback = disp->listener_callback->channel_callback;
Packit 1fb8d4
	return disp_send_display_control_monitor_layout_pdu(callback, NumMonitors, Monitors);
Packit 1fb8d4
}
Packit 1fb8d4
Packit 1fb8d4
#ifdef BUILTIN_CHANNELS
Packit Service 5a9772
#define DVCPluginEntry disp_DVCPluginEntry
Packit 1fb8d4
#else
Packit Service 5a9772
#define DVCPluginEntry FREERDP_API DVCPluginEntry
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
/**
Packit 1fb8d4
 * Function description
Packit 1fb8d4
 *
Packit 1fb8d4
 * @return 0 on success, otherwise a Win32 error code
Packit 1fb8d4
 */
Packit 1fb8d4
UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
Packit 1fb8d4
{
Packit 1fb8d4
	UINT error = CHANNEL_RC_OK;
Packit 1fb8d4
	DISP_PLUGIN* disp;
Packit 1fb8d4
	DispClientContext* context;
Packit Service 5a9772
	disp = (DISP_PLUGIN*)pEntryPoints->GetPlugin(pEntryPoints, "disp");
Packit 1fb8d4
Packit 1fb8d4
	if (!disp)
Packit 1fb8d4
	{
Packit Service 5a9772
		disp = (DISP_PLUGIN*)calloc(1, sizeof(DISP_PLUGIN));
Packit Service 5a9772
Packit 1fb8d4
		if (!disp)
Packit 1fb8d4
		{
Packit 1fb8d4
			WLog_ERR(TAG, "calloc failed!");
Packit 1fb8d4
			return CHANNEL_RC_NO_MEMORY;
Packit 1fb8d4
		}
Packit 1fb8d4
Packit 1fb8d4
		disp->iface.Initialize = disp_plugin_initialize;
Packit 1fb8d4
		disp->iface.Connected = NULL;
Packit 1fb8d4
		disp->iface.Disconnected = NULL;
Packit 1fb8d4
		disp->iface.Terminated = disp_plugin_terminated;
Packit 1fb8d4
		disp->MaxNumMonitors = 16;
Packit 1fb8d4
		disp->MaxMonitorAreaFactorA = 8192;
Packit 1fb8d4
		disp->MaxMonitorAreaFactorB = 8192;
Packit Service 5a9772
		context = (DispClientContext*)calloc(1, sizeof(DispClientContext));
Packit 1fb8d4
Packit 1fb8d4
		if (!context)
Packit 1fb8d4
		{
Packit 1fb8d4
			WLog_ERR(TAG, "calloc failed!");
Packit 1fb8d4
			free(disp);
Packit 1fb8d4
			return CHANNEL_RC_NO_MEMORY;
Packit 1fb8d4
		}
Packit 1fb8d4
Packit Service 5a9772
		context->handle = (void*)disp;
Packit 1fb8d4
		context->SendMonitorLayout = disp_send_monitor_layout;
Packit Service 5a9772
		disp->iface.pInterface = (void*)context;
Packit Service 5a9772
		error = pEntryPoints->RegisterPlugin(pEntryPoints, "disp", (IWTSPlugin*)disp);
Packit 1fb8d4
	}
Packit 1fb8d4
	else
Packit 1fb8d4
	{
Packit 1fb8d4
		WLog_ERR(TAG, "could not get disp Plugin.");
Packit 1fb8d4
		return CHANNEL_RC_BAD_CHANNEL;
Packit 1fb8d4
	}
Packit 1fb8d4
Packit 1fb8d4
	return error;
Packit 1fb8d4
}