VirtualBox

Ignore:
Timestamp:
Jun 4, 2019 4:51:48 PM (6 years ago)
Author:
vboxsync
Message:

Shared Clipboard/URI: Update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp

    r78897 r78974  
    4646
    4747
    48 VBoxClipboardWinStreamImpl::VBoxClipboardWinStreamImpl(SharedClipboardProvider *pProvider, SharedClipboardURIObject *pURIObj)
    49     : m_lRefCount(1)
    50     , m_pProvider(pProvider)
     48VBoxClipboardWinStreamImpl::VBoxClipboardWinStreamImpl(VBoxClipboardWinDataObject *pParent,
     49                                                       PSHAREDCLIPBOARDURITRANSFER pTransfer, SharedClipboardURIObject *pURIObj)
     50    : m_pParent(pParent)
     51    , m_lRefCount(1)
     52    , m_pTransfer(pTransfer)
    5153    , m_pURIObj(pURIObj)
    5254{
    53     AssertPtr(m_pProvider);
     55    AssertPtr(m_pTransfer);
     56    AssertPtr(m_pTransfer->pProvider);
    5457    AssertPtr(m_pURIObj);
    5558
    5659    LogFunc(("szSrcPath=%s, cbSize=%RU64\n", m_pURIObj->GetSourcePathAbs().c_str(), m_pURIObj->GetSize()));
    5760
    58     m_pProvider->AddRef();
     61    m_pTransfer->pProvider->AddRef();
    5962}
    6063
     
    6265{
    6366    LogFlowThisFuncEnter();
    64     m_pProvider->Release();
     67
     68    if (   m_pTransfer
     69        && m_pTransfer->pProvider)
     70        m_pTransfer->pProvider->Release();
    6571}
    6672
     
    159165    const uint64_t cbProcessed = m_pURIObj->GetProcessed();
    160166
    161     const size_t cbToRead = RT_MIN(cbSize - cbProcessed, nBytesToRead);
    162           size_t cbRead   = 0;
     167    const uint32_t cbToRead = RT_MIN(cbSize - cbProcessed, nBytesToRead);
     168          uint32_t cbRead   = 0;
    163169
    164170    int rc = VINF_SUCCESS;
    165171
    166172    if (cbToRead)
    167         rc = m_pProvider->ReadData(pvBuffer, cbToRead, &cbRead);
     173    {
     174        VBOXCLIPBOARDFILEDATA FileData;
     175        RT_ZERO(FileData);
     176
     177        FileData.pvData = pvBuffer;
     178        FileData.cbData = cbToRead;
     179
     180        rc = m_pTransfer->pProvider->ReadFileData(&FileData, &cbRead);
     181        if (RT_SUCCESS(rc))
     182        {
     183            if (m_pURIObj->IsComplete())
     184                m_pParent->OnTransferComplete();
     185        }
     186    }
    168187
    169188    if (nBytesRead)
     
    229248 *
    230249 * @returns HRESULT
    231  * @param   pProvider           Pointer to Shared Clipboard provider to use.
     250 * @param   pParent             Pointer to the parent data object.
     251 * @param   pTransfer           Pointer to URI transfer object to use.
    232252 * @param   pURIObj             Pointer to URI object to handle.
    233253 * @param   ppStream            Where to return the created stream object on success.
    234254 */
    235255/* static */
    236 HRESULT VBoxClipboardWinStreamImpl::Create(SharedClipboardProvider *pProvider, SharedClipboardURIObject *pURIObj,
     256HRESULT VBoxClipboardWinStreamImpl::Create(VBoxClipboardWinDataObject *pParent,
     257                                           PSHAREDCLIPBOARDURITRANSFER pTransfer, SharedClipboardURIObject *pURIObj,
    237258                                           IStream **ppStream)
    238259{
    239     AssertPtrReturn(pProvider, E_POINTER);
    240 
    241     VBoxClipboardWinStreamImpl *pStream = new VBoxClipboardWinStreamImpl(pProvider, pURIObj);
     260    AssertPtrReturn(pTransfer, E_POINTER);
     261
     262    VBoxClipboardWinStreamImpl *pStream = new VBoxClipboardWinStreamImpl(pParent, pTransfer, pURIObj);
    242263    if (pStream)
    243264    {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette