GUI-FreeRDP/arguments.c

67 lines
2.2 KiB
C
Raw Normal View History

/*
* arguments.c
*
* Created on: 6 июл. 2022 г.
* Author: alexander
*/
#include <stdlib.h>
#include "arguments.h"
#include "node_settings.h"
#include "concat.h"
void settingsLoad()
{
addParameterKey(PARAMETER_XFREERDP, "xfreerdp", true, true);
addParameterKey(PARAMETER_SERVER, "/v:", true, true);
addParameterKey(PARAMETER_USERNAME, "/u:", true, true);
addParameterKey(PARAMETER_PASSWORD, "/p:", true, true);
addParameterKey(PARAMETER_CERTIGNORE, "/cert-ignore", false, true);
addParameterKey(PARAMETER_THEMES, "-themes", false, true);
addParameterKey(PARAMETER_WALLPAPER, "-wallpaper", false, true);
addParameterKey(PARAMETER_FULLSCREEN, "/f", true, true);
addParameterKey(PARAMETER_MULTIMONITOR, "/multimon", true, true);
addParameterKey(PARAMETER_AUTHENTICATION, "-authentication", true, true);
addParameterKey(PARAMETER_SECURITY, "/sec:", true, true);
addParameterValue(PARAMETER_SECURITY, VALUE_SECURITY_TLS, "tls", true);
addParameterValue(PARAMETER_SECURITY, VALUE_SECURITY_RDP, "rdp", false);
addParameterValue(PARAMETER_SECURITY, VALUE_SECURITY_NLA, "nla", false);
addParameterValue(PARAMETER_SECURITY, VALUE_SECURITY_EXT, "ext", false);
addParameterKey(PARAMETER_BITSPERPIXEL, "/bpp:", true, true);
addParameterValue(PARAMETER_BITSPERPIXEL, VALUES_BITSPERPIXEL_8, "8", true);
addParameterValue(PARAMETER_BITSPERPIXEL, VALUES_BITSPERPIXEL_16, "16", false);
addParameterValue(PARAMETER_BITSPERPIXEL, VALUES_BITSPERPIXEL_24, "24", false);
addParameterValue(PARAMETER_BITSPERPIXEL, VALUES_BITSPERPIXEL_32, "32", false);
}
void settingsFree()
{
freeSettings();
}
void buildArguments(Arguments *args)
{
args->argc = 0;
args->argv = (char **)malloc(sizeof(char *) * settings.countParameterSet);
for (NodeParameter *head = settings.parameter; head; head = head->next)
{
if (head->set)
{
if (head->value)
args->argv[(args->argc)++] = concat(head->key, getSetNodeValue(head)->current);
else
args->argv[(args->argc)++] = concat(head->key, NULL);
}
}
}
void freeArguments(Arguments *args)
{
for (int i = 0; i < args->argc; ++i)
{
free(args->argv[i]);
}
free(args->argv);
}