libfreerdp-client: export and register successfully interface pointer for channel
This commit is contained in:
parent
608f00b7df
commit
8e151409be
@ -68,6 +68,7 @@
|
||||
* VirtualChannelInit for the pInitHandle.
|
||||
*/
|
||||
|
||||
void* g_pInterface;
|
||||
CHANNEL_INIT_DATA g_ChannelInitData;
|
||||
|
||||
static wArrayList* g_ChannelsList = NULL;
|
||||
@ -386,7 +387,9 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, v
|
||||
ep.pVirtualChannelClose = FreeRDP_VirtualChannelClose;
|
||||
ep.pVirtualChannelWrite = FreeRDP_VirtualChannelWrite;
|
||||
|
||||
ep.pInterface = NULL;
|
||||
g_pInterface = NULL;
|
||||
ep.MagicNumber = FREERDP_CHANNEL_MAGIC_NUMBER;
|
||||
ep.ppInterface = &g_pInterface;
|
||||
ep.pExtendedData = data;
|
||||
ep.pVirtualChannelEventPush = FreeRDP_VirtualChannelEventPush;
|
||||
|
||||
@ -397,10 +400,7 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, v
|
||||
WaitForSingleObject(g_mutex_init, INFINITE);
|
||||
|
||||
g_ChannelInitData.channels = channels;
|
||||
g_ChannelInitData.pInterface = ep.pInterface;
|
||||
status = pChannelClientData->entry((PCHANNEL_ENTRY_POINTS) &ep);
|
||||
g_ChannelInitData.channels = NULL;
|
||||
g_ChannelInitData.pInterface = NULL;
|
||||
|
||||
ReleaseMutex(g_mutex_init);
|
||||
|
||||
@ -659,12 +659,10 @@ BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** r
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void* freerdp_channels_get_static_channel_interface(freerdp* instance, const char* name)
|
||||
void* freerdp_channels_get_static_channel_interface(rdpChannels* channels, const char* name)
|
||||
{
|
||||
rdpChannels* channels;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
|
||||
channels = instance->context->channels;
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels, name);
|
||||
|
||||
return pChannelOpenData->pInterface;
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "init.h"
|
||||
|
||||
extern int g_open_handle_sequence;
|
||||
|
||||
extern void* g_pInterface;
|
||||
extern CHANNEL_INIT_DATA g_ChannelInitData;
|
||||
|
||||
UINT32 FreeRDP_VirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF pChannel,
|
||||
@ -47,7 +49,7 @@ UINT32 FreeRDP_VirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF pChannel,
|
||||
}
|
||||
|
||||
channels = g_ChannelInitData.channels;
|
||||
pInterface = g_ChannelInitData.pInterface;
|
||||
pInterface = g_pInterface;
|
||||
|
||||
pChannelInitData = &(channels->initDataList[channels->initDataCount]);
|
||||
*ppInitHandle = pChannelInitData;
|
||||
|
@ -301,6 +301,7 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
{
|
||||
cliprdrPlugin* _p;
|
||||
CliprdrClientContext* context;
|
||||
CHANNEL_ENTRY_POINTS_EX* pEntryPointsEx;
|
||||
|
||||
_p = (cliprdrPlugin*) malloc(sizeof(cliprdrPlugin));
|
||||
ZeroMemory(_p, sizeof(cliprdrPlugin));
|
||||
@ -318,6 +319,11 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
_p->plugin.event_callback = cliprdr_process_event;
|
||||
_p->plugin.terminate_callback = cliprdr_process_terminate;
|
||||
|
||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_EX*) pEntryPoints;
|
||||
|
||||
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_EX)) &&
|
||||
(pEntryPointsEx->MagicNumber == FREERDP_CHANNEL_MAGIC_NUMBER))
|
||||
{
|
||||
context = (CliprdrClientContext*) malloc(sizeof(CliprdrClientContext));
|
||||
|
||||
context->MonitorReady = cliprdr_monitor_ready;
|
||||
@ -325,7 +331,8 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
||||
context->DataRequest = cliprdr_data_request;
|
||||
context->DataResponse = cliprdr_data_response;
|
||||
|
||||
_p->plugin.channel_entry_points.pInterface = (void*) context;
|
||||
*(pEntryPointsEx->ppInterface) = (void*) context;
|
||||
}
|
||||
|
||||
svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
#include <freerdp/channels/channels.h>
|
||||
|
||||
#include "xf_cliprdr.h"
|
||||
|
||||
@ -89,7 +90,7 @@ struct clipboard_context
|
||||
int incr_data_length;
|
||||
};
|
||||
|
||||
void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman)
|
||||
void xf_cliprdr_init(xfInfo* xfi, rdpChannels* channels)
|
||||
{
|
||||
int n;
|
||||
UINT32 id;
|
||||
@ -100,7 +101,7 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman)
|
||||
|
||||
xfi->clipboard_context = cb;
|
||||
|
||||
cb->channels = chanman;
|
||||
cb->channels = channels;
|
||||
cb->request_index = -1;
|
||||
|
||||
cb->root_window = DefaultRootWindow(xfi->display);
|
||||
|
@ -48,7 +48,7 @@ FREERDP_API BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* inst
|
||||
FREERDP_API wMessage* freerdp_channels_pop_event(rdpChannels* channels);
|
||||
FREERDP_API void freerdp_channels_close(rdpChannels* channels, freerdp* instance);
|
||||
|
||||
FREERDP_API void* freerdp_channels_get_static_channel_interface(freerdp* instance, const char* name);
|
||||
FREERDP_API void* freerdp_channels_get_static_channel_interface(rdpChannels* channels, const char* name);
|
||||
|
||||
FREERDP_API HANDLE freerdp_channels_get_event_handle(freerdp* instance);
|
||||
FREERDP_API int freerdp_channels_process_pending_messages(freerdp* instance);
|
||||
|
@ -95,6 +95,8 @@ typedef CHANNEL_ENTRY_POINTS* PCHANNEL_ENTRY_POINTS;
|
||||
|
||||
typedef int (FREERDP_CC * PVIRTUALCHANNELENTRY)(PCHANNEL_ENTRY_POINTS pEntryPoints);
|
||||
|
||||
#define FREERDP_CHANNEL_MAGIC_NUMBER 0x46524450
|
||||
|
||||
struct _CHANNEL_ENTRY_POINTS_EX
|
||||
{
|
||||
UINT32 cbSize;
|
||||
@ -105,9 +107,9 @@ struct _CHANNEL_ENTRY_POINTS_EX
|
||||
PVIRTUALCHANNELWRITE pVirtualChannelWrite;
|
||||
|
||||
/* Extended Fields */
|
||||
|
||||
UINT32 MagicNumber; /* identifies FreeRDP */
|
||||
void* pExtendedData; /* extended initial data */
|
||||
void* pInterface; /* channel callback interface */
|
||||
void** ppInterface; /* channel callback interface */
|
||||
PVIRTUALCHANNELEVENTPUSH pVirtualChannelEventPush;
|
||||
};
|
||||
typedef struct _CHANNEL_ENTRY_POINTS_EX CHANNEL_ENTRY_POINTS_EX;
|
||||
|
Loading…
Reference in New Issue
Block a user