Added settings dump function
This commit is contained in:
parent
68dfa353b8
commit
6a2ae388f8
@ -23,6 +23,7 @@
|
||||
#define FREERDP_SETTINGS_H
|
||||
|
||||
#include <winpr/timezone.h>
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
@ -1593,6 +1594,8 @@ extern "C"
|
||||
FREERDP_API BOOL freerdp_settings_copy(rdpSettings* dst, const rdpSettings* src);
|
||||
FREERDP_API void freerdp_settings_free(rdpSettings* settings);
|
||||
|
||||
FREERDP_API void freerdp_settings_dump(wLog* log, DWORD level, const rdpSettings* settings);
|
||||
|
||||
FREERDP_API int freerdp_addin_set_argument(ADDIN_ARGV* args, char* argument);
|
||||
FREERDP_API int freerdp_addin_replace_argument(ADDIN_ARGV* args, char* previous,
|
||||
char* argument);
|
||||
|
@ -464,6 +464,72 @@ BOOL freerdp_settings_clone_keys(rdpSettings* dst, const rdpSettings* src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void freerdp_settings_dump(wLog* log, DWORD level, const rdpSettings* settings)
|
||||
{
|
||||
size_t x;
|
||||
for (x = 0; x < ARRAYSIZE(settings_map); x++)
|
||||
{
|
||||
const struct settings_str_entry* cur = &settings_map[x];
|
||||
switch (cur->type)
|
||||
{
|
||||
case 0: /* bool */
|
||||
{
|
||||
BOOL sval = freerdp_settings_get_bool(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [BOOL]: %s", cur->str, sval ? "TRUE" : "FALSE");
|
||||
}
|
||||
break;
|
||||
case 1: /* UINT16 */
|
||||
{
|
||||
UINT16 sval = freerdp_settings_get_uint16(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [UINT16]: %" PRIu16, cur->str, sval);
|
||||
}
|
||||
break;
|
||||
case 2: /* INT16 */
|
||||
{
|
||||
INT16 sval = freerdp_settings_get_int16(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [INT16]: %" PRId16, cur->str, sval);
|
||||
}
|
||||
break;
|
||||
case 3: /* UINT32 */
|
||||
{
|
||||
UINT32 sval = freerdp_settings_get_uint32(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [UINT32]: %" PRIu32, cur->str, sval);
|
||||
}
|
||||
break;
|
||||
case 4: /* INT32 */
|
||||
{
|
||||
INT32 sval = freerdp_settings_get_int32(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [INT32]: %" PRId32, cur->str, sval);
|
||||
}
|
||||
break;
|
||||
case 5: /* UINT64 */
|
||||
{
|
||||
UINT64 sval = freerdp_settings_get_uint64(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [UINT64]: %" PRIu64, cur->str, sval);
|
||||
}
|
||||
break;
|
||||
case 6: /* INT64 */
|
||||
{
|
||||
INT64 sval = freerdp_settings_get_int64(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [INT64]: %" PRId64, cur->str, sval);
|
||||
}
|
||||
break;
|
||||
case 7: /* strings */
|
||||
{
|
||||
const char* sval = freerdp_settings_get_string(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [STRING]: '%s'", cur->str, sval);
|
||||
}
|
||||
break;
|
||||
case 8: /* pointer */
|
||||
{
|
||||
const void* sval = freerdp_settings_get_pointer(settings, cur->id);
|
||||
WLog_Print(log, level, "%s [POINTER]: '%p'", cur->str, sval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void freerdp_settings_free_keys(rdpSettings* dst, BOOL cleanup)
|
||||
{
|
||||
size_t x;
|
||||
|
@ -121,12 +121,80 @@ def write_str(f, entry_dict):
|
||||
f.write('\t\t\t\t\treturn FALSE;\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
|
||||
f.write('\t\t}\n')
|
||||
f.write('\t}\n')
|
||||
f.write('\treturn TRUE;\n')
|
||||
f.write('}\n')
|
||||
f.write('\n')
|
||||
|
||||
f.write('void freerdp_settings_dump(wLog* log, DWORD level, const rdpSettings* settings)\n')
|
||||
f.write('{\n')
|
||||
f.write('\tsize_t x;\n')
|
||||
f.write('\tfor(x=0; x<ARRAYSIZE(settings_map); x++)\n')
|
||||
f.write('\t{\n')
|
||||
f.write('\t\tconst struct settings_str_entry* cur = &settings_map[x];\n')
|
||||
f.write('\t\tswitch(cur->type)\n')
|
||||
f.write('\t\t{\n')
|
||||
f.write('\t\t\tcase 0: /* bool */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tBOOL sval = freerdp_settings_get_bool(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [BOOL]: %s", cur->str, sval ? "TRUE" : "FALSE");\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 1: /* UINT16 */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tUINT16 sval = freerdp_settings_get_uint16(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [UINT16]: %" PRIu16, cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 2: /* INT16 */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tINT16 sval = freerdp_settings_get_int16(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [INT16]: %" PRId16, cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 3: /* UINT32 */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tUINT32 sval = freerdp_settings_get_uint32(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [UINT32]: %" PRIu32, cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 4: /* INT32 */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tINT32 sval = freerdp_settings_get_int32(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [INT32]: %" PRId32, cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 5: /* UINT64 */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tUINT64 sval = freerdp_settings_get_uint64(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [UINT64]: %" PRIu64, cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 6: /* INT64 */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tINT64 sval = freerdp_settings_get_int64(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [INT64]: %" PRId64, cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 7: /* strings */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tconst char* sval = freerdp_settings_get_string(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [STRING]: \'%s\'", cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t\tcase 8: /* pointer */\n')
|
||||
f.write('\t\t\t{\n')
|
||||
f.write('\t\t\t\tconst void* sval = freerdp_settings_get_pointer(settings, cur->id);\n')
|
||||
f.write('\t\t\t\tWLog_Print(log, level, "%s [POINTER]: \'%p\'", cur->str, sval);\n')
|
||||
f.write('\t\t\t}\n')
|
||||
f.write('\t\t\tbreak;\n')
|
||||
f.write('\t\t}\n')
|
||||
f.write('\t}\n')
|
||||
|
||||
f.write('}\n')
|
||||
f.write('\n')
|
||||
|
||||
f.write('void freerdp_settings_free_keys(rdpSettings* dst, BOOL cleanup)\n')
|
||||
f.write('{\n')
|
||||
f.write('\tsize_t x;\n')
|
||||
|
Loading…
Reference in New Issue
Block a user