rdpserver(local Clipboard Owner) not send format data request PDU
.
#8664
-
hi,I want to UINT send_client_format_list(xfClipboard *clipboard)
{
WLog_DBG(TAG, "client send format list-->");
int formatsLen = 2;
CLIPRDR_FORMAT *formats = (CLIPRDR_FORMAT *)calloc(formatsLen, sizeof(CLIPRDR_FORMAT));
formats[0].formatId = CF_RAW;
formats[0].formatName = _strdup("RAW");
formats[1].formatId = CF_UNICODETEXT;
formats[1].formatName = _strdup("UTF8_STRING");
const CLIPRDR_FORMAT_LIST formatList = {.common.msgFlags = CB_RESPONSE_OK,
.numFormats = formatsLen,
.formats = formats,
.common.msgType = CB_FORMAT_LIST};
/* Ensure all pending requests are answered. */
xf_cliprdr_send_data_response(clipboard, NULL, 0);
for (int i = 0; i < formatList.numFormats; i++)
{
WLog_DBG(TAG, "client format list id:%d name:%s", formatList.formats[i].formatId, formatList.formats[i].formatName);
}
WINPR_ASSERT(clipboard->context);
WINPR_ASSERT(clipboard->context->ClientFormatList);
return clipboard->context->ClientFormatList(clipboard->context, &formatList);
}
void clipboard_init(xfContext *xfc, CliprdrClientContext *cliprdr)
{
WINPR_ASSERT(xfc);
WINPR_ASSERT(cliprdr);
xfc->cliprdr = cliprdr;
xfc->clipboard->context = cliprdr;
cliprdr->custom = (void *)xfc->clipboard;
/*https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpeclip/fb9b7e0b-6db4-41c2-b83c-f889c1ee7688*/
/*init handlers*/
cliprdr->ServerCapabilities = server_clipboard_capabilities;
cliprdr->MonitorReady = server_monitor_ready;
cliprdr->ServerFormatListResponse = server_format_list_response;
/*data transfer sequences*/
cliprdr->ServerFormatDataRequest = server_format_data_request;
}
Is there any reason for this problem? thanks a lot. UPDATE: UINT send_client_format_list(xfClipboard *clipboard)
{
WLog_DBG(TAG, "client send format list-->");
int numFormats = clipboard->numClientFormats;
CLIPRDR_FORMAT *formats = NULL;
if (numFormats)
{
if (!(formats = (CLIPRDR_FORMAT *)calloc(numFormats, sizeof(CLIPRDR_FORMAT))))
{
WLog_ERR(TAG, "failed to allocate %" PRIu32 " CLIPRDR_FORMAT structs", numFormats);
return CHANNEL_RC_NO_MEMORY;
}
}
for (int i = 0; i < numFormats; i++)
{
const xfCliprdrFormat *clientFormat = &clipboard->clientFormats[i];
CLIPRDR_FORMAT *format = &formats[i];
format->formatId = clientFormat->formatId;
format->formatName = clientFormat->formatName;
}
const CLIPRDR_FORMAT_LIST formatList = {.common.msgFlags = CB_RESPONSE_OK,
.numFormats = numFormats,
.formats = formats,
.common.msgType = CB_FORMAT_LIST};
/* Ensure all pending requests are answered. */
xf_cliprdr_send_data_response(clipboard, NULL, 0);
for (int i = 0; i < formatList.numFormats; i++)
{
WLog_DBG(TAG, "client format list id:%d name:%s", formatList.formats[i].formatId, formatList.formats[i].formatName);
}
WINPR_ASSERT(clipboard->context);
WINPR_ASSERT(clipboard->context->ClientFormatList);
return clipboard->context->ClientFormatList(clipboard->context, &formatList);
} [13:46:12:091] [167624:167638] [DEBUG][com.freerdp.client.x11] - <--server send clipboard capabilities
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
you need to check your check [MS-DCLB] for details about formats to send |
Beta Was this translation helpful? Give feedback.
you need to check your
formatName
stuff. e.g.UTF8_STRING
is an identifier from your localX11
clipboard, so you sent the wrong data over the RDP clipboard APIcheck [MS-DCLB] for details about formats to send