diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 070611d51..05bd3813a 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -23,6 +23,7 @@ #define FREERDP_SETTINGS_H #include +#include #include #include @@ -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); diff --git a/libfreerdp/common/settings_str.c b/libfreerdp/common/settings_str.c index 810fad5cd..666fa267f 100644 --- a/libfreerdp/common/settings_str.c +++ b/libfreerdp/common/settings_str.c @@ -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; diff --git a/scripts/update-settings-tests b/scripts/update-settings-tests index 48e79d2fc..0d7f3db71 100755 --- a/scripts/update-settings-tests +++ b/scripts/update-settings-tests @@ -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; xtype)\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')