Changeset 80918 in vbox for trunk/src/VBox/HostServices/SharedClipboard
- Timestamp:
- Sep 20, 2019 10:27:30 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133495
- Location:
- trunk/src/VBox/HostServices/SharedClipboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp
r80907 r80918 2110 2110 LogFlowFuncEnter(); 2111 2111 2112 SharedClipboardTransferCtx TransfersCleanup(&pClient->TransferCtx);2112 SharedClipboardTransferCtxCleanup(&pClient->TransferCtx); 2113 2113 2114 2114 int rc; -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r80907 r80918 869 869 870 870 HGCMSvcSetU32(&pMsgReadData->paParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, 871 871 pClient->Events.uID, uEvent)); 872 872 HGCMSvcSetU32(&pMsgReadData->paParms[1], pDataReq->uFmt); 873 873 HGCMSvcSetU32(&pMsgReadData->paParms[2], pClient->State.cbChunkSize); … … 940 940 941 941 HGCMSvcSetU32(&pMsg->paParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, 942 942 pClient->Events.uID, uEvent)); 943 943 HGCMSvcSetU32(&pMsg->paParms[1], pFormats->uFormats); 944 944 HGCMSvcSetU32(&pMsg->paParms[2], 0 /* fFlags */); … … 946 946 rc = sharedClipboardSvcMsgAdd(pClient, pMsg, true /* fAppend */); 947 947 if (RT_SUCCESS(rc)) 948 rc = sharedClipboardSvcClientWakeup(pClient); 948 { 949 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 950 if (pFormats->uFormats & VBOX_SHCL_FMT_URI_LIST) 951 { 952 rc = sharedClipboardSvcTransferStart(pClient, SHCLTRANSFERDIR_WRITE, SHCLSOURCE_LOCAL, 953 NULL /* pTransfer */); 954 if (RT_FAILURE(rc)) 955 LogRel(("Shared Clipboard: Initializing host write transfer failed with %Rrc\n", rc)); 956 } 957 #endif 958 if (RT_SUCCESS(rc)) 959 rc = sharedClipboardSvcClientWakeup(pClient); 960 } 949 961 } 950 962 else … … 1367 1379 if (RT_SUCCESS(rc)) 1368 1380 { 1369 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 1370 if (uFormat == VBOX_SHCL_FMT_URI_LIST) 1381 void *pv; 1382 uint32_t cb; 1383 rc = HGCMSvcGetBuf(&paParms[1], &pv, &cb); 1384 if (RT_SUCCESS(rc)) 1371 1385 { 1372 rc = sharedClipboardSvcTransferStart(pClient, SHCLTRANSFERDIR_WRITE, SHCLSOURCE_LOCAL, 1373 NULL /* pTransfer */); 1374 if (RT_FAILURE(rc)) 1375 LogRel(("Shared Clipboard: Initializing host write transfer failed with %Rrc\n", rc)); 1376 } 1377 else 1378 { 1379 #endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */ 1380 void *pv; 1381 uint32_t cb; 1382 rc = HGCMSvcGetBuf(&paParms[1], &pv, &cb); 1386 uint32_t cbActual = 0; 1387 1388 /* If there is a service extension active, try reading data from it first. */ 1389 if (g_ExtState.pfnExtension) 1390 { 1391 SHCLEXTPARMS parms; 1392 RT_ZERO(parms); 1393 1394 parms.uFormat = uFormat; 1395 parms.u.pvData = pv; 1396 parms.cbData = cb; 1397 1398 g_ExtState.fReadingData = true; 1399 1400 /* Read clipboard data from the extension. */ 1401 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_DATA_READ, 1402 &parms, sizeof(parms)); 1403 1404 LogFlowFunc(("g_ExtState.fDelayedAnnouncement=%RTbool, g_ExtState.uDelayedFormats=0x%x\n", 1405 g_ExtState.fDelayedAnnouncement, g_ExtState.uDelayedFormats)); 1406 1407 /* Did the extension send the clipboard formats yet? 1408 * Otherwise, do this now. */ 1409 if (g_ExtState.fDelayedAnnouncement) 1410 { 1411 SHCLFORMATDATA formatData; 1412 RT_ZERO(formatData); 1413 1414 formatData.uFormats = g_ExtState.uDelayedFormats; 1415 1416 int rc2 = sharedClipboardSvcFormatsReport(pClient, &formatData); 1417 AssertRC(rc2); 1418 1419 g_ExtState.fDelayedAnnouncement = false; 1420 g_ExtState.uDelayedFormats = 0; 1421 } 1422 1423 g_ExtState.fReadingData = false; 1424 1425 if (RT_SUCCESS(rc)) 1426 { 1427 cbActual = parms.cbData; 1428 } 1429 } 1430 1431 /* Note: The host clipboard *always* has precedence over the service extension above, 1432 * so data which has been read above might get overridden by the host clipboard eventually. */ 1433 1434 SHCLCLIENTCMDCTX cmdCtx; 1435 RT_ZERO(cmdCtx); 1436 1437 /* Release any other pending read, as we only 1438 * support one pending read at one time. */ 1383 1439 if (RT_SUCCESS(rc)) 1384 1440 { 1385 uint32_t cbActual = 0; 1386 1387 /* If there is a service extension active, try reading data from it first. */ 1388 if (g_ExtState.pfnExtension) 1389 { 1390 SHCLEXTPARMS parms; 1391 RT_ZERO(parms); 1392 1393 parms.uFormat = uFormat; 1394 parms.u.pvData = pv; 1395 parms.cbData = cb; 1396 1397 g_ExtState.fReadingData = true; 1398 1399 /* Read clipboard data from the extension. */ 1400 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_DATA_READ, 1401 &parms, sizeof(parms)); 1402 1403 LogFlowFunc(("g_ExtState.fDelayedAnnouncement=%RTbool, g_ExtState.uDelayedFormats=0x%x\n", 1404 g_ExtState.fDelayedAnnouncement, g_ExtState.uDelayedFormats)); 1405 1406 /* Did the extension send the clipboard formats yet? 1407 * Otherwise, do this now. */ 1408 if (g_ExtState.fDelayedAnnouncement) 1409 { 1410 SHCLFORMATDATA formatData; 1411 RT_ZERO(formatData); 1412 1413 formatData.uFormats = g_ExtState.uDelayedFormats; 1414 1415 int rc2 = sharedClipboardSvcFormatsReport(pClient, &formatData); 1416 AssertRC(rc2); 1417 1418 g_ExtState.fDelayedAnnouncement = false; 1419 g_ExtState.uDelayedFormats = 0; 1420 } 1421 1422 g_ExtState.fReadingData = false; 1423 1424 if (RT_SUCCESS(rc)) 1425 { 1426 cbActual = parms.cbData; 1427 } 1428 } 1429 1430 /* Note: The host clipboard *always* has precedence over the service extension above, 1431 * so data which has been read above might get overridden by the host clipboard eventually. */ 1432 1433 SHCLCLIENTCMDCTX cmdCtx; 1434 RT_ZERO(cmdCtx); 1435 1436 /* Release any other pending read, as we only 1437 * support one pending read at one time. */ 1441 SHCLDATABLOCK dataBlock; 1442 RT_ZERO(dataBlock); 1443 1444 dataBlock.pvData = pv; 1445 dataBlock.cbData = cb; 1446 dataBlock.uFormat = uFormat; 1447 1448 rc = SharedClipboardSvcImplReadData(pClient, &cmdCtx, &dataBlock, &cbActual); 1438 1449 if (RT_SUCCESS(rc)) 1439 { 1440 SHCLDATABLOCK dataBlock; 1441 RT_ZERO(dataBlock); 1442 1443 dataBlock.pvData = pv; 1444 dataBlock.cbData = cb; 1445 dataBlock.uFormat = uFormat; 1446 1447 rc = SharedClipboardSvcImplReadData(pClient, &cmdCtx, &dataBlock, &cbActual); 1448 if (RT_SUCCESS(rc)) 1449 HGCMSvcSetU32(&paParms[2], cbActual); 1450 } 1450 HGCMSvcSetU32(&paParms[2], cbActual); 1451 1451 } 1452 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS1453 1452 } 1454 #endif1455 1453 } 1456 1454 }
Note:
See TracChangeset
for help on using the changeset viewer.