From adb5e5715b0f0fc4f53cf72e7704226dc9dd0daf Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 7 Dec 2023 18:06:43 +0100 Subject: [PATCH] [cache,glyph] print warning if enabled glyph-cache is buggy, warn if enabled. --- libfreerdp/core/freerdp.c | 2 ++ libfreerdp/core/settings.c | 36 ++++++++++++++++++++++++++++++++++++ libfreerdp/core/settings.h | 3 +++ 3 files changed, 41 insertions(+) diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index 52cc169e5..2ae71b09e 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -118,6 +118,8 @@ static int freerdp_connect_begin(freerdp* instance) IFCALLRET(instance->PreConnect, status, instance); instance->ConnectionCallbackState = CLIENT_STATE_PRECONNECT_PASSED; + freerdp_settings_print_warnings(settings); + if (status) { if (!rdp_set_backup_settings(rdp)) diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index 09bfb5d3b..8ba12bfed 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -269,6 +269,17 @@ static BOOL settings_get_computer_name(rdpSettings* settings) return freerdp_settings_set_string(settings, FreeRDP_ComputerName, computerName); } +void freerdp_settings_print_warnings(const rdpSettings* settings) +{ + const UINT32 level = freerdp_settings_get_uint32(settings, FreeRDP_GlyphSupportLevel); + if (level != GLYPH_SUPPORT_NONE) + { + char buffer[32] = { 0 }; + WLog_WARN(TAG, "[experimental] enabled GlyphSupportLevel %s, expect visual artefacts!", + freerdp_settings_glyph_level_string(level, buffer, sizeof(buffer))); + } +} + BOOL freerdp_settings_set_default_order_support(rdpSettings* settings) { BYTE* OrderSupport = freerdp_settings_get_pointer_writable(settings, FreeRDP_OrderSupport); @@ -1233,3 +1244,28 @@ BOOL identity_set_from_smartcard_hash(SEC_WINNT_AUTH_IDENTITY_W* identity, #endif /* _WIN32 */ return TRUE; } + +const char* freerdp_settings_glyph_level_string(UINT32 level, char* buffer, size_t size) +{ + const char* str = "GLYPH_SUPPORT_UNKNOWN"; + switch (level) + { + case GLYPH_SUPPORT_NONE: + str = "GLYPH_SUPPORT_NONE"; + break; + case GLYPH_SUPPORT_PARTIAL: + str = "GLYPH_SUPPORT_PARTIAL"; + break; + case GLYPH_SUPPORT_FULL: + str = "GLYPH_SUPPORT_FULL"; + break; + case GLYPH_SUPPORT_ENCODE: + str = "GLYPH_SUPPORT_ENCODE"; + break; + default: + break; + } + + _snprintf(buffer, size, "%s[0x%08" PRIx32 "]", str, level); + return buffer; +} diff --git a/libfreerdp/core/settings.h b/libfreerdp/core/settings.h index 941d5608e..062eca6f3 100644 --- a/libfreerdp/core/settings.h +++ b/libfreerdp/core/settings.h @@ -35,6 +35,7 @@ #include +FREERDP_LOCAL void freerdp_settings_print_warnings(const rdpSettings* settings); FREERDP_LOCAL BOOL freerdp_settings_set_default_order_support(rdpSettings* settings); FREERDP_LOCAL BOOL freerdp_settings_clone_keys(rdpSettings* dst, const rdpSettings* src); FREERDP_LOCAL void freerdp_settings_free_keys(rdpSettings* dst, BOOL cleanup); @@ -62,5 +63,7 @@ FREERDP_LOCAL BOOL identity_set_from_smartcard_hash(SEC_WINNT_AUTH_IDENTITY_W* i FreeRDP_Settings_Keys_String domainId, FreeRDP_Settings_Keys_String pwdId, const BYTE* certSha1, size_t sha1len); +FREERDP_LOCAL const char* freerdp_settings_glyph_level_string(UINT32 level, char* buffer, + size_t size); #endif /* FREERDP_LIB_CORE_SETTINGS_H */