Changeset 103631 in vbox
- Timestamp:
- Mar 1, 2024 11:00:38 AM (11 months ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard-win.h
r103615 r103631 113 113 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 114 114 /** Forward declaration for the Windows data object. */ 115 class Sh aredClipboardWinDataObject;115 class ShClWinDataObject; 116 116 #endif 117 117 … … 143 143 * hasn't been started yet. 144 144 * Can be NULL if currently not being used / no current "in-flight" transfer present. */ 145 SharedClipboardWinDataObject 146 *pDataObjInFlight; 145 ShClWinDataObject *pDataObjInFlight; 147 146 #endif 148 147 /** Request queue. … … 151 150 } SHCLWINCTX, *PSHCLWINCTX; 152 151 153 int Sh aredClipboardWinOpen(HWND hWnd);154 int Sh aredClipboardWinClose(void);155 int Sh aredClipboardWinClear(void);156 157 int Sh aredClipboardWinCtxInit(PSHCLWINCTX pWinCtx);158 void Sh aredClipboardWinCtxDestroy(PSHCLWINCTX pWinCtx);159 160 int Sh aredClipboardWinCheckAndInitNewAPI(PSHCLWINAPINEW pAPI);161 bool Sh aredClipboardWinIsNewAPI(PSHCLWINAPINEW pAPI);162 163 int Sh aredClipboardWinDataWrite(UINT cfFormat, void *pvData, uint32_t cbData);164 165 int Sh aredClipboardWinChainAdd(PSHCLWINCTX pCtx);166 int Sh aredClipboardWinChainRemove(PSHCLWINCTX pCtx);167 VOID CALLBACK Sh aredClipboardWinChainPingProc(HWND hWnd, UINT uMsg, ULONG_PTR dwData, LRESULT lResult) RT_NOTHROW_DEF;168 LRESULT Sh aredClipboardWinChainPassToNext(PSHCLWINCTX pWinCtx, UINT msg, WPARAM wParam, LPARAM lParam);169 170 SHCLFORMAT Sh aredClipboardWinClipboardFormatToVBox(UINT uFormat);171 int Sh aredClipboardWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMATS pfFormats);172 173 int Sh aredClipboardWinGetCFHTMLHeaderValue(const char *pszSrc, const char *pszOption, uint32_t *puValue);174 bool Sh aredClipboardWinIsCFHTML(const char *pszSource);175 int Sh aredClipboardWinConvertCFHTMLToMIME(const char *pszSource, const uint32_t cch, char **ppszOutput, uint32_t *pcbOutput);176 int Sh aredClipboardWinConvertMIMEToCFHTML(const char *pszSource, size_t cb, char **ppszOutput, uint32_t *pcbOutput);177 178 LRESULT Sh aredClipboardWinHandleWMChangeCBChain(PSHCLWINCTX pWinCtx, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);179 int Sh aredClipboardWinHandleWMDestroy(PSHCLWINCTX pWinCtx);180 int Sh aredClipboardWinHandleWMRenderAllFormats(PSHCLWINCTX pWinCtx, HWND hWnd);181 int Sh aredClipboardWinHandleWMTimer(PSHCLWINCTX pWinCtx);182 183 int Sh aredClipboardWinClearAndAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats, HWND hWnd);152 int ShClWinOpen(HWND hWnd); 153 int ShClWinClose(void); 154 int ShClWinClear(void); 155 156 int ShClWinCtxInit(PSHCLWINCTX pWinCtx); 157 void ShClWinCtxDestroy(PSHCLWINCTX pWinCtx); 158 159 int ShClWinCheckAndInitNewAPI(PSHCLWINAPINEW pAPI); 160 bool ShClWinIsNewAPI(PSHCLWINAPINEW pAPI); 161 162 int ShClWinDataWrite(UINT cfFormat, void *pvData, uint32_t cbData); 163 164 int ShClWinChainAdd(PSHCLWINCTX pCtx); 165 int ShClWinChainRemove(PSHCLWINCTX pCtx); 166 VOID CALLBACK ShClWinChainPingProc(HWND hWnd, UINT uMsg, ULONG_PTR dwData, LRESULT lResult) RT_NOTHROW_DEF; 167 LRESULT ShClWinChainPassToNext(PSHCLWINCTX pWinCtx, UINT msg, WPARAM wParam, LPARAM lParam); 168 169 SHCLFORMAT ShClWinClipboardFormatToVBox(UINT uFormat); 170 int ShClWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMATS pfFormats); 171 172 int ShClWinGetCFHTMLHeaderValue(const char *pszSrc, const char *pszOption, uint32_t *puValue); 173 bool ShClWinIsCFHTML(const char *pszSource); 174 int ShClWinConvertCFHTMLToMIME(const char *pszSource, const uint32_t cch, char **ppszOutput, uint32_t *pcbOutput); 175 int ShClWinConvertMIMEToCFHTML(const char *pszSource, size_t cb, char **ppszOutput, uint32_t *pcbOutput); 176 177 LRESULT ShClWinHandleWMChangeCBChain(PSHCLWINCTX pWinCtx, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 178 int ShClWinHandleWMDestroy(PSHCLWINCTX pWinCtx); 179 int ShClWinHandleWMRenderAllFormats(PSHCLWINCTX pWinCtx, HWND hWnd); 180 int ShClWinHandleWMTimer(PSHCLWINCTX pWinCtx); 181 182 int ShClWinClearAndAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats, HWND hWnd); 184 183 185 184 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS … … 190 189 191 190 /** 192 * GenericWindows class implementing IDataObject for Shared Clipboard data transfers.193 */ 194 class Sh aredClipboardWinDataObject : public IDataObject //, public IDataObjectAsyncCapability191 * Shared CLipboard Windows class implementing IDataObject for Shared Clipboard data transfers. 192 */ 193 class ShClWinDataObject : public IDataObject //, public IDataObjectAsyncCapability 195 194 { 196 195 public: … … 202 201 { 203 202 /** Pointer to the data object of this callback. */ 204 Sh aredClipboardWinDataObject *pThis;203 ShClWinDataObject *pThis; 205 204 /** User-supplied pointer to more context data. */ 206 205 void *pvUser; … … 253 252 public: 254 253 255 Sh aredClipboardWinDataObject(void);256 virtual ~Sh aredClipboardWinDataObject(void);257 258 public: 259 260 int Init(PSHCLCONTEXT pCtx, Sh aredClipboardWinDataObject::PCALLBACKS pCallbacks, LPFORMATETC pFormatEtc = NULL, LPSTGMEDIUM pStgMed = NULL, ULONG cFormats = 0);254 ShClWinDataObject(void); 255 virtual ~ShClWinDataObject(void); 256 257 public: 258 259 int Init(PSHCLCONTEXT pCtx, ShClWinDataObject::PCALLBACKS pCallbacks, LPFORMATETC pFormatEtc = NULL, LPSTGMEDIUM pStgMed = NULL, ULONG cFormats = 0); 261 260 void Uninit(void); 262 261 void Destroy(void); … … 382 381 * Generic Windows class implementing IEnumFORMATETC for Shared Clipboard data transfers. 383 382 */ 384 class Sh aredClipboardWinEnumFormatEtc : public IEnumFORMATETC385 { 386 public: 387 388 Sh aredClipboardWinEnumFormatEtc(void);389 virtual ~Sh aredClipboardWinEnumFormatEtc(void);383 class ShClWinEnumFormatEtc : public IEnumFORMATETC 384 { 385 public: 386 387 ShClWinEnumFormatEtc(void); 388 virtual ~ShClWinEnumFormatEtc(void); 390 389 391 390 public: … … 423 422 * Generic Windows class implementing IStream for Shared Clipboard data transfers. 424 423 */ 425 class Sh aredClipboardWinStreamImpl : public IStream426 { 427 public: 428 429 Sh aredClipboardWinStreamImpl(SharedClipboardWinDataObject *pParent, PSHCLTRANSFER pTransfer,430 431 virtual ~Sh aredClipboardWinStreamImpl(void);424 class ShClWinStreamImpl : public IStream 425 { 426 public: 427 428 ShClWinStreamImpl(ShClWinDataObject *pParent, PSHCLTRANSFER pTransfer, 429 const Utf8Str &strPath, PSHCLFSOBJINFO pObjInfo); 430 virtual ~ShClWinStreamImpl(void); 432 431 433 432 public: /* IUnknown methods. */ … … 453 452 public: /* Own methods. */ 454 453 455 static HRESULT Create(Sh aredClipboardWinDataObject *pParent, PSHCLTRANSFER pTransfer, const Utf8Str &strPath,454 static HRESULT Create(ShClWinDataObject *pParent, PSHCLTRANSFER pTransfer, const Utf8Str &strPath, 456 455 PSHCLFSOBJINFO pObjInfo, IStream **ppStream); 457 456 private: 458 457 459 458 /** Pointer to the parent data object. */ 460 Sh aredClipboardWinDataObject*m_pParent;459 ShClWinDataObject *m_pParent; 461 460 /** The stream object's current reference count. */ 462 461 LONG m_lRefCount; … … 479 478 * Set as pvUser / cbUser for SHCLTRANSFER on Windows hosts / guests. 480 479 */ 481 class Sh aredClipboardWinTransferCtx482 { 483 public: 484 Sh aredClipboardWinTransferCtx()480 class ShClWinTransferCtx 481 { 482 public: 483 ShClWinTransferCtx() 485 484 : pDataObj(NULL) { } 486 485 487 virtual ~Sh aredClipboardWinTransferCtx() { }486 virtual ~ShClWinTransferCtx() { } 488 487 489 488 /** Pointer to data object to use for this transfer. Not owned. 490 489 * Can be NULL if not being used. */ 491 Sh aredClipboardWinDataObject *pDataObj;490 ShClWinDataObject *pDataObj; 492 491 }; 493 492 494 int Sh aredClipboardWinTransferGetRoots(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer);495 int Sh aredClipboardWinTransferDropFilesToStringList(DROPFILES *pDropFiles, char **papszList, uint32_t *pcbList);496 int Sh aredClipboardWinTransferGetRootsFromClipboard(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer);497 498 int Sh aredClipboardWinTransferCreate(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer);499 void Sh aredClipboardWinTransferDestroy(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer);500 501 int Sh aredClipboardWinTransferCreateAndSetDataObject(PSHCLWINCTX pWinCtx, PSHCLCONTEXT pCtx, SharedClipboardWinDataObject::PCALLBACKS pCallbacks);502 int Sh aredClipboardWinTransferInitialize(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer);503 int Sh aredClipboardWinTransferStart(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer);493 int ShClWinTransferGetRoots(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer); 494 int ShClWinTransferDropFilesToStringList(DROPFILES *pDropFiles, char **papszList, uint32_t *pcbList); 495 int ShClWinTransferGetRootsFromClipboard(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer); 496 497 int ShClWinTransferCreate(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer); 498 void ShClWinTransferDestroy(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer); 499 500 int ShClWinTransferCreateAndSetDataObject(PSHCLWINCTX pWinCtx, PSHCLCONTEXT pCtx, ShClWinDataObject::PCALLBACKS pCallbacks); 501 int ShClWinTransferInitialize(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer); 502 int ShClWinTransferStart(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer); 504 503 # endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */ 505 504 #endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_win_h */ -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r103615 r103631 103 103 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 104 104 /** 105 * @copydoc Sh aredClipboardWinDataObject::CALLBACKS::pfnTransferBegin106 * 107 * Called by Sh aredClipboardWinDataObject::GetData() when the user wants to paste data.105 * @copydoc ShClWinDataObject::CALLBACKS::pfnTransferBegin 106 * 107 * Called by ShClWinDataObject::GetData() when the user wants to paste data. 108 108 * This then requests a new transfer on the host. 109 109 * 110 110 * @thread Clipboard main thread. 111 111 */ 112 static DECLCALLBACK(int) vbtrShClDataObjectTransferBeginCallback(Sh aredClipboardWinDataObject::PCALLBACKCTX pCbCtx)112 static DECLCALLBACK(int) vbtrShClDataObjectTransferBeginCallback(ShClWinDataObject::PCALLBACKCTX pCbCtx) 113 113 { 114 114 LogFlowFuncEnter(); … … 137 137 AssertPtr(pCtx); 138 138 139 int rc = Sh aredClipboardWinTransferCreate(&pCtx->Win, pCbCtx->pTransfer);139 int rc = ShClWinTransferCreate(&pCtx->Win, pCbCtx->pTransfer); 140 140 141 141 LogFlowFuncLeaveRC(rc); … … 156 156 AssertPtr(pCtx); 157 157 158 Sh aredClipboardWinTransferDestroy(&pCtx->Win, pCbCtx->pTransfer);158 ShClWinTransferDestroy(&pCtx->Win, pCbCtx->pTransfer); 159 159 160 160 LogFlowFuncLeave(); … … 186 186 case SHCLTRANSFERDIR_FROM_REMOTE: /* H->G */ 187 187 { 188 rc = Sh aredClipboardWinTransferInitialize(&pCtx->Win, pTransfer);188 rc = ShClWinTransferInitialize(&pCtx->Win, pTransfer); 189 189 break; 190 190 } … … 192 192 case SHCLTRANSFERDIR_TO_REMOTE: /* G->H */ 193 193 { 194 rc = Sh aredClipboardWinTransferGetRootsFromClipboard(&pCtx->Win, pTransfer);194 rc = ShClWinTransferGetRootsFromClipboard(&pCtx->Win, pTransfer); 195 195 break; 196 196 } … … 229 229 case SHCLTRANSFERDIR_FROM_REMOTE: /* H->G */ 230 230 { 231 rc = Sh aredClipboardWinTransferStart(&pCtx->Win, pTransfer);231 rc = ShClWinTransferStart(&pCtx->Win, pTransfer); 232 232 break; 233 233 } … … 305 305 if (enmDir == SHCLTRANSFERDIR_TO_REMOTE) /* G->H */ 306 306 { 307 rc = Sh aredClipboardWinTransferGetRootsFromClipboard(&pCtx->Win, pTransfer);307 rc = ShClWinTransferGetRootsFromClipboard(&pCtx->Win, pTransfer); 308 308 } 309 309 else if (enmDir == SHCLTRANSFERDIR_FROM_REMOTE) /* H->G */ … … 411 411 * Report available formats to the host. */ 412 412 SHCLFORMATS fFormats; 413 rc = Sh aredClipboardWinGetFormats(pWinCtx, &fFormats);413 rc = ShClWinGetFormats(pWinCtx, &fFormats); 414 414 if (RT_SUCCESS(rc)) 415 415 { … … 434 434 { 435 435 LogFunc(("WM_CHANGECBCHAIN\n")); 436 lresultRc = Sh aredClipboardWinHandleWMChangeCBChain(pWinCtx, hwnd, msg, wParam, lParam);436 lresultRc = ShClWinHandleWMChangeCBChain(pWinCtx, hwnd, msg, wParam, lParam); 437 437 break; 438 438 } … … 458 458 /* WM_DRAWCLIPBOARD always expects a return code of 0, so don't change "rc" here. */ 459 459 SHCLFORMATS fFormats; 460 rc = Sh aredClipboardWinGetFormats(pWinCtx, &fFormats);460 rc = ShClWinGetFormats(pWinCtx, &fFormats); 461 461 if ( RT_SUCCESS(rc) 462 462 && fFormats != VBOX_SHCL_FMT_NONE) … … 470 470 } 471 471 472 lresultRc = Sh aredClipboardWinChainPassToNext(pWinCtx, msg, wParam, lParam);472 lresultRc = ShClWinChainPassToNext(pWinCtx, msg, wParam, lParam); 473 473 break; 474 474 } … … 476 476 case WM_TIMER: 477 477 { 478 int rc = Sh aredClipboardWinHandleWMTimer(pWinCtx);478 int rc = ShClWinHandleWMTimer(pWinCtx); 479 479 AssertRC(rc); 480 480 … … 492 492 /* Insert the requested clipboard format data into the clipboard. */ 493 493 const UINT uFmtWin = (UINT)wParam; 494 const SHCLFORMAT uFmtVBox = Sh aredClipboardWinClipboardFormatToVBox(uFmtWin);494 const SHCLFORMAT uFmtVBox = ShClWinClipboardFormatToVBox(uFmtWin); 495 495 496 496 LogFunc(("WM_RENDERFORMAT: uFmtWin=%u -> uFmtVBox=0x%x\n", uFmtWin, uFmtVBox)); … … 504 504 { 505 505 LogRel(("Shared Clipboard: Unsupported format (%#x) requested\n", uFmtWin)); 506 Sh aredClipboardWinClear();506 ShClWinClear(); 507 507 } 508 508 else … … 529 529 { 530 530 /* Wrap content into CF_HTML clipboard format if needed. */ 531 if (!Sh aredClipboardWinIsCFHTML((const char *)pvData))531 if (!ShClWinIsCFHTML((const char *)pvData)) 532 532 { 533 533 char *pszWrapped = NULL; 534 534 uint32_t cbWrapped = 0; 535 rc = Sh aredClipboardWinConvertMIMEToCFHTML((const char *)pvData, cbData, &pszWrapped, &cbWrapped);535 rc = ShClWinConvertMIMEToCFHTML((const char *)pvData, cbData, &pszWrapped, &cbWrapped); 536 536 if (RT_SUCCESS(rc)) 537 537 { … … 588 588 LogFunc(("WM_RENDERALLFORMATS\n")); 589 589 590 int rc = Sh aredClipboardWinHandleWMRenderAllFormats(pWinCtx, hwnd);590 int rc = ShClWinHandleWMRenderAllFormats(pWinCtx, hwnd); 591 591 AssertRC(rc); 592 592 … … 613 613 if (fFormats != VBOX_SHCL_FMT_NONE) /* Could arrive with some older GA versions. */ 614 614 { 615 int rc = Sh aredClipboardWinClearAndAnnounceFormats(pWinCtx, fFormats, hwnd);615 int rc = ShClWinClearAndAnnounceFormats(pWinCtx, fFormats, hwnd); 616 616 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 617 617 if ( RT_SUCCESS(rc) … … 622 622 * That way Windows will recognize that there is a data transfer available. 623 623 */ 624 Sh aredClipboardWinDataObject::CALLBACKS Callbacks;624 ShClWinDataObject::CALLBACKS Callbacks; 625 625 RT_ZERO(Callbacks); 626 626 Callbacks.pfnTransferBegin = vbtrShClDataObjectTransferBeginCallback; 627 627 628 rc = Sh aredClipboardWinTransferCreateAndSetDataObject(pWinCtx, pCtx, &Callbacks);628 rc = ShClWinTransferCreateAndSetDataObject(pWinCtx, pCtx, &Callbacks); 629 629 } 630 630 #else … … 653 653 RTStrFree(pszFmts); 654 654 #endif 655 int rc = Sh aredClipboardWinOpen(hwnd);655 int rc = ShClWinOpen(hwnd); 656 656 HANDLE hClip = NULL; 657 657 if (RT_SUCCESS(rc)) … … 704 704 705 705 /* Unwrap clipboard content from CF_HTML format if needed. */ 706 if (Sh aredClipboardWinIsCFHTML((const char *)pvClip))706 if (ShClWinIsCFHTML((const char *)pvClip)) 707 707 { 708 708 char *pszBuf = NULL; 709 709 uint32_t cbBuf = 0; 710 rc = Sh aredClipboardWinConvertCFHTMLToMIME((const char *)pvClip, cbClip, &pszBuf, &cbBuf);710 rc = ShClWinConvertCFHTMLToMIME((const char *)pvClip, cbClip, &pszBuf, &cbBuf); 711 711 if (RT_SUCCESS(rc)) 712 712 { … … 731 731 LogFunc(("SHCL_WIN_WM_READ_DATA: hClip=NULL, lastError=%ld\n", GetLastError())); 732 732 733 Sh aredClipboardWinClose();733 ShClWinClose(); 734 734 } 735 735 … … 744 744 LogFunc(("WM_DESTROY\n")); 745 745 746 int rc = Sh aredClipboardWinHandleWMDestroy(pWinCtx);746 int rc = ShClWinHandleWMDestroy(pWinCtx); 747 747 AssertRC(rc); 748 748 … … 816 816 SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 817 817 818 rc = Sh aredClipboardWinChainAdd(pWinCtx);818 rc = ShClWinChainAdd(pWinCtx); 819 819 if (RT_SUCCESS(rc)) 820 820 { 821 if (!Sh aredClipboardWinIsNewAPI(&pWinCtx->newAPI))821 if (!ShClWinIsNewAPI(&pWinCtx->newAPI)) 822 822 pWinCtx->oldAPI.timerRefresh = SetTimer(pWinCtx->hWnd, 0, 10 * 1000 /* 10s */, NULL); 823 823 } … … 933 933 AssertRCReturn(rc, rc); 934 934 935 rc = Sh aredClipboardWinCtxInit(&pCtx->Win);935 rc = ShClWinCtxInit(&pCtx->Win); 936 936 if (RT_SUCCESS(rc)) 937 937 rc = VbglR3ClipboardConnectEx(&pCtx->CmdCtx, VBOX_SHCL_GF_0_CONTEXT_ID); … … 1198 1198 UnregisterClass(s_szClipWndClassName, pCtx->pEnv->hInstance); 1199 1199 1200 Sh aredClipboardWinCtxDestroy(&pCtx->Win);1200 ShClWinCtxDestroy(&pCtx->Win); 1201 1201 1202 1202 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardDataObjectImpl-win.cpp
r103615 r103631 62 62 //#define VBOX_CLIPBOARD_WITH_UNICODE_SUPPORT 1 63 63 64 Sh aredClipboardWinDataObject::SharedClipboardWinDataObject(void)64 ShClWinDataObject::ShClWinDataObject(void) 65 65 : m_pCtx(NULL) 66 66 , m_enmStatus(Uninitialized) … … 80 80 } 81 81 82 Sh aredClipboardWinDataObject::~SharedClipboardWinDataObject(void)82 ShClWinDataObject::~ShClWinDataObject(void) 83 83 { 84 84 Destroy(); … … 102 102 * @param cFormats Number of formats in \a pFormatEtc and \a pStgMed. Optional. 103 103 */ 104 int Sh aredClipboardWinDataObject::Init(PSHCLCONTEXT pCtx, SharedClipboardWinDataObject::PCALLBACKS pCallbacks,105 106 104 int ShClWinDataObject::Init(PSHCLCONTEXT pCtx, ShClWinDataObject::PCALLBACKS pCallbacks, 105 LPFORMATETC pFormatEtc /* = NULL */, LPSTGMEDIUM pStgMed /* = NULL */, 106 ULONG cFormats /* = 0 */) 107 107 { 108 108 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); … … 117 117 * Set up callback context + table. 118 118 */ 119 memcpy(&m_Callbacks, pCallbacks, sizeof(Sh aredClipboardWinDataObject::CALLBACKS));119 memcpy(&m_Callbacks, pCallbacks, sizeof(ShClWinDataObject::CALLBACKS)); 120 120 m_CallbackCtx.pvUser = pCtx; 121 121 m_CallbackCtx.pThis = this; … … 199 199 * Uninitialized a data object instance, internal version. 200 200 */ 201 void Sh aredClipboardWinDataObject::uninitInternal(void)201 void ShClWinDataObject::uninitInternal(void) 202 202 { 203 203 LogFlowFuncEnter(); … … 230 230 * Uninitialized a data object instance. 231 231 */ 232 void Sh aredClipboardWinDataObject::Uninit(void)232 void ShClWinDataObject::Uninit(void) 233 233 { 234 234 LogFlowFuncEnter(); … … 240 240 * Destroys a data object instance. 241 241 */ 242 void Sh aredClipboardWinDataObject::Destroy(void)242 void ShClWinDataObject::Destroy(void) 243 243 { 244 244 LogFlowFuncEnter(); … … 295 295 ********************************************************************************************************************************/ 296 296 297 STDMETHODIMP_(ULONG) Sh aredClipboardWinDataObject::AddRef(void)297 STDMETHODIMP_(ULONG) ShClWinDataObject::AddRef(void) 298 298 { 299 299 ULONG ulCount = InterlockedIncrement(&m_lRefCount); … … 302 302 } 303 303 304 STDMETHODIMP_(ULONG) Sh aredClipboardWinDataObject::Release(void)304 STDMETHODIMP_(ULONG) ShClWinDataObject::Release(void) 305 305 { 306 306 ULONG ulCount = InterlockedDecrement(&m_lRefCount); … … 315 315 } 316 316 317 STDMETHODIMP Sh aredClipboardWinDataObject::QueryInterface(REFIID iid, void **ppvObject)317 STDMETHODIMP ShClWinDataObject::QueryInterface(REFIID iid, void **ppvObject) 318 318 { 319 319 AssertPtrReturn(ppvObject, E_INVALIDARG); … … 340 340 * @param phGlobal Where to store the allocated HGLOBAL object. 341 341 */ 342 int Sh aredClipboardWinDataObject::copyToHGlobal(const void *pvData, size_t cbData, UINT fFlags, HGLOBAL *phGlobal)342 int ShClWinDataObject::copyToHGlobal(const void *pvData, size_t cbData, UINT fFlags, HGLOBAL *phGlobal) 343 343 { 344 344 AssertPtrReturn(phGlobal, VERR_INVALID_POINTER); … … 363 363 } 364 364 365 inline int Sh aredClipboardWinDataObject::lock(void)365 inline int ShClWinDataObject::lock(void) 366 366 { 367 367 int rc = RTCritSectEnter(&m_CritSect); … … 371 371 } 372 372 373 inline int Sh aredClipboardWinDataObject::unlock(void)373 inline int ShClWinDataObject::unlock(void) 374 374 { 375 375 int rc = RTCritSectLeave(&m_CritSect); … … 387 387 * @param strDir Directory path to handle. 388 388 */ 389 int Sh aredClipboardWinDataObject::readDir(PSHCLTRANSFER pTransfer, const Utf8Str &strDir)389 int ShClWinDataObject::readDir(PSHCLTRANSFER pTransfer, const Utf8Str &strDir) 390 390 { 391 391 LogFlowFunc(("strDir=%s\n", strDir.c_str())); … … 482 482 * @returns VBox status code. 483 483 * @param pTransfer Pointer to transfer. 484 * @param pvUser Pointer to user-provided data. Of type Sh aredClipboardWinDataObject.484 * @param pvUser Pointer to user-provided data. Of type ShClWinDataObject. 485 485 */ 486 486 /* static */ 487 DECLCALLBACK(int) Sh aredClipboardWinDataObject::readThread(PSHCLTRANSFER pTransfer, void *pvUser)487 DECLCALLBACK(int) ShClWinDataObject::readThread(PSHCLTRANSFER pTransfer, void *pvUser) 488 488 { 489 489 LogFlowFuncEnter(); 490 490 491 Sh aredClipboardWinDataObject *pThis = (SharedClipboardWinDataObject *)pvUser;491 ShClWinDataObject *pThis = (ShClWinDataObject *)pvUser; 492 492 493 493 LogRel2(("Shared Clipboard: Calculating transfer ...\n")); … … 639 639 * @param phGlobal Where to store the allocated HGLOBAL object on success. 640 640 */ 641 int Sh aredClipboardWinDataObject::createFileGroupDescriptorFromTransfer(PSHCLTRANSFER pTransfer,641 int ShClWinDataObject::createFileGroupDescriptorFromTransfer(PSHCLTRANSFER pTransfer, 642 642 bool fUnicode, HGLOBAL *phGlobal) 643 643 { … … 764 764 * @thread Windows event thread. 765 765 */ 766 STDMETHODIMP Sh aredClipboardWinDataObject::GetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium)766 STDMETHODIMP ShClWinDataObject::GetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) 767 767 { 768 768 AssertPtrReturn(pFormatEtc, DV_E_FORMATETC); … … 861 861 if (RT_SUCCESS(rc)) 862 862 { 863 rc = ShClTransferRun(m_pTransfer, &Sh aredClipboardWinDataObject::readThread, this /* pvUser */);863 rc = ShClTransferRun(m_pTransfer, &ShClWinDataObject::readThread, this /* pvUser */); 864 864 if (RT_SUCCESS(rc)) 865 865 { … … 932 932 933 933 /* Hand-in the provider so that our IStream implementation can continue working with it. */ 934 hr = Sh aredClipboardWinStreamImpl::Create(this /* pParent */, m_pTransfer,934 hr = ShClWinStreamImpl::Create(this /* pParent */, m_pTransfer, 935 935 fsObjEntry.pszPath /* File name */, &fsObjEntry.objInfo /* PSHCLFSOBJINFO */, 936 936 &m_pStream); … … 978 978 * @param pMedium 979 979 */ 980 STDMETHODIMP Sh aredClipboardWinDataObject::GetDataHere(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium)980 STDMETHODIMP ShClWinDataObject::GetDataHere(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium) 981 981 { 982 982 RT_NOREF(pFormatEtc, pMedium); … … 992 992 * @param pFormatEtc 993 993 */ 994 STDMETHODIMP Sh aredClipboardWinDataObject::QueryGetData(LPFORMATETC pFormatEtc)994 STDMETHODIMP ShClWinDataObject::QueryGetData(LPFORMATETC pFormatEtc) 995 995 { 996 996 LogFlowFunc(("\n")); … … 998 998 } 999 999 1000 STDMETHODIMP Sh aredClipboardWinDataObject::GetCanonicalFormatEtc(LPFORMATETC pFormatEtc, LPFORMATETC pFormatEtcOut)1000 STDMETHODIMP ShClWinDataObject::GetCanonicalFormatEtc(LPFORMATETC pFormatEtc, LPFORMATETC pFormatEtcOut) 1001 1001 { 1002 1002 RT_NOREF(pFormatEtc); … … 1008 1008 } 1009 1009 1010 STDMETHODIMP Sh aredClipboardWinDataObject::SetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium, BOOL fRelease)1010 STDMETHODIMP ShClWinDataObject::SetData(LPFORMATETC pFormatEtc, LPSTGMEDIUM pMedium, BOOL fRelease) 1011 1011 { 1012 1012 if ( pFormatEtc == NULL … … 1055 1055 } 1056 1056 1057 STDMETHODIMP Sh aredClipboardWinDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc)1057 STDMETHODIMP ShClWinDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc) 1058 1058 { 1059 1059 LogFlowFunc(("dwDirection=%RI32, mcFormats=%RI32, mpFormatEtc=%p\n", dwDirection, m_cFormats, m_pFormatEtc)); … … 1061 1061 HRESULT hr; 1062 1062 if (dwDirection == DATADIR_GET) 1063 hr = Sh aredClipboardWinEnumFormatEtc::CreateEnumFormatEtc(m_cFormats, m_pFormatEtc, ppEnumFormatEtc);1063 hr = ShClWinEnumFormatEtc::CreateEnumFormatEtc(m_cFormats, m_pFormatEtc, ppEnumFormatEtc); 1064 1064 else 1065 1065 hr = E_NOTIMPL; … … 1069 1069 } 1070 1070 1071 STDMETHODIMP Sh aredClipboardWinDataObject::DAdvise(LPFORMATETC pFormatEtc, DWORD fAdvise, IAdviseSink *pAdvSink, DWORD *pdwConnection)1071 STDMETHODIMP ShClWinDataObject::DAdvise(LPFORMATETC pFormatEtc, DWORD fAdvise, IAdviseSink *pAdvSink, DWORD *pdwConnection) 1072 1072 { 1073 1073 RT_NOREF(pFormatEtc, fAdvise, pAdvSink, pdwConnection); … … 1075 1075 } 1076 1076 1077 STDMETHODIMP Sh aredClipboardWinDataObject::DUnadvise(DWORD dwConnection)1077 STDMETHODIMP ShClWinDataObject::DUnadvise(DWORD dwConnection) 1078 1078 { 1079 1079 RT_NOREF(dwConnection); … … 1081 1081 } 1082 1082 1083 STDMETHODIMP Sh aredClipboardWinDataObject::EnumDAdvise(IEnumSTATDATA **ppEnumAdvise)1083 STDMETHODIMP ShClWinDataObject::EnumDAdvise(IEnumSTATDATA **ppEnumAdvise) 1084 1084 { 1085 1085 RT_NOREF(ppEnumAdvise); … … 1092 1092 */ 1093 1093 1094 STDMETHODIMP Sh aredClipboardWinDataObject::EndOperation(HRESULT hResult, IBindCtx *pbcReserved, DWORD dwEffects)1094 STDMETHODIMP ShClWinDataObject::EndOperation(HRESULT hResult, IBindCtx *pbcReserved, DWORD dwEffects) 1095 1095 { 1096 1096 RT_NOREF(hResult, pbcReserved, dwEffects); … … 1098 1098 } 1099 1099 1100 STDMETHODIMP Sh aredClipboardWinDataObject::GetAsyncMode(BOOL *pfIsOpAsync)1100 STDMETHODIMP ShClWinDataObject::GetAsyncMode(BOOL *pfIsOpAsync) 1101 1101 { 1102 1102 RT_NOREF(pfIsOpAsync); … … 1104 1104 } 1105 1105 1106 STDMETHODIMP Sh aredClipboardWinDataObject::InOperation(BOOL *pfInAsyncOp)1106 STDMETHODIMP ShClWinDataObject::InOperation(BOOL *pfInAsyncOp) 1107 1107 { 1108 1108 RT_NOREF(pfInAsyncOp); … … 1110 1110 } 1111 1111 1112 STDMETHODIMP Sh aredClipboardWinDataObject::SetAsyncMode(BOOL fDoOpAsync)1112 STDMETHODIMP ShClWinDataObject::SetAsyncMode(BOOL fDoOpAsync) 1113 1113 { 1114 1114 RT_NOREF(fDoOpAsync); … … 1116 1116 } 1117 1117 1118 STDMETHODIMP Sh aredClipboardWinDataObject::StartOperation(IBindCtx *pbcReserved)1118 STDMETHODIMP ShClWinDataObject::StartOperation(IBindCtx *pbcReserved) 1119 1119 { 1120 1120 RT_NOREF(pbcReserved); … … 1134 1134 * When set to NULL, the transfer will be released from the object. 1135 1135 */ 1136 int Sh aredClipboardWinDataObject::setTransferLocked(PSHCLTRANSFER pTransfer)1136 int ShClWinDataObject::setTransferLocked(PSHCLTRANSFER pTransfer) 1137 1137 { 1138 1138 AssertReturn(RTCritSectIsOwned(&m_CritSect), VERR_WRONG_ORDER); … … 1150 1150 m_pTransfer = pTransfer; 1151 1151 1152 Sh aredClipboardWinTransferCtx *pWinURITransferCtx = (SharedClipboardWinTransferCtx *)pTransfer->pvUser;1152 ShClWinTransferCtx *pWinURITransferCtx = (ShClWinTransferCtx *)pTransfer->pvUser; 1153 1153 AssertPtr(pWinURITransferCtx); 1154 1154 … … 1164 1164 if (m_pTransfer) 1165 1165 { 1166 Sh aredClipboardWinTransferCtx *pWinURITransferCtx = (SharedClipboardWinTransferCtx *)m_pTransfer->pvUser;1166 ShClWinTransferCtx *pWinURITransferCtx = (ShClWinTransferCtx *)m_pTransfer->pvUser; 1167 1167 AssertPtr(pWinURITransferCtx); 1168 1168 … … 1188 1188 * When set to NULL, the transfer will be released from the object. 1189 1189 */ 1190 int Sh aredClipboardWinDataObject::SetTransfer(PSHCLTRANSFER pTransfer)1190 int ShClWinDataObject::SetTransfer(PSHCLTRANSFER pTransfer) 1191 1191 { 1192 1192 lock(); … … 1206 1206 * @param rcSts Result code. Optional. 1207 1207 * 1208 * @note Called by the main clipboard thread + Sh aredClipboardWinStreamImpl.1209 */ 1210 int Sh aredClipboardWinDataObject::SetStatus(Status enmStatus, int rcSts /* = VINF_SUCCESS */)1208 * @note Called by the main clipboard thread + ShClWinStreamImpl. 1209 */ 1210 int ShClWinDataObject::SetStatus(Status enmStatus, int rcSts /* = VINF_SUCCESS */) 1211 1211 { 1212 1212 lock(); … … 1219 1219 1220 1220 /* static */ 1221 void Sh aredClipboardWinDataObject::logFormat(CLIPFORMAT fmt)1221 void ShClWinDataObject::logFormat(CLIPFORMAT fmt) 1222 1222 { 1223 1223 char szFormat[128]; … … 1230 1230 } 1231 1231 1232 bool Sh aredClipboardWinDataObject::lookupFormatEtc(LPFORMATETC pFormatEtc, ULONG *puIndex)1232 bool ShClWinDataObject::lookupFormatEtc(LPFORMATETC pFormatEtc, ULONG *puIndex) 1233 1233 { 1234 1234 AssertReturn(pFormatEtc, false); … … 1258 1258 } 1259 1259 1260 void Sh aredClipboardWinDataObject::registerFormat(LPFORMATETC pFormatEtc, CLIPFORMAT clipFormat,1260 void ShClWinDataObject::registerFormat(LPFORMATETC pFormatEtc, CLIPFORMAT clipFormat, 1261 1261 TYMED tyMed, LONG lIndex, DWORD dwAspect, 1262 1262 DVTARGETDEVICE *pTargetDevice) … … 1285 1285 * @note Caller must have taken the critical section. 1286 1286 */ 1287 int Sh aredClipboardWinDataObject::setStatusLocked(Status enmStatus, int rc /* = VINF_SUCCESS */)1287 int ShClWinDataObject::setStatusLocked(Status enmStatus, int rc /* = VINF_SUCCESS */) 1288 1288 { 1289 1289 AssertReturn(enmStatus == Error || RT_SUCCESS(rc), VERR_INVALID_PARAMETER); -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardEnumFormatEtcImpl-win.cpp
r100665 r103631 56 56 57 57 58 Sh aredClipboardWinEnumFormatEtc::SharedClipboardWinEnumFormatEtc(void)58 ShClWinEnumFormatEtc::ShClWinEnumFormatEtc(void) 59 59 : m_lRefCount(1), 60 60 m_nIndex(0) … … 66 66 } 67 67 68 Sh aredClipboardWinEnumFormatEtc::~SharedClipboardWinEnumFormatEtc(void)68 ShClWinEnumFormatEtc::~ShClWinEnumFormatEtc(void) 69 69 { 70 70 Destroy(); … … 85 85 * @param cFormats Number of formats in \a pFormatEtc. 86 86 */ 87 int Sh aredClipboardWinEnumFormatEtc::Init(LPFORMATETC pFormatEtc, ULONG cFormats)87 int ShClWinEnumFormatEtc::Init(LPFORMATETC pFormatEtc, ULONG cFormats) 88 88 { 89 89 LogFlowFunc(("pFormatEtc=%p, cFormats=%RU32\n", pFormatEtc, cFormats)); … … 96 96 i, pFormatEtc[i].cfFormat, pFormatEtc[i].tymed, pFormatEtc[i].dwAspect)); 97 97 98 Sh aredClipboardWinDataObject::logFormat(pFormatEtc[i].cfFormat);99 100 Sh aredClipboardWinEnumFormatEtc::CopyFormat(&m_pFormatEtc[i], &pFormatEtc[i]);98 ShClWinDataObject::logFormat(pFormatEtc[i].cfFormat); 99 100 ShClWinEnumFormatEtc::CopyFormat(&m_pFormatEtc[i], &pFormatEtc[i]); 101 101 } 102 102 … … 109 109 * Destroys an IEnumFORMATETC instance. 110 110 */ 111 void Sh aredClipboardWinEnumFormatEtc::Destroy(void)111 void ShClWinEnumFormatEtc::Destroy(void) 112 112 { 113 113 if (m_pFormatEtc) … … 130 130 */ 131 131 132 STDMETHODIMP_(ULONG) Sh aredClipboardWinEnumFormatEtc::AddRef(void)132 STDMETHODIMP_(ULONG) ShClWinEnumFormatEtc::AddRef(void) 133 133 { 134 134 return InterlockedIncrement(&m_lRefCount); 135 135 } 136 136 137 STDMETHODIMP_(ULONG) Sh aredClipboardWinEnumFormatEtc::Release(void)137 STDMETHODIMP_(ULONG) ShClWinEnumFormatEtc::Release(void) 138 138 { 139 139 LONG lCount = InterlockedDecrement(&m_lRefCount); … … 148 148 } 149 149 150 STDMETHODIMP Sh aredClipboardWinEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject)150 STDMETHODIMP ShClWinEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject) 151 151 { 152 152 if ( iid == IID_IEnumFORMATETC … … 162 162 } 163 163 164 STDMETHODIMP Sh aredClipboardWinEnumFormatEtc::Next(ULONG cFormats, LPFORMATETC pFormatEtc, ULONG *pcFetched)164 STDMETHODIMP ShClWinEnumFormatEtc::Next(ULONG cFormats, LPFORMATETC pFormatEtc, ULONG *pcFetched) 165 165 { 166 166 ULONG ulCopied = 0; … … 172 172 && ulCopied < cFormats) 173 173 { 174 Sh aredClipboardWinEnumFormatEtc::CopyFormat(&pFormatEtc[ulCopied], &m_pFormatEtc[m_nIndex]);174 ShClWinEnumFormatEtc::CopyFormat(&pFormatEtc[ulCopied], &m_pFormatEtc[m_nIndex]); 175 175 ulCopied++; 176 176 m_nIndex++; … … 183 183 } 184 184 185 STDMETHODIMP Sh aredClipboardWinEnumFormatEtc::Skip(ULONG cFormats)185 STDMETHODIMP ShClWinEnumFormatEtc::Skip(ULONG cFormats) 186 186 { 187 187 m_nIndex += cFormats; … … 189 189 } 190 190 191 STDMETHODIMP Sh aredClipboardWinEnumFormatEtc::Reset(void)191 STDMETHODIMP ShClWinEnumFormatEtc::Reset(void) 192 192 { 193 193 m_nIndex = 0; … … 195 195 } 196 196 197 STDMETHODIMP Sh aredClipboardWinEnumFormatEtc::Clone(IEnumFORMATETC **ppEnumFormatEtc)197 STDMETHODIMP ShClWinEnumFormatEtc::Clone(IEnumFORMATETC **ppEnumFormatEtc) 198 198 { 199 199 HRESULT hResult = CreateEnumFormatEtc(m_nNumFormats, m_pFormatEtc, ppEnumFormatEtc); 200 200 if (hResult == S_OK) 201 ((Sh aredClipboardWinEnumFormatEtc *) *ppEnumFormatEtc)->m_nIndex = m_nIndex;201 ((ShClWinEnumFormatEtc *) *ppEnumFormatEtc)->m_nIndex = m_nIndex; 202 202 203 203 return hResult; … … 205 205 206 206 /* static */ 207 void Sh aredClipboardWinEnumFormatEtc::CopyFormat(LPFORMATETC pDest, LPFORMATETC pSource)207 void ShClWinEnumFormatEtc::CopyFormat(LPFORMATETC pDest, LPFORMATETC pSource) 208 208 { 209 209 AssertPtrReturnVoid(pDest); … … 220 220 221 221 /* static */ 222 HRESULT Sh aredClipboardWinEnumFormatEtc::CreateEnumFormatEtc(UINT nNumFormats, LPFORMATETC pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc)222 HRESULT ShClWinEnumFormatEtc::CreateEnumFormatEtc(UINT nNumFormats, LPFORMATETC pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc) 223 223 { 224 224 AssertReturn(nNumFormats, E_INVALIDARG); … … 228 228 HRESULT hr; 229 229 230 Sh aredClipboardWinEnumFormatEtc *pEnumFormatEtc = new SharedClipboardWinEnumFormatEtc();230 ShClWinEnumFormatEtc *pEnumFormatEtc = new ShClWinEnumFormatEtc(); 231 231 if (pEnumFormatEtc) 232 232 { -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp
r103480 r103631 60 60 61 61 62 Sh aredClipboardWinStreamImpl::SharedClipboardWinStreamImpl(SharedClipboardWinDataObject *pParent, PSHCLTRANSFER pTransfer,63 62 ShClWinStreamImpl::ShClWinStreamImpl(ShClWinDataObject *pParent, PSHCLTRANSFER pTransfer, 63 const Utf8Str &strPath, PSHCLFSOBJINFO pObjInfo) 64 64 : m_pParent(pParent) 65 65 , m_lRefCount(1) /* Our IDataObjct *always* holds the last reference to this object; needed for the callbacks. */ … … 81 81 } 82 82 83 Sh aredClipboardWinStreamImpl::~SharedClipboardWinStreamImpl(void)83 ShClWinStreamImpl::~ShClWinStreamImpl(void) 84 84 { 85 85 LogFlowThisFuncEnter(); … … 95 95 */ 96 96 97 STDMETHODIMP Sh aredClipboardWinStreamImpl::QueryInterface(REFIID iid, void **ppvObject)97 STDMETHODIMP ShClWinStreamImpl::QueryInterface(REFIID iid, void **ppvObject) 98 98 { 99 99 AssertPtrReturn(ppvObject, E_INVALIDARG); … … 124 124 } 125 125 126 STDMETHODIMP_(ULONG) Sh aredClipboardWinStreamImpl::AddRef(void)126 STDMETHODIMP_(ULONG) ShClWinStreamImpl::AddRef(void) 127 127 { 128 128 LONG lCount = InterlockedIncrement(&m_lRefCount); … … 131 131 } 132 132 133 STDMETHODIMP_(ULONG) Sh aredClipboardWinStreamImpl::Release(void)133 STDMETHODIMP_(ULONG) ShClWinStreamImpl::Release(void) 134 134 { 135 135 LONG lCount = InterlockedDecrement(&m_lRefCount); … … 148 148 */ 149 149 150 STDMETHODIMP Sh aredClipboardWinStreamImpl::Clone(IStream** ppStream)150 STDMETHODIMP ShClWinStreamImpl::Clone(IStream** ppStream) 151 151 { 152 152 RT_NOREF(ppStream); … … 156 156 } 157 157 158 STDMETHODIMP Sh aredClipboardWinStreamImpl::Commit(DWORD dwFrags)158 STDMETHODIMP ShClWinStreamImpl::Commit(DWORD dwFrags) 159 159 { 160 160 RT_NOREF(dwFrags); … … 164 164 } 165 165 166 STDMETHODIMP Sh aredClipboardWinStreamImpl::CopyTo(IStream *pDestStream, ULARGE_INTEGER nBytesToCopy, ULARGE_INTEGER *nBytesRead,166 STDMETHODIMP ShClWinStreamImpl::CopyTo(IStream *pDestStream, ULARGE_INTEGER nBytesToCopy, ULARGE_INTEGER *nBytesRead, 167 167 ULARGE_INTEGER *nBytesWritten) 168 168 { … … 173 173 } 174 174 175 STDMETHODIMP Sh aredClipboardWinStreamImpl::LockRegion(ULARGE_INTEGER nStart, ULARGE_INTEGER nBytes,DWORD dwFlags)175 STDMETHODIMP ShClWinStreamImpl::LockRegion(ULARGE_INTEGER nStart, ULARGE_INTEGER nBytes,DWORD dwFlags) 176 176 { 177 177 RT_NOREF(nStart, nBytes, dwFlags); … … 182 182 183 183 /* Note: Windows seems to assume EOF if nBytesRead < nBytesToRead. */ 184 STDMETHODIMP Sh aredClipboardWinStreamImpl::Read(void *pvBuffer, ULONG nBytesToRead, ULONG *nBytesRead)184 STDMETHODIMP ShClWinStreamImpl::Read(void *pvBuffer, ULONG nBytesToRead, ULONG *nBytesRead) 185 185 { 186 186 LogFlowThisFunc(("Enter: m_cbProcessed=%RU64\n", m_cbProcessed)); … … 249 249 250 250 if (m_pParent) 251 m_pParent->SetStatus(Sh aredClipboardWinDataObject::Completed);251 m_pParent->SetStatus(ShClWinDataObject::Completed); 252 252 } 253 253 } … … 256 256 { 257 257 if (m_pParent) 258 m_pParent->SetStatus(Sh aredClipboardWinDataObject::Error, rc /* Propagate rc */);258 m_pParent->SetStatus(ShClWinDataObject::Error, rc /* Propagate rc */); 259 259 } 260 260 … … 271 271 } 272 272 273 STDMETHODIMP Sh aredClipboardWinStreamImpl::Revert(void)274 { 275 LogFlowThisFuncEnter(); 276 return E_NOTIMPL; 277 } 278 279 STDMETHODIMP Sh aredClipboardWinStreamImpl::Seek(LARGE_INTEGER nMove, DWORD dwOrigin, ULARGE_INTEGER* nNewPos)273 STDMETHODIMP ShClWinStreamImpl::Revert(void) 274 { 275 LogFlowThisFuncEnter(); 276 return E_NOTIMPL; 277 } 278 279 STDMETHODIMP ShClWinStreamImpl::Seek(LARGE_INTEGER nMove, DWORD dwOrigin, ULARGE_INTEGER* nNewPos) 280 280 { 281 281 RT_NOREF(nMove, dwOrigin, nNewPos); … … 286 286 } 287 287 288 STDMETHODIMP Sh aredClipboardWinStreamImpl::SetSize(ULARGE_INTEGER nNewSize)288 STDMETHODIMP ShClWinStreamImpl::SetSize(ULARGE_INTEGER nNewSize) 289 289 { 290 290 RT_NOREF(nNewSize); … … 294 294 } 295 295 296 STDMETHODIMP Sh aredClipboardWinStreamImpl::Stat(STATSTG *pStatStg, DWORD dwFlags)296 STDMETHODIMP ShClWinStreamImpl::Stat(STATSTG *pStatStg, DWORD dwFlags) 297 297 { 298 298 HRESULT hr = S_OK; … … 355 355 } 356 356 357 STDMETHODIMP Sh aredClipboardWinStreamImpl::UnlockRegion(ULARGE_INTEGER nStart, ULARGE_INTEGER nBytes, DWORD dwFlags)357 STDMETHODIMP ShClWinStreamImpl::UnlockRegion(ULARGE_INTEGER nStart, ULARGE_INTEGER nBytes, DWORD dwFlags) 358 358 { 359 359 RT_NOREF(nStart, nBytes, dwFlags); … … 363 363 } 364 364 365 STDMETHODIMP Sh aredClipboardWinStreamImpl::Write(const void *pvBuffer, ULONG nBytesToRead, ULONG *nBytesRead)365 STDMETHODIMP ShClWinStreamImpl::Write(const void *pvBuffer, ULONG nBytesToRead, ULONG *nBytesRead) 366 366 { 367 367 RT_NOREF(pvBuffer, nBytesToRead, nBytesRead); … … 386 386 */ 387 387 /* static */ 388 HRESULT Sh aredClipboardWinStreamImpl::Create(SharedClipboardWinDataObject *pParent, PSHCLTRANSFER pTransfer,388 HRESULT ShClWinStreamImpl::Create(ShClWinDataObject *pParent, PSHCLTRANSFER pTransfer, 389 389 const Utf8Str &strPath, PSHCLFSOBJINFO pObjInfo, 390 390 IStream **ppStream) … … 392 392 AssertPtrReturn(pTransfer, E_POINTER); 393 393 394 Sh aredClipboardWinStreamImpl *pStream = new SharedClipboardWinStreamImpl(pParent, pTransfer, strPath, pObjInfo);394 ShClWinStreamImpl *pStream = new ShClWinStreamImpl(pParent, pTransfer, strPath, pObjInfo); 395 395 if (pStream) 396 396 { -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp
r103615 r103631 54 54 55 55 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 56 int Sh aredClipboardWinTransferDropFilesToStringList(DROPFILES *pDropFiles, char **ppszList, uint32_t *pcbList);56 int ShClWinTransferDropFilesToStringList(DROPFILES *pDropFiles, char **ppszList, uint32_t *pcbList); 57 57 #endif 58 58 … … 64 64 * @param hWnd Handle of window to open clipboard for. 65 65 */ 66 int Sh aredClipboardWinOpen(HWND hWnd)66 int ShClWinOpen(HWND hWnd) 67 67 { 68 68 /* "OpenClipboard fails if another window has the clipboard open." … … 112 112 * @returns VBox status code. 113 113 */ 114 int Sh aredClipboardWinClose(void)114 int ShClWinClose(void) 115 115 { 116 116 int rc; … … 142 142 * @returns VBox status code. 143 143 */ 144 int Sh aredClipboardWinClear(void)144 int ShClWinClear(void) 145 145 { 146 146 LogFlowFuncEnter(); … … 164 164 * @param pWinCtx Shared Clipboard Windows context to initialize. 165 165 */ 166 int Sh aredClipboardWinCtxInit(PSHCLWINCTX pWinCtx)166 int ShClWinCtxInit(PSHCLWINCTX pWinCtx) 167 167 { 168 168 int rc = RTCritSectInit(&pWinCtx->CritSect); … … 170 170 { 171 171 /* Check that new Clipboard API is available. */ 172 Sh aredClipboardWinCheckAndInitNewAPI(&pWinCtx->newAPI);172 ShClWinCheckAndInitNewAPI(&pWinCtx->newAPI); 173 173 /* Do *not* check the rc, as the call might return VERR_SYMBOL_NOT_FOUND is the new API isn't available. */ 174 174 … … 191 191 * @param pWinCtx Shared Clipboard Windows context to destroy. 192 192 */ 193 void Sh aredClipboardWinCtxDestroy(PSHCLWINCTX pWinCtx)193 void ShClWinCtxDestroy(PSHCLWINCTX pWinCtx) 194 194 { 195 195 if (!pWinCtx) … … 213 213 * Will be set to NULL if the new API is not available. 214 214 */ 215 int Sh aredClipboardWinCheckAndInitNewAPI(PSHCLWINAPINEW pAPI)215 int ShClWinCheckAndInitNewAPI(PSHCLWINAPINEW pAPI) 216 216 { 217 217 RTLDRMOD hUser32 = NIL_RTLDRMOD; … … 248 248 * @param pAPI Structure used for checking if the new clipboard API is available or not. 249 249 */ 250 bool Sh aredClipboardWinIsNewAPI(PSHCLWINAPINEW pAPI)250 bool ShClWinIsNewAPI(PSHCLWINAPINEW pAPI) 251 251 { 252 252 if (!pAPI) … … 261 261 * @param pCtx Windows clipboard context to use to add ourselves. 262 262 */ 263 int Sh aredClipboardWinChainAdd(PSHCLWINCTX pCtx)263 int ShClWinChainAdd(PSHCLWINCTX pCtx) 264 264 { 265 265 const PSHCLWINAPINEW pAPI = &pCtx->newAPI; 266 266 267 267 BOOL fRc; 268 if (Sh aredClipboardWinIsNewAPI(pAPI))268 if (ShClWinIsNewAPI(pAPI)) 269 269 fRc = pAPI->pfnAddClipboardFormatListener(pCtx->hWnd); 270 270 else … … 293 293 * @param pCtx Windows clipboard context to use to remove ourselves. 294 294 */ 295 int Sh aredClipboardWinChainRemove(PSHCLWINCTX pCtx)295 int ShClWinChainRemove(PSHCLWINCTX pCtx) 296 296 { 297 297 if (!pCtx->hWnd) … … 301 301 302 302 BOOL fRc; 303 if (Sh aredClipboardWinIsNewAPI(pAPI))303 if (ShClWinIsNewAPI(pAPI)) 304 304 { 305 305 fRc = pAPI->pfnRemoveClipboardFormatListener(pCtx->hWnd); … … 335 335 * @param lResult Additional data to pass. Not used currently. 336 336 */ 337 VOID CALLBACK Sh aredClipboardWinChainPingProc(HWND hWnd, UINT uMsg, ULONG_PTR dwData, LRESULT lResult) RT_NOTHROW_DEF337 VOID CALLBACK ShClWinChainPingProc(HWND hWnd, UINT uMsg, ULONG_PTR dwData, LRESULT lResult) RT_NOTHROW_DEF 338 338 { 339 339 RT_NOREF(hWnd); … … 357 357 * @param lParam LPARAM to pass. 358 358 */ 359 LRESULT Sh aredClipboardWinChainPassToNext(PSHCLWINCTX pWinCtx,359 LRESULT ShClWinChainPassToNext(PSHCLWINCTX pWinCtx, 360 360 UINT msg, WPARAM wParam, LPARAM lParam) 361 361 { … … 386 386 * @param uFormat Windows clipboard format to convert. 387 387 */ 388 SHCLFORMAT Sh aredClipboardWinClipboardFormatToVBox(UINT uFormat)388 SHCLFORMAT ShClWinClipboardFormatToVBox(UINT uFormat) 389 389 { 390 390 /* Insert the requested clipboard format data into the clipboard. */ … … 445 445 * @param pfFormats Where to store the retrieved formats. 446 446 */ 447 int Sh aredClipboardWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMATS pfFormats)447 int ShClWinGetFormats(PSHCLWINCTX pCtx, PSHCLFORMATS pfFormats) 448 448 { 449 449 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); … … 453 453 454 454 /* Query list of available formats and report to host. */ 455 int rc = Sh aredClipboardWinOpen(pCtx->hWnd);455 int rc = ShClWinOpen(pCtx->hWnd); 456 456 if (RT_SUCCESS(rc)) 457 457 { 458 458 UINT uCurFormat = 0; /* Must be set to zero for EnumClipboardFormats(). */ 459 459 while ((uCurFormat = EnumClipboardFormats(uCurFormat)) != 0) 460 fFormats |= Sh aredClipboardWinClipboardFormatToVBox(uCurFormat);461 462 int rc2 = Sh aredClipboardWinClose();460 fFormats |= ShClWinClipboardFormatToVBox(uCurFormat); 461 462 int rc2 = ShClWinClose(); 463 463 AssertRC(rc2); 464 464 LogFlowFunc(("fFormats=%#x\n", fFormats)); … … 479 479 * @param puValue Where to return extracted value of CF_HTML field. 480 480 */ 481 int Sh aredClipboardWinGetCFHTMLHeaderValue(const char *pszSrc, const char *pszOption, uint32_t *puValue)481 int ShClWinGetCFHTMLHeaderValue(const char *pszSrc, const char *pszOption, uint32_t *puValue) 482 482 { 483 483 AssertPtrReturn(pszSrc, VERR_INVALID_POINTER); … … 503 503 * @param pszSource Source string to check. 504 504 */ 505 bool Sh aredClipboardWinIsCFHTML(const char *pszSource)505 bool ShClWinIsCFHTML(const char *pszSource) 506 506 { 507 507 return RTStrStr(pszSource, "Version:") != NULL … … 520 520 * @param pcbOutput Where to the return length of the result (bytes/chars). 521 521 */ 522 int Sh aredClipboardWinConvertCFHTMLToMIME(const char *pszSource, const uint32_t cch, char **ppszOutput, uint32_t *pcbOutput)522 int ShClWinConvertCFHTMLToMIME(const char *pszSource, const uint32_t cch, char **ppszOutput, uint32_t *pcbOutput) 523 523 { 524 524 Assert(pszSource); … … 528 528 529 529 uint32_t offStart; 530 int rc = Sh aredClipboardWinGetCFHTMLHeaderValue(pszSource, "StartFragment:", &offStart);530 int rc = ShClWinGetCFHTMLHeaderValue(pszSource, "StartFragment:", &offStart); 531 531 if (RT_SUCCESS(rc)) 532 532 { 533 533 uint32_t offEnd; 534 rc = Sh aredClipboardWinGetCFHTMLHeaderValue(pszSource, "EndFragment:", &offEnd);534 rc = ShClWinGetCFHTMLHeaderValue(pszSource, "EndFragment:", &offEnd); 535 535 if (RT_SUCCESS(rc)) 536 536 { … … 612 612 * @note Everything inside of fragment can be UTF8. Windows allows it. Everything in header should be Latin1. 613 613 */ 614 int Sh aredClipboardWinConvertMIMEToCFHTML(const char *pszSource, size_t cb, char **ppszOutput, uint32_t *pcbOutput)614 int ShClWinConvertMIMEToCFHTML(const char *pszSource, size_t cb, char **ppszOutput, uint32_t *pcbOutput) 615 615 { 616 616 Assert(ppszOutput); … … 709 709 * @param lParam lParam to pass on. 710 710 */ 711 LRESULT Sh aredClipboardWinHandleWMChangeCBChain(PSHCLWINCTX pWinCtx,711 LRESULT ShClWinHandleWMChangeCBChain(PSHCLWINCTX pWinCtx, 712 712 HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 713 713 { … … 716 716 LogFlowFuncEnter(); 717 717 718 if (Sh aredClipboardWinIsNewAPI(&pWinCtx->newAPI))718 if (ShClWinIsNewAPI(&pWinCtx->newAPI)) 719 719 { 720 720 lresultRc = DefWindowProc(hWnd, msg, wParam, lParam); … … 757 757 * @param pWinCtx Windows context to use. 758 758 */ 759 int Sh aredClipboardWinHandleWMDestroy(PSHCLWINCTX pWinCtx)759 int ShClWinHandleWMDestroy(PSHCLWINCTX pWinCtx) 760 760 { 761 761 LogFlowFuncEnter(); … … 764 764 765 765 /* MS recommends to remove from Clipboard chain in this callback. */ 766 Sh aredClipboardWinChainRemove(pWinCtx);766 ShClWinChainRemove(pWinCtx); 767 767 768 768 if (pWinCtx->oldAPI.timerRefresh) … … 783 783 * @param hWnd Window handle to use. 784 784 */ 785 int Sh aredClipboardWinHandleWMRenderAllFormats(PSHCLWINCTX pWinCtx, HWND hWnd)785 int ShClWinHandleWMRenderAllFormats(PSHCLWINCTX pWinCtx, HWND hWnd) 786 786 { 787 787 RT_NOREF(pWinCtx); … … 792 792 * windows is to be destroyed and therefore the guest side becomes inactive. 793 793 */ 794 int rc = Sh aredClipboardWinOpen(hWnd);794 int rc = ShClWinOpen(hWnd); 795 795 if (RT_SUCCESS(rc)) 796 796 { 797 Sh aredClipboardWinClear();798 Sh aredClipboardWinClose();797 ShClWinClear(); 798 ShClWinClose(); 799 799 } 800 800 … … 810 810 * @param pWinCtx Windows context to use. 811 811 */ 812 int Sh aredClipboardWinHandleWMTimer(PSHCLWINCTX pWinCtx)812 int ShClWinHandleWMTimer(PSHCLWINCTX pWinCtx) 813 813 { 814 814 int rc = VINF_SUCCESS; 815 815 816 if (!Sh aredClipboardWinIsNewAPI(&pWinCtx->newAPI)) /* Only run when using the "old" Windows API. */816 if (!ShClWinIsNewAPI(&pWinCtx->newAPI)) /* Only run when using the "old" Windows API. */ 817 817 { 818 818 LogFlowFuncEnter(); … … 824 824 if (!hViewer || pWinCtx->oldAPI.fCBChainPingInProcess) 825 825 { 826 Sh aredClipboardWinChainRemove(pWinCtx);827 Sh aredClipboardWinChainAdd(pWinCtx);826 ShClWinChainRemove(pWinCtx); 827 ShClWinChainAdd(pWinCtx); 828 828 } 829 829 … … 835 835 if (hViewer) 836 836 SendMessageCallback(hViewer, WM_CHANGECBCHAIN, (WPARAM)pWinCtx->hWndNextInChain, (LPARAM)pWinCtx->hWndNextInChain, 837 Sh aredClipboardWinChainPingProc, (ULONG_PTR)pWinCtx);837 ShClWinChainPingProc, (ULONG_PTR)pWinCtx); 838 838 } 839 839 … … 853 853 * @param fFormats Clipboard format(s) to announce. 854 854 */ 855 static int sh aredClipboardWinAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats)855 static int shClWinAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats) 856 856 { 857 857 LogFunc(("fFormats=0x%x\n", fFormats)); … … 960 960 * @param hWnd The window handle to use as owner. 961 961 */ 962 int Sh aredClipboardWinClearAndAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats, HWND hWnd)963 { 964 int rc = Sh aredClipboardWinOpen(hWnd);962 int ShClWinClearAndAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats, HWND hWnd) 963 { 964 int rc = ShClWinOpen(hWnd); 965 965 if (RT_SUCCESS(rc)) 966 966 { 967 Sh aredClipboardWinClear();968 969 rc = sh aredClipboardWinAnnounceFormats(pWinCtx, fFormats);967 ShClWinClear(); 968 969 rc = shClWinAnnounceFormats(pWinCtx, fFormats); 970 970 Assert(pWinCtx->hWndClipboardOwnerUs == hWnd || pWinCtx->hWndClipboardOwnerUs == NULL); 971 971 972 Sh aredClipboardWinClose();972 ShClWinClose(); 973 973 } 974 974 return rc; … … 985 985 * @note ASSUMES that the clipboard has already been opened. 986 986 */ 987 int Sh aredClipboardWinDataWrite(UINT cfFormat, void *pvData, uint32_t cbData)987 int ShClWinDataWrite(UINT cfFormat, void *pvData, uint32_t cbData) 988 988 { 989 989 AssertPtrReturn(pvData, VERR_INVALID_POINTER); … … 1053 1053 * @param pCallbacks Callbacks table to use. 1054 1054 */ 1055 int Sh aredClipboardWinTransferCreateAndSetDataObject(PSHCLWINCTX pWinCtx,1056 PSHCLCONTEXT pCtx, Sh aredClipboardWinDataObject::PCALLBACKS pCallbacks)1055 int ShClWinTransferCreateAndSetDataObject(PSHCLWINCTX pWinCtx, 1056 PSHCLCONTEXT pCtx, ShClWinDataObject::PCALLBACKS pCallbacks) 1057 1057 { 1058 1058 AssertPtrReturn(pWinCtx, VERR_INVALID_POINTER); … … 1072 1072 * The data object will be deleted automatically once its refcount reaches 0. 1073 1073 */ 1074 Sh aredClipboardWinDataObject *pObj = new SharedClipboardWinDataObject();1074 ShClWinDataObject *pObj = new ShClWinDataObject(); 1075 1075 if (pObj) 1076 1076 { … … 1087 1087 if (RT_SUCCESS(rc)) 1088 1088 { 1089 Sh aredClipboardWinClose();1089 ShClWinClose(); 1090 1090 /* Note: Clipboard must be closed first before calling OleSetClipboard(). */ 1091 1091 1092 /** @todo There is a potential race between Sh aredClipboardWinClose() and OleSetClipboard(),1092 /** @todo There is a potential race between ShClWinClose() and OleSetClipboard(), 1093 1093 * where another application could own the clipboard (open), and thus the call to 1094 1094 * OleSetClipboard() will fail. Needs (better) fixing. */ … … 1139 1139 * @param pTransfer Shared Clipboard transfer to create implementation-specific data for. 1140 1140 */ 1141 int Sh aredClipboardWinTransferCreate(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer)1141 int ShClWinTransferCreate(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer) 1142 1142 { 1143 1143 RT_NOREF(pWinCtx); … … 1146 1146 && pTransfer->cbUser == 0, ("Already initialized Windows-specific data\n"), VERR_WRONG_ORDER); 1147 1147 1148 pTransfer->pvUser = new Sh aredClipboardWinTransferCtx(); /** @todo Can this throw? */1148 pTransfer->pvUser = new ShClWinTransferCtx(); /** @todo Can this throw? */ 1149 1149 AssertPtrReturn(pTransfer->pvUser, VERR_INVALID_POINTER); 1150 pTransfer->cbUser = sizeof(Sh aredClipboardWinTransferCtx);1150 pTransfer->cbUser = sizeof(ShClWinTransferCtx); 1151 1151 1152 1152 return VINF_SUCCESS; … … 1160 1160 * @param pTransfer Shared Clipboard transfer to destroy implementation-specific data for. 1161 1161 */ 1162 void Sh aredClipboardWinTransferDestroy(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer)1162 void ShClWinTransferDestroy(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer) 1163 1163 { 1164 1164 RT_NOREF(pWinCtx); … … 1171 1171 if (pTransfer->pvUser) 1172 1172 { 1173 Assert(pTransfer->cbUser == sizeof(Sh aredClipboardWinTransferCtx));1174 Sh aredClipboardWinTransferCtx *pWinURITransferCtx = (SharedClipboardWinTransferCtx *)pTransfer->pvUser;1173 Assert(pTransfer->cbUser == sizeof(ShClWinTransferCtx)); 1174 ShClWinTransferCtx *pWinURITransferCtx = (ShClWinTransferCtx *)pTransfer->pvUser; 1175 1175 AssertPtr(pWinURITransferCtx); 1176 1176 … … 1199 1199 * @param pObj Data object to initialize transfer for. 1200 1200 */ 1201 static int sh aredClipboardWinTransferInitializeInternal(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer,1202 SharedClipboardWinDataObject *pObj)1201 static int shClWinTransferInitializeInternal(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer, 1202 ShClWinDataObject *pObj) 1203 1203 { 1204 1204 RT_NOREF(pWinCtx); … … 1215 1215 * @param pTransfer Transfer to initialize for the data object. 1216 1216 */ 1217 int Sh aredClipboardWinTransferInitialize(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer)1217 int ShClWinTransferInitialize(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer) 1218 1218 { 1219 1219 int rc = RTCritSectEnter(&pWinCtx->CritSect); 1220 1220 if (RT_SUCCESS(rc)) 1221 1221 { 1222 Sh aredClipboardWinDataObject *pObj = pWinCtx->pDataObjInFlight;1222 ShClWinDataObject *pObj = pWinCtx->pDataObjInFlight; 1223 1223 if (pObj) 1224 1224 { 1225 rc = sh aredClipboardWinTransferInitializeInternal(pWinCtx, pTransfer, pObj);1225 rc = shClWinTransferInitializeInternal(pWinCtx, pTransfer, pObj); 1226 1226 } 1227 1227 else /* No current in-flight data object. */ … … 1242 1242 * @param pObj Data object to start transfer for. 1243 1243 */ 1244 static int sh aredClipboardWinTransferStartInternal(PSHCLWINCTX pWinCtx, SharedClipboardWinDataObject *pObj)1244 static int shClWinTransferStartInternal(PSHCLWINCTX pWinCtx, ShClWinDataObject *pObj) 1245 1245 { 1246 1246 RT_NOREF(pWinCtx); 1247 1247 1248 return pObj->SetStatus(Sh aredClipboardWinDataObject::Running);1248 return pObj->SetStatus(ShClWinDataObject::Running); 1249 1249 } 1250 1250 … … 1259 1259 * @param pTransfer Transfer to initialize for the data object. 1260 1260 */ 1261 int Sh aredClipboardWinTransferStart(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer)1261 int ShClWinTransferStart(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer) 1262 1262 { 1263 1263 RT_NOREF(pTransfer); … … 1266 1266 if (RT_SUCCESS(rc)) 1267 1267 { 1268 Sh aredClipboardWinDataObject *pObj = pWinCtx->pDataObjInFlight;1268 ShClWinDataObject *pObj = pWinCtx->pDataObjInFlight; 1269 1269 if (pObj) 1270 1270 { 1271 rc = sh aredClipboardWinTransferStartInternal(pWinCtx, pObj);1271 rc = shClWinTransferStartInternal(pWinCtx, pObj); 1272 1272 if (RT_SUCCESS(rc)) 1273 1273 pWinCtx->pDataObjInFlight = NULL; /* Hand off to Windows on success. */ … … 1291 1291 * @param pTransfer Transfer to get roots for. 1292 1292 */ 1293 int Sh aredClipboardWinTransferGetRootsFromClipboard(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer)1293 int ShClWinTransferGetRootsFromClipboard(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer) 1294 1294 { 1295 1295 AssertPtrReturn(pWinCtx, VERR_INVALID_POINTER); … … 1298 1298 Assert(ShClTransferGetSource(pTransfer) == SHCLSOURCE_LOCAL); /* Sanity. */ 1299 1299 1300 int rc = Sh aredClipboardWinOpen(pWinCtx->hWnd);1300 int rc = ShClWinOpen(pWinCtx->hWnd); 1301 1301 if (RT_SUCCESS(rc)) 1302 1302 { … … 1311 1311 char *pszList = NULL; 1312 1312 uint32_t cbList; 1313 rc = Sh aredClipboardWinTransferDropFilesToStringList((DROPFILES *)hDrop, &pszList, &cbList);1313 rc = ShClWinTransferDropFilesToStringList((DROPFILES *)hDrop, &pszList, &cbList); 1314 1314 1315 1315 GlobalUnlock(hClip); … … 1328 1328 GetLastError())); 1329 1329 1330 Sh aredClipboardWinClose();1330 ShClWinClose(); 1331 1331 } 1332 1332 … … 1346 1346 * Includes zero terminator. 1347 1347 */ 1348 int Sh aredClipboardWinTransferDropFilesToStringList(DROPFILES *pDropFiles, char **ppszList, uint32_t *pcbList)1348 int ShClWinTransferDropFilesToStringList(DROPFILES *pDropFiles, char **ppszList, uint32_t *pcbList) 1349 1349 { 1350 1350 AssertPtrReturn(pDropFiles, VERR_INVALID_POINTER); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp
r103630 r103631 132 132 133 133 if ( u32Format == VBOX_SHCL_FMT_HTML 134 && Sh aredClipboardWinIsCFHTML((const char *)pvSrc))134 && ShClWinIsCFHTML((const char *)pvSrc)) 135 135 { 136 136 /** @todo r=bird: Why the double conversion? */ 137 137 char *pszBuf = NULL; 138 138 uint32_t cbBuf = 0; 139 int rc = Sh aredClipboardWinConvertCFHTMLToMIME((const char *)pvSrc, cbSrc, &pszBuf, &cbBuf);139 int rc = ShClWinConvertCFHTMLToMIME((const char *)pvSrc, cbSrc, &pszBuf, &cbBuf); 140 140 if (RT_SUCCESS(rc)) 141 141 { … … 180 180 static int vboxClipboardSvcWinReadDataFromGuest(PSHCLCONTEXT pCtx, UINT uWinFormat, void **ppvData, uint32_t *pcbData) 181 181 { 182 SHCLFORMAT uVBoxFmt = Sh aredClipboardWinClipboardFormatToVBox(uWinFormat);182 SHCLFORMAT uVBoxFmt = ShClWinClipboardFormatToVBox(uWinFormat); 183 183 if (uVBoxFmt == VBOX_SHCL_FMT_NONE) 184 184 { … … 282 282 rc = ShClTransferSetProvider(pTransfer, &pClient->Transfers.Provider); 283 283 if (RT_SUCCESS(rc)) 284 rc = Sh aredClipboardWinTransferCreate(&pCtx->Win, pTransfer);284 rc = ShClWinTransferCreate(&pCtx->Win, pTransfer); 285 285 } 286 286 … … 312 312 case SHCLTRANSFERDIR_FROM_REMOTE: /* G->H */ 313 313 { 314 rc = Sh aredClipboardWinTransferInitialize(&pCtx->Win, pTransfer);314 rc = ShClWinTransferInitialize(&pCtx->Win, pTransfer); 315 315 break; 316 316 } … … 356 356 case SHCLTRANSFERDIR_FROM_REMOTE: /* H->G */ 357 357 { 358 rc = Sh aredClipboardWinTransferStart(&pCtx->Win, pTransfer);358 rc = ShClWinTransferStart(&pCtx->Win, pTransfer); 359 359 break; 360 360 } … … 385 385 AssertPtr(pTransfer); 386 386 387 Sh aredClipboardWinTransferDestroy(&pCtx->Win, pTransfer);388 } 389 390 /** 391 * @copydoc Sh aredClipboardWinDataObject::CALLBACKS::pfnTransferBegin392 * 393 * Called by Sh aredClipboardWinDataObject::GetData() when the user wants to paste data.387 ShClWinTransferDestroy(&pCtx->Win, pTransfer); 388 } 389 390 /** 391 * @copydoc ShClWinDataObject::CALLBACKS::pfnTransferBegin 392 * 393 * Called by ShClWinDataObject::GetData() when the user wants to paste data. 394 394 * This then creates and initializes a new transfer on the host + lets the guest know about that new transfer. 395 395 * 396 396 * @thread Service main thread. 397 397 */ 398 static DECLCALLBACK(int) shClSvcWinDataObjectTransferBeginCallback(Sh aredClipboardWinDataObject::PCALLBACKCTX pCbCtx)398 static DECLCALLBACK(int) shClSvcWinDataObjectTransferBeginCallback(ShClWinDataObject::PCALLBACKCTX pCbCtx) 399 399 { 400 400 LogFlowFuncEnter(); … … 466 466 { 467 467 LogFunc(("WM_CHANGECBCHAIN\n")); 468 lresultRc = Sh aredClipboardWinHandleWMChangeCBChain(pWinCtx, hWnd, uMsg, wParam, lParam);468 lresultRc = ShClWinHandleWMChangeCBChain(pWinCtx, hWnd, uMsg, wParam, lParam); 469 469 break; 470 470 } … … 497 497 } 498 498 499 lresultRc = Sh aredClipboardWinChainPassToNext(pWinCtx, uMsg, wParam, lParam);499 lresultRc = ShClWinChainPassToNext(pWinCtx, uMsg, wParam, lParam); 500 500 break; 501 501 } … … 503 503 case WM_TIMER: 504 504 { 505 int rc = Sh aredClipboardWinHandleWMTimer(pWinCtx);505 int rc = ShClWinHandleWMTimer(pWinCtx); 506 506 AssertRC(rc); 507 507 … … 513 513 /* Insert the requested clipboard format data into the clipboard. */ 514 514 const UINT uFmtWin = (UINT)wParam; 515 const SHCLFORMAT uFmtVBox = Sh aredClipboardWinClipboardFormatToVBox(uFmtWin);515 const SHCLFORMAT uFmtVBox = ShClWinClipboardFormatToVBox(uFmtWin); 516 516 517 517 LogFunc(("WM_RENDERFORMAT: uFmtWin=%u -> uFmtVBox=0x%x\n", uFmtWin, uFmtVBox)); … … 527 527 /* Unsupported clipboard format is requested. */ 528 528 LogFunc(("WM_RENDERFORMAT unsupported format requested or client is not active\n")); 529 Sh aredClipboardWinClear();529 ShClWinClear(); 530 530 } 531 531 else … … 538 538 /* Wrap HTML clipboard content info CF_HTML format if needed. */ 539 539 if (uFmtVBox == VBOX_SHCL_FMT_HTML 540 && !Sh aredClipboardWinIsCFHTML((char *)pvData))540 && !ShClWinIsCFHTML((char *)pvData)) 541 541 { 542 542 char *pszWrapped = NULL; 543 543 uint32_t cbWrapped = 0; 544 rc = Sh aredClipboardWinConvertMIMEToCFHTML((char *)pvData, cbData, &pszWrapped, &cbWrapped);544 rc = ShClWinConvertMIMEToCFHTML((char *)pvData, cbData, &pszWrapped, &cbWrapped); 545 545 if (RT_SUCCESS(rc)) 546 546 { … … 554 554 } 555 555 556 rc = Sh aredClipboardWinDataWrite(uFmtWin, pvData, cbData);556 rc = ShClWinDataWrite(uFmtWin, pvData, cbData); 557 557 if (RT_FAILURE(rc)) 558 558 LogRel(("Shared Clipboard: Setting clipboard data for Windows host failed with %Rrc\n", rc)); … … 563 563 564 564 if (RT_FAILURE(rc)) 565 Sh aredClipboardWinClear();565 ShClWinClear(); 566 566 } 567 567 … … 573 573 LogFunc(("WM_RENDERALLFORMATS\n")); 574 574 575 int rc = Sh aredClipboardWinHandleWMRenderAllFormats(pWinCtx, hWnd);575 int rc = ShClWinHandleWMRenderAllFormats(pWinCtx, hWnd); 576 576 AssertRC(rc); 577 577 … … 585 585 LogFunc(("SHCL_WIN_WM_REPORT_FORMATS: fFormats=%#xn", fFormats)); 586 586 587 int rc = Sh aredClipboardWinClearAndAnnounceFormats(pWinCtx, fFormats, hWnd);587 int rc = ShClWinClearAndAnnounceFormats(pWinCtx, fFormats, hWnd); 588 588 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 589 589 if ( RT_SUCCESS(rc) … … 594 594 * That way Windows will recognize that there is a data transfer available. 595 595 */ 596 Sh aredClipboardWinDataObject::CALLBACKS Callbacks;596 ShClWinDataObject::CALLBACKS Callbacks; 597 597 RT_ZERO(Callbacks); 598 598 Callbacks.pfnTransferBegin = shClSvcWinDataObjectTransferBeginCallback; 599 599 600 rc = Sh aredClipboardWinTransferCreateAndSetDataObject(pWinCtx, pCtx, &Callbacks);600 rc = ShClWinTransferCreateAndSetDataObject(pWinCtx, pCtx, &Callbacks); 601 601 } 602 602 #else … … 611 611 LogFunc(("WM_DESTROY\n")); 612 612 613 int rc = Sh aredClipboardWinHandleWMDestroy(pWinCtx);613 int rc = ShClWinHandleWMDestroy(pWinCtx); 614 614 AssertRC(rc); 615 615 … … 718 718 SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 719 719 720 rc = Sh aredClipboardWinChainAdd(&pCtx->Win);720 rc = ShClWinChainAdd(&pCtx->Win); 721 721 if (RT_SUCCESS(rc)) 722 722 { 723 if (!Sh aredClipboardWinIsNewAPI(&pWinCtx->newAPI))723 if (!ShClWinIsNewAPI(&pWinCtx->newAPI)) 724 724 pWinCtx->oldAPI.timerRefresh = SetTimer(pWinCtx->hWnd, 0, 10 * 1000, NULL); 725 725 } … … 801 801 { 802 802 SHCLFORMATS fFormats = 0; 803 rc = Sh aredClipboardWinGetFormats(&pCtx->Win, &fFormats);803 rc = ShClWinGetFormats(&pCtx->Win, &fFormats); 804 804 if (RT_SUCCESS(rc)) 805 805 rc = ShClSvcReportFormats(pCtx->pClient, fFormats); … … 854 854 if (pCtx) 855 855 { 856 rc = Sh aredClipboardWinCtxInit(&pCtx->Win);856 rc = ShClWinCtxInit(&pCtx->Win); 857 857 if (RT_SUCCESS(rc)) 858 858 { … … 928 928 } 929 929 930 Sh aredClipboardWinCtxDestroy(&pCtx->Win);930 ShClWinCtxDestroy(&pCtx->Win); 931 931 932 932 if (RT_SUCCESS(rc)) … … 984 984 * The guest wants to read data in the given format. 985 985 */ 986 int rc = Sh aredClipboardWinOpen(pWinCtx->hWnd);986 int rc = ShClWinOpen(pWinCtx->hWnd); 987 987 if (RT_SUCCESS(rc)) 988 988 { … … 1066 1066 char *pszList = NULL; 1067 1067 uint32_t cbList; 1068 rc = Sh aredClipboardWinTransferDropFilesToStringList((DROPFILES *)hDrop, &pszList, &cbList);1068 rc = ShClWinTransferDropFilesToStringList((DROPFILES *)hDrop, &pszList, &cbList); 1069 1069 1070 1070 GlobalUnlock(hClip); … … 1089 1089 } 1090 1090 #endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */ 1091 Sh aredClipboardWinClose();1091 ShClWinClose(); 1092 1092 } 1093 1093 … … 1139 1139 PSHCLWINCTX pWin = &pClient->State.pCtx->Win; 1140 1140 1141 int rc = Sh aredClipboardWinTransferGetRootsFromClipboard(pWin, pCtx->pTransfer);1141 int rc = ShClWinTransferGetRootsFromClipboard(pWin, pCtx->pTransfer); 1142 1142 1143 1143 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardMockHGCM.cpp
r99968 r103631 605 605 ShClBackendSetCallbacks(pBackend, &ShClCallbacks); 606 606 #elif defined (RT_OS_WINDOWS) 607 rc = Sh aredClipboardWinOpen(GetDesktopWindow());607 rc = ShClWinOpen(GetDesktopWindow()); 608 608 if (RT_SUCCESS(rc)) 609 609 { 610 rc = Sh aredClipboardWinDataWrite(CF_UNICODETEXT, pTask->pvData, (uint32_t)pTask->cbData);611 Sh aredClipboardWinClose();610 rc = ShClWinDataWrite(CF_UNICODETEXT, pTask->pvData, (uint32_t)pTask->cbData); 611 ShClWinClose(); 612 612 } 613 613 #endif /* defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS) */ -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceImpl.cpp
r98103 r103631 106 106 uint32_t cbOutput = UINT32_MAX/2; 107 107 RTTestIDisableAssertions(); 108 RTTESTI_CHECK_RC(Sh aredClipboardWinConvertCFHTMLToMIME("", 0, &pszOutput, &cbOutput), VERR_INVALID_PARAMETER);108 RTTESTI_CHECK_RC(ShClWinConvertCFHTMLToMIME("", 0, &pszOutput, &cbOutput), VERR_INVALID_PARAMETER); 109 109 RTTestIRestoreAssertions(); 110 110 111 111 pszOutput = NULL; 112 112 cbOutput = UINT32_MAX/2; 113 RTTESTI_CHECK_RC(Sh aredClipboardWinConvertCFHTMLToMIME((char *)&g_abVBoxOrgCfHtml1[0], g_cbVBoxOrgCfHtml1,113 RTTESTI_CHECK_RC(ShClWinConvertCFHTMLToMIME((char *)&g_abVBoxOrgCfHtml1[0], g_cbVBoxOrgCfHtml1, 114 114 &pszOutput, &cbOutput), VINF_SUCCESS); 115 115 RTTESTI_CHECK(cbOutput == g_cbVBoxOrgMimeHtml1); … … 141 141 char *pszCfHtml = NULL; 142 142 uint32_t cbCfHtml = UINT32_MAX/2; 143 rc = Sh aredClipboardWinConvertMIMEToCFHTML(s_aRoundTrips[i].psz, s_aRoundTrips[i].cch + 1, &pszCfHtml, &cbCfHtml);143 rc = ShClWinConvertMIMEToCFHTML(s_aRoundTrips[i].psz, s_aRoundTrips[i].cch + 1, &pszCfHtml, &cbCfHtml); 144 144 if (rc == VINF_SUCCESS) 145 145 { 146 146 if (strlen(pszCfHtml) + 1 != cbCfHtml) 147 RTTestIFailed("#%u: Sh aredClipboardWinConvertMIMEToCFHTML(%s, %#zx,,) returned incorrect length: %#x, actual %#zx",147 RTTestIFailed("#%u: ShClWinConvertMIMEToCFHTML(%s, %#zx,,) returned incorrect length: %#x, actual %#zx", 148 148 i, s_aRoundTrips[i].psz, s_aRoundTrips[i].cch, cbCfHtml, strlen(pszCfHtml) + 1); 149 149 150 150 char *pszHtml = NULL; 151 151 uint32_t cbHtml = UINT32_MAX/4; 152 rc = Sh aredClipboardWinConvertCFHTMLToMIME(pszCfHtml, (uint32_t)strlen(pszCfHtml), &pszHtml, &cbHtml);152 rc = ShClWinConvertCFHTMLToMIME(pszCfHtml, (uint32_t)strlen(pszCfHtml), &pszHtml, &cbHtml); 153 153 if (rc == VINF_SUCCESS) 154 154 { 155 155 if (strlen(pszHtml) + 1 != cbHtml) 156 RTTestIFailed("#%u: Sh aredClipboardWinConvertCFHTMLToMIME(%s, %#zx,,) returned incorrect length: %#x, actual %#zx",156 RTTestIFailed("#%u: ShClWinConvertCFHTMLToMIME(%s, %#zx,,) returned incorrect length: %#x, actual %#zx", 157 157 i, pszHtml, strlen(pszHtml), cbHtml, strlen(pszHtml) + 1); 158 158 if (strcmp(pszHtml, s_aRoundTrips[i].psz) != 0) … … 162 162 } 163 163 else 164 RTTestIFailed("#%u: Sh aredClipboardWinConvertCFHTMLToMIME(%s, %#zx,,) returned %Rrc, expected VINF_SUCCESS",164 RTTestIFailed("#%u: ShClWinConvertCFHTMLToMIME(%s, %#zx,,) returned %Rrc, expected VINF_SUCCESS", 165 165 i, pszCfHtml, strlen(pszCfHtml), rc); 166 166 RTMemFree(pszCfHtml); 167 167 } 168 168 else 169 RTTestIFailed("#%u: Sh aredClipboardWinConvertMIMEToCFHTML(%s, %#zx,,) returned %Rrc, expected VINF_SUCCESS",169 RTTestIFailed("#%u: ShClWinConvertMIMEToCFHTML(%s, %#zx,,) returned %Rrc, expected VINF_SUCCESS", 170 170 i, s_aRoundTrips[i].psz, s_aRoundTrips[i].cch, rc); 171 171 }
Note:
See TracChangeset
for help on using the changeset viewer.