2013-03-20 00:52:07 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* Input Virtual Channel Extension
|
|
|
|
*
|
|
|
|
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2015-06-09 13:46:10 +03:00
|
|
|
* Copyright 2015 Thincast Technologies GmbH
|
|
|
|
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
|
2013-03-20 00:52:07 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
2013-06-12 00:15:46 +04:00
|
|
|
#include <winpr/synch.h>
|
|
|
|
#include <winpr/thread.h>
|
2013-05-09 07:18:42 +04:00
|
|
|
#include <winpr/stream.h>
|
2013-05-14 03:17:25 +04:00
|
|
|
#include <winpr/sysinfo.h>
|
2013-03-20 00:52:07 +04:00
|
|
|
#include <winpr/cmdline.h>
|
2013-06-12 00:15:46 +04:00
|
|
|
#include <winpr/collections.h>
|
2013-03-20 00:52:07 +04:00
|
|
|
|
|
|
|
#include <freerdp/addin.h>
|
2015-07-15 10:50:35 +03:00
|
|
|
#include <freerdp/freerdp.h>
|
2013-03-20 00:52:07 +04:00
|
|
|
|
2013-05-09 07:18:42 +04:00
|
|
|
#include "rdpei_common.h"
|
2013-03-20 00:52:07 +04:00
|
|
|
|
|
|
|
#include "rdpei_main.h"
|
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
/**
|
|
|
|
* Touch Input
|
|
|
|
* http://msdn.microsoft.com/en-us/library/windows/desktop/dd562197/
|
|
|
|
*
|
|
|
|
* Windows Touch Input
|
|
|
|
* http://msdn.microsoft.com/en-us/library/windows/desktop/dd317321/
|
|
|
|
*
|
|
|
|
* Input: Touch injection sample
|
|
|
|
* http://code.msdn.microsoft.com/windowsdesktop/Touch-Injection-Sample-444d9bf7
|
|
|
|
*
|
|
|
|
* Pointer Input Message Reference
|
|
|
|
* http://msdn.microsoft.com/en-us/library/hh454916/
|
|
|
|
*
|
|
|
|
* POINTER_INFO Structure
|
|
|
|
* http://msdn.microsoft.com/en-us/library/hh454907/
|
|
|
|
*
|
|
|
|
* POINTER_TOUCH_INFO Structure
|
|
|
|
* http://msdn.microsoft.com/en-us/library/hh454910/
|
|
|
|
*/
|
|
|
|
|
2013-05-14 03:17:25 +04:00
|
|
|
#define MAX_CONTACTS 512
|
|
|
|
|
|
|
|
struct _RDPEI_CHANNEL_CALLBACK
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
2013-05-14 03:17:25 +04:00
|
|
|
IWTSVirtualChannelCallback iface;
|
2013-03-20 00:52:07 +04:00
|
|
|
|
|
|
|
IWTSPlugin* plugin;
|
|
|
|
IWTSVirtualChannelManager* channel_mgr;
|
2013-05-14 03:17:25 +04:00
|
|
|
IWTSVirtualChannel* channel;
|
2013-03-20 00:52:07 +04:00
|
|
|
};
|
2013-05-14 03:17:25 +04:00
|
|
|
typedef struct _RDPEI_CHANNEL_CALLBACK RDPEI_CHANNEL_CALLBACK;
|
2013-03-20 00:52:07 +04:00
|
|
|
|
2013-05-14 03:17:25 +04:00
|
|
|
struct _RDPEI_LISTENER_CALLBACK
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
2013-05-14 03:17:25 +04:00
|
|
|
IWTSListenerCallback iface;
|
2013-03-20 00:52:07 +04:00
|
|
|
|
|
|
|
IWTSPlugin* plugin;
|
|
|
|
IWTSVirtualChannelManager* channel_mgr;
|
2013-05-14 03:17:25 +04:00
|
|
|
RDPEI_CHANNEL_CALLBACK* channel_callback;
|
2013-03-20 00:52:07 +04:00
|
|
|
};
|
2013-05-14 03:17:25 +04:00
|
|
|
typedef struct _RDPEI_LISTENER_CALLBACK RDPEI_LISTENER_CALLBACK;
|
2013-03-20 00:52:07 +04:00
|
|
|
|
|
|
|
struct _RDPEI_PLUGIN
|
|
|
|
{
|
|
|
|
IWTSPlugin iface;
|
|
|
|
|
2013-05-14 00:07:42 +04:00
|
|
|
IWTSListener* listener;
|
2013-03-20 00:52:07 +04:00
|
|
|
RDPEI_LISTENER_CALLBACK* listener_callback;
|
2013-05-14 03:17:25 +04:00
|
|
|
|
2014-12-27 23:20:29 +03:00
|
|
|
RdpeiClientContext* context;
|
|
|
|
|
2013-05-14 03:17:25 +04:00
|
|
|
int version;
|
2013-05-15 01:45:52 +04:00
|
|
|
UINT16 maxTouchContacts;
|
2013-05-14 03:17:25 +04:00
|
|
|
UINT64 currentFrameTime;
|
|
|
|
UINT64 previousFrameTime;
|
|
|
|
RDPINPUT_TOUCH_FRAME frame;
|
|
|
|
RDPINPUT_CONTACT_DATA contacts[MAX_CONTACTS];
|
2013-05-15 01:45:52 +04:00
|
|
|
RDPINPUT_CONTACT_POINT* contactPoints;
|
2013-06-12 00:15:46 +04:00
|
|
|
|
|
|
|
HANDLE event;
|
2013-09-05 15:39:05 +04:00
|
|
|
HANDLE stopEvent;
|
2013-06-12 00:15:46 +04:00
|
|
|
HANDLE thread;
|
2013-08-04 00:45:53 +04:00
|
|
|
|
|
|
|
CRITICAL_SECTION lock;
|
2015-07-15 10:50:35 +03:00
|
|
|
rdpContext* rdpcontext;
|
2013-03-20 00:52:07 +04:00
|
|
|
};
|
2013-05-14 00:07:42 +04:00
|
|
|
typedef struct _RDPEI_PLUGIN RDPEI_PLUGIN;
|
2013-03-20 00:52:07 +04:00
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_send_frame(RdpeiClientContext* context);
|
2013-06-12 00:15:46 +04:00
|
|
|
|
2013-05-09 07:18:42 +04:00
|
|
|
const char* RDPEI_EVENTID_STRINGS[] =
|
|
|
|
{
|
|
|
|
"",
|
|
|
|
"EVENTID_SC_READY",
|
|
|
|
"EVENTID_CS_READY",
|
|
|
|
"EVENTID_TOUCH",
|
|
|
|
"EVENTID_SUSPEND_TOUCH",
|
|
|
|
"EVENTID_RESUME_TOUCH",
|
|
|
|
"EVENTID_DISMISS_HOVERING_CONTACT"
|
|
|
|
};
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_add_frame(RdpeiClientContext* context)
|
2013-06-12 00:15:46 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
RDPINPUT_CONTACT_DATA* contact;
|
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
|
|
|
|
rdpei->frame.contactCount = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < rdpei->maxTouchContacts; i++)
|
|
|
|
{
|
2016-09-26 13:12:37 +03:00
|
|
|
contact = (RDPINPUT_CONTACT_DATA*) & (rdpei->contactPoints[i].data);
|
2013-06-12 00:15:46 +04:00
|
|
|
|
|
|
|
if (rdpei->contactPoints[i].dirty)
|
|
|
|
{
|
2016-09-26 13:12:37 +03:00
|
|
|
CopyMemory(&(rdpei->contacts[rdpei->frame.contactCount]), contact,
|
|
|
|
sizeof(RDPINPUT_CONTACT_DATA));
|
2013-06-12 00:15:46 +04:00
|
|
|
rdpei->contactPoints[i].dirty = FALSE;
|
|
|
|
rdpei->frame.contactCount++;
|
|
|
|
}
|
|
|
|
else if (rdpei->contactPoints[i].active)
|
|
|
|
{
|
|
|
|
if (contact->contactFlags & CONTACT_FLAG_DOWN)
|
|
|
|
{
|
|
|
|
contact->contactFlags = CONTACT_FLAG_UPDATE;
|
|
|
|
contact->contactFlags |= CONTACT_FLAG_INRANGE;
|
|
|
|
contact->contactFlags |= CONTACT_FLAG_INCONTACT;
|
|
|
|
}
|
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
CopyMemory(&(rdpei->contacts[rdpei->frame.contactCount]), contact,
|
|
|
|
sizeof(RDPINPUT_CONTACT_DATA));
|
2013-06-12 00:15:46 +04:00
|
|
|
rdpei->frame.contactCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-06-12 00:15:46 +04:00
|
|
|
}
|
|
|
|
|
2018-03-07 14:03:10 +03:00
|
|
|
static DWORD WINAPI rdpei_schedule_thread(LPVOID arg)
|
2013-06-12 00:15:46 +04:00
|
|
|
{
|
|
|
|
DWORD status;
|
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) arg;
|
|
|
|
RdpeiClientContext* context = (RdpeiClientContext*) rdpei->iface.pInterface;
|
2013-09-05 15:39:05 +04:00
|
|
|
HANDLE hdl[] = {rdpei->event, rdpei->stopEvent};
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2014-04-21 22:42:24 +04:00
|
|
|
if (!rdpei)
|
2015-06-09 13:46:10 +03:00
|
|
|
{
|
2015-07-15 10:50:35 +03:00
|
|
|
error = ERROR_INVALID_PARAMETER;
|
|
|
|
goto out;
|
2015-06-09 13:46:10 +03:00
|
|
|
}
|
|
|
|
|
2014-04-21 22:42:24 +04:00
|
|
|
if (!context)
|
2015-06-09 13:46:10 +03:00
|
|
|
{
|
2015-07-15 10:50:35 +03:00
|
|
|
error = ERROR_INVALID_PARAMETER;
|
|
|
|
goto out;
|
2015-06-09 13:46:10 +03:00
|
|
|
}
|
2013-06-12 00:15:46 +04:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2013-09-05 15:39:05 +04:00
|
|
|
status = WaitForMultipleObjects(2, hdl, FALSE, 20);
|
2015-07-30 16:49:21 +03:00
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
if (status == WAIT_FAILED)
|
|
|
|
{
|
|
|
|
error = GetLastError();
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "WaitForMultipleObjects failed with error %"PRIu32"!", error);
|
2016-09-26 13:12:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2015-07-30 16:49:21 +03:00
|
|
|
|
2013-09-05 15:39:05 +04:00
|
|
|
if (status == WAIT_OBJECT_0 + 1)
|
|
|
|
break;
|
2013-06-12 00:15:46 +04:00
|
|
|
|
2013-08-04 00:45:53 +04:00
|
|
|
EnterCriticalSection(&rdpei->lock);
|
2013-06-12 00:15:46 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = rdpei_add_frame(context)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_add_frame failed with error %"PRIu32"!", error);
|
2015-07-15 10:50:35 +03:00
|
|
|
break;
|
2015-06-09 13:46:10 +03:00
|
|
|
}
|
2013-06-12 00:15:46 +04:00
|
|
|
|
|
|
|
if (rdpei->frame.contactCount > 0)
|
2015-06-09 13:46:10 +03:00
|
|
|
{
|
|
|
|
if ((error = rdpei_send_frame(context)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_send_frame failed with error %"PRIu32"!", error);
|
2015-07-15 10:50:35 +03:00
|
|
|
break;
|
2015-06-09 13:46:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-12 00:15:46 +04:00
|
|
|
if (status == WAIT_OBJECT_0)
|
|
|
|
ResetEvent(rdpei->event);
|
|
|
|
|
2013-08-04 00:45:53 +04:00
|
|
|
LeaveCriticalSection(&rdpei->lock);
|
2013-06-12 00:15:46 +04:00
|
|
|
}
|
|
|
|
|
2015-07-15 10:50:35 +03:00
|
|
|
out:
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2018-03-06 18:35:56 +03:00
|
|
|
if (error && rdpei && rdpei->rdpcontext)
|
2016-09-26 13:12:37 +03:00
|
|
|
setChannelError(rdpei->rdpcontext, error,
|
|
|
|
"rdpei_schedule_thread reported an error");
|
2015-07-15 10:50:35 +03:00
|
|
|
|
2018-03-07 14:03:10 +03:00
|
|
|
ExitThread(error);
|
|
|
|
return error;
|
2013-06-12 00:15:46 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT rdpei_send_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s,
|
|
|
|
UINT16 eventId, UINT32 pduLength)
|
2013-05-09 08:21:33 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT status;
|
2013-05-09 08:21:33 +04:00
|
|
|
Stream_SetPosition(s, 0);
|
|
|
|
Stream_Write_UINT16(s, eventId); /* eventId (2 bytes) */
|
|
|
|
Stream_Write_UINT32(s, pduLength); /* pduLength (4 bytes) */
|
|
|
|
Stream_SetPosition(s, Stream_Length(s));
|
2016-09-26 13:12:37 +03:00
|
|
|
status = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s),
|
|
|
|
Stream_Buffer(s), NULL);
|
2013-05-15 03:26:01 +04:00
|
|
|
#ifdef WITH_DEBUG_RDPEI
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_DBG(TAG, "rdpei_send_pdu: eventId: %"PRIu16" (%s) length: %"PRIu32" status: %"PRIu32"",
|
2016-09-26 13:12:37 +03:00
|
|
|
eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength, status);
|
2013-05-15 03:26:01 +04:00
|
|
|
#endif
|
2013-05-09 08:21:33 +04:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_send_cs_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback)
|
2013-05-09 08:21:33 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT status;
|
2013-05-09 08:21:33 +04:00
|
|
|
wStream* s;
|
|
|
|
UINT32 flags;
|
|
|
|
UINT32 pduLength;
|
2013-05-15 01:45:52 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) callback->plugin;
|
2013-05-09 08:21:33 +04:00
|
|
|
flags = 0;
|
|
|
|
flags |= READY_FLAGS_SHOW_TOUCH_VISUALS;
|
|
|
|
//flags |= READY_FLAGS_DISABLE_TIMESTAMP_INJECTION;
|
|
|
|
pduLength = RDPINPUT_HEADER_LENGTH + 10;
|
|
|
|
s = Stream_New(NULL, pduLength);
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2013-05-09 08:21:33 +04:00
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
Stream_Seek(s, RDPINPUT_HEADER_LENGTH);
|
2013-05-09 08:21:33 +04:00
|
|
|
Stream_Write_UINT32(s, flags); /* flags (4 bytes) */
|
2013-07-11 22:04:20 +04:00
|
|
|
Stream_Write_UINT32(s, RDPINPUT_PROTOCOL_V10); /* protocolVersion (4 bytes) */
|
2016-09-26 13:12:37 +03:00
|
|
|
Stream_Write_UINT16(s,
|
|
|
|
rdpei->maxTouchContacts); /* maxTouchContacts (2 bytes) */
|
2013-05-09 08:21:33 +04:00
|
|
|
Stream_SealLength(s);
|
|
|
|
status = rdpei_send_pdu(callback, s, EVENTID_CS_READY, pduLength);
|
|
|
|
Stream_Free(s, TRUE);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
void rdpei_print_contact_flags(UINT32 contactFlags)
|
|
|
|
{
|
|
|
|
if (contactFlags & CONTACT_FLAG_DOWN)
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_DBG(TAG, " CONTACT_FLAG_DOWN");
|
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
if (contactFlags & CONTACT_FLAG_UPDATE)
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_DBG(TAG, " CONTACT_FLAG_UPDATE");
|
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
if (contactFlags & CONTACT_FLAG_UP)
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_DBG(TAG, " CONTACT_FLAG_UP");
|
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
if (contactFlags & CONTACT_FLAG_INRANGE)
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_DBG(TAG, " CONTACT_FLAG_INRANGE");
|
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
if (contactFlags & CONTACT_FLAG_INCONTACT)
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_DBG(TAG, " CONTACT_FLAG_INCONTACT");
|
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
if (contactFlags & CONTACT_FLAG_CANCELED)
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_DBG(TAG, " CONTACT_FLAG_CANCELED");
|
2013-05-15 01:45:52 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
|
2013-05-09 08:21:33 +04:00
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 index;
|
2013-07-11 22:04:20 +04:00
|
|
|
int rectSize = 2;
|
2013-05-09 08:21:33 +04:00
|
|
|
RDPINPUT_CONTACT_DATA* contact;
|
2013-05-15 03:26:01 +04:00
|
|
|
#ifdef WITH_DEBUG_RDPEI
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_DBG(TAG, "contactCount: %"PRIu32"", frame->contactCount);
|
|
|
|
WLog_DBG(TAG, "frameOffset: 0x%016"PRIX64"", frame->frameOffset);
|
2013-05-15 03:26:01 +04:00
|
|
|
#endif
|
2016-09-26 13:12:37 +03:00
|
|
|
rdpei_write_2byte_unsigned(s,
|
|
|
|
frame->contactCount); /* contactCount (TWO_BYTE_UNSIGNED_INTEGER) */
|
2013-06-12 00:15:46 +04:00
|
|
|
/**
|
|
|
|
* the time offset from the previous frame (in microseconds).
|
|
|
|
* If this is the first frame being transmitted then this field MUST be set to zero.
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
rdpei_write_8byte_unsigned(s,
|
|
|
|
frame->frameOffset * 1000); /* frameOffset (EIGHT_BYTE_UNSIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(s, (size_t) frame->contactCount * 64))
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2013-05-09 08:21:33 +04:00
|
|
|
|
|
|
|
for (index = 0; index < frame->contactCount; index++)
|
|
|
|
{
|
|
|
|
contact = &frame->contacts[index];
|
2013-07-11 22:04:20 +04:00
|
|
|
contact->fieldsPresent |= CONTACT_DATA_CONTACTRECT_PRESENT;
|
|
|
|
contact->contactRectLeft = contact->x - rectSize;
|
|
|
|
contact->contactRectTop = contact->y - rectSize;
|
|
|
|
contact->contactRectRight = contact->x + rectSize;
|
|
|
|
contact->contactRectBottom = contact->y + rectSize;
|
2013-05-15 03:26:01 +04:00
|
|
|
#ifdef WITH_DEBUG_RDPEI
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_DBG(TAG, "contact[%"PRIu32"].contactId: %"PRIu32"", index, contact->contactId);
|
|
|
|
WLog_DBG(TAG, "contact[%"PRIu32"].fieldsPresent: %"PRIu32"", index, contact->fieldsPresent);
|
|
|
|
WLog_DBG(TAG, "contact[%"PRIu32"].x: %"PRId32"", index, contact->x);
|
|
|
|
WLog_DBG(TAG, "contact[%"PRIu32"].y: %"PRId32"", index, contact->y);
|
|
|
|
WLog_DBG(TAG, "contact[%"PRIu32"].contactFlags: 0x%08"PRIX32"", index, contact->contactFlags);
|
2013-05-15 01:45:52 +04:00
|
|
|
rdpei_print_contact_flags(contact->contactFlags);
|
2013-05-15 03:26:01 +04:00
|
|
|
#endif
|
2013-05-14 09:06:25 +04:00
|
|
|
Stream_Write_UINT8(s, contact->contactId); /* contactId (1 byte) */
|
|
|
|
/* fieldsPresent (TWO_BYTE_UNSIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_2byte_unsigned(s, contact->fieldsPresent);
|
2013-05-14 09:06:25 +04:00
|
|
|
rdpei_write_4byte_signed(s, contact->x); /* x (FOUR_BYTE_SIGNED_INTEGER) */
|
|
|
|
rdpei_write_4byte_signed(s, contact->y); /* y (FOUR_BYTE_SIGNED_INTEGER) */
|
|
|
|
/* contactFlags (FOUR_BYTE_UNSIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_4byte_unsigned(s, contact->contactFlags);
|
|
|
|
|
|
|
|
if (contact->fieldsPresent & CONTACT_DATA_CONTACTRECT_PRESENT)
|
|
|
|
{
|
2013-05-14 09:06:25 +04:00
|
|
|
/* contactRectLeft (TWO_BYTE_SIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_2byte_signed(s, contact->contactRectLeft);
|
2013-05-14 09:06:25 +04:00
|
|
|
/* contactRectTop (TWO_BYTE_SIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_2byte_signed(s, contact->contactRectTop);
|
2013-05-14 09:06:25 +04:00
|
|
|
/* contactRectRight (TWO_BYTE_SIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_2byte_signed(s, contact->contactRectRight);
|
2013-05-14 09:06:25 +04:00
|
|
|
/* contactRectBottom (TWO_BYTE_SIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_2byte_signed(s, contact->contactRectBottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (contact->fieldsPresent & CONTACT_DATA_ORIENTATION_PRESENT)
|
|
|
|
{
|
2013-05-14 09:06:25 +04:00
|
|
|
/* orientation (FOUR_BYTE_UNSIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_4byte_unsigned(s, contact->orientation);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (contact->fieldsPresent & CONTACT_DATA_PRESSURE_PRESENT)
|
|
|
|
{
|
2013-05-14 09:06:25 +04:00
|
|
|
/* pressure (FOUR_BYTE_UNSIGNED_INTEGER) */
|
2013-05-09 08:21:33 +04:00
|
|
|
rdpei_write_4byte_unsigned(s, contact->pressure);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-05-09 08:21:33 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT rdpei_send_touch_event_pdu(RDPEI_CHANNEL_CALLBACK* callback,
|
|
|
|
RDPINPUT_TOUCH_FRAME* frame)
|
2013-05-09 08:21:33 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT status;
|
2013-05-09 08:21:33 +04:00
|
|
|
wStream* s;
|
|
|
|
UINT32 pduLength;
|
2013-07-11 22:04:20 +04:00
|
|
|
pduLength = 64 + (frame->contactCount * 64);
|
2013-05-14 09:06:25 +04:00
|
|
|
s = Stream_New(NULL, pduLength);
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2013-05-09 08:21:33 +04:00
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
Stream_Seek(s, RDPINPUT_HEADER_LENGTH);
|
2013-06-12 00:15:46 +04:00
|
|
|
/**
|
|
|
|
* the time that has elapsed (in milliseconds) from when the oldest touch frame
|
|
|
|
* was generated to when it was encoded for transmission by the client.
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
rdpei_write_4byte_unsigned(s,
|
|
|
|
(UINT32) frame->frameOffset); /* encodeTime (FOUR_BYTE_UNSIGNED_INTEGER) */
|
2013-06-12 00:15:46 +04:00
|
|
|
rdpei_write_2byte_unsigned(s, 1); /* (frameCount) TWO_BYTE_UNSIGNED_INTEGER */
|
2013-05-09 08:21:33 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((status = rdpei_write_touch_frame(s, frame)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_write_touch_frame failed with error %"PRIu32"!", status);
|
2015-06-09 13:46:10 +03:00
|
|
|
Stream_Free(s, TRUE);
|
|
|
|
return status;
|
|
|
|
}
|
2013-05-09 08:21:33 +04:00
|
|
|
|
|
|
|
Stream_SealLength(s);
|
|
|
|
pduLength = Stream_Length(s);
|
|
|
|
status = rdpei_send_pdu(callback, s, EVENTID_TOUCH, pduLength);
|
|
|
|
Stream_Free(s, TRUE);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
|
2013-05-09 07:18:42 +04:00
|
|
|
{
|
|
|
|
UINT32 protocolVersion;
|
|
|
|
Stream_Read_UINT32(s, protocolVersion); /* protocolVersion (4 bytes) */
|
2013-07-11 22:04:20 +04:00
|
|
|
#if 0
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2013-07-11 22:04:20 +04:00
|
|
|
if (protocolVersion != RDPINPUT_PROTOCOL_V10)
|
2013-05-09 07:18:42 +04:00
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "Unknown [MS-RDPEI] protocolVersion: 0x%08"PRIX32"", protocolVersion);
|
2013-05-09 07:18:42 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
#endif
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-05-09 07:18:42 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_recv_suspend_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
|
2013-05-09 08:21:33 +04:00
|
|
|
{
|
2014-03-11 19:55:38 +04:00
|
|
|
RdpeiClientContext* rdpei = (RdpeiClientContext*) callback->plugin->pInterface;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2015-06-09 13:46:10 +03:00
|
|
|
IFCALLRET(rdpei->SuspendTouch, error, rdpei);
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (error)
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei->SuspendTouch failed with error %"PRIu32"!", error);
|
2014-02-07 22:16:41 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
2013-05-09 08:21:33 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_recv_resume_touch_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
|
2013-05-09 08:21:33 +04:00
|
|
|
{
|
2014-03-11 19:55:38 +04:00
|
|
|
RdpeiClientContext* rdpei = (RdpeiClientContext*) callback->plugin->pInterface;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2015-06-09 13:46:10 +03:00
|
|
|
IFCALLRET(rdpei->ResumeTouch, error, rdpei);
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (error)
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei->ResumeTouch failed with error %"PRIu32"!", error);
|
2014-02-07 22:16:41 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
2013-05-09 08:21:33 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_recv_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
|
2013-05-09 07:18:42 +04:00
|
|
|
{
|
|
|
|
UINT16 eventId;
|
|
|
|
UINT32 pduLength;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2013-05-09 07:18:42 +04:00
|
|
|
Stream_Read_UINT16(s, eventId); /* eventId (2 bytes) */
|
|
|
|
Stream_Read_UINT32(s, pduLength); /* pduLength (4 bytes) */
|
2013-05-15 03:26:01 +04:00
|
|
|
#ifdef WITH_DEBUG_RDPEI
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_DBG(TAG, "rdpei_recv_pdu: eventId: %"PRIu16" (%s) length: %"PRIu32"",
|
2016-09-26 13:12:37 +03:00
|
|
|
eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength);
|
2013-05-15 03:26:01 +04:00
|
|
|
#endif
|
2013-05-09 07:18:42 +04:00
|
|
|
|
|
|
|
switch (eventId)
|
|
|
|
{
|
|
|
|
case EVENTID_SC_READY:
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = rdpei_recv_sc_ready_pdu(callback, s)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_recv_sc_ready_pdu failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
|
|
|
}
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = rdpei_send_cs_ready_pdu(callback)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_send_cs_ready_pdu failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
|
|
|
}
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2013-05-09 07:18:42 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENTID_SUSPEND_TOUCH:
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = rdpei_recv_suspend_touch_pdu(callback, s)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_recv_suspend_touch_pdu failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
|
|
|
}
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2013-05-09 07:18:42 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENTID_RESUME_TOUCH:
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = rdpei_recv_resume_touch_pdu(callback, s)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_recv_resume_touch_pdu failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
|
|
|
}
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2013-05-09 07:18:42 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-05-09 07:18:42 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
static UINT rdpei_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
|
|
|
|
wStream* data)
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
2013-05-09 08:21:33 +04:00
|
|
|
RDPEI_CHANNEL_CALLBACK* callback = (RDPEI_CHANNEL_CALLBACK*) pChannelCallback;
|
2015-06-09 13:46:10 +03:00
|
|
|
return rdpei_recv_pdu(callback, data);
|
2013-03-20 00:52:07 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT rdpei_on_close(IWTSVirtualChannelCallback* pChannelCallback)
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
|
|
|
RDPEI_CHANNEL_CALLBACK* callback = (RDPEI_CHANNEL_CALLBACK*) pChannelCallback;
|
|
|
|
free(callback);
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-03-20 00:52:07 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
static UINT rdpei_on_new_channel_connection(IWTSListenerCallback*
|
|
|
|
pListenerCallback,
|
|
|
|
IWTSVirtualChannel* pChannel, BYTE* Data, BOOL* pbAccept,
|
|
|
|
IWTSVirtualChannelCallback** ppCallback)
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
|
|
|
RDPEI_CHANNEL_CALLBACK* callback;
|
2016-09-26 13:12:37 +03:00
|
|
|
RDPEI_LISTENER_CALLBACK* listener_callback = (RDPEI_LISTENER_CALLBACK*)
|
|
|
|
pListenerCallback;
|
2015-06-09 13:46:10 +03:00
|
|
|
callback = (RDPEI_CHANNEL_CALLBACK*) calloc(1, sizeof(RDPEI_CHANNEL_CALLBACK));
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!callback)
|
|
|
|
{
|
2016-09-26 13:12:37 +03:00
|
|
|
WLog_ERR(TAG, "calloc failed!");
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2013-03-20 00:52:07 +04:00
|
|
|
|
|
|
|
callback->iface.OnDataReceived = rdpei_on_data_received;
|
|
|
|
callback->iface.OnClose = rdpei_on_close;
|
|
|
|
callback->plugin = listener_callback->plugin;
|
|
|
|
callback->channel_mgr = listener_callback->channel_mgr;
|
|
|
|
callback->channel = pChannel;
|
2013-05-14 03:17:25 +04:00
|
|
|
listener_callback->channel_callback = callback;
|
2013-03-20 00:52:07 +04:00
|
|
|
*ppCallback = (IWTSVirtualChannelCallback*) callback;
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-03-20 00:52:07 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
static UINT rdpei_plugin_initialize(IWTSPlugin* pPlugin,
|
|
|
|
IWTSVirtualChannelManager* pChannelMgr)
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2013-05-14 00:07:42 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) pPlugin;
|
2016-09-26 13:12:37 +03:00
|
|
|
rdpei->listener_callback = (RDPEI_LISTENER_CALLBACK*) calloc(1 ,
|
|
|
|
sizeof(RDPEI_LISTENER_CALLBACK));
|
2013-03-20 00:52:07 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!rdpei->listener_callback)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "calloc failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2013-05-14 00:07:42 +04:00
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
rdpei->listener_callback->iface.OnNewChannelConnection =
|
|
|
|
rdpei_on_new_channel_connection;
|
2013-05-14 00:07:42 +04:00
|
|
|
rdpei->listener_callback->plugin = pPlugin;
|
|
|
|
rdpei->listener_callback->channel_mgr = pChannelMgr;
|
2013-03-20 00:52:07 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = pChannelMgr->CreateListener(pChannelMgr, RDPEI_DVC_CHANNEL_NAME, 0,
|
2016-09-26 13:12:37 +03:00
|
|
|
(IWTSListenerCallback*) rdpei->listener_callback, &(rdpei->listener))))
|
2015-06-09 13:46:10 +03:00
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "ChannelMgr->CreateListener failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
goto error_out;
|
|
|
|
}
|
2013-03-20 00:52:07 +04:00
|
|
|
|
2013-05-14 00:07:42 +04:00
|
|
|
rdpei->listener->pInterface = rdpei->iface.pInterface;
|
2013-09-05 15:39:05 +04:00
|
|
|
InitializeCriticalSection(&rdpei->lock);
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!(rdpei->event = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "CreateEvent failed!");
|
|
|
|
goto error_out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(rdpei->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "CreateEvent failed!");
|
|
|
|
goto error_out;
|
|
|
|
}
|
|
|
|
|
2018-03-07 14:03:10 +03:00
|
|
|
if (!(rdpei->thread = CreateThread(NULL, 0,
|
2016-09-26 13:12:37 +03:00
|
|
|
rdpei_schedule_thread, (void*) rdpei, 0, NULL)))
|
2015-06-09 13:46:10 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "CreateThread failed!");
|
|
|
|
goto error_out;
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
error_out:
|
|
|
|
CloseHandle(rdpei->stopEvent);
|
|
|
|
CloseHandle(rdpei->event);
|
|
|
|
free(rdpei->listener_callback);
|
|
|
|
return error;
|
2013-03-20 00:52:07 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT rdpei_plugin_terminated(IWTSPlugin* pPlugin)
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
2013-05-14 00:07:42 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) pPlugin;
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT error;
|
2013-03-20 00:52:07 +04:00
|
|
|
|
2014-04-21 22:42:24 +04:00
|
|
|
if (!pPlugin)
|
2015-06-09 13:46:10 +03:00
|
|
|
return ERROR_INVALID_PARAMETER;
|
2013-09-05 15:39:05 +04:00
|
|
|
|
|
|
|
SetEvent(rdpei->stopEvent);
|
|
|
|
EnterCriticalSection(&rdpei->lock);
|
|
|
|
|
2015-07-30 16:49:21 +03:00
|
|
|
if (WaitForSingleObject(rdpei->thread, INFINITE) == WAIT_FAILED)
|
2016-09-26 13:12:37 +03:00
|
|
|
{
|
|
|
|
error = GetLastError();
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"!", error);
|
2016-09-26 13:12:37 +03:00
|
|
|
return error;
|
|
|
|
}
|
2013-09-05 15:39:05 +04:00
|
|
|
|
|
|
|
CloseHandle(rdpei->stopEvent);
|
|
|
|
CloseHandle(rdpei->event);
|
|
|
|
CloseHandle(rdpei->thread);
|
|
|
|
DeleteCriticalSection(&rdpei->lock);
|
2015-05-11 10:07:39 +03:00
|
|
|
free(rdpei->listener_callback);
|
2014-12-27 23:20:29 +03:00
|
|
|
free(rdpei->context);
|
2013-05-14 00:07:42 +04:00
|
|
|
free(rdpei);
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-03-20 00:52:07 +04:00
|
|
|
}
|
|
|
|
|
2013-05-14 00:07:42 +04:00
|
|
|
/**
|
|
|
|
* Channel Client Interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
int rdpei_get_version(RdpeiClientContext* context)
|
|
|
|
{
|
2013-05-14 03:17:25 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
|
|
|
|
return rdpei->version;
|
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT rdpei_send_frame(RdpeiClientContext* context)
|
2013-05-14 03:17:25 +04:00
|
|
|
{
|
2013-05-15 03:26:01 +04:00
|
|
|
UINT64 currentTime;
|
2013-05-14 03:17:25 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
|
|
|
|
RDPEI_CHANNEL_CALLBACK* callback = rdpei->listener_callback->channel_callback;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2013-05-15 03:26:01 +04:00
|
|
|
currentTime = GetTickCount64();
|
2013-05-14 09:06:25 +04:00
|
|
|
|
2013-05-14 03:17:25 +04:00
|
|
|
if (!rdpei->previousFrameTime && !rdpei->currentFrameTime)
|
|
|
|
{
|
2013-05-15 03:26:01 +04:00
|
|
|
rdpei->currentFrameTime = currentTime;
|
2013-05-14 03:17:25 +04:00
|
|
|
rdpei->frame.frameOffset = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-15 03:26:01 +04:00
|
|
|
rdpei->currentFrameTime = currentTime;
|
2013-05-14 03:17:25 +04:00
|
|
|
rdpei->frame.frameOffset = rdpei->currentFrameTime - rdpei->previousFrameTime;
|
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = rdpei_send_touch_event_pdu(callback, &rdpei->frame)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "rdpei_send_touch_event_pdu failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
|
|
|
}
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2013-05-14 03:17:25 +04:00
|
|
|
rdpei->previousFrameTime = rdpei->currentFrameTime;
|
|
|
|
rdpei->frame.contactCount = 0;
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
2013-05-14 03:17:25 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT rdpei_add_contact(RdpeiClientContext* context,
|
|
|
|
RDPINPUT_CONTACT_DATA* contact)
|
2013-05-14 03:17:25 +04:00
|
|
|
{
|
2013-06-12 00:15:46 +04:00
|
|
|
RDPINPUT_CONTACT_POINT* contactPoint;
|
2013-05-14 03:17:25 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
|
2013-08-04 00:45:53 +04:00
|
|
|
EnterCriticalSection(&rdpei->lock);
|
2016-09-26 13:12:37 +03:00
|
|
|
contactPoint = (RDPINPUT_CONTACT_POINT*)
|
|
|
|
&rdpei->contactPoints[contact->contactId];
|
2013-06-12 00:15:46 +04:00
|
|
|
CopyMemory(&(contactPoint->data), contact, sizeof(RDPINPUT_CONTACT_DATA));
|
|
|
|
contactPoint->dirty = TRUE;
|
|
|
|
SetEvent(rdpei->event);
|
2013-08-04 00:45:53 +04:00
|
|
|
LeaveCriticalSection(&rdpei->lock);
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-05-15 01:45:52 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT rdpei_touch_begin(RdpeiClientContext* context, int externalId, int x,
|
|
|
|
int y, int* contactId)
|
2013-05-15 01:45:52 +04:00
|
|
|
{
|
2015-06-09 13:46:10 +03:00
|
|
|
unsigned int i;
|
|
|
|
int contactIdlocal = -1;
|
2013-06-07 02:14:59 +04:00
|
|
|
RDPINPUT_CONTACT_DATA contact;
|
2013-06-07 02:37:52 +04:00
|
|
|
RDPINPUT_CONTACT_POINT* contactPoint = NULL;
|
2013-05-15 01:45:52 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2013-05-15 01:45:52 +04:00
|
|
|
|
|
|
|
/* Create a new contact point in an empty slot */
|
|
|
|
|
|
|
|
for (i = 0; i < rdpei->maxTouchContacts; i++)
|
|
|
|
{
|
2013-06-07 02:14:59 +04:00
|
|
|
contactPoint = (RDPINPUT_CONTACT_POINT*) &rdpei->contactPoints[i];
|
|
|
|
|
|
|
|
if (!contactPoint->active)
|
2013-05-14 09:06:25 +04:00
|
|
|
{
|
2013-06-07 02:14:59 +04:00
|
|
|
contactPoint->contactId = i;
|
2015-06-09 13:46:10 +03:00
|
|
|
contactIdlocal = contactPoint->contactId;
|
2013-06-07 02:14:59 +04:00
|
|
|
contactPoint->externalId = externalId;
|
|
|
|
contactPoint->active = TRUE;
|
|
|
|
contactPoint->state = RDPINPUT_CONTACT_STATE_ENGAGED;
|
|
|
|
break;
|
2013-05-14 09:06:25 +04:00
|
|
|
}
|
2013-05-15 01:45:52 +04:00
|
|
|
}
|
2013-05-14 09:06:25 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (contactIdlocal >= 0)
|
2013-06-07 02:14:59 +04:00
|
|
|
{
|
|
|
|
ZeroMemory(&contact, sizeof(RDPINPUT_CONTACT_DATA));
|
2013-06-07 02:37:52 +04:00
|
|
|
contactPoint->lastX = x;
|
|
|
|
contactPoint->lastY = y;
|
2013-06-07 02:14:59 +04:00
|
|
|
contact.x = x;
|
|
|
|
contact.y = y;
|
2015-06-09 13:46:10 +03:00
|
|
|
contact.contactId = (UINT32) contactIdlocal;
|
2013-06-07 02:14:59 +04:00
|
|
|
contact.contactFlags |= CONTACT_FLAG_DOWN;
|
|
|
|
contact.contactFlags |= CONTACT_FLAG_INRANGE;
|
|
|
|
contact.contactFlags |= CONTACT_FLAG_INCONTACT;
|
2015-06-09 13:46:10 +03:00
|
|
|
error = context->AddContact(context, &contact);
|
2013-06-07 02:14:59 +04:00
|
|
|
}
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
*contactId = contactIdlocal;
|
|
|
|
return error;
|
2013-05-15 01:45:52 +04:00
|
|
|
}
|
2013-05-14 09:06:25 +04:00
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT rdpei_touch_update(RdpeiClientContext* context, int externalId, int x,
|
|
|
|
int y, int* contactId)
|
2013-05-15 01:45:52 +04:00
|
|
|
{
|
2015-06-09 13:46:10 +03:00
|
|
|
unsigned int i;
|
|
|
|
int contactIdlocal = -1;
|
2013-06-07 02:14:59 +04:00
|
|
|
RDPINPUT_CONTACT_DATA contact;
|
2013-06-07 02:37:52 +04:00
|
|
|
RDPINPUT_CONTACT_POINT* contactPoint = NULL;
|
2013-05-15 01:45:52 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2013-05-14 09:06:25 +04:00
|
|
|
|
2013-05-15 01:45:52 +04:00
|
|
|
for (i = 0; i < rdpei->maxTouchContacts; i++)
|
|
|
|
{
|
2013-06-07 02:14:59 +04:00
|
|
|
contactPoint = (RDPINPUT_CONTACT_POINT*) &rdpei->contactPoints[i];
|
|
|
|
|
|
|
|
if (!contactPoint->active)
|
2013-05-15 01:45:52 +04:00
|
|
|
continue;
|
|
|
|
|
2013-06-07 02:14:59 +04:00
|
|
|
if (contactPoint->externalId == externalId)
|
2013-05-15 01:45:52 +04:00
|
|
|
{
|
2015-06-09 13:46:10 +03:00
|
|
|
contactIdlocal = contactPoint->contactId;
|
2013-05-15 01:45:52 +04:00
|
|
|
break;
|
2013-05-15 03:26:01 +04:00
|
|
|
}
|
2013-05-14 03:17:25 +04:00
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (contactIdlocal >= 0)
|
2013-06-07 02:14:59 +04:00
|
|
|
{
|
|
|
|
ZeroMemory(&contact, sizeof(RDPINPUT_CONTACT_DATA));
|
2013-06-07 02:37:52 +04:00
|
|
|
contactPoint->lastX = x;
|
|
|
|
contactPoint->lastY = y;
|
2013-06-07 02:14:59 +04:00
|
|
|
contact.x = x;
|
|
|
|
contact.y = y;
|
2015-06-09 13:46:10 +03:00
|
|
|
contact.contactId = (UINT32) contactIdlocal;
|
2013-06-07 02:14:59 +04:00
|
|
|
contact.contactFlags |= CONTACT_FLAG_UPDATE;
|
|
|
|
contact.contactFlags |= CONTACT_FLAG_INRANGE;
|
|
|
|
contact.contactFlags |= CONTACT_FLAG_INCONTACT;
|
2015-06-09 13:46:10 +03:00
|
|
|
error = context->AddContact(context, &contact);
|
2013-06-07 02:14:59 +04:00
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
*contactId = contactIdlocal;
|
|
|
|
return error;
|
2013-05-15 01:45:52 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT rdpei_touch_end(RdpeiClientContext* context, int externalId, int x, int y,
|
|
|
|
int* contactId)
|
2013-05-15 01:45:52 +04:00
|
|
|
{
|
2015-06-09 13:46:10 +03:00
|
|
|
unsigned int i;
|
|
|
|
int contactIdlocal = -1;
|
|
|
|
int tempvalue;
|
2013-06-07 02:14:59 +04:00
|
|
|
RDPINPUT_CONTACT_DATA contact;
|
2014-02-07 22:16:41 +04:00
|
|
|
RDPINPUT_CONTACT_POINT* contactPoint = NULL;
|
2013-05-15 01:45:52 +04:00
|
|
|
RDPEI_PLUGIN* rdpei = (RDPEI_PLUGIN*) context->handle;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2013-05-15 01:45:52 +04:00
|
|
|
|
|
|
|
for (i = 0; i < rdpei->maxTouchContacts; i++)
|
|
|
|
{
|
2013-06-07 02:14:59 +04:00
|
|
|
contactPoint = (RDPINPUT_CONTACT_POINT*) &rdpei->contactPoints[i];
|
|
|
|
|
|
|
|
if (!contactPoint->active)
|
2013-05-15 01:45:52 +04:00
|
|
|
continue;
|
|
|
|
|
2013-06-07 02:14:59 +04:00
|
|
|
if (contactPoint->externalId == externalId)
|
2013-05-15 01:45:52 +04:00
|
|
|
{
|
2015-06-09 13:46:10 +03:00
|
|
|
contactIdlocal = contactPoint->contactId;
|
2013-05-15 01:45:52 +04:00
|
|
|
break;
|
2013-05-15 03:26:01 +04:00
|
|
|
}
|
2013-05-15 01:45:52 +04:00
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (contactIdlocal >= 0)
|
2013-06-07 02:14:59 +04:00
|
|
|
{
|
|
|
|
ZeroMemory(&contact, sizeof(RDPINPUT_CONTACT_DATA));
|
|
|
|
|
2013-06-07 02:37:52 +04:00
|
|
|
if ((contactPoint->lastX != x) && (contactPoint->lastY != y))
|
|
|
|
{
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = context->TouchUpdate(context, externalId, x, y, &tempvalue)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "context->TouchUpdate failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
|
|
|
}
|
2013-06-07 02:37:52 +04:00
|
|
|
}
|
|
|
|
|
2013-06-07 02:14:59 +04:00
|
|
|
contact.x = x;
|
|
|
|
contact.y = y;
|
2015-06-09 13:46:10 +03:00
|
|
|
contact.contactId = (UINT32) contactIdlocal;
|
2013-06-07 02:14:59 +04:00
|
|
|
contact.contactFlags |= CONTACT_FLAG_UP;
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if ((error = context->AddContact(context, &contact)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "context->AddContact failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
return error;
|
|
|
|
}
|
2013-06-07 02:37:52 +04:00
|
|
|
|
|
|
|
contactPoint->externalId = 0;
|
|
|
|
contactPoint->active = FALSE;
|
|
|
|
contactPoint->flags = 0;
|
|
|
|
contactPoint->contactId = 0;
|
|
|
|
contactPoint->state = RDPINPUT_CONTACT_STATE_OUT_OF_RANGE;
|
2013-06-07 02:14:59 +04:00
|
|
|
}
|
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
*contactId = contactIdlocal;
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2013-05-14 00:07:42 +04:00
|
|
|
}
|
|
|
|
|
2016-06-15 14:36:27 +03:00
|
|
|
#ifdef BUILTIN_CHANNELS
|
2013-03-20 00:52:07 +04:00
|
|
|
#define DVCPluginEntry rdpei_DVCPluginEntry
|
2016-02-29 17:18:19 +03:00
|
|
|
#else
|
|
|
|
#define DVCPluginEntry FREERDP_API DVCPluginEntry
|
2013-03-20 00:52:07 +04:00
|
|
|
#endif
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2015-06-09 13:46:10 +03:00
|
|
|
RDPEI_PLUGIN* rdpei = NULL;
|
|
|
|
RdpeiClientContext* context = NULL;
|
2013-03-20 00:52:07 +04:00
|
|
|
rdpei = (RDPEI_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "rdpei");
|
|
|
|
|
2014-12-27 23:20:29 +03:00
|
|
|
if (!rdpei)
|
2013-03-20 00:52:07 +04:00
|
|
|
{
|
2013-05-15 01:45:52 +04:00
|
|
|
size_t size;
|
2015-06-09 13:46:10 +03:00
|
|
|
rdpei = (RDPEI_PLUGIN*) calloc(1, sizeof(RDPEI_PLUGIN));
|
2016-09-26 13:12:37 +03:00
|
|
|
|
|
|
|
if (!rdpei)
|
2015-06-09 13:46:10 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "calloc failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2013-03-20 00:52:07 +04:00
|
|
|
|
|
|
|
rdpei->iface.Initialize = rdpei_plugin_initialize;
|
|
|
|
rdpei->iface.Connected = NULL;
|
|
|
|
rdpei->iface.Disconnected = NULL;
|
|
|
|
rdpei->iface.Terminated = rdpei_plugin_terminated;
|
2013-05-14 03:17:25 +04:00
|
|
|
rdpei->version = 1;
|
|
|
|
rdpei->currentFrameTime = 0;
|
|
|
|
rdpei->previousFrameTime = 0;
|
|
|
|
rdpei->frame.contacts = (RDPINPUT_CONTACT_DATA*) rdpei->contacts;
|
2013-05-15 01:45:52 +04:00
|
|
|
rdpei->maxTouchContacts = 10;
|
|
|
|
size = rdpei->maxTouchContacts * sizeof(RDPINPUT_CONTACT_POINT);
|
2015-06-09 13:46:10 +03:00
|
|
|
rdpei->contactPoints = (RDPINPUT_CONTACT_POINT*) calloc(1, size);
|
2016-09-26 13:12:37 +03:00
|
|
|
rdpei->rdpcontext = ((freerdp*)((rdpSettings*) pEntryPoints->GetRdpSettings(
|
|
|
|
pEntryPoints))->instance)->context;
|
2015-07-15 10:50:35 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!rdpei->contactPoints)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "calloc failed!");
|
|
|
|
error = CHANNEL_RC_NO_MEMORY;
|
|
|
|
goto error_out;
|
|
|
|
}
|
2013-05-15 01:45:52 +04:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
context = (RdpeiClientContext*) calloc(1, sizeof(RdpeiClientContext));
|
2016-09-26 13:12:37 +03:00
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
if (!context)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "calloc failed!");
|
|
|
|
error = CHANNEL_RC_NO_MEMORY;
|
|
|
|
goto error_out;
|
|
|
|
}
|
2013-05-14 00:07:42 +04:00
|
|
|
|
|
|
|
context->handle = (void*) rdpei;
|
|
|
|
context->GetVersion = rdpei_get_version;
|
2013-05-14 03:17:25 +04:00
|
|
|
context->AddContact = rdpei_add_contact;
|
2013-06-07 02:14:59 +04:00
|
|
|
context->TouchBegin = rdpei_touch_begin;
|
|
|
|
context->TouchUpdate = rdpei_touch_update;
|
|
|
|
context->TouchEnd = rdpei_touch_end;
|
2013-05-14 00:07:42 +04:00
|
|
|
rdpei->iface.pInterface = (void*) context;
|
|
|
|
|
2016-09-26 13:12:37 +03:00
|
|
|
if ((error = pEntryPoints->RegisterPlugin(pEntryPoints, "rdpei",
|
|
|
|
(IWTSPlugin*) rdpei)))
|
2015-06-09 13:46:10 +03:00
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "EntryPoints->RegisterPlugin failed with error %"PRIu32"!", error);
|
2015-06-09 13:46:10 +03:00
|
|
|
error = CHANNEL_RC_NO_MEMORY;
|
|
|
|
goto error_out;
|
|
|
|
}
|
|
|
|
|
2014-12-27 23:20:29 +03:00
|
|
|
rdpei->context = context;
|
2013-03-20 00:52:07 +04:00
|
|
|
}
|
|
|
|
|
2015-06-09 13:46:10 +03:00
|
|
|
return CHANNEL_RC_OK;
|
|
|
|
error_out:
|
|
|
|
free(context);
|
|
|
|
free(rdpei->contactPoints);
|
|
|
|
free(rdpei);
|
2013-03-20 00:52:07 +04:00
|
|
|
return error;
|
|
|
|
}
|