VirtualBox

Ignore:
Timestamp:
Jan 29, 2014 11:12:44 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
91898
Message:

DnD: First working implementation for Windows guest->host support; still work in progress. As for now only pure text data can be dragged over.

File:
1 edited

Legend:

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

    r49930 r50265  
    882882                break;
    883883            }
    884 #ifdef VBOX_WITH_DRAG_AND_DROP_GH
    885884            case DragAndDropSvc::HOST_DND_GH_REQ_PENDING:
    886885            {
     
    905904                break;
    906905            }
    907 #endif /* VBOX_WITH_DRAG_AND_DROP_GH */
    908906            default:
    909                 AssertMsgFailedReturn(("Message %u isn't expected in this context", uMsg),
    910                                       VERR_INVALID_PARAMETER);
     907                rc = VERR_NOT_SUPPORTED;
    911908                break;
    912909        }
     
    944941    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_HG_REQ_DATA;
    945942    Msg.hdr.cParms      = 1;
     943    /* Initialize parameter */
     944    Msg.pFormat.SetPtr((void*)pcszFormat, (uint32_t)strlen(pcszFormat) + 1);
    946945    /* Do request */
    947     Msg.pFormat.SetPtr((void*)pcszFormat, (uint32_t)strlen(pcszFormat) + 1);
    948946    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    949947    if (RT_SUCCESS(rc))
     
    968966    Msg.uDefAction.SetUInt32(uDefAction);
    969967    Msg.uAllActions.SetUInt32(uAllActions);
    970     Msg.pFormat.SetPtr((void*)pcszFormat, static_cast<uint32_t>(strlen(pcszFormat) + 1));
     968    Msg.pFormat.SetPtr((void*)pcszFormat, (uint32_t)strlen(pcszFormat) + 1);
    971969    /* Do request */
    972970    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     
    982980    AssertReturn(cbData,    VERR_INVALID_PARAMETER);
    983981
    984     /* Todo: URI support. Currently only data is send over to the host. For URI
    985      * support basically the same as in the H->G case (see
    986      * HostServices/DragAndDrop/dndmanager.h/cpp) has to be done:
    987      * 1. Parse the urilist
    988      * 2. Recursively send "create dir" and "transfer file" msg to the host
    989      * 3. Patch the urilist by removing all base dirnames
    990      * 4. On the host all needs to received and the urilist patched afterwards
    991      *    to point to the new location
     982    /** @todo Add URI support. Currently only data is send over to the host. For URI
     983     *        support basically the same as in the H->G case (see
     984     *        HostServices/DragAndDrop/dndmanager.h/cpp) has to be done:
     985     *        1. Parse the urilist
     986     *        2. Recursively send "create dir" and "transfer file" msg to the host
     987     *        3. Patch the urilist by removing all base dirnames
     988     *        4. On the host all needs to received and the urilist patched afterwards
     989     *           to point to the new location
    992990     */
    993991
     
    999997    Msg.hdr.cParms      = 2;
    1000998    Msg.uSize.SetUInt32(cbData);
     999
    10011000    int rc          = VINF_SUCCESS;
    1002     uint32_t cbMax  = _1M;
    1003     uint32_t cbSend = 0;
    1004     while(cbSend < cbData)
     1001    uint32_t cbMax  = _1M; /** @todo Remove 1 MB limit. */
     1002    uint32_t cbSent = 0;
     1003
     1004    while (cbSent < cbData)
    10051005    {
    10061006        /* Initialize parameter */
    1007         uint32_t cbToSend = RT_MIN(cbData - cbSend, cbMax);
    1008         Msg.pData.SetPtr(static_cast<uint8_t*>(pvData) + cbSend, cbToSend);
     1007        uint32_t cbToSend = RT_MIN(cbData - cbSent, cbMax);
     1008        Msg.pData.SetPtr(static_cast<uint8_t*>(pvData) + cbSent, cbToSend);
    10091009        /* Do request */
    10101010        rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     
    10181018        else
    10191019            break;
    1020         cbSend += cbToSend;
     1020        cbSent += cbToSend;
    10211021//        RTThreadSleep(500);
    10221022    }
Note: See TracChangeset for help on using the changeset viewer.

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