VirtualBox

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


Ignore:
Timestamp:
Jul 10, 2019 1:02:50 PM (6 years ago)
Author:
vboxsync
Message:

Shared Clipboard/URI: More code for root entries handling.

File:
1 edited

Legend:

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

    r79630 r79672  
    8080    PVBOXCLIPBOARDCONTEXT       pClipboardCtx;
    8181    PSHAREDCLIPBOARDURITRANSFER pTransfer;
    82     char                       *papszURIList;
    83     uint32_t                    cbURIList;
    8482} VBOXCLIPBOARDURIWRITETHREADCTX, *PVBOXCLIPBOARDURIWRITETHREADCTX;
    8583#endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
     
    156154        VbglR3ClipboardDisconnect(uClientID);
    157155    }
    158 
    159     if (pCtx->papszURIList)
    160         RTStrFree(pCtx->papszURIList);
    161156
    162157    RTMemFree(pCtx);
     
    787782               if (RT_SUCCESS(rc))
    788783               {
    789             #if 0
    790                    SHAREDCLIPBOARDURITRANSFERCALLBACKS TransferCallbacks;
    791                    RT_ZERO(TransferCallbacks);
    792 
    793                    TransferCallbacks.pvUser              = &pCtx->URI;
    794                    TransferCallbacks.pfnTransferComplete = vboxClipboardURITransferCompleteCallback;
    795                    TransferCallbacks.pfnTransferError    = vboxClipboardURITransferErrorCallback;
    796 
    797                    SharedClipboardURITransferSetCallbacks(pTransfer, &TransferCallbacks);
    798 
    799                    SHAREDCLIPBOARDPROVIDERCREATIONCTX creationCtx;
    800                    RT_ZERO(creationCtx);
    801                    creationCtx.enmSource = SHAREDCLIPBOARDSOURCE_LOCAL;
    802 
    803                    RT_ZERO(creationCtx.Interface);
    804                    creationCtx.Interface.pfnListHdrWrite   = vboxClipboardURIListHdrWrite;
    805                    creationCtx.Interface.pfnListEntryWrite = vboxClipboardURIListEntryWrite;
    806                    creationCtx.Interface.pfnObjOpen        = vboxClipboardURIObjOpen;
    807                    creationCtx.Interface.pfnObjClose       = vboxClipboardURIObjClose;
    808                    creationCtx.Interface.pfnObjWrite       = vboxClipboardURIObjWrite;
    809 
    810                    creationCtx.pvUser = pCtx;
    811 
    812                    rc = SharedClipboardURITransferSetInterface(pTransfer, &creationCtx);
     784                   rc = SharedClipboardURICtxTransferAdd(&pCtx->URI, pTransfer);
    813785                   if (RT_SUCCESS(rc))
    814786                   {
    815             #endif
    816                        rc = SharedClipboardURICtxTransferAdd(&pCtx->URI, pTransfer);
    817                        if (RT_SUCCESS(rc))
     787                       /* The data data in CF_HDROP format, as the files are locally present and don't need to be
     788                       * presented as a IDataObject or IStream. */
     789                       HANDLE hClip = hClip = GetClipboardData(CF_HDROP);
     790                       if (hClip)
    818791                       {
    819                            /* The data data in CF_HDROP format, as the files are locally present and don't need to be
    820                            * presented as a IDataObject or IStream. */
    821                            HANDLE hClip = hClip = GetClipboardData(CF_HDROP);
    822                            if (hClip)
     792                           HDROP hDrop = (HDROP)GlobalLock(hClip);
     793                           if (hDrop)
    823794                           {
    824                                HDROP hDrop = (HDROP)GlobalLock(hClip);
    825                                if (hDrop)
     795                               char    *papszList;
     796                               uint32_t cbList;
     797                               rc = VBoxClipboardWinDropFilesToStringList((DROPFILES *)hDrop, &papszList, &cbList);
     798
     799                               GlobalUnlock(hClip);
     800
     801                               if (RT_SUCCESS(rc))
    826802                               {
    827                                    char    *papszList;
    828                                    uint32_t cbList;
    829                                    rc = VBoxClipboardWinDropFilesToStringList((DROPFILES *)hDrop, &papszList, &cbList);
     803                                   rc = SharedClipboardURILTransferSetRoots(pTransfer, papszList, cbList);
    830804                                   if (RT_SUCCESS(rc))
    831805                                   {
     
    836810                                           pThreadCtx->pClipboardCtx = pCtx;
    837811                                           pThreadCtx->pTransfer     = pTransfer;
    838                                            pThreadCtx->papszURIList  = papszList;
    839                                            pThreadCtx->cbURIList     = cbList;
    840 
    841                                            GlobalUnlock(hClip);
    842 
     812
     813                                           rc = SharedClipboardURITransferPrepare(pTransfer);
    843814                                           if (RT_SUCCESS(rc))
    844815                                           {
    845                                                rc = SharedClipboardURITransferPrepare(pTransfer);
    846                                                if (RT_SUCCESS(rc))
    847                                                {
    848                                                    rc = SharedClipboardURITransferRun(pTransfer, vboxClipboardURIWriteThread,
    849                                                                                       pThreadCtx /* pvUser */);
    850                                                    /* pThreadCtx now is owned by vboxClipboardURIWriteThread(). */
    851                                                }
     816                                               rc = SharedClipboardURITransferRun(pTransfer, vboxClipboardURIWriteThread,
     817                                                                                  pThreadCtx /* pvUser */);
     818                                               /* pThreadCtx now is owned by vboxClipboardURIWriteThread(). */
    852819                                           }
    853820                                       }
    854821                                       else
    855822                                           rc = VERR_NO_MEMORY;
    856 
    857                                        if (RT_FAILURE(rc))
    858                                        {
    859                                            RTStrFree(papszList);
    860                                        }
    861823                                   }
    862                                }
    863                                else
    864                                {
    865                                    hClip = NULL;
     824
     825                                   if (papszList)
     826                                       RTStrFree(papszList);
    866827                               }
    867828                           }
     829                           else
     830                           {
     831                               hClip = NULL;
     832                           }
    868833                       }
    869                    //}
     834                   }
    870835               }
    871836
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