From 0560ba0910f73461b588437482b7f4b01198b956 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 20 Feb 2019 08:45:36 +0100 Subject: [PATCH] Fixed mixing of remote application mode requested and feature mask. --- include/freerdp/settings.h | 6 ++++-- libfreerdp/core/capabilities.c | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index ba15b0a..9e1fc4d 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -756,6 +756,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL; #define FreeRDP_RemoteAppNumIconCacheEntries (2123) #define FreeRDP_RemoteAppLanguageBarSupported (2124) #define FreeRDP_RemoteWndSupportLevel (2125) +#define FreeRDP_RemoteApplicationSupportLevel (2126) #define FreeRDP_ReceivedCapabilities (2240) #define FreeRDP_ReceivedCapabilitiesSize (2241) #define FreeRDP_OsMajorType (2304) @@ -1239,7 +1240,7 @@ struct rdp_settings */ /* RemoteApp */ - ALIGN64 UINT32 RemoteApplicationMode; /* 2112 */ + ALIGN64 BOOL RemoteApplicationMode; /* 2112 */ ALIGN64 char* RemoteApplicationName; /* 2113 */ ALIGN64 char* RemoteApplicationIcon; /* 2114 */ ALIGN64 char* RemoteApplicationProgram; /* 2115 */ @@ -1253,7 +1254,8 @@ struct rdp_settings ALIGN64 UINT32 RemoteAppNumIconCacheEntries; /* 2123 */ ALIGN64 BOOL RemoteAppLanguageBarSupported; /* 2124 */ ALIGN64 UINT32 RemoteWndSupportLevel; /* 2125 */ - UINT64 padding2176[2176 - 2126]; /* 2126 */ + ALIGN64 UINT32 RemoteApplicationSupportLevel; /* 2126 */ + UINT64 padding2176[2176 - 2127]; /* 2127 */ UINT64 padding2240[2240 - 2176]; /* 2176 */ /** diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 1badada..e31831c 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -2183,7 +2183,17 @@ static BOOL rdp_read_remote_programs_capability_set(wStream* s, UINT16 length, return FALSE; Stream_Read_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */ - settings->RemoteApplicationMode = railSupportLevel; + settings->RemoteApplicationSupportLevel = railSupportLevel; + + if ((railSupportLevel & RAIL_LEVEL_SUPPORTED) == 0) + { + if (settings->RemoteApplicationMode == TRUE) + { + /* RemoteApp Failure! */ + settings->RemoteApplicationMode = FALSE; + } + } + return TRUE; } @@ -2206,13 +2216,13 @@ static BOOL rdp_write_remote_programs_capability_set(wStream* s, header = rdp_capability_set_start(s); railSupportLevel = RAIL_LEVEL_SUPPORTED; - if (settings->RemoteApplicationMode & RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED) + if (settings->RemoteApplicationSupportLevel & RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED) { if (settings->RemoteAppLanguageBarSupported) railSupportLevel |= RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED; } - if (settings->RemoteApplicationMode & RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED) + if (settings->RemoteApplicationSupportLevel & RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED) railSupportLevel |= RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED; Stream_Write_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */ @@ -3941,7 +3951,7 @@ BOOL rdp_write_demand_active(wStream* s, rdpSettings* settings) return FALSE; } - if (settings->RemoteApplicationMode & RAIL_LEVEL_SUPPORTED) + if (settings->RemoteApplicationMode) { numberCapabilities += 2; @@ -4125,7 +4135,7 @@ BOOL rdp_write_confirm_active(wStream* s, rdpSettings* settings) } } - if (settings->RemoteApplicationMode & RAIL_LEVEL_SUPPORTED) + if (settings->RemoteApplicationMode) { numberCapabilities += 2; -- 2.7.4