Changeset 93395 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 21, 2022 12:17:48 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r93115 r93395 345 345 else 346 346 { 347 const uint32_t cbPrealloc = _4K;348 uint32_tcb = 0;347 uint32_t const cbPrealloc = _4K; 348 uint32_t cb = 0; 349 349 350 350 /* Preallocate a buffer, most of small text transfers will fit into it. */ … … 352 352 if (hMem) 353 353 { 354 void *p Mem = GlobalLock(hMem);355 if (p Mem)354 void *pvMem = GlobalLock(hMem); 355 if (pvMem) 356 356 { 357 357 /* Read the host data to the preallocated buffer. */ 358 int rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, fFormat, p Mem, cbPrealloc, &cb);358 int rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, fFormat, pvMem, cbPrealloc, &cb); 359 359 if (RT_SUCCESS(rc)) 360 360 { … … 378 378 if (hMem) 379 379 { 380 p Mem = GlobalLock(hMem);381 if (p Mem)380 pvMem = GlobalLock(hMem); 381 if (pvMem) 382 382 { 383 383 /* Read the host data to the preallocated buffer. */ 384 384 uint32_t cbNew = 0; 385 rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, fFormat, p Mem, cb, &cbNew);385 rc = VbglR3ClipboardReadDataEx(&pCtx->CmdCtx, fFormat, pvMem, cb, &cbNew); 386 386 if ( RT_SUCCESS(rc) 387 387 && cbNew <= cb) … … 412 412 if (hMem) 413 413 { 414 /* p Mem is the address of the data. cb is the size of returned data. */414 /* pvMem is the address of the data. cb is the size of returned data. */ 415 415 /* Verify the size of returned text, the memory block for clipboard 416 416 * must have the exact string size. … … 419 419 { 420 420 size_t cbActual = 0; 421 HRESULT hrc = StringCbLengthW((LPWSTR)p Mem, cb, &cbActual);421 HRESULT hrc = StringCbLengthW((LPWSTR)pvMem, cb, &cbActual); 422 422 if (FAILED(hrc)) 423 423 { … … 441 441 { 442 442 /* Wrap content into CF_HTML clipboard format if needed. */ 443 if (!SharedClipboardWinIsCFHTML((const char *)p Mem))443 if (!SharedClipboardWinIsCFHTML((const char *)pvMem)) 444 444 { 445 445 char *pszWrapped = NULL; 446 446 uint32_t cbWrapped = 0; 447 rc = SharedClipboardWinConvertMIMEToCFHTML((const char *)pMem, cb, &pszWrapped, &cbWrapped); 447 rc = SharedClipboardWinConvertMIMEToCFHTML((const char *)pvMem, cb, 448 &pszWrapped, &cbWrapped); 448 449 if (RT_SUCCESS(rc)) 449 450 { … … 453 454 if (hMem) 454 455 { 455 p Mem = GlobalLock(hMem);456 if (p Mem)456 pvMem = GlobalLock(hMem); 457 if (pvMem) 457 458 { 458 459 /* Copy wrapped content back to memory passed to system clipboard. */ 459 memcpy(p Mem, pszWrapped, cbWrapped);460 memcpy(pvMem, pszWrapped, cbWrapped); 460 461 cb = cbWrapped; 461 462 } 462 463 else 463 464 { 464 LogRel(("Shared Clipboard: Cannot lock memory, " 465 "HTML clipboard data won't be converted into CF_HTML clipboard format\n")); 465 LogRel(("Shared Clipboard: Failed to lock memory (%u), HTML clipboard data won't be converted into CF_HTML clipboard format\n", GetLastError())); 466 466 GlobalFree(hMem); 467 467 hMem = NULL; … … 469 469 } 470 470 else 471 LogRel(("Shared Clipboard: Cannot re-allocate memory, " 472 "HTML clipboard data won't be converted into CF_HTML clipboard format\n")); 471 LogRel(("Shared Clipboard: Failed to re-allocate memory (%u), HTML clipboard data won't be converted into CF_HTML clipboard format\n", GetLastError())); 473 472 } 474 473 else 475 LogRel(("Shared Clipboard: Cannot unlock memory, " 476 "HTML clipboard data won't be converted into CF_HTML clipboard format\n")); 474 LogRel(("Shared Clipboard: Failed to unlock memory (%u), HTML clipboard data won't be converted into CF_HTML clipboard format\n", GetLastError())); 477 475 478 476 RTMemFree(pszWrapped);
Note:
See TracChangeset
for help on using the changeset viewer.