VirtualBox

Changeset 80907 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Sep 19, 2019 1:12:34 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133482
Message:

Shared Clipboard/Transfers: Update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp

    r80905 r80907  
    161161#endif
    162162
     163/**
     164 * Cleanup helper function for transfer callbacks.
     165 *
     166 * @param   pData               Callback data to cleanup.
     167 */
    163168static void vboxClipboardTransferCallbackCleanup(PSHCLTRANSFERCALLBACKDATA pData)
    164169{
     
    194199    if (RT_SUCCESS(rc))
    195200    {
    196         PSHCLTRANSFER pTransfer;
    197         rc = SharedClipboardTransferCreate(&pTransfer);
    198         if (RT_SUCCESS(rc))
    199             rc = SharedClipboardTransferInit(pTransfer, 0 /* uID */,
    200                                              SHCLTRANSFERDIR_WRITE, SHCLSOURCE_LOCAL);
    201         if (RT_SUCCESS(rc))
     201        /* The data data in CF_HDROP format, as the files are locally present and don't need to be
     202         * presented as a IDataObject or IStream. */
     203        HANDLE hClip = hClip = GetClipboardData(CF_HDROP);
     204        if (hClip)
    202205        {
    203             /* The data data in CF_HDROP format, as the files are locally present and don't need to be
    204              * presented as a IDataObject or IStream. */
    205             HANDLE hClip = hClip = GetClipboardData(CF_HDROP);
    206             if (hClip)
     206            HDROP hDrop = (HDROP)GlobalLock(hClip);
     207            if (hDrop)
    207208            {
    208                 HDROP hDrop = (HDROP)GlobalLock(hClip);
    209                 if (hDrop)
     209                char    *papszList = NULL;
     210                uint32_t cbList;
     211                rc = SharedClipboardWinDropFilesToStringList((DROPFILES *)hDrop, &papszList, &cbList);
     212
     213                GlobalUnlock(hClip);
     214
     215                if (RT_SUCCESS(rc))
    210216                {
    211                     char    *papszList = NULL;
    212                     uint32_t cbList;
    213                     rc = SharedClipboardWinDropFilesToStringList((DROPFILES *)hDrop, &papszList, &cbList);
    214 
    215                     GlobalUnlock(hClip);
    216 
    217                     if (RT_SUCCESS(rc))
    218                     {
    219                         rc = SharedClipboardTransferRootsSet(pTransfer,
    220                                                              papszList, cbList + 1 /* Include termination */);
    221                         RTStrFree(papszList);
    222                     }
     217                    rc = SharedClipboardTransferRootsSet(pData->pTransfer,
     218                                                         papszList, cbList + 1 /* Include termination */);
     219                    RTStrFree(papszList);
    223220                }
    224                 else
    225                 {
    226                     hClip = NULL;
    227                 }
     221            }
     222            else
     223            {
     224                hClip = NULL;
    228225            }
    229226        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette