- Timestamp:
- Jun 24, 2019 9:09:21 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131505
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/GuestControlSvc.h
r79287 r79296 504 504 GUEST_MSG_SESSION_CLOSE = 21, 505 505 506 /** Report guest side feature flags and retrieve the host ones. 507 * 508 * VBoxService makes this call right after becoming master to indicate to the 509 * host what features it support in addition. In return the host will return 510 * features the host supports. Two 64-bit parameters are passed in from the 511 * guest with the guest features (VBOX_GUESTCTRL_GF_XXX), the host replies by 512 * replacing the parameter values with the host ones (VBOX_GUESTCTRL_HF_XXX). 513 * 514 * @retval VINF_SUCCESS on success. 515 * @retval VERR_ACCESS_DENIED it not master. 516 * @retval VERR_INVALID_CLIENT_ID 517 * @retval VERR_WRONG_PARAMETER_COUNT 518 * @retval VERR_WRONG_PARAMETER_TYPE 519 * @since 6.0.10, 5.2.32 520 */ 521 GUEST_MSG_REPORT_FEATURES, 522 /** Query the host ones feature masks. 523 * 524 * This is for the session sub-process so that it can get hold of the features 525 * from the host. Again, it is prudent to set the 127 bit and observe it being 526 * cleared on success, as older hosts might return success without doing 527 * anything. 528 * 529 * @retval VINF_SUCCESS on success. 530 * @retval VERR_INVALID_CLIENT_ID 531 * @retval VERR_WRONG_PARAMETER_COUNT 532 * @retval VERR_WRONG_PARAMETER_TYPE 533 * @since 6.0.10, 5.2.32 534 */ 535 GUEST_MSG_QUERY_FEATURES, 536 506 537 /** 507 538 * Guests sends output from an executed process. … … 567 598 RT_CASE_RET_STR(GUEST_MSG_SESSION_NOTIFY); 568 599 RT_CASE_RET_STR(GUEST_MSG_SESSION_CLOSE); 600 RT_CASE_RET_STR(GUEST_MSG_REPORT_FEATURES); 601 RT_CASE_RET_STR(GUEST_MSG_QUERY_FEATURES); 569 602 RT_CASE_RET_STR(GUEST_MSG_EXEC_OUTPUT); 570 603 RT_CASE_RET_STR(GUEST_MSG_EXEC_STATUS); … … 635 668 GUEST_FILE_NOTIFYTYPE_CLOSE = 20, 636 669 GUEST_FILE_NOTIFYTYPE_READ = 30, 670 GUEST_FILE_NOTIFYTYPE_READ_OFFSET, /**< @since 6.0.10, 5.2.32 - VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET */ 637 671 GUEST_FILE_NOTIFYTYPE_WRITE = 40, 672 GUEST_FILE_NOTIFYTYPE_WRITE_OFFSET, /**< @since 6.0.10, 5.2.32 - VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET */ 638 673 GUEST_FILE_NOTIFYTYPE_SEEK = 50, 639 674 GUEST_FILE_NOTIFYTYPE_TELL = 60, … … 652 687 GUEST_FILE_SEEKTYPE_END = 8 653 688 }; 689 690 /** @name VBOX_GUESTCTRL_GF_XXX - Guest features. 691 * @sa GUEST_MSG_REPORT_FEATURES 692 * @{ */ 693 /** Supports HOST_MSG_FILE_SET_SIZE. */ 694 #define VBOX_GUESTCTRL_GF_0_SET_SIZE RT_BIT_64(0) 695 /** Bit that must be set in the 2nd parameter, will be cleared if the host reponds 696 * correctly (old hosts might not). */ 697 #define VBOX_GUESTCTRL_GF_1_MUST_BE_ONE RT_BIT_64(63) 698 /** @} */ 699 700 /** @name VBOX_GUESTCTRL_HF_XXX - Host features. 701 * @sa GUEST_MSG_REPORT_FEATURES 702 * @{ */ 703 /** Host supports the GUEST_FILE_NOTIFYTYPE_READ_OFFSET and 704 * GUEST_FILE_NOTIFYTYPE_WRITE_OFFSET notification types. */ 705 #define VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET RT_BIT_64(0) 706 /** @} */ 707 654 708 655 709 /* … … 1151 1205 struct 1152 1206 { 1207 /** Actual data read (if any). */ 1208 HGCMFunctionParameter pvData; 1209 /** The new file offset (signed). Negative value if non-seekable files. */ 1210 HGCMFunctionParameter off64New; 1211 } ReadOffset; 1212 struct 1213 { 1153 1214 /** How much data (in bytes) have been successfully written. */ 1154 1215 HGCMFunctionParameter written; 1155 1216 } write; 1217 struct 1218 { 1219 /** Number of bytes that was successfully written. */ 1220 HGCMFunctionParameter cb32Written; 1221 /** The new file offset (signed). Negative value if non-seekable files. */ 1222 HGCMFunctionParameter off64New; 1223 } WriteOffset; 1156 1224 struct 1157 1225 { -
trunk/include/VBox/VBoxGuestLib.h
r79287 r79296 824 824 VBGLR3DECL(bool) VbglR3GuestCtrlSupportsOptimizations(uint32_t idClient); 825 825 VBGLR3DECL(int) VbglR3GuestCtrlMakeMeMaster(uint32_t idClient); 826 VBGLR3DECL(int) VbglR3GuestCtrlReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures); 827 VBGLR3DECL(int) VbglR3GuestCtrlQueryFeatures(uint32_t idClient, uint64_t *pfHostFeatures); 826 828 VBGLR3DECL(int) VbglR3GuestCtrlMsgFilterSet(uint32_t uClientId, uint32_t uValue, uint32_t uMaskAdd, uint32_t uMaskRemove); 827 829 VBGLR3DECL(int) VbglR3GuestCtrlMsgReply(PVBGLR3GUESTCTRLCMDCTX pCtx, int rc); … … 883 885 VBGLR3DECL(int) VbglR3GuestCtrlFileCbError(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc); 884 886 VBGLR3DECL(int) VbglR3GuestCtrlFileCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, void *pvData, uint32_t cbData); 887 VBGLR3DECL(int) VbglR3GuestCtrlFileCbReadOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, 888 void *pvData, uint32_t cbData, int64_t offNew); 885 889 VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten); 890 VBGLR3DECL(int) VbglR3GuestCtrlFileCbWriteOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten, int64_t offNew); 891 886 892 VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t offCurrent); 887 893 VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t offCurrent); -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibGuestCtrl.cpp
r79287 r79296 309 309 310 310 /** 311 * Reports features to the host and retrieve host feature set. 312 * 313 * @returns VBox status code. 314 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 315 * @param fGuestFeatures Features to report, VBOX_GUESTCTRL_GF_XXX. 316 * @param pfHostFeatures Where to store the features VBOX_GUESTCTRL_HF_XXX. 317 */ 318 VBGLR3DECL(int) VbglR3GuestCtrlReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures) 319 { 320 int rc; 321 do 322 { 323 struct 324 { 325 VBGLIOCHGCMCALL Hdr; 326 HGCMFunctionParameter f64Features0; 327 HGCMFunctionParameter f64Features1; 328 } Msg; 329 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_MSG_REPORT_FEATURES, 2); 330 VbglHGCMParmUInt64Set(&Msg.f64Features0, fGuestFeatures); 331 VbglHGCMParmUInt64Set(&Msg.f64Features1, VBOX_GUESTCTRL_GF_1_MUST_BE_ONE); 332 333 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr)); 334 if (RT_SUCCESS(rc)) 335 { 336 Assert(Msg.f64Features0.type == VMMDevHGCMParmType_64bit); 337 Assert(Msg.f64Features1.type == VMMDevHGCMParmType_64bit); 338 if (Msg.f64Features1.u.value64 & VBOX_GUESTCTRL_GF_1_MUST_BE_ONE) 339 rc = VERR_NOT_SUPPORTED; 340 else if (pfHostFeatures) 341 *pfHostFeatures = Msg.f64Features0.u.value64; 342 break; 343 } 344 } while (rc == VERR_INTERRUPTED); 345 return rc; 346 347 } 348 349 350 /** 351 * Query the host features. 352 * 353 * @returns VBox status code. 354 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 355 * @param pfHostFeatures Where to store the host feature, VBOX_GUESTCTRL_HF_XXX. 356 */ 357 VBGLR3DECL(int) VbglR3GuestCtrlQueryFeatures(uint32_t idClient, uint64_t *pfHostFeatures) 358 { 359 int rc; 360 do 361 { 362 struct 363 { 364 VBGLIOCHGCMCALL Hdr; 365 HGCMFunctionParameter f64Features0; 366 HGCMFunctionParameter f64Features1; 367 } Msg; 368 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_MSG_QUERY_FEATURES, 2); 369 VbglHGCMParmUInt64Set(&Msg.f64Features0, 0); 370 VbglHGCMParmUInt64Set(&Msg.f64Features1, RT_BIT_64(63)); 371 372 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr)); 373 if (RT_SUCCESS(rc)) 374 { 375 Assert(Msg.f64Features0.type == VMMDevHGCMParmType_64bit); 376 Assert(Msg.f64Features1.type == VMMDevHGCMParmType_64bit); 377 if (Msg.f64Features1.u.value64 & RT_BIT_64(63)) 378 rc = VERR_NOT_SUPPORTED; 379 else if (pfHostFeatures) 380 *pfHostFeatures = Msg.f64Features0.u.value64; 381 break; 382 } 383 } while (rc == VERR_INTERRUPTED); 384 return rc; 385 386 } 387 388 389 /** 311 390 * Peeks at the next host message, waiting for one to turn up. 312 391 * … … 1443 1522 1444 1523 1524 VBGLR3DECL(int) VbglR3GuestCtrlFileCbReadOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, 1525 void *pvData, uint32_t cbData, int64_t offNew) 1526 { 1527 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1528 1529 HGCMReplyFileNotify Msg; 1530 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_MSG_FILE_NOTIFY, 5); 1531 VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID); 1532 VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_READ_OFFSET); 1533 VbglHGCMParmUInt32Set(&Msg.rc, uRc); 1534 VbglHGCMParmPtrSet(&Msg.u.ReadOffset.pvData, pvData, cbData); 1535 VbglHGCMParmUInt64Set(&Msg.u.ReadOffset.off64New, (uint64_t)offNew); 1536 1537 return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.read)); 1538 } 1539 1540 1445 1541 VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten) 1446 1542 { … … 1453 1549 VbglHGCMParmUInt32Set(&Msg.rc, uRc); 1454 1550 VbglHGCMParmUInt32Set(&Msg.u.write.written, cbWritten); 1551 1552 return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.write)); 1553 } 1554 1555 1556 VBGLR3DECL(int) VbglR3GuestCtrlFileCbWriteOffset(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten, int64_t offNew) 1557 { 1558 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1559 1560 HGCMReplyFileNotify Msg; 1561 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_MSG_FILE_NOTIFY, 5); 1562 VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID); 1563 VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_WRITE_OFFSET); 1564 VbglHGCMParmUInt32Set(&Msg.rc, uRc); 1565 VbglHGCMParmUInt32Set(&Msg.u.WriteOffset.cb32Written, cbWritten); 1566 VbglHGCMParmUInt64Set(&Msg.u.WriteOffset.off64New, (uint64_t)offNew); 1455 1567 1456 1568 return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.write)); -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r76958 r79296 79 79 /** The guest control service client ID. */ 80 80 uint32_t g_idControlSvcClient = 0; 81 /** VBOX_GUESTCTRL_HF_XXX */ 82 uint64_t g_fControlHostFeatures0 = 0; 81 83 #if 0 /** @todo process limit */ 82 84 /** How many started guest processes are kept into memory for supplying … … 210 212 VGSvcVerbose(3, "Guest control service client ID=%RU32%s\n", 211 213 g_idControlSvcClient, g_fControlSupportsOptimizations ? " w/ optimizations" : ""); 214 215 /* 216 * Report features to the host. 217 */ 218 rc = VbglR3GuestCtrlReportFeatures(g_idControlSvcClient, VBOX_GUESTCTRL_GF_0_SET_SIZE, &g_fControlHostFeatures0); 219 if (RT_SUCCESS(rc)) 220 VGSvcVerbose(3, "Host features: %#RX64\n", g_fControlHostFeatures0); 221 else 222 VGSvcVerbose(1, "Warning! Feature reporing failed: %Rrc\n", rc); 223 212 224 return VINF_SUCCESS; 213 225 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.h
r76563 r79296 68 68 /** Context ID. */ 69 69 uint32_t uContextID; 70 /** RTFILE_O_XXX flags. */ 71 uint64_t fOpen; 70 72 } VBOXSERVICECTRLFILE; 71 73 /** Pointer to thread data. */ … … 294 296 extern VBOXSERVICECTRLSESSION g_Session; 295 297 extern uint32_t g_idControlSvcClient; 298 extern uint64_t g_fControlHostFeatures0; 296 299 extern bool g_fControlSupportsOptimizations; 297 300 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r79287 r79296 334 334 uHandle = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pHostCtx->uContextID); 335 335 pFile->uHandle = uHandle; 336 pFile->fOpen = fFlags; 336 337 RTListAppend(&pSession->lstFiles, &pFile->Node); 337 338 VGSvcVerbose(2, "[File %s] Opened (ID=%RU32)\n", pFile->szName, pFile->uHandle); … … 448 449 * ignore failure as the host better respect our buffer limits. 449 450 */ 450 size_t cbRead = 0; 451 uint32_t offNew = 0; 452 size_t cbRead = 0; 451 453 PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle); 452 454 if (pFile) … … 456 458 457 459 rc = RTFileRead(pFile->hFile, *ppvScratchBuf, RT_MIN(cbToRead, *pcbScratchBuf), &cbRead); 458 VGSvcVerbose(5, "[File %s] Read %zu/%RU32 bytes, rc=%Rrc\n", pFile->szName, cbRead, cbToRead, rc); 460 offNew = (int64_t)RTFileTell(pFile->hFile); 461 VGSvcVerbose(5, "[File %s] Read %zu/%RU32 bytes, rc=%Rrc, offNew=%RI64\n", pFile->szName, cbRead, cbToRead, rc, offNew); 459 462 } 460 463 else … … 467 470 * Report result and data back to the host. 468 471 */ 469 int rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead); 472 int rc2; 473 if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET) 474 rc2 = VbglR3GuestCtrlFileCbReadOffset(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead, offNew); 475 else 476 rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead); 470 477 if (RT_FAILURE(rc2)) 471 478 { … … 505 512 * ignore failure as the host better respect our buffer limits. 506 513 */ 507 size_t cbRead = 0; 514 int64_t offNew = 0; 515 size_t cbRead = 0; 508 516 PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle); 509 517 if (pFile) … … 513 521 514 522 rc = RTFileReadAt(pFile->hFile, (RTFOFF)offReadAt, *ppvScratchBuf, RT_MIN(cbToRead, *pcbScratchBuf), &cbRead); 515 VGSvcVerbose(5, "[File %s] Read %zu bytes @ %RU64, rc=%Rrc\n", pFile->szName, cbRead, offReadAt, rc); 523 if (RT_SUCCESS(rc)) 524 { 525 offNew = offReadAt + cbRead; 526 RTFileSeek(pFile->hFile, offNew, RTFILE_SEEK_BEGIN, NULL); /* RTFileReadAt does not always change position. */ 527 } 528 else 529 offNew = (int64_t)RTFileTell(pFile->hFile); 530 VGSvcVerbose(5, "[File %s] Read %zu bytes @ %RU64, rc=%Rrc, offNew=%RI64\n", pFile->szName, cbRead, offReadAt, rc, offNew); 516 531 } 517 532 else … … 524 539 * Report result and data back to the host. 525 540 */ 526 int rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead); 541 int rc2; 542 if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET) 543 rc2 = VbglR3GuestCtrlFileCbReadOffset(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead, offNew); 544 else 545 rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, *ppvScratchBuf, (uint32_t)cbRead); 527 546 if (RT_FAILURE(rc2)) 528 547 { … … 561 580 * Locate the file and do the writing. 562 581 */ 563 size_t cbWritten = 0; 582 int64_t offNew = 0; 583 size_t cbWritten = 0; 564 584 PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle); 565 585 if (pFile) 566 586 { 567 587 rc = RTFileWrite(pFile->hFile, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), &cbWritten); 568 VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 => %Rrc, cbWritten=%zu\n", 569 pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), rc, cbWritten); 588 offNew = (int64_t)RTFileTell(pFile->hFile); 589 VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 => %Rrc, cbWritten=%zu, offNew=%RI64\n", 590 pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), rc, cbWritten, offNew); 570 591 } 571 592 else … … 578 599 * Report result back to host. 579 600 */ 580 int rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten); 601 int rc2; 602 if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET) 603 rc2 = VbglR3GuestCtrlFileCbWriteOffset(pHostCtx, rc, (uint32_t)cbWritten, offNew); 604 else 605 rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten); 581 606 if (RT_FAILURE(rc2)) 582 607 { … … 616 641 * Locate the file and do the writing. 617 642 */ 618 size_t cbWritten = 0; 643 int64_t offNew = 0; 644 size_t cbWritten = 0; 619 645 PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle); 620 646 if (pFile) 621 647 { 622 648 rc = RTFileWriteAt(pFile->hFile, (RTFOFF)offWriteAt, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), &cbWritten); 623 VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 @ %RU64 => %Rrc, cbWritten=%zu\n", 624 pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), offWriteAt, rc, cbWritten); 649 if (RT_SUCCESS(rc)) 650 { 651 offNew = offWriteAt + cbWritten; 652 653 /* RTFileWriteAt does not always change position: */ 654 if (!(pFile->fOpen & RTFILE_O_APPEND)) 655 RTFileSeek(pFile->hFile, offNew, RTFILE_SEEK_BEGIN, NULL); 656 else 657 RTFileSeek(pFile->hFile, 0, RTFILE_SEEK_END, (uint64_t *)&offNew); 658 } 659 else 660 offNew = (int64_t)RTFileTell(pFile->hFile); 661 VGSvcVerbose(5, "[File %s] Writing %p LB %RU32 @ %RU64 => %Rrc, cbWritten=%zu, offNew=%RI64\n", 662 pFile->szName, *ppvScratchBuf, RT_MIN(cbToWrite, *pcbScratchBuf), offWriteAt, rc, cbWritten, offNew); 625 663 } 626 664 else … … 633 671 * Report result back to host. 634 672 */ 635 int rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten); 673 int rc2; 674 if (g_fControlHostFeatures0 & VBOX_GUESTCTRL_HF_0_NOTIFY_RDWR_OFFSET) 675 rc2 = VbglR3GuestCtrlFileCbWriteOffset(pHostCtx, rc, (uint32_t)cbWritten, offNew); 676 else 677 rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten); 636 678 if (RT_FAILURE(rc2)) 637 679 { … … 1658 1700 g_fControlSupportsOptimizations = VbglR3GuestCtrlSupportsOptimizations(idClient); 1659 1701 g_idControlSvcClient = idClient; 1702 VbglR3GuestCtrlQueryFeatures(idClient, &g_fControlHostFeatures0); 1660 1703 1661 1704 rc = vgsvcGstCtrlSessionReadKeyAndAccept(idClient, pSession->StartupInfo.uSessionID); -
trunk/src/VBox/Main/include/GuestImpl.h
r79050 r79296 113 113 ComObjPtr<GuestSession> &pGuestSession); 114 114 inline bool i_sessionExists(uint32_t uSessionID); 115 115 /** Returns the VBOX_GUESTCTRL_GF_0_XXX mask reported by the guest. */ 116 uint64_t i_getGuestControlFeatures0() const { return mData.mfGuestFeatures0; } 117 /** Returns the VBOX_GUESTCTRL_GF_1_XXX mask reported by the guest. */ 118 uint64_t i_getGuestControlFeatures1() const { return mData.mfGuestFeatures1; } 116 119 #endif 117 120 /** @} */ … … 193 196 Data() : mOSType(VBOXOSTYPE_Unknown), mAdditionsRunLevel(AdditionsRunLevelType_None) 194 197 , mAdditionsVersionFull(0), mAdditionsRevision(0), mAdditionsFeatures(0) 198 #ifdef VBOX_WITH_GUEST_CONTROL 199 , mfGuestFeatures0(0), mfGuestFeatures1(0) 200 #endif 195 201 { } 196 202 … … 206 212 #ifdef VBOX_WITH_GUEST_CONTROL 207 213 GuestSessions mGuestSessions; 214 /** Guest control features (reported by the guest), VBOX_GUESTCTRL_GF_0_XXX. */ 215 uint64_t mfGuestFeatures0; 216 /** Guest control features (reported by the guest), VBOX_GUESTCTRL_GF_1_XXX. */ 217 uint64_t mfGuestFeatures1; 208 218 #endif 209 219 } mData; -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r78744 r79296 95 95 PVBOXGUESTCTRLHOSTCALLBACK pSvcCb = (PVBOXGUESTCTRLHOSTCALLBACK)pvData; 96 96 AssertPtrReturn(pSvcCb, VERR_INVALID_POINTER); 97 98 /* 99 * Deal with GUEST_MSG_REPORT_FEATURES here as it shouldn't be handed 100 * i_dispatchToSession() and has different parameters. 101 */ 102 if (idMessage == GUEST_MSG_REPORT_FEATURES) 103 { 104 Assert(pSvcCb->mParms == 2); 105 Assert(pSvcCb->mpaParms[0].type == VBOX_HGCM_SVC_PARM_64BIT); 106 Assert(pSvcCb->mpaParms[1].type == VBOX_HGCM_SVC_PARM_64BIT); 107 Assert(pSvcCb->mpaParms[1].u.uint64 & VBOX_GUESTCTRL_GF_1_MUST_BE_ONE); 108 pGuest->mData.mfGuestFeatures0 = pSvcCb->mpaParms[0].u.uint64; 109 pGuest->mData.mfGuestFeatures1 = pSvcCb->mpaParms[1].u.uint64; 110 LogRel(("Guest Control: GUEST_MSG_REPORT_FEATURES: %#RX64, %#RX64\n", 111 pGuest->mData.mfGuestFeatures0, pGuest->mData.mfGuestFeatures1)); 112 return VINF_SUCCESS; 113 } 97 114 98 115 /* -
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r79287 r79296 520 520 } 521 521 522 case GUEST_FILE_NOTIFYTYPE_READ_OFFSET: 523 { 524 ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mParms == 5, ("mParms=%u\n", pSvcCbData->mParms), 525 rc = VERR_WRONG_PARAMETER_COUNT); 526 ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx].type == VBOX_HGCM_SVC_PARM_PTR, 527 ("type=%u\n", pSvcCbData->mpaParms[idx].type), 528 rc = VERR_WRONG_PARAMETER_TYPE); 529 ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx + 1].type == VBOX_HGCM_SVC_PARM_64BIT, 530 ("type=%u\n", pSvcCbData->mpaParms[idx].type), 531 rc = VERR_WRONG_PARAMETER_TYPE); 532 BYTE const * const pbData = (BYTE const *)pSvcCbData->mpaParms[idx].u.pointer.addr; 533 uint32_t const cbRead = pSvcCbData->mpaParms[idx].u.pointer.size; 534 int64_t offNew = (int64_t)pSvcCbData->mpaParms[idx + 1].u.uint64; 535 Log3ThisFunc(("cbRead=%RU32 offNew=%RI64 (%#RX64)\n", cbRead, offNew, offNew)); 536 537 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 538 if (offNew < 0) /* non-seekable */ 539 offNew = mData.mOffCurrent + cbRead; 540 mData.mOffCurrent = offNew; 541 alock.release(); 542 543 try 544 { 545 com::SafeArray<BYTE> data((size_t)cbRead); 546 data.initFrom(pbData, cbRead); 547 fireGuestFileReadEvent(mEventSource, mSession, this, offNew, cbRead, ComSafeArrayAsInParam(data)); 548 rc = VINF_SUCCESS; 549 } 550 catch (std::bad_alloc &) 551 { 552 rc = VERR_NO_MEMORY; 553 } 554 break; 555 } 556 522 557 case GUEST_FILE_NOTIFYTYPE_WRITE: 523 558 { … … 539 574 540 575 fireGuestFileWriteEvent(mEventSource, mSession, this, mData.mOffCurrent, cbWritten); 576 } 577 break; 578 } 579 580 case GUEST_FILE_NOTIFYTYPE_WRITE_OFFSET: 581 { 582 ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mParms == 5, ("mParms=%u\n", pSvcCbData->mParms), 583 rc = VERR_WRONG_PARAMETER_COUNT); 584 ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx].type == VBOX_HGCM_SVC_PARM_32BIT, 585 ("type=%u\n", pSvcCbData->mpaParms[idx].type), 586 rc = VERR_WRONG_PARAMETER_TYPE); 587 ASSERT_GUEST_MSG_STMT_BREAK(pSvcCbData->mpaParms[idx + 1].type == VBOX_HGCM_SVC_PARM_64BIT, 588 ("type=%u\n", pSvcCbData->mpaParms[idx].type), 589 rc = VERR_WRONG_PARAMETER_TYPE); 590 uint32_t const cbWritten = pSvcCbData->mpaParms[idx].u.uint32; 591 int64_t offNew = (int64_t)pSvcCbData->mpaParms[idx + 1].u.uint64; 592 Log3ThisFunc(("cbWritten=%RU32 offNew=%RI64 (%#RX64)\n", cbWritten, offNew, offNew)); 593 594 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 595 if (offNew < 0) /* non-seekable */ 596 offNew = mData.mOffCurrent + cbWritten; 597 mData.mOffCurrent = offNew; 598 alock.release(); 599 600 try 601 { 602 fireGuestFileWriteEvent(mEventSource, mSession, this, offNew, cbWritten); 603 rc = VINF_SUCCESS; 604 } 605 catch (std::bad_alloc &) 606 { 607 rc = VERR_NO_MEMORY; 541 608 } 542 609 break;
Note:
See TracChangeset
for help on using the changeset viewer.