Index: /trunk/src/VBox/HostServices/GuestControl/service.cpp
===================================================================
--- /trunk/src/VBox/HostServices/GuestControl/service.cpp	(revision 75870)
+++ /trunk/src/VBox/HostServices/GuestControl/service.cpp	(revision 75871)
@@ -60,5 +60,4 @@
 *   Header Files                                                                                                                 *
 *********************************************************************************************************************************/
-#define USE_PVCLIENT
 #define LOG_GROUP LOG_GROUP_GUEST_CONTROL
 #include <VBox/HostServices/GuestControlSvc.h>
@@ -90,8 +89,7 @@
 
 /**
- * Structure for maintaining a pending (that is, a deferred and not yet completed)
- * client command.
- */
-typedef struct ClientConnection
+ * Structure for maintaining a request.
+ */
+typedef struct ClientRequest
 {
     /** The call handle */
@@ -101,8 +99,9 @@
     /** The call parameters */
     VBOXHGCMSVCPARM *mParms;
-    /** The standard constructor. */
-    ClientConnection(void)
-        : mHandle(0), mNumParms(0), mParms(NULL) {}
-} ClientConnection;
+    /** The default constructor. */
+    ClientRequest(void)
+        : mHandle(0), mNumParms(0), mParms(NULL)
+    {}
+} ClientRequest;
 
 /**
@@ -395,5 +394,5 @@
     }
 
-    int Assign(const ClientConnection *pConnection)
+    int Assign(const ClientRequest *pConnection)
     {
         AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
@@ -435,5 +434,5 @@
     }
 
-    int Peek(const ClientConnection *pConnection)
+    int Peek(const ClientRequest *pConnection)
     {
         AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
@@ -461,6 +460,4 @@
 } HostCommand;
 typedef std::list< HostCommand *> HostCmdList;
-typedef std::list< HostCommand *>::iterator HostCmdListIter;
-typedef std::list< HostCommand *>::const_iterator HostCmdListIterConst;
 
 /**
@@ -478,6 +475,4 @@
 } ClientContext;
 typedef std::map< uint32_t, ClientContext > ClientContextMap;
-typedef std::map< uint32_t, ClientContext >::iterator ClientContextMapIter;
-typedef std::map< uint32_t, ClientContext >::const_iterator ClientContextMapIterConst;
 
 /**
@@ -486,7 +481,7 @@
 typedef struct ClientState
 {
-    PVBOXHGCMSVCHELPERS mSvcHelpers;
-    /** The client's ID. */
-    uint32_t mID;
+    PVBOXHGCMSVCHELPERS     m_pSvcHelpers;
+    /** The HGCM client ID. */
+    uint32_t                m_idClient;
     /** Host command list to process. */
     HostCmdList mHostCmdList;
@@ -495,19 +490,19 @@
      * This means the client waits for a new host command to reply and won't return
      * from the waiting call until a new host command is available. */
-    guestControl::eGuestFn mIsPending;
+    guestControl::eGuestFn  m_enmIsPending;
     /** The client's pending connection. */
-    ClientConnection    mPendingCon;
+    ClientRequest           m_PendingReq;
     /** Set if we've got a pending wait cancel. */
-    bool                m_fPendingCancel;
+    bool                    m_fPendingCancel;
     /** Set if master. */
-    bool                m_fIsMaster;
+    bool                    m_fIsMaster;
     /** The session ID for this client, UINT32_MAX if not set or master. */
-    uint32_t            m_idSession;
+    uint32_t                m_idSession;
 
 
     ClientState(void)
-        : mSvcHelpers(NULL)
-        , mID(0)
-        , mIsPending((guestControl::eGuestFn)0)
+        : m_pSvcHelpers(NULL)
+        , m_idClient(0)
+        , m_enmIsPending((guestControl::eGuestFn)0)
         , m_fPendingCancel(false)
         , m_fIsMaster(false)
