2012-11-18 09:08:03 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* Settings Management
|
|
|
|
*
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2016-02-26 16:50:27 +03:00
|
|
|
* Copyright 2016 Armin Novak <armin.novak@gmail.com>
|
2012-11-18 09:08:03 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2012-12-05 23:00:49 +04:00
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
#include <freerdp/settings.h>
|
2013-04-25 00:33:43 +04:00
|
|
|
#include <freerdp/freerdp.h>
|
2014-09-12 16:36:29 +04:00
|
|
|
#include <freerdp/log.h>
|
|
|
|
|
|
|
|
#define TAG FREERDP_TAG("common")
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-12-05 23:00:49 +04:00
|
|
|
int freerdp_addin_set_argument(ADDIN_ARGV* args, char* argument)
|
|
|
|
{
|
|
|
|
int i;
|
2018-08-22 14:40:41 +03:00
|
|
|
char** new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
|
|
|
|
for (i = 0; i < args->argc; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(args->argv[i], argument) == 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
new_argv = (char**)realloc(args->argv, sizeof(char*) * (args->argc + 1));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
if (!new_argv)
|
|
|
|
return -1;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
args->argv = new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
args->argc++;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!(args->argv[args->argc - 1] = _strdup(argument)))
|
|
|
|
return -1;
|
2012-12-05 23:00:49 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_addin_replace_argument(ADDIN_ARGV* args, char* previous, char* argument)
|
|
|
|
{
|
|
|
|
int i;
|
2018-08-22 14:40:41 +03:00
|
|
|
char** new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
|
|
|
|
for (i = 0; i < args->argc; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(args->argv[i], previous) == 0)
|
|
|
|
{
|
|
|
|
free(args->argv[i]);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!(args->argv[i] = _strdup(argument)))
|
|
|
|
return -1;
|
2012-12-05 23:00:49 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
new_argv = (char**)realloc(args->argv, sizeof(char*) * (args->argc + 1));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
if (!new_argv)
|
|
|
|
return -1;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
args->argv = new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
args->argc++;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!(args->argv[args->argc - 1] = _strdup(argument)))
|
|
|
|
return -1;
|
2012-12-05 23:00:49 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_addin_set_argument_value(ADDIN_ARGV* args, char* option, char* value)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char* p;
|
|
|
|
char* str;
|
2019-10-29 12:18:09 +03:00
|
|
|
size_t length;
|
2018-08-22 14:40:41 +03:00
|
|
|
char** new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
length = strlen(option) + strlen(value) + 1;
|
2019-11-06 17:24:51 +03:00
|
|
|
str = (char*)malloc(length + 1);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
if (!str)
|
|
|
|
return -1;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2012-12-05 23:00:49 +04:00
|
|
|
sprintf_s(str, length + 1, "%s:%s", option, value);
|
|
|
|
|
|
|
|
for (i = 0; i < args->argc; i++)
|
|
|
|
{
|
|
|
|
p = strchr(args->argv[i], ':');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
if (strncmp(args->argv[i], option, p - args->argv[i]) == 0)
|
|
|
|
{
|
|
|
|
free(args->argv[i]);
|
|
|
|
args->argv[i] = str;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
new_argv = (char**)realloc(args->argv, sizeof(char*) * (args->argc + 1));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
if (!new_argv)
|
2015-06-23 22:29:21 +03:00
|
|
|
{
|
|
|
|
free(str);
|
2015-03-11 08:52:24 +03:00
|
|
|
return -1;
|
2015-06-23 22:29:21 +03:00
|
|
|
}
|
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
args->argv = new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
args->argc++;
|
|
|
|
args->argv[args->argc - 1] = str;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-08-22 14:40:41 +03:00
|
|
|
int freerdp_addin_replace_argument_value(ADDIN_ARGV* args, char* previous, char* option,
|
2019-11-06 17:24:51 +03:00
|
|
|
char* value)
|
2012-12-05 23:00:49 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char* str;
|
2019-10-29 12:18:09 +03:00
|
|
|
size_t length;
|
2018-08-22 14:40:41 +03:00
|
|
|
char** new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
length = strlen(option) + strlen(value) + 1;
|
2019-11-06 17:24:51 +03:00
|
|
|
str = (char*)malloc(length + 1);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
if (!str)
|
|
|
|
return -1;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2012-12-05 23:00:49 +04:00
|
|
|
sprintf_s(str, length + 1, "%s:%s", option, value);
|
|
|
|
|
|
|
|
for (i = 0; i < args->argc; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(args->argv[i], previous) == 0)
|
|
|
|
{
|
|
|
|
free(args->argv[i]);
|
|
|
|
args->argv[i] = str;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
new_argv = (char**)realloc(args->argv, sizeof(char*) * (args->argc + 1));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
if (!new_argv)
|
2015-06-23 22:29:21 +03:00
|
|
|
{
|
|
|
|
free(str);
|
2015-03-11 08:52:24 +03:00
|
|
|
return -1;
|
2015-06-23 22:29:21 +03:00
|
|
|
}
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
args->argv = new_argv;
|
2012-12-05 23:00:49 +04:00
|
|
|
args->argc++;
|
|
|
|
args->argv[args->argc - 1] = str;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-18 14:00:10 +03:00
|
|
|
BOOL freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device)
|
2012-11-18 09:08:03 +04:00
|
|
|
{
|
2015-03-10 15:10:39 +03:00
|
|
|
if (!settings->DeviceArray)
|
2015-06-18 14:00:10 +03:00
|
|
|
return FALSE;
|
2015-03-10 15:10:39 +03:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
if (settings->DeviceArraySize < (settings->DeviceCount + 1))
|
|
|
|
{
|
2015-03-11 08:52:24 +03:00
|
|
|
UINT32 new_size;
|
2018-08-22 14:40:41 +03:00
|
|
|
RDPDR_DEVICE** new_array;
|
2015-03-11 08:52:24 +03:00
|
|
|
new_size = settings->DeviceArraySize * 2;
|
2019-11-06 17:24:51 +03:00
|
|
|
new_array =
|
|
|
|
(RDPDR_DEVICE**)realloc(settings->DeviceArray, new_size * sizeof(RDPDR_DEVICE*));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
if (!new_array)
|
2015-06-18 14:00:10 +03:00
|
|
|
return FALSE;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
settings->DeviceArray = new_array;
|
|
|
|
settings->DeviceArraySize = new_size;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
settings->DeviceArray[settings->DeviceCount++] = device;
|
2015-06-18 14:00:10 +03:00
|
|
|
return TRUE;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
|
2013-02-15 04:38:45 +04:00
|
|
|
RDPDR_DEVICE* freerdp_device_collection_find(rdpSettings* settings, const char* name)
|
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 index;
|
2013-02-15 04:38:45 +04:00
|
|
|
RDPDR_DEVICE* device;
|
|
|
|
|
|
|
|
for (index = 0; index < settings->DeviceCount; index++)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
device = (RDPDR_DEVICE*)settings->DeviceArray[index];
|
2013-02-15 04:38:45 +04:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!device->Name)
|
2013-09-06 14:35:33 +04:00
|
|
|
continue;
|
|
|
|
|
2013-02-15 04:38:45 +04:00
|
|
|
if (strcmp(device->Name, name) == 0)
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-02-26 16:50:27 +03:00
|
|
|
RDPDR_DEVICE* freerdp_device_collection_find_type(rdpSettings* settings, UINT32 type)
|
|
|
|
{
|
|
|
|
UINT32 index;
|
|
|
|
RDPDR_DEVICE* device;
|
|
|
|
|
|
|
|
for (index = 0; index < settings->DeviceCount; index++)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
device = (RDPDR_DEVICE*)settings->DeviceArray[index];
|
2016-02-26 16:50:27 +03:00
|
|
|
|
|
|
|
if (device->Type == type)
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-19 06:42:50 +04:00
|
|
|
RDPDR_DEVICE* freerdp_device_clone(RDPDR_DEVICE* device)
|
|
|
|
{
|
|
|
|
if (device->Type == RDPDR_DTYP_FILESYSTEM)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
RDPDR_DRIVE* drive = (RDPDR_DRIVE*)device;
|
|
|
|
RDPDR_DRIVE* _drive = (RDPDR_DRIVE*)calloc(1, sizeof(RDPDR_DRIVE));
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_drive)
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
_drive->Id = drive->Id;
|
|
|
|
_drive->Type = drive->Type;
|
|
|
|
_drive->Name = _strdup(drive->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_drive->Name)
|
|
|
|
goto out_fs_name_error;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2013-10-19 06:42:50 +04:00
|
|
|
_drive->Path = _strdup(drive->Path);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_drive->Path)
|
|
|
|
goto out_fs_path_error;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
return (RDPDR_DEVICE*)_drive;
|
2018-08-22 14:40:41 +03:00
|
|
|
out_fs_path_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_drive->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
out_fs_name_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_drive);
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
2014-03-26 02:13:08 +04:00
|
|
|
|
|
|
|
if (device->Type == RDPDR_DTYP_PRINT)
|
2013-10-19 06:42:50 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
RDPDR_PRINTER* printer = (RDPDR_PRINTER*)device;
|
|
|
|
RDPDR_PRINTER* _printer = (RDPDR_PRINTER*)calloc(1, sizeof(RDPDR_PRINTER));
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_printer)
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
_printer->Id = printer->Id;
|
|
|
|
_printer->Type = printer->Type;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
|
|
|
if (printer->Name)
|
|
|
|
{
|
|
|
|
_printer->Name = _strdup(printer->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!_printer->Name)
|
|
|
|
goto out_print_name_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (printer->DriverName)
|
|
|
|
{
|
|
|
|
_printer->DriverName = _strdup(printer->DriverName);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!_printer->DriverName)
|
|
|
|
goto out_print_path_error;
|
|
|
|
}
|
2014-03-26 02:13:08 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
return (RDPDR_DEVICE*)_printer;
|
2018-08-22 14:40:41 +03:00
|
|
|
out_print_path_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_printer->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
out_print_name_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_printer);
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
2014-03-26 02:13:08 +04:00
|
|
|
|
|
|
|
if (device->Type == RDPDR_DTYP_SMARTCARD)
|
2013-10-19 06:42:50 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
RDPDR_SMARTCARD* smartcard = (RDPDR_SMARTCARD*)device;
|
|
|
|
RDPDR_SMARTCARD* _smartcard = (RDPDR_SMARTCARD*)calloc(1, sizeof(RDPDR_SMARTCARD));
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_smartcard)
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
_smartcard->Id = smartcard->Id;
|
|
|
|
_smartcard->Type = smartcard->Type;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
|
|
|
if (smartcard->Name)
|
|
|
|
{
|
|
|
|
_smartcard->Name = _strdup(smartcard->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!_smartcard->Name)
|
|
|
|
goto out_smartc_name_error;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
return (RDPDR_DEVICE*)_smartcard;
|
2018-08-22 14:40:41 +03:00
|
|
|
out_smartc_name_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_smartcard);
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
2014-03-26 02:13:08 +04:00
|
|
|
|
|
|
|
if (device->Type == RDPDR_DTYP_SERIAL)
|
2013-10-19 06:42:50 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
RDPDR_SERIAL* serial = (RDPDR_SERIAL*)device;
|
|
|
|
RDPDR_SERIAL* _serial = (RDPDR_SERIAL*)calloc(1, sizeof(RDPDR_SERIAL));
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_serial)
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
_serial->Id = serial->Id;
|
|
|
|
_serial->Type = serial->Type;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
|
|
|
if (serial->Name)
|
|
|
|
{
|
|
|
|
_serial->Name = _strdup(serial->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!_serial->Name)
|
|
|
|
goto out_serial_name_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (serial->Path)
|
|
|
|
{
|
|
|
|
_serial->Path = _strdup(serial->Path);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!_serial->Path)
|
|
|
|
goto out_serial_path_error;
|
|
|
|
}
|
2014-03-26 02:13:08 +04:00
|
|
|
|
2014-06-18 20:20:21 +04:00
|
|
|
if (serial->Driver)
|
|
|
|
{
|
|
|
|
_serial->Driver = _strdup(serial->Driver);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-06-18 20:20:21 +04:00
|
|
|
if (!_serial->Driver)
|
|
|
|
goto out_serial_driver_error;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
return (RDPDR_DEVICE*)_serial;
|
2018-08-22 14:40:41 +03:00
|
|
|
out_serial_driver_error:
|
2014-06-18 20:20:21 +04:00
|
|
|
free(_serial->Path);
|
2018-08-22 14:40:41 +03:00
|
|
|
out_serial_path_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_serial->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
out_serial_name_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_serial);
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
2014-03-26 02:13:08 +04:00
|
|
|
|
|
|
|
if (device->Type == RDPDR_DTYP_PARALLEL)
|
2013-10-19 06:42:50 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
RDPDR_PARALLEL* parallel = (RDPDR_PARALLEL*)device;
|
|
|
|
RDPDR_PARALLEL* _parallel = (RDPDR_PARALLEL*)calloc(1, sizeof(RDPDR_PARALLEL));
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_parallel)
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
_parallel->Id = parallel->Id;
|
|
|
|
_parallel->Type = parallel->Type;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
|
|
|
if (parallel->Name)
|
|
|
|
{
|
|
|
|
_parallel->Name = _strdup(parallel->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!_parallel->Name)
|
|
|
|
goto out_parallel_name_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parallel->Path)
|
|
|
|
{
|
|
|
|
_parallel->Path = _strdup(parallel->Path);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
if (!_parallel->Path)
|
|
|
|
goto out_parallel_path_error;
|
|
|
|
}
|
2014-03-26 02:13:08 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
return (RDPDR_DEVICE*)_parallel;
|
2018-08-22 14:40:41 +03:00
|
|
|
out_parallel_path_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_parallel->Name);
|
2018-08-22 14:40:41 +03:00
|
|
|
out_parallel_name_error:
|
2014-03-26 02:13:08 +04:00
|
|
|
free(_parallel);
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
WLog_ERR(TAG, "unknown device type %" PRIu32 "", device->Type);
|
2014-03-26 02:13:08 +04:00
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
void freerdp_device_collection_free(rdpSettings* settings)
|
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 index;
|
2012-11-19 22:26:56 +04:00
|
|
|
RDPDR_DEVICE* device;
|
|
|
|
|
|
|
|
for (index = 0; index < settings->DeviceCount; index++)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
device = (RDPDR_DEVICE*)settings->DeviceArray[index];
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!device)
|
|
|
|
continue;
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
free(device->Name);
|
|
|
|
|
|
|
|
if (settings->DeviceArray[index]->Type == RDPDR_DTYP_FILESYSTEM)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
free(((RDPDR_DRIVE*)device)->Path);
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_PRINT)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_SMARTCARD)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_SERIAL)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
free(((RDPDR_SERIAL*)device)->Path);
|
|
|
|
free(((RDPDR_SERIAL*)device)->Driver);
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_PARALLEL)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
free(((RDPDR_PARALLEL*)device)->Path);
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
free(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(settings->DeviceArray);
|
|
|
|
settings->DeviceArraySize = 0;
|
|
|
|
settings->DeviceArray = NULL;
|
|
|
|
settings->DeviceCount = 0;
|
|
|
|
}
|
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
BOOL freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
|
2012-11-18 09:08:03 +04:00
|
|
|
{
|
2015-03-10 15:10:39 +03:00
|
|
|
if (!settings->StaticChannelArray)
|
2015-06-16 16:42:07 +03:00
|
|
|
return FALSE;
|
2015-03-10 15:10:39 +03:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
if (settings->StaticChannelArraySize < (settings->StaticChannelCount + 1))
|
|
|
|
{
|
2015-03-11 08:52:24 +03:00
|
|
|
UINT32 new_size;
|
2018-08-22 14:40:41 +03:00
|
|
|
ADDIN_ARGV** new_array;
|
2015-03-11 08:52:24 +03:00
|
|
|
new_size = settings->StaticChannelArraySize * 2;
|
2019-11-06 17:24:51 +03:00
|
|
|
new_array =
|
|
|
|
(ADDIN_ARGV**)realloc(settings->StaticChannelArray, new_size * sizeof(ADDIN_ARGV*));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
if (!new_array)
|
2015-06-16 16:42:07 +03:00
|
|
|
return FALSE;
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
settings->StaticChannelArray = new_array;
|
|
|
|
settings->StaticChannelArraySize = new_size;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
settings->StaticChannelArray[settings->StaticChannelCount++] = channel;
|
2015-06-16 16:42:07 +03:00
|
|
|
return TRUE;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
|
2012-11-21 18:30:06 +04:00
|
|
|
ADDIN_ARGV* freerdp_static_channel_collection_find(rdpSettings* settings, const char* name)
|
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 index;
|
2012-11-21 18:30:06 +04:00
|
|
|
ADDIN_ARGV* channel;
|
|
|
|
|
|
|
|
for (index = 0; index < settings->StaticChannelCount; index++)
|
|
|
|
{
|
|
|
|
channel = settings->StaticChannelArray[index];
|
|
|
|
|
|
|
|
if (strcmp(channel->argv[0], name) == 0)
|
|
|
|
return channel;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-19 06:42:50 +04:00
|
|
|
ADDIN_ARGV* freerdp_static_channel_clone(ADDIN_ARGV* channel)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
ADDIN_ARGV* _channel = NULL;
|
2019-11-06 17:24:51 +03:00
|
|
|
_channel = (ADDIN_ARGV*)malloc(sizeof(ADDIN_ARGV));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_channel)
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
_channel->argc = channel->argc;
|
2019-11-06 17:24:51 +03:00
|
|
|
_channel->argv = (char**)calloc(channel->argc, sizeof(char*));
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_channel->argv)
|
|
|
|
goto out_free;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
for (index = 0; index < _channel->argc; index++)
|
|
|
|
{
|
|
|
|
_channel->argv[index] = _strdup(channel->argv[index]);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_channel->argv[index])
|
|
|
|
goto out_release_args;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return _channel;
|
2014-03-26 02:13:08 +04:00
|
|
|
out_release_args:
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
for (index = 0; _channel->argv[index]; index++)
|
|
|
|
free(_channel->argv[index]);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
out_free:
|
|
|
|
free(_channel);
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
void freerdp_static_channel_collection_free(rdpSettings* settings)
|
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
int j;
|
|
|
|
UINT32 i;
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2013-01-29 03:42:32 +04:00
|
|
|
for (i = 0; i < settings->StaticChannelCount; i++)
|
2012-11-19 22:26:56 +04:00
|
|
|
{
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!settings->StaticChannelArray[i])
|
|
|
|
continue;
|
|
|
|
|
2013-01-29 03:42:32 +04:00
|
|
|
for (j = 0; j < settings->StaticChannelArray[i]->argc; j++)
|
|
|
|
free(settings->StaticChannelArray[i]->argv[j]);
|
|
|
|
|
|
|
|
free(settings->StaticChannelArray[i]->argv);
|
|
|
|
free(settings->StaticChannelArray[i]);
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
free(settings->StaticChannelArray);
|
|
|
|
settings->StaticChannelArraySize = 0;
|
|
|
|
settings->StaticChannelArray = NULL;
|
|
|
|
settings->StaticChannelCount = 0;
|
|
|
|
}
|
|
|
|
|
2015-06-16 16:42:07 +03:00
|
|
|
BOOL freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
|
2012-11-18 09:08:03 +04:00
|
|
|
{
|
2015-03-10 15:10:39 +03:00
|
|
|
if (!settings->DynamicChannelArray)
|
2015-06-16 16:42:07 +03:00
|
|
|
return FALSE;
|
2015-03-10 15:10:39 +03:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
if (settings->DynamicChannelArraySize < (settings->DynamicChannelCount + 1))
|
|
|
|
{
|
2018-08-22 14:40:41 +03:00
|
|
|
ADDIN_ARGV** new_array;
|
|
|
|
new_array = realloc(settings->DynamicChannelArray,
|
|
|
|
settings->DynamicChannelArraySize * sizeof(ADDIN_ARGV*) * 2);
|
2015-03-13 14:17:22 +03:00
|
|
|
|
2015-03-11 08:52:24 +03:00
|
|
|
if (!new_array)
|
2015-06-16 16:42:07 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
settings->DynamicChannelArraySize *= 2;
|
2015-03-11 08:52:24 +03:00
|
|
|
settings->DynamicChannelArray = new_array;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
settings->DynamicChannelArray[settings->DynamicChannelCount++] = channel;
|
2015-06-16 16:42:07 +03:00
|
|
|
return TRUE;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2012-11-21 18:30:06 +04:00
|
|
|
ADDIN_ARGV* freerdp_dynamic_channel_collection_find(rdpSettings* settings, const char* name)
|
|
|
|
{
|
2014-02-11 07:12:13 +04:00
|
|
|
UINT32 index;
|
2012-11-21 18:30:06 +04:00
|
|
|
ADDIN_ARGV* channel;
|
|
|
|
|
|
|
|
for (index = 0; index < settings->DynamicChannelCount; index++)
|
|
|
|
{
|
|
|
|
channel = settings->DynamicChannelArray[index];
|
|
|
|
|
|
|
|
if (strcmp(channel->argv[0], name) == 0)
|
|
|
|
return channel;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-19 06:42:50 +04:00
|
|
|
ADDIN_ARGV* freerdp_dynamic_channel_clone(ADDIN_ARGV* channel)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
ADDIN_ARGV* _channel = NULL;
|
2019-11-06 17:24:51 +03:00
|
|
|
_channel = (ADDIN_ARGV*)malloc(sizeof(ADDIN_ARGV));
|
2015-02-07 01:35:14 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_channel)
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
_channel->argc = channel->argc;
|
2019-11-06 17:24:51 +03:00
|
|
|
_channel->argv = (char**)calloc(sizeof(char*), channel->argc);
|
2015-02-07 01:35:14 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_channel->argv)
|
|
|
|
goto out_free;
|
2013-10-19 06:42:50 +04:00
|
|
|
|
|
|
|
for (index = 0; index < _channel->argc; index++)
|
|
|
|
{
|
|
|
|
_channel->argv[index] = _strdup(channel->argv[index]);
|
2015-02-07 01:35:14 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
if (!_channel->argv[index])
|
|
|
|
goto out_release_args;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return _channel;
|
2014-03-26 02:13:08 +04:00
|
|
|
out_release_args:
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
for (index = 0; _channel->argv[index]; index++)
|
|
|
|
free(_channel->argv[index]);
|
2018-08-22 14:40:41 +03:00
|
|
|
|
2014-03-26 02:13:08 +04:00
|
|
|
out_free:
|
|
|
|
free(_channel);
|
|
|
|
return NULL;
|
2013-10-19 06:42:50 +04:00
|
|
|
}
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
void freerdp_dynamic_channel_collection_free(rdpSettings* settings)
|
|
|
|
{
|
2014-06-20 21:52:13 +04:00
|
|
|
int j;
|
|
|
|
UINT32 i;
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2014-06-20 21:52:13 +04:00
|
|
|
for (i = 0; i < settings->DynamicChannelCount; i++)
|
2012-11-19 22:26:56 +04:00
|
|
|
{
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!settings->DynamicChannelArray[i])
|
|
|
|
continue;
|
|
|
|
|
2014-06-20 21:52:13 +04:00
|
|
|
for (j = 0; j < settings->DynamicChannelArray[i]->argc; j++)
|
|
|
|
free(settings->DynamicChannelArray[i]->argv[j]);
|
|
|
|
|
|
|
|
free(settings->DynamicChannelArray[i]->argv);
|
|
|
|
free(settings->DynamicChannelArray[i]);
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
free(settings->DynamicChannelArray);
|
|
|
|
settings->DynamicChannelArraySize = 0;
|
|
|
|
settings->DynamicChannelArray = NULL;
|
|
|
|
settings->DynamicChannelCount = 0;
|
|
|
|
}
|
2013-03-20 23:33:33 +04:00
|
|
|
|
2013-11-04 01:25:56 +04:00
|
|
|
void freerdp_target_net_addresses_free(rdpSettings* settings)
|
|
|
|
{
|
|
|
|
UINT32 index;
|
|
|
|
|
|
|
|
for (index = 0; index < settings->TargetNetAddressCount; index++)
|
|
|
|
free(settings->TargetNetAddresses[index]);
|
|
|
|
|
|
|
|
free(settings->TargetNetAddresses);
|
2015-05-06 23:32:45 +03:00
|
|
|
free(settings->TargetNetPorts);
|
2013-11-04 01:25:56 +04:00
|
|
|
settings->TargetNetAddressCount = 0;
|
|
|
|
settings->TargetNetAddresses = NULL;
|
2015-05-06 23:32:45 +03:00
|
|
|
settings->TargetNetPorts = NULL;
|
2013-11-04 01:25:56 +04:00
|
|
|
}
|
|
|
|
|
2013-09-17 22:56:23 +04:00
|
|
|
void freerdp_performance_flags_make(rdpSettings* settings)
|
|
|
|
{
|
|
|
|
settings->PerformanceFlags = PERF_FLAG_NONE;
|
|
|
|
|
|
|
|
if (settings->AllowFontSmoothing)
|
|
|
|
settings->PerformanceFlags |= PERF_ENABLE_FONT_SMOOTHING;
|
|
|
|
|
|
|
|
if (settings->AllowDesktopComposition)
|
|
|
|
settings->PerformanceFlags |= PERF_ENABLE_DESKTOP_COMPOSITION;
|
|
|
|
|
|
|
|
if (settings->DisableWallpaper)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_WALLPAPER;
|
|
|
|
|
|
|
|
if (settings->DisableFullWindowDrag)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_FULLWINDOWDRAG;
|
|
|
|
|
|
|
|
if (settings->DisableMenuAnims)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_MENUANIMATIONS;
|
|
|
|
|
|
|
|
if (settings->DisableThemes)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_THEMING;
|
|
|
|
}
|
|
|
|
|
|
|
|
void freerdp_performance_flags_split(rdpSettings* settings)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->AllowFontSmoothing =
|
|
|
|
(settings->PerformanceFlags & PERF_ENABLE_FONT_SMOOTHING) ? TRUE : FALSE;
|
|
|
|
settings->AllowDesktopComposition =
|
|
|
|
(settings->PerformanceFlags & PERF_ENABLE_DESKTOP_COMPOSITION) ? TRUE : FALSE;
|
|
|
|
settings->DisableWallpaper =
|
|
|
|
(settings->PerformanceFlags & PERF_DISABLE_WALLPAPER) ? TRUE : FALSE;
|
|
|
|
settings->DisableFullWindowDrag =
|
|
|
|
(settings->PerformanceFlags & PERF_DISABLE_FULLWINDOWDRAG) ? TRUE : FALSE;
|
|
|
|
settings->DisableMenuAnims =
|
|
|
|
(settings->PerformanceFlags & PERF_DISABLE_MENUANIMATIONS) ? TRUE : FALSE;
|
2013-09-17 22:56:23 +04:00
|
|
|
settings->DisableThemes = (settings->PerformanceFlags & PERF_DISABLE_THEMING) ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
2019-05-06 10:51:42 +03:00
|
|
|
BOOL freerdp_set_gateway_usage_method(rdpSettings* settings, UINT32 GatewayUsageMethod)
|
2014-04-25 01:05:10 +04:00
|
|
|
{
|
2019-05-08 15:35:25 +03:00
|
|
|
if (!freerdp_settings_set_uint32(settings, FreeRDP_GatewayUsageMethod, GatewayUsageMethod))
|
2019-05-06 10:51:42 +03:00
|
|
|
return FALSE;
|
2014-04-25 01:05:10 +04:00
|
|
|
|
|
|
|
if (GatewayUsageMethod == TSC_PROXY_MODE_NONE_DIRECT)
|
|
|
|
{
|
2019-05-08 15:35:25 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayEnabled, FALSE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayBypassLocal, FALSE))
|
2019-05-06 10:51:42 +03:00
|
|
|
return FALSE;
|
2014-04-25 01:05:10 +04:00
|
|
|
}
|
|
|
|
else if (GatewayUsageMethod == TSC_PROXY_MODE_DIRECT)
|
|
|
|
{
|
2019-05-08 15:35:25 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayEnabled, TRUE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayBypassLocal, FALSE))
|
2019-05-06 10:51:42 +03:00
|
|
|
return FALSE;
|
2014-04-25 01:05:10 +04:00
|
|
|
}
|
|
|
|
else if (GatewayUsageMethod == TSC_PROXY_MODE_DETECT)
|
|
|
|
{
|
2019-05-08 15:35:25 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayEnabled, TRUE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayBypassLocal, TRUE))
|
2019-05-06 10:51:42 +03:00
|
|
|
return FALSE;
|
2014-04-25 01:05:10 +04:00
|
|
|
}
|
|
|
|
else if (GatewayUsageMethod == TSC_PROXY_MODE_DEFAULT)
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* This corresponds to "Automatically detect RD Gateway server settings",
|
|
|
|
* which means the client attempts to use gateway group policy settings
|
|
|
|
* http://technet.microsoft.com/en-us/library/cc770601.aspx
|
|
|
|
*/
|
2019-05-08 15:35:25 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayEnabled, FALSE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayBypassLocal, FALSE))
|
2019-05-06 10:51:42 +03:00
|
|
|
return FALSE;
|
2014-04-25 01:05:10 +04:00
|
|
|
}
|
|
|
|
else if (GatewayUsageMethod == TSC_PROXY_MODE_NONE_DETECT)
|
|
|
|
{
|
2019-05-08 15:35:25 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayEnabled, FALSE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayBypassLocal, FALSE))
|
2019-05-06 10:51:42 +03:00
|
|
|
return FALSE;
|
2014-04-25 01:05:10 +04:00
|
|
|
}
|
2019-05-06 10:51:42 +03:00
|
|
|
|
|
|
|
return TRUE;
|
2014-04-25 01:05:10 +04:00
|
|
|
}
|
|
|
|
|
2018-08-22 14:40:41 +03:00
|
|
|
void freerdp_update_gateway_usage_method(rdpSettings* settings, UINT32 GatewayEnabled,
|
2019-11-06 17:24:51 +03:00
|
|
|
UINT32 GatewayBypassLocal)
|
2014-05-30 20:55:17 +04:00
|
|
|
{
|
|
|
|
UINT32 GatewayUsageMethod = 0;
|
|
|
|
|
|
|
|
if (!GatewayEnabled && !GatewayBypassLocal)
|
|
|
|
GatewayUsageMethod = TSC_PROXY_MODE_NONE_DIRECT;
|
|
|
|
else if (GatewayEnabled && !GatewayBypassLocal)
|
|
|
|
GatewayUsageMethod = TSC_PROXY_MODE_DIRECT;
|
|
|
|
else if (GatewayEnabled && GatewayBypassLocal)
|
|
|
|
GatewayUsageMethod = TSC_PROXY_MODE_DETECT;
|
|
|
|
|
|
|
|
freerdp_set_gateway_usage_method(settings, GatewayUsageMethod);
|
|
|
|
}
|
2019-05-08 15:35:25 +03:00
|
|
|
|
2019-11-07 14:39:22 +03:00
|
|
|
BOOL freerdp_get_param_bool(const rdpSettings* settings, int id)
|
2019-05-08 15:35:25 +03:00
|
|
|
{
|
|
|
|
return freerdp_settings_get_bool(settings, (size_t)id);
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param)
|
|
|
|
{
|
|
|
|
return freerdp_settings_set_bool(settings, (size_t)id, param) ? 0 : -1;
|
|
|
|
}
|
|
|
|
|
2019-11-07 14:39:22 +03:00
|
|
|
int freerdp_get_param_int(const rdpSettings* settings, int id)
|
2019-05-08 15:35:25 +03:00
|
|
|
{
|
|
|
|
return freerdp_settings_get_int32(settings, (size_t)id);
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_set_param_int(rdpSettings* settings, int id, int param)
|
|
|
|
{
|
|
|
|
return freerdp_settings_set_int32(settings, (size_t)id, param) ? 0 : -1;
|
|
|
|
}
|
|
|
|
|
2019-11-07 14:39:22 +03:00
|
|
|
UINT32 freerdp_get_param_uint32(const rdpSettings* settings, int id)
|
2019-05-08 15:35:25 +03:00
|
|
|
{
|
|
|
|
return freerdp_settings_get_uint32(settings, (size_t)id);
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_set_param_uint32(rdpSettings* settings, int id, UINT32 param)
|
|
|
|
{
|
|
|
|
return freerdp_settings_set_uint32(settings, (size_t)id, param) ? 0 : -1;
|
|
|
|
}
|
|
|
|
|
2019-11-07 14:39:22 +03:00
|
|
|
UINT64 freerdp_get_param_uint64(const rdpSettings* settings, int id)
|
2019-05-08 15:35:25 +03:00
|
|
|
{
|
|
|
|
return freerdp_settings_get_uint64(settings, (size_t)id);
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_set_param_uint64(rdpSettings* settings, int id, UINT64 param)
|
|
|
|
{
|
|
|
|
return freerdp_settings_set_uint64(settings, (size_t)id, param) ? 0 : -1;
|
|
|
|
}
|
|
|
|
|
2019-11-07 14:39:22 +03:00
|
|
|
char* freerdp_get_param_string(const rdpSettings* settings, int id)
|
2019-05-08 15:35:25 +03:00
|
|
|
{
|
|
|
|
return (char*)freerdp_settings_get_string(settings, (size_t)id);
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_set_param_string(rdpSettings* settings, int id, const char* param)
|
|
|
|
{
|
|
|
|
return freerdp_settings_set_string(settings, (size_t)id, param) ? 0 : -1;
|
|
|
|
}
|