Changeset 75757 in vbox
- Timestamp:
- Nov 27, 2018 4:24:13 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
include/VBox/HostServices/GuestControlSvc.h (modified) (1 diff)
-
src/VBox/HostServices/GuestControl/service.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/GuestControlSvc.h
r75755 r75757 304 304 /** Gets the next message, returning immediately. 305 305 * 306 * First argument is the message ID returned by the peek and which the caller307 * expects to retrieve (holds actual message ID when VERR_MISMATCH is returned).308 * Second argument is the parameter count (output only) and exist for309 * compatibility with GUEST_MSG_WAIT. Any subsequent parameters are specific to310 * the message being retrieved.306 * All parameters are specific to the message being retrieved, however if the 307 * first one is an integer value it shall be an input parameter holding the 308 * ID of the message being retrieved. While it would be nice to add a separate 309 * parameter for this purpose, this is difficult without breaking GUEST_MSG_WAIT 310 * compatibility. 311 311 * 312 312 * @retval VINF_SUCCESS if message retrieved and removed from the pending queue. -
trunk/src/VBox/HostServices/GuestControl/service.cpp
r75756 r75757 766 766 HGCMSvcSetU32(&mPendingCon.mParms[1], pHostCmd->mParmCount); 767 767 for (uint32_t i = pHostCmd->mParmCount; i >= 2; i--) 768 switch (pHostCmd->mpParms[i ].type)768 switch (pHostCmd->mpParms[i - 2].type) 769 769 { 770 770 case VBOX_HGCM_SVC_PARM_32BIT: mPendingCon.mParms[i].u.uint32 = ~(uint32_t)sizeof(uint32_t); break; 771 771 case VBOX_HGCM_SVC_PARM_64BIT: mPendingCon.mParms[i].u.uint32 = ~(uint32_t)sizeof(uint64_t); break; 772 case VBOX_HGCM_SVC_PARM_PTR: mPendingCon.mParms[i].u.uint32 = pHostCmd->mpParms[i ].u.pointer.size; break;772 case VBOX_HGCM_SVC_PARM_PTR: mPendingCon.mParms[i].u.uint32 = pHostCmd->mpParms[i - 2].u.pointer.size; break; 773 773 } 774 774 … … 1273 1273 paParms[1].u.uint32 = pFirstCmd->mParmCount; 1274 1274 for (uint32_t i = pFirstCmd->mParmCount; i >= 2; i--) 1275 switch (pFirstCmd->mpParms[i ].type)1275 switch (pFirstCmd->mpParms[i - 2].type) 1276 1276 { 1277 1277 case VBOX_HGCM_SVC_PARM_32BIT: paParms[i].u.uint32 = ~(uint32_t)sizeof(uint32_t); break; 1278 1278 case VBOX_HGCM_SVC_PARM_64BIT: paParms[i].u.uint32 = ~(uint32_t)sizeof(uint64_t); break; 1279 case VBOX_HGCM_SVC_PARM_PTR: paParms[i].u.uint32 = pFirstCmd->mpParms[i ].u.pointer.size; break;1279 case VBOX_HGCM_SVC_PARM_PTR: paParms[i].u.uint32 = pFirstCmd->mpParms[i - 2].u.pointer.size; break; 1280 1280 } 1281 1281 … … 1330 1330 * Validate the request. 1331 1331 * 1332 * Note! The 2nd parameter is basically ignored as it's only purpose is 1333 * compatibility with GUEST_MSG_WAIT 1334 */ 1335 ASSERT_GUEST_MSG_RETURN(cParms >= 2, ("cParms=%u!\n", cParms), VERR_INVALID_PARAMETER); 1336 ASSERT_GUEST_MSG_RETURN(paParms[0].type == VBOX_HGCM_SVC_PARM_32BIT, ("type=%u\n", paParms[0].type), VERR_WRONG_TYPE); 1337 uint32_t const idMsgExpected = paParms[0].u.uint32; 1338 ASSERT_GUEST_MSG_RETURN(paParms[1].type == VBOX_HGCM_SVC_PARM_32BIT, ("type=%u\n", paParms[0].type), VERR_WRONG_TYPE); 1332 * The weird first parameter logic is due to GUEST_MSG_WAIT compatibility 1333 * (don't want to rewrite all the message structures). 1334 */ 1335 uint32_t const idMsgExpected = cParms > 0 && paParms[0].type == VBOX_HGCM_SVC_PARM_32BIT ? paParms[0].u.uint32 1336 : cParms > 0 && paParms[0].type == VBOX_HGCM_SVC_PARM_64BIT ? paParms[0].u.uint64 1337 : UINT32_MAX; 1339 1338 1340 1339 ClientStateMapIter itClientState = mClientStateMap.find(idClient); … … 1351 1350 HostCommand *pFirstCmd = *itFirstCmd; 1352 1351 1353 /* The 'peek' parameters. */ 1354 paParms[0].u.uint32 = pFirstCmd->mMsgType; 1355 paParms[1].u.uint32 = pFirstCmd->mParmCount; 1356 ASSERT_GUEST_MSG_RETURN(pFirstCmd->mMsgType == idMsgExpected, 1352 ASSERT_GUEST_MSG_RETURN(pFirstCmd->mMsgType == idMsgExpected || idMsgExpected == UINT32_MAX, 1357 1353 ("idMsg=%u cParms=%u, caller expected %u and %u\n", 1358 1354 pFirstCmd->mMsgType, pFirstCmd->mParmCount, idMsgExpected, cParms), … … 1364 1360 1365 1361 /* Check the parameter types. */ 1366 for (uint32_t i = 2; i < cParms; i++)1362 for (uint32_t i = 0; i < cParms; i++) 1367 1363 ASSERT_GUEST_MSG_RETURN(pFirstCmd->mpParms[i].type == paParms[i].type, 1368 1364 ("param #%u: type %u, caller expected %u\n", i, pFirstCmd->mpParms[i].type, paParms[i].type), … … 1376 1372 */ 1377 1373 int rc = VINF_SUCCESS; 1378 for (uint32_t i = 2; i < cParms; i++)1374 for (uint32_t i = 0; i < cParms; i++) 1379 1375 switch (pFirstCmd->mpParms[i].type) 1380 1376 {
Note:
See TracChangeset
for help on using the changeset viewer.