@@ -519,7 +514,7 @@
 
     ClientState(PVBOXHGCMSVCHELPERS pSvcHelpers, uint32_t idClient)
-        : mSvcHelpers(pSvcHelpers)
-        , mID(idClient)
-        , mIsPending((guestControl::eGuestFn)0)
+        : m_pSvcHelpers(pSvcHelpers)
+        , m_idClient(idClient)
+        , m_enmIsPending((guestControl::eGuestFn)0)
         , m_fPendingCancel(false)
         , m_fIsMaster(false)
@@ -559,11 +554,11 @@
         int rc = VINF_NO_CHANGE;
 
-        if (mIsPending != 0)
-        {
-            LogFlowFunc(("[Client %RU32] Waking up ...\n", mID));
+        if (m_enmIsPending != 0)
+        {
+            LogFlowFunc(("[Client %RU32] Waking up ...\n", m_idClient));
 
             rc = VINF_SUCCESS;
 
-            HostCmdListIter ItFirstCmd = mHostCmdList.begin();
+            HostCmdList::iterator ItFirstCmd = mHostCmdList.begin();
             if (ItFirstCmd != mHostCmdList.end())
             {
@@ -572,23 +567,23 @@
 
                 LogFlowThisFunc(("[Client %RU32] Current host command is %RU32 (CID=%RU32, cParms=%RU32, m_cRefs=%RU32)\n",
-                                 mID, pFirstCmd->mMsgType, pFirstCmd->m_idContext, pFirstCmd->mParmCount, pFirstCmd->m_cRefs));
-
-                if (mIsPending == GUEST_MSG_PEEK_WAIT)
+                                 m_idClient, pFirstCmd->mMsgType, pFirstCmd->m_idContext, pFirstCmd->mParmCount, pFirstCmd->m_cRefs));
+
+                if (m_enmIsPending == GUEST_MSG_PEEK_WAIT)
                 {
-                    pFirstCmd->setPeekReturn(mPendingCon.mParms, mPendingCon.mNumParms);
-                    rc = mSvcHelpers->pfnCallComplete(mPendingCon.mHandle, VINF_SUCCESS);
-
-                    mPendingCon.mHandle   = NULL;
-                    mPendingCon.mParms    = NULL;
-                    mPendingCon.mNumParms = 0;
-                    mIsPending            = (guestControl::eGuestFn)0;
+                    pFirstCmd->setPeekReturn(m_PendingReq.mParms, m_PendingReq.mNumParms);
+                    rc = m_pSvcHelpers->pfnCallComplete(m_PendingReq.mHandle, VINF_SUCCESS);
+
+                    m_PendingReq.mHandle   = NULL;
+                    m_PendingReq.mParms    = NULL;
+                    m_PendingReq.mNumParms = 0;
+                    m_enmIsPending            = (guestControl::eGuestFn)0;
                 }
-                else if (mIsPending == GUEST_MSG_WAIT)
-                    rc = OldRun(&mPendingCon, pFirstCmd);
+                else if (m_enmIsPending == GUEST_MSG_WAIT)
+                    rc = OldRun(&m_PendingReq, pFirstCmd);
                 else
-                    AssertMsgFailed(("mIsPending=%d\n", mIsPending));
+                    AssertMsgFailed(("m_enmIsPending=%d\n", m_enmIsPending));
             }
             else
-                AssertMsgFailed(("Waking up client ID=%RU32 with no host command in queue is a bad idea\n", mID));
+                AssertMsgFailed(("Waking up client ID=%RU32 with no host command in queue is a bad idea\n", m_idClient));
 
             return rc;
@@ -606,5 +601,5 @@
     {
         LogFlowFunc(("[Client %RU32] Cancelling waiting thread, isPending=%d, pendingNumParms=%RU32, m_idSession=%x\n",
-                     mID, mIsPending, mPendingCon.mNumParms, m_idSession));
+                     m_idClient, m_enmIsPending, m_PendingReq.mNumParms, m_idSession));
 
         /*
@@ -612,7 +607,7 @@
          */
         int rcComplete;
