VirtualBox

Changeset 57743 in vbox for trunk


Ignore:
Timestamp:
Sep 14, 2015 3:34:14 PM (9 years ago)
Author:
vboxsync
Message:

DnD/VbglR3: Check the host version before doing a (blocking) GUEST_DND_CONNECT, as older host services might not support this command in a proper (non-blocking) way.

File:
1 edited

Legend:

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

    r57654 r57743  
    940940        if (RT_SUCCESS(rc))
    941941        {
    942             /* Set the protocol version to use. */
     942            /* Set the default protocol version to use. */
    943943            pCtx->uProtocol = 2;
    944944
     
    948948    }
    949949
    950     if (RT_SUCCESS(rc))
     950    /*
     951     * Check if the host is >= VBox 5.0 which in case supports GUEST_DND_CONNECT.
     952     */
     953    bool fSupportsConnectReq = false;
     954    if (RT_SUCCESS(rc))
     955    {
     956        /* The guest property service might not be available. Not fatal. */
     957        uint32_t uGuestPropSvcClientID;
     958        int rc2 = VbglR3GuestPropConnect(&uGuestPropSvcClientID);
     959        if (RT_SUCCESS(rc2))
     960        {
     961            char *pszHostVersion;
     962            rc2 = VbglR3GuestPropReadValueAlloc(uGuestPropSvcClientID, "/VirtualBox/HostInfo/VBoxVer", &pszHostVersion);
     963            if (RT_SUCCESS(rc2))
     964            {
     965                fSupportsConnectReq = RTStrVersionCompare(pszHostVersion, "5.0") >= 0;
     966                VbglR3GuestPropReadValueFree(pszHostVersion);
     967            }
     968
     969            VbglR3GuestPropDisconnect(uGuestPropSvcClientID);
     970        }
     971    }
     972
     973    if (fSupportsConnectReq)
    951974    {
    952975        /*
     
    969992            rc2 = Msg.hdr.result; /* Not fatal. */
    970993
     994        if (RT_FAILURE(rc2))
     995            fSupportsConnectReq = false;
     996
    971997        LogFlowFunc(("Connection request ended with rc=%Rrc\n", rc2));
    972998    }
     999
     1000    /* GUEST_DND_CONNECT not supported; play safe here and just use protocol v1. */
     1001    if (!fSupportsConnectReq)
     1002        pCtx->uProtocol = 1; /* Fall back to protocol version 1 (< VBox 5.0). */
    9731003
    9741004    LogFlowFunc(("uClient=%RU32, uProtocol=%RU32, rc=%Rrc\n", pCtx->uClientID, pCtx->uProtocol, rc));
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