From c0f681066e6ea2993416f6e39e0f24e1d47a9316 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 18 Jul 2013 11:35:40 -0700 Subject: [PATCH] Add test for change in type of rdpBitmap.Decompress. Fix cliprdr header. --- configure.ac | 55 +++++++++++++++++++++++++++++-- src/protocols/rdp/client.c | 4 +++ src/protocols/rdp/guac_handlers.c | 5 +++ src/protocols/rdp/rdp_bitmap.c | 8 ++++- src/protocols/rdp/rdp_bitmap.h | 9 ++++- 5 files changed, 77 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 188f8cef..ca607713 100644 --- a/configure.ac +++ b/configure.ac @@ -194,7 +194,7 @@ then have_vnc_repeater=yes AC_CHECK_MEMBERS([rfbClient.destHost, rfbClient.destPort], [], [have_vnc_repeater=no], - [[#include ]]) + [[#include ]]) if test "x${have_vnc_repeater}" = "xno" then @@ -217,6 +217,7 @@ have_winpr=yes have_freerdp=yes legacy_freerdp_extensions=no rdpsettings_interface=unknown +freerdp_interface=unknown RDP_LIBS= # libfreerdp-cache @@ -251,13 +252,21 @@ AC_CHECK_LIB([freerdp-codec], [freerdp_image_convert], AC_CHECK_MEMBERS([rdpSvcPlugin.interval_ms], [[#include ]]) -# FreeRDP-specific headers +# Keyboard layout header AC_CHECK_HEADERS([freerdp/locale/keyboard.h],, AC_CHECK_HEADERS([freerdp/kbd/layouts.h],, [have_freerdp=no])) +# New headers defining addins AC_CHECK_HEADERS([freerdp/addin.h freerdp/client/channels.h]) +# Header defining cliprdr +AC_CHECK_HEADERS([freerdp/client/cliprdr.h],, + AC_CHECK_HEADERS([freerdp/plugins/cliprdr.h],, + [have_freerdp=no]), + [#include + #include ]) + AC_CHECK_DECL([freerdp_register_addin_provider], [AC_DEFINE([HAVE_FREERDP_REGISTER_ADDIN_PROVIDER])],, [#include ]) @@ -283,6 +292,30 @@ then AC_DEFINE([ENABLE_WINPR]) fi +# +# FreeRDP: freerdp +# + +# Check for current (as of 1.1) freerdp interface +AC_CHECK_MEMBERS([freerdp.ContextSize], + [freerdp_interface=stable],, + [[#include ]]) + +# If not current, check for legacy interface +if test "x${freerdp_interface}" = "xunknown" +then + AC_CHECK_MEMBERS([freerdp.context_size], + [freerdp_interface=legacy],, + [[#include ]]) +fi + +# Set defines based on interface type, warn if unknown +if test "x${freerdp_interface}" = "xlegacy"; then + AC_DEFINE([LEGACY_FREERDP]) +elif test "x${freerdp_interface}" = "xunknown"; then + have_freerdp=no +fi + # # FreeRDP: rdpSettings # @@ -311,6 +344,24 @@ elif test "x${rdpsettings_interface}" = "xunknown"; then have_freerdp=no fi +# +# FreeRDP: rdpBitmap +# + +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include + #include + void __decompress(rdpContext* context, + rdpBitmap* bitmap, + UINT8* data, + int width, + int height, + int bpp, + int length, + BOOL compressed, + int codec_id); + rdpBitmap b = { .Decompress = __decompress };]])],, + [AC_DEFINE([LEGACY_RDPBITMAP])]) + AM_CONDITIONAL([LEGACY_FREERDP_EXTENSIONS], [test "x${legacy_freerdp_extensions}" = "xyes"]) AM_CONDITIONAL([ENABLE_WINPR], [test "x${have_winpr}" = "xyes"]) AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp}" = "xyes"]) diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index 9233c5cb..9aacb692 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -389,7 +389,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) { rdp_inst->ReceiveChannelData = __guac_receive_channel_data; /* Allocate FreeRDP context */ +#ifdef LEGACY_FREERDP rdp_inst->context_size = sizeof(rdp_freerdp_context); +#else + rdp_inst->ContextSize = sizeof(rdp_freerdp_context); +#endif rdp_inst->ContextNew = (pContextNew) rdp_freerdp_context_new; rdp_inst->ContextFree = (pContextFree) rdp_freerdp_context_free; freerdp_context_new(rdp_inst); diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index 95a2fb8d..f0dd244f 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -52,7 +52,12 @@ #include #include #include + +#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H +#include +#else #include +#endif #ifdef ENABLE_WINPR #include diff --git a/src/protocols/rdp/rdp_bitmap.c b/src/protocols/rdp/rdp_bitmap.c index c36b8646..6973f94f 100644 --- a/src/protocols/rdp/rdp_bitmap.c +++ b/src/protocols/rdp/rdp_bitmap.c @@ -197,7 +197,13 @@ void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, BOOL pri } -void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, int width, int height, int bpp, int length, BOOL compressed) { +#ifdef LEGACY_RDPBITMAP +void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, + int width, int height, int bpp, int length, BOOL compressed) { +#else +void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, + int width, int height, int bpp, int length, BOOL compressed, int codec_id) { +#endif int size = width * height * (bpp + 7) / 8; diff --git a/src/protocols/rdp/rdp_bitmap.h b/src/protocols/rdp/rdp_bitmap.h index 00867e8a..6c317114 100644 --- a/src/protocols/rdp/rdp_bitmap.h +++ b/src/protocols/rdp/rdp_bitmap.h @@ -69,9 +69,16 @@ typedef struct guac_rdp_bitmap { void guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap); void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap); -void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, int width, int height, int bpp, int length, BOOL compressed); void guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap); void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap); void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary); +#ifdef LEGACY_RDPBITMAP +void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, + int width, int height, int bpp, int length, BOOL compressed); +#else +void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, + int width, int height, int bpp, int length, BOOL compressed, int codec_id); +#endif + #endif