Changeset 82880 in vbox for trunk/src/VBox
- Timestamp:
- Jan 27, 2020 5:52:41 PM (5 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r82870 r82880 362 362 if (pMem) 363 363 { 364 SHCLDATABLOCK dataBlock;365 RT_ZERO(dataBlock);366 367 dataBlock.cbData = cbPrealloc;368 dataBlock.pvData = pMem;369 dataBlock.uFormat = fFormat;370 371 364 /* Read the host data to the preallocated buffer. */ 372 int rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, &dataBlock, &cb);365 int rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, fFormat, pMem, cbPrealloc, &cb); 373 366 if (RT_SUCCESS(rc)) 374 367 { … … 395 388 if (pMem) 396 389 { 397 dataBlock.cbData = cb;398 dataBlock.pvData = pMem;399 400 390 /* Read the host data to the preallocated buffer. */ 401 391 uint32_t cbNew = 0; 402 rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, &dataBlock, &cbNew);392 rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, fFormat, pMem, cb, &cbNew); 403 393 if ( RT_SUCCESS(rc) 404 394 && cbNew <= cb) … … 580 570 if (lp != NULL) 581 571 { 582 SHCLDATABLOCK dataBlock; 583 RT_ZERO(dataBlock); 584 585 dataBlock.uFormat = fFormat; 586 dataBlock.pvData = lp; 587 dataBlock.cbData = (uint32_t)GlobalSize(hClip); 588 589 rc = VbglR3ClipboardWriteDataEx(&pEvent->cmdCtx, &dataBlock); 572 rc = VbglR3ClipboardWriteDataEx(&pEvent->cmdCtx, fFormat, lp, (uint32_t)GlobalSize(hClip)); 590 573 591 574 GlobalUnlock(hClip); … … 605 588 if (uniString != NULL) 606 589 { 607 SHCLDATABLOCK dataBlock; 608 RT_ZERO(dataBlock); 609 610 dataBlock.uFormat = fFormat; 611 dataBlock.pvData = uniString; 612 dataBlock.cbData = ((uint32_t)lstrlenW(uniString) + 1) * 2; 613 614 rc = VbglR3ClipboardWriteDataEx(&pEvent->cmdCtx, &dataBlock); 590 rc = VbglR3ClipboardWriteDataEx(&pEvent->cmdCtx, 591 fFormat, uniString, ((uint32_t)lstrlenW(uniString) + 1) * 2); 615 592 616 593 GlobalUnlock(hClip); … … 631 608 { 632 609 LPVOID lp = GlobalLock(hClip); 633 634 610 if (lp != NULL) 635 611 { 636 SHCLDATABLOCK dataBlock; 637 RT_ZERO(dataBlock); 638 639 dataBlock.uFormat = fFormat; 640 dataBlock.pvData = lp; 641 dataBlock.cbData = (uint32_t)GlobalSize(hClip); 642 643 rc = VbglR3ClipboardWriteDataEx(&pEvent->cmdCtx, &dataBlock); 612 rc = VbglR3ClipboardWriteDataEx(&pEvent->cmdCtx, fFormat, lp, (uint32_t)GlobalSize(hClip)); 644 613 645 614 GlobalUnlock(hClip); -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r82852 r82880 453 453 * 454 454 * @returns VBox status code. 455 * @retval VINF_BUFFER_OVERFLOW 455 * @retval VINF_BUFFER_OVERFLOW If there is more data available than the caller provided buffer space for. 456 456 * 457 457 * @param pCtx The command context returned by VbglR3ClipboardConnectEx(). 458 * @param pData Where to store the clipboard data read. 458 * @param uFormat Clipboard format of clipboard data to be read. 459 * @param pvData Buffer where to store the read data. 460 * @param cbData Size (in bytes) of data buffer where to store the read data. 459 461 * @param pcbRead The actual size of the host clipboard data. 460 462 */ 461 VBGLR3DECL(int) VbglR3ClipboardReadDataEx(PVBGLR3SHCLCMDCTX pCtx, PSHCLDATABLOCK pData, uint32_t *pcbRead) 462 { 463 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 464 AssertPtrReturn(pData, VERR_INVALID_POINTER); 465 return VbglR3ClipboardReadData(pCtx->idClient, pData->uFormat, pData->pvData, pData->cbData, pcbRead); 463 VBGLR3DECL(int) VbglR3ClipboardReadDataEx(PVBGLR3SHCLCMDCTX pCtx, 464 SHCLFORMAT uFormat, void *pvData, uint32_t cbData, uint32_t *pcbRead) 465 { 466 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 467 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 468 return VbglR3ClipboardReadData(pCtx->idClient, uFormat, pvData, cbData, pcbRead); 466 469 } 467 470 … … 2543 2546 * @returns VBox status code. 2544 2547 * @param pCtx The command context returned by VbglR3ClipboardConnectEx(). 2545 * @param pData Clipboard data to send. 2546 */ 2547 VBGLR3DECL(int) VbglR3ClipboardWriteDataEx(PVBGLR3SHCLCMDCTX pCtx, PSHCLDATABLOCK pData) 2548 { 2549 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 2550 AssertPtrReturn(pData, VERR_INVALID_POINTER); 2548 * @param uFormat Clipboard format to send. 2549 * @param pvData Pointer to data to send. 2550 * @param cbData Size (in bytes) of data to send. 2551 */ 2552 VBGLR3DECL(int) VbglR3ClipboardWriteDataEx(PVBGLR3SHCLCMDCTX pCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData) 2553 { 2554 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 2555 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 2551 2556 2552 2557 int rc; … … 2556 2561 if (pCtx->fUseLegacyProtocol) 2557 2562 { 2558 rc = VbglR3ClipboardWriteData(pCtx->idClient, pData->uFormat, pData->pvData, pData->cbData);2563 rc = VbglR3ClipboardWriteData(pCtx->idClient, uFormat, pvData, cbData); 2559 2564 } 2560 2565 else … … 2568 2573 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_DATA_WRITE, VBOX_SHCL_CPARMS_DATA_WRITE); 2569 2574 Msg.Parms.id64Context.SetUInt64(pCtx->idContext); 2570 Msg.Parms.f32Format.SetUInt32( pData->uFormat);2571 Msg.Parms.pData.SetPtr(p Data->pvData, pData->cbData);2575 Msg.Parms.f32Format.SetUInt32(uFormat); 2576 Msg.Parms.pData.SetPtr(pvData, cbData); 2572 2577 2573 2578 LogFlowFunc(("CID=%RU32\n", pCtx->idContext)); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-darwin.cpp
r82846 r82880 212 212 213 213 int ShClSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 214 PSHCLDATABLOCK pData, uint32_t *pcbActual)214 SHCLFORMAT uFormat, uint32_t cbData, void *pvData, uint32_t *pcbActual) 215 215 { 216 216 RT_NOREF(pCmdCtx); … … 222 222 223 223 int rc = readFromPasteboard(pClient->State.pCtx->pasteboard, 224 pData->uFormat, pData->pvData, pData->cbData, pcbActual);224 uFormat, pvData, cbData, pcbActual); 225 225 226 226 ShClSvcUnlock(); … … 230 230 231 231 int ShClSvcImplWriteData(PSHCLCLIENT pClient, 232 PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData)232 PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, uint32_t cbData, void *pvData) 233 233 { 234 234 RT_NOREF(pCmdCtx); … … 236 236 ShClSvcLock(); 237 237 238 writeToPasteboard(pClient->State.pCtx->pasteboard, p Data->pvData, pData->cbData, pData->uFormat);238 writeToPasteboard(pClient->State.pCtx->pasteboard, pvData, cbData, uFormat); 239 239 240 240 ShClSvcUnlock(); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r82872 r82880 242 242 */ 243 243 int ShClSvcDataReadRequest(PSHCLCLIENT pClient, SHCLFORMAT fFormat, PSHCLEVENTID pidEvent); 244 int ShClSvcDataReadSignal(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData);244 int ShClSvcDataReadSignal(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData); 245 245 int ShClSvcHostReportFormats(PSHCLCLIENT pClient, SHCLFORMATS fFormats); 246 246 uint32_t ShClSvcGetMode(void); … … 293 293 * @param pClient Shared Clipboard client context. 294 294 * @param pCmdCtx Shared Clipboard command context. 295 * @param pData Where to return the read clipboard data. 295 * @param uFormat Clipboard format to read. 296 * @param pvData Where to return the read clipboard data. 297 * @param cbData Size (in bytes) of buffer where to return the clipboard data. 296 298 * @param pcbActual Where to return the amount of bytes read. 297 299 */ 298 int ShClSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData, uint32_t *pcbActual);300 int ShClSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData, uint32_t *pcbActual); 299 301 /** 300 302 * Called when the guest writes clipboard data to the host. … … 303 305 * @param pClient Shared Clipboard client context. 304 306 * @param pCmdCtx Shared Clipboard command context. 305 * @param pData Clipboard data from the guest. 306 */ 307 int ShClSvcImplWriteData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData); 307 * @param uFormat Clipboard format to write. 308 * @param pvData Clipboard data to write. 309 * @param cbData Size (in bytes) of buffer clipboard data to write. 310 */ 311 int ShClSvcImplWriteData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData); 308 312 /** 309 313 * Called when synchronization of the clipboard contents of the host clipboard with the guest is needed. -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp
r82851 r82880 729 729 730 730 int ShClSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 731 PSHCLDATABLOCK pData, uint32_t *pcbActual)731 SHCLFORMAT uFormat, uint32_t cbData, void *pvData, uint32_t *pcbActual) 732 732 { 733 733 AssertPtrReturn(pClient, VERR_INVALID_POINTER); 734 734 RT_NOREF(pCmdCtx); 735 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 735 736 AssertPtrReturn(pClient->State.pCtx, VERR_INVALID_POINTER); 736 737 737 LogFlowFunc(("uFormat=%02X\n", pData->uFormat));738 LogFlowFunc(("uFormat=%02X\n", uFormat)); 738 739 739 740 HANDLE hClip = NULL; … … 749 750 LogFunc(("Clipboard opened\n")); 750 751 751 if ( pData->uFormat & VBOX_SHCL_FMT_BITMAP)752 if (uFormat & VBOX_SHCL_FMT_BITMAP) 752 753 { 753 754 hClip = GetClipboardData(CF_DIB); … … 761 762 762 763 vboxClipboardSvcWinGetData(VBOX_SHCL_FMT_BITMAP, lp, GlobalSize(hClip), 763 p Data->pvData, pData->cbData, pcbActual);764 pvData, cbData, pcbActual); 764 765 765 766 GlobalUnlock(hClip); … … 771 772 } 772 773 } 773 else if ( pData->uFormat & VBOX_SHCL_FMT_UNICODETEXT)774 else if (uFormat & VBOX_SHCL_FMT_UNICODETEXT) 774 775 { 775 776 hClip = GetClipboardData(CF_UNICODETEXT); … … 783 784 784 785 vboxClipboardSvcWinGetData(VBOX_SHCL_FMT_UNICODETEXT, uniString, (lstrlenW(uniString) + 1) * 2, 785 p Data->pvData, pData->cbData, pcbActual);786 pvData, cbData, pcbActual); 786 787 787 788 GlobalUnlock(hClip); … … 793 794 } 794 795 } 795 else if ( pData->uFormat & VBOX_SHCL_FMT_HTML)796 else if (uFormat & VBOX_SHCL_FMT_HTML) 796 797 { 797 798 UINT format = RegisterClipboardFormat(SHCL_WIN_REGFMT_HTML); … … 806 807 /** @todo r=andy Add data overflow handling. */ 807 808 vboxClipboardSvcWinGetData(VBOX_SHCL_FMT_HTML, lp, GlobalSize(hClip), 808 p Data->pvData, pData->cbData, pcbActual);809 pvData, cbData, pcbActual); 809 810 #ifdef VBOX_STRICT 810 811 LogFlowFunc(("Raw HTML clipboard data from host:")); 811 ShClDbgDumpHtml((char *)p Data->pvData, pData->cbData);812 ShClDbgDumpHtml((char *)pvData, cbData); 812 813 #endif 813 814 GlobalUnlock(hClip); … … 821 822 } 822 823 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 823 else if ( pData->uFormat & VBOX_SHCL_FMT_URI_LIST)824 else if (uFormat & VBOX_SHCL_FMT_URI_LIST) 824 825 { 825 826 AssertFailed(); /** @todo */ … … 832 833 { 833 834 /* Reply with empty data. */ 834 vboxClipboardSvcWinGetData(0, NULL, 0, p Data->pvData, pData->cbData, pcbActual);835 vboxClipboardSvcWinGetData(0, NULL, 0, pvData, cbData, pcbActual); 835 836 } 836 837 … … 840 841 841 842 int ShClSvcImplWriteData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 842 PSHCLDATABLOCK pData)843 SHCLFORMAT uFormat, uint32_t cbData, void *pvData) 843 844 { 844 845 LogFlowFuncEnter(); 845 846 846 int rc = ShClSvcDataReadSignal(pClient, pCmdCtx, pData);847 int rc = ShClSvcDataReadSignal(pClient, pCmdCtx, uFormat, cbData, pvData); 847 848 848 849 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11-stubs.cpp
r81820 r82880 107 107 * @param pClient Context information about the guest VM 108 108 * @param pCmdCtx Command context to use. 109 * @param pData Data block to put read data into. 109 * @param uFormat Clipboard format to read. 110 * @param pvData Where to return the read clipboard data. 111 * @param cbData Size (in bytes) of buffer where to return the clipboard data. 110 112 * @param pcbActual Where to store the actual amount of data available. 111 113 */ 112 114 int SharedClipboardSvcImplReadData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 113 PSHCLDATABLOCK pData, uint32_t *pcbActual)115 SHCLFORMAT uFormat, void *pvData, uint32_t cbData, uint32_t *pcbActual) 114 116 { 115 RT_NOREF(pClient, pCmdCtx, pData);117 RT_NOREF(pClient, pCmdCtx, uFormat, pvData, cbData); 116 118 117 119 /* No data available. */ … … 122 124 123 125 int SharedClipboardSvcImplWriteData(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 124 PSHCLDATABLOCK pData)126 SHCLFORMAT uFormat, void *pvData, uint32_t cbData) 125 127 { 126 RT_NOREF(pClient, pCmdCtx, pData);128 RT_NOREF(pClient, pCmdCtx, uFormat, pvData, cbData); 127 129 return VERR_NOT_IMPLEMENTED; 128 130 } -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp
r82875 r82880 177 177 */ 178 178 int ShClSvcImplReadData(PSHCLCLIENT pClient, 179 PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData, uint32_t *pcbActual) 180 { 179 PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData, uint32_t *pcbActual) 180 { 181 AssertPtrReturn(pClient, VERR_INVALID_POINTER); 182 AssertPtrReturn(pCmdCtx, VERR_INVALID_POINTER); 183 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 184 181 185 RT_NOREF(pCmdCtx); 182 186 183 187 LogFlowFunc(("pClient=%p, uFormat=%02X, pv=%p, cb=%u, pcbActual=%p\n", 184 pClient, pData->uFormat, pData->pvData, pData->cbData, pcbActual));188 pClient, uFormat, pvData, cbData, pcbActual)); 185 189 186 190 int rc = VINF_SUCCESS; … … 189 193 if (pReq) 190 194 { 191 pReq->pv = p Data->pvData;192 pReq->cb = pData->cbData;195 pReq->pv = pvData; 196 pReq->cb = cbData; 193 197 pReq->pcbActual = pcbActual; 194 198 const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pClient->EventSrc); … … 196 200 if (idEvent != NIL_SHCLEVENTID) 197 201 { 198 rc = ShClX11ReadDataFromX11(&pClient->State.pCtx->X11, pData->uFormat, pReq);202 rc = ShClX11ReadDataFromX11(&pClient->State.pCtx->X11, uFormat, pReq); 199 203 if (RT_SUCCESS(rc)) 200 204 { … … 203 207 if (RT_SUCCESS(rc)) 204 208 { 205 memcpy(p Data->pvData, pPayload->pvData, RT_MIN(pData->cbData, pPayload->cbData));206 pData->cbData = (uint32_t)pPayload->cbData; /** @todo r=bird: Just ditch this data block wrapper, it made you forget to set pcbActual! */ 209 memcpy(pvData, pPayload->pvData, RT_MIN(cbData, pPayload->cbData)); 210 207 211 *pcbActual = (uint32_t)pPayload->cbData; 208 212 … … 227 231 228 232 int ShClSvcImplWriteData(PSHCLCLIENT pClient, 229 PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData)233 PSHCLCLIENTCMDCTX pCmdCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData) 230 234 { 231 235 AssertPtrReturn(pClient, VERR_INVALID_POINTER); 232 236 AssertPtrReturn(pCmdCtx, VERR_INVALID_POINTER); 233 AssertPtrReturn(p Data,VERR_INVALID_POINTER);237 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 234 238 235 239 LogFlowFunc(("pClient=%p, pv=%p, cb=%RU32, uFormat=%02X\n", 236 pClient, p Data->pvData, pData->cbData, pData->uFormat));237 238 int rc = ShClSvcDataReadSignal(pClient, pCmdCtx, pData);240 pClient, pvData, cbData, uFormat)); 241 242 int rc = ShClSvcDataReadSignal(pClient, pCmdCtx, uFormat, pvData, cbData); 239 243 240 244 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r82875 r82880 1250 1250 1251 1251 int ShClSvcDataReadSignal(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, 1252 PSHCLDATABLOCK pData)1252 SHCLFORMAT uFormat, void *pvData, uint32_t cbData) 1253 1253 { 1254 1254 AssertPtrReturn(pClient, VERR_INVALID_POINTER); 1255 1255 AssertPtrReturn(pCmdCtx, VERR_INVALID_POINTER); 1256 AssertPtrReturn(pData, VERR_INVALID_POINTER); 1256 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 1257 1258 RT_NOREF(uFormat); 1257 1259 1258 1260 LogFlowFuncEnter(); … … 1271 1273 1272 1274 PSHCLEVENTPAYLOAD pPayload = NULL; 1273 if ( pData->cbData)1274 rc = ShClPayloadAlloc(idEvent, p Data->pvData, pData->cbData, &pPayload);1275 if (cbData) 1276 rc = ShClPayloadAlloc(idEvent, pvData, cbData, &pPayload); 1275 1277 1276 1278 if (RT_SUCCESS(rc)) … … 1479 1481 } 1480 1482 1481 SHCLDATABLOCK dataBlock; 1483 SHCLFORMAT uFormat = VBOX_SHCL_FMT_NONE; 1484 uint32_t cbData = 0; 1485 void *pvData = NULL; 1486 1482 1487 ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_32BIT, VERR_WRONG_PARAMETER_TYPE); 1483 dataBlock.uFormat = paParms[iParm].u.uint32;1488 uFormat = paParms[iParm].u.uint32; 1484 1489 iParm++; 1485 1490 if (cParms != VBOX_SHCL_CPARMS_DATA_READ_61B) 1486 1491 { 1487 1492 ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_PTR, VERR_WRONG_PARAMETER_TYPE); /* Data buffer */ 1488 dataBlock.pvData = paParms[iParm].u.pointer.addr;1489 dataBlock.cbData = paParms[iParm].u.pointer.size;1493 pvData = paParms[iParm].u.pointer.addr; 1494 cbData = paParms[iParm].u.pointer.size; 1490 1495 iParm++; 1491 1496 ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_32BIT, VERR_WRONG_PARAMETER_TYPE); /*cbDataReturned*/ … … 1497 1502 iParm++; 1498 1503 ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_PTR, VERR_WRONG_PARAMETER_TYPE); /* Data buffer */ 1499 dataBlock.pvData = paParms[iParm].u.pointer.addr;1500 dataBlock.cbData = paParms[iParm].u.pointer.size;1504 pvData = paParms[iParm].u.pointer.addr; 1505 cbData = paParms[iParm].u.pointer.size; 1501 1506 iParm++; 1502 1507 } … … 1511 1516 { 1512 1517 if (pClient->State.POD.uFormat == VBOX_SHCL_FMT_NONE) 1513 pClient->State.POD.uFormat = dataBlock.uFormat;1518 pClient->State.POD.uFormat = uFormat; 1514 1519 } 1515 1520 … … 1526 1531 RT_ZERO(parms); 1527 1532 1528 parms.uFormat = dataBlock.uFormat;1529 parms.u.pvData = dataBlock.pvData;1530 parms.cbData = dataBlock.cbData;1533 parms.uFormat = uFormat; 1534 parms.u.pvData = pvData; 1535 parms.cbData = cbData; 1531 1536 1532 1537 g_ExtState.fReadingData = true; … … 1535 1540 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_DATA_READ, &parms, sizeof(parms)); 1536 1541 LogRelFlowFunc(("Shared Clipboard: DATA/Ext: fDelayedAnnouncement=%RTbool fDelayedFormats=%#x cbData=%RU32->%RU32 rc=%Rrc\n", 1537 g_ExtState.fDelayedAnnouncement, g_ExtState.fDelayedFormats, dataBlock.cbData, parms.cbData, rc));1542 g_ExtState.fDelayedAnnouncement, g_ExtState.fDelayedFormats, cbData, parms.cbData, rc)); 1538 1543 1539 1544 /* Did the extension send the clipboard formats yet? … … 1555 1560 else 1556 1561 { 1557 rc = ShClSvcImplReadData(pClient, &cmdCtx, &dataBlock, &cbActual);1558 LogRelFlowFunc(("Shared Clipboard: DATA/Host: cbData=%RU32->%RU32 rc=%Rrc\n", dataBlock.cbData, cbActual, rc));1562 rc = ShClSvcImplReadData(pClient, &cmdCtx, uFormat, pvData, cbData, &cbActual); 1563 LogRelFlowFunc(("Shared Clipboard: DATA/Host: cbData=%RU32->%RU32 rc=%Rrc\n", cbData, cbActual, rc)); 1559 1564 } 1560 1565 … … 1568 1573 1569 1574 /* If the data to return exceeds the buffer the guest supplies, tell it (and let it try again). */ 1570 if (cbActual >= dataBlock.cbData)1575 if (cbActual >= cbData) 1571 1576 rc = VINF_BUFFER_OVERFLOW; 1572 1577 } … … 1626 1631 iParm++; 1627 1632 } 1628 SHCLDATABLOCK dataBlock; 1633 1634 SHCLFORMAT uFormat = VBOX_SHCL_FMT_NONE; 1635 uint32_t cbData = 0; 1636 void *pvData = NULL; 1637 1629 1638 ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_32BIT, VERR_WRONG_PARAMETER_TYPE); /* Format bit. */ 1630 dataBlock.uFormat = paParms[iParm].u.uint32;1639 uFormat = paParms[iParm].u.uint32; 1631 1640 iParm++; 1632 1641 if (cParms == VBOX_SHCL_CPARMS_DATA_WRITE_61B) … … 1636 1645 } 1637 1646 ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_PTR, VERR_WRONG_PARAMETER_TYPE); /* Data buffer */ 1638 dataBlock.pvData = paParms[iParm].u.pointer.addr;1639 dataBlock.cbData = paParms[iParm].u.pointer.size;1647 pvData = paParms[iParm].u.pointer.addr; 1648 cbData = paParms[iParm].u.pointer.size; 1640 1649 iParm++; 1641 1650 Assert(iParm == cParms); … … 1649 1658 { 1650 1659 if (pClient->State.POD.uFormat == VBOX_SHCL_FMT_NONE) 1651 pClient->State.POD.uFormat = dataBlock.uFormat;1660 pClient->State.POD.uFormat = uFormat; 1652 1661 } 1653 1662 … … 1660 1669 SHCLEXTPARMS parms; 1661 1670 RT_ZERO(parms); 1662 parms.uFormat = dataBlock.uFormat;1663 parms.u.pvData = dataBlock.pvData;1664 parms.cbData = dataBlock.cbData;1671 parms.uFormat = uFormat; 1672 parms.u.pvData = pvData; 1673 parms.cbData = cbData; 1665 1674 1666 1675 g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_DATA_WRITE, &parms, sizeof(parms)); … … 1668 1677 } 1669 1678 else 1670 rc = ShClSvcImplWriteData(pClient, &cmdCtx, &dataBlock);1679 rc = ShClSvcImplWriteData(pClient, &cmdCtx, uFormat, pvData, cbData); 1671 1680 1672 1681 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp
r82846 r82880 307 307 int ShClSvcImplConnect(PSHCLCLIENT, bool) { return VINF_SUCCESS; } 308 308 int ShClSvcImplFormatAnnounce(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLFORMATDATA) { AssertFailed(); return VINF_SUCCESS; } 309 int ShClSvcImplReadData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK, unsigned int *) { AssertFailed(); return VERR_WRONG_ORDER; }310 int ShClSvcImplWriteData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, PSHCLDATABLOCK) { AssertFailed(); return VINF_SUCCESS; }309 int ShClSvcImplReadData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, SHCLFORMAT uFormat, uint32_t cbData, void *pvData, unsigned int *) { AssertFailed(); return VERR_WRONG_ORDER; } 310 int ShClSvcImplWriteData(PSHCLCLIENT, PSHCLCLIENTCMDCTX, SHCLFORMAT uFormat, uint32_t cbData, void *pvData) { AssertFailed(); return VINF_SUCCESS; } 311 311 int ShClSvcImplSync(PSHCLCLIENT) { return VINF_SUCCESS; } 312 312
Note:
See TracChangeset
for help on using the changeset viewer.