I've been tasked with sending text clipboard data to a WfreeRDP connected remote machine's clipboard from a web application and am having trouble knowing where to look.
WFreeRDP
has a TestClipboardFormats.c which kind of looks like what I need and features a SetClipboardData
and GetClipboardData
which I've managed to get working (according to the Debug console output at least)
BOOL bSuccess;
UINT32 SrcSize;
UINT32 DstSize;
const char* pSrcData = commandArgs.c_str();
char* pDstData;
textHtmlStringFormatId = ClipboardRegisterFormat(clipboard, "CF_TEXT");
utf8StringFormatId = ClipboardRegisterFormat(clipboard, "UTF8_STRING");
SrcSize = (UINT32)(strlen(pSrcData) + 1);
bSuccess = ClipboardSetData(clipboard, textHtmlStringFormatId, pSrcData, SrcSize);
fprintf(stderr, "ClipboardSetData: %d\n", bSuccess);
DstSize = 0;
pDstData = (char*)ClipboardGetData(clipboard, textHtmlStringFormatId, &DstSize);
fprintf(stderr, "ClipboardGetData: %s\n", pDstData);
free(pDstData);
I was kind of hoping the remote machine's clipboard would be populated with the data I'd sent as it can be retrieved with GetClipboardData
successfully, but right clicking on the remote machine yields no results.
Am I using the right method? Or maybe using it incorrectly?