vbox的更動 60772 路徑 trunk/src/VBox/HostServices
- 時間撮記:
- 2016-4-29 下午09:16:24 (9 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostServices/SharedClipboard/VBoxClipboard-win.cpp
r58604 r60772 111 111 #endif /* LOG_ENABLED */ 112 112 113 113 114 static void vboxClipboardInitNewAPI(VBOXCLIPBOARDCONTEXT *pCtx) 114 115 { … … 143 144 } 144 145 146 147 static int vboxOpenClipboard(HWND hwnd) 148 { 149 /* "OpenClipboard fails if another window has the clipboard open." 150 * So try a few times and wait up to 1 second. 151 */ 152 int rc; 153 154 uint32_t u32SleepMS = 1; 155 int i; 156 for (i = 0; i <= 9; ++i) /* u32SleepMS = [1..512] */ 157 { 158 if (OpenClipboard(hwnd)) 159 { 160 rc = 0; 161 break; 162 } 163 rc = RTErrConvertFromWin32(GetLastError()); 164 165 RTThreadSleep(u32SleepMS); 166 u32SleepMS <<= 1; 167 } 168 #ifdef LOG_ENABLED 169 if (i > 0) 170 LogFlow(("vboxOpenClipboard: %d times tried to open clipboard. \n", ++i)); 171 #endif 172 return rc; 173 } 174 175 145 176 static void vboxClipboardGetData (uint32_t u32Format, const void *pvSrc, uint32_t cbSrc, 146 177 void *pvDst, uint32_t cbDst, uint32_t *pcbActualDst) … … 194 225 195 226 /* Query list of available formats and report to host. */ 196 if (OpenClipboard (pCtx->hwnd)) 227 int rc = vboxOpenClipboard(pCtx->hwnd); 228 if (RT_SUCCESS(rc)) 197 229 { 198 230 uint32_t u32Formats = 0; … … 240 272 vboxSvcClipboardReportMsg (pCtx->pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS, u32Formats); 241 273 } 274 else 275 { 276 LogFlow(("vboxClipboardChanged: error in open clipboard. hwnd: %x. err: %Rrc\n", pCtx->hwnd, rc)); 277 } 242 278 } 243 279 … … 491 527 * windows is to be destroyed and therefore the guest side becomes inactive. 492 528 */ 493 if (OpenClipboard (hwnd)) 529 int res = vboxOpenClipboard(hwnd); 530 if (RT_SUCCESS(res)) 494 531 { 495 532 EmptyClipboard(); 496 533 497 534 CloseClipboard(); 535 } 536 else 537 { 538 LogFlow(("vboxClipboardWndProc: WM_RENDERALLFORMATS: error in open clipboard. hwnd: %x, rc: %Rrc\n", hwnd, res)); 498 539 } 499 540 } break; … … 515 556 Log(("WM_USER u32Formats = %02X\n", u32Formats)); 516 557 517 if (OpenClipboard (hwnd)) 558 int res = vboxOpenClipboard(hwnd); 559 if (RT_SUCCESS(res)) 518 560 { 519 561 EmptyClipboard(); … … 553 595 else 554 596 { 555 dprintf(("window proc WM_USER: failed to open clipboard \n"));597 dprintf(("window proc WM_USER: failed to open clipboard. rc: %Rrc \n", res)); 556 598 } 557 599 } break; … … 748 790 * The guest wants to read data in the given format. 749 791 */ 750 if (OpenClipboard (pClient->pCtx->hwnd)) 792 int rc = vboxOpenClipboard(pClient->pCtx->hwnd); 793 if (RT_SUCCESS(rc)) 751 794 { 752 795 dprintf(("Clipboard opened.\n")); … … 831 874 else 832 875 { 833 dprintf((" failed to open clipboard\n"));876 dprintf(("vboxClipboardReadData: failed to open clipboard, rc: %Rrc \n", rc)); 834 877 } 835 878
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器