[settings] add freerdp_supported_color_depths_string

This commit is contained in:
Armin Novak
2023-04-13 12:52:38 +02:00
committed by akallabeth
parent fcdd3a1e75
commit 391f5e0ddb
3 changed files with 36 additions and 4 deletions

View File

@@ -2172,6 +2172,13 @@ enum rdp_settings_type
FREERDP_API const char* freerdp_encryption_methods_string(UINT32 EncryptionLevel, char* buffer,
size_t size);
/** \brief returns a string representation of \b RNS_UD_XXBPP_SUPPORT values
*
* return A string reprenentation of the bitmask.
*/
FREERDP_API const char* freerdp_supported_color_depths_string(UINT16 mask, char* buffer,
size_t size);
#ifdef __cplusplus
}
#endif

View File

@@ -2155,3 +2155,28 @@ const char* freerdp_encryption_methods_string(UINT32 EncryptionMethods, char* bu
return buffer;
}
const char* freerdp_supported_color_depths_string(UINT16 mask, char* buffer, size_t size)
{
const UINT32 invalid = mask & ~(RNS_UD_32BPP_SUPPORT | RNS_UD_24BPP_SUPPORT |
RNS_UD_16BPP_SUPPORT | RNS_UD_15BPP_SUPPORT);
if (mask & RNS_UD_32BPP_SUPPORT)
winpr_str_append("RNS_UD_32BPP_SUPPORT", buffer, size, "|");
if (mask & RNS_UD_24BPP_SUPPORT)
winpr_str_append("RNS_UD_24BPP_SUPPORT", buffer, size, "|");
if (mask & RNS_UD_16BPP_SUPPORT)
winpr_str_append("RNS_UD_16BPP_SUPPORT", buffer, size, "|");
if (mask & RNS_UD_15BPP_SUPPORT)
winpr_str_append("RNS_UD_15BPP_SUPPORT", buffer, size, "|");
if (invalid != 0)
{
char str[32] = { 0 };
_snprintf(str, sizeof(str), "RNS_UD_INVALID[0x%04" PRIx16 "]", invalid);
winpr_str_append(str, buffer, size, "|");
}
char hex[32] = { 0 };
_snprintf(hex, sizeof(hex), "[0x%04" PRIx16 "]", mask);
return buffer;
}

View File

@@ -1332,6 +1332,7 @@ BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
BOOL gcc_write_client_core_data(wStream* s, const rdpMcs* mcs)
{
char buffer[2048] = { 0 };
char dbuffer[2048] = { 0 };
WCHAR* clientName = NULL;
size_t clientNameLength;
BYTE connectionType;
@@ -1392,10 +1393,9 @@ BOOL gcc_write_client_core_data(wStream* s, const rdpMcs* mcs)
if (!Stream_EnsureRemainingCapacity(s, 6))
return FALSE;
WLog_DBG(TAG,
"Sending highColorDepth=%s, supportedColorDepths=0x%04" PRIx16
", earlyCapabilityFlags=%s",
HighColorToString(highColorDepth), SupportedColorDepths,
WLog_DBG(TAG, "Sending highColorDepth=%s, supportedColorDepths=%s, earlyCapabilityFlags=%s",
HighColorToString(highColorDepth),
freerdp_supported_color_depths_string(SupportedColorDepths, dbuffer, sizeof(dbuffer)),
rdp_early_client_caps_string(earlyCapabilityFlags, buffer, sizeof(buffer)));
Stream_Write_UINT16(s, highColorDepth); /* highColorDepth */
Stream_Write_UINT16(s, SupportedColorDepths); /* supportedColorDepths */