[PATCH] ole32/clipboard: Handle CF_HDROP format.

Jactry Zeng jzeng at codeweavers.com
Wed Mar 10 02:55:44 CST 2021


Hi Huw,

I sent another try.
Thanks for the review!

On 3/9/21 8:48 PM, Huw Davies wrote:
> On Tue, Mar 09, 2021 at 11:57:01AM +0800, Jactry Zeng wrote:
>> +static HDROP create_dropped_file(void)
>> +{
>> +    WCHAR path[] = L"C:\testfile1";
> You need to escape the backslash.  Also, it would most likely be easier to
> include the second \0 in the string ie. L"C:\\testfile1\0" and then use
> memcpy to copy it.
>
>> +    DROPFILES *dropfiles;
>> +    DWORD size, offset;
>> +    HDROP hdrop;
>> +
>> +    size = sizeof(DROPFILES) + (sizeof(path) + 1) * sizeof(WCHAR);
> This is wrong.
>
>> +    offset = sizeof(DROPFILES);
>> +    hdrop = GlobalAlloc(GHND, size);
>> +    dropfiles = GlobalLock(hdrop);
>> +    dropfiles->pFiles = offset;
>> +    dropfiles->fWide = TRUE;
>> +    lstrcpyW(((WCHAR *)dropfiles) + offset, path);
> As is this - offset is a byte offset...
>
>> +    offset += lstrlenW(path) + 1;
> ...which seems to turn into a WCHAR offset.
>
>> +    ((WCHAR *)dropfiles)[offset] = 0;
>> +    GlobalUnlock(hdrop);
>> +
>> +    return hdrop;
>> +}
>> +

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210310/587e3b89/attachment.sig>


More information about the wine-devel mailing list