- Timestamp:
- Jul 11, 2023 8:00:15 AM (22 months ago)
- svn:sync-xref-src-repo-rev:
- 158280
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r100430 r100499 776 776 uint32_t fInfoRet; 777 777 rc = Msg.Parms.fInfo.GetUInt32(&fInfoRet); 778 AssertRCReturn(rc, rc);779 AssertMsgStmt((fInfoRet & VBOX_SHCL_INFO_F_FSOBJINFO) == VBOX_SHCL_INFO_F_FSOBJINFO,780 ("Host returned unknown entry info flags (%#x)\n", fInfoRet), rc = VERR_INVALID_PARAMETER);781 778 if (RT_SUCCESS(rc)) 782 779 { 783 uint32_t cbInfoRet = 0; 784 Msg.cbInfo.GetUInt32(&cbInfoRet); 785 786 AssertMsgStmt(cbInfo == cbInfoRet, 787 ("Host reported cbInfo %RU32, expected %RU32\n", cbInfoRet, cbInfo), rc = VERR_INVALID_PARAMETER); 788 789 rc = ShClTransferListEntryInitEx(pRootListEntry, fInfo, szName, pvInfo, cbInfo); 780 AssertMsgStmt((fInfoRet & VBOX_SHCL_INFO_F_FSOBJINFO) == VBOX_SHCL_INFO_F_FSOBJINFO, 781 ("Host returned unknown root entry info flags (%#x)\n", fInfoRet), rc = VERR_INVALID_PARAMETER); 790 782 if (RT_SUCCESS(rc)) 791 783 { 792 pvInfo = NULL; /* Entry took ownership of pvInfo now. */ 793 cbInfo = 0; 784 uint32_t cbInfoRet = 0; 785 rc = Msg.cbInfo.GetUInt32(&cbInfoRet); 786 if (RT_SUCCESS(rc)) 787 { 788 AssertMsgStmt(cbInfo == cbInfoRet, 789 ("Host reported cbInfo %RU32, expected %RU32\n", cbInfoRet, cbInfo), rc = VERR_INVALID_PARAMETER); 790 if (RT_SUCCESS(rc)) 791 rc = ShClTransferListEntryInitEx(pRootListEntry, fInfo, szName, pvInfo, cbInfo); 792 if (RT_SUCCESS(rc)) 793 { 794 pvInfo = NULL; /* Entry took ownership of pvInfo now. */ 795 cbInfo = 0; 796 } 797 } 794 798 } 795 799 } … … 1420 1424 VBOX_SHCL_GUEST_FN_LIST_ENTRY_READ, VBOX_SHCL_CPARMS_LIST_ENTRY); 1421 1425 1426 uint32_t const fInfo = VBOX_SHCL_INFO_F_FSOBJINFO; /* For now the only info we have. */ 1427 1422 1428 Msg.ReqParms.uContext.SetUInt64(pCtx->idContext); 1423 1429 Msg.ReqParms.uHandle.SetUInt64(hList); 1424 Msg.ReqParms.fInfo.SetUInt32(0); 1425 1426 Msg.szName.SetPtr(pListEntry->pszName, pListEntry->cbName); 1427 Msg.cbInfo.SetUInt32(pListEntry->cbInfo); 1428 Msg.pvInfo.SetPtr(pListEntry->pvInfo, pListEntry->cbInfo); 1429 1430 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 1431 if (RT_SUCCESS(rc)) 1432 { 1433 rc = Msg.cbInfo.GetUInt32(&pListEntry->cbInfo); AssertRC(rc); 1434 } 1430 Msg.ReqParms.fInfo.SetUInt32(fInfo); 1431 1432 char szName[SHCLLISTENTRY_MAX_NAME]; 1433 Msg.szName.SetPtr(szName, sizeof(szName)); 1434 1435 void *pvInfo = NULL; 1436 uint32_t cbInfo = 0; 1437 1438 int rc = VINF_SUCCESS; 1439 1440 if ((fInfo & VBOX_SHCL_INFO_F_FSOBJINFO) == VBOX_SHCL_INFO_F_FSOBJINFO) 1441 { 1442 cbInfo = sizeof(SHCLFSOBJINFO); 1443 pvInfo = RTMemAlloc(cbInfo); 1444 if (!pvInfo) 1445 rc = VERR_NO_MEMORY; 1446 } 1447 1448 if (RT_SUCCESS(rc)) 1449 { 1450 Msg.cbInfo.SetUInt32(cbInfo); 1451 Msg.pvInfo.SetPtr(pvInfo, cbInfo); 1452 1453 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 1454 if (RT_SUCCESS(rc)) 1455 { 1456 uint32_t cbInfoRet = 0; 1457 rc = Msg.cbInfo.GetUInt32(&cbInfoRet); 1458 if (RT_SUCCESS(rc)) 1459 { 1460 AssertMsgStmt(cbInfo == cbInfoRet, 1461 ("Host reported cbInfo %RU32, expected %RU32\n", cbInfoRet, cbInfo), rc = VERR_INVALID_PARAMETER); 1462 if (RT_SUCCESS(rc)) 1463 rc = ShClTransferListEntryInitEx(pListEntry, fInfo, szName, pvInfo, cbInfo); 1464 if (RT_SUCCESS(rc)) 1465 { 1466 pvInfo = NULL; /* Entry took ownership of pvInfo now. */ 1467 cbInfo = 0; 1468 } 1469 } 1470 } 1471 else 1472 LogRel(("Shared Clipboard: Reading list entry failed: %Rrc\n", rc)); 1473 } 1474 1475 RTMemFree(pvInfo); 1435 1476 1436 1477 LogFlowFuncLeaveRC(rc); … … 2514 2555 2515 2556 SHCLLISTENTRY entryList; 2516 rc = ShClTransferList Read(pTransfer, hList,&entryList);2557 rc = ShClTransferListEntryInit(&entryList); 2517 2558 if (RT_SUCCESS(rc)) 2518 2559 { 2519 PSHCLFSOBJINFO pObjInfo = (PSHCLFSOBJINFO)entryList.pvInfo; 2520 Assert(entryList.cbInfo == sizeof(SHCLFSOBJINFO)); 2521 2522 RT_NOREF(pObjInfo); 2523 2524 LogFlowFunc(("\t%s (%RU64 bytes)\n", entryList.pszName, pObjInfo->cbObject)); 2525 2526 rc = VbglR3ClipboardTransferListEntryWrite(pCmdCtx, hList, &entryList); 2527 2528 ShClTransferListEntryDestroy(&entryList); 2560 rc = ShClTransferListRead(pTransfer, hList, &entryList); 2561 if (RT_SUCCESS(rc)) 2562 { 2563 PSHCLFSOBJINFO pObjInfo = (PSHCLFSOBJINFO)entryList.pvInfo; 2564 Assert(entryList.cbInfo == sizeof(SHCLFSOBJINFO)); 2565 2566 RT_NOREF(pObjInfo); 2567 2568 LogFlowFunc(("\t%s (%RU64 bytes)\n", entryList.pszName, pObjInfo->cbObject)); 2569 2570 rc = VbglR3ClipboardTransferListEntryWrite(pCmdCtx, hList, &entryList); 2571 2572 ShClTransferListEntryDestroy(&entryList); 2573 } 2529 2574 } 2530 2575 } -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp
r100471 r100499 1278 1278 * @param cParms Number of HGCM parameters supplied in \a aParms. 1279 1279 * @param aParms Array of HGCM parameters. 1280 * @param p ListEntryPointer list entry to set.1280 * @param pEntry Pointer list entry to set. 1281 1281 */ 1282 1282 static int shClSvcTransferSetListEntry(uint32_t cParms, VBOXHGCMSVCPARM aParms[], 1283 PSHCLLISTENTRY p ListEntry)1283 PSHCLLISTENTRY pEntry) 1284 1284 { 1285 1285 int rc; 1286 1286 1287 1287 /* Sanity. */ 1288 AssertReturn(ShClTransferListEntryIsValid(p ListEntry), VERR_INVALID_PARAMETER);1288 AssertReturn(ShClTransferListEntryIsValid(pEntry), VERR_INVALID_PARAMETER); 1289 1289 1290 1290 if (cParms == VBOX_SHCL_CPARMS_LIST_ENTRY) 1291 1291 { 1292 HGCMSvcSetPv (&aParms[3], pListEntry->pszName, pListEntry->cbName); 1293 HGCMSvcSetU32(&aParms[4], pListEntry->cbInfo); 1294 HGCMSvcSetPv (&aParms[5], pListEntry->pvInfo, pListEntry->cbInfo); 1292 /* Entry name */ 1293 void *pvDst = aParms[3].u.pointer.addr; 1294 size_t cbDst = aParms[3].u.pointer.size; 1295 memcpy(pvDst, pEntry->pszName, RT_MIN(pEntry->cbName, cbDst)); 1296 1297 /* Info size */ 1298 HGCMSvcSetU32(&aParms[4], pEntry->cbInfo); 1299 1300 /* Info data */ 1301 pvDst = aParms[5].u.pointer.addr; 1302 cbDst = aParms[5].u.pointer.size; 1303 memcpy(pvDst, pEntry->pvInfo, RT_MIN(pEntry->cbInfo, cbDst)); 1295 1304 1296 1305 rc = VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.