From be1a1dcbe03143f1e4c8aefb09b8fd9c9d2a7be5 Mon Sep 17 00:00:00 2001 From: Martin Fleisz Date: Wed, 2 Jun 2021 12:29:55 +0200 Subject: [PATCH] client: Fix writing of untouched rdp settings to rdp files Since the last change untouched string settings were written to the rdp file because their default value was set to NULL instead of ~0. This resulted in settings being written to the rdp file with a value of "(null)" instead of just being skipped. --- client/common/file.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/client/common/file.c b/client/common/file.c index 715348c3d..6645c7275 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -97,22 +97,22 @@ struct rdp_file DWORD EnableSuperSpan; /* enablesuperpan */ DWORD SuperSpanAccelerationFactor; /* superpanaccelerationfactor */ - DWORD DesktopWidth; /* desktopwidth */ - DWORD DesktopHeight; /* desktopheight */ - DWORD DesktopSizeId; /* desktop size id */ - DWORD SessionBpp; /* session bpp */ + DWORD DesktopWidth; /* desktopwidth */ + DWORD DesktopHeight; /* desktopheight */ + DWORD DesktopSizeId; /* desktop size id */ + DWORD SessionBpp; /* session bpp */ DWORD DesktopScaleFactor; /* desktopscalefactor */ DWORD Compression; /* compression */ DWORD KeyboardHook; /* keyboardhook */ DWORD DisableCtrlAltDel; /* disable ctrl+alt+del */ - DWORD AudioMode; /* audiomode */ - DWORD AudioQualityMode; /* audioqualitymode */ - DWORD AudioCaptureMode; /* audiocapturemode */ + DWORD AudioMode; /* audiomode */ + DWORD AudioQualityMode; /* audioqualitymode */ + DWORD AudioCaptureMode; /* audiocapturemode */ DWORD EncodeRedirectedVideoCapture; /* encode redirected video capture */ DWORD RedirectedVideoCaptureEncodingQuality; /* redirected video capture encoding quality */ - DWORD VideoPlaybackMode; /* videoplaybackmode */ + DWORD VideoPlaybackMode; /* videoplaybackmode */ DWORD ConnectionType; /* connection type */ @@ -869,7 +869,7 @@ static INLINE BOOL FILE_POPULATE_STRING(char** _target, const rdpSettings* _sett str = freerdp_settings_get_string(_settings, _option); freerdp_client_file_string_check_free(*_target); - *_target = NULL; + *_target = (void*)~((size_t)NULL); if (str) { *_target = _strdup(str); @@ -896,6 +896,7 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett size_t index; UINT32 LoadBalanceInfoLength; const char* GatewayHostname = NULL; + char* redirectCameras = NULL; if (!FILE_POPULATE_STRING(&file->Domain, settings, FreeRDP_Domain) || !FILE_POPULATE_STRING(&file->Username, settings, FreeRDP_Username) || @@ -1021,7 +1022,9 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett file->AutoReconnectionEnabled = freerdp_settings_get_bool(settings, FreeRDP_AutoReconnectionEnabled); file->RedirectSmartCards = freerdp_settings_get_bool(settings, FreeRDP_RedirectSmartCards); - file->RedirectCameras = freerdp_client_channel_args_to_string(settings, "rdpecam", "device:"); + + redirectCameras = freerdp_client_channel_args_to_string(settings, "rdpecam", "device:"); + if (redirectCameras) { char* str = freerdp_client_channel_args_to_string(settings, "rdpecam", "encode:"); file->EncodeRedirectedVideoCapture = 0; @@ -1034,10 +1037,8 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett file->EncodeRedirectedVideoCapture = val; } free(str); - } - { - char* str = freerdp_client_channel_args_to_string(settings, "rdpecam", "quality:"); + str = freerdp_client_channel_args_to_string(settings, "rdpecam", "quality:"); file->RedirectedVideoCaptureEncodingQuality = 0; if (str) { @@ -1050,6 +1051,8 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett } } free(str); + + file->RedirectCameras = redirectCameras; } #ifdef CHANNEL_URBDRC_CLIENT file->UsbDevicesToRedirect =