Merge pull request #5314 from akallabeth/setting_getter_setter_generator

Added python generator for freerdp_[g|s]et_param*
This commit is contained in:
Martin Fleisz 2019-05-09 14:23:31 +02:00 committed by GitHub
commit b8d931241e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 3730 additions and 2163 deletions

View File

@ -251,7 +251,8 @@ BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
printf(" %s connection.rdp /p:Pwd123! /f\n", name);
printf(" %s /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com\n", name);
printf(" %s /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489\n", name);
printf(" %s /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168.1.100\n", name);
printf(" %s /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168.1.100\n",
name);
printf("\n");
printf("Clipboard Redirection: +clipboard\n");
printf("\n");
@ -1165,7 +1166,6 @@ static int freerdp_detect_command_line_pre_filter(void* context, int index,
int argc, LPSTR* argv)
{
size_t length;
WINPR_UNUSED(context);
if (index == 1)
@ -1421,7 +1421,7 @@ static void activate_smartcard_logon_rdp(rdpSettings* settings)
{
settings->SmartcardLogon = TRUE;
/* TODO: why not? settings->UseRdpSecurityLayer = TRUE; */
freerdp_set_param_bool(settings, FreeRDP_PasswordIsSmartcardPin, TRUE);
freerdp_settings_set_bool(settings, FreeRDP_PasswordIsSmartcardPin, TRUE);
}
/**
@ -1547,7 +1547,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
CommandLineSwitchCase(arg, "v")
{
assert(arg->Value);
free(settings->ServerHostname);
settings->ServerHostname = NULL;
p = strchr(arg->Value, '[');
@ -1617,7 +1616,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
size_t count = 0;
char* cur = arg->Value;
assert(arg->Value);
settings->RedirectionPreferType = 0;
do
@ -1689,7 +1687,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
CommandLineSwitchCase(arg, "size")
{
assert(arg->Value);
p = strchr(arg->Value, 'x');
if (p)
@ -1968,7 +1965,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
{
assert(arg->Value);
p = strchr(arg->Value, ':');
if (p)
@ -2013,7 +2009,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
{
char* atPtr;
assert(arg->Value);
/* value is [scheme://][user:password@]hostname:port */
p = strstr(arg->Value, "://");
@ -2555,7 +2550,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
{
assert(arg->Value);
promptForPassword = (strncmp(arg->Value, "force", 6) == 0);
if (!promptForPassword)
@ -2593,7 +2587,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
CommandLineSwitchCase(arg, "tls-ciphers")
{
assert(arg->Value);
free(settings->AllowedTlsCiphers);
if (strcmp(arg->Value, "netmon") == 0)
@ -2754,7 +2747,6 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
CommandLineSwitchCase(arg, "codec-cache")
{
settings->BitmapCacheV3Enabled = TRUE;
assert(arg->Value);
if (strcmp(arg->Value, "rfx") == 0)
@ -2848,9 +2840,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
{
BYTE* base64 = NULL;
int length;
assert(arg->Value);
crypto_base64_decode((const char*)(arg->Value), (int) strlen(arg->Value),
&base64, &length);
@ -3080,7 +3070,7 @@ static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels,
{
PVIRTUALCHANNELENTRY entry = NULL;
PVIRTUALCHANNELENTRYEX entryEx = NULL;
entryEx = (PVIRTUALCHANNELENTRYEX) (void*)freerdp_load_channel_addin_entry(name, NULL, NULL,
entryEx = (PVIRTUALCHANNELENTRYEX)(void*)freerdp_load_channel_addin_entry(name, NULL, NULL,
FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
if (!entryEx)

272
client/common/file.c Executable file → Normal file
View File

@ -641,7 +641,6 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
int status = 0;
WCHAR* unicodestr = NULL;
size = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
buffer = (char*) calloc((size + 1), sizeof(char));
if (freerdp_client_write_rdp_file_buffer(file, buffer, size + 1) != size)
@ -658,6 +657,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
if (unicode)
{
int length;
if (size > INT_MAX)
{
free(buffer);
@ -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_settings_set_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_settings_set_string(settings, FreeRDP_Username, user))
return FALSE;
if (domain)
{
if (freerdp_set_param_string(settings, FreeRDP_Domain, domain) != 0)
if (!freerdp_settings_set_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_settings_set_string(settings, FreeRDP_Password, file->Password))
return FALSE;
}
@ -779,49 +779,77 @@ 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_settings_set_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_settings_set_uint32(settings, FreeRDP_ServerPort, (UINT32) port))
return FALSE;
}
}
if (~file->ServerPort)
freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->ServerPort);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, file->ServerPort))
return FALSE;
}
if (~file->DesktopWidth)
freerdp_set_param_uint32(settings, FreeRDP_DesktopWidth, file->DesktopWidth);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, file->DesktopWidth))
return FALSE;
}
if (~file->DesktopHeight)
freerdp_set_param_uint32(settings, FreeRDP_DesktopHeight, file->DesktopHeight);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, file->DesktopHeight))
return FALSE;
}
if (~file->SessionBpp)
freerdp_set_param_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp))
return FALSE;
}
if (~file->ConnectToConsole)
freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->ConnectToConsole);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_ConsoleSession, file->ConnectToConsole))
return FALSE;
}
if (~file->AdministrativeSession)
freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->AdministrativeSession);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_ConsoleSession, file->AdministrativeSession))
return FALSE;
}
if (~file->NegotiateSecurityLayer)
freerdp_set_param_bool(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_NegotiateSecurityLayer,
file->NegotiateSecurityLayer))
return FALSE;
}
if (~file->EnableCredSSPSupport)
freerdp_set_param_bool(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport);
{
if (!freerdp_settings_set_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_settings_set_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_settings_set_string(settings, FreeRDP_ShellWorkingDirectory,
file->ShellWorkingDirectory))
return FALSE;
}
@ -839,14 +867,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_settings_set_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_settings_set_bool(settings, FreeRDP_SmartSizing,
(file->SmartSizing == 1) ? TRUE : FALSE))
return FALSE;
}
if (~((size_t) file->LoadBalanceInfo))
@ -879,27 +909,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_settings_set_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_settings_set_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_settings_set_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_settings_set_bool(settings, FreeRDP_AudioPlayback, FALSE) ||
!freerdp_settings_set_bool(settings, FreeRDP_RemoteConsoleAudio, FALSE))
return FALSE;
}
}
if (~file->Compression)
freerdp_set_param_bool(settings, FreeRDP_CompressionEnabled, file->Compression);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_CompressionEnabled, file->Compression))
return FALSE;
}
if (~((size_t) file->GatewayHostname))
{
@ -909,124 +948,193 @@ 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_settings_set_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_settings_set_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_settings_set_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_settings_set_bool(settings, FreeRDP_GatewayUseSameCredentials,
file->PromptCredentialOnce))
return FALSE;
}
if (~file->RemoteApplicationMode)
freerdp_set_param_bool(settings, FreeRDP_RemoteApplicationMode, file->RemoteApplicationMode);
{
if (!freerdp_settings_set_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_settings_set_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_settings_set_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_settings_set_string(settings, FreeRDP_RemoteApplicationIcon,
file->RemoteApplicationIcon))
return FALSE;
}
if (~((size_t) file->RemoteApplicationFile))
{
if (freerdp_set_param_string(settings, FreeRDP_RemoteApplicationGuid,
file->RemoteApplicationGuid) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationGuid,
file->RemoteApplicationGuid))
return FALSE;
}
if (~((size_t) file->RemoteApplicationCmdLine))
{
if (freerdp_set_param_string(settings, FreeRDP_RemoteApplicationCmdLine,
file->RemoteApplicationCmdLine) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationCmdLine,
file->RemoteApplicationCmdLine))
return FALSE;
}
if (~file->SpanMonitors)
freerdp_set_param_bool(settings, FreeRDP_SpanMonitors, file->SpanMonitors);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_SpanMonitors, file->SpanMonitors))
return FALSE;
}
if (~file->UseMultiMon)
freerdp_set_param_bool(settings, FreeRDP_UseMultimon, file->UseMultiMon);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_UseMultimon, file->UseMultiMon))
return FALSE;
}
if (~file->AllowFontSmoothing)
freerdp_set_param_bool(settings, FreeRDP_AllowFontSmoothing, file->AllowFontSmoothing);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_AllowFontSmoothing, file->AllowFontSmoothing))
return FALSE;
}
if (~file->DisableWallpaper)
freerdp_set_param_bool(settings, FreeRDP_DisableWallpaper, file->DisableWallpaper);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_DisableWallpaper, file->DisableWallpaper))
return FALSE;
}
if (~file->DisableFullWindowDrag)
freerdp_set_param_bool(settings, FreeRDP_DisableFullWindowDrag, file->DisableFullWindowDrag);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_DisableFullWindowDrag,
file->DisableFullWindowDrag))
return FALSE;
}
if (~file->DisableMenuAnims)
freerdp_set_param_bool(settings, FreeRDP_DisableMenuAnims, file->DisableMenuAnims);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_DisableMenuAnims, file->DisableMenuAnims))
return FALSE;
}
if (~file->DisableThemes)
freerdp_set_param_bool(settings, FreeRDP_DisableThemes, file->DisableThemes);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_DisableThemes, file->DisableThemes))
return FALSE;
}
if (~file->AllowDesktopComposition)
freerdp_set_param_bool(settings, FreeRDP_AllowDesktopComposition, file->AllowDesktopComposition);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_AllowDesktopComposition,
file->AllowDesktopComposition))
return FALSE;
}
if (~file->BitmapCachePersistEnable)
freerdp_set_param_bool(settings, FreeRDP_BitmapCachePersistEnabled, file->BitmapCachePersistEnable);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_BitmapCachePersistEnabled,
file->BitmapCachePersistEnable))
return FALSE;
}
if (~file->DisableRemoteAppCapsCheck)
freerdp_set_param_bool(settings, FreeRDP_DisableRemoteAppCapsCheck,
file->DisableRemoteAppCapsCheck);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_DisableRemoteAppCapsCheck,
file->DisableRemoteAppCapsCheck))
return FALSE;
}
if (~file->AutoReconnectionEnabled)
freerdp_set_param_bool(settings, FreeRDP_AutoReconnectionEnabled, file->AutoReconnectionEnabled);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_AutoReconnectionEnabled,
file->AutoReconnectionEnabled))
return FALSE;
}
if (~file->AutoReconnectMaxRetries)
freerdp_set_param_uint32(settings, FreeRDP_AutoReconnectMaxRetries, file->AutoReconnectMaxRetries);
{
if (!freerdp_settings_set_uint32(settings, FreeRDP_AutoReconnectMaxRetries,
file->AutoReconnectMaxRetries))
return FALSE;
}
if (~file->RedirectSmartCards)
freerdp_set_param_bool(settings, FreeRDP_RedirectSmartCards, file->RedirectSmartCards);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSmartCards, file->RedirectSmartCards))
return FALSE;
}
if (~file->RedirectClipboard)
freerdp_set_param_bool(settings, FreeRDP_RedirectClipboard, file->RedirectClipboard);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectClipboard, file->RedirectClipboard))
return FALSE;
}
if (~file->RedirectPrinters)
freerdp_set_param_bool(settings, FreeRDP_RedirectPrinters, file->RedirectPrinters);
{
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectPrinters, file->RedirectPrinters))
return FALSE;
}
if (~file->RedirectDrives)
freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, file->RedirectDrives);
{
if (!freerdp_settings_set_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_settings_set_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts) ||
!freerdp_settings_set_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_settings_set_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts) ||
!freerdp_settings_set_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts))
return FALSE;
}
if (~file->RedirectDirectX)
@ -1060,7 +1168,8 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
* devicestoredirect:s:USB\VID_04A9&PID_30C1\6&4BD985D&0&2;,DynamicDevices
*
*/
freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, TRUE);
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectDrives, TRUE))
return FALSE;
}
if (~((size_t) file->DrivesToRedirect))
@ -1072,19 +1181,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_settings_set_bool(settings, FreeRDP_RedirectDrives, !empty))
return FALSE;
}
if (~file->KeyboardHook)
{
freerdp_set_param_uint32(settings, FreeRDP_KeyboardHook, file->KeyboardHook);
if (!freerdp_settings_set_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_settings_set_string(settings, FreeRDP_PreconnectionBlob, file->PreconnectionBlob) ||
!freerdp_settings_set_bool(settings, FreeRDP_SendPreconnectionPdu, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_VmConnectMode, TRUE))
return FALSE;
}
if (file->argc > 1)
@ -1107,7 +1220,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 +1242,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 +1249,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 +1297,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 +1310,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 +1356,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 +1369,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 +1414,6 @@ rdpFile* freerdp_client_rdp_file_new()
return file;
}
void freerdp_client_rdp_file_free(rdpFile* file)
{
int i;

View File

@ -1040,7 +1040,7 @@ struct rdp_settings
UINT64 padding0896[896 - 837]; /* 837 */
/* Client Info (Time Zone) */
ALIGN64 LPTIME_ZONE_INFORMATION ClientTimeZone; /* 896 */
ALIGN64 TIME_ZONE_INFORMATION* ClientTimeZone; /* 896 */
ALIGN64 char* DynamicDSTTimeZoneKeyName; /* 897 */
ALIGN64 BOOL DynamicDaylightTimeDisabled; /* 898 */
UINT64 padding0960[960 - 899]; /* 899 */
@ -1175,8 +1175,8 @@ struct rdp_settings
ALIGN64 char* WmClass; /* 1549 */
ALIGN64 BOOL EmbeddedWindow; /* 1550 */
ALIGN64 BOOL SmartSizing; /* 1551 */
ALIGN64 int XPan; /* 1552 */
ALIGN64 int YPan; /* 1553 */
ALIGN64 INT32 XPan; /* 1552 */
ALIGN64 INT32 YPan; /* 1553 */
ALIGN64 UINT32 SmartSizingWidth; /* 1554 */
ALIGN64 UINT32 SmartSizingHeight; /* 1555 */
ALIGN64 BOOL PercentScreenUseWidth; /* 1556 */
@ -1531,7 +1531,7 @@ struct rdp_settings
*/
/* Extensions */
ALIGN64 int num_extensions; /* */
ALIGN64 INT32 num_extensions; /* */
ALIGN64 struct rdp_ext_set extensions[16]; /* */
ALIGN64 BYTE*
@ -1584,10 +1584,14 @@ 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);
/* DEPRECATED:
* the functions freerdp_get_param_* and freerdp_set_param_* are deprecated.
* use freerdp_settings_get_* and freerdp_settings_set_* as a replacement!
*/
FREERDP_API BOOL freerdp_get_param_bool(rdpSettings* settings, int id);
FREERDP_API int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param);
@ -1603,6 +1607,32 @@ FREERDP_API int freerdp_set_param_uint64(rdpSettings* settings, int id, UINT64 p
FREERDP_API char* freerdp_get_param_string(rdpSettings* settings, int id);
FREERDP_API int freerdp_set_param_string(rdpSettings* settings, int id, const char* param);
FREERDP_API BOOL freerdp_settings_get_bool(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL param);
FREERDP_API INT16 freerdp_settings_get_int16(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_int16(rdpSettings* settings, size_t id, INT16 param);
FREERDP_API UINT16 freerdp_settings_get_uint16(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_uint16(rdpSettings* settings, size_t id, UINT16 param);
FREERDP_API INT32 freerdp_settings_get_int32(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_int32(rdpSettings* settings, size_t id, INT32 param);
FREERDP_API UINT32 freerdp_settings_get_uint32(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_uint32(rdpSettings* settings, size_t id, UINT32 param);
FREERDP_API INT64 freerdp_settings_get_int64(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_int64(rdpSettings* settings, size_t id, INT64 param);
FREERDP_API UINT64 freerdp_settings_get_uint64(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_uint64(rdpSettings* settings, size_t id, UINT64 param);
FREERDP_API const char* freerdp_settings_get_string(rdpSettings* settings, size_t id);
FREERDP_API BOOL freerdp_settings_set_string(rdpSettings* settings, size_t id, const char* param);
FREERDP_API const void* freerdp_settings_get_pointer(rdpSettings* settings, size_t id);
#ifdef __cplusplus
}
#endif

View File

@ -21,6 +21,7 @@ set(MODULE_PREFIX "FREERDP_COMMON")
set(${MODULE_PREFIX}_SRCS
addin.c
settings.c
settings_getters.c
assistance.c)
freerdp_module_add(${${MODULE_PREFIX}_SRCS})

View File

@ -1155,49 +1155,54 @@ BOOL freerdp_assistance_populate_settings_from_assistance_file(rdpAssistanceFile
rdpSettings* settings)
{
UINT32 i;
freerdp_set_param_bool(settings, FreeRDP_RemoteAssistanceMode, TRUE);
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteAssistanceMode, TRUE))
return FALSE;
if (!file->RASessionId || !file->MachineAddresses)
return FALSE;
if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceSessionId, file->RASessionId) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistanceSessionId, file->RASessionId))
return FALSE;
if (file->RCTicket)
{
if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceRCTicket, file->RCTicket) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistanceRCTicket, file->RCTicket))
return FALSE;
}
else
{
if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistanceRCTicket,
file->ConnectionString2) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistanceRCTicket,
file->ConnectionString2))
return FALSE;
}
if (file->PassStub)
{
if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistancePassStub, file->PassStub) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistancePassStub, file->PassStub))
return FALSE;
}
if (freerdp_set_param_string(settings, FreeRDP_ServerHostname, file->MachineAddresses[0]) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, file->MachineAddresses[0]))
return FALSE;
if (freerdp_set_param_string(settings, FreeRDP_AssistanceFile, file->filename) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_AssistanceFile, file->filename))
return FALSE;
if (freerdp_set_param_string(settings, FreeRDP_RemoteAssistancePassword, file->password) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteAssistancePassword, file->password))
return FALSE;
if (file->Username)
{
if (freerdp_set_param_string(settings, FreeRDP_Username, file->Username) != 0)
if (!freerdp_settings_set_string(settings, FreeRDP_Username, file->Username))
return FALSE;
}
settings->RemoteAssistanceMode = TRUE;
freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->MachinePorts[0]);
if (!freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, file->MachinePorts[0]))
return FALSE;
freerdp_target_net_addresses_free(settings);
settings->TargetNetAddressCount = file->MachineCount;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -569,27 +569,35 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_LICENSING:
{
LicenseCallbackResult res;
if (!client->LicenseCallback)
{
WLog_ERR(TAG, "peer_recv_callback: LicenseCallback has been removed, assuming licensing is ok (please fix your app)");
WLog_ERR(TAG,
"peer_recv_callback: LicenseCallback has been removed, assuming licensing is ok (please fix your app)");
res = LICENSE_CB_COMPLETED;
}
else
res = client->LicenseCallback(client, s);
switch(res) {
switch (res)
{
case LICENSE_CB_INTERNAL_ERROR:
WLog_ERR(TAG, "peer_recv_callback: CONNECTION_STATE_LICENSING - callback internal error, aborting");
return -1;
case LICENSE_CB_ABORT:
return -1;
case LICENSE_CB_IN_PROGRESS:
break;
case LICENSE_CB_COMPLETED:
rdp_server_transition_to_state(rdp, CONNECTION_STATE_CAPABILITIES_EXCHANGE);
return peer_recv_callback(transport, NULL, extra);
default:
WLog_ERR(TAG, "peer_recv_callback: CONNECTION_STATE_LICENSING - unknown license callback result %d", (int)res);
WLog_ERR(TAG, "peer_recv_callback: CONNECTION_STATE_LICENSING - unknown license callback result %d",
(int)res);
break;
}
@ -680,7 +688,7 @@ static BOOL freerdp_peer_close(freerdp_peer* client)
if (!rdp_send_deactivate_all(client->context->rdp))
return FALSE;
if (freerdp_get_param_bool(client->settings, FreeRDP_SupportErrorInfoPdu))
if (freerdp_settings_get_bool(client->settings, FreeRDP_SupportErrorInfoPdu))
{
rdp_send_error_info(client->context->rdp);
}
@ -717,9 +725,9 @@ static BOOL freerdp_peer_has_more_to_read(freerdp_peer* peer)
return peer->context->rdp->transport->haveMoreBytesToRead;
}
static LicenseCallbackResult freerdp_peer_nolicense(freerdp_peer* peer, wStream *s)
static LicenseCallbackResult freerdp_peer_nolicense(freerdp_peer* peer, wStream* s)
{
rdpRdp *rdp = peer->context->rdp;
rdpRdp* rdp = peer->context->rdp;
if (!license_send_valid_client_error_packet(rdp))
{

View File

@ -1,7 +1,10 @@
#include <freerdp/settings.h>
#include "settings_property_lists.h"
int TestSettings(int argc, char* argv[])
{
int rc = -1;
size_t x;
rdpSettings* settings = NULL;
rdpSettings* cloned;
WINPR_UNUSED(argc);
@ -25,8 +28,121 @@ int TestSettings(int argc, char* argv[])
return -1;
}
#if defined(have_bool_list_indices)
for (x = 0; x < ARRAYSIZE(bool_list_indices); x++)
{
const size_t key = bool_list_indices[x];
const BOOL val = freerdp_settings_get_bool(settings, key);
if (!freerdp_settings_set_bool(settings, key, val))
goto fail;
}
#endif
#if defined(have_int16_list_indices)
for (x = 0; x < ARRAYSIZE(int16_list_indices); x++)
{
const size_t key = int16_list_indices[x];
const INT16 val = freerdp_settings_get_int16(settings, key);
if (!freerdp_settings_set_int16(settings, key, val))
goto fail;
}
#endif
#if defined(have_uint16_list_indices)
for (x = 0; x < ARRAYSIZE(uint16_list_indices); x++)
{
const size_t key = uint16_list_indices[x];
const UINT16 val = freerdp_settings_get_uint16(settings, key);
if (!freerdp_settings_set_uint16(settings, key, val))
goto fail;
}
#endif
#if defined(have_uint32_list_indices)
for (x = 0; x < ARRAYSIZE(uint32_list_indices); x++)
{
const size_t key = uint32_list_indices[x];
const UINT32 val = freerdp_settings_get_uint32(settings, key);
if (!freerdp_settings_set_uint32(settings, key, val))
goto fail;
}
#endif
#if defined(have_int32_list_indices)
for (x = 0; x < ARRAYSIZE(int32_list_indices); x++)
{
const size_t key = int32_list_indices[x];
const INT32 val = freerdp_settings_get_int32(settings, key);
if (!freerdp_settings_set_int32(settings, key, val))
goto fail;
}
#endif
#if defined(have_uint64_list_indices)
for (x = 0; x < ARRAYSIZE(uint64_list_indices); x++)
{
const size_t key = uint64_list_indices[x];
const UINT64 val = freerdp_settings_get_uint64(settings, key);
if (!freerdp_settings_set_uint64(settings, key, val))
goto fail;
}
#endif
#if defined(have_int64_list_indices)
for (x = 0; x < ARRAYSIZE(int64_list_indices); x++)
{
const size_t key = int64_list_indices[x];
const INT64 val = freerdp_settings_get_int64(settings, key);
if (!freerdp_settings_set_int64(settings, key, val))
goto fail;
}
#endif
#if defined(have_string_list_indices)
for (x = 0; x < ARRAYSIZE(string_list_indices); x++)
{
const size_t key = string_list_indices[x];
const char val[] = "test-string";
const char* res;
if (!freerdp_settings_set_string(settings, key, val))
goto fail;
res = freerdp_settings_get_string(settings, key);
if (strncmp(val, res, sizeof(val)) != 0)
goto fail;
}
#endif
#if defined(have_pointer_list_indices)
for (x = 0; x < ARRAYSIZE(pointer_list_indices); x++)
{
const size_t key = pointer_list_indices[x];
const void* val = freerdp_settings_get_pointer(settings, key);
}
#endif
rc = 0;
fail:
freerdp_settings_free(cloned);
freerdp_settings_free(settings);
return 0;
return rc;
}

View File

@ -0,0 +1,399 @@
#ifndef TEST_SETTINGS_PROPERTY_LISTS
#define TEST_SETTINGS_PROPERTY_LISTS
#define have_bool_list_indices
static const size_t bool_list_indices[] =
{
FreeRDP_ServerMode,
FreeRDP_WaitForOutputBufferFlush,
FreeRDP_NetworkAutoDetect,
FreeRDP_SupportAsymetricKeys,
FreeRDP_SupportErrorInfoPdu,
FreeRDP_SupportStatusInfoPdu,
FreeRDP_SupportMonitorLayoutPdu,
FreeRDP_SupportGraphicsPipeline,
FreeRDP_SupportDynamicTimeZone,
FreeRDP_SupportHeartbeatPdu,
FreeRDP_UseRdpSecurityLayer,
FreeRDP_ConsoleSession,
FreeRDP_SpanMonitors,
FreeRDP_UseMultimon,
FreeRDP_ForceMultimon,
FreeRDP_ListMonitors,
FreeRDP_HasMonitorAttributes,
FreeRDP_SupportMultitransport,
FreeRDP_AutoLogonEnabled,
FreeRDP_CompressionEnabled,
FreeRDP_DisableCtrlAltDel,
FreeRDP_EnableWindowsKey,
FreeRDP_MaximizeShell,
FreeRDP_LogonNotify,
FreeRDP_LogonErrors,
FreeRDP_MouseAttached,
FreeRDP_MouseHasWheel,
FreeRDP_RemoteConsoleAudio,
FreeRDP_AudioPlayback,
FreeRDP_AudioCapture,
FreeRDP_VideoDisable,
FreeRDP_PasswordIsSmartcardPin,
FreeRDP_UsingSavedCredentials,
FreeRDP_ForceEncryptedCsPdu,
FreeRDP_HiDefRemoteApp,
FreeRDP_IPv6Enabled,
FreeRDP_AutoReconnectionEnabled,
FreeRDP_PrintReconnectCookie,
FreeRDP_DynamicDaylightTimeDisabled,
FreeRDP_AllowFontSmoothing,
FreeRDP_DisableWallpaper,
FreeRDP_DisableFullWindowDrag,
FreeRDP_DisableMenuAnims,
FreeRDP_DisableThemes,
FreeRDP_DisableCursorShadow,
FreeRDP_DisableCursorBlinking,
FreeRDP_AllowDesktopComposition,
FreeRDP_RemoteAssistanceMode,
FreeRDP_EncomspVirtualChannel,
FreeRDP_RemdeskVirtualChannel,
FreeRDP_LyncRdpMode,
FreeRDP_TlsSecurity,
FreeRDP_NlaSecurity,
FreeRDP_RdpSecurity,
FreeRDP_ExtSecurity,
FreeRDP_Authentication,
FreeRDP_NegotiateSecurityLayer,
FreeRDP_RestrictedAdminModeRequired,
FreeRDP_DisableCredentialsDelegation,
FreeRDP_VmConnectMode,
FreeRDP_FIPSMode,
FreeRDP_MstscCookieMode,
FreeRDP_SendPreconnectionPdu,
FreeRDP_SmartcardLogon,
FreeRDP_IgnoreCertificate,
FreeRDP_ExternalCertificateManagement,
FreeRDP_AutoAcceptCertificate,
FreeRDP_AutoDenyCertificate,
FreeRDP_Workarea,
FreeRDP_Fullscreen,
FreeRDP_GrabKeyboard,
FreeRDP_Decorations,
FreeRDP_MouseMotion,
FreeRDP_AsyncInput,
FreeRDP_AsyncUpdate,
FreeRDP_AsyncChannels,
FreeRDP_ToggleFullscreen,
FreeRDP_EmbeddedWindow,
FreeRDP_SmartSizing,
FreeRDP_PercentScreenUseWidth,
FreeRDP_PercentScreenUseHeight,
FreeRDP_DynamicResolutionUpdate,
FreeRDP_SoftwareGdi,
FreeRDP_LocalConnection,
FreeRDP_AuthenticationOnly,
FreeRDP_CredentialsFromStdin,
FreeRDP_UnmapButtons,
FreeRDP_OldLicenseBehaviour,
FreeRDP_DumpRemoteFx,
FreeRDP_PlayRemoteFx,
FreeRDP_GatewayUseSameCredentials,
FreeRDP_GatewayEnabled,
FreeRDP_GatewayBypassLocal,
FreeRDP_GatewayRpcTransport,
FreeRDP_GatewayHttpTransport,
FreeRDP_GatewayUdpTransport,
FreeRDP_RemoteApplicationMode,
FreeRDP_DisableRemoteAppCapsCheck,
FreeRDP_RemoteAppLanguageBarSupported,
FreeRDP_RefreshRect,
FreeRDP_SuppressOutput,
FreeRDP_FastPathOutput,
FreeRDP_SaltedChecksum,
FreeRDP_LongCredentialsSupported,
FreeRDP_NoBitmapCompressionHeader,
FreeRDP_BitmapCompressionDisabled,
FreeRDP_DesktopResize,
FreeRDP_DrawAllowDynamicColorFidelity,
FreeRDP_DrawAllowColorSubsampling,
FreeRDP_DrawAllowSkipAlpha,
FreeRDP_BitmapCacheV3Enabled,
FreeRDP_AltSecFrameMarkerSupport,
FreeRDP_AllowUnanouncedOrdersFromServer,
FreeRDP_BitmapCacheEnabled,
FreeRDP_AllowCacheWaitingList,
FreeRDP_BitmapCachePersistEnabled,
FreeRDP_ColorPointerFlag,
FreeRDP_UnicodeInput,
FreeRDP_FastPathInput,
FreeRDP_MultiTouchInput,
FreeRDP_MultiTouchGestures,
FreeRDP_HasHorizontalWheel,
FreeRDP_HasExtendedMouseEvent,
FreeRDP_SoundBeepsEnabled,
FreeRDP_SurfaceCommandsEnabled,
FreeRDP_FrameMarkerCommandEnabled,
FreeRDP_SurfaceFrameMarkerEnabled,
FreeRDP_RemoteFxOnly,
FreeRDP_RemoteFxCodec,
FreeRDP_RemoteFxImageCodec,
FreeRDP_NSCodec,
FreeRDP_NSCodecAllowSubsampling,
FreeRDP_NSCodecAllowDynamicColorFidelity,
FreeRDP_JpegCodec,
FreeRDP_GfxThinClient,
FreeRDP_GfxSmallCache,
FreeRDP_GfxProgressive,
FreeRDP_GfxProgressiveV2,
FreeRDP_GfxH264,
FreeRDP_GfxAVC444,
FreeRDP_GfxSendQoeAck,
FreeRDP_GfxAVC444v2,
FreeRDP_DrawNineGridEnabled,
FreeRDP_DrawGdiPlusEnabled,
FreeRDP_DrawGdiPlusCacheEnabled,
FreeRDP_DeviceRedirection,
FreeRDP_RedirectDrives,
FreeRDP_RedirectHomeDrive,
FreeRDP_RedirectSmartCards,
FreeRDP_RedirectPrinters,
FreeRDP_RedirectSerialPorts,
FreeRDP_RedirectParallelPorts,
FreeRDP_PreferIPv6OverIPv4,
FreeRDP_RedirectClipboard,
FreeRDP_SupportDynamicChannels,
FreeRDP_SupportEchoChannel,
FreeRDP_SupportDisplayControl,
FreeRDP_SupportGeometryTracking,
FreeRDP_SupportSSHAgentChannel,
FreeRDP_SupportVideoOptimized,
};
#define have_uint16_list_indices
static const size_t uint16_list_indices[] =
{
FreeRDP_DesktopOrientation,
FreeRDP_ProxyPort,
};
#define have_uint32_list_indices
static const size_t uint32_list_indices[] =
{
FreeRDP_ShareId,
FreeRDP_PduSource,
FreeRDP_ServerPort,
FreeRDP_MaxTimeInCheckLoop,
FreeRDP_AcceptedCertLength,
FreeRDP_RdpVersion,
FreeRDP_DesktopWidth,
FreeRDP_DesktopHeight,
FreeRDP_ColorDepth,
FreeRDP_ConnectionType,
FreeRDP_ClientBuild,
FreeRDP_EarlyCapabilityFlags,
FreeRDP_DesktopPhysicalWidth,
FreeRDP_DesktopPhysicalHeight,
FreeRDP_DesktopScaleFactor,
FreeRDP_DeviceScaleFactor,
FreeRDP_EncryptionMethods,
FreeRDP_ExtEncryptionMethods,
FreeRDP_EncryptionLevel,
FreeRDP_ServerRandomLength,
FreeRDP_ServerCertificateLength,
FreeRDP_ClientRandomLength,
FreeRDP_ChannelCount,
FreeRDP_ChannelDefArraySize,
FreeRDP_ClusterInfoFlags,
FreeRDP_RedirectedSessionId,
FreeRDP_MonitorCount,
FreeRDP_MonitorDefArraySize,
FreeRDP_DesktopPosX,
FreeRDP_DesktopPosY,
FreeRDP_NumMonitorIds,
FreeRDP_MonitorLocalShiftX,
FreeRDP_MonitorLocalShiftY,
FreeRDP_MultitransportFlags,
FreeRDP_CompressionLevel,
FreeRDP_AutoReconnectMaxRetries,
FreeRDP_PerformanceFlags,
FreeRDP_RequestedProtocols,
FreeRDP_SelectedProtocol,
FreeRDP_NegotiationFlags,
FreeRDP_AuthenticationLevel,
FreeRDP_TlsSecLevel,
FreeRDP_CookieMaxLength,
FreeRDP_PreconnectionId,
FreeRDP_RedirectionFlags,
FreeRDP_LoadBalanceInfoLength,
FreeRDP_RedirectionPasswordLength,
FreeRDP_RedirectionTsvUrlLength,
FreeRDP_TargetNetAddressCount,
FreeRDP_RedirectionAcceptedCertLength,
FreeRDP_RedirectionPreferType,
FreeRDP_Password51Length,
FreeRDP_PercentScreen,
FreeRDP_SmartSizingWidth,
FreeRDP_SmartSizingHeight,
FreeRDP_GatewayUsageMethod,
FreeRDP_GatewayPort,
FreeRDP_GatewayCredentialsSource,
FreeRDP_GatewayAcceptedCertLength,
FreeRDP_ProxyType,
FreeRDP_RemoteApplicationExpandCmdLine,
FreeRDP_RemoteApplicationExpandWorkingDir,
FreeRDP_RemoteAppNumIconCaches,
FreeRDP_RemoteAppNumIconCacheEntries,
FreeRDP_RemoteWndSupportLevel,
FreeRDP_RemoteApplicationSupportLevel,
FreeRDP_ReceivedCapabilitiesSize,
FreeRDP_OsMajorType,
FreeRDP_OsMinorType,
FreeRDP_BitmapCacheVersion,
FreeRDP_BitmapCacheV2NumCells,
FreeRDP_PointerCacheSize,
FreeRDP_KeyboardLayout,
FreeRDP_KeyboardType,
FreeRDP_KeyboardSubType,
FreeRDP_KeyboardFunctionKey,
FreeRDP_KeyboardHook,
FreeRDP_BrushSupportLevel,
FreeRDP_GlyphSupportLevel,
FreeRDP_OffscreenSupportLevel,
FreeRDP_OffscreenCacheSize,
FreeRDP_OffscreenCacheEntries,
FreeRDP_VirtualChannelCompressionFlags,
FreeRDP_VirtualChannelChunkSize,
FreeRDP_MultifragMaxRequestSize,
FreeRDP_LargePointerFlag,
FreeRDP_CompDeskSupportLevel,
FreeRDP_RemoteFxCodecId,
FreeRDP_RemoteFxCodecMode,
FreeRDP_RemoteFxCaptureFlags,
FreeRDP_NSCodecId,
FreeRDP_FrameAcknowledge,
FreeRDP_NSCodecColorLossLevel,
FreeRDP_JpegCodecId,
FreeRDP_JpegQuality,
FreeRDP_GfxCapsFilter,
FreeRDP_BitmapCacheV3CodecId,
FreeRDP_DrawNineGridCacheSize,
FreeRDP_DrawNineGridCacheEntries,
FreeRDP_DeviceCount,
FreeRDP_DeviceArraySize,
FreeRDP_StaticChannelCount,
FreeRDP_StaticChannelArraySize,
FreeRDP_DynamicChannelCount,
FreeRDP_DynamicChannelArraySize,
};
#define have_int32_list_indices
static const size_t int32_list_indices[] =
{
FreeRDP_XPan,
FreeRDP_YPan,
};
#define have_uint64_list_indices
static const size_t uint64_list_indices[] =
{
FreeRDP_ParentWindowId,
};
#define have_string_list_indices
static const size_t string_list_indices[] =
{
FreeRDP_ServerHostname,
FreeRDP_Username,
FreeRDP_Password,
FreeRDP_Domain,
FreeRDP_PasswordHash,
FreeRDP_AcceptedCert,
FreeRDP_ClientHostname,
FreeRDP_ClientProductId,
FreeRDP_AlternateShell,
FreeRDP_ShellWorkingDirectory,
FreeRDP_ClientAddress,
FreeRDP_ClientDir,
FreeRDP_DynamicDSTTimeZoneKeyName,
FreeRDP_RemoteAssistanceSessionId,
FreeRDP_RemoteAssistancePassStub,
FreeRDP_RemoteAssistancePassword,
FreeRDP_RemoteAssistanceRCTicket,
FreeRDP_AuthenticationServiceClass,
FreeRDP_AllowedTlsCiphers,
FreeRDP_NtlmSamFile,
FreeRDP_PreconnectionBlob,
FreeRDP_TargetNetAddress,
FreeRDP_RedirectionUsername,
FreeRDP_RedirectionDomain,
FreeRDP_RedirectionTargetFQDN,
FreeRDP_RedirectionTargetNetBiosName,
FreeRDP_RedirectionAcceptedCert,
FreeRDP_KerberosKdc,
FreeRDP_KerberosRealm,
FreeRDP_CertificateName,
FreeRDP_CertificateFile,
FreeRDP_PrivateKeyFile,
FreeRDP_RdpKeyFile,
FreeRDP_CertificateContent,
FreeRDP_PrivateKeyContent,
FreeRDP_RdpKeyContent,
FreeRDP_WindowTitle,
FreeRDP_WmClass,
FreeRDP_ComputerName,
FreeRDP_ConnectionFile,
FreeRDP_AssistanceFile,
FreeRDP_HomePath,
FreeRDP_ConfigPath,
FreeRDP_CurrentPath,
FreeRDP_DumpRemoteFxFile,
FreeRDP_PlayRemoteFxFile,
FreeRDP_GatewayHostname,
FreeRDP_GatewayUsername,
FreeRDP_GatewayPassword,
FreeRDP_GatewayDomain,
FreeRDP_GatewayAccessToken,
FreeRDP_GatewayAcceptedCert,
FreeRDP_ProxyHostname,
FreeRDP_ProxyUsername,
FreeRDP_ProxyPassword,
FreeRDP_RemoteApplicationName,
FreeRDP_RemoteApplicationIcon,
FreeRDP_RemoteApplicationProgram,
FreeRDP_RemoteApplicationFile,
FreeRDP_RemoteApplicationGuid,
FreeRDP_RemoteApplicationCmdLine,
FreeRDP_ImeFileName,
FreeRDP_DrivesToRedirect,
};
#define have_pointer_list_indices
static const size_t pointer_list_indices[] =
{
FreeRDP_StaticChannelArray,
FreeRDP_DynamicChannelArray,
FreeRDP_instance,
FreeRDP_RdpServerCertificate,
FreeRDP_MonitorIds,
FreeRDP_TargetNetPorts,
FreeRDP_DeviceArray,
FreeRDP_ClientAutoReconnectCookie,
FreeRDP_TargetNetAddresses,
FreeRDP_MonitorDefArray,
FreeRDP_BitmapCacheV2CellInfo,
FreeRDP_ServerAutoReconnectCookie,
FreeRDP_ServerRandom,
FreeRDP_ServerCertificate,
FreeRDP_ClientRandom,
FreeRDP_LoadBalanceInfo,
FreeRDP_RedirectionPassword,
FreeRDP_RedirectionTsvUrl,
FreeRDP_Password51,
FreeRDP_ReceivedCapabilities,
FreeRDP_OrderSupport,
FreeRDP_RdpServerRsaKey,
FreeRDP_GlyphCache,
FreeRDP_FragCache,
FreeRDP_ClientTimeZone,
FreeRDP_ChannelDefArray,
};
#endif /* TEST_SETTINGS_PROPERTY_LISTS */

187
scripts/update-settings-tests Executable file
View File

@ -0,0 +1,187 @@
#!/usr/bin/env python
import os
import sys
def get_values(entry_dict, entry_type):
values = []
if '*' == entry_type:
for key in entry_dict.keys():
if entry_type in key:
values += entry_dict[key]
entry_dict.pop(key, None)
elif entry_type in entry_dict:
values = entry_dict[entry_type]
entry_dict.pop(entry_type, None)
return values
def write_entry(f, entry_dict, entry_type, entry_name):
values = get_values(entry_dict, entry_type)
if not values:
return
f.write('#define have_' + entry_name.lower() + '_list_indices\n')
f.write('static const size_t ' + entry_name.lower() + '_list_indices[] =\n')
f.write('{\n')
for val in values:
f.write('\tFreeRDP_' + val + ',\n')
f.write('};\n\n')
def write_getter_case(f, val):
f.write('\t\tcase FreeRDP_' + val + ':\n')
f.write('\t\t\treturn settings->' + val + ';\n\n')
def write_getter(f, entry_dict, entry_type, entry_name):
isString = 'string' in entry_name
isPointer = 'pointer' in entry_name
values = get_values(entry_dict, entry_type)
if isPointer:
f.write('const void*')
elif isString:
f.write('const ' + entry_type)
else:
f.write(entry_type)
f.write(' freerdp_settings_get_' + entry_name.lower() + '(rdpSettings* settings, size_t id)\n')
f.write('{\n')
f.write('\tif (!settings)\n')
f.write('\t\treturn FALSE;\n\n')
f.write('\tswitch (id)\n')
f.write('\t{\n')
if values:
for val in values:
write_getter_case(f, val)
f.write('\t\tdefault:\n')
f.write('\t\t\tWLog_ERR(TAG, "[%s] Invalid key index %"PRIuz, __FUNCTION__, id);\n')
f.write('\t\t\treturn FALSE;\n')
f.write('\t}\n')
f.write('}\n\n')
def write_setter_case(f, val, isString, isPointer):
f.write('\t\tcase FreeRDP_' + val + ':\n')
if not isString:
f.write('\t\t\tsettings->' + val + ' = val;\n')
f.write('\t\t\tbreak;\n\n')
else:
f.write('\t\t\tfree(settings->' + val + ');\n')
f.write('\t\t\tsettings->' + val + ' = _strdup(val);\n')
f.write('\t\t\treturn settings->' + val + ' != NULL;\n\n')
def write_setter(f, entry_dict, entry_type, entry_name):
isString = 'string' in entry_name
isPointer = 'pointer' in entry_name
values = get_values(entry_dict, entry_type)
f.write('BOOL freerdp_settings_set_' + entry_name.lower() + '(rdpSettings* settings, size_t id, ')
if isString or isPointer:
f.write('const ')
if not isPointer:
f.write(entry_type + ' val)\n')
else:
f.write('void* val)\n')
f.write('{\n')
f.write('\tif (!settings)\n')
f.write('\t\treturn FALSE;\n\n')
f.write('\tswitch (id)\n')
f.write('\t{\n')
if values:
for val in values:
write_setter_case(f, val, isString, isPointer)
f.write('\t\tdefault:\n')
f.write('\t\t\tWLog_ERR(TAG, "[%s] Invalid key index %"PRIuz, __FUNCTION__, id);\n')
f.write('\t\t\treturn FALSE;\n')
f.write('\t}\n')
f.write('\treturn TRUE;\n')
f.write('}\n\n')
name = os.path.dirname(os.path.realpath(__file__))
begin = "WARNING: this data structure is carefully padded for ABI stability!"
end = "WARNING: End of ABI stable zone!"
print('begin parsing settings header')
try:
type_list = dict()
with open(name + "/../include/freerdp/settings.h", "rb") as f:
lines = f.readlines()
started = False
for line in lines:
if not started:
if begin in line:
started = True
continue
if end in line:
break
sline = line.strip()
if not sline:
continue
if sline.startswith('/'):
continue
if sline.startswith('*'):
continue
if 'padding' in sline:
continue
if sline.startswith('ALIGN64'):
sline = sline[7:].strip()
sline = sline[:sline.find(';')]
pair = sline.split()
if pair[0] in type_list:
type_list[pair[0]].append(pair[1])
else:
type_list[pair[0]] = [pair[1]]
with open(name + '/../libfreerdp/common/settings_getters.c', 'w+') as f:
f.write('/* Generated by ' + '' + ' */\n\n')
f.write('#include <freerdp/settings.h>\n')
f.write('#include <freerdp/log.h>\n\n')
f.write('#define TAG FREERDP_TAG("common.settings")\n\n')
getter_list = dict(type_list)
setter_list = dict(type_list)
write_getter(f, getter_list, 'BOOL', 'bool')
write_setter(f, setter_list, 'BOOL', 'bool')
write_getter(f, getter_list, 'UINT16', 'uint16')
write_setter(f, setter_list, 'UINT16', 'uint16')
write_getter(f, getter_list, 'INT16', 'int16')
write_setter(f, setter_list, 'INT16', 'int16')
write_getter(f, getter_list, 'UINT32', 'uint32')
write_setter(f, setter_list, 'UINT32', 'uint32')
write_getter(f, getter_list, 'INT32', 'int32')
write_setter(f, setter_list, 'INT32', 'int32')
write_getter(f, getter_list, 'UINT64', 'uint64')
write_setter(f, setter_list, 'UINT64', 'uint64')
write_getter(f, getter_list, 'INT64', 'int64')
write_setter(f, setter_list, 'INT64', 'int64')
write_getter(f, getter_list, 'char*', 'string')
write_setter(f, setter_list, 'char*', 'string')
write_getter(f, getter_list, '*', 'pointer')
# write_setter(f, setter_list, '*', 'pointer')
f.write('\n')
with open(name + '/../libfreerdp/core/test/settings_property_lists.h', 'w+') as f:
f.write('#ifndef TEST_SETTINGS_PROPERTY_LISTS\n')
f.write('#define TEST_SETTINGS_PROPERTY_LISTS\n\n')
write_entry(f, type_list, 'BOOL', 'bool')
write_entry(f, type_list, 'UINT16', 'uint16')
write_entry(f, type_list, 'INT16', 'int16')
write_entry(f, type_list, 'UINT32', 'uint32')
write_entry(f, type_list, 'INT32', 'int32')
write_entry(f, type_list, 'UINT64', 'uint64')
write_entry(f, type_list, 'INT64', 'int64')
write_entry(f, type_list, 'char*', 'string')
write_entry(f, type_list, '*', 'pointer')
f.write('#endif /* TEST_SETTINGS_PROPERTY_LISTS */\n\n')
print('remaining:\n' + str(type_list))
except IOError as e:
print('failed to parse settings header ' + str(e))
sys.exit(-1)
print('ended parsing settings header')

View File

@ -343,7 +343,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "sam-file")
{
freerdp_set_param_string(settings, FreeRDP_NtlmSamFile, arg->Value);
freerdp_settings_set_string(settings, FreeRDP_NtlmSamFile, arg->Value);
}
CommandLineSwitchDefault(arg)
{