VirtualBox

Changeset 81559 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Oct 28, 2019 10:09:35 AM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard: Got rid of the protocol version in VBOX_SHCL_GUEST_FN_CONNECT and internals; instead use the get / query features bit field.

File:
1 edited

Legend:

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

    r81460 r81559  
    9494                           VBOX_SHCL_GUEST_FN_CONNECT, VBOX_SHCL_CPARMS_CONNECT);
    9595
    96         VbglHGCMParmUInt32Set(&Msg.uProtocolVer, 0);
    97         VbglHGCMParmUInt32Set(&Msg.uProtocolFlags, 0);
    9896        VbglHGCMParmUInt32Set(&Msg.cbChunkSize, 0);
    9997        VbglHGCMParmUInt32Set(&Msg.enmCompression, 0);
     
    103101        if (RT_SUCCESS(rc))
    104102        {
    105             rc = VbglHGCMParmUInt32Get(&Msg.uProtocolVer, &pCtx->uProtocolVer);
    106             if (RT_SUCCESS(rc))
    107                 rc = VbglHGCMParmUInt32Get(&Msg.uProtocolFlags, &pCtx->uProtocolFlags);
    108             if (RT_SUCCESS(rc))
    109                 rc = VbglHGCMParmUInt32Get(&Msg.cbChunkSize, &pCtx->cbChunkSize);
     103            rc = VbglHGCMParmUInt32Get(&Msg.cbChunkSize, &pCtx->cbChunkSize);
    110104
    111105            /** @todo Add / handle checksum + compression type. */
     
    116110                 * Report features to the host.
    117111                 */
    118                 uint64_t fHostFeatures0Ignored;
    119                 rc = VbglR3ClipboardReportFeatures(pCtx->uClientID, VBOX_SHCL_GF_NONE /* None yet */,
    120                                                    &fHostFeatures0Ignored);
     112                const uint64_t fGuestFeatures = VBOX_SHCL_GF_0_CONTEXT_ID;
     113
     114                rc = VbglR3ClipboardReportFeatures(pCtx->uClientID, fGuestFeatures,
     115                                                   &pCtx->fHostFeatures);
    121116                if (RT_SUCCESS(rc))
    122                     LogRel2(("Shared Clipboard: Host features: %#RX64\n", fHostFeatures0Ignored));
     117                    LogRel2(("Shared Clipboard: Host features: %#RX64\n", pCtx->fHostFeatures));
    123118                else
    124119                    LogRel(("Shared Clipboard: Warning! Feature reporing failed: %Rrc\n", rc));
     120
     121                pCtx->fUseLegacyProtocol = false;
    125122            }
    126123        }
     
    128125        {
    129126            /* If the above call fails, make sure to use some sane defaults for
    130              * the old (legacy) protocol. */
    131             pCtx->uProtocolVer   = 0;
    132             pCtx->uProtocolFlags = 0;
    133             pCtx->cbChunkSize    = _64K;
     127             * the old (legacy, VBox <= 6.1) protocol. */
     128            pCtx->fUseLegacyProtocol = true;
     129            pCtx->cbChunkSize        = _64K; /* Use 64KB as chunk size by default. */
    134130
    135131            rc = VINF_SUCCESS; /* Failing above is not fatal. */
    136132        }
    137133
    138         LogFlowFunc(("uProtocolVer=%RU32, cbChunkSize=%RU32\n", pCtx->uProtocolVer, pCtx->cbChunkSize));
    139 
    140         LogRel2(("Shared Clipboard: Client %RU32 connected, using protocol v%RU32 (cbChunkSize=%RU32)\n",
    141                  pCtx->uClientID, pCtx->uProtocolVer, pCtx->cbChunkSize));
    142 
     134        LogFlowFunc(("fHostFeatures=%#RX64, cbChunkSize=%RU32\n", pCtx->fHostFeatures, pCtx->cbChunkSize));
     135
     136        LogRel2(("Shared Clipboard: Client %RU32 connected (cbChunkSize=%RU32, fUseLegacyProtocol=%RTbool)\n",
     137                 pCtx->uClientID, pCtx->cbChunkSize, pCtx->fUseLegacyProtocol));
    143138    }
    144139
     
    194189    RT_ZERO(Msg);
    195190
    196     if (pCtx->uProtocolVer >= 1)
    197     {
    198         VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
    199                            VBOX_SHCL_GUEST_FN_MSG_GET, 3);
    200 
    201         Msg.u.v1.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_FORMATS_REPORT);
    202         Msg.u.v1.uFormats.SetUInt32(0);
    203         Msg.u.v1.fFlags.SetUInt32(0);
    204     }
     191    VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, VBOX_SHCL_GUEST_FN_MSG_GET, 3);
     192
     193    Msg.u.v1.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_FORMATS_REPORT);
     194    Msg.u.v1.uFormats.SetUInt32(0);
     195    Msg.u.v1.fFlags.SetUInt32(0);
    205196
    206197    int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
     
    256247
    257248/**
    258  * Get a host message, legacy version (protocol v0). Do not use anymore.
     249 * Get a host message, legacy version (which does not have VBOX_SHCL_GUEST_FN_MSG_GET). Do not use anymore.
    259250 *
    260251 * Note: This is the old message which still is being used for the non-URI Shared Clipboard transfers,
     
    22182209
    22192210#ifdef LOG_ENABLED
    2220     LogFunc(("Handling idMsg=%RU32 (%s), protocol v%RU32\n", idMsg, ShClHostMsgToStr(idMsg), pCtx->uProtocolVer));
     2211    LogFunc(("Handling idMsg=%RU32 (%s)\n", idMsg, ShClHostMsgToStr(idMsg)));
    22212212#endif
    22222213    switch (idMsg)
     
    23082299    LogFlowFunc(("uFormats=0x%x\n", pFormats->uFormats));
    23092300
    2310     if (pCtx->uProtocolVer == 0)
     2301    if (pCtx->fUseLegacyProtocol)
    23112302    {
    23122303        VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, VBOX_SHCL_GUEST_FN_FORMATS_REPORT, 1);
     
    24022393    int rc;
    24032394
    2404     if (pCtx->uProtocolVer == 0)
     2395    if (pCtx->fUseLegacyProtocol)
    24052396    {
    24062397        rc = VbglR3ClipboardWriteData(pCtx->uClientID, pData->uFormat, pData->pvData, pData->cbData);
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