channels: properly handle VirtualChannelEntryEx in static virtual channel loading

This commit is contained in:
Marc-André Moreau 2016-11-16 09:52:24 -05:00
parent f74380be42
commit 36db0cc325
7 changed files with 41 additions and 12 deletions

View File

@ -25,7 +25,7 @@ set(${MODULE_PREFIX}_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/addin.h) ${CMAKE_CURRENT_SOURCE_DIR}/addin.h)
if(CHANNEL_STATIC_CLIENT_ENTRIES) if(CHANNEL_STATIC_CLIENT_ENTRIES)
list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES) list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES)
endif() endif()
foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES}) foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
@ -38,6 +38,8 @@ foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${${STATIC_MODULE}_CLIENT_ENTRY}") set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${${STATIC_MODULE}_CLIENT_ENTRY}")
if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "VirtualChannelEntry") if(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "VirtualChannelEntry")
set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS);") set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS);")
elseif(${${STATIC_MODULE}_CLIENT_ENTRY} STREQUAL "VirtualChannelEntryEx")
set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS,PVOID);")
else() else()
set(ENTRY_POINT_IMPORT "extern UINT ${ENTRY_POINT_NAME}();") set(ENTRY_POINT_IMPORT "extern UINT ${ENTRY_POINT_NAME}();")
endif() endif()

View File

@ -349,6 +349,24 @@ void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins)
free(ppAddins); free(ppAddins);
} }
extern const STATIC_ENTRY CLIENT_VirtualChannelEntryEx_TABLE[];
BOOL freerdp_channels_is_virtual_channel_entry_ex(LPCSTR pszName)
{
int i;
STATIC_ENTRY* entry;
for (i = 0; CLIENT_VirtualChannelEntryEx_TABLE[i].name != NULL; i++)
{
entry = (STATIC_ENTRY*) &CLIENT_VirtualChannelEntryEx_TABLE[i];
if (!strcmp(entry->name, pszName))
return TRUE;
}
return FALSE;
}
void* freerdp_channels_load_static_addin_entry(LPCSTR pszName, LPSTR pszSubsystem, LPSTR pszType, DWORD dwFlags) void* freerdp_channels_load_static_addin_entry(LPCSTR pszName, LPSTR pszSubsystem, LPSTR pszType, DWORD dwFlags)
{ {
int i, j; int i, j;
@ -380,6 +398,12 @@ void* freerdp_channels_load_static_addin_entry(LPCSTR pszName, LPSTR pszSubsyste
} }
else else
{ {
if (dwFlags & FREERDP_ADDIN_CHANNEL_ENTRYEX)
{
if (!freerdp_channels_is_virtual_channel_entry_ex(pszName))
return NULL;
}
return (void*) CLIENT_STATIC_ADDIN_TABLE[i].entry; return (void*) CLIENT_STATIC_ADDIN_TABLE[i].entry;
} }
} }

View File

@ -21,7 +21,7 @@ set(${MODULE_PREFIX}_SRCS
drdynvc_main.c drdynvc_main.c
drdynvc_main.h) drdynvc_main.h)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntry") add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "VirtualChannelEntryEx")
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client") set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client")

View File

@ -1422,9 +1422,9 @@ static int drdynvc_get_version(DrdynvcClientContext* context)
} }
/* drdynvc is always built-in */ /* drdynvc is always built-in */
#define VirtualChannelEntry drdynvc_VirtualChannelEntry #define VirtualChannelEntryEx drdynvc_VirtualChannelEntryEx
BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOID pInitHandle) BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOID pInitHandle)
{ {
UINT rc; UINT rc;
drdynvcPlugin* drdynvc; drdynvcPlugin* drdynvc;

View File

@ -2524,10 +2524,11 @@ static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels,
PVIRTUALCHANNELENTRY entry = NULL; PVIRTUALCHANNELENTRY entry = NULL;
PVIRTUALCHANNELENTRYEX entryEx = NULL; PVIRTUALCHANNELENTRYEX entryEx = NULL;
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC); entryEx = (PVIRTUALCHANNELENTRYEX) freerdp_load_channel_addin_entry(name, NULL, NULL,
FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
if (!strcmp(name, "drdynvc")) if (!entryEx)
entryEx = (PVIRTUALCHANNELENTRYEX) entry; entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
if (entryEx) if (entryEx)
{ {

View File

@ -36,6 +36,7 @@
#define FREERDP_ADDIN_CHANNEL_STATIC 0x00001000 #define FREERDP_ADDIN_CHANNEL_STATIC 0x00001000
#define FREERDP_ADDIN_CHANNEL_DYNAMIC 0x00002000 #define FREERDP_ADDIN_CHANNEL_DYNAMIC 0x00002000
#define FREERDP_ADDIN_CHANNEL_DEVICE 0x00004000 #define FREERDP_ADDIN_CHANNEL_DEVICE 0x00004000
#define FREERDP_ADDIN_CHANNEL_ENTRYEX 0x00008000
struct _FREERDP_ADDIN struct _FREERDP_ADDIN
{ {

View File

@ -288,12 +288,13 @@ PVIRTUALCHANNELENTRY freerdp_load_channel_addin_entry(LPCSTR pszName,
PVIRTUALCHANNELENTRY entry = NULL; PVIRTUALCHANNELENTRY entry = NULL;
if (freerdp_load_static_channel_addin_entry) if (freerdp_load_static_channel_addin_entry)
entry = freerdp_load_static_channel_addin_entry(pszName, pszSubsystem, pszType, entry = freerdp_load_static_channel_addin_entry(pszName, pszSubsystem, pszType, dwFlags);
dwFlags);
if (dwFlags & FREERDP_ADDIN_CHANNEL_ENTRYEX)
return entry; /* don't warn, don't try dynamic entries for VirtualChannelEntryEx */
if (!entry) if (!entry)
entry = freerdp_load_dynamic_channel_addin_entry(pszName, pszSubsystem, pszType, entry = freerdp_load_dynamic_channel_addin_entry(pszName, pszSubsystem, pszType, dwFlags);
dwFlags);
if (!entry) if (!entry)
WLog_WARN(TAG, "Failed to load channel %s [%s]", pszName, pszSubsystem); WLog_WARN(TAG, "Failed to load channel %s [%s]", pszName, pszSubsystem);