VirtualBox

Changeset 82528 in vbox


Ignore:
Timestamp:
Dec 10, 2019 2:35:26 AM (5 years ago)
Author:
vboxsync
Message:

Vbgl: clipboard fixes. bugref:9437

File:
1 edited

Legend:

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

    r82527 r82528  
    115115        if (RT_SUCCESS(rc))
    116116        {
     117            pCtx->fGuestFeatures = fGuestFeatures;
    117118            LogRel2(("Shared Clipboard: Host features: %#RX64\n", pCtx->fHostFeatures));
    118119            if (   (pCtx->fHostFeatures & VBOX_SHCL_HF_0_CONTEXT_ID)
     
    264265    } Msg;
    265266
    266     VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_MSG_GET, 3);
    267     Msg.id64Context.SetUInt64(VBOX_SHCL_HOST_MSG_FORMATS_REPORT);
     267    VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_MSG_GET, 2);
     268    Msg.id64Context.SetUInt32(VBOX_SHCL_HOST_MSG_FORMATS_REPORT);
    268269    Msg.f32Formats.SetUInt32(0);
    269270
     
    271272    if (RT_SUCCESS(rc))
    272273    {
    273         rc = Msg.id64Context.GetUInt64(&pCtx->idContext);
     274        rc = Msg.f32Formats.GetUInt32(&pFormats->Formats);
    274275        AssertRC(rc);
    275         int rc2 = Msg.f32Formats.GetUInt32(&pFormats->Formats);
    276         AssertRCStmt(rc2, rc = rc2);
    277     }
    278 
    279     LogFlowFuncLeaveRC(rc);
    280     return rc;
    281 }
    282 
    283 
    284 /**
    285  * Receives a host request to read clipboard data from the guest.
     276    }
     277
     278    LogFlowFuncLeaveRC(rc);
     279    return rc;
     280}
     281
     282
     283/**
     284 * Fetches a VBOX_SHCL_HOST_MSG_READ_DATA_CID message.
    286285 *
    287286 * @returns VBox status code.
     
    289288 * @param   pfFormat            Where to return the requested format.
    290289 */
    291 static int vbglR3ClipboardReadDataRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLFORMAT pfFormat)
     290static int vbglR3ClipboardFetchReadDataCid(PVBGLR3SHCLCMDCTX pCtx, PSHCLFORMAT pfFormat)
    292291{
    293292    AssertPtrReturn(pCtx,     VERR_INVALID_POINTER);
     
    312311        int rc2 = Msg.f32Format.GetUInt32(pfFormat);
    313312        AssertRCStmt(rc2, rc = rc2);
     313    }
     314
     315    LogFlowFuncLeaveRC(rc);
     316    return rc;
     317}
     318
     319
     320/**
     321 * Fetches a VBOX_SHCL_HOST_MSG_READ_DATA message.
     322 *
     323 * @returns VBox status code.
     324 * @param   pCtx                Shared Clipboard command context to use for the connection.
     325 * @param   pfFormat            Where to return the requested format.
     326 */
     327static int vbglR3ClipboardFetchReadData(PVBGLR3SHCLCMDCTX pCtx, PSHCLFORMAT pfFormat)
     328{
     329    AssertPtrReturn(pCtx,     VERR_INVALID_POINTER);
     330    AssertPtrReturn(pfFormat, VERR_INVALID_POINTER);
     331
     332    struct
     333    {
     334        VBGLIOCHGCMCALL         Hdr;
     335        HGCMFunctionParameter   id32Msg;
     336        HGCMFunctionParameter   f32Format;
     337    } Msg;
     338
     339    VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_MSG_GET, 2);
     340    Msg.id32Msg.SetUInt32(VBOX_SHCL_HOST_MSG_READ_DATA);
     341    Msg.f32Format.SetUInt32(0);
     342
     343    int rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg));
     344    if (RT_SUCCESS(rc))
     345    {
     346        rc = Msg.f32Format.GetUInt32(pfFormat);
     347        AssertRC(rc);
    314348    }
    315349
     
    487521 * @note    Restore check is only performed optimally with a 6.0 host.
    488522 */
    489 int VbglR3ClipboardMsgPeekWait(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck)
     523VBGLR3DECL(int) VbglR3ClipboardMsgPeekWait(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pidMsg,
     524                                           uint32_t *pcParameters, uint64_t *pidRestoreCheck)
    490525{
    491526    AssertPtrReturn(pidMsg, VERR_INVALID_POINTER);
     
    23342369            }
    23352370
     2371            case VBOX_SHCL_HOST_MSG_READ_DATA_CID:
     2372            {
     2373                rc = vbglR3ClipboardFetchReadDataCid(pCtx, &pEvent->u.fReadData);
     2374                if (RT_SUCCESS(rc))
     2375                    pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_READ_DATA;
     2376                break;
     2377            }
     2378
    23362379            case VBOX_SHCL_HOST_MSG_READ_DATA:
    23372380            {
    2338                 rc = vbglR3ClipboardReadDataRecv(pCtx, &pEvent->u.fReadData);
     2381                rc = vbglR3ClipboardFetchReadData(pCtx, &pEvent->u.fReadData);
    23392382                if (RT_SUCCESS(rc))
    23402383                    pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_READ_DATA;
     
    23512394            default:
    23522395            {
     2396                /** @todo r=bird: BUGBUG - need a skip command here! */
    23532397                rc = VERR_NOT_SUPPORTED;
    23542398                break;
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