channels/rdpdr: remove dependency on svc_plugin
This commit is contained in:
parent
49a2334554
commit
05d9fbfe2a
@ -27,26 +27,25 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/stream.h>
|
||||||
|
|
||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
#include <freerdp/addin.h>
|
#include <freerdp/addin.h>
|
||||||
#include <winpr/stream.h>
|
|
||||||
#include <freerdp/utils/list.h>
|
#include <freerdp/utils/list.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
|
||||||
#include <freerdp/client/channels.h>
|
#include <freerdp/client/channels.h>
|
||||||
|
|
||||||
#include "rdpdr_main.h"
|
#include "rdpdr_main.h"
|
||||||
|
|
||||||
#include "devman.h"
|
#include "devman.h"
|
||||||
|
|
||||||
DEVMAN* devman_new(rdpSvcPlugin* plugin)
|
DEVMAN* devman_new(rdpdrPlugin* rdpdr)
|
||||||
{
|
{
|
||||||
DEVMAN* devman;
|
DEVMAN* devman;
|
||||||
|
|
||||||
devman = (DEVMAN*) malloc(sizeof(DEVMAN));
|
devman = (DEVMAN*) malloc(sizeof(DEVMAN));
|
||||||
ZeroMemory(devman, sizeof(DEVMAN));
|
ZeroMemory(devman, sizeof(DEVMAN));
|
||||||
|
|
||||||
devman->plugin = plugin;
|
devman->plugin = (void*) rdpdr;
|
||||||
devman->id_sequence = 1;
|
devman->id_sequence = 1;
|
||||||
devman->devices = list_new();
|
devman->devices = list_new();
|
||||||
|
|
||||||
@ -69,8 +68,6 @@ static void devman_register_device(DEVMAN* devman, DEVICE* device)
|
|||||||
{
|
{
|
||||||
device->id = devman->id_sequence++;
|
device->id = devman->id_sequence++;
|
||||||
list_add(devman->devices, device);
|
list_add(devman->devices, device);
|
||||||
|
|
||||||
DEBUG_SVC("device %d.%s registered", device->id, device->name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char DRIVE_SERVICE_NAME[] = "drive";
|
static char DRIVE_SERVICE_NAME[] = "drive";
|
||||||
|
@ -21,10 +21,12 @@
|
|||||||
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H
|
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H
|
||||||
#define FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H
|
#define FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H
|
||||||
|
|
||||||
|
#include "rdpdr_main.h"
|
||||||
|
|
||||||
BOOL devman_load_device_service(DEVMAN* devman, RDPDR_DEVICE* device);
|
BOOL devman_load_device_service(DEVMAN* devman, RDPDR_DEVICE* device);
|
||||||
DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id);
|
DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id);
|
||||||
|
|
||||||
DEVMAN* devman_new(rdpSvcPlugin* plugin);
|
DEVMAN* devman_new(rdpdrPlugin* rdpdr);
|
||||||
void devman_free(DEVMAN* devman);
|
void devman_free(DEVMAN* devman);
|
||||||
|
|
||||||
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H */
|
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_DEVMAN_H */
|
||||||
|
@ -27,9 +27,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <winpr/stream.h>
|
#include <winpr/stream.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
|
||||||
|
|
||||||
#include "rdpdr_main.h"
|
#include "rdpdr_main.h"
|
||||||
#include "devman.h"
|
#include "devman.h"
|
||||||
@ -37,8 +35,6 @@
|
|||||||
|
|
||||||
static void irp_free(IRP* irp)
|
static void irp_free(IRP* irp)
|
||||||
{
|
{
|
||||||
DEBUG_SVC("DeviceId %d FileId %d CompletionId %d", irp->device->id, irp->FileId, irp->CompletionId);
|
|
||||||
|
|
||||||
Stream_Free(irp->input, TRUE);
|
Stream_Free(irp->input, TRUE);
|
||||||
Stream_Free(irp->output, TRUE);
|
Stream_Free(irp->output, TRUE);
|
||||||
|
|
||||||
@ -49,8 +45,6 @@ static void irp_complete(IRP* irp)
|
|||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
DEBUG_SVC("DeviceId %d FileId %d CompletionId %d", irp->device->id, irp->FileId, irp->CompletionId);
|
|
||||||
|
|
||||||
pos = Stream_GetPosition(irp->output);
|
pos = Stream_GetPosition(irp->output);
|
||||||
Stream_SetPosition(irp->output, 12);
|
Stream_SetPosition(irp->output, 12);
|
||||||
Stream_Write_UINT32(irp->output, irp->IoStatus);
|
Stream_Write_UINT32(irp->output, irp->IoStatus);
|
||||||
@ -62,18 +56,17 @@ static void irp_complete(IRP* irp)
|
|||||||
irp_free(irp);
|
irp_free(irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
IRP* irp_new(DEVMAN* devman, wStream* data_in)
|
IRP* irp_new(DEVMAN* devman, wStream* s)
|
||||||
{
|
{
|
||||||
IRP* irp;
|
IRP* irp;
|
||||||
UINT32 DeviceId;
|
UINT32 DeviceId;
|
||||||
DEVICE* device;
|
DEVICE* device;
|
||||||
|
|
||||||
Stream_Read_UINT32(data_in, DeviceId);
|
Stream_Read_UINT32(s, DeviceId);
|
||||||
device = devman_get_device_by_id(devman, DeviceId);
|
device = devman_get_device_by_id(devman, DeviceId);
|
||||||
|
|
||||||
if (device == NULL)
|
if (!device)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("unknown DeviceId %d", DeviceId);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,11 +75,11 @@ IRP* irp_new(DEVMAN* devman, wStream* data_in)
|
|||||||
|
|
||||||
irp->device = device;
|
irp->device = device;
|
||||||
irp->devman = devman;
|
irp->devman = devman;
|
||||||
Stream_Read_UINT32(data_in, irp->FileId);
|
Stream_Read_UINT32(s, irp->FileId);
|
||||||
Stream_Read_UINT32(data_in, irp->CompletionId);
|
Stream_Read_UINT32(s, irp->CompletionId);
|
||||||
Stream_Read_UINT32(data_in, irp->MajorFunction);
|
Stream_Read_UINT32(s, irp->MajorFunction);
|
||||||
Stream_Read_UINT32(data_in, irp->MinorFunction);
|
Stream_Read_UINT32(s, irp->MinorFunction);
|
||||||
irp->input = data_in;
|
irp->input = s;
|
||||||
|
|
||||||
irp->output = Stream_New(NULL, 256);
|
irp->output = Stream_New(NULL, 256);
|
||||||
Stream_Write_UINT16(irp->output, RDPDR_CTYP_CORE);
|
Stream_Write_UINT16(irp->output, RDPDR_CTYP_CORE);
|
||||||
@ -98,8 +91,5 @@ IRP* irp_new(DEVMAN* devman, wStream* data_in)
|
|||||||
irp->Complete = irp_complete;
|
irp->Complete = irp_complete;
|
||||||
irp->Discard = irp_free;
|
irp->Discard = irp_free;
|
||||||
|
|
||||||
DEBUG_SVC("DeviceId %d FileId %d CompletionId %d MajorFunction 0x%X MinorFunction 0x%x",
|
|
||||||
irp->device->id, irp->FileId, irp->CompletionId, irp->MajorFunction, irp->MinorFunction);
|
|
||||||
|
|
||||||
return irp;
|
return irp;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
|
|
||||||
#include "rdpdr_main.h"
|
#include "rdpdr_main.h"
|
||||||
|
|
||||||
IRP* irp_new(DEVMAN* devman, wStream* data_in);
|
IRP* irp_new(DEVMAN* devman, wStream* s);
|
||||||
|
|
||||||
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H */
|
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_IRP_H */
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
#include <winpr/stream.h>
|
#include <winpr/stream.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
|
||||||
|
|
||||||
#include "rdpdr_main.h"
|
#include "rdpdr_main.h"
|
||||||
#include "rdpdr_capabilities.h"
|
#include "rdpdr_capabilities.h"
|
||||||
@ -162,7 +162,6 @@ void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* s)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG_WARN("Unknown capabilityType %d", capabilityType);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "rdpdr_main.h"
|
#include "rdpdr_main.h"
|
||||||
|
|
||||||
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* data_in);
|
void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* s);
|
||||||
void rdpdr_send_capability_response(rdpdrPlugin* rdpdr);
|
void rdpdr_send_capability_response(rdpdrPlugin* rdpdr);
|
||||||
|
|
||||||
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H */
|
#endif /* FREERDP_CHANNEL_RDPDR_CLIENT_CAPABILITIES_H */
|
||||||
|
@ -27,12 +27,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/stream.h>
|
||||||
|
|
||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
#include <freerdp/constants.h>
|
#include <freerdp/constants.h>
|
||||||
#include <winpr/stream.h>
|
|
||||||
#include <freerdp/channels/rdpdr.h>
|
#include <freerdp/channels/rdpdr.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -45,15 +44,14 @@
|
|||||||
|
|
||||||
#include "rdpdr_main.h"
|
#include "rdpdr_main.h"
|
||||||
|
|
||||||
static void rdpdr_process_connect(rdpSvcPlugin* plugin)
|
static void rdpdr_process_connect(rdpdrPlugin* rdpdr)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
RDPDR_DEVICE* device;
|
RDPDR_DEVICE* device;
|
||||||
rdpSettings* settings;
|
rdpSettings* settings;
|
||||||
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
|
|
||||||
|
|
||||||
rdpdr->devman = devman_new(plugin);
|
rdpdr->devman = devman_new(rdpdr);
|
||||||
settings = (rdpSettings*) plugin->channel_entry_points.pExtendedData;
|
settings = (rdpSettings*) rdpdr->channel_entry_points.pExtendedData;
|
||||||
|
|
||||||
strncpy(rdpdr->computerName, settings->ComputerName, sizeof(rdpdr->computerName) - 1);
|
strncpy(rdpdr->computerName, settings->ComputerName, sizeof(rdpdr->computerName) - 1);
|
||||||
|
|
||||||
@ -69,8 +67,6 @@ static void rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, wStream* s
|
|||||||
Stream_Read_UINT16(s, rdpdr->versionMajor);
|
Stream_Read_UINT16(s, rdpdr->versionMajor);
|
||||||
Stream_Read_UINT16(s, rdpdr->versionMinor);
|
Stream_Read_UINT16(s, rdpdr->versionMinor);
|
||||||
Stream_Read_UINT32(s, rdpdr->clientID);
|
Stream_Read_UINT32(s, rdpdr->clientID);
|
||||||
|
|
||||||
DEBUG_SVC("version %d.%d clientID %d", rdpdr->versionMajor, rdpdr->versionMinor, rdpdr->clientID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
|
static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
|
||||||
@ -128,14 +124,12 @@ static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, wStream* s
|
|||||||
|
|
||||||
if (versionMajor != rdpdr->versionMajor || versionMinor != rdpdr->versionMinor)
|
if (versionMajor != rdpdr->versionMajor || versionMinor != rdpdr->versionMinor)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("unmatched version %d.%d", versionMajor, versionMinor);
|
|
||||||
rdpdr->versionMajor = versionMajor;
|
rdpdr->versionMajor = versionMajor;
|
||||||
rdpdr->versionMinor = versionMinor;
|
rdpdr->versionMinor = versionMinor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientID != rdpdr->clientID)
|
if (clientID != rdpdr->clientID)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("unmatched clientID %d", clientID);
|
|
||||||
rdpdr->clientID = clientID;
|
rdpdr->clientID = clientID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +213,7 @@ static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, wStream* s)
|
|||||||
|
|
||||||
irp = irp_new(rdpdr->devman, s);
|
irp = irp_new(rdpdr->devman, s);
|
||||||
|
|
||||||
if (irp == NULL)
|
if (!irp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
IFCALL(irp->device->IRPRequest, irp->device, irp);
|
IFCALL(irp->device->IRPRequest, irp->device, irp);
|
||||||
@ -227,13 +221,12 @@ static BOOL rdpdr_process_irp(rdpdrPlugin* rdpdr, wStream* s)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdpdr_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
static void rdpdr_process_receive(rdpdrPlugin* rdpdr, wStream* s)
|
||||||
{
|
{
|
||||||
UINT16 component;
|
UINT16 component;
|
||||||
UINT16 packetID;
|
UINT16 packetID;
|
||||||
UINT32 deviceID;
|
UINT32 deviceID;
|
||||||
UINT32 status;
|
UINT32 status;
|
||||||
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
|
|
||||||
|
|
||||||
Stream_Read_UINT16(s, component);
|
Stream_Read_UINT16(s, component);
|
||||||
Stream_Read_UINT16(s, packetID);
|
Stream_Read_UINT16(s, packetID);
|
||||||
@ -243,26 +236,22 @@ static void rdpdr_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
|||||||
switch (packetID)
|
switch (packetID)
|
||||||
{
|
{
|
||||||
case PAKID_CORE_SERVER_ANNOUNCE:
|
case PAKID_CORE_SERVER_ANNOUNCE:
|
||||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_SERVER_ANNOUNCE");
|
|
||||||
rdpdr_process_server_announce_request(rdpdr, s);
|
rdpdr_process_server_announce_request(rdpdr, s);
|
||||||
rdpdr_send_client_announce_reply(rdpdr);
|
rdpdr_send_client_announce_reply(rdpdr);
|
||||||
rdpdr_send_client_name_request(rdpdr);
|
rdpdr_send_client_name_request(rdpdr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAKID_CORE_SERVER_CAPABILITY:
|
case PAKID_CORE_SERVER_CAPABILITY:
|
||||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_SERVER_CAPABILITY");
|
|
||||||
rdpdr_process_capability_request(rdpdr, s);
|
rdpdr_process_capability_request(rdpdr, s);
|
||||||
rdpdr_send_capability_response(rdpdr);
|
rdpdr_send_capability_response(rdpdr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAKID_CORE_CLIENTID_CONFIRM:
|
case PAKID_CORE_CLIENTID_CONFIRM:
|
||||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_CLIENTID_CONFIRM");
|
|
||||||
rdpdr_process_server_clientid_confirm(rdpdr, s);
|
rdpdr_process_server_clientid_confirm(rdpdr, s);
|
||||||
rdpdr_send_device_list_announce_request(rdpdr, FALSE);
|
rdpdr_send_device_list_announce_request(rdpdr, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAKID_CORE_USER_LOGGEDON:
|
case PAKID_CORE_USER_LOGGEDON:
|
||||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_USER_LOGGEDON");
|
|
||||||
rdpdr_send_device_list_announce_request(rdpdr, TRUE);
|
rdpdr_send_device_list_announce_request(rdpdr, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -270,39 +259,34 @@ static void rdpdr_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
|||||||
/* connect to a specific resource */
|
/* connect to a specific resource */
|
||||||
Stream_Read_UINT32(s, deviceID);
|
Stream_Read_UINT32(s, deviceID);
|
||||||
Stream_Read_UINT32(s, status);
|
Stream_Read_UINT32(s, status);
|
||||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_DEVICE_REPLY (deviceID=%d status=0x%08X)", deviceID, status);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAKID_CORE_DEVICE_IOREQUEST:
|
case PAKID_CORE_DEVICE_IOREQUEST:
|
||||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_DEVICE_IOREQUEST");
|
|
||||||
if (rdpdr_process_irp(rdpdr, s))
|
if (rdpdr_process_irp(rdpdr, s))
|
||||||
s = NULL;
|
s = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG_WARN("RDPDR_CTYP_CORE / unknown packetID: 0x%02X", packetID);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (component == RDPDR_CTYP_PRN)
|
else if (component == RDPDR_CTYP_PRN)
|
||||||
{
|
{
|
||||||
DEBUG_SVC("RDPDR_CTYP_PRN");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_WARN("RDPDR component: 0x%02X packetID: 0x%02X", component, packetID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream_Free(s, TRUE);
|
Stream_Free(s, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdpdr_process_terminate(rdpSvcPlugin* plugin)
|
static void rdpdr_process_terminate(rdpdrPlugin* rdpdr)
|
||||||
{
|
{
|
||||||
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
|
|
||||||
|
|
||||||
devman_free(rdpdr->devman);
|
devman_free(rdpdr->devman);
|
||||||
free(plugin);
|
free(rdpdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -359,7 +343,7 @@ void rdpdr_remove_open_handle_data(DWORD openHandle)
|
|||||||
int rdpdr_send(rdpdrPlugin* rdpdr, wStream* s)
|
int rdpdr_send(rdpdrPlugin* rdpdr, wStream* s)
|
||||||
{
|
{
|
||||||
UINT32 status = 0;
|
UINT32 status = 0;
|
||||||
rdpSvcPlugin* plugin = (rdpSvcPlugin*) rdpdr;
|
rdpdrPlugin* plugin = (rdpdrPlugin*) rdpdr;
|
||||||
|
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
status = CHANNEL_RC_BAD_INIT_HANDLE;
|
status = CHANNEL_RC_BAD_INIT_HANDLE;
|
||||||
@ -376,7 +360,7 @@ int rdpdr_send(rdpdrPlugin* rdpdr, wStream* s)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdpdr_virtual_channel_event_data_received(rdpSvcPlugin* plugin,
|
static void rdpdr_virtual_channel_event_data_received(rdpdrPlugin* plugin,
|
||||||
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
||||||
{
|
{
|
||||||
wStream* data_in;
|
wStream* data_in;
|
||||||
@ -422,9 +406,9 @@ static void rdpdr_virtual_channel_event_data_received(rdpSvcPlugin* plugin,
|
|||||||
static void rdpdr_virtual_channel_open_event(UINT32 openHandle, UINT32 event,
|
static void rdpdr_virtual_channel_open_event(UINT32 openHandle, UINT32 event,
|
||||||
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
||||||
{
|
{
|
||||||
rdpSvcPlugin* plugin;
|
rdpdrPlugin* plugin;
|
||||||
|
|
||||||
plugin = (rdpSvcPlugin*) rdpdr_get_open_handle_data(openHandle);
|
plugin = (rdpdrPlugin*) rdpdr_get_open_handle_data(openHandle);
|
||||||
|
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
{
|
{
|
||||||
@ -450,11 +434,10 @@ static void rdpdr_virtual_channel_open_event(UINT32 openHandle, UINT32 event,
|
|||||||
static void* rdpdr_virtual_channel_client_thread(void* arg)
|
static void* rdpdr_virtual_channel_client_thread(void* arg)
|
||||||
{
|
{
|
||||||
wStream* data;
|
wStream* data;
|
||||||
wMessage* event;
|
|
||||||
wMessage message;
|
wMessage message;
|
||||||
rdpSvcPlugin* plugin = (rdpSvcPlugin*) arg;
|
rdpdrPlugin* plugin = (rdpdrPlugin*) arg;
|
||||||
|
|
||||||
IFCALL(plugin->connect_callback, plugin);
|
rdpdr_process_connect(plugin);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -469,12 +452,7 @@ static void* rdpdr_virtual_channel_client_thread(void* arg)
|
|||||||
if (message.id == 0)
|
if (message.id == 0)
|
||||||
{
|
{
|
||||||
data = (wStream*) message.wParam;
|
data = (wStream*) message.wParam;
|
||||||
IFCALL(plugin->receive_callback, plugin, data);
|
rdpdr_process_receive(plugin, data);
|
||||||
}
|
|
||||||
else if (message.id == 1)
|
|
||||||
{
|
|
||||||
event = (wMessage*) message.wParam;
|
|
||||||
IFCALL(plugin->event_callback, plugin, event);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,7 +461,7 @@ static void* rdpdr_virtual_channel_client_thread(void* arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdpdr_virtual_channel_event_connected(rdpSvcPlugin* plugin, void* pData, UINT32 dataLength)
|
static void rdpdr_virtual_channel_event_connected(rdpdrPlugin* plugin, void* pData, UINT32 dataLength)
|
||||||
{
|
{
|
||||||
UINT32 status;
|
UINT32 status;
|
||||||
|
|
||||||
@ -504,7 +482,7 @@ static void rdpdr_virtual_channel_event_connected(rdpSvcPlugin* plugin, void* pD
|
|||||||
(LPTHREAD_START_ROUTINE) rdpdr_virtual_channel_client_thread, (void*) plugin, 0, NULL);
|
(LPTHREAD_START_ROUTINE) rdpdr_virtual_channel_client_thread, (void*) plugin, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdpdr_virtual_channel_event_terminated(rdpSvcPlugin* plugin)
|
static void rdpdr_virtual_channel_event_terminated(rdpdrPlugin* plugin)
|
||||||
{
|
{
|
||||||
MessagePipe_PostQuit(plugin->MsgPipe, 0);
|
MessagePipe_PostQuit(plugin->MsgPipe, 0);
|
||||||
WaitForSingleObject(plugin->thread, INFINITE);
|
WaitForSingleObject(plugin->thread, INFINITE);
|
||||||
@ -520,7 +498,7 @@ static void rdpdr_virtual_channel_event_terminated(rdpSvcPlugin* plugin)
|
|||||||
plugin->data_in = NULL;
|
plugin->data_in = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFCALL(plugin->terminate_callback, plugin);
|
rdpdr_process_terminate(plugin);
|
||||||
|
|
||||||
rdpdr_remove_open_handle_data(plugin->open_handle);
|
rdpdr_remove_open_handle_data(plugin->open_handle);
|
||||||
rdpdr_remove_init_handle_data(plugin->init_handle);
|
rdpdr_remove_init_handle_data(plugin->init_handle);
|
||||||
@ -528,9 +506,9 @@ static void rdpdr_virtual_channel_event_terminated(rdpSvcPlugin* plugin)
|
|||||||
|
|
||||||
static void rdpdr_virtual_channel_init_event(void* pInitHandle, UINT32 event, void* pData, UINT32 dataLength)
|
static void rdpdr_virtual_channel_init_event(void* pInitHandle, UINT32 event, void* pData, UINT32 dataLength)
|
||||||
{
|
{
|
||||||
rdpSvcPlugin* plugin;
|
rdpdrPlugin* plugin;
|
||||||
|
|
||||||
plugin = (rdpSvcPlugin*) rdpdr_get_init_handle_data(pInitHandle);
|
plugin = (rdpdrPlugin*) rdpdr_get_init_handle_data(pInitHandle);
|
||||||
|
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
{
|
{
|
||||||
@ -558,24 +536,17 @@ static void rdpdr_virtual_channel_init_event(void* pInitHandle, UINT32 event, vo
|
|||||||
|
|
||||||
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||||
{
|
{
|
||||||
rdpdrPlugin* _p;
|
rdpdrPlugin* plugin;
|
||||||
rdpSvcPlugin* plugin;
|
|
||||||
|
|
||||||
_p = (rdpdrPlugin*) malloc(sizeof(rdpdrPlugin));
|
plugin = (rdpdrPlugin*) malloc(sizeof(rdpdrPlugin));
|
||||||
ZeroMemory(_p, sizeof(rdpdrPlugin));
|
ZeroMemory(plugin, sizeof(rdpdrPlugin));
|
||||||
|
|
||||||
plugin = (rdpSvcPlugin*) _p;
|
plugin->channel_def.options =
|
||||||
|
|
||||||
_p->plugin.channel_def.options =
|
|
||||||
CHANNEL_OPTION_INITIALIZED |
|
CHANNEL_OPTION_INITIALIZED |
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP;
|
CHANNEL_OPTION_COMPRESS_RDP;
|
||||||
|
|
||||||
strcpy(_p->plugin.channel_def.name, "rdpdr");
|
strcpy(plugin->channel_def.name, "rdpdr");
|
||||||
|
|
||||||
_p->plugin.connect_callback = rdpdr_process_connect;
|
|
||||||
_p->plugin.receive_callback = rdpdr_process_receive;
|
|
||||||
_p->plugin.terminate_callback = rdpdr_process_terminate;
|
|
||||||
|
|
||||||
CopyMemory(&(plugin->channel_entry_points), pEntryPoints, pEntryPoints->cbSize);
|
CopyMemory(&(plugin->channel_entry_points), pEntryPoints, pEntryPoints->cbSize);
|
||||||
|
|
||||||
|
@ -21,14 +21,35 @@
|
|||||||
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H
|
#ifndef FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H
|
||||||
#define FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H
|
#define FREERDP_CHANNEL_RDPDR_CLIENT_MAIN_H
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/synch.h>
|
||||||
|
#include <winpr/thread.h>
|
||||||
|
#include <winpr/stream.h>
|
||||||
|
#include <winpr/collections.h>
|
||||||
|
|
||||||
|
#include <freerdp/api.h>
|
||||||
|
#include <freerdp/svc.h>
|
||||||
|
#include <freerdp/addin.h>
|
||||||
|
|
||||||
#include <freerdp/channels/rdpdr.h>
|
#include <freerdp/channels/rdpdr.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
|
||||||
|
|
||||||
typedef struct rdpdr_plugin rdpdrPlugin;
|
typedef struct rdpdr_plugin rdpdrPlugin;
|
||||||
|
|
||||||
struct rdpdr_plugin
|
struct rdpdr_plugin
|
||||||
{
|
{
|
||||||
rdpSvcPlugin plugin;
|
CHANNEL_ENTRY_POINTS_EX channel_entry_points;
|
||||||
|
CHANNEL_DEF channel_def;
|
||||||
|
|
||||||
|
void* connect_callback;
|
||||||
|
void* receive_callback;
|
||||||
|
void* event_callback;
|
||||||
|
void* terminate_callback;
|
||||||
|
|
||||||
|
HANDLE thread;
|
||||||
|
wStream* data_in;
|
||||||
|
void* init_handle;
|
||||||
|
UINT32 open_handle;
|
||||||
|
wMessagePipe* MsgPipe;
|
||||||
|
|
||||||
DEVMAN* devman;
|
DEVMAN* devman;
|
||||||
|
|
||||||
|
@ -47,12 +47,13 @@
|
|||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
#include <winpr/synch.h>
|
#include <winpr/synch.h>
|
||||||
#include <winpr/thread.h>
|
#include <winpr/thread.h>
|
||||||
|
#include <winpr/stream.h>
|
||||||
#include <winpr/collections.h>
|
#include <winpr/collections.h>
|
||||||
|
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/utils/list.h>
|
#include <freerdp/utils/list.h>
|
||||||
#include <winpr/stream.h>
|
|
||||||
#include <freerdp/channels/rdpdr.h>
|
#include <freerdp/channels/rdpdr.h>
|
||||||
|
#include <freerdp/utils/svc_plugin.h>
|
||||||
|
|
||||||
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
|
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
#include <winpr/stream.h>
|
#include <winpr/stream.h>
|
||||||
#include <winpr/interlocked.h>
|
#include <winpr/interlocked.h>
|
||||||
|
|
||||||
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/utils/list.h>
|
#include <freerdp/utils/list.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
|
||||||
|
|
||||||
/* RDPDR_HEADER.Component */
|
/* RDPDR_HEADER.Component */
|
||||||
enum RDPDR_CTYP
|
enum RDPDR_CTYP
|
||||||
@ -336,7 +336,7 @@ struct _IRP
|
|||||||
|
|
||||||
struct _DEVMAN
|
struct _DEVMAN
|
||||||
{
|
{
|
||||||
rdpSvcPlugin* plugin;
|
void* plugin;
|
||||||
UINT32 id_sequence;
|
UINT32 id_sequence;
|
||||||
LIST* devices;
|
LIST* devices;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user