VirtualBox

Ignore:
Timestamp:
Jul 9, 2019 8:14:01 AM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard/URI: Update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/ClipboardDataObjectImpl-win.cpp

    r79497 r79630  
    249249    if (RT_SUCCESS(rc))
    250250    {
    251         VBOXCLIPBOARDLISTHDR Hdr;
    252         rc = SharedClipboardURIListHdrInit(&Hdr);
     251        VBOXCLIPBOARDLISTOPENPARMS openParmsList;
     252        rc = SharedClipboardURIListOpenParmsInit(&openParmsList);
    253253        if (RT_SUCCESS(rc))
    254254        {
    255             VBOXCLIPBOARDLISTHANDLE hList;
    256             rc = SharedClipboardURITransferListOpen(pTransfer, &Hdr, &hList);
     255            SHAREDCLIPBOARDLISTHANDLE hList;
     256            rc = SharedClipboardURITransferListOpen(pTransfer, &openParmsList, &hList);
    257257            if (RT_SUCCESS(rc))
    258258            {
    259                 LogFlowFunc(("hList=%RU64, cTotalObjects=%RU64, cbTotalSize=%RU64\n\n",
    260                              hList, Hdr.cTotalObjects, Hdr.cbTotalSize));
    261 
    262                 for (uint64_t i = 0; i < Hdr.cTotalObjects; i++)
     259                LogFlowFunc(("hList=%RU64\n", hList));
     260
     261                VBOXCLIPBOARDLISTHDR hdrList;
     262                rc = SharedClipboardURITransferListGetHeader(pTransfer, hList, &hdrList);
     263                if (RT_SUCCESS(rc))
    263264                {
    264                     VBOXCLIPBOARDLISTENTRY Entry;
    265                     rc = SharedClipboardURITransferListRead(pTransfer, hList, &Entry);
     265                    LogFlowFunc(("cTotalObjects=%RU64, cbTotalSize=%RU64\n\n",
     266                                 hdrList.cTotalObjects, hdrList.cbTotalSize));
     267
     268                    for (uint64_t i = 0; i < hdrList.cTotalObjects; i++)
     269                    {
     270                        VBOXCLIPBOARDLISTENTRY entryList;
     271                        rc = SharedClipboardURITransferListRead(pTransfer, hList, &entryList);
     272                        if (RT_SUCCESS(rc))
     273                        {
     274                        }
     275                        else
     276                            break;
     277
     278                        if (pTransfer->Thread.fStop)
     279                            break;
     280                    }
     281
    266282                    if (RT_SUCCESS(rc))
    267283                    {
    268 
     284                        /*
     285                         * Signal the "list complete" event so that this data object can return (valid) data via ::GetData().
     286                         * This in turn then will create IStream instances (by the OS) for each file system object to handle.
     287                         */
     288                        int rc2 = RTSemEventSignal(pThis->m_EventListComplete);
     289                        AssertRC(rc2);
     290
     291                        LogFlowFunc(("Waiting for transfer to complete ...\n"));
     292
     293                        /* Transferring stuff can take a while, so don't use any timeout here. */
     294                        rc2 = RTSemEventWait(pThis->m_EventTransferComplete, RT_INDEFINITE_WAIT);
     295                        AssertRC(rc2);
    269296                    }
    270                     else
    271                         break;
    272 
    273                     if (pTransfer->Thread.fStop)
    274                         break;
    275                 }
    276 
    277                 if (RT_SUCCESS(rc))
    278                 {
    279                     /*
    280                      * Signal the "list complete" event so that this data object can return (valid) data via ::GetData().
    281                      * This in turn then will create IStream instances (by the OS) for each file system object to handle.
    282                      */
    283                     int rc2 = RTSemEventSignal(pThis->m_EventListComplete);
    284                     AssertRC(rc2);
    285 
    286                     LogFlowFunc(("Waiting for transfer to complete ...\n"));
    287 
    288                     /* Transferring stuff can take a while, so don't use any timeout here. */
    289                     rc2 = RTSemEventWait(pThis->m_EventTransferComplete, RT_INDEFINITE_WAIT);
    290                     AssertRC(rc2);
    291297                }
    292298
     
    294300            }
    295301
    296             SharedClipboardURIListHdrDestroy(&Hdr);
     302            SharedClipboardURIListOpenParmsDestroy(&openParmsList);
    297303        }
    298304
     
    497503                    if (RT_SUCCESS(rc))
    498504                    {
     505                        /* Don't block for too long here, as this also will screw other apps running on the OS. */
    499506                        LogFunc(("Waiting for listing to arrive ...\n"));
    500                         rc = RTSemEventWait(m_EventListComplete, 5 * 60 * 1000 /* 5 min timeout */);
     507                        rc = RTSemEventWait(m_EventListComplete, 10 * 1000 /* 10s timeout */);
    501508                        if (RT_SUCCESS(rc))
    502509                        {
     
    530537            LogFlowFunc(("FormatIndex_FileContents: m_uObjIdx=%u\n", m_uObjIdx));
    531538
     539            SHAREDCLIPBOARDOBJHANDLE hObj = 0; /** @todo */
     540
    532541            /* Hand-in the provider so that our IStream implementation can continue working with it. */
    533             hr = VBoxClipboardWinStreamImpl::Create(this /* pParent */, m_pTransfer, m_uObjIdx, &m_pStream);
     542            hr = VBoxClipboardWinStreamImpl::Create(this /* pParent */, m_pTransfer, hObj, &m_pStream);
    534543            if (SUCCEEDED(hr))
    535544            {
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