Changeset 78501 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
- Timestamp:
- May 14, 2019 11:36:25 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r78474 r78501 79 79 const PVBOXCLIPBOARDWINCTX pWinCtx = &pCtx->Win; 80 80 81 LRESULT rc = 0;81 LRESULT lresultRc = 0; 82 82 83 83 switch (msg) … … 87 87 if (GetClipboardOwner() != hwnd) 88 88 { 89 Log(("WM_CLIPBOARDUPDATE\n")); 90 91 /* Clipboard was updated by another application. */ 89 /* Clipboard was updated by another application. 90 * Report available formats to the host. */ 92 91 VBOXCLIPBOARDFORMATS fFormats; 93 int vboxrc = VBoxClipboardWinGetFormats(&pCtx->Win, &fFormats); 94 if (RT_SUCCESS(vboxrc)) 95 vboxrc = VbglR3ClipboardReportFormats(pCtx->u32ClientID, fFormats); 92 int rc = VBoxClipboardWinGetFormats(&pCtx->Win, &fFormats); 93 if (RT_SUCCESS(rc)) 94 rc = VbglR3ClipboardReportFormats(pCtx->u32ClientID, fFormats); 95 96 LogFunc(("WM_CLIPBOARDUPDATE: rc=%Rrc, fFormats=0x%x\n", rc, fFormats)); 96 97 } 98 else 99 LogFlowFunc(("WM_CLIPBOARDUPDATE: No change (VBoxTray is owner)\n")); 97 100 } 98 101 break; … … 102 105 if (VBoxClipboardWinIsNewAPI(&pWinCtx->newAPI)) 103 106 { 104 rc = DefWindowProc(hwnd, msg, wParam, lParam);107 lresultRc = DefWindowProc(hwnd, msg, wParam, lParam); 105 108 break; 106 109 } … … 123 126 /* Pass the message further. */ 124 127 DWORD_PTR dwResult; 125 rc = SendMessageTimeout(pWinCtx->hWndNextInChain, WM_CHANGECBCHAIN, wParam, lParam, 0,126 VBOX_CLIPBOARD_CBCHAIN_TIMEOUT_MS, &dwResult);127 if (! rc)128 rc = (LRESULT)dwResult;128 lresultRc = SendMessageTimeout(pWinCtx->hWndNextInChain, WM_CHANGECBCHAIN, wParam, lParam, 0, 129 VBOX_CLIPBOARD_CBCHAIN_TIMEOUT_MS, &dwResult); 130 if (!lresultRc) 131 lresultRc = (LRESULT)dwResult; 129 132 } 130 133 } … … 141 144 /* WM_DRAWCLIPBOARD always expects a return code of 0, so don't change "rc" here. */ 142 145 VBOXCLIPBOARDFORMATS fFormats; 143 int vboxrc = VBoxClipboardWinGetFormats(pWinCtx, &fFormats);144 if (RT_SUCCESS( vboxrc))145 vboxrc = VbglR3ClipboardReportFormats(pCtx->u32ClientID, fFormats);146 int rc = VBoxClipboardWinGetFormats(pWinCtx, &fFormats); 147 if (RT_SUCCESS(rc)) 148 rc = VbglR3ClipboardReportFormats(pCtx->u32ClientID, fFormats); 146 149 } 147 150 … … 197 200 LogFunc(("WM_RENDERFORMAT: cfFormat=%u -> fFormat=0x%x\n", cfFormat, fFormat)); 198 201 199 if (fFormat != VBOX_SHARED_CLIPBOARD_FMT_NONE) 202 if (fFormat == VBOX_SHARED_CLIPBOARD_FMT_NONE) 203 { 204 LogFunc(("WM_RENDERFORMAT: Unsupported format requested\n")); 205 VBoxClipboardWinClear(); 206 } 207 else 200 208 { 201 209 const uint32_t cbPrealloc = _4K; … … 214 222 { 215 223 /* Read the host data to the preallocated buffer. */ 216 int vboxrc = VbglR3ClipboardReadData(pCtx->u32ClientID, fFormat, pMem, cbPrealloc, &cb);217 LogFlowFunc(("VbglR3ClipboardReadData returned with rc = %Rrc\n", vboxrc));218 219 if (RT_SUCCESS( vboxrc))224 int rc = VbglR3ClipboardReadData(pCtx->u32ClientID, fFormat, pMem, cbPrealloc, &cb); 225 LogFlowFunc(("VbglR3ClipboardReadData returned with rc = %Rrc\n", rc)); 226 227 if (RT_SUCCESS(rc)) 220 228 { 221 229 if (cb == 0) … … 245 253 /* Read the host data to the preallocated buffer. */ 246 254 uint32_t cbNew = 0; 247 vboxrc = VbglR3ClipboardReadData(pCtx->u32ClientID, fFormat, pMem, cb, &cbNew);255 rc = VbglR3ClipboardReadData(pCtx->u32ClientID, fFormat, pMem, cb, &cbNew); 248 256 LogFlowFunc(("VbglR3ClipboardReadData returned with rc = %Rrc, cb = %d, cbNew = %d\n", 249 vboxrc, cb, cbNew));250 251 if (RT_SUCCESS( vboxrc)257 rc, cb, cbNew)); 258 259 if (RT_SUCCESS(rc) 252 260 && cbNew <= cb) 253 261 { … … 335 343 * windows is to be destroyed and therefore the guest side becomes inactive. 336 344 */ 337 int vboxrc = VBoxClipboardWinOpen(hwnd);338 if (RT_SUCCESS( vboxrc))345 int rc = VBoxClipboardWinOpen(hwnd); 346 if (RT_SUCCESS(rc)) 339 347 { 340 348 VBoxClipboardWinClear(); … … 351 359 LogFunc(("VBOX_WM_SHCLPB_SET_FORMATS: fFormats=0x%x\n", fFormats)); 352 360 353 int vboxrc = VBoxClipboardWinOpen(hwnd);354 if (RT_SUCCESS( vboxrc))361 int rc = VBoxClipboardWinOpen(hwnd); 362 if (RT_SUCCESS(rc)) 355 363 { 356 364 VBoxClipboardWinClear(); … … 366 374 hClip = SetClipboardData(CF_UNICODETEXT, NULL); 367 375 } 368 369 376 else if (fFormats & VBOX_SHARED_CLIPBOARD_FMT_BITMAP) 370 377 { … … 372 379 hClip = SetClipboardData(CF_DIB, NULL); 373 380 } 374 375 381 else if (fFormats & VBOX_SHARED_CLIPBOARD_FMT_HTML) 376 382 { … … 380 386 hClip = SetClipboardData(cfFormat, NULL); 381 387 } 382 383 388 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 384 389 else if (fFormats & VBOX_SHARED_CLIPBOARD_FMT_URI_LIST) … … 390 395 if (pWinCtx->URI.pDataObj) 391 396 { 392 int vboxrc = pWinCtx->URI.pDataObj->Init(pCtx->u32ClientID);393 if (RT_SUCCESS( vboxrc))397 rc = pWinCtx->URI.pDataObj->Init(pCtx->u32ClientID); 398 if (RT_SUCCESS(rc)) 394 399 { 395 400 VBoxClipboardWinClose(); … … 429 434 LogFlowFunc(("VBOX_WM_SHCLPB_READ_DATA: u32Formats=0x%x\n", u32Formats)); 430 435 431 int vboxrc = VBoxClipboardWinOpen(hwnd);432 if (RT_SUCCESS( vboxrc))436 int rc = VBoxClipboardWinOpen(hwnd); 437 if (RT_SUCCESS(rc)) 433 438 { 434 439 if (u32Formats & VBOX_SHARED_CLIPBOARD_FMT_BITMAP) 435 440 { 436 441 hClip = GetClipboardData(CF_DIB); 437 438 442 if (hClip != NULL) 439 443 { … … 441 445 if (lp != NULL) 442 446 { 443 vboxrc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_BITMAP,444 447 rc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_BITMAP, 448 lp, GlobalSize(hClip)); 445 449 GlobalUnlock(hClip); 446 450 } … … 454 458 { 455 459 hClip = GetClipboardData(CF_UNICODETEXT); 456 457 460 if (hClip != NULL) 458 461 { 459 462 LPWSTR uniString = (LPWSTR)GlobalLock(hClip); 460 461 463 if (uniString != NULL) 462 464 { 463 vboxrc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT,464 465 rc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, 466 uniString, (lstrlenW(uniString) + 1) * 2); 465 467 GlobalUnlock(hClip); 466 468 } … … 483 485 if (lp != NULL) 484 486 { 485 vboxrc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_HTML,486 487 rc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_HTML, 488 lp, GlobalSize(hClip)); 487 489 GlobalUnlock(hClip); 488 490 } … … 497 499 else if (u32Formats & VBOX_SHARED_CLIPBOARD_FMT_URI_LIST) 498 500 { 499 UINT format = RegisterClipboardFormat(VBOX_CLIPBOARD_WIN_REGFMT_URI_LIST); 500 if (format != 0) 501 /* The data data in CF_HDROP format, as the files are locally present and don't need to be 502 * presented as a IDataObject or IStream. */ 503 hClip = GetClipboardData(CF_HDROP); 504 if (hClip) 501 505 { 502 hClip = GetClipboardData(format);503 if (h Clip)506 HDROP hDrop = (HDROP)GlobalLock(hClip); 507 if (hDrop) 504 508 { 505 HDROP hDrop = (HDROP)GlobalLock(hClip); 506 if (hDrop) 507 { 508 /* vboxrc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_URI_LIST, 509 );*/ 510 GlobalUnlock(hClip); 511 } 512 else 513 { 514 hClip = NULL; 515 } 509 /* vboxrc = VbglR3ClipboardWriteData(pCtx->u32ClientID, VBOX_SHARED_CLIPBOARD_FMT_URI_LIST, 510 );*/ 511 GlobalUnlock(hClip); 512 } 513 else 514 { 515 hClip = NULL; 516 516 } 517 517 } … … 543 543 default: 544 544 { 545 rc = DefWindowProc(hwnd, msg, wParam, lParam);545 lresultRc = DefWindowProc(hwnd, msg, wParam, lParam); 546 546 } 547 547 break; … … 549 549 550 550 #ifndef DEBUG_andy 551 LogFlowFunc(("vboxClipboardProcessMsg returned with rc = %ld\n", rc));551 LogFlowFunc(("vboxClipboardProcessMsg returned with lresultRc=%ld\n", lresultRc)); 552 552 #endif 553 return rc;553 return lresultRc; 554 554 } 555 555
Note:
See TracChangeset
for help on using the changeset viewer.