Changeset 80283 in vbox for trunk/src/VBox/Additions/common/VBoxGuest
- Timestamp:
- Aug 15, 2019 8:47:23 AM (5 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/Makefile.kmk
r79497 r80283 147 147 endif 148 148 ifdef VBOX_WITH_SHARED_CLIPBOARD 149 VBoxGuestR3Lib_DEFS += VBOX_WITH_SHARED_CLIPBOARD_GUEST 149 VBoxGuestR3Lib_DEFS += VBOX_WITH_SHARED_CLIPBOARD_GUEST LOG_ENABLED 150 150 VBoxGuestR3Lib_SOURCES += \ 151 151 VBoxGuestR3LibClipboard.cpp -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r79702 r80283 30 30 *********************************************************************************************************************************/ 31 31 #include <VBox/GuestHost/SharedClipboard.h> 32 #include <VBox/GuestHost/clipboard-helper.h> 32 33 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 33 34 # include <VBox/GuestHost/SharedClipboard-uri.h> … … 207 208 * @note Restore check is only performed optimally with a 6.0 host. 208 209 */ 209 static int vbglR3ClipboardMsgPeekWait( uint32_t idClient, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck)210 static int vbglR3ClipboardMsgPeekWait(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck) 210 211 { 211 212 AssertPtrReturn(pidMsg, VERR_INVALID_POINTER); … … 220 221 HGCMFunctionParameter cParameters; 221 222 } Msg; 222 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT, 2);223 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT, 2); 223 224 VbglHGCMParmUInt64Set(&Msg.idMsg, pidRestoreCheck ? *pidRestoreCheck : 0); 224 225 VbglHGCMParmUInt32Set(&Msg.cParameters, 0); … … 242 243 if (rc == VERR_INTERRUPTED) 243 244 { 244 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL, 0);245 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL, 0); 245 246 int rc2 = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr)); 246 247 AssertRC(rc2); … … 259 260 #endif 260 261 261 VBGLR3DECL(int) VbglR3ClipboardTransferSendStatus(HGCMCLIENTID idClient, SHAREDCLIPBOARDURITRANSFERSTATUS uStatus) 262 { 262 VBGLR3DECL(int) VbglR3ClipboardTransferSendStatus(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDURITRANSFERSTATUS uStatus) 263 { 264 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 265 263 266 VBoxClipboardStatusMsg Msg; 264 267 RT_ZERO(Msg); 265 268 266 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,269 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 267 270 VBOX_SHARED_CLIPBOARD_GUEST_FN_STATUS, VBOX_SHARED_CLIPBOARD_CPARMS_STATUS); 268 271 … … 278 281 } 279 282 280 VBGLR3DECL(int) VbglR3ClipboardRootsRecv(HGCMCLIENTID idClient, PVBOXCLIPBOARDROOTS pRoots) 281 { 282 AssertPtrReturn(pRoots, VERR_INVALID_POINTER); 283 284 VBoxClipboardRootsMsg Msg; 285 RT_ZERO(Msg); 286 287 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 288 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_ROOTS); 289 290 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOTS); 291 Msg.fRoots.SetUInt32(0); 292 Msg.fMore.SetUInt32(0); 293 Msg.cRoots.SetUInt32(0); 294 Msg.cbRoots.SetUInt32(pRoots->cbRoots); 295 Msg.pvRoots.SetPtr((void *)pRoots->pszRoots, pRoots->cbRoots); 296 297 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 298 if (RT_SUCCESS(rc)) 299 { 300 uint32_t fMore; 301 rc = Msg.fMore.GetUInt32(&fMore); AssertRC(rc); 302 if (RT_SUCCESS(rc)) 303 { 304 pRoots->fMore = RT_BOOL(fMore); 305 } 306 if (RT_SUCCESS(rc)) 307 rc = Msg.fRoots.GetUInt32(&pRoots->fRoots); AssertRC(rc); 308 if (RT_SUCCESS(rc)) 309 rc = Msg.cRoots.GetUInt32(&pRoots->cRoots); AssertRC(rc); 310 if (RT_SUCCESS(rc)) 311 rc = Msg.cbRoots.GetUInt32(&pRoots->cbRoots); AssertRC(rc); 312 } 313 314 LogFlowFuncLeaveRC(rc); 315 return rc; 316 } 317 318 VBGLR3DECL(int) VbglR3ClipboardRootsWrite(HGCMCLIENTID idClient, uint32_t cRoots, char *papszList, uint32_t cbList) 319 { 320 AssertPtrReturn(papszList, VERR_INVALID_POINTER); 321 AssertReturn(cbList, VERR_INVALID_PARAMETER); 322 323 VBoxClipboardRootsMsg Msg; 324 RT_ZERO(Msg); 325 326 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 327 VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOTS, VBOX_SHARED_CLIPBOARD_CPARMS_ROOTS); 328 329 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 330 Msg.fRoots.SetUInt32(0); 331 Msg.fMore.SetUInt32(0); 332 Msg.cRoots.SetUInt32(cRoots); 333 Msg.cbRoots.SetUInt32(cbList); 334 Msg.pvRoots.SetPtr(papszList, cbList); 335 336 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 337 338 LogFlowFuncLeaveRC(rc); 339 return rc; 340 } 341 342 VBGLR3DECL(int) VbglR3ClipboardListOpenSend(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms, 283 VBGLR3DECL(int) VbglR3ClipboardRootListHdrReadReq(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pfRoots) 284 { 285 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 286 AssertPtrReturn(pfRoots, VERR_INVALID_POINTER); 287 288 VBoxClipboardRootListReadReqMsg Msg; 289 RT_ZERO(Msg); 290 291 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 292 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_HDR_READ); 293 294 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ); 295 Msg.ReqParms.fRoots.SetUInt32(0); 296 297 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 298 if (RT_SUCCESS(rc)) 299 { 300 rc = Msg.ReqParms.uContext.GetUInt32(&pCtx->uContextID); AssertRC(rc); 301 if (RT_SUCCESS(rc)) 302 rc = Msg.ReqParms.fRoots.GetUInt32(pfRoots); AssertRC(rc); 303 } 304 305 LogFlowFuncLeaveRC(rc); 306 return rc; 307 } 308 309 VBGLR3DECL(int) VbglR3ClipboardRootListHdrReadReply(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDROOTLISTHDR pRootListHdr) 310 { 311 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 312 AssertPtrReturn(pRootListHdr, VERR_INVALID_POINTER); 313 314 VBoxClipboardRootListHdrMsg Msg; 315 RT_ZERO(Msg); 316 317 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 318 VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_HDR); 319 320 Msg.ReqParms.uContext.SetUInt32(pCtx->uContextID); 321 Msg.ReqParms.fRoots.SetUInt32(pRootListHdr->fRoots); 322 323 Msg.cRoots.SetUInt32(pRootListHdr->cRoots); 324 Msg.enmCompression.SetUInt32(0); /** @todo Not implemented yet. */ 325 Msg.enmChecksumType.SetUInt32(0); /** @todo Not implemented yet. */ 326 327 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 328 329 LogFlowFuncLeaveRC(rc); 330 return rc; 331 } 332 333 VBGLR3DECL(int) VbglR3ClipboardRootListEntryReadReq(PVBGLR3SHCLCMDCTX pCtx, uint32_t *puIndex, uint32_t *pfInfo) 334 { 335 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 336 AssertPtrReturn(puIndex, VERR_INVALID_POINTER); 337 AssertPtrReturn(pfInfo, VERR_INVALID_POINTER); 338 339 VBoxClipboardRootListEntryReadReqMsg Msg; 340 RT_ZERO(Msg); 341 342 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 343 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_ENTRY_READ_REQ); 344 345 Msg.Parms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_ENTRY_READ); 346 Msg.Parms.fInfo.SetUInt32(0); 347 Msg.Parms.uIndex.SetUInt32(0); 348 349 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 350 if (RT_SUCCESS(rc)) 351 { 352 rc = Msg.Parms.uContext.GetUInt32(&pCtx->uContextID); AssertRC(rc); 353 if (RT_SUCCESS(rc)) 354 rc = Msg.Parms.fInfo.GetUInt32(pfInfo); AssertRC(rc); 355 if (RT_SUCCESS(rc)) 356 rc = Msg.Parms.uIndex.GetUInt32(puIndex); AssertRC(rc); 357 } 358 359 LogFlowFuncLeaveRC(rc); 360 return rc; 361 } 362 363 VBGLR3DECL(int) VbglR3ClipboardRootListEntryReadReply(PVBGLR3SHCLCMDCTX pCtx, uint32_t uIndex, PVBOXCLIPBOARDLISTENTRY pEntry) 364 { 365 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 366 AssertPtrReturn(pEntry, VERR_INVALID_POINTER); 367 368 VBoxClipboardRootListEntryMsg Msg; 369 RT_ZERO(Msg); 370 371 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 372 VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_ENTRY_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_ENTRY); 373 374 Msg.Parms.uContext.SetUInt32(pCtx->uContextID); 375 Msg.Parms.fInfo.SetUInt32(0); 376 Msg.Parms.uIndex.SetUInt32(uIndex); 377 378 Msg.szName.SetPtr(pEntry->pszName, pEntry->cbName); 379 Msg.cbInfo.SetUInt32(pEntry->cbInfo); 380 Msg.pvInfo.SetPtr(pEntry->pvInfo, pEntry->cbInfo); 381 382 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 383 384 LogFlowFuncLeaveRC(rc); 385 return rc; 386 } 387 388 VBGLR3DECL(int) VbglR3ClipboardListOpenSend(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms, 343 389 PSHAREDCLIPBOARDLISTHANDLE phList) 344 390 { 391 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 345 392 AssertPtrReturn(pOpenParms, VERR_INVALID_POINTER); 346 393 AssertPtrReturn(phList, VERR_INVALID_POINTER); … … 349 396 RT_ZERO(Msg); 350 397 351 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,398 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 352 399 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_OPEN, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN); 353 400 … … 369 416 } 370 417 371 VBGLR3DECL(int) VbglR3ClipboardListOpenRecv(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms) 372 { 418 VBGLR3DECL(int) VbglR3ClipboardListOpenRecv(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms) 419 { 420 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 373 421 AssertPtrReturn(pOpenParms, VERR_INVALID_POINTER); 374 422 … … 376 424 RT_ZERO(Msg); 377 425 378 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,426 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 379 427 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN); 380 428 … … 401 449 } 402 450 403 VBGLR3DECL(int) VbglR3ClipboardListOpenReply(HGCMCLIENTID idClient, int rcReply, SHAREDCLIPBOARDLISTHANDLE hList) 404 { 451 VBGLR3DECL(int) VbglR3ClipboardListOpenReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDLISTHANDLE hList) 452 { 453 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 454 405 455 VBoxClipboardReplyMsg Msg; 406 456 RT_ZERO(Msg); 407 457 408 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,458 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 409 459 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6); 410 460 … … 423 473 } 424 474 425 VBGLR3DECL(int) VbglR3ClipboardListCloseReply(HGCMCLIENTID idClient, int rcReply, SHAREDCLIPBOARDLISTHANDLE hList) 426 { 475 VBGLR3DECL(int) VbglR3ClipboardListCloseRecv(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDLISTHANDLE phList) 476 { 477 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 478 AssertPtrReturn(phList, VERR_INVALID_POINTER); 479 480 VBoxClipboardListCloseMsg Msg; 481 RT_ZERO(Msg); 482 483 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 484 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE); 485 486 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE); 487 Msg.uHandle.SetUInt64(0); 488 489 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 490 if (RT_SUCCESS(rc)) 491 { 492 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); 493 } 494 495 LogFlowFuncLeaveRC(rc); 496 return rc; 497 } 498 499 VBGLR3DECL(int) VbglR3ClipboardListCloseReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDLISTHANDLE hList) 500 { 501 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 502 427 503 VBoxClipboardReplyMsg Msg; 428 504 RT_ZERO(Msg); 429 505 430 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,506 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 431 507 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6); 432 508 … … 445 521 } 446 522 447 VBGLR3DECL(int) VbglR3ClipboardListCloseSend(HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList) 448 { 523 VBGLR3DECL(int) VbglR3ClipboardListCloseSend(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList) 524 { 525 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 526 449 527 VBoxClipboardListCloseMsg Msg; 450 528 RT_ZERO(Msg); 451 529 452 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,530 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 453 531 VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE); 454 532 … … 462 540 } 463 541 464 VBGLR3DECL(int) VbglR3ClipboardListCloseRecv(HGCMCLIENTID idClient, PSHAREDCLIPBOARDLISTHANDLE phList) 465 { 466 AssertPtrReturn(phList, VERR_INVALID_POINTER); 467 468 VBoxClipboardListCloseMsg Msg; 469 RT_ZERO(Msg); 470 471 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 472 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE); 473 474 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE); 475 Msg.uHandle.SetUInt64(0); 476 477 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 478 if (RT_SUCCESS(rc)) 479 { 480 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); 481 } 482 483 LogFlowFuncLeaveRC(rc); 484 return rc; 485 } 486 487 VBGLR3DECL(int) VbglR3ClipboardListHdrRead(HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList, uint32_t fFlags, 542 543 VBGLR3DECL(int) VbglR3ClipboardListHdrRead(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList, uint32_t fFlags, 488 544 PVBOXCLIPBOARDLISTHDR pListHdr) 489 545 { 546 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 490 547 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER); 491 548 … … 493 550 RT_ZERO(Msg); 494 551 495 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,552 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 496 553 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR); 497 554 … … 525 582 } 526 583 527 VBGLR3DECL(int) VbglR3ClipboardListHdrReadRecvReq(HGCMCLIENTID idClient, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfFlags) 528 { 584 VBGLR3DECL(int) VbglR3ClipboardListHdrReadRecvReq(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfFlags) 585 { 586 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 529 587 AssertPtrReturn(phList, VERR_INVALID_POINTER); 530 588 AssertPtrReturn(pfFlags, VERR_INVALID_POINTER); … … 533 591 RT_ZERO(Msg); 534 592 535 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,593 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 536 594 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ_REQ); 537 595 … … 553 611 } 554 612 555 VBGLR3DECL(int) VbglR3ClipboardListHdrWrite( HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList,613 VBGLR3DECL(int) VbglR3ClipboardListHdrWrite(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList, 556 614 PVBOXCLIPBOARDLISTHDR pListHdr) 557 615 { 616 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 558 617 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER); 559 618 … … 561 620 RT_ZERO(Msg); 562 621 563 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,622 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 564 623 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR); 565 624 … … 581 640 } 582 641 583 VBGLR3DECL(int) VbglR3ClipboardListEntryRead( HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList,642 VBGLR3DECL(int) VbglR3ClipboardListEntryRead(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList, 584 643 PVBOXCLIPBOARDLISTENTRY pListEntry) 585 644 { 645 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 586 646 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER); 587 647 … … 589 649 RT_ZERO(Msg); 590 650 591 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,651 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 592 652 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY); 593 653 … … 597 657 598 658 Msg.szName.SetPtr(pListEntry->pszName, pListEntry->cbName); 599 Msg.cbInfo.SetUInt32( 0);659 Msg.cbInfo.SetUInt32(pListEntry->cbInfo); 600 660 Msg.pvInfo.SetPtr(pListEntry->pvInfo, pListEntry->cbInfo); 601 661 … … 610 670 } 611 671 612 VBGLR3DECL(int) VbglR3ClipboardListEntryReadRecvReq(HGCMCLIENTID idClient, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfInfo) 613 { 672 VBGLR3DECL(int) VbglR3ClipboardListEntryReadRecvReq(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfInfo) 673 { 674 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 614 675 AssertPtrReturn(phList, VERR_INVALID_POINTER); 615 676 AssertPtrReturn(pfInfo, VERR_INVALID_POINTER); … … 618 679 RT_ZERO(Msg); 619 680 620 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,621 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_READ _REQ);681 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 682 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_READ); 622 683 623 684 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ); … … 637 698 } 638 699 639 VBGLR3DECL(int) VbglR3ClipboardListEntryWrite( HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList,700 VBGLR3DECL(int) VbglR3ClipboardListEntryWrite(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList, 640 701 PVBOXCLIPBOARDLISTENTRY pListEntry) 641 702 { 703 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 642 704 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER); 643 705 … … 645 707 RT_ZERO(Msg); 646 708 647 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,709 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 648 710 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY); 649 711 … … 662 724 } 663 725 664 VBGLR3DECL(int) VbglR3ClipboardEventGetNext(HGCMCLIENTID idClient, PSHAREDCLIPBOARDURITRANSFER pTransfer, 726 VBGLR3DECL(int) VbglR3ClipboardObjOpenRecv(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDOBJOPENCREATEPARMS pCreateParms) 727 { 728 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 729 AssertPtrReturn(pCreateParms, VERR_INVALID_POINTER); 730 731 VBoxClipboardObjOpenMsg Msg; 732 RT_ZERO(Msg); 733 734 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 735 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_OPEN); 736 737 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN); 738 Msg.cbPath.SetUInt64(pCreateParms->cbPath); 739 Msg.szPath.SetPtr(pCreateParms->pszPath, pCreateParms->cbPath); 740 Msg.fCreate.SetUInt32(0); 741 Msg.objInfo.SetPtr(&pCreateParms->ObjInfo, sizeof(pCreateParms->ObjInfo)); 742 743 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 744 if (RT_SUCCESS(rc)) 745 { 746 rc = Msg.cbPath.GetUInt32(&pCreateParms->cbPath); 747 if (RT_SUCCESS(rc)) 748 rc = Msg.fCreate.GetUInt32(&pCreateParms->fCreate); 749 } 750 751 LogFlowFuncLeaveRC(rc); 752 return rc; 753 } 754 755 VBGLR3DECL(int) VbglR3ClipboardObjOpenReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDOBJHANDLE hObj) 756 { 757 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 758 759 VBoxClipboardReplyMsg Msg; 760 RT_ZERO(Msg); 761 762 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 763 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6); 764 765 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 766 Msg.enmType.SetUInt32(VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_OPEN); 767 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ 768 Msg.cbPayload.SetUInt32(0); 769 Msg.pvPayload.SetPtr(0, NULL); 770 771 Msg.u.ObjOpen.uHandle.SetUInt64(hObj); 772 773 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 774 775 LogFlowFuncLeaveRC(rc); 776 return rc; 777 } 778 779 VBGLR3DECL(int) VbglR3ClipboardObjOpenSend(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDOBJOPENCREATEPARMS pCreateParms, 780 PSHAREDCLIPBOARDOBJHANDLE phObj) 781 { 782 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 783 AssertPtrReturn(pCreateParms, VERR_INVALID_POINTER); 784 AssertPtrReturn(phObj, VERR_INVALID_POINTER); 785 786 VBoxClipboardObjOpenMsg Msg; 787 RT_ZERO(Msg); 788 789 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 790 VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_OPEN, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_OPEN); 791 792 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 793 Msg.uHandle.SetUInt64(0); 794 Msg.cbPath.SetUInt32(pCreateParms->cbPath); 795 Msg.szPath.SetPtr((void *)pCreateParms->pszPath, pCreateParms->cbPath + 1 /* Include terminating zero */); 796 Msg.fCreate.SetUInt32(pCreateParms->fCreate); 797 Msg.objInfo.SetPtr((void *)&pCreateParms->ObjInfo, sizeof(pCreateParms->ObjInfo)); 798 799 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 800 if (RT_SUCCESS(rc)) 801 { 802 Msg.uHandle.GetUInt64(phObj); 803 } 804 805 LogFlowFuncLeaveRC(rc); 806 return rc; 807 } 808 809 VBGLR3DECL(int) VbglR3ClipboardObjCloseRecv(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDOBJHANDLE phObj) 810 { 811 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 812 AssertPtrReturn(phObj, VERR_INVALID_POINTER); 813 814 VBoxClipboardObjCloseMsg Msg; 815 RT_ZERO(Msg); 816 817 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 818 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_CLOSE); 819 820 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN); 821 Msg.uHandle.SetUInt64(0); 822 823 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 824 if (RT_SUCCESS(rc)) 825 { 826 rc = Msg.uHandle.GetUInt64(phObj); 827 } 828 829 LogFlowFuncLeaveRC(rc); 830 return rc; 831 } 832 833 VBGLR3DECL(int) VbglR3ClipboardObjCloseReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDOBJHANDLE hObj) 834 { 835 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 836 837 VBoxClipboardReplyMsg Msg; 838 RT_ZERO(Msg); 839 840 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 841 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6); 842 843 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 844 Msg.enmType.SetUInt32(VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_CLOSE); 845 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ 846 Msg.cbPayload.SetUInt32(0); 847 Msg.pvPayload.SetPtr(0, NULL); 848 849 Msg.u.ObjClose.uHandle.SetUInt64(hObj); 850 851 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 852 853 LogFlowFuncLeaveRC(rc); 854 return rc; 855 } 856 857 VBGLR3DECL(int) VbglR3ClipboardObjCloseSend(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDOBJHANDLE hObj) 858 { 859 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 860 861 VBoxClipboardObjCloseMsg Msg; 862 RT_ZERO(Msg); 863 864 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 865 VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_CLOSE, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_CLOSE); 866 867 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 868 Msg.uHandle.SetUInt64(hObj); 869 870 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 871 872 LogFlowFuncLeaveRC(rc); 873 return rc; 874 } 875 876 VBGLR3DECL(int) VbglR3ClipboardObjReadRecv(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDOBJHANDLE phObj, uint32_t *pcbToRead, 877 uint32_t *pfFlags) 878 { 879 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 880 AssertPtrReturn(phObj, VERR_INVALID_POINTER); 881 AssertPtrReturn(pcbToRead, VERR_INVALID_POINTER); 882 AssertPtrReturn(pfFlags, VERR_INVALID_POINTER); 883 884 VBoxClipboardObjReadReqMsg Msg; 885 RT_ZERO(Msg); 886 887 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 888 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ_REQ); 889 890 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ); 891 Msg.ReqParms.uHandle.SetUInt64(0); 892 Msg.ReqParms.cbToRead.SetUInt32(0); 893 Msg.ReqParms.fRead.SetUInt32(0); 894 895 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 896 if (RT_SUCCESS(rc)) 897 { 898 rc = Msg.ReqParms.uHandle.GetUInt64(phObj); 899 if (RT_SUCCESS(rc)) 900 rc = Msg.ReqParms.cbToRead.GetUInt32(pcbToRead); 901 if (RT_SUCCESS(rc)) 902 rc = Msg.ReqParms.fRead.GetUInt32(pfFlags); 903 } 904 905 LogFlowFuncLeaveRC(rc); 906 return rc; 907 } 908 909 VBGLR3DECL(int) VbglR3ClipboardObjReadSend(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDOBJHANDLE hObj, 910 void *pvData, uint32_t cbData, uint32_t *pcbRead) 911 { 912 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 913 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 914 AssertReturn(cbData, VERR_INVALID_PARAMETER); 915 /* pcbRead is optional. */ 916 917 VBoxClipboardObjReadWriteMsg Msg; 918 RT_ZERO(Msg); 919 920 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_READ, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ); 921 922 Msg.uContext.SetUInt32(0); 923 Msg.uHandle.SetUInt64(hObj); 924 Msg.pvData.SetPtr(pvData, cbData); 925 Msg.cbData.SetUInt32(0); 926 Msg.pvChecksum.SetPtr(NULL, 0); 927 Msg.cbChecksum.SetUInt32(0); 928 929 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 930 if (RT_SUCCESS(rc)) 931 { 932 /** @todo Context ID not used yet. */ 933 /** @todo Add checksum support. */ 934 935 if (pcbRead) 936 { 937 rc = Msg.cbData.GetUInt32(pcbRead); AssertRC(rc); 938 AssertReturn(cbData >= *pcbRead, VERR_TOO_MUCH_DATA); 939 } 940 } 941 942 LogFlowFuncLeaveRC(rc); 943 return rc; 944 } 945 946 VBGLR3DECL(int) VbglR3ClipboardObjWriteSend(PVBGLR3SHCLCMDCTX pCtx, 947 SHAREDCLIPBOARDOBJHANDLE hObj, 948 void *pvData, uint32_t cbData, uint32_t *pcbWritten) 949 { 950 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 951 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 952 AssertReturn(cbData, VERR_INVALID_PARAMETER); 953 /* pcbWritten is optional. */ 954 955 VBoxClipboardObjReadWriteMsg Msg; 956 RT_ZERO(Msg); 957 958 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_WRITE); 959 960 Msg.uContext.SetUInt32(0); 961 Msg.uHandle.SetUInt64(hObj); 962 Msg.pvData.SetPtr(pvData, cbData); 963 Msg.cbData.SetUInt32(cbData); 964 Msg.pvChecksum.SetPtr(NULL, 0); /** @todo Implement this. */ 965 Msg.cbChecksum.SetUInt32(0); /** @todo Implement this. */ 966 967 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 968 if (RT_SUCCESS(rc)) 969 { 970 if (pcbWritten) 971 *pcbWritten = cbData; 972 } 973 974 LogFlowFuncLeaveRC(rc); 975 return rc; 976 } 977 978 VBGLR3DECL(int) VbglR3ClipboardEventGetNext(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDURITRANSFER pTransfer, 665 979 PVBGLR3CLIPBOARDEVENT *ppEvent) 666 980 { 981 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 667 982 AssertPtrReturn(pTransfer, VERR_INVALID_POINTER); 668 983 AssertPtrReturn(ppEvent, VERR_INVALID_POINTER); … … 674 989 uint32_t uMsg = 0; 675 990 uint32_t cParms = 0; 676 int rc = vbglR3ClipboardMsgPeekWait(idClient, &uMsg, &cParms, NULL /* pidRestoreCheck */); 677 if (RT_SUCCESS(rc)) 678 { 679 LogFunc(("Handling uMsg=%RU32\n", uMsg)); 680 991 int rc = vbglR3ClipboardMsgPeekWait(pCtx, &uMsg, &cParms, NULL /* pidRestoreCheck */); 992 if (RT_SUCCESS(rc)) 993 { 994 #ifdef LOG_ENABLED 995 LogFunc(("Handling uMsg=%RU32 (%s)\n", uMsg, VBoxClipboardHostMsgToStr(uMsg))); 996 #endif 681 997 switch (uMsg) 682 998 { 683 999 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 684 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT S:1000 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ: 685 1001 { 686 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOTS\n")); 687 688 VBOXCLIPBOARDROOTS Roots; 689 rc = SharedClipboardURIRootsInit(&Roots); 1002 uint32_t fRoots; 1003 rc = VbglR3ClipboardRootListHdrReadReq(pCtx, &fRoots); 1004 1005 /** @todo Validate / handle fRoots. */ 1006 690 1007 if (RT_SUCCESS(rc)) 691 1008 { 692 rc = VbglR3ClipboardRootsRecv(idClient, &Roots); 1009 VBOXCLIPBOARDROOTLISTHDR rootListHdr; 1010 RT_ZERO(rootListHdr); 1011 1012 rootListHdr.cRoots = SharedClipboardURILTransferRootsCount(pTransfer); 1013 1014 LogFlowFunc(("cRoots=%RU32\n", rootListHdr.cRoots)); 1015 1016 rc = VbglR3ClipboardRootListHdrReadReply(pCtx, &rootListHdr); 1017 } 1018 break; 1019 } 1020 1021 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_ENTRY_READ: 1022 { 1023 uint32_t uIndex; 1024 uint32_t fInfo; 1025 rc = VbglR3ClipboardRootListEntryReadReq(pCtx, &uIndex, &fInfo); 1026 if (RT_SUCCESS(rc)) 1027 { 1028 VBOXCLIPBOARDLISTENTRY rootListEntry; 1029 rc = SharedClipboardURILTransferRootsEntry(pTransfer, uIndex, &rootListEntry); 693 1030 if (RT_SUCCESS(rc)) 694 { 695 /** @todo Handle Roots.fRoots flags. */ 696 697 char *pszRoots = NULL; 698 uint32_t cRoots = 0; 699 rc = SharedClipboardURILTransferGetRoots(pTransfer, &pszRoots, &cRoots); 700 if (RT_SUCCESS(rc)) 701 { 702 /** @todo Split up transfers in _64K each. */ 703 704 const uint32_t cbRoots = pszRoots 705 ? (uint32_t)strlen(pszRoots) + 1 /* Include termination. */ 706 : 0; 707 708 rc = VbglR3ClipboardRootsWrite(idClient, cRoots, pszRoots, cbRoots); 709 } 710 } 1031 rc = VbglR3ClipboardRootListEntryReadReply(pCtx, uIndex, &rootListEntry); 711 1032 } 712 713 1033 break; 714 1034 } … … 722 1042 if (RT_SUCCESS(rc)) 723 1043 { 724 rc = VbglR3ClipboardListOpenRecv( idClient, &openParmsList);1044 rc = VbglR3ClipboardListOpenRecv(pCtx, &openParmsList); 725 1045 if (RT_SUCCESS(rc)) 726 1046 { … … 731 1051 732 1052 /* Reply in any case. */ 733 int rc2 = VbglR3ClipboardListOpenReply( idClient, rc, hList);1053 int rc2 = VbglR3ClipboardListOpenReply(pCtx, rc, hList); 734 1054 AssertRC(rc2); 735 1055 … … 746 1066 747 1067 SHAREDCLIPBOARDLISTHANDLE hList; 748 rc = VbglR3ClipboardListCloseRecv( idClient, &hList);1068 rc = VbglR3ClipboardListCloseRecv(pCtx, &hList); 749 1069 if (RT_SUCCESS(rc)) 750 1070 { … … 752 1072 753 1073 /* Reply in any case. */ 754 int rc2 = VbglR3ClipboardListCloseReply( idClient, rc, hList);1074 int rc2 = VbglR3ClipboardListCloseReply(pCtx, rc, hList); 755 1075 AssertRC(rc2); 756 1076 } … … 767 1087 SHAREDCLIPBOARDLISTHANDLE hList = SHAREDCLIPBOARDLISTHANDLE_INVALID; 768 1088 uint32_t fFlags = 0; 769 rc = VbglR3ClipboardListHdrReadRecvReq( idClient, &hList, &fFlags);1089 rc = VbglR3ClipboardListHdrReadRecvReq(pCtx, &hList, &fFlags); 770 1090 if (RT_SUCCESS(rc)) 771 1091 { … … 774 1094 if (RT_SUCCESS(rc)) 775 1095 { 776 rc = VbglR3ClipboardListHdrWrite(idClient, hList, &hdrList); 1096 rc = VbglR3ClipboardListHdrWrite(pCtx, hList, &hdrList); 1097 777 1098 SharedClipboardURIListHdrDestroy(&hdrList); 778 1099 } … … 791 1112 if (RT_SUCCESS(rc)) 792 1113 { 793 rc = VBglR3ClipboardListHdrRecv( idClient, )1114 rc = VBglR3ClipboardListHdrRecv(pCtx, ) 794 1115 } 795 1116 break; … … 807 1128 SHAREDCLIPBOARDLISTHANDLE hList; 808 1129 uint32_t fInfo; 809 rc = VbglR3ClipboardListEntryReadRecvReq( idClient, &hList, &fInfo);1130 rc = VbglR3ClipboardListEntryReadRecvReq(pCtx, &hList, &fInfo); 810 1131 if (RT_SUCCESS(rc)) 811 1132 { … … 816 1137 Assert(entryList.cbInfo == sizeof(SHAREDCLIPBOARDFSOBJINFO)); 817 1138 1139 RT_NOREF(pObjInfo); 1140 818 1141 LogFlowFunc(("\t%s (%RU64 bytes)\n", entryList.pszName, pObjInfo->cbObject)); 819 1142 820 rc = VbglR3ClipboardListEntryWrite( idClient, hList, &entryList);1143 rc = VbglR3ClipboardListEntryWrite(pCtx, hList, &entryList); 821 1144 } 822 1145 } … … 840 1163 { 841 1164 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN\n")); 842 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_URI_OBJ_OPEN; 1165 1166 VBOXCLIPBOARDOBJOPENCREATEPARMS createParms; 1167 rc = VbglR3ClipboardObjOpenRecv(pCtx, &createParms); 1168 if (RT_SUCCESS(rc)) 1169 { 1170 SHAREDCLIPBOARDOBJHANDLE hObj; 1171 rc = SharedClipboardURIObjectOpen(pTransfer, &createParms, &hObj); 1172 if (RT_SUCCESS(rc)) 1173 { 1174 int rc2 = VbglR3ClipboardObjOpenReply(pCtx, rc, hObj); 1175 AssertRC(rc2); 1176 } 1177 } 1178 843 1179 break; 844 1180 } … … 847 1183 { 848 1184 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_CLOSE\n")); 849 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_URI_OBJ_CLOSE; 1185 1186 SHAREDCLIPBOARDOBJHANDLE hObj; 1187 rc = VbglR3ClipboardObjCloseRecv(pCtx, &hObj); 1188 if (RT_SUCCESS(rc)) 1189 { 1190 rc = SharedClipboardURIObjectClose(hObj); 1191 1192 /* Reply in any case. */ 1193 int rc2 = VbglR3ClipboardObjCloseReply(pCtx, rc, hObj); 1194 AssertRC(rc2); 1195 } 850 1196 break; 851 1197 } … … 854 1200 { 855 1201 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ\n")); 856 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_URI_OBJ_READ; 1202 1203 SHAREDCLIPBOARDOBJHANDLE hObj; 1204 uint32_t cbBuf; 1205 uint32_t fFlags; 1206 rc = VbglR3ClipboardObjReadRecv(pCtx, &hObj, &cbBuf, &fFlags); 1207 if (RT_SUCCESS(rc)) 1208 { 1209 void *pvBuf = RTMemAlloc(RT_MIN(cbBuf, _64K)); /** @todo Make this more flexible. */ 1210 if (pvBuf) 1211 { 1212 uint32_t cbRead; 1213 rc = SharedClipboardURIObjectRead(hObj, pvBuf, cbBuf, &cbRead, fFlags); 1214 if (RT_SUCCESS(rc)) 1215 rc = VbglR3ClipboardObjReadSend(pCtx, hObj, pvBuf, cbRead, NULL /* pcbWritten */); 1216 1217 RTMemFree(pvBuf); 1218 } 1219 else 1220 rc = VERR_NO_MEMORY; 1221 } 857 1222 break; 858 1223 } … … 862 1227 { 863 1228 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_WRITE\n")); 864 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_URI_OBJ_WRITE;865 1229 break; 866 1230 } … … 886 1250 { 887 1251 /* Report error back to the host. */ 888 //VbglR3ClipboardWriteError(idClient, rc); 1252 int rc2 = VbglR3ClipboardWriteError(pCtx->uClientID, rc); 1253 Assert(rc2); 889 1254 890 1255 VbglR3ClipboardEventFree(pEvent); … … 1004 1369 } 1005 1370 #endif 1006 1007 VBGLR3DECL(int) VbglR3ClipboardObjOpen(HGCMCLIENTID idClient,1008 const char *pszPath, PVBOXCLIPBOARDCREATEPARMS pCreateParms,1009 PSHAREDCLIPBOARDOBJHANDLE phObj)1010 {1011 AssertPtrReturn(pszPath, VERR_INVALID_POINTER);1012 AssertPtrReturn(pCreateParms, VERR_INVALID_POINTER);1013 AssertPtrReturn(phObj, VERR_INVALID_POINTER);1014 1015 VBoxClipboardObjOpenMsg Msg;1016 RT_ZERO(Msg);1017 1018 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,1019 VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_OPEN, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_OPEN);1020 1021 int rc;1022 1023 char *pszPathTmp = RTStrDup(pszPath);1024 if (pszPathTmp)1025 {1026 Msg.szPath.SetPtr((void *)pszPathTmp, (uint32_t)strlen(pszPathTmp) + 1 /* Include terminating zero */);1027 Msg.parms.SetPtr(pCreateParms, sizeof(VBOXCLIPBOARDCREATEPARMS));1028 1029 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));1030 if (RT_SUCCESS(rc))1031 {1032 *phObj = pCreateParms->uHandle;1033 }1034 1035 RTStrFree(pszPathTmp);1036 }1037 else1038 rc = VERR_NO_MEMORY;1039 1040 LogFlowFuncLeaveRC(rc);1041 return rc;1042 }1043 1044 VBGLR3DECL(int) VbglR3ClipboardObjClose(HGCMCLIENTID idClient, SHAREDCLIPBOARDOBJHANDLE hObj)1045 {1046 VBoxClipboardObjCloseMsg Msg;1047 RT_ZERO(Msg);1048 1049 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,1050 VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_CLOSE, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_CLOSE);1051 1052 Msg.uHandle.SetUInt64(hObj);1053 1054 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));1055 1056 LogFlowFuncLeaveRC(rc);1057 return rc;1058 }1059 1060 VBGLR3DECL(int) VbglR3ClipboardObjRead(HGCMCLIENTID idClient, SHAREDCLIPBOARDOBJHANDLE hObj,1061 void *pvData, uint32_t cbData, uint32_t *pcbRead)1062 {1063 AssertPtrReturn(pvData, VERR_INVALID_POINTER);1064 AssertReturn(cbData, VERR_INVALID_PARAMETER);1065 /* pcbRead is optional. */1066 1067 VBoxClipboardObjReadWriteMsg Msg;1068 RT_ZERO(Msg);1069 1070 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_READ, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ);1071 1072 Msg.uContext.SetUInt32(0);1073 Msg.uHandle.SetUInt64(hObj);1074 Msg.pvData.SetPtr(pvData, cbData);1075 Msg.cbData.SetUInt32(0);1076 Msg.pvChecksum.SetPtr(NULL, 0);1077 Msg.cbChecksum.SetUInt32(0);1078 1079 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));1080 if (RT_SUCCESS(rc))1081 {1082 /** @todo Context ID not used yet. */1083 /** @todo Add checksum support. */1084 1085 if (pcbRead)1086 {1087 rc = Msg.cbData.GetUInt32(pcbRead); AssertRC(rc);1088 AssertReturn(cbData >= *pcbRead, VERR_TOO_MUCH_DATA);1089 }1090 }1091 1092 LogFlowFuncLeaveRC(rc);1093 return rc;1094 }1095 1096 VBGLR3DECL(int) VbglR3ClipboardObjWrite(HGCMCLIENTID idClient,1097 SHAREDCLIPBOARDOBJHANDLE hObj,1098 void *pvData, uint32_t cbData, uint32_t *pcbWritten)1099 {1100 AssertPtrReturn(pvData, VERR_INVALID_POINTER);1101 AssertReturn(cbData, VERR_INVALID_PARAMETER);1102 /* pcbWritten is optional. */1103 1104 VBoxClipboardObjReadWriteMsg Msg;1105 RT_ZERO(Msg);1106 1107 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_WRITE);1108 1109 Msg.uContext.SetUInt32(0);1110 Msg.uHandle.SetUInt64(hObj);1111 Msg.pvData.SetPtr(pvData, cbData);1112 Msg.cbData.SetUInt32(cbData);1113 Msg.pvChecksum.SetPtr(NULL, 0); /** @todo Implement this. */1114 Msg.cbChecksum.SetUInt32(0); /** @todo Implement this. */1115 1116 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));1117 if (RT_SUCCESS(rc))1118 {1119 if (pcbWritten)1120 *pcbWritten = cbData;1121 }1122 1123 LogFlowFuncLeaveRC(rc);1124 return rc;1125 }1126 1371 #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */ 1127 1372
Note:
See TracChangeset
for help on using the changeset viewer.