-        if (mIsPending == GUEST_MSG_PEEK_WAIT)
-        {
-            HGCMSvcSetU32(&mPendingCon.mParms[0], HOST_CANCEL_PENDING_WAITS);
+        if (m_enmIsPending == GUEST_MSG_PEEK_WAIT)
+        {
+            HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_CANCEL_PENDING_WAITS);
             rcComplete = VINF_TRY_AGAIN;
         }
@@ -622,12 +617,12 @@
          * aren't two parameters, fail the call.
          */
-        else if (mIsPending != 0)
-        {
-            Assert(mIsPending == GUEST_MSG_WAIT);
-            if (mPendingCon.mNumParms > 0)
-                HGCMSvcSetU32(&mPendingCon.mParms[0], HOST_CANCEL_PENDING_WAITS);
-            if (mPendingCon.mNumParms > 1)
-                HGCMSvcSetU32(&mPendingCon.mParms[1], 0);
-            rcComplete = mPendingCon.mNumParms == 2 ? VINF_SUCCESS : VERR_TRY_AGAIN;
+        else if (m_enmIsPending != 0)
+        {
+            Assert(m_enmIsPending == GUEST_MSG_WAIT);
+            if (m_PendingReq.mNumParms > 0)
+                HGCMSvcSetU32(&m_PendingReq.mParms[0], HOST_CANCEL_PENDING_WAITS);
+            if (m_PendingReq.mNumParms > 1)
+                HGCMSvcSetU32(&m_PendingReq.mParms[1], 0);
+            rcComplete = m_PendingReq.mNumParms == 2 ? VINF_SUCCESS : VERR_TRY_AGAIN;
         }
         /*
@@ -640,10 +635,10 @@
         }
 
-        mSvcHelpers->pfnCallComplete(mPendingCon.mHandle, rcComplete);
-
-        mPendingCon.mHandle   = NULL;
-        mPendingCon.mParms    = NULL;
-        mPendingCon.mNumParms = 0;
-        mIsPending            = (guestControl::eGuestFn)0;
+        m_pSvcHelpers->pfnCallComplete(m_PendingReq.mHandle, rcComplete);
+
+        m_PendingReq.mHandle   = NULL;
+        m_PendingReq.mParms    = NULL;
+        m_PendingReq.mNumParms = 0;
+        m_enmIsPending            = (guestControl::eGuestFn)0;
         m_fPendingCancel      = false;
         return VINF_SUCCESS;
@@ -698,5 +693,5 @@
      * @note Only used by GUEST_MSG_WAIT scenarios.
      */
-    int OldRun(ClientConnection const *pConnection, HostCommand *pHostCmd)
+    int OldRun(ClientRequest const *pConnection, HostCommand *pHostCmd)
     {
         AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
@@ -705,9 +700,9 @@
 
         LogFlowFunc(("[Client %RU32] pConnection=%p, mHostCmdRc=%Rrc, mHostCmdTries=%RU32, mPeekCount=%RU32\n",
-                      mID, pConnection, mHostCmdRc, mHostCmdTries, mPeekCount));
+                      m_idClient, pConnection, mHostCmdRc, mHostCmdTries, mPeekCount));
 
         int rc = mHostCmdRc = OldSendReply(pConnection, pHostCmd);
 
-        LogFlowThisFunc(("[Client %RU32] Processing command %RU32 ended with rc=%Rrc\n", mID, pHostCmd->mMsgType, mHostCmdRc));
+        LogFlowThisFunc(("[Client %RU32] Processing command %RU32 ended with rc=%Rrc\n", m_idClient, pHostCmd->mMsgType, mHostCmdRc));
 
         bool fRemove = false;
