Changeset 81445 in vbox for trunk/src/VBox/HostServices/SharedClipboard
- Timestamp:
- Oct 22, 2019 10:23:38 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134163
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r81443 r81445 427 427 * @param paDstParms The peek parameter vector. 428 428 * @param cDstParms The number of peek parameters (at least two). 429 */ 430 int shclSvcMsgSetGetHostMsgOldReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms) 429 * @param pfRemove Returns whether the message can be removed from the queue or not. 430 * This is needed for certain messages which need to stay around for more than one (guest) call. 431 */ 432 int shclSvcMsgSetGetHostMsgOldReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms, 433 bool *pfRemove) 431 434 { 432 435 AssertPtrReturn(pMsg, VERR_INVALID_POINTER); 433 436 AssertPtrReturn(paDstParms, VERR_INVALID_POINTER); 434 437 AssertReturn (cDstParms >= 2, VERR_INVALID_PARAMETER); 438 AssertPtrReturn(pfRemove, VERR_INVALID_POINTER); 435 439 436 440 int rc = VINF_SUCCESS; 441 442 bool fRemove = true; 443 444 LogFlowFunc(("uMsg=%RU32 (%s), cParms=%RU32\n", 445 pMsg->uMsg, ShClHostMsgToStr(pMsg->uMsg), pMsg->cParms)); 437 446 438 447 switch (pMsg->uMsg) … … 449 458 HGCMSvcSetU32(&paDstParms[0], VBOX_SHCL_HOST_MSG_READ_DATA); 450 459 AssertBreakStmt(pMsg->cParms >= 2, rc = VERR_INVALID_PARAMETER); /* Paranoia. */ 451 uint32_t uFmt; 452 rc = HGCMSvcGetU32(&pMsg->paParms[1] /* uFormat */, &uFmt); 460 uint32_t uSrcFmt = VBOX_SHCL_FMT_NONE; 461 uint32_t uDstFmt = VBOX_SHCL_FMT_NONE; 462 rc = HGCMSvcGetU32(&pMsg->paParms[1] /* uFormat */, &uSrcFmt); 453 463 if (RT_SUCCESS(rc)) 454 HGCMSvcSetU32(&paDstParms[1], uFmt); 464 { 465 if (uSrcFmt & VBOX_SHCL_FMT_UNICODETEXT) 466 uDstFmt = VBOX_SHCL_FMT_UNICODETEXT; 467 else if (uSrcFmt & VBOX_SHCL_FMT_BITMAP) 468 uDstFmt = VBOX_SHCL_FMT_BITMAP; 469 else if (uSrcFmt & VBOX_SHCL_FMT_HTML) 470 uDstFmt = VBOX_SHCL_FMT_HTML; 471 else 472 AssertStmt(uSrcFmt == VBOX_SHCL_FMT_NONE, uSrcFmt = VBOX_SHCL_FMT_NONE); 473 474 /* Remove format we're going to return from the queued message. */ 475 uSrcFmt &= ~uDstFmt; 476 HGCMSvcSetU32(&pMsg->paParms[1], uSrcFmt); 477 478 /* Only report back one format at a time. */ 479 HGCMSvcSetU32(&paDstParms[1], uDstFmt); 480 481 /* If no more formats are left, the message can be removed finally. */ 482 fRemove = uSrcFmt == VBOX_SHCL_FMT_NONE; 483 484 LogFlowFunc(("uSrcFmt=0x%x, fRemove=%RTbool\n", uSrcFmt, fRemove)); 485 } 455 486 break; 456 487 } … … 472 503 break; 473 504 } 505 506 *pfRemove = fRemove; 474 507 475 508 LogFlowFuncLeaveRC(rc); … … 780 813 pFirstMsg->cParms)); 781 814 782 rc = shclSvcMsgSetGetHostMsgOldReturn(pFirstMsg, paParms, cParms); 815 bool fRemove; 816 rc = shclSvcMsgSetGetHostMsgOldReturn(pFirstMsg, paParms, cParms, &fRemove); 783 817 if (RT_SUCCESS(rc)) 784 818 { 785 819 AssertPtr(g_pHelpers); 786 820 rc = g_pHelpers->pfnCallComplete(hCall, rc); 787 if (rc != VERR_CANCELLED) 821 if ( rc != VERR_CANCELLED 822 && fRemove) 788 823 { 789 824 pClient->queueMsg.removeFirst(); … … 975 1010 else if (pClient->Pending.uType == VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD) /* Legacy */ 976 1011 { 977 rc = shclSvcMsgSetGetHostMsgOldReturn(pFirstMsg, pClient->Pending.paParms, pClient->Pending.cParms); 1012 bool fRemove; 1013 rc = shclSvcMsgSetGetHostMsgOldReturn(pFirstMsg, pClient->Pending.paParms, pClient->Pending.cParms, 1014 &fRemove); 978 1015 if (RT_SUCCESS(rc)) 979 1016 { 980 /* The old (legacy) protocol gets the message right when returning from peeking, so 981 * remove the actual message from our queue right now. */ 982 pClient->queueMsg.removeFirst(); 983 shclSvcMsgFree(pFirstMsg); 1017 if (fRemove) 1018 { 1019 /* The old (legacy) protocol gets the message right when returning from peeking, so 1020 * remove the actual message from our queue right now. */ 1021 pClient->queueMsg.removeFirst(); 1022 shclSvcMsgFree(pFirstMsg); 1023 } 984 1024 985 1025 fDonePending = true;
Note:
See TracChangeset
for help on using the changeset viewer.