Changeset 78897 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- May 31, 2019 3:23:14 PM (6 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
r78618 r78897 147 147 endif 148 148 ifdef VBOX_WITH_SHARED_CLIPBOARD 149 VBoxGuestR3Lib_DEFS += VBOX_WITH_SHARED_CLIPBOARD_GUEST 149 150 VBoxGuestR3Lib_SOURCES += \ 150 151 VBoxGuestR3LibClipboard.cpp 152 ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 153 VBoxGuestR3Lib_SOURCES += \ 154 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardMetaData.cpp \ 155 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardMIME.cpp 156 endif 151 157 endif 152 158 ifdef VBOX_WITH_SHARED_FOLDERS -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r78809 r78897 264 264 * @param idClient The client id returned by VbglR3ClipboardConnect(). 265 265 * @param pDataHdr Where to store the data header data. 266 * @param ppvData Returns the received meta data. Needs to be free'd by the caller. 267 * @param pcbData Where to store the size (in bytes) of the received meta data. 266 * @param pMetaData Returns the received meta data. Needs to be free'd by the caller. 268 267 */ 269 268 static int vbglR3ClipboardReadMetaDataLoop(HGCMCLIENTID idClient, PVBOXCLIPBOARDDATAHDR pDataHdr, 270 void **ppvData, uint64_t *pcbData) 271 { 272 AssertPtrReturn(pDataHdr, VERR_INVALID_POINTER); 273 AssertPtrReturn(ppvData, VERR_INVALID_POINTER); 274 AssertPtrReturn(pcbData, VERR_INVALID_POINTER); 269 PSHAREDCLIPBOARDMETADATA pMetaData) 270 { 271 AssertPtrReturn(pDataHdr, VERR_INVALID_POINTER); 272 AssertPtrReturn(pMetaData, VERR_INVALID_POINTER); 275 273 276 274 int rc; … … 318 316 LogFlowFunc(("Received %RU64 bytes of data\n", cbDataTmp)); 319 317 320 *ppvData = pvDataTmp; 321 *pcbData = cbDataTmp; 318 pMetaData->pvMeta = pvDataTmp; 319 pMetaData->cbMeta = cbDataTmp; 320 pMetaData->cbUsed = cbDataTmp; 322 321 } 323 322 else … … 326 325 } 327 326 else 328 { 329 *ppvData = NULL; 330 *pcbData = 0; 331 } 327 SharedClipboardMetaDataDestroy(pMetaData); 332 328 333 329 LogFlowFuncLeaveRC(rc); … … 336 332 337 333 /** 338 * Main function for reading the actual meta data from the host, extended version. 339 * 340 * @returns IPRT status code. 341 * @param idClient The client id returned by VbglR3ClipboardConnect(). 342 * @param pEnmType Where to store the meta data type. Optional. 343 * @param ppvData Returns the received meta data. Needs to be free'd by the caller. Optional. 344 * @param pcbData Where to store the size (in bytes) of the received meta data. Optional. 345 */ 346 static int vbglR3ClipboardReadMetaDataMainEx(HGCMCLIENTID idClient, 347 VBGLR3GUESTDNDMETADATATYPE *pEnmType, 348 void **ppvData, 349 uint32_t *pcbData) 334 * Reads the actual meta data from the host, extended version. 335 * 336 * @returns IPRT status code. 337 * @param idClient The client id returned by VbglR3ClipboardConnect(). 338 * @param URIList Where to store received meta data. 339 */ 340 static int vbglR3ClipboardReadMetaDataEx(HGCMCLIENTID idClient, SharedClipboardURIList &URIList) 350 341 { 351 342 /* The rest is optional. */ … … 359 350 return VERR_NO_MEMORY; 360 351 361 SharedClipboardURIList lstURI; 362 363 void *pvData = NULL; 364 uint64_t cbData = 0; 365 366 int rc = vbglR3ClipboardReadMetaDataLoop(idClient, &dataHdr, &pvData, &cbData); 352 SHAREDCLIPBOARDMETADATA dataMeta; 353 SharedClipboardMetaDataInit(&dataMeta); 354 355 int rc = vbglR3ClipboardReadMetaDataLoop(idClient, &dataHdr, &dataMeta); 367 356 if (RT_SUCCESS(rc)) 368 357 { … … 379 368 if (SharedClipboardMIMEHasFileURLs((char *)dataHdr.pvMetaFmt, dataHdr.cbMetaFmt)) /* URI data. */ 380 369 { 381 AssertPtr(pvData); 382 Assert(cbData); 383 384 rc = lstURI.SetFromURIData(pvData, cbData, 0 /* fFlags */); 370 rc = URIList.SetFromURIData(dataMeta.pvMeta, dataMeta.cbMeta, 0 /* fFlags */); 371 372 #if 0 385 373 if (RT_SUCCESS(rc)) 386 374 rc = vbglR3ClipboardReadURIData(idClient, &dataHdr); 387 375 388 if (RT_SUCCESS(rc)) /** @todo Remove this block as soon as we hand in DnDURIList. */376 if (RT_SUCCESS(rc)) 389 377 { 390 378 if (pvData) … … 406 394 { 407 395 memcpy(pvData, strData.c_str(), cbData); 408 409 if (pEnmType)410 *pEnmType = VBGLR3GUESTDNDMETADATATYPE_URI_LIST;411 396 } 412 397 else … … 414 399 #endif 415 400 } 401 #endif 416 402 } 417 403 else /* Raw data. */ 418 404 { 419 if (pEnmType) 420 *pEnmType = VBGLR3GUESTDNDMETADATATYPE_RAW; 405 /** @todo Implement this. */ 421 406 } 407 408 SharedClipboardMetaDataDestroy(&dataMeta); 422 409 } 423 410 424 411 if (dataHdr.pvMetaFmt) 412 { 425 413 RTMemFree(dataHdr.pvMetaFmt); 426 427 if (RT_SUCCESS(rc)) 428 { 429 if ( pvData 430 && cbData) 431 { 432 if (pcbData) 433 *pcbData = cbData; 434 if (ppvData) 435 *ppvData = pvData; 436 else 437 RTMemFree(pvData); 438 } 439 } 440 else if ( RT_FAILURE(rc) 441 && rc != VERR_CANCELLED) 442 { 443 if (pvData) 444 RTMemFree(pvData); 414 dataHdr.pvMetaFmt = NULL; 445 415 } 446 416 … … 450 420 451 421 /** 452 * Main function for readingthe actual meta data from the host.453 * 454 * @returns IPRT status code. 455 * @param idClient The client id returned by VbglR3ClipboardConnect(). 456 * @param pMeta Where to store the actual meta data received from the host.457 */ 458 static int vbglR3ClipboardReadMetaDataMain(HGCMCLIENTID idClient, PVBGLR3GUESTDNDMETADATA pMeta)459 { 460 AssertPtrReturn(pMeta, VERR_INVALID_POINTER);461 462 int rc = vbglR3ClipboardReadMetaDataMainEx(idClient, 463 &pMeta->enmType, 464 &pMeta->pvMeta, 465 &pMeta->cbMeta);466 return rc;422 * Reads the actual meta data from the host. 423 * 424 * @returns IPRT status code. 425 * @param idClient The client id returned by VbglR3ClipboardConnect(). 426 * @param URIList Where to store received meta data. 427 */ 428 VBGLR3DECL(int) VbglR3ClipboardReadMetaData(HGCMCLIENTID idClient, SharedClipboardURIList &URIList) 429 { 430 return vbglR3ClipboardReadMetaDataEx(idClient, URIList); 431 } 432 433 VBGLR3DECL(int) VbglR3ClipboardWriteMetaData(HGCMCLIENTID idClient, const SharedClipboardURIList &URIList) 434 { 435 RT_NOREF(idClient, URIList); 436 return 0; 467 437 } 468 438
Note:
See TracChangeset
for help on using the changeset viewer.