2011-07-09 19:29:04 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-09 19:29:04 +04:00
|
|
|
* Static Virtual Channel Interface
|
|
|
|
*
|
|
|
|
* Copyright 2009-2011 Jay Sorg
|
|
|
|
* Copyright 2010-2011 Vic Lee
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2011-07-09 19:29:04 +04:00
|
|
|
#include "config.h"
|
2012-08-15 01:09:01 +04:00
|
|
|
#endif
|
|
|
|
|
2013-09-05 15:45:49 +04:00
|
|
|
#include <assert.h>
|
2011-07-09 19:29:04 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2012-08-15 01:09:01 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
#include <winpr/crt.h>
|
2013-02-21 00:33:42 +04:00
|
|
|
#include <winpr/synch.h>
|
2013-03-30 01:53:18 +04:00
|
|
|
#include <winpr/stream.h>
|
2013-02-21 00:33:42 +04:00
|
|
|
#include <winpr/collections.h>
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2011-07-10 06:00:16 +04:00
|
|
|
#include <freerdp/constants.h>
|
2011-07-09 19:29:04 +04:00
|
|
|
#include <freerdp/utils/debug.h>
|
2011-07-12 16:52:08 +04:00
|
|
|
#include <freerdp/utils/event.h>
|
2011-07-09 19:29:04 +04:00
|
|
|
#include <freerdp/utils/svc_plugin.h>
|
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
static wArrayList* g_AddinList = NULL;
|
2011-07-09 19:29:04 +04:00
|
|
|
|
|
|
|
static rdpSvcPlugin* svc_plugin_find_by_init_handle(void* init_handle)
|
|
|
|
{
|
2013-02-21 00:33:42 +04:00
|
|
|
int index;
|
|
|
|
BOOL found = FALSE;
|
2012-09-19 01:33:52 +04:00
|
|
|
rdpSvcPlugin* plugin;
|
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
ArrayList_Lock(g_AddinList);
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
index = 0;
|
|
|
|
plugin = (rdpSvcPlugin*) ArrayList_GetItem(g_AddinList, index++);
|
2012-09-19 01:33:52 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
while (plugin)
|
|
|
|
{
|
2013-02-21 03:44:52 +04:00
|
|
|
if (plugin->init_handle == init_handle)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-02-21 00:33:42 +04:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
2013-02-21 00:33:42 +04:00
|
|
|
|
|
|
|
plugin = (rdpSvcPlugin*) ArrayList_GetItem(g_AddinList, index++);
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
2012-09-19 01:33:52 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
ArrayList_Unlock(g_AddinList);
|
2012-09-19 01:33:52 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
return (found) ? plugin : NULL;
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
static rdpSvcPlugin* svc_plugin_find_by_open_handle(UINT32 open_handle)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-02-21 00:33:42 +04:00
|
|
|
int index;
|
|
|
|
BOOL found = FALSE;
|
2012-11-19 22:26:56 +04:00
|
|
|
rdpSvcPlugin* plugin;
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
ArrayList_Lock(g_AddinList);
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
index = 0;
|
|
|
|
plugin = (rdpSvcPlugin*) ArrayList_GetItem(g_AddinList, index++);
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
while (plugin)
|
|
|
|
{
|
2013-02-21 03:44:52 +04:00
|
|
|
if (plugin->open_handle == open_handle)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-02-21 00:33:42 +04:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
2013-02-21 00:33:42 +04:00
|
|
|
|
|
|
|
plugin = (rdpSvcPlugin*) ArrayList_GetItem(g_AddinList, index++);
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
ArrayList_Unlock(g_AddinList);
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
return (found) ? plugin : NULL;
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void svc_plugin_remove(rdpSvcPlugin* plugin)
|
|
|
|
{
|
2013-02-21 00:33:42 +04:00
|
|
|
ArrayList_Remove(g_AddinList, (void*) plugin);
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT32 dataLength,
|
|
|
|
UINT32 totalLength, UINT32 dataFlags)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* data_in;
|
2012-05-16 01:39:07 +04:00
|
|
|
|
2012-11-20 07:31:15 +04:00
|
|
|
if ((dataFlags & CHANNEL_FLAG_SUSPEND) || (dataFlags & CHANNEL_FLAG_RESUME))
|
2012-05-16 01:39:07 +04:00
|
|
|
{
|
2012-11-20 07:31:15 +04:00
|
|
|
/*
|
|
|
|
* According to MS-RDPBCGR 2.2.6.1, "All virtual channel traffic MUST be suspended.
|
|
|
|
* This flag is only valid in server-to-client virtual channel traffic. It MUST be
|
|
|
|
* ignored in client-to-server data." Thus it would be best practice to cease data
|
|
|
|
* transmission. However, simply returning here avoids a crash.
|
|
|
|
*/
|
2012-05-16 01:39:07 +04:00
|
|
|
return;
|
|
|
|
}
|
2011-07-10 06:00:16 +04:00
|
|
|
|
|
|
|
if (dataFlags & CHANNEL_FLAG_FIRST)
|
|
|
|
{
|
2013-02-21 03:44:52 +04:00
|
|
|
if (plugin->data_in != NULL)
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(plugin->data_in, TRUE);
|
2013-02-21 03:53:47 +04:00
|
|
|
|
2013-05-09 01:48:30 +04:00
|
|
|
plugin->data_in = Stream_New(NULL, totalLength);
|
2011-07-10 06:00:16 +04:00
|
|
|
}
|
|
|
|
|
2013-02-21 03:44:52 +04:00
|
|
|
data_in = plugin->data_in;
|
2013-05-02 02:15:55 +04:00
|
|
|
Stream_EnsureRemainingCapacity(data_in, (int) dataLength);
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write(data_in, pData, dataLength);
|
2011-07-10 06:00:16 +04:00
|
|
|
|
|
|
|
if (dataFlags & CHANNEL_FLAG_LAST)
|
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
|
2011-07-10 06:00:16 +04:00
|
|
|
{
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "svc_plugin_process_received: read error\n");
|
2011-07-10 06:00:16 +04:00
|
|
|
}
|
2011-07-12 12:56:01 +04:00
|
|
|
|
2013-02-21 03:44:52 +04:00
|
|
|
plugin->data_in = NULL;
|
2013-09-04 05:48:26 +04:00
|
|
|
Stream_SealLength(data_in);
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_SetPosition(data_in, 0);
|
2011-07-12 12:56:01 +04:00
|
|
|
|
2013-02-21 03:53:47 +04:00
|
|
|
MessageQueue_Post(plugin->MsgPipe->In, NULL, 0, (void*) data_in, NULL);
|
2011-07-10 06:00:16 +04:00
|
|
|
}
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
|
|
|
|
2013-03-29 05:13:56 +04:00
|
|
|
static void svc_plugin_process_event(rdpSvcPlugin* plugin, wMessage* event_in)
|
2011-07-12 16:52:08 +04:00
|
|
|
{
|
2013-02-21 03:53:47 +04:00
|
|
|
MessageQueue_Post(plugin->MsgPipe->In, NULL, 1, (void*) event_in, NULL);
|
2011-07-12 16:52:08 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
static void svc_plugin_open_event(UINT32 openHandle, UINT32 event, void* pData, UINT32 dataLength,
|
|
|
|
UINT32 totalLength, UINT32 dataFlags)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
|
|
|
rdpSvcPlugin* plugin;
|
|
|
|
|
2011-07-10 06:00:16 +04:00
|
|
|
DEBUG_SVC("openHandle %d event %d dataLength %d totalLength %d dataFlags %d",
|
|
|
|
openHandle, event, dataLength, totalLength, dataFlags);
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2012-09-23 21:54:14 +04:00
|
|
|
plugin = (rdpSvcPlugin*) svc_plugin_find_by_open_handle(openHandle);
|
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
if (!plugin)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "svc_plugin_open_event: error no match\n");
|
2011-07-09 19:29:04 +04:00
|
|
|
return;
|
|
|
|
}
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2011-07-11 08:04:13 +04:00
|
|
|
switch (event)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2011-07-11 08:04:13 +04:00
|
|
|
case CHANNEL_EVENT_DATA_RECEIVED:
|
|
|
|
svc_plugin_process_received(plugin, pData, dataLength, totalLength, dataFlags);
|
|
|
|
break;
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2011-07-11 08:04:13 +04:00
|
|
|
case CHANNEL_EVENT_WRITE_COMPLETE:
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free((wStream*) pData, TRUE);
|
2011-07-11 08:04:13 +04:00
|
|
|
break;
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2011-07-11 08:04:13 +04:00
|
|
|
case CHANNEL_EVENT_USER:
|
2013-03-29 05:13:56 +04:00
|
|
|
svc_plugin_process_event(plugin, (wMessage*) pData);
|
2011-07-11 08:04:13 +04:00
|
|
|
break;
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
static void* svc_plugin_thread_func(void* arg)
|
2011-07-12 12:56:01 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* data;
|
2013-03-29 05:13:56 +04:00
|
|
|
wMessage* event;
|
2013-02-21 03:44:52 +04:00
|
|
|
wMessage message;
|
2013-02-21 04:44:14 +04:00
|
|
|
rdpSvcPlugin* plugin = (rdpSvcPlugin*) arg;
|
|
|
|
|
|
|
|
DEBUG_SVC("in");
|
|
|
|
|
2013-09-05 15:39:32 +04:00
|
|
|
assert(NULL != plugin);
|
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
IFCALL(plugin->connect_callback, plugin);
|
2011-07-12 12:56:01 +04:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2013-02-21 06:34:47 +04:00
|
|
|
if (!MessageQueue_Wait(plugin->MsgPipe->In))
|
|
|
|
break;
|
2011-07-12 12:56:01 +04:00
|
|
|
|
2013-02-21 03:44:52 +04:00
|
|
|
if (MessageQueue_Peek(plugin->MsgPipe->In, &message, TRUE))
|
2011-07-12 12:56:01 +04:00
|
|
|
{
|
2013-02-21 04:44:14 +04:00
|
|
|
if (message.id == WMQ_QUIT)
|
|
|
|
break;
|
|
|
|
|
2013-02-21 03:53:47 +04:00
|
|
|
if (message.id == 0)
|
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
data = (wStream*) message.wParam;
|
2013-02-21 03:53:47 +04:00
|
|
|
IFCALL(plugin->receive_callback, plugin, data);
|
|
|
|
}
|
|
|
|
else if (message.id == 1)
|
|
|
|
{
|
2013-03-29 05:13:56 +04:00
|
|
|
event = (wMessage*) message.wParam;
|
2013-02-21 03:53:47 +04:00
|
|
|
IFCALL(plugin->event_callback, plugin, event);
|
|
|
|
}
|
2011-07-12 12:56:01 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_SVC("out");
|
|
|
|
|
2013-09-05 15:39:32 +04:00
|
|
|
ExitThread(0);
|
|
|
|
|
2011-07-12 12:56:01 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
static void svc_plugin_process_connected(rdpSvcPlugin* plugin, void* pData, UINT32 dataLength)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-02-21 04:44:14 +04:00
|
|
|
UINT32 status;
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
status = plugin->channel_entry_points.pVirtualChannelOpen(plugin->init_handle,
|
2013-02-21 03:44:52 +04:00
|
|
|
&plugin->open_handle, plugin->channel_def.name, svc_plugin_open_event);
|
2011-08-16 22:41:12 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
if (status != CHANNEL_RC_OK)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-03-30 01:53:18 +04:00
|
|
|
fprintf(stderr, "svc_plugin_process_connected: open failed: status: %d\n", status);
|
2011-07-09 19:29:04 +04:00
|
|
|
return;
|
|
|
|
}
|
2011-07-12 12:56:01 +04:00
|
|
|
|
2013-02-21 03:44:52 +04:00
|
|
|
plugin->MsgPipe = MessagePipe_New();
|
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
plugin->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) svc_plugin_thread_func, (void*) plugin, 0, NULL);
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void svc_plugin_process_terminated(rdpSvcPlugin* plugin)
|
|
|
|
{
|
2013-02-21 04:44:14 +04:00
|
|
|
MessagePipe_PostQuit(plugin->MsgPipe, 0);
|
|
|
|
WaitForSingleObject(plugin->thread, INFINITE);
|
2011-07-12 12:56:01 +04:00
|
|
|
|
2013-02-26 20:16:33 +04:00
|
|
|
MessagePipe_Free(plugin->MsgPipe);
|
|
|
|
CloseHandle(plugin->thread);
|
|
|
|
|
2013-02-21 03:44:52 +04:00
|
|
|
plugin->channel_entry_points.pVirtualChannelClose(plugin->open_handle);
|
2011-07-10 06:00:16 +04:00
|
|
|
|
2011-07-09 19:29:04 +04:00
|
|
|
svc_plugin_remove(plugin);
|
2011-07-10 06:00:16 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
if (plugin->data_in)
|
2011-07-10 06:00:16 +04:00
|
|
|
{
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(plugin->data_in, TRUE);
|
2013-02-21 03:44:52 +04:00
|
|
|
plugin->data_in = NULL;
|
2011-07-10 06:00:16 +04:00
|
|
|
}
|
|
|
|
|
2011-08-14 18:32:12 +04:00
|
|
|
IFCALL(plugin->terminate_callback, plugin);
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
static void svc_plugin_init_event(void* pInitHandle, UINT32 event, void* pData, UINT32 dataLength)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
|
|
|
rdpSvcPlugin* plugin;
|
|
|
|
|
|
|
|
DEBUG_SVC("event %d", event);
|
|
|
|
|
2012-09-23 21:54:14 +04:00
|
|
|
plugin = (rdpSvcPlugin*) svc_plugin_find_by_init_handle(pInitHandle);
|
|
|
|
|
|
|
|
if (!plugin)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "svc_plugin_init_event: error no match\n");
|
2011-07-09 19:29:04 +04:00
|
|
|
return;
|
|
|
|
}
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2011-07-09 19:29:04 +04:00
|
|
|
switch (event)
|
|
|
|
{
|
|
|
|
case CHANNEL_EVENT_CONNECTED:
|
|
|
|
svc_plugin_process_connected(plugin, pData, dataLength);
|
|
|
|
break;
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2011-07-09 19:29:04 +04:00
|
|
|
case CHANNEL_EVENT_DISCONNECTED:
|
|
|
|
break;
|
2012-09-23 21:54:14 +04:00
|
|
|
|
2011-07-09 19:29:04 +04:00
|
|
|
case CHANNEL_EVENT_TERMINATED:
|
|
|
|
svc_plugin_process_terminated(plugin);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-11 08:21:55 +04:00
|
|
|
void svc_plugin_init(rdpSvcPlugin* plugin, CHANNEL_ENTRY_POINTS* pEntryPoints)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The channel manager will guarantee only one thread can call
|
|
|
|
* VirtualChannelInit at a time. So this should be safe.
|
|
|
|
*/
|
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
CopyMemory(&plugin->channel_entry_points, pEntryPoints, pEntryPoints->cbSize);
|
2011-07-11 08:21:55 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
if (!g_AddinList)
|
|
|
|
g_AddinList = ArrayList_New(TRUE);
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-02-21 00:33:42 +04:00
|
|
|
ArrayList_Add(g_AddinList, (void*) plugin);
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-02-21 03:44:52 +04:00
|
|
|
plugin->channel_entry_points.pVirtualChannelInit(&plugin->init_handle,
|
2011-07-09 19:29:04 +04:00
|
|
|
&plugin->channel_def, 1, VIRTUAL_CHANNEL_VERSION_WIN2000, svc_plugin_init_event);
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
int svc_plugin_send(rdpSvcPlugin* plugin, wStream* data_out)
|
2011-07-09 19:29:04 +04:00
|
|
|
{
|
2013-02-21 04:44:14 +04:00
|
|
|
UINT32 status = 0;
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
DEBUG_SVC("length %d", (int) Stream_GetPosition(data_out));
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-02-21 03:44:52 +04:00
|
|
|
if (!plugin)
|
2013-02-21 04:44:14 +04:00
|
|
|
status = CHANNEL_RC_BAD_INIT_HANDLE;
|
2012-04-25 22:27:38 +04:00
|
|
|
else
|
2013-02-21 04:44:14 +04:00
|
|
|
status = plugin->channel_entry_points.pVirtualChannelWrite(plugin->open_handle,
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Buffer(data_out), Stream_GetPosition(data_out), data_out);
|
2012-04-25 22:27:38 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
if (status != CHANNEL_RC_OK)
|
2011-07-12 12:56:01 +04:00
|
|
|
{
|
2013-05-09 01:48:30 +04:00
|
|
|
Stream_Free(data_out, TRUE);
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "svc_plugin_send: VirtualChannelWrite failed %d\n", status);
|
2011-07-12 12:56:01 +04:00
|
|
|
}
|
2011-07-11 08:21:55 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
return status;
|
2011-07-11 08:21:55 +04:00
|
|
|
}
|
|
|
|
|
2013-03-29 05:13:56 +04:00
|
|
|
int svc_plugin_send_event(rdpSvcPlugin* plugin, wMessage* event)
|
2011-07-11 08:21:55 +04:00
|
|
|
{
|
2013-02-21 04:44:14 +04:00
|
|
|
UINT32 status = 0;
|
2011-07-11 08:21:55 +04:00
|
|
|
|
2013-05-11 00:39:16 +04:00
|
|
|
DEBUG_SVC("event class: %d type: %d",
|
|
|
|
GetMessageClass(event->id), GetMessageType(event->id));
|
2011-07-11 08:21:55 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
status = plugin->channel_entry_points.pVirtualChannelEventPush(plugin->open_handle, event);
|
2011-08-10 10:24:06 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
if (status != CHANNEL_RC_OK)
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "svc_plugin_send_event: VirtualChannelEventPush failed %d\n", status);
|
2011-07-09 19:29:04 +04:00
|
|
|
|
2013-02-21 04:44:14 +04:00
|
|
|
return status;
|
2011-07-09 19:29:04 +04:00
|
|
|
}
|