mirror of https://github.com/FreeRDP/FreeRDP
mfreerdp: fix cliprdr copy with Windows XP
This commit is contained in:
parent
c4ab4ad128
commit
b8f694d8df
|
@ -86,29 +86,21 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
|
|||
{
|
||||
szFormatName = (char*) Stream_Pointer(s);
|
||||
|
||||
if (!szFormatName[0])
|
||||
formatNameLength = 0;
|
||||
else
|
||||
formatNameLength = strlen(szFormatName);
|
||||
|
||||
if (formatNameLength)
|
||||
if (szFormatName[0])
|
||||
{
|
||||
formats[index].formatName = _strdup(szFormatName);
|
||||
formats[index].formatName = (char*) malloc(32 + 1);
|
||||
CopyMemory(formats[index].formatName, szFormatName, 32);
|
||||
formats[index].formatName[32] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wszFormatName = (WCHAR*) Stream_Pointer(s);
|
||||
|
||||
if (!wszFormatName[0])
|
||||
formatNameLength = 0;
|
||||
else
|
||||
formatNameLength = _wcslen(wszFormatName);
|
||||
|
||||
if (formatNameLength)
|
||||
if (wszFormatName[0])
|
||||
{
|
||||
ConvertFromUnicode(CP_UTF8, 0, wszFormatName,
|
||||
-1, &(formats[index].formatName), 0, NULL, NULL);
|
||||
16, &(formats[index].formatName), 0, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,9 +175,6 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
|
|||
|
||||
for (index = 0; index < formatList.numFormats; index++)
|
||||
{
|
||||
fprintf(stderr, "[%02d] Format: 0x%04X %s\n",
|
||||
index, formats[index].formatId, formats[index].formatName);
|
||||
|
||||
if (formats[index].formatName)
|
||||
free(formats[index].formatName);
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ int cliprdr_client_capabilities(CliprdrClientContext* context, CLIPRDR_CAPABILIT
|
|||
wStream* s;
|
||||
CLIPRDR_GENERAL_CAPABILITY_SET* generalCapabilitySet;
|
||||
cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle;
|
||||
|
||||
|
||||
s = cliprdr_packet_new(CB_CLIP_CAPS, 0, 4 + CB_CAPSTYPE_GENERAL_LEN);
|
||||
|
||||
Stream_Write_UINT16(s, 1); /* cCapabilitiesSets */
|
||||
|
@ -523,6 +523,8 @@ int cliprdr_client_format_list(CliprdrClientContext* context, CLIPRDR_FORMAT_LIS
|
|||
|
||||
Stream_Write(s, wszFormatName, formatNameSize * 2);
|
||||
Stream_Zero(s, 32 - (formatNameSize * 2));
|
||||
|
||||
free(wszFormatName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,12 +57,30 @@ int mac_cliprdr_send_client_format_list(CliprdrClientContext* cliprdr)
|
|||
|
||||
mfc->cliprdr->ClientFormatList(mfc->cliprdr, &formatList);
|
||||
|
||||
for (index = 0; index < numFormats; index++)
|
||||
{
|
||||
free(formats[index].formatName);
|
||||
}
|
||||
|
||||
free(pFormatIds);
|
||||
free(formats);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int mac_cliprdr_send_client_format_list_response(CliprdrClientContext* cliprdr, BOOL status)
|
||||
{
|
||||
CLIPRDR_FORMAT_LIST_RESPONSE formatListResponse;
|
||||
|
||||
formatListResponse.msgType = CB_FORMAT_LIST_RESPONSE;
|
||||
formatListResponse.msgFlags = status ? CB_RESPONSE_OK : CB_RESPONSE_FAIL;
|
||||
formatListResponse.dataLen = 0;
|
||||
|
||||
cliprdr->ClientFormatListResponse(cliprdr, &formatListResponse);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int mac_cliprdr_send_client_format_data_request(CliprdrClientContext* cliprdr, UINT32 formatId)
|
||||
{
|
||||
CLIPRDR_FORMAT_DATA_REQUEST formatDataRequest;
|
||||
|
@ -172,6 +190,8 @@ int mac_cliprdr_server_format_list(CliprdrClientContext* cliprdr, CLIPRDR_FORMAT
|
|||
mfc->serverFormats[index].formatName = _strdup(formatList->formats[index].formatName);
|
||||
}
|
||||
|
||||
mac_cliprdr_send_client_format_list_response(cliprdr, TRUE);
|
||||
|
||||
for (index = 0; index < mfc->numServerFormats; index++)
|
||||
{
|
||||
format = &(mfc->serverFormats[index]);
|
||||
|
@ -247,6 +267,12 @@ int mac_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr, CLIPR
|
|||
mfContext* mfc = (mfContext*) cliprdr->custom;
|
||||
MRDPView* view = (MRDPView*) mfc->view;
|
||||
|
||||
if (formatDataResponse->msgFlags & CB_RESPONSE_FAIL)
|
||||
{
|
||||
SetEvent(mfc->clipboardRequestEvent);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (index = 0; index < mfc->numServerFormats; index++)
|
||||
{
|
||||
if (mfc->requestedFormatId == mfc->serverFormats[index].formatId)
|
||||
|
@ -266,6 +292,13 @@ int mac_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr, CLIPR
|
|||
|
||||
size = formatDataResponse->dataLen;
|
||||
data = (BYTE*) malloc(size);
|
||||
|
||||
if (!data)
|
||||
{
|
||||
SetEvent(mfc->clipboardRequestEvent);
|
||||
return -1;
|
||||
}
|
||||
|
||||
CopyMemory(data, formatDataResponse->requestedFormatData, size);
|
||||
|
||||
ClipboardSetData(mfc->clipboard, formatId, data, size);
|
||||
|
|
Loading…
Reference in New Issue