VirtualBox

Changeset 79296 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 24, 2019 9:09:21 AM (6 years ago)
Author:
vboxsync
Message:

Main,VBoxService,GstCtrlSvc: Added functions for exchanging feature masks between guest and host so new features can more easily be added without resorting to version comparsion magic. Added alternative read and write completion notifications that includes the new file offset. Made sure RTFileReadAt and RTFileWriteAt are followed by a RTFileSeek call so we'll end up with the same file position regardless of guest OS. bugref:9320

Location:
trunk/src/VBox
Files:
7 edited

Legend:

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

    r79287 r79296  
    309309
    310310/**
     311 * Reports features to the host and retrieve host feature set.
     312 *
     313 * @returns VBox status code.
     314 * @param   idClient        The client ID returned by VbglR3GuestCtrlConnect().
     315 * @param   fGuestFeatures  Features to report, VBOX_GUESTCTRL_GF_XXX.
     316 * @param   pfHostFeatures  Where to store the features VBOX_GUESTCTRL_HF_XXX.
     317 */
     318VBGLR3DECL(int) VbglR3GuestCtrlReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures)
     319{
     320    int rc;
     321    do
     322    {
     323        struct
     324        {
     325            VBGLIOCHGCMCALL         Hdr;
     326            HGCMFunctionParameter   f64Features0;
     327            HGCMFunctionParameter   f64Features1;
     328        } Msg;
     329        VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_MSG_REPORT_FEATURES, 2);
     330        VbglHGCMParmUInt64Set(&Msg.f64Features0, fGuestFeatures);
     331        VbglHGCMParmUInt64Set(&Msg.f64Features1, VBOX_GUESTCTRL_GF_1_MUST_BE_ONE);
     332
     333        rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr));
     334        if (RT_SUCCESS(rc))
     335        {
     336            Assert(Msg.f64Features0.type == VMMDevHGCMParmType_64bit);
     337            Assert(Msg.f64Features1.type == VMMDevHGCMParmType_64bit);
     338            if (Msg.f64Features1.u.value64 & VBOX_GUESTCTRL_GF_1_MUST_BE_ONE)
     339                rc = VERR_NOT_SUPPORTED;
     340            else if (pfHostFeatures)
     341                *pfHostFeatures = Msg.f64Features0.u.value64;
     342            break;
     343        }
     344    } while (rc == VERR_INTERRUPTED);
     345    return rc;
     346
     347}
     348
     349
     350/**
     351 * Query the host features.
     352 *
     353 * @returns VBox status code.
     354 * @param   idClient        The client ID returned by VbglR3GuestCtrlConnect().
     355 * @param   pfHostFeatures  Where to store the host feature, VBOX_GUESTCTRL_HF_XXX.
     356 */
     357VBGLR3DECL(int) VbglR3GuestCtrlQueryFeatures(uint32_t idClient, uint64_t *pfHostFeatures)
     358{
     359    int rc;
     360    do
     361    {
     362        struct
     363        {
     364            VBGLIOCHGCMCALL         Hdr;
     365            HGCMFunctionParameter   f64Features0;
     366            HGCMFunctionParameter   f64Features1;
     367        } Msg;
     368        VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_MSG_QUERY_FEATURES, 2);
     369        VbglHGCMParmUInt64Set(&Msg.f64Features0, 0);
     370        VbglHGCMParmUInt64Set(&Msg.f64Features1, RT_BIT_64(63));
     371
     372        rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr));
     373        if (RT_SUCCESS(rc))
     374        {
     375            Assert(Msg.f64Features0.type == VMMDevHGCMParmType_64bit);
     376            Assert(Msg.f64Features1.type == VMMDevHGCMParmType_64bit);
     377            if (Msg.f64Features1.u.value64 & RT_BIT_64(63))
     378                rc = VERR_NOT_SUPPORTED;
     379            else if (pfHostFeatures)
     380                *pfHostFeatures = Msg.f64Features0.u.value64;
     381            break;
     382        }
     383    } while (rc == VERR_INTERRUPTED);
     384    return rc;
     385
     386}
     387
     388
     389/**
    311390 * Peeks at the next host message, waiting for one to turn up.
    312391 *
     
    14431522
    14441523
     1524VBGLR3DECL(int) VbglR3GuestCtrlFileCbReadOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc,
     1525                                                void *pvData, uint32_t cbData, int64_t offNew)
     1526{
     1527    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1528
     1529    HGCMReplyFileNotify Msg;
     1530    VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_MSG_FILE_NOTIFY, 5);
     1531    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1532    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_READ_OFFSET);
     1533    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     1534    VbglHGCMParmPtrSet(&Msg.u.ReadOffset.pvData, pvData, cbData);
     1535    VbglHGCMParmUInt64Set(&Msg.u.ReadOffset.off64New, (uint64_t)offNew);
     1536
     1537    return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.read));
     1538}
     1539
     1540
    14451541VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten)
    14461542{
     
    14531549    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
    14541550    VbglHGCMParmUInt32Set(&Msg.u.write.written, cbWritten);
     1551
     1552    return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.write));
     1553}
     1554
     1555
     1556VBGLR3DECL(int) VbglR3GuestCtrlFileCbWriteOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten, int64_t offNew)
     1557{
     1558    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1559
     1560    HGCMReplyFileNotify Msg;
     1561    VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_MSG_FILE_NOTIFY, 5);
     1562    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1563    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_WRITE_OFFSET);
     1564    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     1565    VbglHGCMParmUInt32Set(&Msg.u.WriteOffset.cb32Written, cbWritten);
     1566    VbglHGCMParmUInt64Set(&Msg.u.WriteOffset.off64New, (uint64_t)offNew);
    14551567
    14561568    return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.write));
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r76958 r79296  
    7979/** The guest control service client ID. */
    8080uint32_t                    g_idControlSvcClient = 0;
     81/** VBOX_GUESTCTRL_HF_XXX */
     82uint64_t                    g_fControlHostFeatures0 = 0;
    8183#if 0 /** @todo process limit */
    8284/** How many started guest processes are kept into memory for supplying
     
    210212            VGSvcVerbose(3, "Guest control service client ID=%RU32%s\n",
    211213                         g_idControlSvcClient, g_fControlSupportsOptimizations ? " w/ optimizations" : "");
     214
     215            /*
     216             * Report features to the host.
     217             */
     218            rc = VbglR3GuestCtrlReportFeatures(g_idControlSvcClient, VBOX_GUESTCTRL_GF_0_SET_SIZE, &g_fControlHostFeatures0);
     219            if (RT_SUCCESS(rc))
     220                VGSvcVerbose(3, "Host features: %#RX64\n", g_fControlHostFeatures0);
     221            else
     222                VGSvcVerbose(1, "Warning! Feature reporing failed: %Rrc\n", rc);
     223
    212224            return VINF_SUCCESS;
    213225        }
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.h

    r76563 r79296  
    6868    /** Context ID. */
    6969    uint32_t                        uContextID;
     70    /** RTFILE_O_XXX flags. */
     71    uint64_t                        fOpen;
    7072} VBOXSERVICECTRLFILE;
    7173/** Pointer to thread data. */
     
    294296extern VBOXSERVICECTRLSESSION   g_Session;
    295297extern uint32_t                 g_idControlSvcClient;
     298extern uint64_t                 g_fControlHostFeatures0;
    296299extern bool                     g_fControlSupportsOptimizations;
    297300
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp

    r79287 r79296  
    334334                            uHandle = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pHostCtx->uContextID);
    335335                            pFile->uHandle = uHandle;
     336                            pFile->fOpen   = fFlags;
    336337                            RTListAppend(&pSession->lstFiles, &pFile->Node);
    337338                            VGSvcVerbose(2, "[File %s] Opened (ID=%RU32)\n", pFile->szName, pFile->uHandle);
     
    448449         * ignore failure as the host better respect our buffer limits.
    449450         */
    450         size_t cbRead = 0;
     451        uint32_t offNew = 0;
     452        size_t   cbRead = 0;
    451453        PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle);
    452454        if (pFile)
     
    456458
    457459            rc = RTFileRead(pFile->hFile, *ppvScratchBuf, RT_MIN(cbToRead, *pcbScratchBuf), &cbRead);
    458             VGSvcVerbose(5, "[File %s] Read %zu/%RU32 bytes, rc=%Rrc\n", pFile->szName, cbRead, cbToRead, rc);
     460            offNew = (int64_t)RTFileTell(pFile->hFile);
     461            VGSvcVerbose(5, "[File %s] Read %zu/%RU32 bytes, rc=%Rrc, offNew=%RI64\n", pFile->szName, cbRead, cbToRead, rc, offNew);
    459462        }
    460463        else
     
    467470         * Report result and data back to the host.
    468471         */
    469         int rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead);
     472        int rc2;
     473        if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET)
     474            rc2 = VbglR3GuestCtrlFileCbReadOffset(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead, offNew);
     475        else
     476            rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead);
    470477        if (RT_FAILURE(rc2))
    471478        {
     
    505512         * ignore failure as the host better respect our buffer limits.
    506513         */
    507         size_t cbRead = 0;
     514        int64_t offNew = 0;
     515        size_t  cbRead = 0;
    508516        PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle);
    509517        if (pFile)
     
    513521
    514522            rc = RTFileReadAt(pFile->hFile, (RTFOFF)offReadAt, *ppvScratchBuf, RT_MIN(cbToRead, *pcbScratchBuf), &cbRead);
    515             VGSvcVerbose(5, "[File %s] Read %zu bytes @ %RU64, rc=%Rrc\n", pFile->szName, cbRead, offReadAt, rc);
     523            if (RT_SUCCESS(rc))
     524            {
     525                offNew = offReadAt + cbRead;
     526                RTFileSeek(pFile->hFile, offNew, RTFILE_SEEK_BEGIN, NULL); /* RTFileReadAt does not always change position. */
     527            }
     528            else
     529                offNew = (int64_t)RTFileTell(pFile->hFile);
     530            VGSvcVerbose(5, "[File %s] Read %zu bytes @ %RU64, rc=%Rrc, offNew=%RI64\n", pFile->szName, cbRead, offReadAt, rc, offNew);
    516531        }
    517532        else
     
    524539         * Report result and data back to the host.
    525540         */
    526         int rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead);
     541        int rc2;
     542        if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET)
     543            rc2 = VbglR3GuestCtrlFileCbReadOffset(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead, offNew);
     544        else
     545            rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead);
    527546        if (RT_FAILURE(rc2))
    528547        {
     
    561580         * Locate the file and do the writing.
    562581         */
    563         size_t cbWritten = 0;
     582        int64_t offNew    = 0;
     583        size_t  cbWritten = 0;
    564584        PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle);
    565585        if (pFile)
    566586        {
    567587            rc = RTFileWrite(pFile->hFile, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), &cbWritten);
    568             VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 =>  %Rrc, cbWritten=%zu\n",
    569                          pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), rc, cbWritten);
     588            offNew = (int64_t)RTFileTell(pFile->hFile);
     589            VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 =>  %Rrc, cbWritten=%zu, offNew=%RI64\n",
     590                         pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), rc, cbWritten, offNew);
    570591        }
    571592        else
     
    578599         * Report result back to host.
    579600         */
    580         int rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten);
     601        int rc2;
     602        if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET)
     603            rc2 = VbglR3GuestCtrlFileCbWriteOffset(pHostCtx, rc, (uint32_t)cbWritten, offNew);
     604        else
     605            rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten);
    581606        if (RT_FAILURE(rc2))
    582607        {
     
    616641         * Locate the file and do the writing.
    617642         */
    618         size_t cbWritten = 0;
     643        int64_t offNew    = 0;
     644        size_t  cbWritten = 0;
    619645        PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle);
    620646        if (pFile)
    621647        {
    622648            rc = RTFileWriteAt(pFile->hFile, (RTFOFF)offWriteAt, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), &cbWritten);
    623             VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 @ %RU64 =>  %Rrc, cbWritten=%zu\n",
    624                          pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), offWriteAt, rc, cbWritten);
     649            if (RT_SUCCESS(rc))
     650            {
     651                offNew = offWriteAt + cbWritten;
     652
     653                /* RTFileWriteAt does not always change position: */
     654                if (!(pFile->fOpen & RTFILE_O_APPEND))
     655                    RTFileSeek(pFile->hFile, offNew, RTFILE_SEEK_BEGIN, NULL);
     656                else
     657                    RTFileSeek(pFile->hFile, 0, RTFILE_SEEK_END, (uint64_t *)&offNew);
     658            }
     659            else
     660                offNew = (int64_t)RTFileTell(pFile->hFile);
     661            VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 @ %RU64 =>  %Rrc, cbWritten=%zu, offNew=%RI64\n",
     662                         pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), offWriteAt, rc, cbWritten, offNew);
    625663        }
    626664        else
     
    633671         * Report result back to host.
    634672         */
    635         int rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten);
     673        int rc2;
     674        if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET)
     675            rc2 = VbglR3GuestCtrlFileCbWriteOffset(pHostCtx, rc, (uint32_t)cbWritten, offNew);
     676        else
     677            rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten);
    636678        if (RT_FAILURE(rc2))
    637679        {
     
    16581700    g_fControlSupportsOptimizations = VbglR3GuestCtrlSupportsOptimizations(idClient);
    16591701    g_idControlSvcClient            = idClient;
     1702    VbglR3GuestCtrlQueryFeatures(idClient, &g_fControlHostFeatures0);
    16601703
    16611704    rc = vgsvcGstCtrlSessionReadKeyAndAccept(idClient, pSession->StartupInfo.uSessionID);
  • trunk/src/VBox/Main/include/GuestImpl.h

    r79050 r79296  
    113113                                ComObjPtr<GuestSession> &pGuestSession);
    114114    inline bool i_sessionExists(uint32_t uSessionID);
    115 
     115    /** Returns the VBOX_GUESTCTRL_GF_0_XXX mask reported by the guest. */
     116    uint64_t    i_getGuestControlFeatures0() const { return mData.mfGuestFeatures0; }
     117    /** Returns the VBOX_GUESTCTRL_GF_1_XXX mask reported by the guest. */
     118    uint64_t    i_getGuestControlFeatures1() const { return mData.mfGuestFeatures1; }
    116119#endif
    117120    /** @}  */
     
    193196        Data() : mOSType(VBOXOSTYPE_Unknown),  mAdditionsRunLevel(AdditionsRunLevelType_None)
    194197            , mAdditionsVersionFull(0), mAdditionsRevision(0), mAdditionsFeatures(0)
     198#ifdef VBOX_WITH_GUEST_CONTROL
     199            , mfGuestFeatures0(0), mfGuestFeatures1(0)
     200#endif
    195201        { }
    196202
     
    206212#ifdef VBOX_WITH_GUEST_CONTROL
    207213        GuestSessions               mGuestSessions;
     214        /** Guest control features (reported by the guest), VBOX_GUESTCTRL_GF_0_XXX. */
     215        uint64_t                    mfGuestFeatures0;
     216        /** Guest control features (reported by the guest), VBOX_GUESTCTRL_GF_1_XXX. */
     217        uint64_t                    mfGuestFeatures1;
    208218#endif
    209219    } mData;
  • trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp

    r78744 r79296  
    9595    PVBOXGUESTCTRLHOSTCALLBACK pSvcCb = (PVBOXGUESTCTRLHOSTCALLBACK)pvData;
    9696    AssertPtrReturn(pSvcCb, VERR_INVALID_POINTER);
     97
     98    /*
     99     * Deal with GUEST_MSG_REPORT_FEATURES here as it shouldn't be handed
     100     * i_dispatchToSession() and has different parameters.
     101     */
     102    if (idMessage == GUEST_MSG_REPORT_FEATURES)
     103    {
     104        Assert(pSvcCb->mParms == 2);
     105        Assert(pSvcCb->mpaParms[0].type == VBOX_HGCM_SVC_PARM_64BIT);
     106        Assert(pSvcCb->mpaParms[1].type == VBOX_HGCM_SVC_PARM_64BIT);
     107        Assert(pSvcCb->mpaParms[1].u.uint64 & VBOX_GUESTCTRL_GF_1_MUST_BE_ONE);
     108        pGuest->mData.mfGuestFeatures0 = pSvcCb->mpaParms[0].u.uint64;
     109        pGuest->mData.mfGuestFeatures1 = pSvcCb->mpaParms[1].u.uint64;
     110        LogRel(("Guest Control: GUEST_MSG_REPORT_FEATURES: %#RX64, %#RX64\n",
     111                pGuest->mData.mfGuestFeatures0, pGuest->mData.mfGuestFeatures1));
     112        return VINF_SUCCESS;
     113    }
    97114
    98115    /*
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r79287 r79296  
    520520        }
    521521
     522        case GUEST_FILE_NOTIFYTYPE_READ_OFFSET:
     523        {
     524            ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mParms == 5, ("mParms=%u\n", pSvcCbData->mParms),
     525                                        rc = VERR_WRONG_PARAMETER_COUNT);
     526            ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx].type == VBOX_HGCM_SVC_PARM_PTR,
     527                                        ("type=%u\n", pSvcCbData->mpaParms[idx].type),
     528                                        rc = VERR_WRONG_PARAMETER_TYPE);
     529            ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx + 1].type == VBOX_HGCM_SVC_PARM_64BIT,
     530                                        ("type=%u\n", pSvcCbData->mpaParms[idx].type),
     531                                        rc = VERR_WRONG_PARAMETER_TYPE);
     532            BYTE const * const pbData = (BYTE const *)pSvcCbData->mpaParms[idx].u.pointer.addr;
     533            uint32_t const     cbRead = pSvcCbData->mpaParms[idx].u.pointer.size;
     534            int64_t            offNew = (int64_t)pSvcCbData->mpaParms[idx + 1].u.uint64;
     535            Log3ThisFunc(("cbRead=%RU32 offNew=%RI64 (%#RX64)\n", cbRead, offNew, offNew));
     536
     537            AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     538            if (offNew < 0) /* non-seekable */
     539                offNew = mData.mOffCurrent + cbRead;
     540            mData.mOffCurrent = offNew;
     541            alock.release();
     542
     543            try
     544            {
     545                com::SafeArray<BYTE> data((size_t)cbRead);
     546                data.initFrom(pbData, cbRead);
     547                fireGuestFileReadEvent(mEventSource, mSession, this, offNew, cbRead, ComSafeArrayAsInParam(data));
     548                rc = VINF_SUCCESS;
     549            }
     550            catch (std::bad_alloc &)
     551            {
     552                rc = VERR_NO_MEMORY;
     553            }
     554            break;
     555        }
     556
    522557        case GUEST_FILE_NOTIFYTYPE_WRITE:
    523558        {
     
    539574
    540575                fireGuestFileWriteEvent(mEventSource, mSession, this, mData.mOffCurrent, cbWritten);
     576            }
     577            break;
     578        }
     579
     580        case GUEST_FILE_NOTIFYTYPE_WRITE_OFFSET:
     581        {
     582            ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mParms == 5, ("mParms=%u\n", pSvcCbData->mParms),
     583                                        rc = VERR_WRONG_PARAMETER_COUNT);
     584            ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx].type == VBOX_HGCM_SVC_PARM_32BIT,
     585                                        ("type=%u\n", pSvcCbData->mpaParms[idx].type),
     586                                        rc = VERR_WRONG_PARAMETER_TYPE);
     587            ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx + 1].type == VBOX_HGCM_SVC_PARM_64BIT,
     588                                        ("type=%u\n", pSvcCbData->mpaParms[idx].type),
     589                                        rc = VERR_WRONG_PARAMETER_TYPE);
     590            uint32_t const  cbWritten = pSvcCbData->mpaParms[idx].u.uint32;
     591            int64_t         offNew    = (int64_t)pSvcCbData->mpaParms[idx + 1].u.uint64;
     592            Log3ThisFunc(("cbWritten=%RU32 offNew=%RI64 (%#RX64)\n", cbWritten, offNew, offNew));
     593
     594            AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     595            if (offNew < 0) /* non-seekable */
     596                offNew = mData.mOffCurrent + cbWritten;
     597            mData.mOffCurrent = offNew;
     598            alock.release();
     599
     600            try
     601            {
     602                fireGuestFileWriteEvent(mEventSource, mSession, this, offNew, cbWritten);
     603                rc = VINF_SUCCESS;
     604            }
     605            catch (std::bad_alloc &)
     606            {
     607                rc = VERR_NO_MEMORY;
    541608            }
    542609            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