Changeset 75807 in vbox for trunk/src/VBox/Additions/common/VBoxGuest/lib
- Timestamp:
- Nov 29, 2018 7:09:21 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibGuestCtrl.cpp
r75804 r75807 83 83 * 84 84 * @returns VBox status code. 85 * @param uClientIdThe client ID returned by VbglR3GuestCtrlConnect().85 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 86 86 * @param pidMsg Where to store the message id. 87 87 * @param pcParameters Where to store the number of parameters which will 88 88 * be received in a second call to the host. 89 89 */ 90 static int vbglR3GuestCtrlMsgWaitFor(uint32_t uClientId, uint32_t *pidMsg, uint32_t *pcParameters)90 static int vbglR3GuestCtrlMsgWaitFor(uint32_t idClient, uint32_t *pidMsg, uint32_t *pcParameters) 91 91 { 92 92 AssertPtrReturn(pidMsg, VERR_INVALID_POINTER); … … 94 94 95 95 HGCMMsgCmdWaitFor Msg; 96 VBGL_HGCM_HDR_INIT(&Msg.hdr, uClientId,96 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 97 97 GUEST_MSG_WAIT, /* Tell the host we want our next command. */ 98 98 2); /* Just peek for the next message! */ … … 275 275 276 276 /** 277 * Checks if the host supports the optimizes message and session functions. 278 * 279 * @returns true / false. 280 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 281 * We may need to use this for checking. 282 * @since 6.0 283 */ 284 VBGLR3DECL(bool) VbglR3GuestCtrlSupportsOptimizations(uint32_t idClient) 285 { 286 return vbglR3GuestCtrlSupportsPeekGetCancel(idClient); 287 } 288 289 290 /** 291 * Make us the guest control master client. 292 * 293 * @returns VBox status code. 294 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 295 */ 296 VBGLR3DECL(int) VbglR3GuestCtrlMakeMeMaster(uint32_t idClient) 297 { 298 int rc; 299 do 300 { 301 VBGLIOCHGCMCALL Hdr; 302 VBGL_HGCM_HDR_INIT(&Hdr, idClient, GUEST_MAKE_ME_MASTER, 0); 303 rc = VbglR3HGCMCall(&Hdr, sizeof(Hdr)); 304 } while (rc == VERR_INTERRUPTED); 305 return rc; 306 } 307 308 309 310 /** 277 311 * Peeks at the next host message, waiting for one to turn up. 278 312 * … … 299 333 VbglHGCMParmUInt32Set(&Msg.num_parms, 0); 300 334 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 335 LogRel(("VbglR3GuestCtrlMsgPeekWait -> %Rrc\n", rc)); 301 336 if (RT_SUCCESS(rc)) 302 337 { … … 342 377 * 343 378 * @return IPRT status code. 344 * @param uClientIdThe client ID returned by VbglR3GuestCtrlConnect().379 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 345 380 * @param uValue The value to filter messages for. 346 381 * @param uMaskAdd Filter mask to add. 347 382 * @param uMaskRemove Filter mask to remove. 348 383 */ 349 VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove)384 VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t idClient, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove) 350 385 { 351 386 HGCMMsgCmdFilterSet Msg; 352 387 353 388 /* Tell the host we want to set a filter. */ 354 VBGL_HGCM_HDR_INIT(&Msg.hdr, uClientId, GUEST_MSG_FILTER_SET, 4);389 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, GUEST_MSG_FILTER_SET, 4); 355 390 VbglHGCMParmUInt32Set(&Msg.value, uValue); 356 391 VbglHGCMParmUInt32Set(&Msg.mask_add, uMaskAdd); … … 387 422 } 388 423 424 /** 425 * Tell the host to skip the current message replying VERR_NOT_SUPPORTED 426 * 427 * @return IPRT status code. 428 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 429 */ 430 VBGLR3DECL(int) VbglR3GuestCtrlMsgSkip(uint32_t idClient) 431 { 432 if (vbglR3GuestCtrlSupportsPeekGetCancel(idClient)) 433 { 434 VBGLIOCHGCMCALL Hdr; 435 VBGL_HGCM_HDR_INIT(&Hdr, idClient, GUEST_MSG_SKIP, 0); 436 return VbglR3HGCMCall(&Hdr, sizeof(Hdr)); 437 } 438 439 /* This is generally better than nothing... */ 440 return VbglR3GuestCtrlMsgSkipOld(idClient); 441 } 442 389 443 390 444 /** … … 393 447 * 394 448 * @return IPRT status code. 395 * @param uClientIdThe client ID returned by VbglR3GuestCtrlConnect().396 */ 397 VBGLR3DECL(int) VbglR3GuestCtrlMsgSkipOld(uint32_t uClientId)449 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 450 */ 451 VBGLR3DECL(int) VbglR3GuestCtrlMsgSkipOld(uint32_t idClient) 398 452 { 399 453 HGCMMsgCmdSkip Msg; 400 454 401 455 /* Tell the host we want to skip the current assigned command. */ 402 VBGL_HGCM_HDR_INIT(&Msg.hdr, uClientId, GUEST_MSG_SKIP_OLD, 1);456 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, GUEST_MSG_SKIP_OLD, 1); 403 457 VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */); 404 458 return VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); … … 410 464 * 411 465 * @returns VBox status code. 412 * @param uClientIdThe client ID returned by VbglR3GuestCtrlConnect().413 */ 414 VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(uint32_t uClientId)466 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 467 */ 468 VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(uint32_t idClient) 415 469 { 416 470 HGCMMsgCancelPendingWaits Msg; 417 VBGL_HGCM_HDR_INIT(&Msg.hdr, uClientId, GUEST_MSG_CANCEL, 0);471 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, GUEST_MSG_CANCEL, 0); 418 472 return VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 473 } 474 475 476 /** 477 * Prepares a session. 478 * @since 6.0 479 * @sa GUEST_SESSION_PREPARE 480 */ 481 VBGLR3DECL(int) VbglR3GuestCtrlSessionPrepare(uint32_t idClient, uint32_t idSession, void const *pvKey, uint32_t cbKey) 482 { 483 int rc; 484 do 485 { 486 struct 487 { 488 VBGLIOCHGCMCALL Hdr; 489 HGCMFunctionParameter idSession; 490 HGCMFunctionParameter pKey; 491 } Msg; 492 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_SESSION_PREPARE, 2); 493 VbglHGCMParmUInt32Set(&Msg.idSession, idSession); 494 VbglHGCMParmPtrSet(&Msg.pKey, (void *)pvKey, cbKey); 495 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 496 } while (rc == VERR_INTERRUPTED); 497 return rc; 498 } 499 500 501 /** 502 * Accepts a session. 503 * @since 6.0 504 * @sa GUEST_SESSION_ACCEPT 505 */ 506 VBGLR3DECL(int) VbglR3GuestCtrlSessionAccept(uint32_t idClient, uint32_t idSession, void const *pvKey, uint32_t cbKey) 507 { 508 int rc; 509 do 510 { 511 struct 512 { 513 VBGLIOCHGCMCALL Hdr; 514 HGCMFunctionParameter idSession; 515 HGCMFunctionParameter pKey; 516 } Msg; 517 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_SESSION_ACCEPT, 2); 518 VbglHGCMParmUInt32Set(&Msg.idSession, idSession); 519 VbglHGCMParmPtrSet(&Msg.pKey, (void *)pvKey, cbKey); 520 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 521 } while (rc == VERR_INTERRUPTED); 522 return rc; 523 } 524 525 526 /** 527 * Cancels a prepared session. 528 * @since 6.0 529 * @sa GUEST_SESSION_CANCEL_PREPARED 530 */ 531 VBGLR3DECL(int) VbglR3GuestCtrlSessionCancelPrepared(uint32_t idClient, uint32_t idSession) 532 { 533 int rc; 534 do 535 { 536 struct 537 { 538 VBGLIOCHGCMCALL Hdr; 539 HGCMFunctionParameter idSession; 540 } Msg; 541 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_SESSION_CANCEL_PREPARED, 1); 542 VbglHGCMParmUInt32Set(&Msg.idSession, idSession); 543 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 544 } while (rc == VERR_INTERRUPTED); 545 return rc; 419 546 } 420 547 … … 442 569 443 570 444 VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uType, uint32_t uResult)571 VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uType, int32_t iResult) 445 572 { 446 573 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); … … 450 577 VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID); 451 578 VbglHGCMParmUInt32Set(&Msg.type, uType); 452 VbglHGCMParmUInt32Set(&Msg.result, uResult);579 VbglHGCMParmUInt32Set(&Msg.result, (uint32_t)iResult); 453 580 454 581 return VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); … … 497 624 *pidSession = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pCtx->uContextID); 498 625 } 626 /* Try get the context ID so we can inform the host about this message retrival failure. */ 627 else if (Msg.context.u.value32 != HOST_SESSION_CREATE) 628 Msg.context.GetUInt32(&pCtx->uContextID); 629 499 630 } while (rc == VERR_INTERRUPTED && g_fVbglR3GuestCtrlHavePeekGetCancel); 500 631 return rc; … … 725 856 HGCMMsgProcOutput Msg; 726 857 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, vbglR3GuestCtrlGetMsgFunctionNo(pCtx->uClientID), pCtx->uNumParms); 727 VbglHGCMParmUInt32Set(&Msg.context, 0);858 VbglHGCMParmUInt32Set(&Msg.context, HOST_EXEC_GET_OUTPUT); 728 859 VbglHGCMParmUInt32Set(&Msg.pid, 0); 729 860 VbglHGCMParmUInt32Set(&Msg.handle, 0);
Note:
See TracChangeset
for help on using the changeset viewer.