VirtualBox

Ignore:
Timestamp:
Oct 15, 2019 4:37:37 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard/Transfers: Added IMachine::clipboardFileTransfersEnabled attribute (getter/setter) for enabling/disabling the feature. Disabled by default.

Location:
trunk/src/VBox/HostServices/SharedClipboard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h

    r81229 r81286  
    197197
    198198# ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     199int shclSvcTransferModeSet(uint32_t fMode);
    199200int shclSvcTransferStart(PSHCLCLIENT pClient, SHCLTRANSFERDIR enmDir, SHCLSOURCE enmSource, PSHCLTRANSFER *ppTransfer);
    200201int shclSvcTransferStop(PSHCLCLIENT pClient, PSHCLTRANSFER pTransfer);
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp

    r81260 r81286  
    4040*   Externals                                                                                                                    *
    4141*********************************************************************************************************************************/
    42 extern SHCLEXTSTATE g_ExtState;
    43 extern PVBOXHGCMSVCHELPERS g_pHelpers;
     42extern uint32_t             g_fTransferMode;
     43extern SHCLEXTSTATE         g_ExtState;
     44extern PVBOXHGCMSVCHELPERS  g_pHelpers;
     45extern ClipboardClientMap   g_mapClients;
    4446extern ClipboardClientQueue g_listClientsDeferred;
    4547
     
    21862188}
    21872189
     2190/**
     2191 * Sets the host service's (file) transfer mode.
     2192 *
     2193 * @returns VBox status code.
     2194 * @param   uMode               Transfer mode to set.
     2195 */
     2196int shclSvcTransferModeSet(uint32_t fMode)
     2197{
     2198    AssertReturn(!(fMode & ~VBOX_SHCL_TRANSFER_MODE_VALID_MASK), VERR_INVALID_FLAGS);
     2199
     2200    g_fTransferMode = fMode;
     2201
     2202    LogRel2(("Shared Clipboard: Transfer mode set to 0x%x\n", g_fTransferMode));
     2203
     2204    /* If file transfers are being disabled, make sure to also reset (destroy) all pending transfers. */
     2205    if (g_fTransferMode == VBOX_SHCL_TRANSFER_MODE_DISABLED)
     2206    {
     2207        ClipboardClientMap::const_iterator itClient = g_mapClients.begin();
     2208        while (itClient != g_mapClients.end())
     2209        {
     2210            PSHCLCLIENT pClient = itClient->second;
     2211            AssertPtr(pClient);
     2212
     2213            shclSvcClientTransfersReset(pClient);
     2214
     2215            ++itClient;
     2216        }
     2217    }
     2218
     2219    LogFlowFuncLeaveRC(VINF_SUCCESS);
     2220    return VINF_SUCCESS;
     2221}
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r81229 r81286  
    235235
    236236static RTCRITSECT g_CritSect;
    237 static uint32_t g_uMode;
     237/** Global Shared Clipboard mode. */
     238static uint32_t g_uMode  = VBOX_SHCL_MODE_OFF;
     239#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     240/** Global Shared Clipboard (file) transfer mode. */
     241uint32_t g_fTransferMode = VBOX_SHCL_TRANSFER_MODE_DISABLED;
     242#endif
    238243
    239244/** Is the clipboard running in headless mode? */
     
    15371542        {
    15381543#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1539             rc = shclSvcTransferHandler(pClient, callHandle, u32Function, cParms, paParms, tsArrival);
     1544            if (g_fTransferMode & VBOX_SHCL_TRANSFER_MODE_ENABLED)
     1545            {
     1546                rc = shclSvcTransferHandler(pClient, callHandle, u32Function, cParms, paParms, tsArrival);
     1547            }
     1548            else
     1549                rc = VERR_ACCESS_DENIED;
    15401550#else
    15411551            rc = VERR_NOT_IMPLEMENTED;
     
    16371647        }
    16381648
     1649#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     1650        case VBOX_SHCL_HOST_FN_SET_TRANSFER_MODE:
     1651        {
     1652            if (cParms != 1)
     1653            {
     1654                rc = VERR_INVALID_PARAMETER;
     1655            }
     1656            else
     1657            {
     1658                uint32_t u32TransferMode;
     1659                rc = HGCMSvcGetU32(&paParms[0], &u32TransferMode);
     1660                if (RT_SUCCESS(rc))
     1661                    rc = shclSvcTransferModeSet(u32TransferMode);
     1662            }
     1663            break;
     1664        }
     1665#endif
    16391666        case VBOX_SHCL_HOST_FN_SET_HEADLESS:
    16401667        {
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