Changeset 76958 in vbox for trunk/src/VBox/HostServices/GuestControl
- Timestamp:
- Jan 23, 2019 6:23:04 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128342
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox
- Property svn:mergeinfo
-
old new 8 8 /branches/VBox-5.0/src/VBox:104938,104943,104950,104987-104988,104990,106453 9 9 /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 11 11 /branches/andy/draganddrop/src/VBox:90781-91268 12 12 /branches/andy/guestctrl20/src/VBox:78916,78930
-
- Property svn:mergeinfo
-
trunk/src/VBox/HostServices/GuestControl/service.cpp
r76956 r76958 18 18 /** @page pg_svc_guest_control Guest Control HGCM Service 19 19 * 20 * This service acts as a proxy for handling and buffering host commandrequests20 * This service acts as a proxy for handling and buffering host message requests 21 21 * and clients on the guest. It tries to be as transparent as possible to let 22 22 * the guest (client) and host side do their protocol handling as desired. … … 26 26 * which wants to control something on the guest. 27 27 * - Client: A client (e.g. VBoxService) running inside the guest OS waiting for 28 * new host commands to perform. There can be multiple clients connected28 * new host messages to perform. There can be multiple clients connected 29 29 * to this service. A client is represented by its unique HGCM client ID. 30 30 * - Context ID: An (almost) unique ID automatically generated on the host (Main API) … … 33 33 * an indicator which it can refer to later. This context ID gets 34 34 * internally bound by the service to a client which actually processes 35 * the commandin 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 HGCM35 * 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 38 38 * 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 commandthen will be immediately40 * removed from the command list. If there are ready clients but no new commands to be39 * 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 41 41 * processed, these clients will be set into a deferred state (that is being blocked 42 * to return until a new commandis available).42 * to return until a new host message is available). 43 43 * 44 44 * If a client needs to inform the host that something happened, it can send a … … 104 104 105 105 /** 106 * Structure for holding a buffered host commandwhich has106 * Structure for holding a buffered host message which has 107 107 * not been processed yet. 108 108 * 109 109 * @todo r=bird: It would be nice if we could decide on _one_ term for what the 110 110 * 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 */ 113 typedef struct HostMsg 114 { 115 /** Entry on the ClientState::m_HostMsgList list. */ 121 116 RTLISTNODE m_ListEntry; 122 117 union … … 125 120 * See VBOX_GUESTCTRL_DST_XXX. */ 126 121 uint64_t m_idContextAndDst; 127 /** The context ID this commandbelongs to (extracted from the first parameter). */122 /** The context ID this message belongs to (extracted from the first parameter). */ 128 123 uint32_t m_idContext; 129 124 }; 130 125 /** Dynamic structure for holding the HGCM parms */ 131 uint32_t m MsgType;126 uint32_t mType; 132 127 /** Number of HGCM parameters. */ 133 128 uint32_t mParmCount; … … 137 132 bool m_f60BetaHackInPlay; 138 133 139 Host Command()134 HostMsg() 140 135 : m_idContextAndDst(0) 141 , m MsgType(UINT32_MAX)136 , mType(UINT32_MAX) 142 137 , mParmCount(0) 143 138 , mpParms(NULL) … … 148 143 149 144 /** 150 * Releases the host command, properly deleting it if no further references.145 * Releases the host message, properly deleting it if no further references. 151 146 */ 152 147 void Delete(void) 153 148 { 154 LogFlowThisFunc(("[ Cmd %RU32 (%s)] destroying\n", mMsgType, GstCtrlHostFnName((eHostFn)mMsgType)));149 LogFlowThisFunc(("[Msg %RU32 (%s)] destroying\n", mType, GstCtrlHostMsgtoStr((eHostMsg)mType))); 155 150 Assert(m_ListEntry.pNext == NULL); 156 151 if (mpParms) … … 171 166 172 167 /** 173 * Initializes the command.168 * Initializes the message. 174 169 * 175 170 * The specified parameters are copied and any buffers referenced by it … … 177 172 * 178 173 * @returns VBox status code. 179 * @param id Function The host function (message) number, eHostFn.174 * @param idMsg The host message number, eHostMsg. 180 175 * @param cParms Number of parameters in the HGCM request. 181 176 * @param paParms Array of parameters. 182 177 */ 183 int Init(uint32_t id Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])184 { 185 LogFlowThisFunc(("[ Cmd%RU32 (%s)] Allocating cParms=%RU32, paParms=%p\n",186 id Function, 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)); 187 182 Assert(mpParms == NULL); 188 183 Assert(mParmCount == 0); … … 197 192 198 193 /* 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. 200 195 */ 201 196 if (paParms[0].type == VBOX_HGCM_SVC_PARM_64BIT) … … 206 201 else if (paParms[0].type == VBOX_HGCM_SVC_PARM_32BIT) 207 202 { 208 AssertMsgFailed(("id Function=%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))); 209 204 m_idContextAndDst = paParms[0].u.uint32 | VBOX_GUESTCTRL_DST_BOTH; 210 205 } … … 215 210 * Just make a copy of the parameters and any buffers. 216 211 */ 217 m MsgType = idFunction;212 mType = idMsg; 218 213 mParmCount = cParms; 219 214 mpParms = (VBOXHGCMSVCPARM *)RTMemAllocZ(sizeof(VBOXHGCMSVCPARM) * mParmCount); … … 244 239 245 240 default: 246 AssertMsgFailedReturn(("id Function=%u (%s) parameter #%u: type=%u\n",247 id Function, 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), 248 243 VERR_WRONG_PARAMETER_TYPE); 249 244 } … … 271 266 Assert(cDstParms >= 2); 272 267 if (paDstParms[0].type == VBOX_HGCM_SVC_PARM_32BIT) 273 paDstParms[0].u.uint32 = m MsgType;268 paDstParms[0].u.uint32 = mType; 274 269 else 275 paDstParms[0].u.uint64 = m MsgType;270 paDstParms[0].u.uint64 = mType; 276 271 paDstParms[1].u.uint32 = mParmCount; 277 272 … … 301 296 int CopyTo(VBOXHGCMSVCPARM paDstParms[], uint32_t cDstParms) const 302 297 { 303 LogFlowThisFunc(("[ Cmd%RU32] mParmCount=%RU32, m_idContext=%RU32 (Session %RU32)\n",304 m MsgType, 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))); 305 300 306 301 int rc = VINF_SUCCESS; … … 386 381 int rc; 387 382 388 LogFlowThisFunc(("[ Cmd %RU32] mParmCount=%RU32, mpParms=%p\n", mMsgType, mParmCount, mpParms));389 390 /* Does the current host commandneed more parameter space which383 LogFlowThisFunc(("[Msg %RU32] mParmCount=%RU32, mpParms=%p\n", mType, mParmCount, mpParms)); 384 385 /* Does the current host message need more parameter space which 391 386 * the client does not provide yet? */ 392 387 if (mParmCount > pReq->mNumParms) 393 388 { 394 LogFlowThisFunc(("[ Cmd%RU32] Requires %RU32 parms, only got %RU32 from client\n",395 m MsgType, mParmCount, pReq->mNumParms));389 LogFlowThisFunc(("[Msg %RU32] Requires %RU32 parms, only got %RU32 from client\n", 390 mType, mParmCount, pReq->mNumParms)); 396 391 /* 397 392 * So this call apparently failed because the guest wanted to peek 398 393 * 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! 400 395 */ 401 396 rc = VERR_TOO_MUCH_DATA; … … 424 419 AssertPtrReturn(pReq, VERR_INVALID_POINTER); 425 420 426 LogFlowThisFunc(("[ Cmd %RU32] mParmCount=%RU32, mpParms=%p\n", mMsgType, mParmCount, mpParms));421 LogFlowThisFunc(("[Msg %RU32] mParmCount=%RU32, mpParms=%p\n", mType, mParmCount, mpParms)); 427 422 428 423 if (pReq->mNumParms >= 2) 429 424 { 430 HGCMSvcSetU32(&pReq->mParms[0], m MsgType); /* Message ID */425 HGCMSvcSetU32(&pReq->mParms[0], mType); /* Message ID */ 431 426 HGCMSvcSetU32(&pReq->mParms[1], mParmCount); /* Required parameters for message */ 432 427 } … … 438 433 * Always return VERR_TOO_MUCH_DATA data here to 439 434 * keep it compatible with older clients and to 440 * have correct accounting (mHostRc + mHost CmdTries).435 * have correct accounting (mHostRc + mHostMsgTries). 441 436 */ 442 437 return VERR_TOO_MUCH_DATA; … … 444 439 445 440 /** @} */ 446 } Host Command;441 } HostMsg; 447 442 448 443 /** 449 444 * Per-client structure used for book keeping/state tracking a 450 * certain host command.445 * certain host message. 451 446 */ 452 447 typedef struct ClientContext 453 448 { 454 /* Pointer to list node of this command. */455 Host Command *mpHostCmd;449 /* Pointer to list node of this message. */ 450 HostMsg *mpHostMsg; 456 451 /** The standard constructor. */ 457 ClientContext(void) : mpHost Cmd(NULL) {}452 ClientContext(void) : mpHostMsg(NULL) {} 458 453 /** Internal constrcutor. */ 459 ClientContext(Host Command *pHostCmd) : mpHostCmd(pHostCmd) {}454 ClientContext(HostMsg *pHostMsg) : mpHostMsg(pHostMsg) {} 460 455 } ClientContext; 461 456 typedef std::map< uint32_t, ClientContext > ClientContextMap; … … 467 462 { 468 463 PVBOXHGCMSVCHELPERS m_pSvcHelpers; 469 /** Host command list to process (HostCommand). */470 RTLISTANCHOR m_Host CmdList;464 /** Host message list to process (HostMsg). */ 465 RTLISTANCHOR m_HostMsgList; 471 466 /** The HGCM client ID. */ 472 467 uint32_t m_idClient; … … 482 477 /** Pending client call (GUEST_MSG_PEEK_WAIT or GUEST_MSG_WAIT), zero if none pending. 483 478 * 484 * This means the client waits for a new host commandto reply and won't return485 * from the waiting call until a new host commandis available. */486 guestControl::eGuest Fn 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; 487 482 /** Pending peek/wait request details. */ 488 483 ClientRequest m_PendingReq; … … 496 491 , m_fRestored(false) 497 492 , m_fPendingCancel(false) 498 , m_enm IsPending((guestControl::eGuestFn)0)499 , mHost CmdRc(VINF_SUCCESS)500 , mHost CmdTries(0)493 , m_enmPendingMsg((guestControl::eGuestMsg)0) 494 , mHostMsgRc(VINF_SUCCESS) 495 , mHostMsgTries(0) 501 496 , mPeekCount(0) 502 497 { 503 RTListInit(&m_Host CmdList);498 RTListInit(&m_HostMsgList); 504 499 } 505 500 … … 511 506 , m_fRestored(false) 512 507 , m_fPendingCancel(false) 513 , m_enm IsPending((guestControl::eGuestFn)0)514 , mHost CmdRc(VINF_SUCCESS)515 , mHost CmdTries(0)508 , m_enmPendingMsg((guestControl::eGuestMsg)0) 509 , mHostMsgRc(VINF_SUCCESS) 510 , mHostMsgTries(0) 516 511 , mPeekCount(0) 517 512 { 518 RTListInit(&m_Host CmdList);513 RTListInit(&m_HostMsgList); 519 514 } 520 515 521 516 /** 522 * Used by for Service::hostProcess Command().523 */ 524 void Enqueue Command(HostCommand *pHostCmd)525 { 526 AssertPtr(pHost Cmd);527 RTListAppend(&m_Host CmdList, &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); 528 523 } 529 524 530 525 /** 531 * Used by for Service::hostProcess Command().526 * Used by for Service::hostProcessMessage(). 532 527 * 533 528 * @note This wakes up both GUEST_MSG_WAIT and GUEST_MSG_PEEK_WAIT sleepers. … … 537 532 int rc = VINF_NO_CHANGE; 538 533 539 if (m_enm IsPending != 0)534 if (m_enmPendingMsg != 0) 540 535 { 541 536 LogFlowFunc(("[Client %RU32] Waking up ...\n", m_idClient)); … … 543 538 rc = VINF_SUCCESS; 544 539 545 Host Command *pFirstCmd = RTListGetFirstCpp(&m_HostCmdList, HostCommand, m_ListEntry);546 if (pFirst Cmd)540 HostMsg *pFirstMsg = RTListGetFirstCpp(&m_HostMsgList, HostMsg, m_ListEntry); 541 if (pFirstMsg) 547 542 { 548 LogFlowThisFunc(("[Client %RU32] Current host commandis %RU32 (CID=%#RX32, cParms=%RU32)\n",549 m_idClient, pFirst Cmd->mMsgType, pFirstCmd->m_idContext, pFirstCmd->mParmCount));550 551 if (m_enm IsPending == 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) 552 547 { 553 pFirst Cmd->setPeekReturn(m_PendingReq.mParms, m_PendingReq.mNumParms);548 pFirstMsg->setPeekReturn(m_PendingReq.mParms, m_PendingReq.mNumParms); 554 549 rc = m_pSvcHelpers->pfnCallComplete(m_PendingReq.mHandle, VINF_SUCCESS); 555 550 … … 557 552 m_PendingReq.mParms = NULL; 558 553 m_PendingReq.mNumParms = 0; 559 m_enm IsPending = (guestControl::eGuestFn)0;554 m_enmPendingMsg = (guestControl::eGuestMsg)0; 560 555 } 561 else if (m_enm IsPending == GUEST_MSG_WAIT)562 rc = OldRun(&m_PendingReq, pFirst Cmd);556 else if (m_enmPendingMsg == GUEST_MSG_WAIT) 557 rc = OldRun(&m_PendingReq, pFirstMsg); 563 558 else 564 AssertMsgFailed(("m_enmIsPending=%d\n", m_enm IsPending));559 AssertMsgFailed(("m_enmIsPending=%d\n", m_enmPendingMsg)); 565 560 } 566 561 else 567 AssertMsgFailed(("Waking up client ID=%RU32 with no host commandin 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)); 568 563 569 564 return rc; … … 581 576 { 582 577 LogFlowFunc(("[Client %RU32] Cancelling waiting thread, isPending=%d, pendingNumParms=%RU32, m_idSession=%x\n", 583 m_idClient, m_enm IsPending, m_PendingReq.mNumParms, m_idSession));578 m_idClient, m_enmPendingMsg, m_PendingReq.mNumParms, m_idSession)); 584 579 585 580 /* … … 587 582 */ 588 583 int rcComplete; 589 if (m_enm IsPending == 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); 592 587 rcComplete = VINF_TRY_AGAIN; 593 588 } … … 597 592 * aren't two parameters, fail the call. 598 593 */ 599 else if (m_enm IsPending != 0)600 { 601 Assert(m_enm IsPending == GUEST_MSG_WAIT);594 else if (m_enmPendingMsg != 0) 595 { 596 Assert(m_enmPendingMsg == GUEST_MSG_WAIT); 602 597 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); 604 599 if (m_PendingReq.mNumParms > 1) 605 600 HGCMSvcSetU32(&m_PendingReq.mParms[1], 0); … … 620 615 m_PendingReq.mParms = NULL; 621 616 m_PendingReq.mNumParms = 0; 622 m_enm IsPending = (guestControl::eGuestFn)0;617 m_enmPendingMsg = (guestControl::eGuestMsg)0; 623 618 m_fPendingCancel = false; 624 619 return VINF_SUCCESS; … … 633 628 */ 634 629 635 /** Last (most recent) rc after handling the host command. */636 int mHost CmdRc;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. 638 633 * 639 634 * This is used as a heuristic to remove a message that the client appears not 640 635 * to be able to successfully retrieve. */ 641 uint32_t mHost CmdTries;636 uint32_t mHostMsgTries; 642 637 /** Number of times we've peeked at a pending message. 643 638 * 644 639 * 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 fit640 * there are messages which only have two (2) parameters and therefore would fit 646 641 * into the GUEST_MSG_WAIT reply immediately, we now can make sure that the 647 642 * client first gets back the GUEST_MSG_WAIT results first. … … 650 645 651 646 /** 652 * Ditches the first host commandand crazy GUEST_MSG_WAIT state.647 * Ditches the first host message and crazy GUEST_MSG_WAIT state. 653 648 * 654 649 * @note Only used by GUEST_MSG_WAIT scenarios. 655 650 */ 656 void OldDitchFirstHost Cmd()657 { 658 Host Command *pFirstCmd = RTListGetFirstCpp(&m_HostCmdList, HostCommand, m_ListEntry);659 Assert(pFirst Cmd);660 RTListNodeRemove(&pFirst Cmd->m_ListEntry);661 pFirst Cmd->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(); 662 657 663 658 /* Reset state else. */ 664 mHost CmdRc = VINF_SUCCESS;665 mHost CmdTries = 0;659 mHostMsgRc = VINF_SUCCESS; 660 mHostMsgTries = 0; 666 661 mPeekCount = 0; 667 662 } … … 672 667 * @note Only used by GUEST_MSG_WAIT scenarios. 673 668 */ 674 int OldRun(ClientRequest const *pReq, Host Command *pHostCmd)669 int OldRun(ClientRequest const *pReq, HostMsg *pHostMsg) 675 670 { 676 671 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)); 686 682 687 683 bool fRemove = false; 688 684 if (RT_FAILURE(rc)) 689 685 { 690 mHost CmdTries++;686 mHostMsgTries++; 691 687 692 688 /* … … 695 691 * 696 692 * Note: Due to legacy reasons this the retry counter has to be even because on 697 * every peek there will be the actual commandretrieval from the client side.698 * To not get the actual commandif the client actually only wants to peek for699 * 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. 700 696 */ 701 697 /** @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). Then698 * (and every time) returning the next upcoming host message (if any, blocking). Then 703 699 * it's up to the client what to do next, either peeking again or getting the actual 704 * host commandvia an own GUEST_ type message.700 * host message via an own GUEST_ type message. 705 701 */ 706 702 if ( rc == VERR_TOO_MUCH_DATA 707 703 || rc == VERR_CANCELLED) 708 704 { 709 if (mHost CmdTries == 6)705 if (mHostMsgTries == 6) 710 706 fRemove = true; 711 707 } 712 708 /* Client did not understand the message or something else weird happened. Try again one 713 709 * more time and drop it if it didn't get handled then. */ 714 else if (mHost CmdTries > 1)710 else if (mHostMsgTries > 1) 715 711 fRemove = true; 716 712 } … … 718 714 fRemove = true; /* Everything went fine, remove it. */ 719 715 720 LogFlowThisFunc(("[Client %RU32] Tried command%RU32 for %RU32 times, (last result=%Rrc, fRemove=%RTbool)\n",721 m_idClient, pHost Cmd->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)); 722 718 723 719 if (fRemove) 724 720 { 725 Assert(RTListNodeIsFirst(&m_Host CmdList, &pHostCmd->m_ListEntry));726 OldDitchFirstHost Cmd();721 Assert(RTListNodeIsFirst(&m_HostMsgList, &pHostMsg->m_ListEntry)); 722 OldDitchFirstHostMsg(); 727 723 } 728 724 … … 739 735 740 736 /* 741 * If the host commandlist 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. 742 738 */ 743 Host Command *pFirstCmd = RTListGetFirstCpp(&m_HostCmdList, HostCommand, m_ListEntry);744 if (!pFirst Cmd)739 HostMsg *pFirstMsg = RTListGetFirstCpp(&m_HostMsgList, HostMsg, m_ListEntry); 740 if (!pFirstMsg) 745 741 { 746 742 if (!m_fPendingCancel) 747 743 { 748 744 /* Go to sleep. */ 749 ASSERT_GUEST_RETURN(m_enm IsPending == 0, VERR_WRONG_ORDER);745 ASSERT_GUEST_RETURN(m_enmPendingMsg == 0, VERR_WRONG_ORDER); 750 746 m_PendingReq = *pReq; 751 m_enm IsPending = GUEST_MSG_WAIT;747 m_enmPendingMsg = GUEST_MSG_WAIT; 752 748 LogFlowFunc(("[Client %RU32] Is now in pending mode\n", m_idClient)); 753 749 return VINF_HGCM_ASYNC_EXECUTE; … … 757 753 m_fPendingCancel = false; 758 754 if (pReq->mNumParms > 0) 759 HGCMSvcSetU32(&pReq->mParms[0], HOST_ CANCEL_PENDING_WAITS);755 HGCMSvcSetU32(&pReq->mParms[0], HOST_MSG_CANCEL_PENDING_WAITS); 760 756 if (pReq->mNumParms > 1) 761 757 HGCMSvcSetU32(&pReq->mParms[1], 0); … … 764 760 765 761 /* 766 * Return first host command.762 * Return first host message. 767 763 */ 768 return OldRun(pReq, pFirst Cmd);764 return OldRun(pReq, pFirstMsg); 769 765 } 770 766 … … 774 770 */ 775 771 int OldSendReply(ClientRequest const *pReq, 776 Host Command *pHostCmd)772 HostMsg *pHostMsg) 777 773 { 778 774 AssertPtrReturn(pReq, VERR_INVALID_POINTER); 779 AssertPtrReturn(pHost Cmd, VERR_INVALID_POINTER);775 AssertPtrReturn(pHostMsg, VERR_INVALID_POINTER); 780 776 781 777 /* In case of VERR_CANCELLED. */ … … 785 781 /* If the client is in pending mode, always send back 786 782 * the peek result first. */ 787 if (m_enm IsPending)788 { 789 Assert(m_enm IsPending == GUEST_MSG_WAIT);790 rc = pHost Cmd->Peek(pReq);783 if (m_enmPendingMsg) 784 { 785 Assert(m_enmPendingMsg == GUEST_MSG_WAIT); 786 rc = pHostMsg->Peek(pReq); 791 787 mPeekCount++; 792 788 } … … 794 790 { 795 791 /* 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 commandwould fit into the current792 * instead of the actual message, even if this message would fit into the current 797 793 * connection buffer. */ 798 794 if (!mPeekCount) 799 795 { 800 rc = pHost Cmd->Peek(pReq);796 rc = pHostMsg->Peek(pReq); 801 797 mPeekCount++; 802 798 } 803 799 else 804 800 { 805 /* Try assigning the host commandto the client and store the801 /* Try assigning the host message to the client and store the 806 802 * result code for later use. */ 807 rc = pHost Cmd->Assign(pReq);803 rc = pHostMsg->Assign(pReq); 808 804 if (RT_FAILURE(rc)) /* If something failed, let the client peek (again). */ 809 805 { 810 rc = pHost Cmd->Peek(pReq);806 rc = pHostMsg->Peek(pReq); 811 807 mPeekCount++; 812 808 } … … 817 813 818 814 /* Reset pending status. */ 819 m_enm IsPending = (guestControl::eGuestFn)0;815 m_enmPendingMsg = (guestControl::eGuestMsg)0; 820 816 821 817 /* In any case the client did something, so complete … … 831 827 } 832 828 833 LogFlowThisFunc(("[Client %RU32] Command%RU32 ended with %Rrc (mPeekCount=%RU32, pReq=%p)\n",834 m_idClient, pHost Cmd->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)); 835 831 return rc; 836 832 } … … 867 863 typedef GstCtrlService SELF; 868 864 /** HGCM helper functions. */ 869 PVBOXHGCMSVCHELPERS mpHelpers;865 PVBOXHGCMSVCHELPERS mpHelpers; 870 866 /** Callback function supplied by the host for notification of updates to properties. */ 871 PFNHGCMSVCEXT mpfnHostCallback;867 PFNHGCMSVCEXT mpfnHostCallback; 872 868 /** User data pointer to be supplied to the host callback function. */ 873 void *mpvHostData;869 void *mpvHostData; 874 870 /** Map containing all connected clients, key is HGCM client ID. */ 875 ClientStateMap m_ClientStateMap;871 ClientStateMap m_ClientStateMap; 876 872 /** Session ID -> client state. */ 877 ClientStateMap m_SessionIdMap;873 ClientStateMap m_SessionIdMap; 878 874 /** The current master client, NULL if none. */ 879 ClientState *m_pMasterClient;875 ClientState *m_pMasterClient; 880 876 /** The master HGCM client ID, UINT32_MAX if none. */ 881 uint32_t m_idMasterClient;877 uint32_t m_idMasterClient; 882 878 /** Set if we're in legacy mode (pre 6.0). */ 883 bool m_fLegacyMode;879 bool m_fLegacyMode; 884 880 /** Number of prepared sessions. */ 885 uint32_t m_cPreparedSessions;881 uint32_t m_cPreparedSessions; 886 882 /** List of prepared session (GstCtrlPreparedSession). */ 887 RTLISTANCHOR m_PreparedSessions;883 RTLISTANCHOR m_PreparedSessions; 888 884 889 885 public: … … 921 917 int clientSessionAccept(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 922 918 int clientSessionCloseOther(ClientState *pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 923 int clientToMain(ClientState *pClient, uint32_t id Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);919 int clientToMain(ClientState *pClient, uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 924 920 925 921 int clientMsgOldGet(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); … … 927 923 int clientMsgOldSkip(ClientState *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms); 928 924 929 int hostCallback(uint32_t id Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);930 int hostProcess Command(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[]); 931 927 932 928 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(GstCtrlService); … … 1025 1021 1026 1022 /* 1027 * Cancel all pending host commands, replying with GUEST_DISCONNECTED if final recipient.1028 */ 1029 Host Command *pCurCmd, *pNextCmd;1030 RTListForEachSafeCpp(&pClient->m_Host CmdList, pCurCmd, pNextCmd, HostCommand, m_ListEntry)1031 { 1032 RTListNodeRemove(&pCur Cmd->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); 1033 1029 1034 1030 VBOXHGCMSVCPARM Parm; 1035 HGCMSvcSetU32(&Parm, pCur Cmd->m_idContext);1036 int rc2 = pThis->hostCallback(GUEST_ DISCONNECTED, 1, &Parm);1037 LogFlowFunc(("Cancelled host command%u (%s) with idContext=%#x -> %Rrc\n",1038 pCur Cmd->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)); 1039 1035 RT_NOREF(rc2); 1040 1036 1041 pCur Cmd->Delete();1037 pCurMsg->Delete(); 1042 1038 } 1043 1039 … … 1079 1075 * A client asks for the next message to process. 1080 1076 * 1081 * This either fills in a pending host commandinto the client's parameter space1077 * This either fills in a pending host message into the client's parameter space 1082 1078 * or defers the guest call until we have something from the host. 1083 1079 * … … 1206 1202 1207 1203 /* 1208 * Return information about the first commandif one is pending in the list.1209 */ 1210 Host Command *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);1211 if (pFirst Cmd)1212 { 1213 pFirst Cmd->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); 1214 1210 LogFlowFunc(("[Client %RU32] GUEST_MSG_PEEK_XXXX -> VINF_SUCCESS (idMsg=%u (%s), cParms=%u)\n", 1215 pClient->m_idClient, pFirst Cmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount));1211 pClient->m_idClient, pFirstMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pFirstMsg->mType), pFirstMsg->mParmCount)); 1216 1212 return VINF_SUCCESS; 1217 1213 } … … 1229 1225 * Wait for the host to queue a message for this client. 1230 1226 */ 1231 ASSERT_GUEST_MSG_RETURN(pClient->m_enm IsPending == 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), 1232 1228 VERR_RESOURCE_BUSY); 1233 1229 pClient->m_PendingReq.mHandle = hCall; 1234 1230 pClient->m_PendingReq.mNumParms = cParms; 1235 1231 pClient->m_PendingReq.mParms = paParms; 1236 pClient->m_enm IsPending = GUEST_MSG_PEEK_WAIT;1232 pClient->m_enmPendingMsg = GUEST_MSG_PEEK_WAIT; 1237 1233 LogFlowFunc(("[Client %RU32] Is now in pending mode...\n", pClient->m_idClient)); 1238 1234 return VINF_HGCM_ASYNC_EXECUTE; … … 1270 1266 1271 1267 /* 1272 * Return information about the first commandif one is pending in the list.1273 */ 1274 Host Command *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);1275 if (pFirst Cmd)1276 { 1277 1278 ASSERT_GUEST_MSG_RETURN(pFirst Cmd->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, 1279 1275 ("idMsg=%u (%s) cParms=%u, caller expected %u (%s) and %u\n", 1280 pFirst Cmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount,1281 idMsgExpected, GstCtrlHost FnName((eHostFn)idMsgExpected), cParms),1276 pFirstMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pFirstMsg->mType), pFirstMsg->mParmCount, 1277 idMsgExpected, GstCtrlHostMsgtoStr((eHostMsg)idMsgExpected), cParms), 1282 1278 VERR_MISMATCH); 1283 ASSERT_GUEST_MSG_RETURN(pFirst Cmd->mParmCount == cParms,1279 ASSERT_GUEST_MSG_RETURN(pFirstMsg->mParmCount == cParms, 1284 1280 ("idMsg=%u (%s) cParms=%u, caller expected %u (%s) and %u\n", 1285 pFirst Cmd->mMsgType, GstCtrlHostFnName((eHostFn)pFirstCmd->mMsgType), pFirstCmd->mParmCount,1286 idMsgExpected, GstCtrlHost FnName((eHostFn)idMsgExpected), cParms),1281 pFirstMsg->mType, GstCtrlHostMsgtoStr((eHostMsg)pFirstMsg->mType), pFirstMsg->mParmCount, 1282 idMsgExpected, GstCtrlHostMsgtoStr((eHostMsg)idMsgExpected), cParms), 1287 1283 VERR_WRONG_PARAMETER_COUNT); 1288 1284 1289 1285 /* Check the parameter types. */ 1290 1286 for (uint32_t i = 0; i < cParms; i++) 1291 ASSERT_GUEST_MSG_RETURN(pFirst Cmd->mpParms[i].type == paParms[i].type,1292 ("param #%u: type %u, caller expected %u (idMsg=%u %s)\n", i, pFirst Cmd->mpParms[i].type,1293 paParms[i].type, pFirst Cmd->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)), 1294 1290 VERR_WRONG_PARAMETER_TYPE); 1295 1291 … … 1302 1298 int rc = VINF_SUCCESS; 1303 1299 for (uint32_t i = 0; i < cParms; i++) 1304 switch (pFirst Cmd->mpParms[i].type)1300 switch (pFirstMsg->mpParms[i].type) 1305 1301 { 1306 1302 case VBOX_HGCM_SVC_PARM_32BIT: 1307 paParms[i].u.uint32 = pFirst Cmd->mpParms[i].u.uint32;1303 paParms[i].u.uint32 = pFirstMsg->mpParms[i].u.uint32; 1308 1304 break; 1309 1305 1310 1306 case VBOX_HGCM_SVC_PARM_64BIT: 1311 paParms[i].u.uint64 = pFirst Cmd->mpParms[i].u.uint64;1307 paParms[i].u.uint64 = pFirstMsg->mpParms[i].u.uint64; 1312 1308 break; 1313 1309 1314 1310 case VBOX_HGCM_SVC_PARM_PTR: 1315 1311 { 1316 uint32_t const cbSrc = pFirst Cmd->mpParms[i].u.pointer.size;1312 uint32_t const cbSrc = pFirstMsg->mpParms[i].u.pointer.size; 1317 1313 uint32_t const cbDst = paParms[i].u.pointer.size; 1318 1314 paParms[i].u.pointer.size = cbSrc; /** @todo Check if this is safe in other layers... 1319 1315 * Update: Safe, yes, but VMMDevHGCM doesn't pass it along. */ 1320 1316 if (cbSrc <= cbDst) 1321 memcpy(paParms[i].u.pointer.addr, pFirst Cmd->mpParms[i].u.pointer.addr, cbSrc);1317 memcpy(paParms[i].u.pointer.addr, pFirstMsg->mpParms[i].u.pointer.addr, cbSrc); 1322 1318 else 1323 1319 rc = VERR_BUFFER_OVERFLOW; … … 1326 1322 1327 1323 default: 1328 AssertMsgFailed(("#%u: %u\n", i, pFirst Cmd->mpParms[i].type));1324 AssertMsgFailed(("#%u: %u\n", i, pFirstMsg->mpParms[i].type)); 1329 1325 rc = VERR_INTERNAL_ERROR; 1330 1326 break; … … 1333 1329 { 1334 1330 /* 1335 * Complete the commandand remove the pending message unless the1331 * Complete the message and remove the pending message unless the 1336 1332 * guest raced us and cancelled this call in the meantime. 1337 1333 */ … … 1340 1336 if (rc != VERR_CANCELLED) 1341 1337 { 1342 RTListNodeRemove(&pFirst Cmd->m_ListEntry);1343 pFirst Cmd->Delete();1338 RTListNodeRemove(&pFirstMsg->m_ListEntry); 1339 pFirstMsg->Delete(); 1344 1340 } 1345 1341 else … … 1377 1373 * Execute. 1378 1374 */ 1379 if (pClient->m_enm IsPending != 0)1375 if (pClient->m_enmPendingMsg != 0) 1380 1376 { 1381 1377 pClient->CancelWaiting(); … … 1422 1418 * Do the job. 1423 1419 */ 1424 Host Command *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);1425 if (pFirst Cmd)1426 { 1427 if ( pFirst Cmd->mMsgType == idMsg1420 HostMsg *pFirstMsg = RTListGetFirstCpp(&pClient->m_HostMsgList, HostMsg, m_ListEntry); 1421 if (pFirstMsg) 1422 { 1423 if ( pFirstMsg->mType == idMsg 1428 1424 || idMsg == UINT32_MAX) 1429 1425 { … … 1432 1428 { 1433 1429 /* 1434 * Remove the commandfrom the queue.1430 * Remove the message from the queue. 1435 1431 */ 1436 Assert(RTListNodeIsFirst(&pClient->m_Host CmdList, &pFirstCmd->m_ListEntry) );1437 RTListNodeRemove(&pFirst Cmd->m_ListEntry);1432 Assert(RTListNodeIsFirst(&pClient->m_HostMsgList, &pFirstMsg->m_ListEntry) ); 1433 RTListNodeRemove(&pFirstMsg->m_ListEntry); 1438 1434 1439 1435 /* … … 1441 1437 */ 1442 1438 VBOXHGCMSVCPARM aReplyParams[5]; 1443 HGCMSvcSetU32(&aReplyParams[0], pFirst Cmd->m_idContext);1444 switch (pFirst Cmd->mMsgType)1439 HGCMSvcSetU32(&aReplyParams[0], pFirstMsg->m_idContext); 1440 switch (pFirstMsg->mType) 1445 1441 { 1446 case HOST_ EXEC_CMD:1442 case HOST_MSG_EXEC_CMD: 1447 1443 HGCMSvcSetU32(&aReplyParams[1], 0); /* pid */ 1448 1444 HGCMSvcSetU32(&aReplyParams[2], PROC_STS_ERROR); /* status */ 1449 1445 HGCMSvcSetU32(&aReplyParams[3], rcSkip); /* flags / whatever */ 1450 1446 HGCMSvcSetPv(&aReplyParams[4], NULL, 0); /* data buffer */ 1451 hostCallback(GUEST_ EXEC_STATUS, 5, aReplyParams);1447 hostCallback(GUEST_MSG_EXEC_STATUS, 5, aReplyParams); 1452 1448 break; 1453 1449 1454 case HOST_ SESSION_CREATE:1450 case HOST_MSG_SESSION_CREATE: 1455 1451 HGCMSvcSetU32(&aReplyParams[1], GUEST_SESSION_NOTIFYTYPE_ERROR); /* type */ 1456 1452 HGCMSvcSetU32(&aReplyParams[2], rcSkip); /* result */ 1457 hostCallback(GUEST_ SESSION_NOTIFY, 3, aReplyParams);1453 hostCallback(GUEST_MSG_SESSION_NOTIFY, 3, aReplyParams); 1458 1454 break; 1459 1455 1460 case HOST_ EXEC_SET_INPUT:1461 HGCMSvcSetU32(&aReplyParams[1], pFirst Cmd->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); 1462 1458 HGCMSvcSetU32(&aReplyParams[2], INPUT_STS_ERROR); /* status */ 1463 1459 HGCMSvcSetU32(&aReplyParams[3], rcSkip); /* flags / whatever */ 1464 1460 HGCMSvcSetU32(&aReplyParams[4], 0); /* bytes consumed */ 1465 hostCallback(GUEST_ EXEC_INPUT_STATUS, 5, aReplyParams);1461 hostCallback(GUEST_MSG_EXEC_INPUT_STATUS, 5, aReplyParams); 1466 1462 break; 1467 1463 1468 case HOST_ FILE_OPEN:1464 case HOST_MSG_FILE_OPEN: 1469 1465 HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_OPEN); /* type*/ 1470 1466 HGCMSvcSetU32(&aReplyParams[2], rcSkip); /* rc */ 1471 HGCMSvcSetU32(&aReplyParams[3], VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pFirst Cmd->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); 1473 1469 break; 1474 case HOST_ FILE_CLOSE:1470 case HOST_MSG_FILE_CLOSE: 1475 1471 HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_ERROR); /* type*/ 1476 1472 HGCMSvcSetU32(&aReplyParams[2], rcSkip); /* rc */ 1477 hostCallback(GUEST_ FILE_NOTIFY, 3, aReplyParams);1473 hostCallback(GUEST_MSG_FILE_NOTIFY, 3, aReplyParams); 1478 1474 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: 1481 1477 HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_READ); /* type */ 1482 1478 HGCMSvcSetU32(&aReplyParams[2], rcSkip); /* rc */ 1483 1479 HGCMSvcSetPv(&aReplyParams[3], NULL, 0); /* data buffer */ 1484 hostCallback(GUEST_ FILE_NOTIFY, 4, aReplyParams);1480 hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams); 1485 1481 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: 1488 1484 HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_WRITE); /* type */ 1489 1485 HGCMSvcSetU32(&aReplyParams[2], rcSkip); /* rc */ 1490 1486 HGCMSvcSetU32(&aReplyParams[3], 0); /* bytes written */ 1491 hostCallback(GUEST_ FILE_NOTIFY, 4, aReplyParams);1487 hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams); 1492 1488 break; 1493 case HOST_ FILE_SEEK:1489 case HOST_MSG_FILE_SEEK: 1494 1490 HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_SEEK); /* type */ 1495 1491 HGCMSvcSetU32(&aReplyParams[2], rcSkip); /* rc */ 1496 1492 HGCMSvcSetU64(&aReplyParams[3], 0); /* actual */ 1497 hostCallback(GUEST_ FILE_NOTIFY, 4, aReplyParams);1493 hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams); 1498 1494 break; 1499 case HOST_ FILE_TELL:1495 case HOST_MSG_FILE_TELL: 1500 1496 HGCMSvcSetU32(&aReplyParams[1], GUEST_FILE_NOTIFYTYPE_TELL); /* type */ 1501 1497 HGCMSvcSetU32(&aReplyParams[2], rcSkip); /* rc */ 1502 1498 HGCMSvcSetU64(&aReplyParams[3], 0); /* actual */ 1503 hostCallback(GUEST_ FILE_NOTIFY, 4, aReplyParams);1499 hostCallback(GUEST_MSG_FILE_NOTIFY, 4, aReplyParams); 1504 1500 break; 1505 1501 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: 1513 1509 default: 1514 HGCMSvcSetU32(&aReplyParams[1], pFirst Cmd->mMsgType);1510 HGCMSvcSetU32(&aReplyParams[1], pFirstMsg->mType); 1515 1511 HGCMSvcSetU32(&aReplyParams[2], (uint32_t)rcSkip); 1516 1512 HGCMSvcSetPv(&aReplyParams[3], NULL, 0); … … 1520 1516 1521 1517 /* 1522 * Free the command.1518 * Free the message. 1523 1519 */ 1524 pFirst Cmd->Delete();1520 pFirstMsg->Delete(); 1525 1521 } 1526 1522 else … … 1528 1524 return VINF_HGCM_ASYNC_EXECUTE; /* The caller must not complete it. */ 1529 1525 } 1530 LogFunc(("Warning: GUEST_MSG_SKIP mismatch! Found %u, caller expected %u!\n", pFirst Cmd->mMsgType, idMsg));1526 LogFunc(("Warning: GUEST_MSG_SKIP mismatch! Found %u, caller expected %u!\n", pFirstMsg->mType, idMsg)); 1531 1527 return VERR_MISMATCH; 1532 1528 } … … 1596 1592 1597 1593 /* 1598 * Try complete the command.1594 * Try complete the message. 1599 1595 */ 1600 1596 int rc = mpHelpers->pfnCallComplete(hCall, VINF_SUCCESS); … … 1786 1782 1787 1783 /* 1788 * Forward the commandto the destiation.1784 * Forward the message to the destiation. 1789 1785 * Since we modify the first parameter, we must make a copy of the parameters. 1790 1786 */ … … 1792 1788 HGCMSvcSetU64(&aParms[0], idContext | VBOX_GUESTCTRL_DST_SESSION); 1793 1789 HGCMSvcSetU32(&aParms[1], fFlags); 1794 int rc = hostProcess Command(HOST_SESSION_CLOSE, RT_ELEMENTS(aParms), aParms);1790 int rc = hostProcessMessage(HOST_MSG_SESSION_CLOSE, RT_ELEMENTS(aParms), aParms); 1795 1791 1796 1792 LogFlowFunc(("Closing guest context ID=%RU32 (from client ID=%RU32) returned with rc=%Rrc\n", idContext, pClient->m_idClient, rc)); … … 1871 1867 1872 1868 /** 1873 * For compatibility with old additions only - skip the current commandw/o1869 * For compatibility with old additions only - skip the current message w/o 1874 1870 * calling main code. 1875 1871 * … … 1899 1895 * So, we have to track whether they issued a MSG_REPLY or not. Wonderful. 1900 1896 */ 1901 Host Command *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);1902 if (pFirst Cmd)1903 { 1904 uint32_t const idMsg = pFirst Cmd->mMsgType;1905 bool const f60BetaHackInPlay = pFirst Cmd->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; 1906 1902 int rc; 1907 1903 if (!f60BetaHackInPlay) … … 1909 1905 else 1910 1906 { 1911 RTListNodeRemove(&pFirst Cmd->m_ListEntry);1912 pFirst Cmd->Delete();1907 RTListNodeRemove(&pFirstMsg->m_ListEntry); 1908 pFirstMsg->Delete(); 1913 1909 rc = VINF_SUCCESS; 1914 1910 } … … 1917 1913 if (RT_SUCCESS(rc)) 1918 1914 { 1919 pClient->mHost CmdRc = VINF_SUCCESS;1920 pClient->mHost CmdTries = 0;1915 pClient->mHostMsgRc = VINF_SUCCESS; 1916 pClient->mHostMsgTries = 0; 1921 1917 pClient->mPeekCount = 0; 1922 1918 } 1923 1919 1924 1920 LogFlowFunc(("[Client %RU32] Legacy message skipping: Skipped %u (%s)%s!\n", 1925 pClient->m_idClient, idMsg, GstCtrlHost FnName((eHostFn)idMsg), f60BetaHackInPlay ? " hack style" : ""));1921 pClient->m_idClient, idMsg, GstCtrlHostMsgtoStr((eHostMsg)idMsg), f60BetaHackInPlay ? " hack style" : "")); 1926 1922 NOREF(idMsg); 1927 1923 return rc; … … 1939 1935 * @returns VBox status code. 1940 1936 * @param pClient The client state. 1941 * @param id Function Function (event)that occured.1937 * @param idMsg Message ID that occured. 1942 1938 * @param cParms Number of parameters. 1943 1939 * @param paParms Array of parameters. 1944 1940 */ 1945 int GstCtrlService::clientToMain(ClientState *pClient, uint32_t id Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])1941 int GstCtrlService::clientToMain(ClientState *pClient, uint32_t idMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 1946 1942 { 1947 1943 /* … … 1958 1954 || ( m_fLegacyMode /* (see bugref:9313#c16) */ 1959 1955 && pClient->m_idSession == UINT32_MAX 1960 && ( id Function == GUEST_EXEC_STATUS1961 || id Function == GUEST_SESSION_NOTIFY)),1962 ("idSession=%u (CID=%#x) m_idSession=%u idClient=%u id Function=%u (%s)\n", idSession, idContext,1963 pClient->m_idSession, pClient->m_idClient, id Function, 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)), 1964 1960 VERR_ACCESS_DENIED); 1965 1961 … … 1967 1963 * It seems okay, so make the call. 1968 1964 */ 1969 return hostCallback(id Function, cParms, paParms);1965 return hostCallback(idMsg, cParms, paParms); 1970 1966 } 1971 1967 … … 1981 1977 /*static*/ DECLCALLBACK(void) 1982 1978 GstCtrlService::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)); 1987 1983 RT_NOREF(tsArrival, idClient); 1988 1984 … … 2000 1996 */ 2001 1997 int rc; 2002 switch ( idFunction)2003 { 2004 case GUEST_M AKE_ME_MASTER:1998 switch (u32Function) 1999 { 2000 case GUEST_MSG_MAKE_ME_MASTER: 2005 2001 LogFlowFunc(("[Client %RU32] GUEST_MAKE_ME_MASTER\n", idClient)); 2006 2002 rc = pThis->clientMakeMeMaster(pClient, hCall, cParms); … … 2026 2022 rc = pThis->clientMsgSkip(pClient, hCall, cParms, paParms); 2027 2023 break; 2028 case GUEST_ SESSION_PREPARE:2024 case GUEST_MSG_SESSION_PREPARE: 2029 2025 LogFlowFunc(("[Client %RU32] GUEST_SESSION_PREPARE\n", idClient)); 2030 2026 rc = pThis->clientSessionPrepare(pClient, hCall, cParms, paParms); 2031 2027 break; 2032 case GUEST_ SESSION_CANCEL_PREPARED:2028 case GUEST_MSG_SESSION_CANCEL_PREPARED: 2033 2029 LogFlowFunc(("[Client %RU32] GUEST_SESSION_CANCEL_PREPARED\n", idClient)); 2034 2030 rc = pThis->clientSessionCancelPrepared(pClient, cParms, paParms); 2035 2031 break; 2036 case GUEST_ SESSION_ACCEPT:2032 case GUEST_MSG_SESSION_ACCEPT: 2037 2033 LogFlowFunc(("[Client %RU32] GUEST_SESSION_ACCEPT\n", idClient)); 2038 2034 rc = pThis->clientSessionAccept(pClient, hCall, cParms, paParms); 2039 2035 break; 2040 case GUEST_ SESSION_CLOSE:2036 case GUEST_MSG_SESSION_CLOSE: 2041 2037 LogFlowFunc(("[Client %RU32] GUEST_SESSION_CLOSE\n", idClient)); 2042 2038 rc = pThis->clientSessionCloseOther(pClient, cParms, paParms); … … 2049 2045 if (cParms >= 3 && paParms[2].u.uint32 == (uint32_t)VERR_NOT_SUPPORTED) 2050 2046 { 2051 Host Command *pFirstCmd = RTListGetFirstCpp(&pClient->m_HostCmdList, HostCommand, m_ListEntry);2052 if (pFirst Cmd && pFirstCmd->m_idContext == paParms[0].u.uint32)2053 pFirst Cmd->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; 2054 2050 } 2055 2051 RT_FALL_THROUGH(); 2056 2052 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, GstCtrlGuest FnName((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); 2066 2062 Assert(rc != VINF_HGCM_ASYNC_EXECUTE); 2067 2063 break; 2068 2064 2069 2065 /* 2070 * The remaining commands are here for compatibility with older guest additions:2066 * The remaining messages are here for compatibility with older Guest Additions: 2071 2067 */ 2072 2068 case GUEST_MSG_WAIT: … … 2097 2093 */ 2098 2094 default: 2099 ASSERT_GUEST_MSG_FAILED((" idFunction=%d (%#x)\n", idFunction, idFunction));2095 ASSERT_GUEST_MSG_FAILED(("u32Function=%RU32 (%#x)\n", u32Function, u32Function)); 2100 2096 rc = VERR_INVALID_FUNCTION; 2101 2097 break; … … 2117 2113 * 2118 2114 * @returns VBox status code. 2119 * @param idFunction Function (event)that occured.2115 * @param u32Function Message ID that occured. 2120 2116 * @param cParms Number of parameters. 2121 2117 * @param paParms Array of parameters. 2122 2118 */ 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)); 2119 int 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)); 2126 2123 2127 2124 int rc; … … 2129 2126 { 2130 2127 VBOXGUESTCTRLHOSTCALLBACK data(cParms, paParms); 2131 rc = mpfnHostCallback(mpvHostData, idFunction, &data, sizeof(data));2128 rc = mpfnHostCallback(mpvHostData, u32Function, &data, sizeof(data)); 2132 2129 } 2133 2130 else … … 2140 2137 2141 2138 /** 2142 * Processes a commandreceived from the host side and re-routes it to2139 * Processes a message received from the host side and re-routes it to 2143 2140 * a connect client on the guest. 2144 2141 * 2145 2142 * @returns VBox status code. 2146 * @param id Function Function codeto process.2143 * @param idMsg Message ID to process. 2147 2144 * @param cParms Number of parameters. 2148 2145 * @param paParms Array of parameters. 2149 2146 */ 2150 int GstCtrlService::hostProcess Command(uint32_t idFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[])2151 { 2152 /* 2153 * If no client is connected at all we don't buffer any host commands2147 int 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 2154 2151 * and immediately return an error to the host. This avoids the host 2155 2152 * waiting for a response from the guest side in case VBoxService on … … 2158 2155 if (m_ClientStateMap.empty()) 2159 2156 { 2160 LogFlow(("GstCtrlService::hostProcess Command: VERR_NOT_FOUND!\n"));2157 LogFlow(("GstCtrlService::hostProcessMessage: VERR_NOT_FOUND!\n")); 2161 2158 return VERR_NOT_FOUND; 2162 2159 } 2163 2160 2164 2161 /* 2165 * Create a host commandfor each destination.2162 * Create a host message for each destination. 2166 2163 * Note! There is currently only one scenario in which we send a host 2167 * commandto two recipients.2168 */ 2169 Host Command *pHostCmd = new (std::nothrow) HostCommand();2170 AssertReturn(pHost Cmd, VERR_NO_MEMORY);2171 int rc = pHost Cmd->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); 2172 2169 if (RT_SUCCESS(rc)) 2173 2170 { 2174 uint64_t const fDestinations = pHost Cmd->m_idContextAndDst & VBOX_GUESTCTRL_DST_BOTH;2175 Host Command *pHostCmd2 = NULL;2171 uint64_t const fDestinations = pHostMsg->m_idContextAndDst & VBOX_GUESTCTRL_DST_BOTH; 2172 HostMsg *pHostMsg2 = NULL; 2176 2173 if (fDestinations != VBOX_GUESTCTRL_DST_BOTH) 2177 2174 { /* likely */ } 2178 2175 else 2179 2176 { 2180 pHost Cmd2 = new (std::nothrow) HostCommand();2181 if (pHost Cmd2)2182 rc = pHost Cmd2->Init(idFunction, cParms, paParms);2177 pHostMsg2 = new (std::nothrow) HostMsg(); 2178 if (pHostMsg2) 2179 rc = pHostMsg2->Init(idMsg, cParms, paParms); 2183 2180 else 2184 2181 rc = VERR_NO_MEMORY; … … 2186 2183 if (RT_SUCCESS(rc)) 2187 2184 { 2188 LogFlowFunc(("Handling host command m_idContextAndDst=%#RX64, idFunction=%RU32, cParms=%RU32, paParms=%p, cClients=%zu\n",2189 pHost Cmd->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())); 2190 2187 2191 2188 /* … … 2198 2195 if (fDestinations & VBOX_GUESTCTRL_DST_SESSION) 2199 2196 { 2200 uint32_t const idSession = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHost Cmd->m_idContext);2197 uint32_t const idSession = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostMsg->m_idContext); 2201 2198 ClientStateMap::iterator It = m_SessionIdMap.find(idSession); 2202 2199 if (It != m_SessionIdMap.end()) … … 2204 2201 ClientState *pClient = It->second; 2205 2202 Assert(pClient->m_idSession == idSession); 2206 RTListAppend(&pClient->m_Host CmdList, &pHostCmd->m_ListEntry);2207 pHost Cmd = pHostCmd2;2208 pHost Cmd2 = NULL;2203 RTListAppend(&pClient->m_HostMsgList, &pHostMsg->m_ListEntry); 2204 pHostMsg = pHostMsg2; 2205 pHostMsg2 = NULL; 2209 2206 2210 2207 int rc2 = pClient->Wakeup(); … … 2215 2212 else 2216 2213 { 2217 LogFunc(("No client with session ID %u was found! (id Function=%d %s)\n",2218 idSession, id Function, GstCtrlHostFnName((eHostFn)idFunction)));2214 LogFunc(("No client with session ID %u was found! (idMsg=%d %s)\n", 2215 idSession, idMsg, GstCtrlHostMsgtoStr((eHostMsg)idMsg))); 2219 2216 rc = !(fDestinations & VBOX_GUESTCTRL_DST_ROOT_SVC) ? VERR_NOT_FOUND : VWRN_NOT_FOUND; 2220 2217 } … … 2225 2222 && RT_SUCCESS(rc)) 2226 2223 { 2227 Assert(pHost Cmd);2224 Assert(pHostMsg); 2228 2225 if (m_pMasterClient) 2229 2226 { 2230 RTListAppend(&m_pMasterClient->m_Host CmdList, &pHostCmd->m_ListEntry);2231 pHost Cmd= NULL;2227 RTListAppend(&m_pMasterClient->m_HostMsgList, &pHostMsg->m_ListEntry); 2228 pHostMsg = NULL; 2232 2229 2233 2230 int rc2 = m_pMasterClient->Wakeup(); … … 2240 2237 } 2241 2238 2242 /* Drop unset commands*/2243 if (pHost Cmd2)2244 pHost Cmd2->Delete();2245 } 2246 if (pHost Cmd)2247 pHost Cmd->Delete();2239 /* Drop unset messages. */ 2240 if (pHostMsg2) 2241 pHostMsg2->Delete(); 2242 } 2243 if (pHostMsg) 2244 pHostMsg->Delete(); 2248 2245 2249 2246 if (RT_FAILURE(rc)) 2250 LogFunc(("Failed %Rrc (id Function=%u, cParms=%u)\n", rc, idFunction, cParms));2247 LogFunc(("Failed %Rrc (idMsg=%u, cParms=%u)\n", rc, idMsg, cParms)); 2251 2248 return rc; 2252 2249 } … … 2255 2252 /** 2256 2253 * @interface_method_impl{VBOXHGCMSVCFNTABLE,pfnHostCall, 2257 * Wraps to the hostProcess Command() member function.}2254 * Wraps to the hostProcessMessage() member function.} 2258 2255 */ 2259 2256 /*static*/ DECLCALLBACK(int) … … 2264 2261 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 2265 2262 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->hostProcess Command(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); 2269 2266 } 2270 2267 -
trunk/src/VBox/HostServices/GuestControl/testcase/tstGuestControlSvc.cpp
r76553 r76958 179 179 180 180 /** 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 }, 184 184 185 185 /** 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 }, 190 190 191 191 /** Client connected, unknown command + valid parameters given. */ … … 221 221 HGCMSvcSetStr(&aParmsHost[2], "baz"); 222 222 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]); 224 224 RTTEST_CHECK_RC_RET(g_hTest, rc, VINF_SUCCESS, rc); 225 225
Note:
See TracChangeset
for help on using the changeset viewer.