@@ -745,5 +740,5 @@
 
         LogFlowThisFunc(("[Client %RU32] Tried command %RU32 for %RU32 times, (last result=%Rrc, fRemove=%RTbool)\n",
-                         mID, pHostCmd->mMsgType, mHostCmdTries, rc, fRemove));
+                         m_idClient, pHostCmd->mMsgType, mHostCmdTries, rc, fRemove));
 
         if (fRemove)
@@ -753,5 +748,5 @@
         }
 
-        LogFlowFunc(("[Client %RU32] Returned with rc=%Rrc\n", mID, rc));
+        LogFlowFunc(("[Client %RU32] Returned with rc=%Rrc\n", m_idClient, rc));
         return rc;
     }
@@ -760,5 +755,5 @@
      * @note Only used by GUEST_MSG_WAIT scenarios.
      */
-    int OldRunCurrent(const ClientConnection *pConnection)
+    int OldRunCurrent(const ClientRequest *pConnection)
     {
         AssertPtrReturn(pConnection, VERR_INVALID_POINTER);
@@ -772,8 +767,8 @@
             {
                 /* Go to sleep. */
-                ASSERT_GUEST_RETURN(mIsPending == 0, VERR_WRONG_ORDER);
-                mPendingCon = *pConnection;
-                mIsPending  = GUEST_MSG_WAIT;
-                LogFlowFunc(("[Client %RU32] Is now in pending mode\n", mID));
+                ASSERT_GUEST_RETURN(m_enmIsPending == 0, VERR_WRONG_ORDER);
+                m_PendingReq = *pConnection;
+                m_enmIsPending  = GUEST_MSG_WAIT;
+                LogFlowFunc(("[Client %RU32] Is now in pending mode\n", m_idClient));
                 return VINF_HGCM_ASYNC_EXECUTE;
             }
@@ -791,5 +786,5 @@
          * Return first host command.
          */
-        HostCmdListIter curCmd = mHostCmdList.begin();
+        HostCmdList::iterator curCmd = mHostCmdList.begin();
         Assert(curCmd != mHostCmdList.end());
         HostCommand *pHostCmd = *curCmd;
@@ -803,5 +798,5 @@
      * @note Only used for GUEST_MSG_WAIT.
      */
-    int OldSendReply(ClientConnection const *pConnection,
+    int OldSendReply(ClientRequest const *pConnection,
                      HostCommand            *pHostCmd)
     {
@@ -815,7 +810,7 @@
         /* If the client is in pending mode, always send back
          * the peek result first. */
-        if (mIsPending)
-        {
-            Assert(mIsPending == GUEST_MSG_WAIT);
+        if (m_enmIsPending)
+        {
+            Assert(m_enmIsPending == GUEST_MSG_WAIT);
             rc = pHostCmd->Peek(pConnection);
             mPeekCount++;
@@ -847,10 +842,10 @@
 
         /* Reset pending status. */
-        mIsPending = (guestControl::eGuestFn)0;
+        m_enmIsPending = (guestControl::eGuestFn)0;
 
         /* In any case the client did something, so complete
          * the pending call with the result we just got. */
-        AssertPtr(mSvcHelpers);
-        int rc2 = mSvcHelpers->pfnCallComplete(pConnection->mHandle, rc);
+        AssertPtr(m_pSvcHelpers);
+        int rc2 = m_pSvcHelpers->pfnCallComplete(pConnection->mHandle, rc);
 
         /* Rollback in case the guest cancelled the call. */
@@ -862,5 +857,5 @@
 
         LogFlowThisFunc(("[Client %RU32] Command %RU32 ended with %Rrc (mPeekCount=%RU32, pConnection=%p)\n",
-                         mID, pHostCmd->mMsgType, rc, mPeekCount, pConnection));
+                         m_idClient, pHostCmd->mMsgType, rc, mPeekCount, pConnection));
         return rc;
     }
@@ -868,13 +863,7 @@
     /** @} */
 } ClientState;
-#ifdef USE_PVCLIENT
 typedef std::map< uint32_t, ClientState *> ClientStateMap;
 typedef std::map< uint32_t, ClientState *>::iterator ClientStateMapIter;
 typedef std::map< uint32_t, ClientState *>::const_iterator ClientStateMapIterConst;
-#else
-typedef std::map< uint32_t, ClientState > ClientStateMap;
-typedef std::map< uint32_t, ClientState >::iterator ClientStateMapIter;
-typedef std::map< uint32_t, ClientState >::const_iterator ClientStateMapIterConst;
-#endif
 
 /**
@@ -1009,5 +998,4 @@
      */
     ClientState *pClient;
-#ifdef USE_PVCLIENT
     try
     {
@@ -1027,15 +1015,4 @@
         return VERR_NO_MEMORY;
     }
-#else
-    try
-    {
-        pThis->mClientStateMap[idClient] = ClientState(pThis->mpHelpers, idClient);
-        pClient = &pThis->mClientStateMap[idClient];
-    }
-    catch (std::bad_alloc &)
-    {
-        return VERR_NO_MEMORY;
-    }
-#endif
 
     /*
@@ -1073,19 +1050,7 @@
     SELF *pThis = reinterpret_cast<SELF *>(pvService);
     AssertPtrReturn(pThis, VERR_INVALID_POINTER);
-#ifdef USE_PVCLIENT
     ClientState *pClient = reinterpret_cast<ClientState *>(pvClient);
     AssertPtrReturn(pClient, VERR_INVALID_POINTER);
-#else
-    RT_NOREF(pvClient);
-#endif
     LogFlowFunc(("[Client %RU32] Disconnected (%zu clients total)\n", idClient, pThis->mClientStateMap.size()));
-
-#ifndef USE_PVCLIENT
-    ClientStateMapIter ItClientState = pThis->mClientStateMap.find(idClient);
-    AssertMsgReturn(ItClientState != pThis->mClientStateMap.end(),
-                    ("Client ID=%RU32 not found in client list when it should be there\n", idClient),
-                    VINF_SUCCESS);
-    ClientState *pClient = &ItClientState->second;
-#endif
 
     /*
@@ -1113,10 +1078,6 @@
      * Delete the client state.
      */
-#ifdef USE_PVCLIENT
     pThis->mClientStateMap.erase(idClient);
     pClient->~ClientState();
-#else
-    pThis->mClientStateMap.erase(ItClientState);
-#endif
     pClient = NULL;
 
@@ -1165,5 +1126,5 @@
 
     /* Use the current (inbound) connection. */
-    ClientConnection thisCon;
+    ClientRequest thisCon;
     thisCon.mHandle   = hCall;
     thisCon.mNumParms = cParms;
@@ -1205,14 +1166,14 @@
      * Do the work.
      */
-    ASSERT_GUEST_MSG_RETURN(m_idMasterClient == pClient->mID || m_idMasterClient == UINT32_MAX,
-                            ("Already have master session %RU32, refusing %RU32.\n", m_idMasterClient, pClient->mID),
+    ASSERT_GUEST_MSG_RETURN(m_idMasterClient == pClient->m_idClient || m_idMasterClient == UINT32_MAX,
+                            ("Already have master session %RU32, refusing %RU32.\n", m_idMasterClient, pClient->m_idClient),
                             VERR_RESOURCE_BUSY);
     int rc = mpHelpers->pfnCallComplete(hCall, VINF_SUCCESS);
     if (RT_SUCCESS(rc))
     {
-        m_idMasterClient = pClient->mID;
+        m_idMasterClient = pClient->m_idClient;
         m_fLegacyMode    = false;
         pClient->m_fIsMaster = true;
-        Log(("[Client %RU32] is master.\n", pClient->mID));
+        Log(("[Client %RU32] is master.\n", pClient->m_idClient));
     }
     else
@@ -1270,5 +1231,5 @@
             paParms[0].u.uint32 = idRestore;
             LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VERR_VM_RESTORED (%#RX64 -> %#RX64)\n",
-                         pClient->mID, idRestoreCheck, idRestore));
+                         pClient->m_idClient, idRestoreCheck, idRestore));
             return VERR_VM_RESTORED;
         }
@@ -1279,5 +1240,5 @@
      * Return information about the first command if one is pending in the list.
      */
-    HostCmdListIter itFirstCmd = pClient->mHostCmdList.begin();
+    HostCmdList::iterator itFirstCmd = pClient->mHostCmdList.begin();
     if (itFirstCmd != pClient->mHostCmdList.end())
     {
@@ -1285,5 +1246,5 @@
         pFirstCmd->setPeekReturn(paParms, cParms);
         LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VINF_SUCCESS (idMsg=%u (%s), cParms=%u)\n",
-                     pClient->mID, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount));
+                     pClient->m_idClient, pFirstCmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount));
         return VINF_SUCCESS;
     }
@@ -1294,5 +1255,5 @@
     if (!fWait)
     {
-        LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_NOWAIT -> VERR_TRY_AGAIN\n", pClient->mID));
+        LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_NOWAIT -> VERR_TRY_AGAIN\n", pClient->m_idClient));
         return VERR_TRY_AGAIN;
     }
@@ -1301,10 +1262,11 @@
      * Wait for the host to queue a message for this client.
      */
-    ASSERT_GUEST_MSG_RETURN(pClient->mIsPending == 0, ("Already pending! (idClient=%RU32)\n", pClient->mID), VERR_RESOURCE_BUSY);
-    pClient->mPendingCon.mHandle    = hCall;
-    pClient->mPendingCon.mNumParms  = cParms;
-    pClient->mPendingCon.mParms     = paParms;
-    pClient->mIsPending             = GUEST_MSG_PEEK_WAIT;
-    LogFlowFunc(("[Client %RU32] Is now in pending mode\n", pClient->mID));
+    ASSERT_GUEST_MSG_RETURN(pClient->m_enmIsPending == 0, ("Already pending! (idClient=%RU32)\n", pClient->m_idClient), 
+                            VERR_RESOURCE_BUSY);
+    pClient->m_PendingReq.mHandle    = hCall;
+    pClient->m_PendingReq.mNumParms  = cParms;
+    pClient->m_PendingReq.mParms     = paParms;
+    pClient->m_enmIsPending             = GUEST_MSG_PEEK_WAIT;
+    LogFlowFunc(("[Client %RU32] Is now in pending mode...\n", pClient->m_idClient));
     return VINF_HGCM_ASYNC_EXECUTE;
 }
