[channels,client] log server format list

This commit is contained in:
akallabeth
2025-04-02 11:46:56 +02:00
parent d27b8be187
commit e7224ff559
3 changed files with 36 additions and 18 deletions

View File

@@ -24,6 +24,7 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/clipboard.h>
#include <freerdp/types.h>
#include <freerdp/freerdp.h>
@@ -131,8 +132,29 @@ UINT cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
if (filteredFormatList.numFormats == 0)
goto error_out;
WLog_Print(cliprdr->log, WLOG_DEBUG, "ServerFormatList: numFormats: %" PRIu32 "",
filteredFormatList.numFormats);
const DWORD level = WLOG_DEBUG;
if (WLog_IsLevelActive(cliprdr->log, level))
{
WLog_Print(cliprdr->log, level, "ServerFormatList: numFormats: %" PRIu32 "",
formatList.numFormats);
for (size_t x = 0; x < formatList.numFormats; x++)
{
const CLIPRDR_FORMAT* format = &formatList.formats[x];
WLog_Print(cliprdr->log, level, "[%" PRIu32 "]: id=0x%08" PRIx32 " [%s|%s]", x,
format->formatId, ClipboardGetFormatIdString(format->formatId),
format->formatName);
}
WLog_Print(cliprdr->log, level, "ServerFormatList [filtered]: numFormats: %" PRIu32 "",
filteredFormatList.numFormats);
for (size_t x = 0; x < filteredFormatList.numFormats; x++)
{
const CLIPRDR_FORMAT* format = &filteredFormatList.formats[x];
WLog_Print(cliprdr->log, level, "[%" PRIu32 "]: id=0x%08" PRIx32 " [%s|%s]", x,
format->formatId, ClipboardGetFormatIdString(format->formatId),
format->formatName);
}
}
if (context->ServerFormatList)
{
@@ -185,8 +207,6 @@ UINT cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UIN
CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr);
UINT error = CHANNEL_RC_OK;
WLog_Print(cliprdr->log, WLOG_DEBUG, "ServerFormatDataRequest");
formatDataRequest.common.msgType = CB_FORMAT_DATA_REQUEST;
formatDataRequest.common.msgFlags = msgFlags;
formatDataRequest.common.dataLen = dataLen;
@@ -194,6 +214,10 @@ UINT cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UIN
if ((error = cliprdr_read_format_data_request(s, &formatDataRequest)))
return error;
WLog_Print(cliprdr->log, WLOG_DEBUG, "ServerFormatDataRequest (0x%08" PRIx32 " [%s])",
formatDataRequest.requestedFormatId,
ClipboardGetFormatIdString(formatDataRequest.requestedFormatId));
const UINT32 mask =
freerdp_settings_get_uint32(context->rdpcontext->settings, FreeRDP_ClipboardFeatureMask);
if ((mask & (CLIPRDR_FLAG_LOCAL_TO_REMOTE | CLIPRDR_FLAG_LOCAL_TO_REMOTE_FILES)) == 0)
@@ -223,7 +247,7 @@ UINT cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, wStream* s, UI
UINT error = CHANNEL_RC_OK;
WLog_Print(cliprdr->log, WLOG_DEBUG,
"ServerFormatDataResponse: msgFlags=ox%08" PRIx32 ", dataLen=%" PRIu32, msgFlags,
"ServerFormatDataResponse: msgFlags=0x%08" PRIx32 ", dataLen=%" PRIu32, msgFlags,
dataLen);
formatDataResponse.common.msgType = CB_FORMAT_DATA_RESPONSE;

View File

@@ -26,6 +26,7 @@
#include <winpr/assert.h>
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/clipboard.h>
#include <freerdp/types.h>
#include <freerdp/constants.h>
@@ -699,8 +700,9 @@ static UINT cliprdr_client_format_list(CliprdrClientContext* context,
for (size_t x = 0; x < filterList.numFormats; x++)
{
const CLIPRDR_FORMAT* format = &filterList.formats[x];
WLog_Print(cliprdr->log, level, "[%" PRIu32 "]: id=0x%08" PRIx32 " [%s]", x,
format->formatId, format->formatName);
WLog_Print(cliprdr->log, level, "[%" PRIu32 "]: id=0x%08" PRIx32 " [%s|%s]", x,
format->formatId, ClipboardGetFormatIdString(format->formatId),
format->formatName);
}
}
@@ -837,8 +839,9 @@ static UINT cliprdr_client_format_data_request(CliprdrClientContext* context,
}
Stream_Write_UINT32(s, formatDataRequest->requestedFormatId); /* requestedFormatId (4 bytes) */
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatDataRequest(0x%08" PRIx32 ")",
formatDataRequest->requestedFormatId);
WLog_Print(cliprdr->log, WLOG_DEBUG, "ClientFormatDataRequest(0x%08" PRIx32 " [%s])",
formatDataRequest->requestedFormatId,
ClipboardGetFormatIdString(formatDataRequest->requestedFormatId));
return cliprdr_packet_send(cliprdr, s);
}

View File

@@ -378,13 +378,6 @@ UINT cliprdr_read_file_contents_response(wStream* s, CLIPRDR_FILE_CONTENTS_RESPO
return CHANNEL_RC_OK;
}
static void dump_format(wLog* log, size_t x, const CLIPRDR_FORMAT* format)
{
WINPR_ASSERT(format);
WLog_Print(log, WLOG_DEBUG, "[%" PRIuz "] formatId=0x%08" PRIx32 ", name=%s", x,
format->formatId, format->formatName);
}
UINT cliprdr_read_format_list(wLog* log, wStream* s, CLIPRDR_FORMAT_LIST* formatList,
BOOL useLongFormatNames)
{
@@ -481,7 +474,6 @@ UINT cliprdr_read_format_list(wLog* log, wStream* s, CLIPRDR_FORMAT_LIST* format
}
}
dump_format(log, index, format);
index++;
}
}
@@ -543,7 +535,6 @@ UINT cliprdr_read_format_list(wLog* log, wStream* s, CLIPRDR_FORMAT_LIST* format
goto error_out;
}
dump_format(log, index, format);
index++;
}
}