VirtualBox

Changeset 86948 in vbox


Ignore:
Timestamp:
Nov 20, 2020 6:35:24 PM (4 years ago)
Author:
vboxsync
Message:

Shared Clipboard/Transfers: Resurrected Windows code. bugref:9437

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuestLib.h

    r86887 r86948  
    577577 * @{ */
    578578
     579# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     580/**
     581 * Structure for maintaining a VbglR3 Shared Clipboard transfer context.
     582 */
     583typedef struct VBGLR3SHCLTRANSFERCMDCTX
     584{
     585    /** Default chunk size (in bytes).
     586     * This is set by VbglR3ClipboardConnectEx(). */
     587    uint32_t                    cbChunkSize;
     588    /** Max chunk size (in bytes).
     589     * This is set by VbglR3ClipboardConnectEx(). */
     590    uint32_t                    cbMaxChunkSize;
     591    /** Callback table to use for all transfers. */
     592    SHCLTRANSFERCALLBACKS       Callbacks;
     593} VBGLR3SHCLTRANSFERCTX;
     594/** Pointer to a Shared Clipboard transfer context. */
     595typedef VBGLR3SHCLTRANSFERCMDCTX *PVBGLR3SHCLTRANSFERCMDCTX;
     596# endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
     597
    579598/**
    580599 * The context required for either retrieving or sending a HGCM shared clipboard
     
    600619     * This is set by VbglR3ClipboardConnectEx().  */
    601620    uint64_t                    fGuestFeatures;
    602 #  ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    603     /** Default chunk size (in bytes).
    604      * This is set by VbglR3ClipboardConnectEx(). */
    605     uint32_t                    cbChunkSize;
    606     /** Max chunk size (in bytes).
    607      * This is set by VbglR3ClipboardConnectEx(). */
    608     uint32_t                    cbMaxChunkSize;
    609 #  endif
    610 
    611621    /** The context ID - input or/and output depending on the operation. */
    612622    uint64_t                    idContext;
     
    614624     * This is set by ??. */
    615625    uint32_t                    cParmsRecived;
    616 
    617 #  ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    618     /** Callback table to use for all transfers. */
    619     SHCLTRANSFERCALLBACKS       Callbacks;
    620 #  endif
     626# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     627    VBGLR3SHCLTRANSFERCMDCTX    Transfers;
     628# endif
    621629} VBGLR3SHCLCMDCTX;
    622630/** Pointer to a shared clipboard context for Vbgl. */
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp

    r85121 r86948  
    161161        /* The IDataObject *must* be created on the same thread as our (proxy) window, so post a message to it
    162162         * to do the stuff for us. */
    163         const SHCLEVENTID idEvent = ShClEventIDGenerate(&pTransfer->Events);
    164 
    165         rc = ShClEventRegister(&pTransfer->Events, idEvent);
    166         if (RT_SUCCESS(rc))
     163        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pTransfer->Events);
     164        if (idEvent != NIL_SHCLEVENTID)
    167165        {
    168166            /* Don't want to rely on SendMessage (synchronous) here, so just post and wait the event getting signalled. */
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp

    r86911 r86948  
    113113    pCtx->fGuestFeatures       |= VBOX_SHCL_GF_0_TRANSFERS_FRONTEND;
    114114# endif
    115     pCtx->cbChunkSize           = VBOX_SHCL_DEFAULT_CHUNK_SIZE; /** @todo Make this configurable. */
    116     pCtx->cbMaxChunkSize        = VBOX_SHCL_MAX_CHUNK_SIZE;     /** @todo Ditto. */
     115    pCtx->Transfers.cbChunkSize    = VBOX_SHCL_DEFAULT_CHUNK_SIZE; /** @todo Make this configurable. */
     116    pCtx->Transfers.cbMaxChunkSize = VBOX_SHCL_MAX_CHUNK_SIZE;     /** @todo Ditto. */
    117117#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    118118
     
    148148                        VBGL_HGCM_HDR_INIT(&MsgChunkSize.hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_NEGOTIATE_CHUNK_SIZE,
    149149                                           VBOX_SHCL_CPARMS_NEGOTIATE_CHUNK_SIZE);
    150                         MsgChunkSize.cb32MaxChunkSize.SetUInt32(pCtx->cbMaxChunkSize);
     150                        MsgChunkSize.cb32MaxChunkSize.SetUInt32(pCtx->Transfers.cbMaxChunkSize);
    151151                        MsgChunkSize.cb32ChunkSize.SetUInt32(0); /* If set to 0, let the host choose. */
    152152                        rc = VbglR3HGCMCall(&MsgChunkSize.hdr, sizeof(MsgChunkSize));
     
    155155                    {
    156156                        Assert(MsgChunkSize.cb32ChunkSize.type == VMMDevHGCMParmType_32bit);
    157                         pCtx->cbChunkSize    = RT_MIN(MsgChunkSize.cb32ChunkSize.u.value32,    pCtx->cbChunkSize);
     157                        pCtx->Transfers.cbChunkSize    = RT_MIN(MsgChunkSize.cb32ChunkSize.u.value32,    pCtx->Transfers.cbChunkSize);
    158158                        Assert(MsgChunkSize.cb32MaxChunkSize.type == VMMDevHGCMParmType_32bit);
    159                         pCtx->cbMaxChunkSize = RT_MIN(MsgChunkSize.cb32MaxChunkSize.u.value32, pCtx->cbMaxChunkSize);
     159                        pCtx->Transfers.cbMaxChunkSize = RT_MIN(MsgChunkSize.cb32MaxChunkSize.u.value32, pCtx->Transfers.cbMaxChunkSize);
    160160
    161161                        LogRel2(("Shared Clipboard: Using chunk size %RU32 (maximum is %RU32)\n",
    162                                  pCtx->cbChunkSize, pCtx->cbMaxChunkSize));
     162                                 pCtx->Transfers.cbChunkSize, pCtx->Transfers.cbMaxChunkSize));
    163163                    }
    164164                }
     
    18031803    if (RT_SUCCESS(rc))
    18041804    {
    1805         ShClTransferSetCallbacks(pTransfer, &pCmdCtx->Callbacks);
     1805        ShClTransferSetCallbacks(pTransfer, &pCmdCtx->Transfers.Callbacks);
    18061806
    18071807        rc = ShClTransferCtxTransferRegisterByIndex(pTransferCtx, pTransfer, uTransferID);
     
    22182218                    AssertPtrBreakStmt(pTransfer, rc = VERR_NOT_FOUND);
    22192219
    2220                     AssertBreakStmt(pCmdCtx->cbChunkSize, rc = VERR_INVALID_PARAMETER);
    2221 
    2222                     const uint32_t cbToRead = RT_MIN(cbBuf, pCmdCtx->cbChunkSize);
     2220                    AssertBreakStmt(pCmdCtx->Transfers.cbChunkSize, rc = VERR_INVALID_PARAMETER);
     2221
     2222                    const uint32_t cbToRead = RT_MIN(cbBuf, pCmdCtx->Transfers.cbChunkSize);
    22232223
    22242224                    LogFlowFunc(("hObj=%RU64, cbBuf=%RU32, fFlags=0x%x -> cbChunkSize=%RU32, cbToRead=%RU32\n",
    2225                                  hObj, cbBuf, fFlags, pCmdCtx->cbChunkSize, cbToRead));
     2225                                 hObj, cbBuf, fFlags, pCmdCtx->Transfers.cbChunkSize, cbToRead));
    22262226
    22272227                    void *pvBuf = RTMemAlloc(cbToRead);
  • trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp

    r82968 r86948  
    5151    , m_lRefCount(1) /* Our IDataObjct *always* holds the last reference to this object; needed for the callbacks. */
    5252    , m_pTransfer(pTransfer)
     53    , m_hObj(SHCLOBJHANDLE_INVALID)
    5354    , m_strPath(strPath)
    54     , m_hObj(SHCLOBJHANDLE_INVALID)
    5555    , m_objInfo(*pObjInfo)
    5656    , m_cbProcessed(0)
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