@@ -1343,5 +1305,5 @@
      * Return information aobut the first command if one is pending in the list.
      */
-    HostCmdListIter itFirstCmd = pClient->mHostCmdList.begin();
+    HostCmdList::iterator itFirstCmd = pClient->mHostCmdList.begin();
     if (itFirstCmd != pClient->mHostCmdList.end())
     {
@@ -1424,5 +1386,5 @@
     paParms[0].u.uint32 = 0;
     paParms[1].u.uint32 = 0;
-    LogFlowFunc(("[Client %RU32] GUEST_MSG_GET -> VERR_TRY_AGAIN\n", pClient->mID));
+    LogFlowFunc(("[Client %RU32] GUEST_MSG_GET -> VERR_TRY_AGAIN\n", pClient->m_idClient));
     return VERR_TRY_AGAIN;
 }
@@ -1449,5 +1411,5 @@
      * Execute.
      */
-    if (pClient->mIsPending != 0)
+    if (pClient->m_enmIsPending != 0)
     {
         pClient->CancelWaiting();
@@ -1643,5 +1605,5 @@
     ASSERT_GUEST_RETURN(pClient->m_fIsMaster, VERR_ACCESS_DENIED);
     ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED);
-    Assert(m_idMasterClient == pClient->mID);
+    Assert(m_idMasterClient == pClient->m_idClient);
 
     /* Now that we know it's the master, we can check for session ID duplicates. */
