VirtualBox

Ignore:
Timestamp:
Jan 23, 2019 6:23:04 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128342
Message:

Guest Control: Unifying terminology for (client/host) commands, functions and messages; it's all about messages now. Renaming, no functional changes.

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox

    • Property svn:mergeinfo
      •  

        old new  
        88/branches/VBox-5.0/src/VBox:104938,104943,104950,104987-104988,104990,106453
        99/branches/VBox-5.1/src/VBox:112367,116543,116550,116568,116573
        10 /branches/VBox-5.2/src/VBox:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124263,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812
         10/branches/VBox-5.2/src/VBox:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124263,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812,127158-127159,127162-127167,127180
        1111/branches/andy/draganddrop/src/VBox:90781-91268
        1212/branches/andy/guestctrl20/src/VBox:78916,78930
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r76956 r76958  
    1818/** @page pg_svc_guest_control   Guest Control HGCM Service
    1919 *
    20  * This service acts as a proxy for handling and buffering host command requests
     20 * This service acts as a proxy for handling and buffering host message requests
    2121 * and clients on the guest. It tries to be as transparent as possible to let
    2222 * the guest (client) and host side do their protocol handling as desired.
     
    2626 *           which wants to control something on the guest.
    2727 * - Client: A client (e.g. VBoxService) running inside the guest OS waiting for
    28  *           new host commands to perform. There can be multiple clients connected
     28 *           new host messages to perform. There can be multiple clients connected
    2929 *           to this service. A client is represented by its unique HGCM client ID.
    3030 * - Context ID: An (almost) unique ID automatically generated on the host (Main API)
     
    3333 *               an indicator which it can refer to later. This context ID gets
    3434 *               internally bound by the service to a client which actually processes
    35  *               the command in order to have a relationship between client<->context ID(s).
    36  *
    37  * The host can trigger commands which get buffered by the service (with full HGCM
     35 *               the message in order to have a relationship between client<->context ID(s).
     36 *
     37 * The host can trigger messages which get buffered by the service (with full HGCM
    3838 * parameter info). As soon as a client connects (or is ready to do some new work)
    39  * it gets a buffered host command to process it. This command then will be immediately
    40  * removed from the command list. If there are ready clients but no new commands to be
     39 * it gets a buffered host message  to process it. This message then will be immediately
     40 * removed from the message list. If there are ready clients but no new messages to be
    4141 * processed, these clients will be set into a deferred state (that is being blocked
    42  * to return until a new command is available).
     42 * to return until a new host message is available).
    4343 *
    4444 * If a client needs to inform the host that something happened, it can send a
     
    104104
    105105/**
    106  * Structure for holding a buffered host command which has
     106 * Structure for holding a buffered host message which has
    107107 * not been processed yet.
    108108 *
    109109 * @todo r=bird: It would be nice if we could decide on _one_ term for what the
    110110 *       host passes to the guest.  We currently have:
    111  *          - The enum is called eHostFn, implying it's a function
    112  *          - The guest retrieves messages, if the eGuestFn enum is anything to
    113  *            go by: GUEST_MSG_GET, GUEST_MSG_CANCEL, GUEST_MSG_XXX
    114  *          - Here it's called a host command.
    115  *          - But this HostCommand structure has a mMsgType rather than command
    116  *            number/enum value, impliying it's a message.
    117  */
    118 typedef struct HostCommand
    119 {
    120     /** Entry on the ClientState::m_HostCmdList list. */
     111 *          - The enum is called eHostMsg, implying it's a function
     112 */
     113typedef struct HostMsg
     114{
     115    /** Entry on the ClientState::m_HostMsgList list. */
    121116    RTLISTNODE      m_ListEntry;
    122117    union
     
    125120         * See VBOX_GUESTCTRL_DST_XXX.  */
    126121        uint64_t    m_idContextAndDst;
    127         /** The context ID this command belongs to (extracted from the first parameter). */
     122        /** The context ID this message belongs to (extracted from the first parameter). */
    128123        uint32_t    m_idContext;
    129124    };
    130125    /** Dynamic structure for holding the HGCM parms */
    131     uint32_t mMsgType;
     126    uint32_t mType;
    132127    /** Number of HGCM parameters. */
    133128    uint32_t mParmCount;
     
    137132    bool m_f60BetaHackInPlay;
    138133
    139     HostCommand()
     134    HostMsg()
    140135        : m_idContextAndDst(0)
    141         , mMsgType(UINT32_MAX)
     136        , mType(UINT32_MAX)
    142137        , mParmCount(0)
    143138        , mpParms(NULL)
     
    148143
    149144    /**
    150      * Releases the host command, properly deleting it if no further references.
     145     * Releases the host message, properly deleting it if no further references.
    151146     */
    152147    void Delete(void)
    153148    {
    154         LogFlowThisFunc(("[Cmd %RU32 (%s)] destroying\n", mMsgType, GstCtrlHostFnName((eHostFn)mMsgType)));
     149        LogFlowThisFunc(("[Msg %RU32 (%s)] destroying\n", mType, GstCtrlHostMsgtoStr((eHostMsg)mType)));
    155150        Assert(m_ListEntry.pNext == NULL);
    156151        if (mpParms)
     
    171166
    172167    /**
    173      * Initializes the command.
     168     * Initializes the message.
    174169     *
    175170     * The specified parameters are copied and any buffers referenced by it
     
    177172     *
    178173     * @returns VBox status code.
    179      * @param   idFunction  The host function (message) number, eHostFn.
     174     * @param   idMsg       The host message number, eHostMsg.
    180175     * @param   cParms      Number of parameters in the HGCM request.
    181176     * @param   paParms     Array of parameters.
    182177     */
    183     int Init(uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    184     {
    185         LogFlowThisFunc(("[Cmd %RU32 (%s)] Allocating cParms=%RU32, paParms=%p\n",
    186                          idFunction, GstCtrlHostFnName((eHostFn)idFunction), cParms, paParms));
     178    int Init(uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     179    {
     180        LogFlowThisFunc(("[Msg %RU32 (%s)] Allocating cParms=%RU32, paParms=%p\n",
     181                         idMsg, GstCtrlHostMsgtoStr((eHostMsg)idMsg), cParms, paParms));
    187182        Assert(mpParms == NULL);
    188183        Assert(mParmCount == 0);
     
    197192
    198193        /*
    199          * The first parameter is the context ID and the command destiation mask.
     194         * The first parameter is the context ID and the message destination mask.
    200195         */
    201196        if (paParms[0].type == VBOX_HGCM_SVC_PARM_64BIT)
     
    206201        else if (paParms[0].type == VBOX_HGCM_SVC_PARM_32BIT)
    207202        {
    208             AssertMsgFailed(("idFunction=%u %s - caller must set dst!\n", idFunction, GstCtrlHostFnName((eHostFn)idFunction)));
     203            AssertMsgFailed(("idMsg=%u %s - caller must set dst!\n", idMsg, GstCtrlHostMsgtoStr((eHostMsg)idMsg)));
    209204            m_idContextAndDst = paParms[0].u.uint32 | VBOX_GUESTCTRL_DST_BOTH;
    210205        }
     
    215210         * Just make a copy of the parameters and any buffers.
    216211         */
    217         mMsgType   = idFunction;
     212        mType   = idMsg;
    218213        mParmCount = cParms;
    219214        mpParms    = (VBOXHGCMSVCPARM *)RTMemAllocZ(sizeof(VBOXHGCMSVCPARM) * mParmCount);
     
    244239
    245240                default:
    246                     AssertMsgFailedReturn(("idFunction=%u (%s) parameter #%u: type=%u\n",
    247                                            idFunction, GstCtrlHostFnName((eHostFn)idFunction), i, paParms[i].type),
     241                    AssertMsgFailedReturn(("idMsg=%u (%s) parameter #%u: type=%u\n",
     242                                           idMsg, GstCtrlHostMsgtoStr((eHostMsg)idMsg), i, paParms[i].type),
    248243                                          VERR_WRONG_PARAMETER_TYPE);
    249244            }
     
    271266        Assert(cDstParms >= 2);
    272267        if (paDstParms[0].type == VBOX_HGCM_SVC_PARM_32BIT)
    273             paDstParms[0].u.uint32 = mMsgType;
     268            paDstParms[0].u.uint32 = mType;
    274269        else
    275             paDstParms[0].u.uint64 = mMsgType;
     270            paDstParms[0].u.uint64 = mType;
    276271        paDstParms[1].u.uint32 = mParmCount;
    277272
     
    301296    int CopyTo(VBOXHGCMSVCPARM paDstParms[], uint32_t cDstParms) const
    302297    {
    303         LogFlowThisFunc(("[Cmd %RU32] mParmCount=%RU32, m_idContext=%RU32 (Session %RU32)\n",
    304                          mMsgType, mParmCount, m_idContext, VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(m_idContext)));
     298        LogFlowThisFunc(("[Msg %RU32] mParmCount=%RU32, m_idContext=%RU32 (Session %RU32)\n",
     299                         mType, mParmCount, m_idContext, VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(m_idContext)));
    305300
    306301        int rc = VINF_SUCCESS;
     
    386381        int rc;
    387382
    388         LogFlowThisFunc(("[Cmd %RU32] mParmCount=%RU32, mpParms=%p\n", mMsgType, mParmCount, mpParms));
    389 
    390         /* Does the current host command need more parameter space which
     383        LogFlowThisFunc(("[Msg %RU32] mParmCount=%RU32, mpParms=%p\n", mType, mParmCount, mpParms));
     384
     385        /* Does the current host message need more parameter space which
    391386         * the client does not provide yet? */
    392387        if (mParmCount > pReq->mNumParms)
    393388        {
    394             LogFlowThisFunc(("[Cmd %RU32] Requires %RU32 parms, only got %RU32 from client\n",
    395                              mMsgType, mParmCount, pReq->mNumParms));
     389            LogFlowThisFunc(("[Msg %RU32] Requires %RU32 parms, only got %RU32 from client\n",
     390                             mType, mParmCount, pReq->mNumParms));
    396391            /*
    397392             * So this call apparently failed because the guest wanted to peek
    398393             * how much parameters it has to supply in order to successfully retrieve
    399              * this command. Let's tell him so!
     394             * this message. Let's tell him so!
    400395             */
    401396            rc = VERR_TOO_MUCH_DATA;
     
    424419        AssertPtrReturn(pReq, VERR_INVALID_POINTER);
    425420
    426         LogFlowThisFunc(("[Cmd %RU32] mParmCount=%RU32, mpParms=%p\n", mMsgType, mParmCount, mpParms));
     421        LogFlowThisFunc(("[Msg %RU32] mParmCount=%RU32, mpParms=%p\n", mType, mParmCount, mpParms));
    427422
    428423        if (pReq->mNumParms >= 2)
    429424        {
    430             HGCMSvcSetU32(&pReq->mParms[0], mMsgType);   /* Message ID */
     425            HGCMSvcSetU32(&pReq->mParms[0], mType);   /* Message ID */
    431426            HGCMSvcSetU32(&pReq->mParms[1], mParmCount); /* Required parameters for message */
    432427        }
     
    438433         * Always return VERR_TOO_MUCH_DATA data here to
    439434         * keep it compatible with older clients and to
    440          * have correct accounting (mHostRc + mHostCmdTries).
     435         * have correct accounting (mHostRc + mHostMsgTries).
    441436         */
    442437        return VERR_TOO_MUCH_DATA;
     
    444439
    445440    /** @} */
    446 } HostCommand;
     441} HostMsg;
    447442
    448443/**
    449444 * Per-client structure used for book keeping/state tracking a
    450  * certain host command.
     445 * certain host message.
    451446 */
    452447typedef struct ClientContext
    453448{
    454     /* Pointer to list node of this command. */
    455     HostCommand *mpHostCmd;
     449    /* Pointer to list node of this message. */
     450    HostMsg *mpHostMsg;
    456451    /** The standard constructor. */
    457     ClientContext(void) : mpHostCmd(NULL) {}
     452    ClientContext(void) : mpHostMsg(NULL) {}
    458453    /** Internal constrcutor. */
    459     ClientContext(HostCommand *pHostCmd) : mpHostCmd(pHostCmd) {}
     454    ClientContext(HostMsg *pHostMsg) : mpHostMsg(pHostMsg) {}
    460455} ClientContext;
    461456typedef std::map< uint32_t, ClientContext > ClientContextMap;
     
    467462{
    468463    PVBOXHGCMSVCHELPERS     m_pSvcHelpers;
    469     /** Host command list to process (HostCommand). */
    470     RTLISTANCHOR            m_HostCmdList;
     464    /** Host message list to process (HostMsg). */
     465    RTLISTANCHOR            m_HostMsgList;
    471466    /** The HGCM client ID. */
    472467    uint32_t                m_idClient;
     
    482477    /** Pending client call (GUEST_MSG_PEEK_WAIT or GUEST_MSG_WAIT), zero if none pending.
    483478     *
    484      * This means the client waits for a new host command to reply and won't return
    485      * from the waiting call until a new host command is available. */
    486     guestControl::eGuestFn  m_enmIsPending;
     479     * This means the client waits for a new host message to reply and won't return
     480     * from the waiting call until a new host message is available. */
     481    guestControl::eGuestMsg m_enmPendingMsg;
    487482    /** Pending peek/wait request details. */
    488483    ClientRequest           m_PendingReq;
     
    496491        , m_fRestored(false)
    497492        , m_fPendingCancel(false)
    498         , m_enmIsPending((guestControl::eGuestFn)0)
    499         , mHostCmdRc(VINF_SUCCESS)
    500         , mHostCmdTries(0)
     493        , m_enmPendingMsg((guestControl::eGuestMsg)0)
     494        , mHostMsgRc(VINF_SUCCESS)
     495        , mHostMsgTries(0)
    501496        , mPeekCount(0)
    502497    {
    503         RTListInit(&m_HostCmdList);
     498        RTListInit(&m_HostMsgList);
    504499    }
    505500
     
    511506        , m_fRestored(false)
    512507        , m_fPendingCancel(false)
    513         , m_enmIsPending((guestControl::eGuestFn)0)
    514         , mHostCmdRc(VINF_SUCCESS)
    515         , mHostCmdTries(0)
     508        , m_enmPendingMsg((guestControl::eGuestMsg)0)
     509        , mHostMsgRc(VINF_SUCCESS)
     510        , mHostMsgTries(0)
    516511        , mPeekCount(0)
    517512    {
    518         RTListInit(&m_HostCmdList);
     513        RTListInit(&m_HostMsgList);
    519514    }
    520515
    521516    /**
    522      * Used by for Service::hostProcessCommand().
    523      */
    524     void EnqueueCommand(HostCommand *pHostCmd)
    525     {
    526         AssertPtr(pHostCmd);
    527         RTListAppend(&m_HostCmdList, &pHostCmd->m_ListEntry);
     517     * Used by for Service::hostProcessMessage().
     518     */
     519    void EnqueueMessage(HostMsg *pHostMsg)
     520    {
     521        AssertPtr(pHostMsg);
     522        RTListAppend(&m_HostMsgList, &pHostMsg->m_ListEntry);
    528523    }
    529524
    530525    /**
    531      * Used by for Service::hostProcessCommand().
     526     * Used by for Service::hostProcessMessage().
    532527     *
    533528     * @note This wakes up both GUEST_MSG_WAIT and GUEST_MSG_PEEK_WAIT sleepers.
     
    537532        int rc = VINF_NO_CHANGE;
    538533
    539         if (m_enmIsPending != 0)
     534        if (m_enmPendingMsg != 0)
    540535        {
    541536            LogFlowFunc(("[Client %RU32] Waking up ...\n", m_idClient));
     
    543538            rc = VINF_SUCCESS;
    544539
    545             HostCommand *pFirstCmd = RTListGetFirstCpp(&m_HostCmdList, HostCommand, m_ListEntry);
    546             if (pFirstCmd)
     540            HostMsg *pFirstMsg = RTListGetFirstCpp(&m_HostMsgList, HostMsg, m_ListEntry);
     541            if (pFirstMsg)
    547542            {
    548                 LogFlowThisFunc(("[Client %RU32] Current host command is %RU32 (CID=%#RX32, cParms=%RU32)\n",
    549                                  m_idClient, pFirstCmd->mMsgType, pFirstCmd->m_idContext, pFirstCmd->mParmCount));
    550 
    551                 if (m_enmIsPending == GUEST_MSG_PEEK_WAIT)
     543                LogFlowThisFunc(("[Client %RU32] Current host message is %RU32 (CID=%#RX32, cParms=%RU32)\n",
     544                                 m_idClient, pFirstMsg->mType, pFirstMsg->m_idContext, pFirstMsg->mParmCount));
     545
     546                if (m_enmPendingMsg == GUEST_MSG_PEEK_WAIT)
    552547                {
    553                     pFirstCmd->setPeekReturn(m_PendingReq.mParms, m_PendingReq.mNumParms);
     548                    pFirstMsg->setPeekReturn(m_PendingReq.mParms, m_PendingReq.mNumParms);
    554549                    rc = m_pSvcHelpers->pfnCallComplete(m_PendingReq.mHandle, VINF_SUCCESS);
    555550
     
    557552                    m_PendingReq.mParms    = NULL;
    558553                    m_PendingReq.mNumParms = 0;
    559                     m_enmIsPending         = (guestControl::eGuestFn)0;
     554                    m_enmPendingMsg         = (guestControl::eGuestMsg)0;
    560555                }
    561                 else if (m_enmIsPending == GUEST_MSG_WAIT)
    562                     rc = OldRun(&m_PendingReq, pFirstCmd);
     556                else if (m_enmPendingMsg == GUEST_MSG_WAIT)
     557                    rc = OldRun(&m_PendingReq, pFirstMsg);
    563558                else
    564                     AssertMsgFailed(("m_enmIsPending=%d\n", m_enmIsPending));
     559                    AssertMsgFailed(("m_enmIsPending=%d\n", m_enmPendingMsg));
    565560            }
    566561            else
    567                 AssertMsgFailed(("Waking up client ID=%RU32 with no host command in queue is a bad idea\n", m_idClient));
     562                AssertMsgFailed(("Waking up client ID=%RU32 with no host message in queue is a bad idea\n", m_idClient));
    568563
    569564            return rc;
     
    581576    {
    582577        LogFlowFunc(("[Client %RU32] Cancelling waiting thread, isPending=%d, pendingNumParms=%RU32, m_idSession=%x\n",
    583                      m_idClient, m_enmIsPending, m_PendingReq.mNumParms, m_idSession));
     578                     m_idClient, m_enmPendingMsg, m_PendingReq.mNumParms, m_idSession));
    584579
    585580        /*
     
    587582         */
    588583        int rcComplete;
    589         if (m_enmIsPending == GUEST_MSG_PEEK_WAIT)
    590         {
    591             HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_CANCEL_PENDING_WAITS);
     584        if (m_enmPendingMsg == GUEST_MSG_PEEK_WAIT)
     585        {
     586            HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_MSG_CANCEL_PENDING_WAITS);
    592587            rcComplete = VINF_TRY_AGAIN;
    593588        }
     
    597592         * aren't two parameters, fail the call.
    598593         */
    599         else if (m_enmIsPending != 0)
    600         {
    601             Assert(m_enmIsPending == GUEST_MSG_WAIT);
     594        else if (m_enmPendingMsg != 0)
     595        {
     596            Assert(m_enmPendingMsg == GUEST_MSG_WAIT);
    602597            if (m_PendingReq.mNumParms > 0)
    603                 HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_CANCEL_PENDING_WAITS);
     598                HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_MSG_CANCEL_PENDING_WAITS);
    604599            if (m_PendingReq.mNumParms > 1)
    605600                HGCMSvcSetU32(&m_PendingReq.mParms[1], 0);
     
    620615        m_PendingReq.mParms    = NULL;
    621616        m_PendingReq.mNumParms = 0;
    622         m_enmIsPending            = (guestControl::eGuestFn)0;
     617        m_enmPendingMsg            = (guestControl::eGuestMsg)0;
    623618        m_fPendingCancel      = false;
    624619        return VINF_SUCCESS;
     
    633628     */
    634629
    635     /** Last (most recent) rc after handling the host command. */
    636     int mHostCmdRc;
    637     /** How many GUEST_MSG_WAIT calls the client has issued to retrieve one command.
     630    /** Last (most recent) rc after handling the host message. */
     631    int mHostMsgRc;
     632    /** How many GUEST_MSG_WAIT calls the client has issued to retrieve one message.
    638633     *
    639634     * This is used as a heuristic to remove a message that the client appears not
    640635     * to be able to successfully retrieve.  */
    641     uint32_t mHostCmdTries;
     636    uint32_t mHostMsgTries;
    642637    /** Number of times we've peeked at a pending message.
    643638     *
    644639     * This is necessary for being compatible with older Guest Additions.  In case
    645      * there are commands which only have two (2) parameters and therefore would fit
     640     * there are messages which only have two (2) parameters and therefore would fit
    646641     * into the GUEST_MSG_WAIT reply immediately, we now can make sure that the
    647642     * client first gets back the GUEST_MSG_WAIT results first.
     
    650645
    651646    /**
    652      * Ditches the first host command and crazy GUEST_MSG_WAIT state.
     647     * Ditches the first host message and crazy GUEST_MSG_WAIT state.
    653648     *
    654649     * @note Only used by GUEST_MSG_WAIT scenarios.
    655650     */
    656     void OldDitchFirstHostCmd()
    657     {
    658         HostCommand *pFirstCmd = RTListGetFirstCpp(&m_HostCmdList, HostCommand, m_ListEntry);
    659         Assert(pFirstCmd);
    660         RTListNodeRemove(&pFirstCmd->m_ListEntry);
    661         pFirstCmd->Delete();
     651    void OldDitchFirstHostMsg()
     652    {
     653        HostMsg *pFirstMsg = RTListGetFirstCpp(&m_HostMsgList, HostMsg, m_ListEntry);
     654        Assert(pFirstMsg);
     655        RTListNodeRemove(&pFirstMsg->m_ListEntry);
     656        pFirstMsg->Delete();
    662657
    663658        /* Reset state else. */
    664         mHostCmdRc    = VINF_SUCCESS;
    665         mHostCmdTries = 0;
     659        mHostMsgRc    = VINF_SUCCESS;
     660        mHostMsgTries = 0;
    666661        mPeekCount    = 0;
    667662    }
     
    672667     * @note Only used by GUEST_MSG_WAIT scenarios.
    673668     */
    674     int OldRun(ClientRequest const *pReq, HostCommand *pHostCmd)
     669    int OldRun(ClientRequest const *pReq, HostMsg *pHostMsg)
    675670    {
    676671        AssertPtrReturn(pReq, VERR_INVALID_POINTER);
    677         AssertPtrReturn(pHostCmd, VERR_INVALID_POINTER);
    678         Assert(RTListNodeIsFirst(&m_HostCmdList, &pHostCmd->m_ListEntry));
    679 
    680         LogFlowFunc(("[Client %RU32] pReq=%p, mHostCmdRc=%Rrc, mHostCmdTries=%RU32, mPeekCount=%RU32\n",
    681                       m_idClient, pReq, mHostCmdRc, mHostCmdTries, mPeekCount));
    682 
    683         int rc = mHostCmdRc = OldSendReply(pReq, pHostCmd);
    684 
    685         LogFlowThisFunc(("[Client %RU32] Processing command %RU32 ended with rc=%Rrc\n", m_idClient, pHostCmd->mMsgType, mHostCmdRc));
     672        AssertPtrReturn(pHostMsg, VERR_INVALID_POINTER);
     673        Assert(RTListNodeIsFirst(&m_HostMsgList, &pHostMsg->m_ListEntry));
     674
     675        LogFlowFunc(("[Client %RU32] pReq=%p, mHostMsgRc=%Rrc, mHostMsgTries=%RU32, mPeekCount=%RU32\n",
     676                      m_idClient, pReq, mHostMsgRc, mHostMsgTries, mPeekCount));
     677
     678        int rc = mHostMsgRc = OldSendReply(pReq, pHostMsg);
     679
     680        LogFlowThisFunc(("[Client %RU32] Processing host message %RU32 ended with rc=%Rrc\n",
     681                         m_idClient, pHostMsg->mType, mHostMsgRc));
    686682
    687683        bool fRemove = false;
    688684        if (RT_FAILURE(rc))
    689685        {
    690             mHostCmdTries++;
     686            mHostMsgTries++;
    691687
    692688            /*
     
    695691             *
    696692             * Note: Due to legacy reasons this the retry counter has to be even because on
    697              *       every peek there will be the actual command retrieval from the client side.
    698              *       To not get the actual command if the client actually only wants to peek for
    699              *       the next command, there needs to be two rounds per try, e.g. 3 rounds = 6 tries.
     693             *       every peek there will be the actual message retrieval from the client side.
     694             *       To not get the actual message if the client actually only wants to peek for
     695             *       the next message, there needs to be two rounds per try, e.g. 3 rounds = 6 tries.
    700696             */
    701697            /** @todo Fix the mess stated above. GUEST_MSG_WAIT should be become GUEST_MSG_PEEK, *only*
    702              *        (and every time) returning the next upcoming host command (if any, blocking). Then
     698             *        (and every time) returning the next upcoming host message (if any, blocking). Then
    703699             *        it's up to the client what to do next, either peeking again or getting the actual
    704              *        host command via an own GUEST_ type message.
     700             *        host message via an own GUEST_ type message.
    705701             */
    706702            if (   rc == VERR_TOO_MUCH_DATA
    707703                || rc == VERR_CANCELLED)
    708704            {
    709                 if (mHostCmdTries == 6)
     705                if (mHostMsgTries == 6)
    710706                    fRemove = true;
    711707            }
    712708            /* Client did not understand the message or something else weird happened. Try again one
    713709             * more time and drop it if it didn't get handled then. */
    714             else if (mHostCmdTries > 1)
     710            else if (mHostMsgTries > 1)
    715711                fRemove = true;
    716712        }
     
    718714            fRemove = true; /* Everything went fine, remove it. */
    719715
    720         LogFlowThisFunc(("[Client %RU32] Tried command %RU32 for %RU32 times, (last result=%Rrc, fRemove=%RTbool)\n",
    721                          m_idClient, pHostCmd->mMsgType, mHostCmdTries, rc, fRemove));
     716        LogFlowThisFunc(("[Client %RU32] Tried host message %RU32 for %RU32 times, (last result=%Rrc, fRemove=%RTbool)\n",
     717                         m_idClient, pHostMsg->mType, mHostMsgTries, rc, fRemove));
    722718
    723719        if (fRemove)
    724720        {
    725             Assert(RTListNodeIsFirst(&m_HostCmdList, &pHostCmd->m_ListEntry));
    726             OldDitchFirstHostCmd();
     721            Assert(RTListNodeIsFirst(&m_HostMsgList, &pHostMsg->m_ListEntry));
     722            OldDitchFirstHostMsg();
    727723        }
    728724
     
    739735
    740736        /*
    741          * If the host command list is empty, the request must wait for one to be posted.
     737         * If the host message list is empty, the request must wait for one to be posted.
    742738         */
    743         HostCommand *pFirstCmd = RTListGetFirstCpp(&m_HostCmdList, HostCommand, m_ListEntry);
    744         if (!pFirstCmd)
     739        HostMsg *pFirstMsg = RTListGetFirstCpp(&m_HostMsgList, HostMsg, m_ListEntry);
     740        if (!pFirstMsg)
    745741        {
    746742            if (!m_fPendingCancel)
    747743            {
    748744                /* Go to sleep. */
    749                 ASSERT_GUEST_RETURN(m_enmIsPending == 0, VERR_WRONG_ORDER);
     745                ASSERT_GUEST_RETURN(m_enmPendingMsg == 0, VERR_WRONG_ORDER);
    750746                m_PendingReq = *pReq;
    751                 m_enmIsPending  = GUEST_MSG_WAIT;
     747                m_enmPendingMsg  = GUEST_MSG_WAIT;
    752748                LogFlowFunc(("[Client %RU32] Is now in pending mode\n", m_idClient));
    753749                return VINF_HGCM_ASYNC_EXECUTE;
     
    757753            m_fPendingCancel = false;
    758754            if (pReq->mNumParms > 0)
    759                 HGCMSvcSetU32(&pReq->mParms[0], HOST_CANCEL_PENDING_WAITS);
     755                HGCMSvcSetU32(&pReq->mParms[0], HOST_MSG_CANCEL_PENDING_WAITS);
    760756            if (pReq->mNumParms > 1)
    761757                HGCMSvcSetU32(&pReq->mParms[1], 0);
     
    764760
    765761        /*
    766          * Return first host command.
     762         * Return first host message.
    767763         */
    768         return OldRun(pReq, pFirstCmd);
     764        return OldRun(pReq, pFirstMsg);
    769765    }
    770766
     
    774770     */
    775771    int OldSendReply(ClientRequest const *pReq,
    776                      HostCommand         *pHostCmd)
     772                     HostMsg         *pHostMsg)
    777773    {
    778774        AssertPtrReturn(pReq, VERR_INVALID_POINTER);
    779         AssertPtrReturn(pHostCmd, VERR_INVALID_POINTER);
     775        AssertPtrReturn(pHostMsg, VERR_INVALID_POINTER);
    780776
    781777        /* In case of VERR_CANCELLED. */
     
    785781        /* If the client is in pending mode, always send back
    786782         * the peek result first. */
    787         if (m_enmIsPending)
    788         {
    789             Assert(m_enmIsPending == GUEST_MSG_WAIT);
    790             rc = pHostCmd->Peek(pReq);
     783        if (m_enmPendingMsg)
     784        {
     785            Assert(m_enmPendingMsg == GUEST_MSG_WAIT);
     786            rc = pHostMsg->Peek(pReq);
    791787            mPeekCount++;
    792788        }
     
    794790        {
    795791            /* If this is the very first peek, make sure to *always* give back the peeking answer
    796              * instead of the actual command, even if this command would fit into the current
     792             * instead of the actual message, even if this message would fit into the current
    797793             * connection buffer. */
    798794            if (!mPeekCount)
    799795            {
    800                 rc = pHostCmd->Peek(pReq);
     796                rc = pHostMsg->Peek(pReq);
    801797                mPeekCount++;
    802798            }
    803799            else
    804800            {
    805                 /* Try assigning the host command to the client and store the
     801                /* Try assigning the host message to the client and store the
    806802                 * result code for later use. */
    807                 rc = pHostCmd->Assign(pReq);
     803                rc = pHostMsg->Assign(pReq);
    808804                if (RT_FAILURE(rc)) /* If something failed, let the client peek (again). */
    809805                {
    810                     rc = pHostCmd->Peek(pReq);
     806                    rc = pHostMsg->Peek(pReq);
    811807                    mPeekCount++;
    812808                }
     
    817813
    818814        /* Reset pending status. */
    819         m_enmIsPending = (guestControl::eGuestFn)0;
     815        m_enmPendingMsg = (guestControl::eGuestMsg)0;
    820816
    821817        /* In any case the client did something, so complete
     
    831827        }
    832828
    833         LogFlowThisFunc(("[Client %RU32] Command %RU32 ended with %Rrc (mPeekCount=%RU32, pReq=%p)\n",
    834                          m_idClient, pHostCmd->mMsgType, rc, mPeekCount, pReq));
     829        LogFlowThisFunc(("[Client %RU32] Message %RU32 ended with %Rrc (mPeekCount=%RU32, pReq=%p)\n",
     830                         m_idClient, pHostMsg->mType, rc, mPeekCount, pReq));
    835831        return rc;
    836832    }
     
    867863    typedef GstCtrlService SELF;
    868864    /** HGCM helper functions. */
    869     PVBOXHGCMSVCHELPERS mpHelpers;
     865    PVBOXHGCMSVCHELPERS     mpHelpers;
    870866    /** Callback function supplied by the host for notification of updates to properties. */
    871     PFNHGCMSVCEXT mpfnHostCallback;
     867    PFNHGCMSVCEXT           mpfnHostCallback;
    872868    /** User data pointer to be supplied to the host callback function. */
    873     void *mpvHostData;
     869    void                   *mpvHostData;
    874870    /** Map containing all connected clients, key is HGCM client ID. */
    875     ClientStateMap  m_ClientStateMap;
     871    ClientStateMap          m_ClientStateMap;
    876872    /** Session ID -> client state. */
    877     ClientStateMap  m_SessionIdMap;
     873    ClientStateMap          m_SessionIdMap;
    878874    /** The current master client, NULL if none. */
    879     ClientState    *m_pMasterClient;
     875    ClientState            *m_pMasterClient;
    880876    /** The master HGCM client ID, UINT32_MAX if none. */
    881     uint32_t        m_idMasterClient;
     877    uint32_t                m_idMasterClient;
    882878    /** Set if we're in legacy mode (pre 6.0). */
    883     bool            m_fLegacyMode;
     879    bool                    m_fLegacyMode;
    884880    /** Number of prepared sessions. */
    885     uint32_t        m_cPreparedSessions;
     881    uint32_t                m_cPreparedSessions;
    886882    /** List of prepared session (GstCtrlPreparedSession). */
    887     RTLISTANCHOR    m_PreparedSessions;
     883    RTLISTANCHOR            m_PreparedSessions;
    888884
    889885public:
     
    921917    int clientSessionAccept(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    922918    int clientSessionCloseOther(ClientState *pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    923     int clientToMain(ClientState *pClient, uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     919    int clientToMain(ClientState *pClient, uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    924920
    925921    int clientMsgOldGet(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     
    927923    int clientMsgOldSkip(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms);
    928924
    929     int hostCallback(uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    930     int hostProcessCommand(uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     925    int hostCallback(uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     926    int hostProcessMessage(uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    931927
    932928    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(GstCtrlService);
     
    10251021
    10261022    /*
    1027      * Cancel all pending host commands, replying with GUEST_DISCONNECTED if final recipient.
    1028      */
    1029     HostCommand *pCurCmd, *pNextCmd;
    1030     RTListForEachSafeCpp(&pClient->m_HostCmdList, pCurCmd, pNextCmd, HostCommand, m_ListEntry)
    1031     {
    1032         RTListNodeRemove(&pCurCmd->m_ListEntry);
     1023     * Cancel all pending host messages, replying with GUEST_DISCONNECTED if final recipient.
     1024     */
     1025    HostMsg *pCurMsg, *pNextMsg;
     1026    RTListForEachSafeCpp(&pClient->m_HostMsgList, pCurMsg, pNextMsg, HostMsg, m_ListEntry)
     1027    {
     1028        RTListNodeRemove(&pCurMsg->m_ListEntry);
    10331029
    10341030        VBOXHGCMSVCPARM Parm;
    1035         HGCMSvcSetU32(&Parm, pCurCmd->m_idContext);
    1036         int rc2 = pThis->hostCallback(GUEST_DISCONNECTED, 1, &Parm);
    1037         LogFlowFunc(("Cancelled host command %u (%s) with idContext=%#x -> %Rrc\n",
    1038                      pCurCmd->mMsgType, GstCtrlHostFnName((eHostFn)pCurCmd->mMsgType), pCurCmd->m_idContext, rc2));
     1031        HGCMSvcSetU32(&Parm, pCurMsg->m_idContext);
     1032        int rc2 = pThis->hostCallback(GUEST_MSG_DISCONNECTED, 1, &Parm);
     1033        LogFlowFunc(("Cancelled host message %u (%s) with idContext=%#x -> %Rrc\n",
     1034                     pCurMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pCurMsg->mType), pCurMsg->m_idContext, rc2));
    10391035        RT_NOREF(rc2);
    10401036
    1041         pCurCmd->Delete();
     1037        pCurMsg->Delete();
    10421038    }
    10431039
     
    10791075 * A client asks for the next message to process.
    10801076 *
    1081  * This either fills in a pending host command into the client's parameter space
     1077 * This either fills in a pending host message into the client's parameter space
    10821078 * or defers the guest call until we have something from the host.
    10831079 *
     
    12061202
    12071203    /*
    1208      * Return information about the first command if one is pending in the list.
    1209      */
    1210     HostCommand *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);
    1211     if (pFirstCmd)
    1212     {
    1213         pFirstCmd->setPeekReturn(paParms, cParms);
     1204     * Return information about the first message if one is pending in the list.
     1205     */
     1206    HostMsg *pFirstMsg = RTListGetFirstCpp(&pClient->m_HostMsgList, HostMsg, m_ListEntry);
     1207    if (pFirstMsg)
     1208    {
     1209        pFirstMsg->setPeekReturn(paParms, cParms);
    12141210        LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VINF_SUCCESS (idMsg=%u (%s), cParms=%u)\n",
    1215                      pClient->m_idClient, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount));
     1211                     pClient->m_idClient, pFirstMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pFirstMsg->mType), pFirstMsg->mParmCount));
    12161212        return VINF_SUCCESS;
    12171213    }
     
    12291225     * Wait for the host to queue a message for this client.
    12301226     */
    1231     ASSERT_GUEST_MSG_RETURN(pClient->m_enmIsPending == 0, ("Already pending! (idClient=%RU32)\n", pClient->m_idClient),
     1227    ASSERT_GUEST_MSG_RETURN(pClient->m_enmPendingMsg == 0, ("Already pending! (idClient=%RU32)\n", pClient->m_idClient),
    12321228                            VERR_RESOURCE_BUSY);
    12331229    pClient->m_PendingReq.mHandle   = hCall;
    12341230    pClient->m_PendingReq.mNumParms = cParms;
    12351231    pClient->m_PendingReq.mParms    = paParms;
    1236     pClient->m_enmIsPending         = GUEST_MSG_PEEK_WAIT;
     1232    pClient->m_enmPendingMsg         = GUEST_MSG_PEEK_WAIT;
    12371233    LogFlowFunc(("[Client %RU32] Is now in pending mode...\n", pClient->m_idClient));
    12381234    return VINF_HGCM_ASYNC_EXECUTE;
     
    12701266
    12711267    /*
    1272      * Return information about the first command if one is pending in the list.
    1273      */
    1274     HostCommand *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);
    1275     if (pFirstCmd)
    1276     {
    1277 
    1278         ASSERT_GUEST_MSG_RETURN(pFirstCmd->mMsgType == idMsgExpected || idMsgExpected == UINT32_MAX,
     1268     * Return information about the first message if one is pending in the list.
     1269     */
     1270    HostMsg *pFirstMsg = RTListGetFirstCpp(&pClient->m_HostMsgList, HostMsg, m_ListEntry);
     1271    if (pFirstMsg)
     1272    {
     1273
     1274        ASSERT_GUEST_MSG_RETURN(pFirstMsg->mType == idMsgExpected || idMsgExpected == UINT32_MAX,
    12791275                                ("idMsg=%u (%s) cParms=%u, caller expected %u (%s) and %u\n",
    1280                                  pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount,
    1281                                  idMsgExpected, GstCtrlHostFnName((eHostFn)idMsgExpected), cParms),
     1276                                 pFirstMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pFirstMsg->mType), pFirstMsg->mParmCount,
     1277                                 idMsgExpected, GstCtrlHostMsgtoStr((eHostMsg)idMsgExpected), cParms),
    12821278                                VERR_MISMATCH);
    1283         ASSERT_GUEST_MSG_RETURN(pFirstCmd->mParmCount == cParms,
     1279        ASSERT_GUEST_MSG_RETURN(pFirstMsg->mParmCount == cParms,
    12841280                                ("idMsg=%u (%s) cParms=%u, caller expected %u (%s) and %u\n",
    1285                                  pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount,
    1286                                  idMsgExpected, GstCtrlHostFnName((eHostFn)idMsgExpected), cParms),
     1281                                 pFirstMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pFirstMsg->mType), pFirstMsg->mParmCount,
     1282                                 idMsgExpected, GstCtrlHostMsgtoStr((eHostMsg)idMsgExpected), cParms),
    12871283                                VERR_WRONG_PARAMETER_COUNT);
    12881284
    12891285        /* Check the parameter types. */
    12901286        for (uint32_t i = 0; i < cParms; i++)
    1291             ASSERT_GUEST_MSG_RETURN(pFirstCmd->mpParms[i].type == paParms[i].type,
    1292                                     ("param #%u: type %u, caller expected %u (idMsg=%u %s)\n", i, pFirstCmd->mpParms[i].type,
    1293                                      paParms[i].type, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType)),
     1287            ASSERT_GUEST_MSG_RETURN(pFirstMsg->mpParms[i].type == paParms[i].type,
     1288                                    ("param #%u: type %u, caller expected %u (idMsg=%u %s)\n", i, pFirstMsg->mpParms[i].type,
     1289                                     paParms[i].type, pFirstMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pFirstMsg->mType)),
    12941290                                    VERR_WRONG_PARAMETER_TYPE);
    12951291
     
    13021298        int rc = VINF_SUCCESS;
    13031299        for (uint32_t i = 0; i < cParms; i++)
    1304             switch (pFirstCmd->mpParms[i].type)
     1300            switch (pFirstMsg->mpParms[i].type)
    13051301            {
    13061302                case VBOX_HGCM_SVC_PARM_32BIT:
    1307                     paParms[i].u.uint32 = pFirstCmd->mpParms[i].u.uint32;
     1303                    paParms[i].u.uint32 = pFirstMsg->mpParms[i].u.uint32;
    13081304                    break;
    13091305
    13101306                case VBOX_HGCM_SVC_PARM_64BIT:
    1311                     paParms[i].u.uint64 = pFirstCmd->mpParms[i].u.uint64;
     1307                    paParms[i].u.uint64 = pFirstMsg->mpParms[i].u.uint64;
    13121308                    break;
    13131309
    13141310                case VBOX_HGCM_SVC_PARM_PTR:
    13151311                {
    1316                     uint32_t const cbSrc = pFirstCmd->mpParms[i].u.pointer.size;
     1312                    uint32_t const cbSrc = pFirstMsg->mpParms[i].u.pointer.size;
    13171313                    uint32_t const cbDst = paParms[i].u.pointer.size;
    13181314                    paParms[i].u.pointer.size = cbSrc; /** @todo Check if this is safe in other layers...
    13191315                                                        * Update: Safe, yes, but VMMDevHGCM doesn't pass it along. */
    13201316                    if (cbSrc <= cbDst)
    1321                         memcpy(paParms[i].u.pointer.addr, pFirstCmd->mpParms[i].u.pointer.addr, cbSrc);
     1317                        memcpy(paParms[i].u.pointer.addr, pFirstMsg->mpParms[i].u.pointer.addr, cbSrc);
    13221318                    else
    13231319                        rc = VERR_BUFFER_OVERFLOW;
     
    13261322
    13271323                default:
    1328                     AssertMsgFailed(("#%u: %u\n", i, pFirstCmd->mpParms[i].type));
     1324                    AssertMsgFailed(("#%u: %u\n", i, pFirstMsg->mpParms[i].type));
    13291325                    rc = VERR_INTERNAL_ERROR;
    13301326                    break;
     
    13331329        {
    13341330            /*
    1335              * Complete the command and remove the pending message unless the
     1331             * Complete the message and remove the pending message unless the
    13361332             * guest raced us and cancelled this call in the meantime.
    13371333             */
     
    13401336            if (rc != VERR_CANCELLED)
    13411337            {
    1342                 RTListNodeRemove(&pFirstCmd->m_ListEntry);
    1343                 pFirstCmd->Delete();
     1338                RTListNodeRemove(&pFirstMsg->m_ListEntry);
     1339                pFirstMsg->Delete();
    13441340            }
    13451341            else
     
    13771373     * Execute.
    13781374     */
    1379     if (pClient->m_enmIsPending != 0)
     1375    if (pClient->m_enmPendingMsg != 0)
    13801376    {
    13811377        pClient->CancelWaiting();
     
    14221418     * Do the job.
    14231419     */
    1424     HostCommand *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);
    1425     if (pFirstCmd)
    1426     {
    1427         if (   pFirstCmd->mMsgType == idMsg
     1420    HostMsg *pFirstMsg = RTListGetFirstCpp(&pClient->m_HostMsgList, HostMsg, m_ListEntry);
     1421    if (pFirstMsg)
     1422    {
     1423        if (   pFirstMsg->mType == idMsg
    14281424            || idMsg == UINT32_MAX)
    14291425        {
     
    14321428            {
    14331429                /*
    1434                  * Remove the command from the queue.
     1430                 * Remove the message from the queue.
    14351431                 */
    1436                 Assert(RTListNodeIsFirst(&pClient->m_HostCmdList, &pFirstCmd->m_ListEntry) );
    1437                 RTListNodeRemove(&pFirstCmd->m_ListEntry);
     1432                Assert(RTListNodeIsFirst(&pClient->m_HostMsgList, &pFirstMsg->m_ListEntry) );
     1433                RTListNodeRemove(&pFirstMsg->m_ListEntry);
    14381434
    14391435                /*
     
    14411437                 */
    14421438                VBOXHGCMSVCPARM aReplyParams[5];
    1443                 HGCMSvcSetU32(&aReplyParams[0], pFirstCmd->m_idContext);
    1444                 switch (pFirstCmd->mMsgType)
     1439                HGCMSvcSetU32(&aReplyParams[0], pFirstMsg->m_idContext);
     1440                switch (pFirstMsg->mType)
    14451441                {
    1446                     case HOST_EXEC_CMD:
     1442                    case HOST_MSG_EXEC_CMD:
    14471443                        HGCMSvcSetU32(&aReplyParams[1], 0);              /* pid */
    14481444                        HGCMSvcSetU32(&aReplyParams[2], PROC_STS_ERROR); /* status */
    14491445                        HGCMSvcSetU32(&aReplyParams[3], rcSkip);         /* flags / whatever */
    14501446                        HGCMSvcSetPv(&aReplyParams[4], NULL, 0);         /* data buffer */
    1451                         hostCallback(GUEST_EXEC_STATUS, 5, aReplyParams);
     1447                        hostCallback(GUEST_MSG_EXEC_STATUS, 5, aReplyParams);
    14521448                        break;
    14531449
    1454                     case HOST_SESSION_CREATE:
     1450                    case HOST_MSG_SESSION_CREATE:
    14551451                        HGCMSvcSetU32(&aReplyParams[1], GUEST_SESSION_NOTIFYTYPE_ERROR);    /* type */
    14561452                        HGCMSvcSetU32(&aReplyParams[2], rcSkip);                            /* result */
    1457                         hostCallback(GUEST_SESSION_NOTIFY, 3, aReplyParams);
     1453                        hostCallback(GUEST_MSG_SESSION_NOTIFY, 3, aReplyParams);
    14581454                        break;
    14591455
    1460                     case HOST_EXEC_SET_INPUT:
    1461                         HGCMSvcSetU32(&aReplyParams[1], pFirstCmd->mParmCount >= 2 ? pFirstCmd->mpParms[1].u.uint32 : 0);
     1456                    case HOST_MSG_EXEC_SET_INPUT:
     1457                        HGCMSvcSetU32(&aReplyParams[1], pFirstMsg->mParmCount >= 2 ? pFirstMsg->mpParms[1].u.uint32 : 0);
    14621458                        HGCMSvcSetU32(&aReplyParams[2], INPUT_STS_ERROR);   /* status */
    14631459                        HGCMSvcSetU32(&aReplyParams[3], rcSkip);            /* flags / whatever */
    14641460                        HGCMSvcSetU32(&aReplyParams[4], 0);                 /* bytes consumed */
    1465                         hostCallback(GUEST_EXEC_INPUT_STATUS, 5, aReplyParams);
     1461                        hostCallback(GUEST_MSG_EXEC_INPUT_STATUS, 5, aReplyParams);
    14661462                        break;
    14671463
    1468                     case HOST_FILE_OPEN:
     1464                    case HOST_MSG_FILE_OPEN:
    14691465                        HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_OPEN); /* type*/
    14701466                        HGCMSvcSetU32(&aReplyParams[2], rcSkip);                     /* rc */
    1471                         HGCMSvcSetU32(&aReplyParams[3], VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pFirstCmd->m_idContext)); /* handle */
    1472                         hostCallback(GUEST_FILE_NOTIFY, 4, aReplyParams);
     1467                        HGCMSvcSetU32(&aReplyParams[3], VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pFirstMsg->m_idContext)); /* handle */
     1468                        hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams);
    14731469                        break;
    1474                     case HOST_FILE_CLOSE:
     1470                    case HOST_MSG_FILE_CLOSE:
    14751471                        HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_ERROR); /* type*/
    14761472                        HGCMSvcSetU32(&aReplyParams[2], rcSkip);                      /* rc */
    1477                         hostCallback(GUEST_FILE_NOTIFY, 3, aReplyParams);
     1473                        hostCallback(GUEST_MSG_FILE_NOTIFY, 3, aReplyParams);
    14781474                        break;
    1479                     case HOST_FILE_READ:
    1480                     case HOST_FILE_READ_AT:
     1475                    case HOST_MSG_FILE_READ:
     1476                    case HOST_MSG_FILE_READ_AT:
    14811477                        HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_READ);  /* type */
    14821478                        HGCMSvcSetU32(&aReplyParams[2], rcSkip);                      /* rc */
    14831479                        HGCMSvcSetPv(&aReplyParams[3], NULL, 0);                      /* data buffer */
    1484                         hostCallback(GUEST_FILE_NOTIFY, 4, aReplyParams);
     1480                        hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams);
    14851481                        break;
    1486                     case HOST_FILE_WRITE:
    1487                     case HOST_FILE_WRITE_AT:
     1482                    case HOST_MSG_FILE_WRITE:
     1483                    case HOST_MSG_FILE_WRITE_AT:
    14881484                        HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_WRITE); /* type */
    14891485                        HGCMSvcSetU32(&aReplyParams[2], rcSkip);                      /* rc */
    14901486                        HGCMSvcSetU32(&aReplyParams[3], 0);                           /* bytes written */
    1491                         hostCallback(GUEST_FILE_NOTIFY, 4, aReplyParams);
     1487                        hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams);
    14921488                        break;
    1493                     case HOST_FILE_SEEK:
     1489                    case HOST_MSG_FILE_SEEK:
    14941490                        HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_SEEK);  /* type */
    14951491                        HGCMSvcSetU32(&aReplyParams[2], rcSkip);                      /* rc */
    14961492                        HGCMSvcSetU64(&aReplyParams[3], 0);                           /* actual */
    1497                         hostCallback(GUEST_FILE_NOTIFY, 4, aReplyParams);
     1493                        hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams);
    14981494                        break;
    1499                     case HOST_FILE_TELL:
     1495                    case HOST_MSG_FILE_TELL:
    15001496                        HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_TELL);  /* type */
    15011497                        HGCMSvcSetU32(&aReplyParams[2], rcSkip);                      /* rc */
    15021498                        HGCMSvcSetU64(&aReplyParams[3], 0);                           /* actual */
    1503                         hostCallback(GUEST_FILE_NOTIFY, 4, aReplyParams);
     1499                        hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams);
    15041500                        break;
    15051501
    1506                     case HOST_EXEC_GET_OUTPUT: /** @todo This can't be right/work. */
    1507                     case HOST_EXEC_TERMINATE:  /** @todo This can't be right/work. */
    1508                     case HOST_EXEC_WAIT_FOR:   /** @todo This can't be right/work. */
    1509                     case HOST_PATH_USER_DOCUMENTS:
    1510                     case HOST_PATH_USER_HOME:
    1511                     case HOST_PATH_RENAME:
    1512                     case HOST_DIR_REMOVE:
     1502                    case HOST_MSG_EXEC_GET_OUTPUT: /** @todo This can't be right/work. */
     1503                    case HOST_MSG_EXEC_TERMINATE:  /** @todo This can't be right/work. */
     1504                    case HOST_MSG_EXEC_WAIT_FOR:   /** @todo This can't be right/work. */
     1505                    case HOST_MSG_PATH_USER_DOCUMENTS:
     1506                    case HOST_MSG_PATH_USER_HOME:
     1507                    case HOST_MSG_PATH_RENAME:
     1508                    case HOST_MSG_DIR_REMOVE:
    15131509                    default:
    1514                         HGCMSvcSetU32(&aReplyParams[1], pFirstCmd->mMsgType);
     1510                        HGCMSvcSetU32(&aReplyParams[1], pFirstMsg->mType);
    15151511                        HGCMSvcSetU32(&aReplyParams[2], (uint32_t)rcSkip);
    15161512                        HGCMSvcSetPv(&aReplyParams[3], NULL, 0);
     
    15201516
    15211517                /*
    1522                  * Free the command.
     1518                 * Free the message.
    15231519                 */
    1524                 pFirstCmd->Delete();
     1520                pFirstMsg->Delete();
    15251521            }
    15261522            else
     
    15281524            return VINF_HGCM_ASYNC_EXECUTE; /* The caller must not complete it. */
    15291525        }
    1530         LogFunc(("Warning: GUEST_MSG_SKIP mismatch! Found %u, caller expected %u!\n", pFirstCmd->mMsgType, idMsg));
     1526        LogFunc(("Warning: GUEST_MSG_SKIP mismatch! Found %u, caller expected %u!\n", pFirstMsg->mType, idMsg));
    15311527        return VERR_MISMATCH;
    15321528    }
     
    15961592
    15971593    /*
    1598      * Try complete the command.
     1594     * Try complete the message.
    15991595     */
    16001596    int rc = mpHelpers->pfnCallComplete(hCall, VINF_SUCCESS);
     
    17861782
    17871783    /*
    1788      * Forward the command to the destiation.
     1784     * Forward the message to the destiation.
    17891785     * Since we modify the first parameter, we must make a copy of the parameters.
    17901786     */
     
    17921788    HGCMSvcSetU64(&aParms[0], idContext | VBOX_GUESTCTRL_DST_SESSION);
    17931789    HGCMSvcSetU32(&aParms[1], fFlags);
    1794     int rc = hostProcessCommand(HOST_SESSION_CLOSE, RT_ELEMENTS(aParms), aParms);
     1790    int rc = hostProcessMessage(HOST_MSG_SESSION_CLOSE, RT_ELEMENTS(aParms), aParms);
    17951791
    17961792    LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->m_idClient, rc));
     
    18711867
    18721868/**
    1873  * For compatibility with old additions only - skip the current command w/o
     1869 * For compatibility with old additions only - skip the current message w/o
    18741870 * calling main code.
    18751871 *
     
    18991895     *       So, we have to track whether they issued a MSG_REPLY or not.  Wonderful.
    19001896     */
    1901     HostCommand *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);
    1902     if (pFirstCmd)
    1903     {
    1904         uint32_t const idMsg             = pFirstCmd->mMsgType;
    1905         bool const     f60BetaHackInPlay = pFirstCmd->m_f60BetaHackInPlay;
     1897    HostMsg *pFirstMsg = RTListGetFirstCpp(&pClient->m_HostMsgList, HostMsg, m_ListEntry);
     1898    if (pFirstMsg)
     1899    {
     1900        uint32_t const idMsg             = pFirstMsg->mType;
     1901        bool const     f60BetaHackInPlay = pFirstMsg->m_f60BetaHackInPlay;
    19061902        int            rc;
    19071903        if (!f60BetaHackInPlay)
     
    19091905        else
    19101906        {
    1911             RTListNodeRemove(&pFirstCmd->m_ListEntry);
    1912             pFirstCmd->Delete();
     1907            RTListNodeRemove(&pFirstMsg->m_ListEntry);
     1908            pFirstMsg->Delete();
    19131909            rc = VINF_SUCCESS;
    19141910        }
     
    19171913        if (RT_SUCCESS(rc))
    19181914        {
    1919             pClient->mHostCmdRc    = VINF_SUCCESS;
    1920             pClient->mHostCmdTries = 0;
     1915            pClient->mHostMsgRc    = VINF_SUCCESS;
     1916            pClient->mHostMsgTries = 0;
    19211917            pClient->mPeekCount    = 0;
    19221918        }
    19231919
    19241920        LogFlowFunc(("[Client %RU32] Legacy message skipping: Skipped %u (%s)%s!\n",
    1925                      pClient->m_idClient, idMsg, GstCtrlHostFnName((eHostFn)idMsg), f60BetaHackInPlay ? " hack style" : ""));
     1921                     pClient->m_idClient, idMsg, GstCtrlHostMsgtoStr((eHostMsg)idMsg), f60BetaHackInPlay ? " hack style" : ""));
    19261922        NOREF(idMsg);
    19271923        return rc;
     
    19391935 * @returns VBox status code.
    19401936 * @param   pClient         The client state.
    1941  * @param   idFunction      Function (event) that occured.
     1937 * @param   idMsg           Message ID that occured.
    19421938 * @param   cParms          Number of parameters.
    19431939 * @param   paParms         Array of parameters.
    19441940 */
    1945 int GstCtrlService::clientToMain(ClientState *pClient, uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     1941int GstCtrlService::clientToMain(ClientState *pClient, uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    19461942{
    19471943    /*
     
    19581954                            || (   m_fLegacyMode                                /* (see bugref:9313#c16) */
    19591955                                && pClient->m_idSession == UINT32_MAX
    1960                                 && (   idFunction == GUEST_EXEC_STATUS
    1961                                     || idFunction == GUEST_SESSION_NOTIFY)),
    1962                             ("idSession=%u (CID=%#x) m_idSession=%u idClient=%u idFunction=%u (%s)\n", idSession, idContext,
    1963                              pClient->m_idSession, pClient->m_idClient, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction)),
     1956                                && (   idMsg == GUEST_MSG_EXEC_STATUS
     1957                                    || idMsg == GUEST_MSG_SESSION_NOTIFY)),
     1958                            ("idSession=%u (CID=%#x) m_idSession=%u idClient=%u idMsg=%u (%s)\n", idSession, idContext,
     1959                             pClient->m_idSession, pClient->m_idClient, idMsg, GstCtrlGuestMsgToStr((eGuestMsg)idMsg)),
    19641960                            VERR_ACCESS_DENIED);
    19651961
     
    19671963     * It seems okay, so make the call.
    19681964     */
    1969     return hostCallback(idFunction, cParms, paParms);
     1965    return hostCallback(idMsg, cParms, paParms);
    19701966}
    19711967
     
    19811977/*static*/ DECLCALLBACK(void)
    19821978GstCtrlService::svcCall(void *pvService, VBOXHGCMCALLHANDLE hCall, uint32_t idClient, void *pvClient,
    1983                         uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival)
    1984 {
    1985     LogFlowFunc(("[Client %RU32] idFunction=%RU32 (%s), cParms=%RU32, paParms=0x%p\n",
    1986                  idClient, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction), cParms, paParms));
     1979                        uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival)
     1980{
     1981    LogFlowFunc(("[Client %RU32] u32Function=%RU32 (%s), cParms=%RU32, paParms=0x%p\n",
     1982                 idClient, u32Function, GstCtrlGuestMsgToStr((eGuestMsg)u32Function), cParms, paParms));
    19871983    RT_NOREF(tsArrival, idClient);
    19881984
     
    20001996     */
    20011997    int rc;
    2002     switch (idFunction)
    2003     {
    2004         case GUEST_MAKE_ME_MASTER:
     1998    switch (u32Function)
     1999    {
     2000        case GUEST_MSG_MAKE_ME_MASTER:
    20052001            LogFlowFunc(("[Client %RU32] GUEST_MAKE_ME_MASTER\n", idClient));
    20062002            rc = pThis->clientMakeMeMaster(pClient, hCall, cParms);
     
    20262022            rc = pThis->clientMsgSkip(pClient, hCall, cParms, paParms);
    20272023            break;
    2028         case GUEST_SESSION_PREPARE:
     2024        case GUEST_MSG_SESSION_PREPARE:
    20292025            LogFlowFunc(("[Client %RU32] GUEST_SESSION_PREPARE\n", idClient));
    20302026            rc = pThis->clientSessionPrepare(pClient, hCall, cParms, paParms);
    20312027            break;
    2032         case GUEST_SESSION_CANCEL_PREPARED:
     2028        case GUEST_MSG_SESSION_CANCEL_PREPARED:
    20332029            LogFlowFunc(("[Client %RU32] GUEST_SESSION_CANCEL_PREPARED\n", idClient));
    20342030            rc = pThis->clientSessionCancelPrepared(pClient, cParms, paParms);
    20352031            break;
    2036         case GUEST_SESSION_ACCEPT:
     2032        case GUEST_MSG_SESSION_ACCEPT:
    20372033            LogFlowFunc(("[Client %RU32] GUEST_SESSION_ACCEPT\n", idClient));
    20382034            rc = pThis->clientSessionAccept(pClient, hCall, cParms, paParms);
    20392035            break;
    2040         case GUEST_SESSION_CLOSE:
     2036        case GUEST_MSG_SESSION_CLOSE:
    20412037            LogFlowFunc(("[Client %RU32] GUEST_SESSION_CLOSE\n", idClient));
    20422038            rc = pThis->clientSessionCloseOther(pClient, cParms, paParms);
     
    20492045            if (cParms >= 3 && paParms[2].u.uint32 == (uint32_t)VERR_NOT_SUPPORTED)
    20502046            {
    2051                 HostCommand *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);
    2052                 if (pFirstCmd && pFirstCmd->m_idContext == paParms[0].u.uint32)
    2053                     pFirstCmd->m_f60BetaHackInPlay = true;
     2047                HostMsg *pFirstMsg = RTListGetFirstCpp(&pClient->m_HostMsgList, HostMsg, m_ListEntry);
     2048                if (pFirstMsg && pFirstMsg->m_idContext == paParms[0].u.uint32)
     2049                    pFirstMsg->m_f60BetaHackInPlay = true;
    20542050            }
    20552051            RT_FALL_THROUGH();
    20562052        case GUEST_MSG_PROGRESS_UPDATE:
    2057         case GUEST_SESSION_NOTIFY:
    2058         case GUEST_EXEC_OUTPUT:
    2059         case GUEST_EXEC_STATUS:
    2060         case GUEST_EXEC_INPUT_STATUS:
    2061         case GUEST_EXEC_IO_NOTIFY:
    2062         case GUEST_DIR_NOTIFY:
    2063         case GUEST_FILE_NOTIFY:
    2064             LogFlowFunc(("[Client %RU32] %s\n", idClient, GstCtrlGuestFnName((eGuestFn)idFunction)));
    2065             rc = pThis->clientToMain(pClient, idFunction, cParms, paParms);
     2053        case GUEST_MSG_SESSION_NOTIFY:
     2054        case GUEST_MSG_EXEC_OUTPUT:
     2055        case GUEST_MSG_EXEC_STATUS:
     2056        case GUEST_MSG_EXEC_INPUT_STATUS:
     2057        case GUEST_MSG_EXEC_IO_NOTIFY:
     2058        case GUEST_MSG_DIR_NOTIFY:
     2059        case GUEST_MSG_FILE_NOTIFY:
     2060            LogFlowFunc(("[Client %RU32] %s\n", idClient, GstCtrlGuestMsgToStr((eGuestMsg)u32Function)));
     2061            rc = pThis->clientToMain(pClient, u32Function /* Msg */, cParms, paParms);
    20662062            Assert(rc != VINF_HGCM_ASYNC_EXECUTE);
    20672063            break;
    20682064
    20692065        /*
    2070          * The remaining commands are here for compatibility with older guest additions:
     2066         * The remaining messages are here for compatibility with older Guest Additions:
    20712067         */
    20722068        case GUEST_MSG_WAIT:
     
    20972093         */
    20982094        default:
    2099             ASSERT_GUEST_MSG_FAILED(("idFunction=%d (%#x)\n", idFunction, idFunction));
     2095            ASSERT_GUEST_MSG_FAILED(("u32Function=%RU32 (%#x)\n", u32Function, u32Function));
    21002096            rc = VERR_INVALID_FUNCTION;
    21012097            break;
     
    21172113 *
    21182114 * @returns VBox status code.
    2119  * @param   idFunction      Function (event) that occured.
     2115 * @param   u32Function     Message ID that occured.
    21202116 * @param   cParms          Number of parameters.
    21212117 * @param   paParms         Array of parameters.
    21222118 */
    2123 int GstCtrlService::hostCallback(uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    2124 {
    2125     LogFlowFunc(("idFunction=%u (%s), cParms=%ld, paParms=%p\n", idFunction, GstCtrlGuestFnName((eGuestFn)idFunction), cParms, paParms));
     2119int GstCtrlService::hostCallback(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     2120{
     2121    LogFlowFunc(("u32Function=%RU32 (%s), cParms=%ld, paParms=%p\n",
     2122                 u32Function, GstCtrlGuestMsgToStr((eGuestMsg)u32Function), cParms, paParms));
    21262123
    21272124    int rc;
     
    21292126    {
    21302127        VBOXGUESTCTRLHOSTCALLBACK data(cParms, paParms);
    2131         rc = mpfnHostCallback(mpvHostData, idFunction, &data, sizeof(data));
     2128        rc = mpfnHostCallback(mpvHostData, u32Function, &data, sizeof(data));
    21322129    }
    21332130    else
     
    21402137
    21412138/**
    2142  * Processes a command received from the host side and re-routes it to
     2139 * Processes a message received from the host side and re-routes it to
    21432140 * a connect client on the guest.
    21442141 *
    21452142 * @returns VBox status code.
    2146  * @param   idFunction  Function code to process.
     2143 * @param   idMsg   Message ID to process.
    21472144 * @param   cParms      Number of parameters.
    21482145 * @param   paParms     Array of parameters.
    21492146 */
    2150 int GstCtrlService::hostProcessCommand(uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    2151 {
    2152     /*
    2153      * If no client is connected at all we don't buffer any host commands
     2147int GstCtrlService::hostProcessMessage(uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     2148{
     2149    /*
     2150     * If no client is connected at all we don't buffer any host messages
    21542151     * and immediately return an error to the host.  This avoids the host
    21552152     * waiting for a response from the guest side in case VBoxService on
     
    21582155    if (m_ClientStateMap.empty())
    21592156    {
    2160         LogFlow(("GstCtrlService::hostProcessCommand: VERR_NOT_FOUND!\n"));
     2157        LogFlow(("GstCtrlService::hostProcessMessage: VERR_NOT_FOUND!\n"));
    21612158        return VERR_NOT_FOUND;
    21622159    }
    21632160
    21642161    /*
    2165      * Create a host command for each destination.
     2162     * Create a host message for each destination.
    21662163     * Note! There is currently only one scenario in which we send a host
    2167      *       command to two recipients.
    2168      */
    2169     HostCommand *pHostCmd = new (std::nothrow) HostCommand();
    2170     AssertReturn(pHostCmd, VERR_NO_MEMORY);
    2171     int rc = pHostCmd->Init(idFunction, cParms, paParms);
     2164     *       message to two recipients.
     2165     */
     2166    HostMsg *pHostMsg = new (std::nothrow) HostMsg();
     2167    AssertReturn(pHostMsg, VERR_NO_MEMORY);
     2168    int rc = pHostMsg->Init(idMsg, cParms, paParms);
    21722169    if (RT_SUCCESS(rc))
    21732170    {
    2174         uint64_t const fDestinations = pHostCmd->m_idContextAndDst & VBOX_GUESTCTRL_DST_BOTH;
    2175         HostCommand   *pHostCmd2     = NULL;
     2171        uint64_t const fDestinations = pHostMsg->m_idContextAndDst & VBOX_GUESTCTRL_DST_BOTH;
     2172        HostMsg       *pHostMsg2     = NULL;
    21762173        if (fDestinations != VBOX_GUESTCTRL_DST_BOTH)
    21772174        { /* likely */ }
    21782175        else
    21792176        {
    2180             pHostCmd2 = new (std::nothrow) HostCommand();
    2181             if (pHostCmd2)
    2182                 rc = pHostCmd2->Init(idFunction, cParms, paParms);
     2177            pHostMsg2 = new (std::nothrow) HostMsg();
     2178            if (pHostMsg2)
     2179                rc = pHostMsg2->Init(idMsg, cParms, paParms);
    21832180            else
    21842181                rc = VERR_NO_MEMORY;
     
    21862183        if (RT_SUCCESS(rc))
    21872184        {
    2188             LogFlowFunc(("Handling host command m_idContextAndDst=%#RX64, idFunction=%RU32, cParms=%RU32, paParms=%p, cClients=%zu\n",
    2189                          pHostCmd->m_idContextAndDst, idFunction, cParms, paParms, m_ClientStateMap.size()));
     2185            LogFlowFunc(("Handling host message m_idContextAndDst=%#RX64, idMsg=%RU32, cParms=%RU32, paParms=%p, cClients=%zu\n",
     2186                         pHostMsg->m_idContextAndDst, idMsg, cParms, paParms, m_ClientStateMap.size()));
    21902187
    21912188            /*
     
    21982195            if (fDestinations & VBOX_GUESTCTRL_DST_SESSION)
    21992196            {
    2200                 uint32_t const idSession = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostCmd->m_idContext);
     2197                uint32_t const idSession = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostMsg->m_idContext);
    22012198                ClientStateMap::iterator It = m_SessionIdMap.find(idSession);
    22022199                if (It != m_SessionIdMap.end())
     
    22042201                    ClientState *pClient = It->second;
    22052202                    Assert(pClient->m_idSession == idSession);
    2206                     RTListAppend(&pClient->m_HostCmdList, &pHostCmd->m_ListEntry);
    2207                     pHostCmd  = pHostCmd2;
    2208                     pHostCmd2 = NULL;
     2203                    RTListAppend(&pClient->m_HostMsgList, &pHostMsg->m_ListEntry);
     2204                    pHostMsg  = pHostMsg2;
     2205                    pHostMsg2 = NULL;
    22092206
    22102207                    int rc2 = pClient->Wakeup();
     
    22152212                else
    22162213                {
    2217                     LogFunc(("No client with session ID %u was found! (idFunction=%d %s)\n",
    2218                              idSession, idFunction, GstCtrlHostFnName((eHostFn)idFunction)));
     2214                    LogFunc(("No client with session ID %u was found! (idMsg=%d %s)\n",
     2215                             idSession, idMsg, GstCtrlHostMsgtoStr((eHostMsg)idMsg)));
    22192216                    rc = !(fDestinations & VBOX_GUESTCTRL_DST_ROOT_SVC) ? VERR_NOT_FOUND : VWRN_NOT_FOUND;
    22202217                }
     
    22252222                && RT_SUCCESS(rc))
    22262223            {
    2227                 Assert(pHostCmd);
     2224                Assert(pHostMsg);
    22282225                if (m_pMasterClient)
    22292226                {
    2230                     RTListAppend(&m_pMasterClient->m_HostCmdList, &pHostCmd->m_ListEntry);
    2231                     pHostCmd = NULL;
     2227                    RTListAppend(&m_pMasterClient->m_HostMsgList, &pHostMsg->m_ListEntry);
     2228                    pHostMsg = NULL;
    22322229
    22332230                    int rc2 = m_pMasterClient->Wakeup();
     
    22402237        }
    22412238
    2242         /* Drop unset commands */
    2243         if (pHostCmd2)
    2244             pHostCmd2->Delete();
    2245     }
    2246     if (pHostCmd)
    2247         pHostCmd->Delete();
     2239        /* Drop unset messages. */
     2240        if (pHostMsg2)
     2241            pHostMsg2->Delete();
     2242    }
     2243    if (pHostMsg)
     2244        pHostMsg->Delete();
    22482245
    22492246    if (RT_FAILURE(rc))
    2250         LogFunc(("Failed %Rrc (idFunction=%u, cParms=%u)\n", rc, idFunction, cParms));
     2247        LogFunc(("Failed %Rrc (idMsg=%u, cParms=%u)\n", rc, idMsg, cParms));
    22512248    return rc;
    22522249}
     
    22552252/**
    22562253 * @interface_method_impl{VBOXHGCMSVCFNTABLE,pfnHostCall,
    2257  *  Wraps to the hostProcessCommand() member function.}
     2254 *  Wraps to the hostProcessMessage() member function.}
    22582255 */
    22592256/*static*/ DECLCALLBACK(int)
     
    22642261    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
    22652262
    2266     LogFlowFunc(("fn=%RU32, cParms=%RU32, paParms=0x%p\n", u32Function, cParms, paParms));
    2267     AssertReturn(u32Function != HOST_CANCEL_PENDING_WAITS, VERR_INVALID_FUNCTION);
    2268     return pThis->hostProcessCommand(u32Function, cParms, paParms);
     2263    LogFlowFunc(("u32Function=%RU32, cParms=%RU32, paParms=0x%p\n", u32Function, cParms, paParms));
     2264    AssertReturn(u32Function != HOST_MSG_CANCEL_PENDING_WAITS, VERR_INVALID_FUNCTION);
     2265    return pThis->hostProcessMessage(u32Function, cParms, paParms);
    22692266}
    22702267
  • trunk/src/VBox/HostServices/GuestControl/testcase/tstGuestControlSvc.cpp

    r76553 r76958  
    179179
    180180        /** Client connected, invalid parameters given. */
    181         { HOST_EXEC_CMD, 1024, 0, true, VERR_INVALID_POINTER },
    182         { HOST_EXEC_CMD, 1, 0, true, VERR_INVALID_POINTER },
    183         { HOST_EXEC_CMD, -1, 0, true, VERR_INVALID_POINTER },
     181        { HOST_MSG_EXEC_CMD, 1024, 0, true, VERR_INVALID_POINTER },
     182        { HOST_MSG_EXEC_CMD, 1, 0, true, VERR_INVALID_POINTER },
     183        { HOST_MSG_EXEC_CMD, -1, 0, true, VERR_INVALID_POINTER },
    184184
    185185        /** Client connected, parameters given. */
    186         { HOST_CANCEL_PENDING_WAITS, 1, &aParms[0], true, VINF_SUCCESS },
    187         { HOST_EXEC_CMD, 1, &aParms[0], true, VINF_SUCCESS },
    188         { HOST_EXEC_SET_INPUT, 1, &aParms[0], true, VINF_SUCCESS },
    189         { HOST_EXEC_GET_OUTPUT, 1, &aParms[0], true, VINF_SUCCESS },
     186        { HOST_MSG_CANCEL_PENDING_WAITS, 1, &aParms[0], true, VINF_SUCCESS },
     187        { HOST_MSG_EXEC_CMD, 1, &aParms[0], true, VINF_SUCCESS },
     188        { HOST_MSG_EXEC_SET_INPUT, 1, &aParms[0], true, VINF_SUCCESS },
     189        { HOST_MSG_EXEC_GET_OUTPUT, 1, &aParms[0], true, VINF_SUCCESS },
    190190
    191191        /** Client connected, unknown command + valid parameters given. */
     
    221221        HGCMSvcSetStr(&aParmsHost[2], "baz");
    222222
    223         rc = pTable->pfnHostCall(pTable->pvService, HOST_EXEC_CMD, 3, &aParmsHost[0]);
     223        rc = pTable->pfnHostCall(pTable->pvService, HOST_MSG_EXEC_CMD, 3, &aParmsHost[0]);
    224224        RTTEST_CHECK_RC_RET(g_hTest, rc, VINF_SUCCESS, rc);
    225225
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette