VirtualBox

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


Ignore:
Timestamp:
Oct 18, 2019 12:55:34 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard/Transfers: Implemented reporting / querying additional guest/host features.

File:
1 edited

Legend:

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

    r81346 r81352  
    110110
    111111            /** @todo Add / handle checksum + compression type. */
     112
     113            if (RT_SUCCESS(rc))
     114            {
     115                /*
     116                 * Report features to the host.
     117                 */
     118                uint64_t fHostFeatures0Ignored;
     119                rc = VbglR3ClipboardReportFeatures(pCtx->uClientID, VBOX_SHCL_GF_NONE /* None yet */,
     120                                                   &fHostFeatures0Ignored);
     121                if (RT_SUCCESS(rc))
     122                    LogRel2(("Shared Clipboard: Host features: %#RX64\n", fHostFeatures0Ignored));
     123                else
     124                    LogRel(("Shared Clipboard: Warning! Feature reporing failed: %Rrc\n", rc));
     125            }
    112126        }
    113127        else
     
    318332    }
    319333    return rc;
     334}
     335
     336/**
     337 * Reports features to the host and retrieve host feature set.
     338 *
     339 * @returns VBox status code.
     340 * @param   idClient        The client ID returned by VbglR3ClipboardConnect().
     341 * @param   fGuestFeatures  Features to report, VBOX_SHCL_GF_XXX.
     342 * @param   pfHostFeatures  Where to store the features VBOX_SHCL_HF_XXX.
     343 */
     344VBGLR3DECL(int) VbglR3ClipboardReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures)
     345{
     346    int rc;
     347    do
     348    {
     349        struct
     350        {
     351            VBGLIOCHGCMCALL         Hdr;
     352            HGCMFunctionParameter   f64Features0;
     353            HGCMFunctionParameter   f64Features1;
     354        } Msg;
     355        VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHCL_GUEST_FN_REPORT_FEATURES, 2);
     356        VbglHGCMParmUInt64Set(&Msg.f64Features0, fGuestFeatures);
     357        VbglHGCMParmUInt64Set(&Msg.f64Features1, VBOX_SHCL_GF_1_MUST_BE_ONE);
     358
     359        rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg));
     360        if (RT_SUCCESS(rc))
     361        {
     362            Assert(Msg.f64Features0.type == VMMDevHGCMParmType_64bit);
     363            Assert(Msg.f64Features1.type == VMMDevHGCMParmType_64bit);
     364            if (Msg.f64Features1.u.value64 & VBOX_SHCL_GF_1_MUST_BE_ONE)
     365                rc = VERR_NOT_SUPPORTED;
     366            else if (pfHostFeatures)
     367                *pfHostFeatures = Msg.f64Features0.u.value64;
     368            break;
     369        }
     370    } while (rc == VERR_INTERRUPTED);
     371    return rc;
     372
     373}
     374
     375/**
     376 * Query the host features.
     377 *
     378 * @returns VBox status code.
     379 * @param   idClient        The client ID returned by VbglR3ClipboardConnect().
     380 * @param   pfHostFeatures  Where to store the host feature, VBOX_SHCL_HF_XXX.
     381 */
     382VBGLR3DECL(int) VbglR3ClipboardQueryFeatures(uint32_t idClient, uint64_t *pfHostFeatures)
     383{
     384    int rc;
     385    do
     386    {
     387        struct
     388        {
     389            VBGLIOCHGCMCALL         Hdr;
     390            HGCMFunctionParameter   f64Features0;
     391            HGCMFunctionParameter   f64Features1;
     392        } Msg;
     393        VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHCL_GUEST_FN_QUERY_FEATURES, 2);
     394        VbglHGCMParmUInt64Set(&Msg.f64Features0, 0);
     395        VbglHGCMParmUInt64Set(&Msg.f64Features1, RT_BIT_64(63));
     396
     397        rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg));
     398        if (RT_SUCCESS(rc))
     399        {
     400            Assert(Msg.f64Features0.type == VMMDevHGCMParmType_64bit);
     401            Assert(Msg.f64Features1.type == VMMDevHGCMParmType_64bit);
     402            if (Msg.f64Features1.u.value64 & RT_BIT_64(63))
     403                rc = VERR_NOT_SUPPORTED;
     404            else if (pfHostFeatures)
     405                *pfHostFeatures = Msg.f64Features0.u.value64;
     406            break;
     407        }
     408    } while (rc == VERR_INTERRUPTED);
     409    return rc;
     410
    320411}
    321412
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