23 #include <freerdp/config.h>
30 #include <winpr/crt.h>
31 #include <winpr/assert.h>
33 #include "../core/settings.h"
34 #include "../core/capabilities.h"
36 #include <freerdp/crypto/certificate.h>
37 #include <freerdp/settings.h>
38 #include <freerdp/freerdp.h>
39 #include <freerdp/log.h>
41 #define TAG FREERDP_TAG("common")
43 BOOL freerdp_addin_argv_add_argument_ex(
ADDIN_ARGV* args,
const char* argument,
size_t len)
46 char** new_argv = NULL;
48 if (!args || !argument)
52 len = strlen(argument);
54 new_argv = (
char**)realloc(args->argv,
sizeof(
char*) * (args->argc + 1));
59 args->argv = new_argv;
61 str = calloc(len + 1,
sizeof(
char));
64 memcpy(str, argument, len);
65 args->argv[args->argc++] = str;
69 BOOL freerdp_addin_argv_add_argument(
ADDIN_ARGV* args,
const char* argument)
71 return freerdp_addin_argv_add_argument_ex(args, argument, 0);
74 BOOL freerdp_addin_argv_del_argument(
ADDIN_ARGV* args,
const char* argument)
76 if (!args || !argument)
78 for (
int x = 0; x < args->argc; x++)
80 char* arg = args->argv[x];
81 if (strcmp(argument, arg) == 0)
84 memmove_s(&args->argv[x], (args->argc - x) *
sizeof(
char*), &args->argv[x + 1],
85 (args->argc - x - 1) *
sizeof(
char*));
86 args->argv[args->argc - 1] = NULL;
94 int freerdp_addin_set_argument(
ADDIN_ARGV* args,
const char* argument)
96 if (!args || !argument)
99 for (
int i = 0; i < args->argc; i++)
101 if (strcmp(args->argv[i], argument) == 0)
107 if (!freerdp_addin_argv_add_argument(args, argument))
112 int freerdp_addin_replace_argument(
ADDIN_ARGV* args,
const char* previous,
const char* argument)
114 if (!args || !previous || !argument)
117 for (
int i = 0; i < args->argc; i++)
119 if (strcmp(args->argv[i], previous) == 0)
123 if (!(args->argv[i] = _strdup(argument)))
130 if (!freerdp_addin_argv_add_argument(args, argument))
135 int freerdp_addin_set_argument_value(
ADDIN_ARGV* args,
const char* option,
const char* value)
141 if (!args || !option || !value)
143 length = strlen(option) + strlen(value) + 1;
144 str = (
char*)calloc(length + 1,
sizeof(
char));
149 (void)sprintf_s(str, length + 1,
"%s:%s", option, value);
151 for (
int i = 0; i < args->argc; i++)
153 p = strchr(args->argv[i],
':');
157 if (strncmp(args->argv[i], option, p - args->argv[i]) == 0)
166 rc = freerdp_addin_argv_add_argument(args, str);
173 int freerdp_addin_replace_argument_value(
ADDIN_ARGV* args,
const char* previous,
const char* option,
179 if (!args || !previous || !option || !value)
181 length = strlen(option) + strlen(value) + 1;
182 str = (
char*)calloc(length + 1,
sizeof(
char));
187 (void)sprintf_s(str, length + 1,
"%s:%s", option, value);
189 for (
int i = 0; i < args->argc; i++)
191 if (strcmp(args->argv[i], previous) == 0)
199 rc = freerdp_addin_argv_add_argument(args, str);
206 BOOL freerdp_device_collection_add(rdpSettings* settings,
RDPDR_DEVICE* device)
210 WINPR_ASSERT(settings);
211 WINPR_ASSERT(device);
217 UINT32 new_size = old * 2;
221 new_size = count * 2;
229 settings->DeviceArray = new_array;
230 memset(&settings->DeviceArray[old], 0, (new_size - old) *
sizeof(
RDPDR_DEVICE*));
236 settings->DeviceArray[settings->DeviceCount++] = device;
242 WINPR_ASSERT(settings);
247 const UINT32 count = settings->DeviceCount;
248 for (
size_t x = 0; x < count; x++)
253 for (
size_t y = x + 1; y < count; y++)
256 settings->DeviceArray[y - 1] = next;
258 settings->DeviceArray[count - 1] = NULL;
259 settings->DeviceCount--;
267 RDPDR_DEVICE* freerdp_device_collection_find(rdpSettings* settings,
const char* name)
271 WINPR_ASSERT(settings);
273 for (UINT32 index = 0; index < settings->DeviceCount; index++)
275 device = settings->DeviceArray[index];
280 if (strcmp(device->Name, name) == 0)
287 RDPDR_DEVICE* freerdp_device_collection_find_type(rdpSettings* settings, UINT32 type)
290 WINPR_ASSERT(settings);
292 for (UINT32 index = 0; index < settings->DeviceCount; index++)
294 device = settings->DeviceArray[index];
296 if (device->Type == type)
303 RDPDR_DEVICE* freerdp_device_new(UINT32 Type,
size_t count,
const char*
const args[])
317 WINPR_ASSERT(args || (count == 0));
321 case RDPDR_DTYP_PRINT:
324 case RDPDR_DTYP_SERIAL:
327 case RDPDR_DTYP_PARALLEL:
330 case RDPDR_DTYP_SMARTCARD:
333 case RDPDR_DTYP_FILESYSTEM:
340 device.base = calloc(1, size);
344 device.base->Type = Type;
348 device.base->Name = _strdup(args[0]);
349 if (!device.base->Name)
354 case RDPDR_DTYP_PRINT:
357 device.printer->DriverName = _strdup(args[1]);
358 if (!device.printer->DriverName)
364 device.printer->IsDefault = _stricmp(args[2],
"default") == 0;
367 case RDPDR_DTYP_SERIAL:
370 device.serial->Path = _strdup(args[1]);
371 if (!device.serial->Path)
377 device.serial->Driver = _strdup(args[2]);
378 if (!device.serial->Driver)
384 device.serial->Permissive = _strdup(args[3]);
385 if (!device.serial->Permissive)
389 case RDPDR_DTYP_PARALLEL:
392 device.parallel->Path = _strdup(args[1]);
393 if (!device.serial->Path)
397 case RDPDR_DTYP_SMARTCARD:
399 case RDPDR_DTYP_FILESYSTEM:
402 device.drive->Path = _strdup(args[1]);
403 if (!device.drive->Path)
407 device.drive->automount = (args[2] == NULL) ? TRUE : FALSE;
416 freerdp_device_free(device.base);
437 switch (device->Type)
439 case RDPDR_DTYP_PRINT:
440 free(cnv.printer->DriverName);
442 case RDPDR_DTYP_SERIAL:
443 free(cnv.serial->Path);
444 free(cnv.serial->Driver);
445 free(cnv.serial->Permissive);
447 case RDPDR_DTYP_PARALLEL:
448 free(cnv.parallel->Path);
450 case RDPDR_DTYP_SMARTCARD:
452 case RDPDR_DTYP_FILESYSTEM:
453 free(cnv.drive->Path);
484 const char* args[4] = { 0 };
495 args[0] = device->Name;
498 switch (device->Type)
500 case RDPDR_DTYP_FILESYSTEM:
503 args[1] = src.drive->Path;
508 case RDPDR_DTYP_PRINT:
509 if (src.printer->DriverName)
511 args[1] = src.printer->DriverName;
516 case RDPDR_DTYP_SMARTCARD:
519 case RDPDR_DTYP_SERIAL:
520 if (src.serial->Path)
522 args[1] = src.serial->Path;
526 if (src.serial->Driver)
528 args[2] = src.serial->Driver;
532 if (src.serial->Permissive)
534 args[3] = src.serial->Permissive;
539 case RDPDR_DTYP_PARALLEL:
540 if (src.parallel->Path)
542 args[1] = src.parallel->Path;
547 WLog_ERR(TAG,
"unknown device type %" PRIu32
"", device->Type);
551 copy.dev = freerdp_device_new(device->Type, count, args);
555 copy.dev->Id = device->Id;
560 void freerdp_device_collection_free(rdpSettings* settings)
562 WINPR_ASSERT(settings);
564 if (settings->DeviceArray)
566 for (UINT32 index = 0; index < settings->DeviceArraySize; index++)
567 (
void)freerdp_settings_set_pointer_array(settings, FreeRDP_DeviceArray, index, NULL);
570 free(settings->DeviceArray);
577 BOOL freerdp_static_channel_collection_del(rdpSettings* settings,
const char* name)
580 if (!settings || !settings->StaticChannelArray)
583 for (UINT32 x = 0; x < count; x++)
585 ADDIN_ARGV* cur = settings->StaticChannelArray[x];
586 if (cur && (cur->argc > 0))
588 if (strcmp(name, cur->argv[0]) == 0)
590 const size_t rem = settings->StaticChannelArraySize - count + 1;
591 memmove_s(&settings->StaticChannelArray[x], (count - x) *
sizeof(
ADDIN_ARGV*),
592 &settings->StaticChannelArray[x + 1],
594 memset(&settings->StaticChannelArray[count - 1], 0,
sizeof(
ADDIN_ARGV*) * rem);
596 freerdp_addin_argv_free(cur);
602 const size_t rem = settings->StaticChannelArraySize - count;
603 memset(&settings->StaticChannelArray[count], 0,
sizeof(
ADDIN_ARGV*) * rem);
608 BOOL freerdp_static_channel_collection_add(rdpSettings* settings,
ADDIN_ARGV* channel)
612 WINPR_ASSERT(settings);
613 WINPR_ASSERT(channel);
618 const UINT32 oldSize =
620 UINT32 new_size = oldSize * 2ul;
623 new_size = count * 2ul;
631 settings->StaticChannelArray = new_array;
633 const size_t rem = new_size - oldSize;
634 memset(&settings->StaticChannelArray[oldSize], 0,
sizeof(
ADDIN_ARGV*) * rem);
642 ADDIN_ARGV** cur = &settings->StaticChannelArray[count++];
643 freerdp_addin_argv_free(*cur);
648 ADDIN_ARGV* freerdp_static_channel_collection_find(rdpSettings* settings,
const char* name)
652 WINPR_ASSERT(settings);
655 for (UINT32 index = 0;
658 channel = settings->StaticChannelArray[index];
660 if (strcmp(channel->argv[0], name) == 0)
667 void freerdp_static_channel_collection_free(rdpSettings* settings)
672 if (settings->StaticChannelArray)
676 freerdp_addin_argv_free(settings->StaticChannelArray[i]);
679 free(settings->StaticChannelArray);
681 settings->StaticChannelArray = NULL;
685 BOOL freerdp_dynamic_channel_collection_del(rdpSettings* settings,
const char* name)
688 if (!settings || !settings->DynamicChannelArray)
691 for (UINT32 x = 0; x < count; x++)
693 ADDIN_ARGV* cur = settings->DynamicChannelArray[x];
694 if (cur && (cur->argc > 0))
696 if (strcmp(name, cur->argv[0]) == 0)
698 const size_t rem = settings->DynamicChannelArraySize - count + 1;
699 memmove_s(&settings->DynamicChannelArray[x], (count - x) *
sizeof(
ADDIN_ARGV*),
700 &settings->DynamicChannelArray[x + 1],
702 memset(&settings->DynamicChannelArray[count - 1], 0,
sizeof(
ADDIN_ARGV*) * rem);
704 freerdp_addin_argv_free(cur);
714 BOOL freerdp_dynamic_channel_collection_add(rdpSettings* settings,
ADDIN_ARGV* channel)
719 WINPR_ASSERT(settings);
720 WINPR_ASSERT(channel);
727 UINT32 size = oldSize * 2;
731 new_array = realloc(settings->DynamicChannelArray,
sizeof(
ADDIN_ARGV*) * size);
736 settings->DynamicChannelArray = new_array;
738 const size_t rem = size - oldSize;
739 memset(&settings->DynamicChannelArray[oldSize], 0,
sizeof(
ADDIN_ARGV*) * rem);
746 settings->DynamicChannelArray[count++] = channel;
750 ADDIN_ARGV* freerdp_dynamic_channel_collection_find(
const rdpSettings* settings,
const char* name)
752 WINPR_ASSERT(settings);
755 for (UINT32 index = 0;
758 ADDIN_ARGV* channel = settings->DynamicChannelArray[index];
760 if (strcmp(channel->argv[0], name) == 0)
767 void freerdp_addin_argv_free(
ADDIN_ARGV* args)
774 for (
int index = 0; index < args->argc; index++)
775 free(args->argv[index]);
782 ADDIN_ARGV* freerdp_addin_argv_new(
size_t argc,
const char*
const argv[])
784 if (argc > INT32_MAX)
793 args->argc = (int)argc;
794 args->argv = calloc(argc,
sizeof(
char*));
800 for (
size_t x = 0; x < argc; x++)
802 args->argv[x] = _strdup(argv[x]);
810 WINPR_PRAGMA_DIAG_PUSH
811 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
812 freerdp_addin_argv_free(args);
813 WINPR_PRAGMA_DIAG_POP
827 return freerdp_addin_argv_new(args->argc, cnv.cc);
830 void freerdp_dynamic_channel_collection_free(rdpSettings* settings)
832 WINPR_ASSERT(settings);
834 if (settings->DynamicChannelArray)
838 freerdp_addin_argv_free(settings->DynamicChannelArray[i]);
841 free(settings->DynamicChannelArray);
843 settings->DynamicChannelArray = NULL;
847 void freerdp_capability_buffer_free(rdpSettings* settings)
849 WINPR_ASSERT(settings);
851 if (settings->ReceivedCapabilityData)
853 for (UINT32 x = 0; x < settings->ReceivedCapabilitiesSize; x++)
855 free(settings->ReceivedCapabilityData[x]);
856 settings->ReceivedCapabilityData[x] = NULL;
859 settings->ReceivedCapabilitiesSize = 0;
861 free(settings->ReceivedCapabilityDataSizes);
862 settings->ReceivedCapabilityDataSizes = NULL;
864 free(settings->ReceivedCapabilityData);
865 settings->ReceivedCapabilityData = NULL;
866 free(settings->ReceivedCapabilities);
867 settings->ReceivedCapabilities = NULL;
870 BOOL freerdp_capability_buffer_copy(rdpSettings* settings,
const rdpSettings* src)
872 WINPR_ASSERT(settings);
875 if (!freerdp_capability_buffer_allocate(settings, src->ReceivedCapabilitiesSize))
878 for (UINT32 x = 0; x < src->ReceivedCapabilitiesSize; x++)
880 WINPR_ASSERT(settings->ReceivedCapabilities);
881 settings->ReceivedCapabilities[x] = src->ReceivedCapabilities[x];
883 WINPR_ASSERT(settings->ReceivedCapabilityDataSizes);
884 settings->ReceivedCapabilityDataSizes[x] = src->ReceivedCapabilityDataSizes[x];
886 WINPR_ASSERT(settings->ReceivedCapabilityData);
887 if (src->ReceivedCapabilityDataSizes[x] > 0)
889 void* tmp = realloc(settings->ReceivedCapabilityData[x],
890 settings->ReceivedCapabilityDataSizes[x]);
893 memcpy(tmp, src->ReceivedCapabilityData[x], src->ReceivedCapabilityDataSizes[x]);
894 settings->ReceivedCapabilityData[x] = tmp;
898 free(settings->ReceivedCapabilityData[x]);
899 settings->ReceivedCapabilityData[x] = NULL;
905 void freerdp_target_net_addresses_free(rdpSettings* settings)
907 WINPR_ASSERT(settings);
909 if (settings->TargetNetAddresses)
911 for (UINT32 index = 0; index < settings->TargetNetAddressCount; index++)
912 free(settings->TargetNetAddresses[index]);
915 free(settings->TargetNetAddresses);
916 free(settings->TargetNetPorts);
917 settings->TargetNetAddressCount = 0;
918 settings->TargetNetAddresses = NULL;
919 settings->TargetNetPorts = NULL;
922 void freerdp_server_license_issuers_free(rdpSettings* settings)
924 WINPR_ASSERT(settings);
926 if (settings->ServerLicenseProductIssuers)
928 for (UINT32 x = 0; x < settings->ServerLicenseProductIssuersCount; x++)
929 free(settings->ServerLicenseProductIssuers[x]);
931 free(settings->ServerLicenseProductIssuers);
932 settings->ServerLicenseProductIssuers = NULL;
933 settings->ServerLicenseProductIssuersCount = 0;
936 BOOL freerdp_server_license_issuers_copy(rdpSettings* settings,
char** issuers, UINT32 count)
938 WINPR_ASSERT(settings);
939 WINPR_ASSERT(issuers || (count == 0));
945 for (UINT32 x = 0; x < count; x++)
947 char* issuer = _strdup(issuers[x]);
950 settings->ServerLicenseProductIssuers[x] = issuer;
956 void freerdp_performance_flags_make(rdpSettings* settings)
958 UINT32 PerformanceFlags = PERF_FLAG_NONE;
961 PerformanceFlags |= PERF_ENABLE_FONT_SMOOTHING;
964 PerformanceFlags |= PERF_ENABLE_DESKTOP_COMPOSITION;
967 PerformanceFlags |= PERF_DISABLE_WALLPAPER;
970 PerformanceFlags |= PERF_DISABLE_FULLWINDOWDRAG;
973 PerformanceFlags |= PERF_DISABLE_MENUANIMATIONS;
976 PerformanceFlags |= PERF_DISABLE_THEMING;
980 void freerdp_performance_flags_split(rdpSettings* settings)
983 settings, FreeRDP_AllowFontSmoothing,
985 PERF_ENABLE_FONT_SMOOTHING)
989 settings, FreeRDP_AllowDesktopComposition,
991 PERF_ENABLE_DESKTOP_COMPOSITION)
995 settings, FreeRDP_DisableWallpaper,
1000 settings, FreeRDP_DisableFullWindowDrag,
1002 PERF_DISABLE_FULLWINDOWDRAG)
1006 settings, FreeRDP_DisableMenuAnims,
1008 PERF_DISABLE_MENUANIMATIONS)
1012 settings, FreeRDP_DisableThemes,
1023 if (GatewayUsageMethod == TSC_PROXY_MODE_NONE_DIRECT)
1029 else if (GatewayUsageMethod == TSC_PROXY_MODE_DIRECT)
1035 else if (GatewayUsageMethod == TSC_PROXY_MODE_DETECT)
1041 else if (GatewayUsageMethod == TSC_PROXY_MODE_DEFAULT)
1052 else if (GatewayUsageMethod == TSC_PROXY_MODE_NONE_DETECT)
1062 void freerdp_update_gateway_usage_method(rdpSettings* settings, UINT32 GatewayEnabled,
1063 UINT32 GatewayBypassLocal)
1065 UINT32 GatewayUsageMethod = 0;
1067 if (!GatewayEnabled && !GatewayBypassLocal)
1068 GatewayUsageMethod = TSC_PROXY_MODE_NONE_DIRECT;
1069 else if (GatewayEnabled && !GatewayBypassLocal)
1070 GatewayUsageMethod = TSC_PROXY_MODE_DIRECT;
1071 else if (GatewayEnabled && GatewayBypassLocal)
1072 GatewayUsageMethod = TSC_PROXY_MODE_DETECT;
1077 #if defined(WITH_FREERDP_DEPRECATED)
1078 BOOL freerdp_get_param_bool(
const rdpSettings* settings,
int id)
1083 int freerdp_set_param_bool(rdpSettings* settings,
int id, BOOL param)
1088 int freerdp_get_param_int(
const rdpSettings* settings,
int id)
1093 int freerdp_set_param_int(rdpSettings* settings,
int id,
int param)
1098 UINT32 freerdp_get_param_uint32(
const rdpSettings* settings,
int id)
1103 int freerdp_set_param_uint32(rdpSettings* settings,
int id, UINT32 param)
1108 UINT64 freerdp_get_param_uint64(
const rdpSettings* settings,
int id)
1113 int freerdp_set_param_uint64(rdpSettings* settings,
int id, UINT64 param)
1118 char* freerdp_get_param_string(
const rdpSettings* settings,
int id)
1121 return WINPR_CAST_CONST_PTR_AWAY(str,
char*);
1124 int freerdp_set_param_string(rdpSettings* settings,
int id,
const char* param)
1130 static BOOL value_to_uint(
const char* value, ULONGLONG* result, ULONGLONG min, ULONGLONG max)
1132 char* endptr = NULL;
1133 unsigned long long rc = 0;
1135 if (!value || !result)
1139 rc = _strtoui64(value, &endptr, 0);
1144 if (endptr == value)
1147 if ((rc < min) || (rc > max))
1154 static BOOL value_to_int(
const char* value, LONGLONG* result, LONGLONG min, LONGLONG max)
1156 char* endptr = NULL;
1159 if (!value || !result)
1163 rc = _strtoi64(value, &endptr, 0);
1168 if (endptr == value)
1171 if ((rc < min) || (rc > max))
1178 static BOOL parsing_fail(
const char* key,
const char* type,
const char* value)
1180 WLog_ERR(TAG,
"Failed to parse key [%s] of type [%s]: value [%s]", key, type, value);
1184 BOOL freerdp_settings_set_value_for_name(rdpSettings* settings,
const char* name,
const char* value)
1190 if (!settings || !name)
1196 WLog_ERR(TAG,
"Invalid settings key [%s]", name);
1200 const SSIZE_T index = i;
1206 case RDP_SETTINGS_TYPE_BOOL:
1208 const BOOL val = (_strnicmp(value,
"TRUE", 5) == 0) || (_strnicmp(value,
"ON", 5) == 0);
1210 (_strnicmp(value,
"FALSE", 6) == 0) || (_strnicmp(value,
"OFF", 6) == 0);
1212 return parsing_fail(name,
"BOOL", value);
1217 case RDP_SETTINGS_TYPE_UINT16:
1218 if (!value_to_uint(value, &uval, 0, UINT16_MAX))
1219 return parsing_fail(name,
"UINT16", value);
1224 return parsing_fail(name,
"UINT16", value);
1227 case RDP_SETTINGS_TYPE_INT16:
1228 if (!value_to_int(value, &ival, INT16_MIN, INT16_MAX))
1229 return parsing_fail(name,
"INT16", value);
1234 return parsing_fail(name,
"INT16", value);
1236 case RDP_SETTINGS_TYPE_UINT32:
1237 if (!value_to_uint(value, &uval, 0, UINT32_MAX))
1238 return parsing_fail(name,
"UINT32", value);
1243 return parsing_fail(name,
"UINT32", value);
1245 case RDP_SETTINGS_TYPE_INT32:
1246 if (!value_to_int(value, &ival, INT32_MIN, INT32_MAX))
1247 return parsing_fail(name,
"INT32", value);
1252 return parsing_fail(name,
"INT32", value);
1254 case RDP_SETTINGS_TYPE_UINT64:
1255 if (!value_to_uint(value, &uval, 0, UINT64_MAX))
1256 return parsing_fail(name,
"UINT64", value);
1260 return parsing_fail(name,
"UINT64", value);
1262 case RDP_SETTINGS_TYPE_INT64:
1263 if (!value_to_int(value, &ival, INT64_MIN, INT64_MAX))
1264 return parsing_fail(name,
"INT64", value);
1268 return parsing_fail(name,
"INT64", value);
1271 case RDP_SETTINGS_TYPE_STRING:
1275 case RDP_SETTINGS_TYPE_POINTER:
1276 return parsing_fail(name,
"POINTER", value);
1283 BOOL freerdp_settings_set_pointer_len_(rdpSettings* settings, FreeRDP_Settings_Keys_Pointer
id,
1284 SSIZE_T lenId,
const void* data,
size_t len,
size_t size)
1298 if (len > UINT32_MAX)
1302 copy = calloc(len, size);
1306 memcpy(copy, data, len * size);
1322 FreeRDP_Settings_Keys_Pointer
id)
1326 const rdpSettings* pc;
1334 const void* data,
size_t len)
1348 case FreeRDP_RdpServerCertificate:
1349 freerdp_certificate_free(settings->RdpServerCertificate);
1353 WLog_ERR(TAG,
"FreeRDP_RdpServerCertificate::len must be 0 or 1");
1356 settings->RdpServerCertificate = cnv.v;
1357 if (!settings->RdpServerCertificate && (len > 0))
1359 settings->RdpServerCertificate = freerdp_certificate_new();
1360 if (!settings->RdpServerCertificate)
1364 case FreeRDP_RdpServerRsaKey:
1365 freerdp_key_free(settings->RdpServerRsaKey);
1368 WLog_ERR(TAG,
"FreeRDP_RdpServerRsaKey::len must be 0 or 1");
1371 settings->RdpServerRsaKey = (rdpPrivateKey*)cnv.v;
1372 if (!settings->RdpServerRsaKey && (len > 0))
1374 settings->RdpServerRsaKey = freerdp_key_new();
1375 if (!settings->RdpServerRsaKey)
1379 case FreeRDP_RedirectionPassword:
1380 return freerdp_settings_set_pointer_len_(
1381 settings,
id, FreeRDP_RedirectionPasswordLength, data, len,
sizeof(
char));
1382 case FreeRDP_RedirectionTsvUrl:
1383 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_RedirectionTsvUrlLength,
1384 data, len,
sizeof(
char));
1385 case FreeRDP_RedirectionTargetCertificate:
1386 freerdp_certificate_free(settings->RedirectionTargetCertificate);
1390 WLog_ERR(TAG,
"FreeRDP_RedirectionTargetCertificate::len must be 0 or 1");
1393 settings->RedirectionTargetCertificate = cnv.v;
1394 if (!settings->RedirectionTargetCertificate && (len > 0))
1396 settings->RedirectionTargetCertificate = freerdp_certificate_new();
1397 if (!settings->RedirectionTargetCertificate)
1401 case FreeRDP_RedirectionGuid:
1402 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_RedirectionGuidLength,
1403 data, len,
sizeof(BYTE));
1404 case FreeRDP_LoadBalanceInfo:
1405 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_LoadBalanceInfoLength,
1406 data, len,
sizeof(
char));
1407 case FreeRDP_ServerRandom:
1408 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_ServerRandomLength, data,
1410 case FreeRDP_ClientRandom:
1411 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_ClientRandomLength, data,
1413 case FreeRDP_ServerCertificate:
1414 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_ServerCertificateLength,
1415 data, len,
sizeof(
char));
1416 case FreeRDP_TargetNetAddresses:
1417 if ((data == NULL) && (len == 0))
1419 freerdp_target_net_addresses_free(settings);
1424 "[BUG] FreeRDP_TargetNetAddresses must not be resized from outside the library!");
1426 case FreeRDP_ServerLicenseProductIssuers:
1428 freerdp_server_license_issuers_free(settings);
1429 return freerdp_settings_set_pointer_len_(settings, FreeRDP_ServerLicenseProductIssuers,
1430 FreeRDP_ServerLicenseProductIssuersCount, data,
1431 len,
sizeof(
char*));
1432 case FreeRDP_TargetNetPorts:
1433 if ((data == NULL) && (len == 0))
1435 freerdp_target_net_addresses_free(settings);
1439 "[BUG] FreeRDP_TargetNetPorts must not be resized from outside the library!");
1441 case FreeRDP_DeviceArray:
1443 freerdp_device_collection_free(settings);
1444 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_DeviceArraySize, data,
1446 case FreeRDP_ChannelDefArray:
1447 if ((len > 0) && (len < CHANNEL_MAX_COUNT))
1449 "FreeRDP_ChannelDefArray::len expected to be >= %" PRIu32
1450 ", but have %" PRIu32,
1451 CHANNEL_MAX_COUNT, len);
1452 return freerdp_settings_set_pointer_len_(settings, FreeRDP_ChannelDefArray,
1453 FreeRDP_ChannelDefArraySize, data, len,
1455 case FreeRDP_MonitorDefArray:
1456 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_MonitorDefArraySize,
1458 case FreeRDP_ClientAutoReconnectCookie:
1459 return freerdp_settings_set_pointer_len_(settings,
id, -1, data, len,
1461 case FreeRDP_ServerAutoReconnectCookie:
1462 return freerdp_settings_set_pointer_len_(settings,
id, -1, data, len,
1464 case FreeRDP_ClientTimeZone:
1467 WLog_ERR(TAG,
"FreeRDP_ClientTimeZone::len must be 0 or 1");
1470 return freerdp_settings_set_pointer_len_(settings,
id, -1, data, len,
1472 case FreeRDP_BitmapCacheV2CellInfo:
1473 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_BitmapCacheV2NumCells,
1475 case FreeRDP_GlyphCache:
1476 if ((len != 0) && (len != 10))
1478 WLog_ERR(TAG,
"FreeRDP_GlyphCache::len must be 0 or 10");
1481 return freerdp_settings_set_pointer_len_(settings,
id, -1, data, len,
1483 case FreeRDP_FragCache:
1486 WLog_ERR(TAG,
"FreeRDP_FragCache::len must be 0 or 1");
1489 return freerdp_settings_set_pointer_len_(settings,
id, -1, data, len,
1491 case FreeRDP_StaticChannelArray:
1493 freerdp_static_channel_collection_free(settings);
1494 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_StaticChannelArraySize,
1496 case FreeRDP_DynamicChannelArray:
1498 freerdp_dynamic_channel_collection_free(settings);
1499 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_DynamicChannelArraySize,
1501 case FreeRDP_ReceivedCapabilityData:
1503 freerdp_capability_buffer_free(settings);
1504 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_ReceivedCapabilitiesSize,
1505 data, len,
sizeof(BYTE*));
1506 case FreeRDP_ReceivedCapabilities:
1508 freerdp_capability_buffer_free(settings);
1509 return freerdp_settings_set_pointer_len_(settings,
id, FreeRDP_ReceivedCapabilitiesSize,
1510 data, len,
sizeof(
char));
1511 case FreeRDP_OrderSupport:
1512 return freerdp_settings_set_pointer_len_(settings,
id, -1, data, len,
sizeof(
char));
1514 case FreeRDP_MonitorIds:
1515 return freerdp_settings_set_pointer_len_(
1516 settings, FreeRDP_MonitorIds, FreeRDP_NumMonitorIds, data, len,
sizeof(UINT32));
1519 if ((data == NULL) && (len == 0))
1524 WLog_WARN(TAG,
"Invalid id %" PRIuz,
id);
1529 void* freerdp_settings_get_pointer_array_writable(
const rdpSettings* settings,
1530 FreeRDP_Settings_Keys_Pointer
id,
size_t offset)
1537 case FreeRDP_ClientAutoReconnectCookie:
1539 if ((offset >= max) || !settings->ClientAutoReconnectCookie)
1541 return &settings->ClientAutoReconnectCookie[offset];
1542 case FreeRDP_ServerAutoReconnectCookie:
1544 if ((offset >= max) || !settings->ServerAutoReconnectCookie)
1546 return &settings->ServerAutoReconnectCookie[offset];
1547 case FreeRDP_ServerCertificate:
1551 return &settings->ServerCertificate[offset];
1552 case FreeRDP_ServerRandom:
1556 return &settings->ServerRandom[offset];
1557 case FreeRDP_ClientRandom:
1561 return &settings->ClientRandom[offset];
1562 case FreeRDP_LoadBalanceInfo:
1566 return &settings->LoadBalanceInfo[offset];
1568 case FreeRDP_RedirectionTsvUrl:
1572 return &settings->RedirectionTsvUrl[offset];
1574 case FreeRDP_RedirectionPassword:
1578 return &settings->RedirectionPassword[offset];
1580 case FreeRDP_OrderSupport:
1584 return &settings->OrderSupport[offset];
1585 case FreeRDP_MonitorIds:
1589 return &settings->MonitorIds[offset];
1590 case FreeRDP_MonitorDefArray:
1594 return &settings->MonitorDefArray[offset];
1595 case FreeRDP_ChannelDefArray:
1599 return &settings->ChannelDefArray[offset];
1600 case FreeRDP_DeviceArray:
1604 return settings->DeviceArray[offset];
1605 case FreeRDP_StaticChannelArray:
1609 return settings->StaticChannelArray[offset];
1610 case FreeRDP_DynamicChannelArray:
1614 return settings->DynamicChannelArray[offset];
1615 case FreeRDP_FragCache:
1619 return &settings->FragCache[offset];
1620 case FreeRDP_GlyphCache:
1624 return &settings->GlyphCache[offset];
1625 case FreeRDP_BitmapCacheV2CellInfo:
1629 return &settings->BitmapCacheV2CellInfo[offset];
1630 case FreeRDP_ReceivedCapabilities:
1634 return &settings->ReceivedCapabilities[offset];
1635 case FreeRDP_TargetNetAddresses:
1639 return settings->TargetNetAddresses[offset];
1640 case FreeRDP_TargetNetPorts:
1644 return &settings->TargetNetPorts[offset];
1645 case FreeRDP_ClientTimeZone:
1649 return settings->ClientTimeZone;
1650 case FreeRDP_RdpServerCertificate:
1654 return settings->RdpServerCertificate;
1655 case FreeRDP_RdpServerRsaKey:
1659 return settings->RdpServerRsaKey;
1666 WLog_WARN(TAG,
"Invalid offset for %s [%" PRIuz
"]: size=%" PRIuz
", offset=%" PRIuz,
1671 BOOL freerdp_settings_set_pointer_array(rdpSettings* settings, FreeRDP_Settings_Keys_Pointer
id,
1672 size_t offset,
const void* data)
1674 size_t maxOffset = 0;
1679 case FreeRDP_ClientAutoReconnectCookie:
1681 if ((offset >= maxOffset) || !data || !settings->ClientAutoReconnectCookie)
1685 case FreeRDP_ServerAutoReconnectCookie:
1687 if ((offset >= maxOffset) || !data || !settings->ServerAutoReconnectCookie)
1691 case FreeRDP_ServerCertificate:
1693 if ((offset >= maxOffset) || !data)
1695 settings->ServerCertificate[offset] = *(
const BYTE*)data;
1697 case FreeRDP_DeviceArray:
1699 if (offset >= maxOffset)
1701 freerdp_device_free(settings->DeviceArray[offset]);
1702 settings->DeviceArray[offset] = freerdp_device_clone(data);
1704 case FreeRDP_TargetNetAddresses:
1706 if ((offset >= maxOffset) || !data)
1708 free(settings->TargetNetAddresses[offset]);
1709 settings->TargetNetAddresses[offset] = _strdup((
const char*)data);
1710 return settings->TargetNetAddresses[offset] != NULL;
1711 case FreeRDP_TargetNetPorts:
1713 if ((offset >= maxOffset) || !data)
1715 settings->TargetNetPorts[offset] = *((
const UINT32*)data);
1717 case FreeRDP_StaticChannelArray:
1719 if ((offset >= maxOffset) || !data)
1721 freerdp_addin_argv_free(settings->StaticChannelArray[offset]);
1722 settings->StaticChannelArray[offset] = freerdp_addin_argv_clone(data);
1724 case FreeRDP_DynamicChannelArray:
1726 if ((offset >= maxOffset) || !data)
1728 freerdp_addin_argv_free(settings->DynamicChannelArray[offset]);
1729 settings->DynamicChannelArray[offset] = freerdp_addin_argv_clone(data);
1731 case FreeRDP_BitmapCacheV2CellInfo:
1733 if ((offset >= maxOffset) || !data)
1737 settings->BitmapCacheV2CellInfo[offset] = *cdata;
1740 case FreeRDP_ServerRandom:
1742 if ((offset >= maxOffset) || !data)
1744 settings->ServerRandom[offset] = *(
const BYTE*)data;
1746 case FreeRDP_ClientRandom:
1748 if ((offset >= maxOffset) || !data)
1750 settings->ClientRandom[offset] = *(
const BYTE*)data;
1752 case FreeRDP_LoadBalanceInfo:
1754 if ((offset >= maxOffset) || !data)
1756 settings->LoadBalanceInfo[offset] = *(
const BYTE*)data;
1758 case FreeRDP_RedirectionTsvUrl:
1760 if ((offset >= maxOffset) || !data)
1762 settings->RedirectionTsvUrl[offset] = *(
const BYTE*)data;
1764 case FreeRDP_RedirectionPassword:
1766 if ((offset >= maxOffset) || !data)
1768 settings->RedirectionPassword[offset] = *(
const BYTE*)data;
1770 case FreeRDP_OrderSupport:
1772 if (!settings->OrderSupport)
1774 if ((offset >= maxOffset) || !data)
1776 settings->OrderSupport[offset] = *(
const BOOL*)data;
1778 case FreeRDP_GlyphCache:
1780 if (!settings->GlyphCache)
1782 if ((offset >= maxOffset) || !data)
1786 case FreeRDP_FragCache:
1788 if (!settings->FragCache)
1790 if ((offset >= maxOffset) || !data)
1794 case FreeRDP_MonitorIds:
1796 if ((offset >= maxOffset) || !data)
1798 settings->MonitorIds[offset] = *(
const UINT32*)data;
1800 case FreeRDP_ChannelDefArray:
1802 if ((offset >= maxOffset) || !data)
1804 settings->ChannelDefArray[offset] = *(
const CHANNEL_DEF*)data;
1806 case FreeRDP_MonitorDefArray:
1808 if ((offset >= maxOffset) || !data)
1810 settings->MonitorDefArray[offset] = *(
const rdpMonitor*)data;
1813 case FreeRDP_ClientTimeZone:
1815 if ((offset >= maxOffset) || !data || !settings->ClientTimeZone)
1826 WLog_WARN(TAG,
"[%s] Invalid offset=%" PRIuz
" [%" PRIuz
"] or NULL data=%p",
1831 const void* freerdp_settings_get_pointer_array(
const rdpSettings* settings,
1832 FreeRDP_Settings_Keys_Pointer
id,
size_t offset)
1834 return freerdp_settings_get_pointer_array_writable(settings,
id, offset);
1839 UINT32 flags = FREERDP_CODEC_ALL;
1840 if (settings->RemoteFxCodec == FALSE)
1842 flags &= ~FREERDP_CODEC_REMOTEFX;
1844 if (settings->NSCodec == FALSE)
1846 flags &= ~FREERDP_CODEC_NSCODEC;
1854 WINPR_ASSERT(settings);
1855 const char* hostname = settings->ServerHostname;
1857 if (settings->UserSpecifiedServerName)
1858 hostname = settings->UserSpecifiedServerName;
1863 #if defined(WITH_FREERDP_DEPRECATED)
1866 return freerdp_addin_argv_clone(channel);
1871 return freerdp_addin_argv_clone(channel);
1875 BOOL freerdp_target_net_addresses_copy(rdpSettings* settings,
char** addresses, UINT32 count)
1877 WINPR_ASSERT(settings);
1878 WINPR_ASSERT(addresses);
1880 if (!freerdp_target_net_adresses_reset(settings, count))
1883 for (UINT32 i = 0; i < settings->TargetNetAddressCount; i++)
1885 if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetAddresses, i,
1888 freerdp_target_net_addresses_free(settings);
1898 if (!what && !expect)
1900 if (!what || !expect)
1903 if (what->Id != expect->Id)
1905 if (what->Type != expect->Type)
1907 if (what->Name && expect->Name)
1909 if (strcmp(what->Name, expect->Name) != 0)
1914 if (what->Name != expect->Name)
1920 case RDPDR_DTYP_PRINT:
1924 if (a->DriverName && b->DriverName)
1925 return strcmp(a->DriverName, b->DriverName) == 0;
1926 return a->DriverName == b->DriverName;
1929 case RDPDR_DTYP_SERIAL:
1934 if (a->Path && b->Path)
1936 if (strcmp(a->Path, b->Path) != 0)
1939 else if (a->Path != b->Path)
1942 if (a->Driver && b->Driver)
1944 if (strcmp(a->Driver, b->Driver) != 0)
1947 else if (a->Driver != b->Driver)
1949 if (a->Permissive && b->Permissive)
1950 return strcmp(a->Permissive, b->Permissive) == 0;
1951 return a->Permissive == b->Permissive;
1954 case RDPDR_DTYP_PARALLEL:
1958 if (a->Path && b->Path)
1959 return strcmp(a->Path, b->Path) == 0;
1960 return a->Path == b->Path;
1963 case RDPDR_DTYP_SMARTCARD:
1965 case RDPDR_DTYP_FILESYSTEM:
1969 if (a->automount != b->automount)
1971 if (a->Path && b->Path)
1972 return strcmp(a->Path, b->Path) == 0;
1973 return a->Path == b->Path;
1986 RAIL_LEVEL_SUPPORTED | RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED |
1987 RAIL_LEVEL_SHELL_INTEGRATION_SUPPORTED | RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED |
1988 RAIL_LEVEL_SERVER_TO_CLIENT_IME_SYNC_SUPPORTED | RAIL_LEVEL_HIDE_MINIMIZED_APPS_SUPPORTED |
1989 RAIL_LEVEL_WINDOW_CLOAKING_SUPPORTED | RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED;
1991 if (flags & RAIL_LEVEL_SUPPORTED)
1992 winpr_str_append(
"RAIL_LEVEL_SUPPORTED", buffer, length,
"|");
1993 if (flags & RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED)
1994 winpr_str_append(
"RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED", buffer, length,
"|");
1995 if (flags & RAIL_LEVEL_SHELL_INTEGRATION_SUPPORTED)
1996 winpr_str_append(
"RAIL_LEVEL_SHELL_INTEGRATION_SUPPORTED", buffer, length,
"|");
1997 if (flags & RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED)
1998 winpr_str_append(
"RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED", buffer, length,
"|");
1999 if (flags & RAIL_LEVEL_SERVER_TO_CLIENT_IME_SYNC_SUPPORTED)
2000 winpr_str_append(
"RAIL_LEVEL_SERVER_TO_CLIENT_IME_SYNC_SUPPORTED", buffer, length,
"|");
2001 if (flags & RAIL_LEVEL_HIDE_MINIMIZED_APPS_SUPPORTED)
2002 winpr_str_append(
"RAIL_LEVEL_HIDE_MINIMIZED_APPS_SUPPORTED", buffer, length,
"|");
2003 if (flags & RAIL_LEVEL_WINDOW_CLOAKING_SUPPORTED)
2004 winpr_str_append(
"RAIL_LEVEL_WINDOW_CLOAKING_SUPPORTED", buffer, length,
"|");
2005 if (flags & RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED)
2006 winpr_str_append(
"RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED", buffer, length,
"|");
2007 if (flags & RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED)
2008 winpr_str_append(
"RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED", buffer, length,
"|");
2009 if ((flags & ~mask) != 0)
2011 char tbuffer[64] = { 0 };
2012 (void)_snprintf(tbuffer,
sizeof(tbuffer),
"RAIL_FLAG_UNKNOWN 0x%08" PRIx32, flags & mask);
2013 winpr_str_append(tbuffer, buffer, length,
"|");
2019 const BYTE** capsData,
const UINT32* capsSizes,
2020 UINT32 capsCount, BOOL serverReceivedCaps)
2022 WINPR_ASSERT(settings);
2023 WINPR_ASSERT(capsFlags || (capsCount == 0));
2024 WINPR_ASSERT(capsData || (capsCount == 0));
2025 WINPR_ASSERT(capsSizes || (capsCount == 0));
2026 WINPR_ASSERT(capsCount <= UINT16_MAX);
2028 for (UINT32 x = 0; x < capsCount; x++)
2033 wStream* sub = Stream_StaticConstInit(&buffer, capsData[x], capsSizes[x]);
2035 if (!rdp_read_capability_set(sub, (UINT16)x, settings, serverReceivedCaps))
2048 return "RDP_VERSION_4";
2049 case RDP_VERSION_5_PLUS:
2050 return "RDP_VERSION_5_PLUS";
2051 case RDP_VERSION_10_0:
2052 return "RDP_VERSION_10_0";
2053 case RDP_VERSION_10_1:
2054 return "RDP_VERSION_10_1";
2055 case RDP_VERSION_10_2:
2056 return "RDP_VERSION_10_2";
2057 case RDP_VERSION_10_3:
2058 return "RDP_VERSION_10_3";
2059 case RDP_VERSION_10_4:
2060 return "RDP_VERSION_10_4";
2061 case RDP_VERSION_10_5:
2062 return "RDP_VERSION_10_5";
2063 case RDP_VERSION_10_6:
2064 return "RDP_VERSION_10_6";
2065 case RDP_VERSION_10_7:
2066 return "RDP_VERSION_10_7";
2067 case RDP_VERSION_10_8:
2068 return "RDP_VERSION_10_8";
2069 case RDP_VERSION_10_9:
2070 return "RDP_VERSION_10_9";
2071 case RDP_VERSION_10_10:
2072 return "RDP_VERSION_10_10";
2073 case RDP_VERSION_10_11:
2074 return "RDP_VERSION_10_11";
2075 case RDP_VERSION_10_12:
2076 return "RDP_VERSION_10_12";
2078 return "RDP_VERSION_UNKNOWN";
2085 WINPR_ASSERT(settings);
2088 return freerdp_settings_set_string_copy_(settings,
id, NULL, 0, TRUE);
2092 char* str = ConvertWCharToUtf8Alloc(param, &len);
2093 if (!str && (len != 0))
2096 return freerdp_settings_set_string_(settings,
id, str, len);
2100 const WCHAR* param,
size_t length)
2104 WINPR_ASSERT(settings);
2107 return freerdp_settings_set_string_copy_(settings,
id, NULL, length, TRUE);
2109 char* str = ConvertWCharNToUtf8Alloc(param, length, &len);
2110 if (!str && (length != 0))
2114 const size_t wlen = _wcsnlen(param, length);
2119 return freerdp_settings_set_string_(settings,
id, str, len);
2123 FreeRDP_Settings_Keys_String
id,
size_t* pCharLen)
2130 return ConvertUtf8ToWCharAlloc(str, pCharLen);
2137 case RDPDR_DTYP_FILESYSTEM:
2138 return "RDPDR_DTYP_FILESYSTEM";
2139 case RDPDR_DTYP_PARALLEL:
2140 return "RDPDR_DTYP_PARALLEL";
2141 case RDPDR_DTYP_PRINT:
2142 return "RDPDR_DTYP_PRINT";
2143 case RDPDR_DTYP_SERIAL:
2144 return "RDPDR_DTYP_SERIAL";
2145 case RDPDR_DTYP_SMARTCARD:
2146 return "RDPDR_DTYP_SMARTCARD";
2148 return "RDPDR_DTYP_UNKNOWN";
2152 const char* freerdp_encryption_level_string(UINT32 EncryptionLevel)
2154 switch (EncryptionLevel)
2156 case ENCRYPTION_LEVEL_NONE:
2157 return "ENCRYPTION_LEVEL_NONE";
2158 case ENCRYPTION_LEVEL_LOW:
2159 return "ENCRYPTION_LEVEL_LOW";
2160 case ENCRYPTION_LEVEL_CLIENT_COMPATIBLE:
2161 return "ENCRYPTION_LEVEL_CLIENT_COMPATIBLE";
2162 case ENCRYPTION_LEVEL_HIGH:
2163 return "ENCRYPTION_LEVEL_HIGH";
2164 case ENCRYPTION_LEVEL_FIPS:
2165 return "ENCRYPTION_LEVEL_FIPS";
2167 return "ENCRYPTION_LEVEL_UNKNOWN";
2171 const char* freerdp_encryption_methods_string(UINT32 EncryptionMethods,
char* buffer,
size_t size)
2173 if (EncryptionMethods == ENCRYPTION_METHOD_NONE)
2175 winpr_str_append(
"ENCRYPTION_METHOD_NONE", buffer, size,
"|");
2179 if (EncryptionMethods & ENCRYPTION_METHOD_40BIT)
2181 winpr_str_append(
"ENCRYPTION_METHOD_40BIT", buffer, size,
"|");
2183 if (EncryptionMethods & ENCRYPTION_METHOD_128BIT)
2185 winpr_str_append(
"ENCRYPTION_METHOD_128BIT", buffer, size,
"|");
2187 if (EncryptionMethods & ENCRYPTION_METHOD_56BIT)
2189 winpr_str_append(
"ENCRYPTION_METHOD_56BIT", buffer, size,
"|");
2191 if (EncryptionMethods & ENCRYPTION_METHOD_FIPS)
2193 winpr_str_append(
"ENCRYPTION_METHOD_FIPS", buffer, size,
"|");
2201 const UINT32 invalid = mask & ~(RNS_UD_32BPP_SUPPORT | RNS_UD_24BPP_SUPPORT |
2202 RNS_UD_16BPP_SUPPORT | RNS_UD_15BPP_SUPPORT);
2204 if (mask & RNS_UD_32BPP_SUPPORT)
2205 winpr_str_append(
"RNS_UD_32BPP_SUPPORT", buffer, size,
"|");
2206 if (mask & RNS_UD_24BPP_SUPPORT)
2207 winpr_str_append(
"RNS_UD_24BPP_SUPPORT", buffer, size,
"|");
2208 if (mask & RNS_UD_16BPP_SUPPORT)
2209 winpr_str_append(
"RNS_UD_16BPP_SUPPORT", buffer, size,
"|");
2210 if (mask & RNS_UD_15BPP_SUPPORT)
2211 winpr_str_append(
"RNS_UD_15BPP_SUPPORT", buffer, size,
"|");
2215 char str[32] = { 0 };
2216 (void)_snprintf(str,
sizeof(str),
"RNS_UD_INVALID[0x%04" PRIx32
"]", invalid);
2217 winpr_str_append(str, buffer, size,
"|");
2219 char hex[32] = { 0 };
2220 (void)_snprintf(hex,
sizeof(hex),
"[0x%04" PRIx16
"]", mask);
2225 const char* separator,
const char* param)
2233 winpr_asprintf(&str, &len,
"%s", param);
2234 else if (!separator)
2235 winpr_asprintf(&str, &len,
"%s%s", old, param);
2237 winpr_asprintf(&str, &len,
"%s%s%s", old, separator, param);
2246 return settings != NULL;
FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
BOOL freerdp_settings_update_from_caps(rdpSettings *settings, const BYTE *capsFlags, const BYTE **capsData, const UINT32 *capsSizes, UINT32 capsCount, BOOL serverReceivedCaps)
Parse capability data and apply to settings.
FREERDP_API BOOL freerdp_settings_set_string(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const char *param)
Sets a string settings value. The param is copied.
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
const void * freerdp_settings_get_pointer(const rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id)
Returns a immutable pointer settings value.
BOOL freerdp_settings_set_string_from_utf16N(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const WCHAR *param, size_t length)
Sets a string settings value. The param is converted to UTF-8 and the copy stored.
FREERDP_API SSIZE_T freerdp_settings_get_type_for_key(SSIZE_T key)
Get a key type for the key index.
BOOL freerdp_settings_are_valid(const rdpSettings *settings)
Returns TRUE if settings are in a valid state, FALSE otherwise.
FREERDP_API UINT64 freerdp_settings_get_uint64(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt64 id)
Returns a UINT64 settings value.
FREERDP_API SSIZE_T freerdp_settings_get_key_for_name(const char *value)
Get a key index for the name string of that key.
FREERDP_API const char * freerdp_settings_get_string(const rdpSettings *settings, FreeRDP_Settings_Keys_String id)
Returns a immutable string settings value.
const char * freerdp_rail_support_flags_to_string(UINT32 flags, char *buffer, size_t length)
Returns a stringified representation of RAIL support flags.
BOOL freerdp_settings_set_pointer_len(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id, const void *data, size_t len)
Set a pointer to value data.
const char * freerdp_supported_color_depths_string(UINT16 mask, char *buffer, size_t size)
returns a string representation of RNS_UD_XXBPP_SUPPORT values
FREERDP_API BOOL freerdp_settings_set_int32(rdpSettings *settings, FreeRDP_Settings_Keys_Int32 id, INT32 param)
Sets a INT32 settings value.
const char * freerdp_rdpdr_dtyp_string(UINT32 type)
Returns a string representation of RDPDR_DTYP_*.
const char * freerdp_settings_get_server_name(const rdpSettings *settings)
A helper function to return the correct server name.
BOOL freerdp_device_collection_del(rdpSettings *settings, const RDPDR_DEVICE *device)
Removed a device from the settings, returns ownership of the allocated device to caller.
BOOL freerdp_set_gateway_usage_method(rdpSettings *settings, UINT32 GatewayUsageMethod)
FREERDP_API BOOL freerdp_settings_set_uint64(rdpSettings *settings, FreeRDP_Settings_Keys_UInt64 id, UINT64 param)
Sets a UINT64 settings value.
WCHAR * freerdp_settings_get_string_as_utf16(const rdpSettings *settings, FreeRDP_Settings_Keys_String id, size_t *pCharLen)
Return an allocated UTF16 string.
FREERDP_API BOOL freerdp_settings_set_int16(rdpSettings *settings, FreeRDP_Settings_Keys_Int16 id, INT16 param)
Sets a INT16 settings value.
FREERDP_API BOOL freerdp_settings_set_int64(rdpSettings *settings, FreeRDP_Settings_Keys_Int64 id, INT64 param)
Sets a INT64 settings value.
BOOL freerdp_settings_set_string_from_utf16(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const WCHAR *param)
Sets a string settings value. The param is converted to UTF-8 and the copy stored.
FREERDP_API BOOL freerdp_settings_set_pointer(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id, const void *data)
Set a pointer to value data.
FREERDP_API INT32 freerdp_settings_get_int32(const rdpSettings *settings, FreeRDP_Settings_Keys_Int32 id)
Returns a INT32 settings value.
UINT32 freerdp_settings_get_codecs_flags(const rdpSettings *settings)
helper function to get a mask of supported codec flags.
const char * freerdp_rdp_version_string(UINT32 version)
Returns a stringified representation of the RDP protocol version.
FREERDP_API BOOL freerdp_settings_set_string_len(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const char *param, size_t len)
Sets a string settings value. The param is copied.
FREERDP_API BOOL freerdp_settings_set_uint32(rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id, UINT32 param)
Sets a UINT32 settings value.
BOOL freerdp_settings_append_string(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const char *separator, const char *param)
appends a string to a settings value. The param is copied. If the initial value of the setting was no...
FREERDP_API BOOL freerdp_settings_set_uint16(rdpSettings *settings, FreeRDP_Settings_Keys_UInt16 id, UINT16 param)
Sets a UINT16 settings value.
FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings *settings, FreeRDP_Settings_Keys_Bool id, BOOL param)
Sets a BOOL settings value.
FREERDP_API void * freerdp_settings_get_pointer_writable(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id)
Returns a mutable pointer settings value.
FREERDP_API const char * freerdp_settings_get_name_for_key(SSIZE_T key)
Returns the type name for a key.