[settings] fix type mismatch warnings

This commit is contained in:
Armin Novak 2023-10-16 19:37:36 +02:00 committed by akallabeth
parent cda6239119
commit 6e6559c41a
14 changed files with 130 additions and 104 deletions

View File

@ -838,7 +838,7 @@ fail:
return FALSE;
}
static BOOL read_pem_file(rdpSettings* settings, size_t id, const char* file)
static BOOL read_pem_file(rdpSettings* settings, FreeRDP_Settings_Keys_String id, const char* file)
{
size_t length = 0;
char* pem = crypto_read_pem(file, &length);
@ -861,7 +861,7 @@ typedef BOOL (*CmdLineSubOptionCb)(const char* value, rdpSettings* settings);
typedef struct
{
const char* optname;
size_t id;
FreeRDP_Settings_Keys_String id;
CmdLineSubOptionType opttype;
CmdLineSubOptionCb cb;
} CmdLineSubOptions;
@ -1150,7 +1150,8 @@ static BOOL freerdp_parse_username_ptr(const char* username, const char** user,
}
static BOOL freerdp_parse_username_settings(const char* username, rdpSettings* settings,
size_t userID, size_t domainID)
FreeRDP_Settings_Keys_String userID,
FreeRDP_Settings_Keys_String domainID)
{
const char* user = NULL;
const char* domain = NULL;
@ -1239,7 +1240,7 @@ static BOOL freerdp_apply_connection_type(rdpSettings* settings, UINT32 type)
{
struct network_settings
{
size_t id;
FreeRDP_Settings_Keys_Bool id;
BOOL value[7];
};
const struct network_settings config[] = {
@ -1571,41 +1572,45 @@ static void freerdp_client_print_tune_list(const rdpSettings* settings)
{
case RDP_SETTINGS_TYPE_BOOL:
printf("%" PRIuz "\t%50s\tBOOL\t%s\n", x, name,
freerdp_settings_get_bool(settings, x) ? "TRUE" : "FALSE");
freerdp_settings_get_bool(settings, (FreeRDP_Settings_Keys_Bool)x)
? "TRUE"
: "FALSE");
break;
case RDP_SETTINGS_TYPE_UINT16:
printf("%" PRIuz "\t%50s\tUINT16\t%" PRIu16 "\n", x, name,
freerdp_settings_get_uint16(settings, x));
freerdp_settings_get_uint16(settings, (FreeRDP_Settings_Keys_UInt16)x));
break;
case RDP_SETTINGS_TYPE_INT16:
printf("%" PRIuz "\t%50s\tINT16\t%" PRId16 "\n", x, name,
freerdp_settings_get_int16(settings, x));
freerdp_settings_get_int16(settings, (FreeRDP_Settings_Keys_Int16)x));
break;
case RDP_SETTINGS_TYPE_UINT32:
printf("%" PRIuz "\t%50s\tUINT32\t%" PRIu32 "\n", x, name,
freerdp_settings_get_uint32(settings, x));
freerdp_settings_get_uint32(settings, (FreeRDP_Settings_Keys_UInt32)x));
break;
case RDP_SETTINGS_TYPE_INT32:
printf("%" PRIuz "\t%50s\tINT32\t%" PRId32 "\n", x, name,
freerdp_settings_get_int32(settings, x));
freerdp_settings_get_int32(settings, (FreeRDP_Settings_Keys_Int32)x));
break;
case RDP_SETTINGS_TYPE_UINT64:
printf("%" PRIuz "\t%50s\tUINT64\t%" PRIu64 "\n", x, name,
freerdp_settings_get_uint64(settings, x));
freerdp_settings_get_uint64(settings, (FreeRDP_Settings_Keys_UInt64)x));
break;
case RDP_SETTINGS_TYPE_INT64:
printf("%" PRIuz "\t%50s\tINT64\t%" PRId64 "\n", x, name,
freerdp_settings_get_int64(settings, x));
freerdp_settings_get_int64(settings, (FreeRDP_Settings_Keys_Int64)x));
break;
case RDP_SETTINGS_TYPE_STRING:
printf("%" PRIuz "\t%50s\tSTRING\t%s"
"\n",
x, name, freerdp_settings_get_string(settings, x));
x, name,
freerdp_settings_get_string(settings, (FreeRDP_Settings_Keys_String)x));
break;
case RDP_SETTINGS_TYPE_POINTER:
printf("%" PRIuz "\t%50s\tPOINTER\t%p"
"\n",
x, name, freerdp_settings_get_pointer(settings, x));
x, name,
freerdp_settings_get_pointer(settings, (FreeRDP_Settings_Keys_Pointer)x));
break;
default:
break;
@ -2358,9 +2363,10 @@ static int parse_kbd_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_
static int parse_app_option_program(rdpSettings* settings, const char* cmd)
{
const size_t ids[] = { FreeRDP_RemoteApplicationMode, FreeRDP_RemoteAppLanguageBarSupported,
FreeRDP_Workarea, FreeRDP_DisableWallpaper,
FreeRDP_DisableFullWindowDrag };
const FreeRDP_Settings_Keys_Bool ids[] = { FreeRDP_RemoteApplicationMode,
FreeRDP_RemoteAppLanguageBarSupported,
FreeRDP_Workarea, FreeRDP_DisableWallpaper,
FreeRDP_DisableFullWindowDrag };
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationProgram, cmd))
return COMMAND_LINE_ERROR_MEMORY;
@ -2388,7 +2394,7 @@ static int parse_app_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_
struct app_map
{
const char* name;
size_t id;
FreeRDP_Settings_Keys_String id;
int (*fkt)(rdpSettings* settings, const char* value);
};
const struct app_map amap[] = {
@ -2555,7 +2561,8 @@ static BOOL parse_gateway_host_option(rdpSettings* settings, const char* host)
return TRUE;
}
static BOOL parse_gateway_cred_option(rdpSettings* settings, const char* value, size_t what)
static BOOL parse_gateway_cred_option(rdpSettings* settings, const char* value,
FreeRDP_Settings_Keys_String what)
{
WINPR_ASSERT(settings);
WINPR_ASSERT(value);
@ -4040,7 +4047,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
}
const BOOL val = bval != PARSE_OFF;
FreeRDP_Settings_Keys_Bool id = 0;
FreeRDP_Settings_Keys_Bool id;
if (option_starts_with("rdp", cur)) /* Standard RDP */
{
id = FreeRDP_RdpSecurity;
@ -4070,9 +4077,10 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
if (singleOptionWithoutOnOff != 0)
{
const size_t options[] = { FreeRDP_AadSecurity, FreeRDP_UseRdpSecurityLayer,
FreeRDP_RdpSecurity, FreeRDP_NlaSecurity,
FreeRDP_TlsSecurity };
const FreeRDP_Settings_Keys_Bool options[] = {
FreeRDP_AadSecurity, FreeRDP_UseRdpSecurityLayer, FreeRDP_RdpSecurity,
FreeRDP_NlaSecurity, FreeRDP_TlsSecurity
};
for (size_t i = 0; i < ARRAYSIZE(options); i++)
{
@ -4357,14 +4365,18 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
else
{
const BOOL val = bval != PARSE_OFF;
size_t key = 0;
if (option_starts_with("relative", cur))
key = FreeRDP_MouseUseRelativeMove;
else if (option_starts_with("grab", cur))
key = FreeRDP_GrabMouse;
if (!freerdp_settings_set_bool(settings, key, val))
rc = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
if (option_starts_with("relative", cur))
{
if (!freerdp_settings_set_bool(settings, FreeRDP_MouseUseRelativeMove,
val))
rc = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
else if (option_starts_with("grab", cur))
{
if (!freerdp_settings_set_bool(settings, FreeRDP_GrabMouse, val))
rc = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
}
if (rc != 0)
@ -5170,7 +5182,7 @@ static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpS
typedef struct
{
size_t settingId;
FreeRDP_Settings_Keys_Bool settingId;
const char* channelName;
void* args;
} ChannelToLoad;

View File

@ -1055,7 +1055,7 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_
}
static INLINE BOOL FILE_POPULATE_STRING(char** _target, const rdpSettings* _settings,
size_t _option)
FreeRDP_Settings_Keys_String _option)
{
WINPR_ASSERT(_target);
WINPR_ASSERT(_settings);
@ -1084,7 +1084,8 @@ static char* freerdp_client_channel_args_to_string(const rdpSettings* settings,
ARRAYSIZE(filters));
}
static BOOL rdp_opt_duplicate(const rdpSettings* _settings, size_t _id, char** _key)
static BOOL rdp_opt_duplicate(const rdpSettings* _settings, FreeRDP_Settings_Keys_String _id,
char** _key)
{
WINPR_ASSERT(_settings);
WINPR_ASSERT(_key);
@ -1102,7 +1103,7 @@ static BOOL rdp_opt_duplicate(const rdpSettings* _settings, size_t _id, char** _
BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSettings* settings)
{
size_t index;
FreeRDP_Settings_Keys_String index;
UINT32 LoadBalanceInfoLength;
const char* GatewayHostname = NULL;
char* redirectCameras = NULL;
@ -1831,9 +1832,10 @@ BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, rdpSett
if (~((size_t)file->ShellWorkingDirectory))
{
/* ShellWorkingDir is used for either, shell working dir or remote app working dir */
size_t targetId = (~file->RemoteApplicationMode && file->RemoteApplicationMode != 0)
? FreeRDP_RemoteApplicationWorkingDir
: FreeRDP_ShellWorkingDirectory;
FreeRDP_Settings_Keys_String targetId =
(~file->RemoteApplicationMode && file->RemoteApplicationMode != 0)
? FreeRDP_RemoteApplicationWorkingDir
: FreeRDP_ShellWorkingDirectory;
if (!freerdp_settings_set_string(settings, targetId, file->ShellWorkingDirectory))
return FALSE;

View File

@ -283,7 +283,8 @@ BOOL pointer_cache_put(rdpPointerCache* pointer_cache, UINT32 index, rdpPointer*
BOOL colorCache)
{
rdpPointer* prevPointer;
const size_t id = colorCache ? FreeRDP_ColorPointerCacheSize : FreeRDP_PointerCacheSize;
const FreeRDP_Settings_Keys_UInt32 id =
colorCache ? FreeRDP_ColorPointerCacheSize : FreeRDP_PointerCacheSize;
WINPR_ASSERT(pointer_cache);
WINPR_ASSERT(pointer_cache->context);

View File

@ -1062,52 +1062,52 @@ void freerdp_update_gateway_usage_method(rdpSettings* settings, UINT32 GatewayEn
#if defined(WITH_FREERDP_DEPRECATED)
BOOL freerdp_get_param_bool(const rdpSettings* settings, int id)
{
return freerdp_settings_get_bool(settings, (size_t)id);
return freerdp_settings_get_bool(settings, (FreeRDP_Settings_Keys_Bool)id);
}
int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param)
{
return freerdp_settings_set_bool(settings, (size_t)id, param) ? 0 : -1;
return freerdp_settings_set_bool(settings, (FreeRDP_Settings_Keys_Bool)id, param) ? 0 : -1;
}
int freerdp_get_param_int(const rdpSettings* settings, int id)
{
return freerdp_settings_get_int32(settings, (size_t)id);
return freerdp_settings_get_int32(settings, (FreeRDP_Settings_Keys_Int32)id);
}
int freerdp_set_param_int(rdpSettings* settings, int id, int param)
{
return freerdp_settings_set_int32(settings, (size_t)id, param) ? 0 : -1;
return freerdp_settings_set_int32(settings, (FreeRDP_Settings_Keys_Int32)id, param) ? 0 : -1;
}
UINT32 freerdp_get_param_uint32(const rdpSettings* settings, int id)
{
return freerdp_settings_get_uint32(settings, (size_t)id);
return freerdp_settings_get_uint32(settings, (FreeRDP_Settings_Keys_UInt32)id);
}
int freerdp_set_param_uint32(rdpSettings* settings, int id, UINT32 param)
{
return freerdp_settings_set_uint32(settings, (size_t)id, param) ? 0 : -1;
return freerdp_settings_set_uint32(settings, (FreeRDP_Settings_Keys_UInt32)id, param) ? 0 : -1;
}
UINT64 freerdp_get_param_uint64(const rdpSettings* settings, int id)
{
return freerdp_settings_get_uint64(settings, (size_t)id);
return freerdp_settings_get_uint64(settings, (FreeRDP_Settings_Keys_UInt64)id);
}
int freerdp_set_param_uint64(rdpSettings* settings, int id, UINT64 param)
{
return freerdp_settings_set_uint64(settings, (size_t)id, param) ? 0 : -1;
return freerdp_settings_set_uint64(settings, (FreeRDP_Settings_Keys_UInt64)id, param) ? 0 : -1;
}
char* freerdp_get_param_string(const rdpSettings* settings, int id)
{
return (char*)freerdp_settings_get_string(settings, (size_t)id);
return (char*)freerdp_settings_get_string(settings, (FreeRDP_Settings_Keys_String)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;
return freerdp_settings_set_string(settings, (FreeRDP_Settings_Keys_String)id, param) ? 0 : -1;
}
#endif
@ -1192,48 +1192,49 @@ BOOL freerdp_settings_set_value_for_name(rdpSettings* settings, const char* name
BOOL val = _strnicmp(value, "TRUE", 5) == 0;
if (!val && _strnicmp(value, "FALSE", 6) != 0)
return parsing_fail(name, "BOOL", value);
return freerdp_settings_set_bool(settings, index, val);
return freerdp_settings_set_bool(settings, (FreeRDP_Settings_Keys_Bool)index, val);
}
case RDP_SETTINGS_TYPE_UINT16:
if (!value_to_uint(value, &uval, 0, UINT16_MAX))
return parsing_fail(name, "UINT16", value);
if (!freerdp_settings_set_uint16(settings, index, uval))
if (!freerdp_settings_set_uint16(settings, (FreeRDP_Settings_Keys_UInt16)index, uval))
return parsing_fail(name, "UINT16", value);
return TRUE;
case RDP_SETTINGS_TYPE_INT16:
if (!value_to_int(value, &ival, INT16_MIN, INT16_MAX))
return parsing_fail(name, "INT16", value);
if (!freerdp_settings_set_int16(settings, index, ival))
if (!freerdp_settings_set_int16(settings, (FreeRDP_Settings_Keys_Int16)index, ival))
return parsing_fail(name, "INT16", value);
return TRUE;
case RDP_SETTINGS_TYPE_UINT32:
if (!value_to_uint(value, &uval, 0, UINT32_MAX))
return parsing_fail(name, "UINT32", value);
if (!freerdp_settings_set_uint32(settings, index, uval))
if (!freerdp_settings_set_uint32(settings, (FreeRDP_Settings_Keys_UInt32)index, uval))
return parsing_fail(name, "UINT32", value);
return TRUE;
case RDP_SETTINGS_TYPE_INT32:
if (!value_to_int(value, &ival, INT32_MIN, INT32_MAX))
return parsing_fail(name, "INT32", value);
if (!freerdp_settings_set_int32(settings, index, ival))
if (!freerdp_settings_set_int32(settings, (FreeRDP_Settings_Keys_Int32)index, ival))
return parsing_fail(name, "INT32", value);
return TRUE;
case RDP_SETTINGS_TYPE_UINT64:
if (!value_to_uint(value, &uval, 0, UINT64_MAX))
return parsing_fail(name, "UINT64", value);
if (!freerdp_settings_set_uint64(settings, index, uval))
if (!freerdp_settings_set_uint64(settings, (FreeRDP_Settings_Keys_UInt64)index, uval))
return parsing_fail(name, "UINT64", value);
return TRUE;
case RDP_SETTINGS_TYPE_INT64:
if (!value_to_int(value, &ival, INT64_MIN, INT64_MAX))
return parsing_fail(name, "INT64", value);
if (!freerdp_settings_set_int64(settings, index, ival))
if (!freerdp_settings_set_int64(settings, (FreeRDP_Settings_Keys_Int64)index, ival))
return parsing_fail(name, "INT64", value);
return TRUE;
case RDP_SETTINGS_TYPE_STRING:
return freerdp_settings_set_string(settings, index, value);
return freerdp_settings_set_string(settings, (FreeRDP_Settings_Keys_String)index,
value);
case RDP_SETTINGS_TYPE_POINTER:
return parsing_fail(name, "POINTER", value);
default:
@ -1242,7 +1243,8 @@ BOOL freerdp_settings_set_value_for_name(rdpSettings* settings, const char* name
return FALSE;
}
static BOOL freerdp_settings_set_pointer_len_(rdpSettings* settings, size_t id, SSIZE_T lenId,
static BOOL freerdp_settings_set_pointer_len_(rdpSettings* settings,
FreeRDP_Settings_Keys_Pointer id, SSIZE_T lenId,
const void* data, size_t len, size_t size)
{
BOOL rc = FALSE;
@ -1253,7 +1255,7 @@ static BOOL freerdp_settings_set_pointer_len_(rdpSettings* settings, size_t id,
return FALSE;
if (lenId >= 0)
{
if (!freerdp_settings_set_uint32(settings, (size_t)lenId, 0))
if (!freerdp_settings_set_uint32(settings, (FreeRDP_Settings_Keys_UInt32)lenId, 0))
return FALSE;
}
@ -1272,7 +1274,7 @@ static BOOL freerdp_settings_set_pointer_len_(rdpSettings* settings, size_t id,
}
if (lenId < 0)
return TRUE;
return freerdp_settings_set_uint32(settings, (size_t)lenId, len);
return freerdp_settings_set_uint32(settings, (FreeRDP_Settings_Keys_UInt32)lenId, len);
}
const void* freerdp_settings_get_pointer(const rdpSettings* settings,

View File

@ -1520,8 +1520,8 @@ BOOL freerdp_settings_set_uint16(rdpSettings* settings, FreeRDP_Settings_Keys_UI
default:
WLog_ERR(TAG, "Invalid key index %" PRIuz " [%s|%s]", id,
freerdp_settings_get_name_for_key(id),
freerdp_settings_get_type_name_for_key(id));
freerdp_settings_get_name_for_key((size_t)id),
freerdp_settings_get_type_name_for_key((size_t)id));
return FALSE;
}
return TRUE;
@ -1558,8 +1558,8 @@ BOOL freerdp_settings_set_int16(rdpSettings* settings, FreeRDP_Settings_Keys_Int
{
default:
WLog_ERR(TAG, "Invalid key index %" PRIuz " [%s|%s]", id,
freerdp_settings_get_name_for_key(id),
freerdp_settings_get_type_name_for_key(id));
freerdp_settings_get_name_for_key((size_t)id),
freerdp_settings_get_type_name_for_key((size_t)id));
return FALSE;
}
return TRUE;
@ -2569,8 +2569,8 @@ INT64 freerdp_settings_get_int64(const rdpSettings* settings, FreeRDP_Settings_K
{
default:
WLog_ERR(TAG, "Invalid key index %" PRIuz " [%s|%s]", id,
freerdp_settings_get_name_for_key(id),
freerdp_settings_get_type_name_for_key(id));
freerdp_settings_get_name_for_key((size_t)id),
freerdp_settings_get_type_name_for_key((size_t)id));
return 0;
}
}
@ -2592,8 +2592,8 @@ BOOL freerdp_settings_set_int64(rdpSettings* settings, FreeRDP_Settings_Keys_Int
{
default:
WLog_ERR(TAG, "Invalid key index %" PRIuz " [%s|%s]", id,
freerdp_settings_get_name_for_key(id),
freerdp_settings_get_type_name_for_key(id));
freerdp_settings_get_name_for_key((size_t)id),
freerdp_settings_get_type_name_for_key((size_t)id));
return FALSE;
}
return TRUE;

View File

@ -1946,12 +1946,12 @@ static void rdp_write_bitmap_cache_cell_info(wStream* s, BITMAP_CACHE_V2_CELL_IN
static BOOL rdp_apply_bitmap_cache_v2_capability_set(rdpSettings* settings, const rdpSettings* src)
{
size_t x;
const size_t keys[] = { FreeRDP_BitmapCacheEnabled, FreeRDP_BitmapCachePersistEnabled };
const FreeRDP_Settings_Keys_Bool keys[] = { FreeRDP_BitmapCacheEnabled,
FreeRDP_BitmapCachePersistEnabled };
for (x = 0; x < ARRAYSIZE(keys); x++)
for (size_t x = 0; x < ARRAYSIZE(keys); x++)
{
const size_t id = keys[x];
const FreeRDP_Settings_Keys_Bool id = keys[x];
const BOOL val = freerdp_settings_get_bool(src, id);
if (!freerdp_settings_set_bool(settings, id, val))
return FALSE;
@ -1964,7 +1964,7 @@ static BOOL rdp_apply_bitmap_cache_v2_capability_set(rdpSettings* settings, cons
BitmapCacheV2NumCells))
return FALSE;
for (x = 0; x < BitmapCacheV2NumCells; x++)
for (size_t x = 0; x < BitmapCacheV2NumCells; x++)
{
const BITMAP_CACHE_V2_CELL_INFO* cdata =
freerdp_settings_get_pointer_array(src, FreeRDP_BitmapCacheV2CellInfo, x);

View File

@ -75,8 +75,9 @@ static const struct info_flags_t info_flags[] = {
{ INFO_HIDEF_RAIL_SUPPORTED, "INFO_HIDEF_RAIL_SUPPORTED" },
};
static BOOL rdp_read_info_null_string(rdpSettings* settings, size_t id, const char* what,
UINT32 flags, wStream* s, size_t cbLen, size_t max)
static BOOL rdp_read_info_null_string(rdpSettings* settings, FreeRDP_Settings_Keys_String id,
const char* what, UINT32 flags, wStream* s, size_t cbLen,
size_t max)
{
const BOOL unicode = (flags & INFO_UNICODE) ? TRUE : FALSE;
const size_t nullSize = unicode ? sizeof(WCHAR) : sizeof(CHAR);
@ -586,8 +587,8 @@ fail:
return ret;
}
static BOOL rdp_read_info_string(rdpSettings* settings, size_t id, UINT32 flags, wStream* s,
size_t cbLenNonNull, size_t max)
static BOOL rdp_read_info_string(rdpSettings* settings, FreeRDP_Settings_Keys_String id,
UINT32 flags, wStream* s, size_t cbLenNonNull, size_t max)
{
union
{
@ -892,7 +893,7 @@ static BOOL rdp_write_info_packet(rdpRdp* rdp, wStream* s)
cbAlternateShell = (UINT16)cbAlternateShell * sizeof(WCHAR);
}
size_t inputId = FreeRDP_RemoteAssistanceSessionId;
FreeRDP_Settings_Keys_String inputId = FreeRDP_RemoteAssistanceSessionId;
if (!freerdp_settings_get_bool(settings, FreeRDP_RemoteAssistanceMode))
inputId = FreeRDP_ShellWorkingDirectory;

View File

@ -1093,7 +1093,7 @@ fail:
}
static BOOL set_creds_octetstring_to_settings(WinPrAsn1Decoder* dec, WinPrAsn1_tagId tagId,
BOOL optional, size_t settingId,
BOOL optional, FreeRDP_Settings_Keys_String settingId,
rdpSettings* settings)
{
if (optional)

View File

@ -95,7 +95,8 @@ static BOOL settings_reg_query_bool_val(HKEY hKey, const TCHAR* sub, BOOL* value
return TRUE;
}
static BOOL settings_reg_query_dword(rdpSettings* settings, size_t id, HKEY hKey, const TCHAR* sub)
static BOOL settings_reg_query_dword(rdpSettings* settings, FreeRDP_Settings_Keys_UInt32 id,
HKEY hKey, const TCHAR* sub)
{
DWORD dwValue;
@ -105,7 +106,8 @@ static BOOL settings_reg_query_dword(rdpSettings* settings, size_t id, HKEY hKey
return freerdp_settings_set_uint32(settings, id, dwValue);
}
static BOOL settings_reg_query_bool(rdpSettings* settings, size_t id, HKEY hKey, const TCHAR* sub)
static BOOL settings_reg_query_bool(rdpSettings* settings, FreeRDP_Settings_Keys_Bool id, HKEY hKey,
const TCHAR* sub)
{
DWORD dwValue;
@ -139,8 +141,8 @@ static void settings_client_load_hkey_local_machine(rdpSettings* settings)
settings_reg_query_bool(settings, FreeRDP_MstscCookieMode, hKey, _T("MstscCookieMode"));
settings_reg_query_dword(settings, FreeRDP_CookieMaxLength, hKey, _T("CookieMaxLength"));
settings_reg_query_bool(settings, FreeRDP_BitmapCacheEnabled, hKey, _T("BitmapCache"));
settings_reg_query_bool(settings, FreeRDP_OffscreenSupportLevel, hKey,
_T("OffscreenBitmapCache"));
settings_reg_query_dword(settings, FreeRDP_OffscreenSupportLevel, hKey,
_T("OffscreenBitmapCache"));
settings_reg_query_dword(settings, FreeRDP_OffscreenCacheSize, hKey,
_T("OffscreenBitmapCacheSize"));
settings_reg_query_dword(settings, FreeRDP_OffscreenCacheEntries, hKey,
@ -238,7 +240,8 @@ static void settings_server_load_hkey_local_machine(rdpSettings* settings)
settings_reg_query_bool(settings, FreeRDP_ExtSecurity, hKey, _T("ExtSecurity"));
settings_reg_query_bool(settings, FreeRDP_NlaSecurity, hKey, _T("NlaSecurity"));
settings_reg_query_bool(settings, FreeRDP_TlsSecLevel, hKey, _T("TlsSecurity"));
settings_reg_query_bool(settings, FreeRDP_TlsSecurity, hKey, _T("TlsSecurity"));
settings_reg_query_dword(settings, FreeRDP_TlsSecLevel, hKey, _T("TlsSecLevel"));
settings_reg_query_bool(settings, FreeRDP_RdpSecurity, hKey, _T("RdpSecurity"));
RegCloseKey(hKey);
@ -766,9 +769,10 @@ rdpSettings* freerdp_settings_new(DWORD flags)
const BOOL enable = freerdp_settings_get_bool(settings, FreeRDP_ServerMode);
{
const size_t keys[] = { FreeRDP_SupportDynamicTimeZone, FreeRDP_SupportGraphicsPipeline,
FreeRDP_SupportStatusInfoPdu, FreeRDP_SupportErrorInfoPdu,
FreeRDP_SupportAsymetricKeys };
const FreeRDP_Settings_Keys_Bool keys[] = {
FreeRDP_SupportDynamicTimeZone, FreeRDP_SupportGraphicsPipeline,
FreeRDP_SupportStatusInfoPdu, FreeRDP_SupportErrorInfoPdu, FreeRDP_SupportAsymetricKeys
};
for (size_t x = 0; x < ARRAYSIZE(keys); x++)
{
@ -1179,7 +1183,8 @@ BOOL identity_set_from_settings_with_pwd(SEC_WINNT_AUTH_IDENTITY* identity,
BOOL identity_set_from_settings(SEC_WINNT_AUTH_IDENTITY_W* identity, const rdpSettings* settings,
FreeRDP_Settings_Keys_String UserId,
FreeRDP_Settings_Keys_String DomainId, size_t PwdId)
FreeRDP_Settings_Keys_String DomainId,
FreeRDP_Settings_Keys_String PwdId)
{
WINPR_ASSERT(identity);
WINPR_ASSERT(settings);
@ -1197,8 +1202,9 @@ BOOL identity_set_from_settings(SEC_WINNT_AUTH_IDENTITY_W* identity, const rdpSe
BOOL identity_set_from_smartcard_hash(SEC_WINNT_AUTH_IDENTITY_W* identity,
const rdpSettings* settings,
FreeRDP_Settings_Keys_String userId,
FreeRDP_Settings_Keys_String domainId, size_t pwdId,
const BYTE* certSha1, size_t sha1len)
FreeRDP_Settings_Keys_String domainId,
FreeRDP_Settings_Keys_String pwdId, const BYTE* certSha1,
size_t sha1len)
{
#ifdef _WIN32
CERT_CREDENTIAL_INFO certInfo = { sizeof(CERT_CREDENTIAL_INFO), { 0 } };

View File

@ -54,12 +54,13 @@ FREERDP_LOCAL BOOL identity_set_from_settings_with_pwd(SEC_WINNT_AUTH_IDENTITY_W
FREERDP_LOCAL BOOL identity_set_from_settings(SEC_WINNT_AUTH_IDENTITY_W* identity,
const rdpSettings* settings,
FreeRDP_Settings_Keys_String UserId,
FreeRDP_Settings_Keys_String DomainId, size_t PwdId);
FreeRDP_Settings_Keys_String DomainId,
FreeRDP_Settings_Keys_String PwdId);
FREERDP_LOCAL BOOL identity_set_from_smartcard_hash(SEC_WINNT_AUTH_IDENTITY_W* identity,
const rdpSettings* settings,
FreeRDP_Settings_Keys_String userId,
FreeRDP_Settings_Keys_String domainId,
size_t pwdId, const BYTE* certSha1,
size_t sha1len);
FreeRDP_Settings_Keys_String pwdId,
const BYTE* certSha1, size_t sha1len);
#endif /* FREERDP_LIB_CORE_SETTINGS_H */

View File

@ -860,7 +860,8 @@ BOOL smartcard_enumerateCerts(const rdpSettings* settings, SmartcardCertInfo***
return ret;
}
static BOOL set_settings_from_smartcard(rdpSettings* settings, size_t id, const char* value)
static BOOL set_settings_from_smartcard(rdpSettings* settings, FreeRDP_Settings_Keys_String id,
const char* value)
{
WINPR_ASSERT(settings);
@ -879,8 +880,6 @@ BOOL smartcard_getCert(const rdpContext* context, SmartcardCertInfo** cert, BOOL
rdpSettings* settings = context->settings;
SmartcardCertInfo** cert_list;
size_t count = 0;
size_t username_setting = 0;
size_t domain_setting = 0;
WINPR_ASSERT(instance);
WINPR_ASSERT(settings);
@ -922,8 +921,9 @@ BOOL smartcard_getCert(const rdpContext* context, SmartcardCertInfo** cert, BOOL
else
*cert = cert_list[0];
username_setting = gateway ? FreeRDP_GatewayUsername : FreeRDP_Username;
domain_setting = gateway ? FreeRDP_GatewayDomain : FreeRDP_Domain;
FreeRDP_Settings_Keys_String username_setting =
gateway ? FreeRDP_GatewayUsername : FreeRDP_Username;
FreeRDP_Settings_Keys_String domain_setting = gateway ? FreeRDP_GatewayDomain : FreeRDP_Domain;
free(cert_list);

View File

@ -1415,8 +1415,8 @@ static BOOL is_accepted_fingerprint(const rdpCertificate* cert,
static BOOL accept_cert(rdpTls* tls, const BYTE* pem, UINT32 length)
{
WINPR_ASSERT(tls);
size_t id = FreeRDP_AcceptedCert;
size_t lid = FreeRDP_AcceptedCertLength;
FreeRDP_Settings_Keys_String id = FreeRDP_AcceptedCert;
FreeRDP_Settings_Keys_UInt32 lid = FreeRDP_AcceptedCertLength;
rdpSettings* settings = tls->settings;

View File

@ -195,16 +195,15 @@ BOOL pf_context_init_server_context(freerdp_peer* client)
}
static BOOL pf_context_revert_str_settings(rdpSettings* dst, const rdpSettings* before, size_t nr,
const size_t* ids)
const FreeRDP_Settings_Keys_String* ids)
{
size_t x;
WINPR_ASSERT(dst);
WINPR_ASSERT(before);
WINPR_ASSERT(ids || (nr == 0));
for (x = 0; x < nr; x++)
for (size_t x = 0; x < nr; x++)
{
size_t id = ids[x];
FreeRDP_Settings_Keys_String id = ids[x];
const char* what = freerdp_settings_get_string(before, id);
if (!freerdp_settings_set_string(dst, id, what))
return FALSE;
@ -227,7 +226,8 @@ BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src)
{
BOOL rc = FALSE;
rdpSettings* before_copy;
const size_t to_revert[] = { FreeRDP_ConfigPath, FreeRDP_CertificateName };
const FreeRDP_Settings_Keys_String to_revert[] = { FreeRDP_ConfigPath,
FreeRDP_CertificateName };
if (!dst || !src)
return FALSE;

View File

@ -64,7 +64,8 @@ typedef struct
} peer_thread_args;
static BOOL pf_server_parse_target_from_routing_token(rdpContext* context, rdpSettings* settings,
size_t targetID, size_t portID)
FreeRDP_Settings_Keys_String targetID,
FreeRDP_Settings_Keys_UInt32 portID)
{
#define TARGET_MAX (100)
#define ROUTING_TOKEN_PREFIX "Cookie: msts="