From 6ac91924d5edfc627fc90e67ddc8e378b267a4ad Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 6 May 2019 09:51:42 +0200 Subject: [PATCH] Fixed use of settings getter/setter --- client/common/file.c | 260 +++++++++++++++++++++++---------- include/freerdp/settings.h | 2 +- libfreerdp/common/assistance.c | 23 +-- libfreerdp/common/settings.c | 32 ++-- 4 files changed, 214 insertions(+), 103 deletions(-) mode change 100755 => 100644 client/common/file.c diff --git a/client/common/file.c b/client/common/file.c old mode 100755 new mode 100644 index 16f56724d..a0f104991 --- a/client/common/file.c +++ b/client/common/file.c @@ -740,7 +740,7 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* { if (~((size_t) file->Domain)) { - if (freerdp_set_param_string(settings, FreeRDP_Domain, file->Domain) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_Domain, file->Domain)) return FALSE; } @@ -752,12 +752,12 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* if (!freerdp_parse_username(file->Username, &user, &domain)) return FALSE; - if (freerdp_set_param_string(settings, FreeRDP_Username, user) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_Username, user)) return FALSE; if (domain) { - if (freerdp_set_param_string(settings, FreeRDP_Domain, domain) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_Domain, domain)) return FALSE; } @@ -767,7 +767,7 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* if (~((size_t)file->Password)) { - if (freerdp_set_param_string(settings, FreeRDP_Password, file->Password) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_Password, file->Password)) return FALSE; } @@ -779,49 +779,76 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* if (!freerdp_parse_hostname(file->FullAddress, &host, &port)) return FALSE; - if (freerdp_set_param_string(settings, FreeRDP_ServerHostname, host) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_ServerHostname, host)) return FALSE; - if (port > 0) - freerdp_set_param_uint32(settings, FreeRDP_ServerPort, (UINT32) port); - free(host); + + if (port > 0) + { + if (!freerdp_set_param_uint32(settings, FreeRDP_ServerPort, (UINT32) port)) + return FALSE; + } } if (~file->ServerPort) - freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->ServerPort); + { + if (!freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->ServerPort)) + return FALSE; + } if (~file->DesktopWidth) - freerdp_set_param_uint32(settings, FreeRDP_DesktopWidth, file->DesktopWidth); + { + if (!freerdp_set_param_uint32(settings, FreeRDP_DesktopWidth, file->DesktopWidth)) + return FALSE; + } if (~file->DesktopHeight) - freerdp_set_param_uint32(settings, FreeRDP_DesktopHeight, file->DesktopHeight); + { + if (!freerdp_set_param_uint32(settings, FreeRDP_DesktopHeight, file->DesktopHeight)) + return FALSE; + } if (~file->SessionBpp) - freerdp_set_param_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp); + { + if (!freerdp_set_param_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp)) + return FALSE; + } if (~file->ConnectToConsole) - freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->ConnectToConsole); + { + if (!freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->ConnectToConsole)) + return FALSE; + } if (~file->AdministrativeSession) - freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->AdministrativeSession); + { + if (!freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->AdministrativeSession)) + return FALSE; + } if (~file->NegotiateSecurityLayer) - freerdp_set_param_bool(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer); + { + if (!freerdp_set_param_bool(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer)) + return FALSE; + } if (~file->EnableCredSSPSupport) - freerdp_set_param_bool(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport); + { + if (!freerdp_set_param_bool(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport)) + return FALSE; + } if (~((size_t) file->AlternateShell)) { - if (freerdp_set_param_string(settings, FreeRDP_AlternateShell, file->AlternateShell) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_AlternateShell, file->AlternateShell)) return FALSE; } if (~((size_t) file->ShellWorkingDirectory)) { - if (freerdp_set_param_string(settings, FreeRDP_ShellWorkingDirectory, - file->ShellWorkingDirectory) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_ShellWorkingDirectory, + file->ShellWorkingDirectory)) return FALSE; } @@ -839,14 +866,16 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* * 1: The remote session will appear in a window. * 2: The remote session will appear full screen. */ - freerdp_set_param_bool(settings, FreeRDP_Fullscreen, - (file->ScreenModeId == 2) ? TRUE : FALSE); + if (!freerdp_set_param_bool(settings, FreeRDP_Fullscreen, + (file->ScreenModeId == 2) ? TRUE : FALSE)) + return FALSE; } if (~(file->SmartSizing)) { - freerdp_set_param_bool(settings, FreeRDP_SmartSizing, - (file->SmartSizing == 1) ? TRUE : FALSE); + if (!freerdp_set_param_bool(settings, FreeRDP_SmartSizing, + (file->SmartSizing == 1) ? TRUE : FALSE)) + return FALSE; } if (~((size_t) file->LoadBalanceInfo)) @@ -879,27 +908,36 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* } if (~file->ConnectionType) - freerdp_set_param_uint32(settings, FreeRDP_ConnectionType, file->ConnectionType); + { + if (!freerdp_set_param_uint32(settings, FreeRDP_ConnectionType, file->ConnectionType)) + return FALSE; + } if (~file->AudioMode) { if (file->AudioMode == AUDIO_MODE_REDIRECT) { - freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, TRUE); + if (!freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, TRUE)) + return FALSE; } else if (file->AudioMode == AUDIO_MODE_PLAY_ON_SERVER) { - freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, TRUE); + if (!freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, TRUE)) + return FALSE; } else if (file->AudioMode == AUDIO_MODE_NONE) { - freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, FALSE); - freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, FALSE); + if (!freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, FALSE) || + !freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, FALSE)) + return FALSE; } } if (~file->Compression) - freerdp_set_param_bool(settings, FreeRDP_CompressionEnabled, file->Compression); + { + if (!freerdp_set_param_bool(settings, FreeRDP_CompressionEnabled, file->Compression)) + return FALSE; + } if (~((size_t) file->GatewayHostname)) { @@ -909,48 +947,61 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* if (!freerdp_parse_hostname(file->GatewayHostname, &host, &port)) return FALSE; - if (freerdp_set_param_string(settings, FreeRDP_GatewayHostname, host) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_GatewayHostname, host)) return FALSE; - if (port > 0) - freerdp_set_param_uint32(settings, FreeRDP_GatewayPort, (UINT32) port); - free(host); + + if (port > 0) + { + if (!freerdp_set_param_uint32(settings, FreeRDP_GatewayPort, (UINT32) port)) + return FALSE; + } } if (~((size_t) file->GatewayAccessToken)) { - if (freerdp_set_param_string(settings, FreeRDP_GatewayAccessToken, file->GatewayAccessToken) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_GatewayAccessToken, file->GatewayAccessToken)) return FALSE; } if (~file->GatewayUsageMethod) - freerdp_set_gateway_usage_method(settings, file->GatewayUsageMethod); + { + if (!freerdp_set_gateway_usage_method(settings, file->GatewayUsageMethod)) + return FALSE; + } if (~file->PromptCredentialOnce) - freerdp_set_param_bool(settings, FreeRDP_GatewayUseSameCredentials, file->PromptCredentialOnce); + { + if (!freerdp_set_param_bool(settings, FreeRDP_GatewayUseSameCredentials, + file->PromptCredentialOnce)) + return FALSE; + } if (~file->RemoteApplicationMode) - freerdp_set_param_bool(settings, FreeRDP_RemoteApplicationMode, file->RemoteApplicationMode); + { + if (!freerdp_set_param_bool(settings, FreeRDP_RemoteApplicationMode, file->RemoteApplicationMode)) + return FALSE; + } if (~((size_t) file->RemoteApplicationProgram)) { - if (freerdp_set_param_string(settings, FreeRDP_RemoteApplicationProgram, - file->RemoteApplicationProgram) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteApplicationProgram, + file->RemoteApplicationProgram)) return FALSE; } if (~((size_t) file->RemoteApplicationName)) { - if (freerdp_set_param_string(settings, FreeRDP_RemoteApplicationName, - file->RemoteApplicationName) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteApplicationName, + file->RemoteApplicationName)) return FALSE; } if (~((size_t) file->RemoteApplicationIcon)) { - if (freerdp_set_param_string(settings, FreeRDP_RemoteApplicationIcon, - file->RemoteApplicationIcon) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteApplicationIcon, + file->RemoteApplicationIcon)) return FALSE; } @@ -963,70 +1014,124 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* if (~((size_t) file->RemoteApplicationCmdLine)) { - if (freerdp_set_param_string(settings, FreeRDP_RemoteApplicationCmdLine, - file->RemoteApplicationCmdLine) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteApplicationCmdLine, + file->RemoteApplicationCmdLine)) return FALSE; } if (~file->SpanMonitors) - freerdp_set_param_bool(settings, FreeRDP_SpanMonitors, file->SpanMonitors); + { + if (!freerdp_set_param_bool(settings, FreeRDP_SpanMonitors, file->SpanMonitors)) + return FALSE; + } if (~file->UseMultiMon) - freerdp_set_param_bool(settings, FreeRDP_UseMultimon, file->UseMultiMon); + { + if (!freerdp_set_param_bool(settings, FreeRDP_UseMultimon, file->UseMultiMon)) + return FALSE; + } if (~file->AllowFontSmoothing) - freerdp_set_param_bool(settings, FreeRDP_AllowFontSmoothing, file->AllowFontSmoothing); + { + if (!freerdp_set_param_bool(settings, FreeRDP_AllowFontSmoothing, file->AllowFontSmoothing)) + return FALSE; + } if (~file->DisableWallpaper) - freerdp_set_param_bool(settings, FreeRDP_DisableWallpaper, file->DisableWallpaper); + { + if (!freerdp_set_param_bool(settings, FreeRDP_DisableWallpaper, file->DisableWallpaper)) + return FALSE; + } if (~file->DisableFullWindowDrag) - freerdp_set_param_bool(settings, FreeRDP_DisableFullWindowDrag, file->DisableFullWindowDrag); + { + if (!freerdp_set_param_bool(settings, FreeRDP_DisableFullWindowDrag, file->DisableFullWindowDrag)) + return FALSE; + } if (~file->DisableMenuAnims) - freerdp_set_param_bool(settings, FreeRDP_DisableMenuAnims, file->DisableMenuAnims); + { + if (!freerdp_set_param_bool(settings, FreeRDP_DisableMenuAnims, file->DisableMenuAnims)) + return FALSE; + } if (~file->DisableThemes) - freerdp_set_param_bool(settings, FreeRDP_DisableThemes, file->DisableThemes); + { + if (!freerdp_set_param_bool(settings, FreeRDP_DisableThemes, file->DisableThemes)) + return FALSE; + } if (~file->AllowDesktopComposition) - freerdp_set_param_bool(settings, FreeRDP_AllowDesktopComposition, file->AllowDesktopComposition); + { + if (!freerdp_set_param_bool(settings, FreeRDP_AllowDesktopComposition, + file->AllowDesktopComposition)) + return FALSE; + } if (~file->BitmapCachePersistEnable) - freerdp_set_param_bool(settings, FreeRDP_BitmapCachePersistEnabled, file->BitmapCachePersistEnable); + { + if (!freerdp_set_param_bool(settings, FreeRDP_BitmapCachePersistEnabled, + file->BitmapCachePersistEnable)) + return FALSE; + } if (~file->DisableRemoteAppCapsCheck) - freerdp_set_param_bool(settings, FreeRDP_DisableRemoteAppCapsCheck, - file->DisableRemoteAppCapsCheck); + { + if (!freerdp_set_param_bool(settings, FreeRDP_DisableRemoteAppCapsCheck, + file->DisableRemoteAppCapsCheck)) + return FALSE; + } if (~file->AutoReconnectionEnabled) - freerdp_set_param_bool(settings, FreeRDP_AutoReconnectionEnabled, file->AutoReconnectionEnabled); + { + if (!freerdp_set_param_bool(settings, FreeRDP_AutoReconnectionEnabled, + file->AutoReconnectionEnabled)) + return FALSE; + } if (~file->AutoReconnectMaxRetries) - freerdp_set_param_uint32(settings, FreeRDP_AutoReconnectMaxRetries, file->AutoReconnectMaxRetries); + { + if (!freerdp_set_param_uint32(settings, FreeRDP_AutoReconnectMaxRetries, + file->AutoReconnectMaxRetries)) + return FALSE; + } if (~file->RedirectSmartCards) - freerdp_set_param_bool(settings, FreeRDP_RedirectSmartCards, file->RedirectSmartCards); + { + if (!freerdp_set_param_bool(settings, FreeRDP_RedirectSmartCards, file->RedirectSmartCards)) + return FALSE; + } if (~file->RedirectClipboard) - freerdp_set_param_bool(settings, FreeRDP_RedirectClipboard, file->RedirectClipboard); + { + if (!freerdp_set_param_bool(settings, FreeRDP_RedirectClipboard, file->RedirectClipboard)) + return FALSE; + } if (~file->RedirectPrinters) - freerdp_set_param_bool(settings, FreeRDP_RedirectPrinters, file->RedirectPrinters); + { + if (!freerdp_set_param_bool(settings, FreeRDP_RedirectPrinters, file->RedirectPrinters)) + return FALSE; + } if (~file->RedirectDrives) - freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, file->RedirectDrives); + { + if (!freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, file->RedirectDrives)) + return FALSE; + } if (~file->RedirectPosDevices) { - freerdp_set_param_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts); - freerdp_set_param_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts); + if (!freerdp_set_param_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts) || + !freerdp_set_param_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts)) + return FALSE; } if (~file->RedirectComPorts) { - freerdp_set_param_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts); - freerdp_set_param_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts); + if (!freerdp_set_param_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts) || + !freerdp_set_param_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts)) + return FALSE; } if (~file->RedirectDirectX) @@ -1072,19 +1177,23 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* * comma-separated list of drive letters to redirect. */ const BOOL empty = !file->DrivesToRedirect || (strlen(file->DrivesToRedirect) == 0); - freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, !empty); + + if (!freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, !empty)) + return FALSE; } if (~file->KeyboardHook) { - freerdp_set_param_uint32(settings, FreeRDP_KeyboardHook, file->KeyboardHook); + if (!freerdp_set_param_uint32(settings, FreeRDP_KeyboardHook, file->KeyboardHook)) + return FALSE; } if (~((size_t) file->PreconnectionBlob)) { - freerdp_set_param_string(settings, FreeRDP_PreconnectionBlob, file->PreconnectionBlob); - freerdp_set_param_bool(settings, FreeRDP_SendPreconnectionPdu, TRUE); - freerdp_set_param_bool(settings, FreeRDP_VmConnectMode, TRUE); + if (!freerdp_set_param_string(settings, FreeRDP_PreconnectionBlob, file->PreconnectionBlob) || + !freerdp_set_param_bool(settings, FreeRDP_SendPreconnectionPdu, TRUE) || + !freerdp_set_param_bool(settings, FreeRDP_VmConnectMode, TRUE)) + return FALSE; } if (file->argc > 1) @@ -1107,7 +1216,6 @@ static rdpFileLine* freerdp_client_rdp_file_find_line_index(rdpFile* file, int i line = &(file->lines[index]); return line; } - static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(rdpFile* file, const char* name) { int index; @@ -1130,7 +1238,6 @@ static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(rdpFile* file, con return (bFound) ? line : NULL; } - /** * Set a string option to a rdpFile * @param file rdpFile @@ -1138,7 +1245,6 @@ static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(rdpFile* file, con * @param value value of the option * @return 0 on success */ - int freerdp_client_rdp_file_set_string_option(rdpFile* file, const char* name, const char* value) { int index; @@ -1187,7 +1293,6 @@ out_fail: free(text); return -1; } - const char* freerdp_client_rdp_file_get_string_option(rdpFile* file, const char* name) { rdpFileLine* line; @@ -1201,7 +1306,6 @@ const char* freerdp_client_rdp_file_get_string_option(rdpFile* file, const char* return line->sValue; } - int freerdp_client_rdp_file_set_integer_option(rdpFile* file, const char* name, int value) { int index; @@ -1248,7 +1352,6 @@ int freerdp_client_rdp_file_set_integer_option(rdpFile* file, const char* name, return 0; } - int freerdp_client_rdp_file_get_integer_option(rdpFile* file, const char* name) { rdpFileLine* line; @@ -1262,13 +1365,11 @@ int freerdp_client_rdp_file_get_integer_option(rdpFile* file, const char* name) return line->iValue; } - static void freerdp_client_file_string_check_free(LPSTR str) { if (~((size_t) str)) free(str); } - rdpFile* freerdp_client_rdp_file_new() { rdpFile* file; @@ -1309,7 +1410,6 @@ rdpFile* freerdp_client_rdp_file_new() return file; } - void freerdp_client_rdp_file_free(rdpFile* file) { int i; diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 93a38784a..8e42f07ed 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -1572,7 +1572,7 @@ FREERDP_API void freerdp_target_net_addresses_free(rdpSettings* settings); FREERDP_API void freerdp_performance_flags_make(rdpSettings* settings); FREERDP_API void freerdp_performance_flags_split(rdpSettings* settings); -FREERDP_API void freerdp_set_gateway_usage_method(rdpSettings* settings, UINT32 GatewayUsageMethod); +FREERDP_API BOOL freerdp_set_gateway_usage_method(rdpSettings* settings, UINT32 GatewayUsageMethod); FREERDP_API void freerdp_update_gateway_usage_method(rdpSettings* settings, UINT32 GatewayEnabled, UINT32 GatewayBypassLocal); diff --git a/libfreerdp/common/assistance.c b/libfreerdp/common/assistance.c index 3432a0547..a7f0d4ab8 100644 --- a/libfreerdp/common/assistance.c +++ b/libfreerdp/common/assistance.c @@ -1160,44 +1160,47 @@ BOOL freerdp_assistance_populate_settings_from_assistance_file(rdpAssistanceFile if (!file->RASessionId || !file->MachineAddresses) return FALSE; - if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceSessionId, file->RASessionId) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceSessionId, file->RASessionId)) return FALSE; if (file->RCTicket) { - if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceRCTicket, file->RCTicket) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceRCTicket, file->RCTicket)) return FALSE; } else { - if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceRCTicket, - file->ConnectionString2) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceRCTicket, + file->ConnectionString2)) return FALSE; } if (file->PassStub) { - if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistancePassStub, file->PassStub) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteAssistancePassStub, file->PassStub)) return FALSE; } - if (freerdp_set_param_string(settings, FreeRDP_ServerHostname, file->MachineAddresses[0]) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_ServerHostname, file->MachineAddresses[0])) return FALSE; - if (freerdp_set_param_string(settings, FreeRDP_AssistanceFile, file->filename) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_AssistanceFile, file->filename)) return FALSE; - if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistancePassword, file->password) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_RemoteAssistancePassword, file->password)) return FALSE; if (file->Username) { - if (freerdp_set_param_string(settings, FreeRDP_Username, file->Username) != 0) + if (!freerdp_set_param_string(settings, FreeRDP_Username, file->Username)) return FALSE; } settings->RemoteAssistanceMode = TRUE; - freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->MachinePorts[0]); + + if (!freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->MachinePorts[0])) + return FALSE; + freerdp_target_net_addresses_free(settings); settings->TargetNetAddressCount = file->MachineCount; diff --git a/libfreerdp/common/settings.c b/libfreerdp/common/settings.c index a2d6aba47..8e571bb77 100644 --- a/libfreerdp/common/settings.c +++ b/libfreerdp/common/settings.c @@ -695,24 +695,28 @@ void freerdp_performance_flags_split(rdpSettings* settings) settings->DisableThemes = (settings->PerformanceFlags & PERF_DISABLE_THEMING) ? TRUE : FALSE; } -void freerdp_set_gateway_usage_method(rdpSettings* settings, UINT32 GatewayUsageMethod) +BOOL freerdp_set_gateway_usage_method(rdpSettings* settings, UINT32 GatewayUsageMethod) { - freerdp_set_param_uint32(settings, FreeRDP_GatewayUsageMethod, GatewayUsageMethod); + if (!freerdp_set_param_uint32(settings, FreeRDP_GatewayUsageMethod, GatewayUsageMethod)) + return FALSE; if (GatewayUsageMethod == TSC_PROXY_MODE_NONE_DIRECT) { - freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, FALSE); - freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE); + if (!freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, FALSE) || + !freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE)) + return FALSE; } else if (GatewayUsageMethod == TSC_PROXY_MODE_DIRECT) { - freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, TRUE); - freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE); + if (!freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, TRUE) || + !freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE)) + return FALSE; } else if (GatewayUsageMethod == TSC_PROXY_MODE_DETECT) { - freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, TRUE); - freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, TRUE); + if (!freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, TRUE) || + !freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, TRUE)) + return FALSE; } else if (GatewayUsageMethod == TSC_PROXY_MODE_DEFAULT) { @@ -721,14 +725,18 @@ void freerdp_set_gateway_usage_method(rdpSettings* settings, UINT32 GatewayUsage * which means the client attempts to use gateway group policy settings * http://technet.microsoft.com/en-us/library/cc770601.aspx */ - freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, FALSE); - freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE); + if (!freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, FALSE) || + !freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE)) + return FALSE; } else if (GatewayUsageMethod == TSC_PROXY_MODE_NONE_DETECT) { - freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, FALSE); - freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE); + if (!freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, FALSE) || + !freerdp_set_param_bool(settings, FreeRDP_GatewayBypassLocal, FALSE)) + return FALSE; } + + return TRUE; } void freerdp_update_gateway_usage_method(rdpSettings* settings, UINT32 GatewayEnabled,