VirtualBox

Changeset 58230 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 14, 2015 11:31:33 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103394
Message:

DnD: Bugfixes.

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/DragAndDrop/service.cpp

    r58212 r58230  
    382382                if (cParms == 2)
    383383                {
    384                     uint32_t uProtocol;
    385                     rc = paParms[0].getUInt32(&uProtocol); /* Get protocol version. */
    386                     if (RT_SUCCESS(rc))
    387                         rc = pClient->setProtocol(uProtocol);
     384                    VBOXDNDCBCONNECTMSGDATA data;
     385                    data.hdr.u32Magic = CB_MAGIC_DND_CONNECT;
     386                    rc = paParms[0].getUInt32(&data.uProtocol);
     387                    if (RT_SUCCESS(rc))
     388                        rc = paParms[1].getUInt32(&data.uFlags);
     389                    if (RT_SUCCESS(rc))
     390                        rc = pClient->setProtocol(data.uProtocol);
    388391                    if (RT_SUCCESS(rc))
    389392                    {
    390393                        LogFlowFunc(("Client %RU32 is now using protocol v%RU32\n", pClient->clientId(), pClient->protocol()));
    391                         /** @todo Handle connection flags (paParms[1]). */
     394                        DO_HOST_CALLBACK();
    392395                    }
    393 
    394                     /* Note: Does not reach the host; the client's protocol version
    395                      *       is only kept in this service. */
    396396                }
    397397                break;
  • trunk/src/VBox/Main/include/GuestDnDPrivate.h

    r58225 r58230  
    151151        if (strData.isNotEmpty())
    152152        {
    153             const size_t cbData = strData.length() + 1; /* Include terminating zero. */
    154             rc = resize(cbData);
     153            const size_t cbStrData = strData.length() + 1; /* Include terminating zero. */
     154            rc = resize(cbStrData);
    155155            if (RT_SUCCESS(rc))
    156                 memcpy(pvData, strData.c_str(), cbData);
     156                memcpy(pvData, strData.c_str(), cbStrData);
    157157        }
    158158
  • trunk/src/VBox/Main/include/GuestImpl.h

    r57425 r58230  
    100100        return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
    101101    }
     102    uint32_t    i_getAdditionsRevision(void) { return mData.mAdditionsRevision; }
    102103    uint32_t    i_getAdditionsVersion(void) { return mData.mAdditionsVersionFull; }
    103104    VBOXOSTYPE  i_getGuestOSType(void) { return mData.mOSType; }
  • trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp

    r58212 r58230  
    362362    switch (u32Function)
    363363    {
     364        case DragAndDropSvc::GUEST_DND_CONNECT:
     365        {
     366            /* Not used in here (yet). */
     367            rc = VINF_SUCCESS;
     368            break;
     369        }
     370
    364371        case DragAndDropSvc::GUEST_DND_HG_ACK_OP:
    365372        {
     
    743750    /* Initialzie private stuff. */
    744751    mDataBase.m_cTransfersPending = 0;
     752    mDataBase.m_uProtocolVersion  = 0;
    745753}
    746754
     
    795803}
    796804
     805/**
     806 * Tries to guess the DnD protocol version to use on the guest, based on the
     807 * installed Guest Additions version + revision.
     808 *
     809 * If unable to retrieve the protocol version, VERR_NOT_FOUND is returned along
     810 * with protocol version 1.
     811 *
     812 * @return  IPRT status code.
     813 * @param   puProto                 Where to store the protocol version.
     814 */
    797815int GuestDnDBase::getProtocolVersion(uint32_t *puProto)
    798816{
     
    801819    int rc;
    802820
    803     uint32_t uProto        = 1; /* Use protocol v1 as a fallback. */
     821    uint32_t uProto        = 0;
    804822    uint32_t uVerAdditions = 0;
     823    uint32_t uRevAdditions = 0;
    805824    if (   m_pGuest
    806         && (uVerAdditions = m_pGuest->i_getAdditionsVersion()) > 0)
    807     {
    808 #if 1
     825        && (uVerAdditions = m_pGuest->i_getAdditionsVersion())  > 0
     826        && (uRevAdditions = m_pGuest->i_getAdditionsRevision()) > 0)
     827    {
     828#ifdef _DEBUG
     829# if 0
    809830        /* Hardcode the to-used protocol version; nice for testing side effects. */
    810831        uProto = 3;
    811 #else
    812         if (uVerAdditions >= VBOX_FULL_VERSION_MAKE(5, 0, 0))
    813         {
    814             if (uVerAdditions >= VBOX_FULL_VERSION_MAKE(5, 0, 8))
     832# endif
     833#endif
     834        if (!uProto) /* Protocol not set yet? */
     835        {
     836            if (uVerAdditions >= VBOX_FULL_VERSION_MAKE(5, 0, 0))
    815837            {
    816                 uProto = 3; /* Since VBox 5.0.8: Protocol v3. */
     838                if (uRevAdditions >= 103344) /* Since r103344: Protocol v3. */
     839                {
     840                    uProto = 3;
     841                }
     842                else
     843                    uProto = 2; /* VBox 5.0.0 - 5.0.6: Protocol v2. */
    817844            }
    818             else
    819                 uProto = 2; /* VBox 5.0.0 - 5.0.6: Protocol v2. */
    820         }
    821 #endif
    822         LogRel3(("DnD: uVerAdditions=%RU32 (%RU32.%RU32.%RU32)\n",
    823                  uVerAdditions, VBOX_FULL_VERSION_GET_MAJOR(uVerAdditions), VBOX_FULL_VERSION_GET_MINOR(uVerAdditions),
    824                                 VBOX_FULL_VERSION_GET_BUILD(uVerAdditions)));
    825         rc = VINF_SUCCESS;
     845
     846            LogFlowFunc(("uVerAdditions=%RU32 (%RU32.%RU32.%RU32), r%RU32\n",
     847                         uVerAdditions, VBOX_FULL_VERSION_GET_MAJOR(uVerAdditions), VBOX_FULL_VERSION_GET_MINOR(uVerAdditions),
     848                                        VBOX_FULL_VERSION_GET_BUILD(uVerAdditions), uRevAdditions));
     849            rc = VINF_SUCCESS;
     850        }
    826851    }
    827852    else
     
    831856    }
    832857
    833     LogRel3(("DnD: uProto=%RU32, rc=%Rrc\n", uProto, rc));
     858    LogRel2(("DnD: Guest is using protocol v%RU32, rc=%Rrc\n", uProto, rc));
    834859
    835860    *puProto = uProto;
  • trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp

    r58212 r58230  
    804804        Msg.setNextUInt32(pData->getFmtSize());                                            /* cbFormat */
    805805        Msg.setNextPointer(pData->getMeta().getDataMutable(), pData->getMeta().getSize()); /* pvData */
    806         /* Note1: Fill in the total data to send.
    807          * Note2: Only supports uint32_t. */
    808         Msg.setNextUInt32((uint32_t)pData->getTotal());                                    /* cbData */
     806        /* Fill in the current data block size to send.
     807         * Note: Only supports uint32_t. */
     808        Msg.setNextUInt32((uint32_t)pData->getMeta().getSize());                           /* cbData */
    809809    }
    810810    else
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