@@ -1706,5 +1668,5 @@
     ASSERT_GUEST_RETURN(pClient->m_fIsMaster, VERR_ACCESS_DENIED);
     ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED);
-    Assert(m_idMasterClient == pClient->mID);
+    Assert(m_idMasterClient == pClient->m_idClient);
 
     /*
@@ -1777,5 +1739,5 @@
     ASSERT_GUEST_RETURN(!pClient->m_fIsMaster, VERR_ACCESS_DENIED);
     ASSERT_GUEST_RETURN(!m_fLegacyMode, VERR_ACCESS_DENIED);
-    Assert(m_idMasterClient != pClient->mID);
+    Assert(m_idMasterClient != pClient->m_idClient);
     ASSERT_GUEST_RETURN(pClient->m_idSession == UINT32_MAX, VERR_RESOURCE_BUSY);
 
@@ -1802,5 +1764,5 @@
                     RTMemFree(pCur);
                     m_cPreparedSessions -= 1;
-                    Log(("[Client %RU32] accepted session id %u.\n", pClient->mID, idSession));
+                    Log(("[Client %RU32] accepted session id %u.\n", pClient->m_idClient, idSession));
                 }
                 else
@@ -1808,10 +1770,10 @@
                 return VINF_HGCM_ASYNC_EXECUTE; /* The caller must not complete it. */
             }
-            LogFunc(("Key mismatch for %u!\n", pClient->mID));
+            LogFunc(("Key mismatch for %u!\n", pClient->m_idClient));
             return VERR_MISMATCH;
         }
     }
 
-    LogFunc(("No client prepared for %u!\n", pClient->mID));
+    LogFunc(("No client prepared for %u!\n", pClient->m_idClient));
     return VERR_NOT_FOUND;
 }
@@ -1849,5 +1811,5 @@
     int rc = hostProcessCommand(HOST_SESSION_CLOSE, RT_ELEMENTS(aParms), aParms);
 
-    LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->mID, rc));
+    LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->m_idClient, rc));
     return rc;
 }
@@ -1904,15 +1866,8 @@
 
         for (ClientStateMapIter It = mClientStateMap.begin(); It != mClientStateMap.end(); ++It)
-#ifdef USE_PVCLIENT
             ASSERT_GUEST_LOGREL_MSG_RETURN(It->second->m_idSession != idSession,
                                            ("idSession=%u uValue=%#x idClient=%u; conflicting with client %u\n",
-                                            idSession, uValue, pClient->mID, It->second->mID),
+                                            idSession, uValue, pClient->m_idClient, It->second->m_idClient),
                                            VERR_DUPLICATE);
-#else
-            ASSERT_GUEST_LOGREL_MSG_RETURN(It->second.m_idSession != idSession,
-                                           ("idSession=%u uValue=%#x idClient=%u; conflicting with client %u\n",
-                                            idSession, uValue, pClient->mID, It->second.mID),
-                                           VERR_DUPLICATE);
-#endif
         /* Commit it. */
         pClient->m_idSession = idSession;
@@ -1946,5 +1901,5 @@
         pClient->OldDitchFirstHostCmd();
 
-    LogFlowFunc(("[Client %RU32] Skipped current message - leagcy function\n", pClient->mID));
+    LogFlowFunc(("[Client %RU32] Skipped current message - leagcy function\n", pClient->m_idClient));
     return VINF_SUCCESS;
 }
