VirtualBox

Changeset 85584 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 31, 2020 4:48:59 PM (4 years ago)
Author:
vboxsync
Message:

DnD/VbglR3: Fixes for receiving raw meta data from host.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp

    r85557 r85584  
    821821        return VERR_NO_MEMORY;
    822822
    823     DNDDROPPEDFILES droppedFiles;
    824     RT_ZERO(droppedFiles);
    825 
    826     int rc = DnDDroppedFilesInit(&droppedFiles);
    827     if (RT_SUCCESS(rc))
    828         rc = DnDDroppedFilesOpenTemp(&droppedFiles, DNDURIDROPPEDFILE_FLAGS_NONE);
    829 
    830     if (RT_FAILURE(rc))
    831     {
    832         LogRel(("DnD: Initializing dropped files directory failed with %Rrc\n", rc));
    833         return rc;
    834     }
    835 
    836823    void    *pvData = NULL;
    837824    uint64_t cbData = 0;
    838825
    839     rc = vbglR3DnDHGRecvDataLoop(pCtx, &dataHdr, &pvData, &cbData);
     826    int rc = vbglR3DnDHGRecvDataLoop(pCtx, &dataHdr, &pvData, &cbData);
    840827    if (RT_SUCCESS(rc))
    841828    {
     829        LogRel2(("DnD: Received %RU32 bytes meta data in format '%s'\n", cbData, (char *)dataHdr.pvMetaFmt));
     830
    842831        /**
    843832         * Check if this is an URI event. If so, let VbglR3 do all the actual
     
    852841        if (DnDMIMEHasFileURLs((char *)dataHdr.pvMetaFmt, dataHdr.cbMetaFmt)) /* URI data. */
    853842        {
    854             AssertPtr(pvData);
    855             Assert(cbData);
    856 
    857             /* Use the dropped files directory as the root directory for the current transfer. */
    858             rc = DnDTransferListInitEx(&pMeta->u.URI.Transfer, DnDDroppedFilesGetDirAbs(&droppedFiles),
    859                                        DNDTRANSFERLISTFMT_NATIVE);
     843            DNDDROPPEDFILES droppedFiles;
     844            RT_ZERO(droppedFiles);
     845
     846            rc = DnDDroppedFilesInit(&droppedFiles);
    860847            if (RT_SUCCESS(rc))
     848                rc = DnDDroppedFilesOpenTemp(&droppedFiles, DNDURIDROPPEDFILE_FLAGS_NONE);
     849
     850            if (RT_FAILURE(rc))
    861851            {
    862                 rc = DnDTransferListAppendRootsFromBuffer(&pMeta->u.URI.Transfer, DNDTRANSFERLISTFMT_URI, (const char *)pvData, cbData,
    863                                                           DND_PATH_SEPARATOR, 0 /* fFlags */);
     852                LogRel(("DnD: Initializing dropped files directory failed with %Rrc\n", rc));
     853            }
     854            else
     855            {
     856                AssertPtr(pvData);
     857                Assert(cbData);
     858
     859                /* Use the dropped files directory as the root directory for the current transfer. */
     860                rc = DnDTransferListInitEx(&pMeta->u.URI.Transfer, DnDDroppedFilesGetDirAbs(&droppedFiles),
     861                                           DNDTRANSFERLISTFMT_NATIVE);
    864862                if (RT_SUCCESS(rc))
    865863                {
    866                     rc = vbglR3DnDHGRecvURIData(pCtx, &dataHdr, &droppedFiles);
     864                    rc = DnDTransferListAppendRootsFromBuffer(&pMeta->u.URI.Transfer, DNDTRANSFERLISTFMT_URI, (const char *)pvData, cbData,
     865                                                              DND_PATH_SEPARATOR, 0 /* fFlags */);
    867866                    if (RT_SUCCESS(rc))
    868867                    {
    869                         pMeta->enmType = VBGLR3GUESTDNDMETADATATYPE_URI_LIST;
     868                        rc = vbglR3DnDHGRecvURIData(pCtx, &dataHdr, &droppedFiles);
     869                        if (RT_SUCCESS(rc))
     870                        {
     871                            pMeta->enmType = VBGLR3GUESTDNDMETADATATYPE_URI_LIST;
     872                        }
    870873                    }
    871874                }
     
    874877        else /* Raw data. */
    875878        {
     879            pMeta->u.Raw.cbMeta = cbData;
     880            pMeta->u.Raw.pvMeta = pvData;
     881
    876882            pMeta->enmType = VBGLR3GUESTDNDMETADATATYPE_RAW;
    877883        }
     
    881887        RTMemFree(dataHdr.pvMetaFmt);
    882888
    883     if (RT_SUCCESS(rc))
    884     {
    885 
    886     }
    887     else if (   RT_FAILURE(rc)
    888              && rc != VERR_CANCELLED)
     889    if (RT_FAILURE(rc))
    889890    {
    890891        if (pvData)
    891892            RTMemFree(pvData);
    892893
    893         int rc2 = VbglR3DnDHGSendProgress(pCtx, DND_PROGRESS_ERROR, 100 /* Percent */, rc);
    894         if (RT_FAILURE(rc2))
    895             LogFlowFunc(("Unable to send progress error %Rrc to host: %Rrc\n", rc, rc2));
     894        LogRel(("DnD: Receiving meta data failed with %Rrc\n", rc));
     895
     896        if (rc != VERR_CANCELLED)
     897        {
     898            int rc2 = VbglR3DnDHGSendProgress(pCtx, DND_PROGRESS_ERROR, 100 /* Percent */, rc);
     899            if (RT_FAILURE(rc2))
     900                LogFlowFunc(("Unable to send progress error %Rrc to host: %Rrc\n", rc, rc2));
     901        }
    896902    }
    897903
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