Changeset 95865 in vbox
- Timestamp:
- Jul 27, 2022 1:18:54 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 152590
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r93396 r95865 28 28 #include <iprt/asm.h> 29 29 #include <iprt/errcore.h> 30 #include <iprt/ldr.h> 30 31 #include <iprt/mem.h> 31 #include <iprt/ldr.h> 32 32 #include <iprt/utf16.h> 33 33 34 34 #include <VBox/GuestHost/SharedClipboard.h> … … 39 39 # include <VBox/GuestHost/SharedClipboard-transfers.h> 40 40 #endif 41 42 #include <strsafe.h>43 41 44 42 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS … … 418 416 if (fFormat == VBOX_SHCL_FMT_UNICODETEXT) 419 417 { 420 size_t cbActual = 0; 421 HRESULT hrc = StringCbLengthW((LPWSTR)pvMem, cb, &cbActual); 422 if (FAILED(hrc)) 418 size_t cwcActual = 0; 419 rc = RTUtf16NLenEx((PCRTUTF16)pvMem, cb / sizeof(RTUTF16), &cwcActual); 420 if (RT_SUCCESS(rc)) 421 cb = (uint32_t)((cwcActual + 1 /* '\0' */) * sizeof(RTUTF16)); 422 else 423 423 { 424 LogRel(("Shared Clipboard: Received host data is invalid (%RU32 vs. %zu)\n",425 cb, c bActual));424 LogRel(("Shared Clipboard: Invalid UTF16 string from host: cb=%RU32, cwcActual=%zu, rc=%Rrc\n", 425 cb, cwcActual, rc)); 426 426 427 427 /* Discard invalid data. */ … … 429 429 GlobalFree(hMem); 430 430 hMem = NULL; 431 }432 else433 {434 /* cbActual is the number of bytes, excluding those used435 * for the terminating null character.436 */437 cb = (uint32_t)(cbActual + 2);438 431 } 439 432 }
Note:
See TracChangeset
for help on using the changeset viewer.