VirtualBox

Changeset 75806 in vbox


Ignore:
Timestamp:
Nov 29, 2018 7:08:07 AM (6 years ago)
Author:
vboxsync
Message:

VBoxGuestCtrlSvc: Some more fixes to the new code. bugref:9313

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r75805 r75806  
    539539                    HGCMSvcSetU32(&mPendingCon.mParms[0], pHostCmd->mMsgType);
    540540                    HGCMSvcSetU32(&mPendingCon.mParms[1], pHostCmd->mParmCount);
    541                     for (uint32_t i = pHostCmd->mParmCount; i >= 2; i--)
     541                    uint32_t i = RT_MIN(mPendingCon.mNumParms, pHostCmd->mParmCount + 2);
     542                    while (i-- > 2)
    542543                        switch (pHostCmd->mpParms[i - 2].type)
    543544                        {
     
    548549
    549550                    rc = mSvcHelpers->pfnCallComplete(mPendingCon.mHandle, VINF_SUCCESS);
    550                     mIsPending = (guestControl::eGuestFn)0;
     551
     552                    mPendingCon.mHandle   = NULL;
     553                    mPendingCon.mParms    = NULL;
     554                    mPendingCon.mNumParms = 0;
     555                    mIsPending            = (guestControl::eGuestFn)0;
    551556                }
    552557                else if (mIsPending == GUEST_MSG_WAIT)
     
    607612
    608613        mSvcHelpers->pfnCallComplete(mPendingCon.mHandle, rcComplete);
    609         mIsPending       = (guestControl::eGuestFn)0;
    610         m_fPendingCancel = false;
     614
     615        mPendingCon.mHandle   = NULL;
     616        mPendingCon.mParms    = NULL;
     617        mPendingCon.mNumParms = 0;
     618        mIsPending            = (guestControl::eGuestFn)0;
     619        m_fPendingCancel      = false;
    611620        return VINF_SUCCESS;
    612621    }
     
    720729
    721730    /**
    722      * Set to indicate that a client call (GUEST_MSG_WAIT) is pending.
    723      *
    724      * @note Only used by GUEST_MSG_WAIT scenarios.
    725      */
    726     int OldSetPending(const ClientConnection *pConnection)
    727     {
    728         AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
    729 
    730         if (mIsPending != 0)
    731         {
    732             LogFlowFunc(("[Client %RU32] Already is in pending mode\n", mID));
    733 
    734             /*
    735              * Signal that we don't and can't return yet.
    736              */
    737             return VINF_HGCM_ASYNC_EXECUTE;
    738         }
    739 
    740         if (mHostCmdList.empty())
    741         {
    742             AssertMsg(mIsPending == 0, ("Client ID=%RU32 already is pending but tried to receive a new host command\n", mID));
    743 
    744             mPendingCon.mHandle   = pConnection->mHandle;
    745             mPendingCon.mNumParms = pConnection->mNumParms;
    746             mPendingCon.mParms    = pConnection->mParms;
    747 
    748             mIsPending = GUEST_MSG_WAIT;
    749 
    750             LogFlowFunc(("[Client %RU32] Is now in pending mode\n", mID));
    751 
    752             /*
    753              * Signal that we don't and can't return yet.
    754              */
    755             return VINF_HGCM_ASYNC_EXECUTE;
    756         }
    757 
    758         /*
    759          * Signal that there already is a connection pending.
    760          * Shouldn't happen in daily usage.
    761          */
    762         AssertMsgFailed(("Client already has a connection pending\n"));
    763         return VERR_SIGNAL_PENDING;
    764     }
    765 
    766     /**
    767731     * @note Only used by GUEST_MSG_WAIT scenarios.
    768732     */
     
    798762         * Return first host command.
    799763         */
    800         AssertMsgReturn(mIsPending == 0,
    801                         ("Client ID=%RU32 still is in pending mode; can't use another connection\n", mID), VERR_INVALID_PARAMETER);
    802 
    803764        HostCmdListIter curCmd = mHostCmdList.begin();
    804765        Assert(curCmd != mHostCmdList.end());
     
    12571218        paParms[0].u.uint32 = pFirstCmd->mMsgType;
    12581219        paParms[1].u.uint32 = pFirstCmd->mParmCount;
    1259         for (uint32_t i = pFirstCmd->mParmCount; i >= 2; i--)
     1220        uint32_t i = RT_MIN(cParms, pFirstCmd->mParmCount + 2);
     1221        while (i-- > 2)
    12601222            switch (pFirstCmd->mpParms[i - 2].type)
    12611223            {
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