@@ -1980,5 +1935,5 @@
                                     || idFunction == GUEST_SESSION_NOTIFY)),
                             ("idSession=%u (CID=%#x) m_idSession=%u idClient=%u idFunction=%u (%s)\n", idSession, idContext,
-                             pClient->m_idSession, pClient->mID, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction)),
+                             pClient->m_idSession, pClient->m_idClient, idFunction, GstCtrlGuestFnName((eGuestFn)idFunction)),
                             VERR_ACCESS_DENIED);
 
@@ -2011,15 +1966,7 @@
     SELF *pThis = reinterpret_cast<SELF *>(pvService);
     AssertReturnVoidStmt(pThis, pThis->mpHelpers->pfnCallComplete(hCall, VERR_INTERNAL_ERROR_5));
-#ifdef USE_PVCLIENT
     ClientState *pClient = reinterpret_cast<ClientState *>(pvClient);
     AssertReturnVoidStmt(pClient, pThis->mpHelpers->pfnCallComplete(hCall, VERR_INVALID_CLIENT_ID));
-    Assert(pClient->mID == idClient);
-#else
-    ClientStateMapIter ItClientState = pThis->mClientStateMap.find(idClient);
-    AssertReturnVoidStmt(ItClientState != pThis->mClientStateMap.end(),
-                         pThis->mpHelpers->pfnCallComplete(hCall, VERR_INVALID_CLIENT_ID));
-    ClientState *pClient = &ItClientState->second;
-    RT_NOREF(pvClient);
-#endif
+    Assert(pClient->m_idClient == idClient);
 
     /*
@@ -2088,6 +2035,5 @@
 
         /*
-         * The remaining commands are here for compatibility with older
-         * guest additions:
+         * The remaining commands are here for compatibility with older guest additions:
          */
         case GUEST_MSG_WAIT:
@@ -2113,6 +2059,5 @@
 
         /*
-         * Anything else shall return fail with invalid function.
-         *
+         * Anything else shall return invalid function.
          * Note! We used to return VINF_SUCCESS for these.  See bugref:9313
          *       and Guest::i_notifyCtrlDispatcher().
@@ -2221,9 +2166,5 @@
             for (ClientStateMapIter It = mClientStateMap.begin(); It != mClientStateMap.end(); ++It)
             {
-#ifdef USE_PVCLIENT
                 ClientState *pClient = It->second;
-#else
-                ClientState *pClient = &It->second;
-#endif
                 if (pClient->m_idSession == idSession)
                 {
@@ -2232,5 +2173,5 @@
                     {
                         int rc2 = pClient->Wakeup();
-                        LogFlowFunc(("Woke up client ID=%RU32 -> rc=%Rrc\n", pClient->mID, rc2));
+                        LogFlowFunc(("Woke up client ID=%RU32 -> rc=%Rrc\n", pClient->m_idClient, rc2));
                         RT_NOREF(rc2);
                     }
@@ -2247,14 +2188,10 @@
             if (It != mClientStateMap.end())
             {
-#ifdef USE_PVCLIENT
                 ClientState *pClient = It->second;
-#else
-                ClientState *pClient = &It->second;
-#endif
                 int rc2 = pClient->EnqueueCommand(pHostCmd);
                 if (RT_SUCCESS(rc2))
                 {
                     rc2 = pClient->Wakeup();
-                    LogFlowFunc(("Woke up client ID=%RU32 (master) -> rc=%Rrc\n", pClient->mID, rc2));
+                    LogFlowFunc(("Woke up client ID=%RU32 (master) -> rc=%Rrc\n", pClient->m_idClient, rc2));
                 }
                 else
@@ -2340,9 +2277,5 @@
         ClientStateMapIter It = pThis->mClientStateMap.find(idClient);
         if (It != pThis->mClientStateMap.end())
-#ifdef USE_PVCLIENT
             It->second->m_fIsMaster = fIsMaster;
-#else
-            It->second.m_fIsMaster = fIsMaster;
-#endif
         else
             AssertFailed();
