GUACAMOLE-25: Support FreeRDP stable-1.0 and compatible.

This commit is contained in:
Michael Jumper 2016-05-09 22:23:46 -07:00
parent f1d4393eb8
commit 8ccf61e6b1
3 changed files with 46 additions and 2 deletions

View File

@ -579,6 +579,15 @@ then
[#include <freerdp/channels/channels.h>]) [#include <freerdp/channels/channels.h>])
fi fi
# Availability of ADDIN_ARGV structure for configuring plugins
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_TYPE([ADDIN_ARGV],
[AC_DEFINE([HAVE_ADDIN_ARGV],,
[Whether the ADDIN_ARGV type is available])],,
[#include <freerdp/settings.h>])
fi
# #
# FreeRDP: WinPR # FreeRDP: WinPR
# #

View File

@ -117,6 +117,14 @@ int guac_rdp_load_drdynvc(rdpContext* context, guac_rdp_dvc_list* list) {
if (list->channel_count == 0) if (list->channel_count == 0)
return 0; return 0;
#ifndef HAVE_ADDIN_ARGV
/* Allocate plugin data array */
RDP_PLUGIN_DATA* all_plugin_data =
calloc(list->channel_count + 1, sizeof(RDP_PLUGIN_DATA));
RDP_PLUGIN_DATA* current_plugin_data = all_plugin_data;
#endif
/* For each channel */ /* For each channel */
guac_common_list_element* current = list->channels->head; guac_common_list_element* current = list->channels->head;
while (current != NULL) { while (current != NULL) {
@ -135,20 +143,41 @@ int guac_rdp_load_drdynvc(rdpContext* context, guac_rdp_dvc_list* list) {
guac_client_log(client, GUAC_LOG_DEBUG, guac_client_log(client, GUAC_LOG_DEBUG,
"Registering DVC plugin \"%s\"", dvc->argv[0]); "Registering DVC plugin \"%s\"", dvc->argv[0]);
#ifdef HAVE_ADDIN_ARGV
/* Register plugin with FreeRDP */ /* Register plugin with FreeRDP */
ADDIN_ARGV* args = malloc(sizeof(ADDIN_ARGV)); ADDIN_ARGV* args = malloc(sizeof(ADDIN_ARGV));
args->argc = dvc->argc; args->argc = dvc->argc;
args->argv = dvc->argv; args->argv = dvc->argv;
freerdp_dynamic_channel_collection_add(context->settings, args); freerdp_dynamic_channel_collection_add(context->settings, args);
#else
/* Copy all arguments */
for (int i = 0; i < dvc->argc; i++)
current_plugin_data->data[i] = dvc->argv[i];
/* Store size of entry */
current_plugin_data->size = sizeof(*current_plugin_data);
/* Advance to next set of plugin data */
current_plugin_data++;
#endif
/* Rely on FreeRDP to free argv storage */ /* Rely on FreeRDP to free argv storage */
dvc->argv = NULL; dvc->argv = NULL;
} }
#ifdef HAVE_ADDIN_ARGV
/* Load virtual channel management plugin */ /* Load virtual channel management plugin */
return freerdp_channels_load_plugin(channels, context->settings, return freerdp_channels_load_plugin(channels, context->instance->settings,
"drdynvc", context->settings); "drdynvc", context->instance->settings);
#else
/* Terminate with empty RDP_PLUGIN_DATA element */
current_plugin_data->size = 0;
/* Load virtual channel management plugin */
return freerdp_channels_load_plugin(channels, context->instance->settings,
"drdynvc", all_plugin_data);
#endif
} }

View File

@ -314,8 +314,14 @@ static int guac_rdp_ai_terminated(IWTSPlugin* plugin) {
*/ */
int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) { int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) {
/* Pull guac_client from arguments */
#ifdef HAVE_ADDIN_ARGV
ADDIN_ARGV* args = pEntryPoints->GetPluginData(pEntryPoints); ADDIN_ARGV* args = pEntryPoints->GetPluginData(pEntryPoints);
guac_client* client = (guac_client*) guac_rdp_string_to_ptr(args->argv[1]); guac_client* client = (guac_client*) guac_rdp_string_to_ptr(args->argv[1]);
#else
RDP_PLUGIN_DATA* data = pEntryPoints->GetPluginData(pEntryPoints);
guac_client* client = (guac_client*) guac_rdp_string_to_ptr(data->data[1]);
#endif
/* Pull previously-allocated plugin */ /* Pull previously-allocated plugin */
guac_rdp_ai_plugin* ai_plugin = (guac_rdp_ai_plugin*) guac_rdp_ai_plugin* ai_plugin = (guac_rdp_ai_plugin*)