From ee06d70bfe81c977db7aebfa1879102bcbe54ed9 Mon Sep 17 00:00:00 2001 From: Martin Fleisz Date: Tue, 7 Mar 2023 13:04:39 +0100 Subject: [PATCH] common: Fix handling of networkautodetect rdp file setting According to https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/rdp-files#session-behavior both, `bandwidthautodetect` and `networkautodetect` are now enabled with a value of 1 and disabled with a value of 0. Earlier rdp files interpreted the `networkautodetect` setting inverted. --- client/common/file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client/common/file.c b/client/common/file.c index 90dd3edbe..f400e764d 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -1067,7 +1067,7 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett file->BandwidthAutoDetect = (freerdp_settings_get_uint32(settings, FreeRDP_ConnectionType) >= 7) ? TRUE : FALSE; file->NetworkAutoDetect = - freerdp_settings_get_bool(settings, FreeRDP_NetworkAutoDetect) ? 0 : 1; + freerdp_settings_get_bool(settings, FreeRDP_NetworkAutoDetect) ? 1 : 0; file->AutoReconnectionEnabled = freerdp_settings_get_bool(settings, FreeRDP_AutoReconnectionEnabled); file->RedirectSmartCards = freerdp_settings_get_bool(settings, FreeRDP_RedirectSmartCards); @@ -1926,14 +1926,14 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* { if (file->BandwidthAutoDetect != 0) { - if ((~file->NetworkAutoDetect) && (file->NetworkAutoDetect != 0)) + if ((~file->NetworkAutoDetect) && (file->NetworkAutoDetect == 0)) { WLog_WARN(TAG, "Got networkautodetect:i:%" PRIu32 " and bandwidthautodetect:i:%" PRIu32 - ". Correcting to networkautodetect:i:0", + ". Correcting to networkautodetect:i:1", file->NetworkAutoDetect, file->BandwidthAutoDetect); WLog_WARN(TAG, - "Add networkautodetect:i:0 to your RDP file to eliminate this warning."); + "Add networkautodetect:i:1 to your RDP file to eliminate this warning."); } if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT)) @@ -1942,13 +1942,13 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* } if (!freerdp_settings_set_bool(settings, FreeRDP_NetworkAutoDetect, (file->BandwidthAutoDetect != 0) || - (file->NetworkAutoDetect == 0))) + (file->NetworkAutoDetect != 0))) return FALSE; } if (~file->NetworkAutoDetect) { - if (file->NetworkAutoDetect == 0) + if (file->NetworkAutoDetect != 0) { if ((~file->BandwidthAutoDetect) && (file->BandwidthAutoDetect == 0)) { @@ -1967,7 +1967,7 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* } if (!freerdp_settings_set_bool(settings, FreeRDP_NetworkAutoDetect, (file->BandwidthAutoDetect != 0) || - (file->NetworkAutoDetect == 0))) + (file->NetworkAutoDetect != 0))) return FALSE; }