VirtualBox

Changeset 105634 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Aug 9, 2024 8:59:25 AM (9 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164323
Message:

Shared Clipboard/Transfers: Be a bit more informative in the release log why file transfers do not work when reporting formats to the guest + host. bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r105630 r105634  
    14981498
    14991499/**
    1500  * Reports clipboard formats to the guest.
    1501  *
    1502  * @note    Host backend callers must check if it's active (use
    1503  *          ShClSvcIsBackendActive) before calling to prevent mixing up the
    1504  *          VRDE clipboard.
    1505  *
    1506  * @returns VBox status code.
    1507  * @param   pClient             Client to report clipboard formats to.
    1508  * @param   fFormats            The formats to report (VBOX_SHCL_FMT_XXX), zero
    1509  *                              is okay (empty the clipboard).
    1510  *
    1511  * @thread  Backend thread.
    1512  */
    1513 int ShClSvcReportFormats(PSHCLCLIENT pClient, SHCLFORMATS fFormats)
    1514 {
    1515     AssertPtrReturn(pClient, VERR_INVALID_POINTER);
    1516 
    1517     LogFlowFunc(("fFormats=%#x\n", fFormats));
    1518 
    1519     /*
    1520      * Check if the service mode allows this operation and whether the guest is
    1521      * supposed to be reading from the host. Otherwise, silently ignore reporting
    1522      * formats and return VINF_SUCCESS in order to do not trigger client
    1523      * termination in svcConnect().
    1524      */
    1525     uint32_t uMode = ShClSvcGetMode();
    1526     if (   uMode == VBOX_SHCL_MODE_BIDIRECTIONAL
    1527         || uMode == VBOX_SHCL_MODE_HOST_TO_GUEST)
    1528     { /* likely */ }
    1529     else
    1530         return VINF_SUCCESS;
    1531 
     1500 * Handles clipboard formats.
     1501 *
     1502 * @returns The new Shared Clipboard formats.
     1503 * @param   fHostToGuest        Reporting direction.
     1504 *                              \c true from host -> guest.
     1505 *                              \c false from guest -> host.
     1506 * @param   pClient             Pointer to client instance.
     1507 * @param   fFormats            Reported clipboard formats.
     1508 */
     1509static SHCLFORMATS shClSvcHandleFormats(bool fHostToGuest, PSHCLCLIENT pClient, SHCLFORMATS fFormats)
     1510{
    15321511#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    15331512    bool fSkipTransfers = false;
     
    15391518            if (s_uTransfersBitchedNotEnabled++ < 32)
    15401519            {
    1541                 LogRel(("Shared Clipboard: File transfers are disabled, skipping reporting those to the guest\n"));
     1520                LogRel(("Shared Clipboard: File transfers are disabled on host, skipping reporting those to the guest\n"));
    15421521                fSkipTransfers = true;
    15431522            }
     
    15581537            fFormats &= ~VBOX_SHCL_FMT_URI_LIST;
    15591538    }
    1560 #endif
    1561 
    1562 #ifdef LOG_ENABLED
     1539#else
     1540    RT_NOREF(pClient);
     1541#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
     1542
    15631543    char *pszFmts = ShClFormatsToStrA(fFormats);
    1564     AssertPtrReturn(pszFmts, VERR_NO_MEMORY);
    1565     LogRel2(("Shared Clipboard: Reporting formats '%s' to guest\n", pszFmts));
    1566     RTStrFree(pszFmts);
    1567 #endif
     1544    if (pszFmts)
     1545    {
     1546        LogRel2(("Shared Clipboard: %s reported formats '%s' to %s\n",
     1547                 fHostToGuest ? "Host" : "Guest",
     1548                 pszFmts,
     1549                 fHostToGuest ? "guest" : "host"));
     1550        RTStrFree(pszFmts);
     1551    }
     1552
     1553    return fFormats;
     1554}
     1555
     1556/**
     1557 * Reports clipboard formats to the guest.
     1558 *
     1559 * @note    Host backend callers must check if it's active (use
     1560 *          ShClSvcIsBackendActive) before calling to prevent mixing up the
     1561 *          VRDE clipboard.
     1562 *
     1563 * @returns VBox status code.
     1564 * @param   pClient             Client to report clipboard formats to.
     1565 * @param   fFormats            The formats to report (VBOX_SHCL_FMT_XXX), zero
     1566 *                              is okay (empty the clipboard).
     1567 *
     1568 * @thread  Backend thread.
     1569 */
     1570int ShClSvcReportFormats(PSHCLCLIENT pClient, SHCLFORMATS fFormats)
     1571{
     1572    AssertPtrReturn(pClient, VERR_INVALID_POINTER);
     1573
     1574    LogFlowFunc(("fFormats=%#x\n", fFormats));
     1575
     1576    /*
     1577     * Check if the service mode allows this operation and whether the guest is
     1578     * supposed to be reading from the host. Otherwise, silently ignore reporting
     1579     * formats and return VINF_SUCCESS in order to do not trigger client
     1580     * termination in svcConnect().
     1581     */
     1582    uint32_t uMode = ShClSvcGetMode();
     1583    if (   uMode == VBOX_SHCL_MODE_BIDIRECTIONAL
     1584        || uMode == VBOX_SHCL_MODE_HOST_TO_GUEST)
     1585    { /* likely */ }
     1586    else
     1587        return VINF_SUCCESS;
     1588
     1589    fFormats = shClSvcHandleFormats(true /* fHostToGuest */, pClient, fFormats);
    15681590
    15691591    int rc;
     
    16521674    }
    16531675    ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_32BIT, VERR_WRONG_PARAMETER_TYPE);
    1654     uint32_t const fFormats = paParms[iParm].u.uint32;
     1676    uint32_t fFormats = paParms[iParm].u.uint32;
    16551677    iParm++;
    16561678    if (cParms == VBOX_SHCL_CPARMS_REPORT_FORMATS_61B)
     
    16761698    else
    16771699    {
     1700#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     1701        fFormats = shClSvcHandleFormats(false /* fHostToGuest */, pClient, fFormats);
     1702#endif
    16781703        rc = RTCritSectEnter(&g_CritSect);
    16791704        if (RT_SUCCESS(rc))
     
    16941719            if (rc == VERR_NOT_SUPPORTED)
    16951720            {
    1696 #ifdef LOG_ENABLED
    1697                 char *pszFmts = ShClFormatsToStrA(fFormats);
    1698                 if (pszFmts)
    1699                 {
    1700                     LogRel2(("Shared Clipboard: Guest reported formats '%s' to host\n", pszFmts));
    1701                     RTStrFree(pszFmts);
    1702                 }
    1703 #endif
    17041721                rc = ShClBackendReportFormats(&g_ShClBackend, pClient, fFormats);
    17051722                if (RT_FAILURE(rc))
Note: See TracChangeset for help on using the changeset viewer.

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