VirtualBox

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


Ignore:
Timestamp:
Jul 18, 2023 8:06:24 AM (17 months ago)
Author:
vboxsync
Message:

Shared Clipboard: Made the Main host service dispatcher a bit more flexible so that it returns VERR_NOT_SUPPORTED if certain commands are not being handled. See comment(s) for details. bugref:9437

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

Legend:

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

    r100374 r100619  
    265265typedef struct _SHCLEXTSTATE
    266266{
    267     /** Pointer to the actual service extension handle. */
     267    /** Pointer to the actual service extension handle.
     268     *
     269     * Must return VERR_NOT_SUPPORTED if the extension didn't handle the requested function.
     270     * This will invoke the regular backend then.
     271     */
    268272    PFNHGCMSVCEXT  pfnExtension;
    269273    /** Opaque pointer to extension-provided data. Don't touch. */
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r100613 r100619  
    16171617                SHCLEXTPARMS parms;
    16181618                RT_ZERO(parms);
     1619
    16191620                parms.u.ReportFormats.uFormats = fFormats;
    16201621
    1621                 g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_FORMAT_ANNOUNCE, &parms, sizeof(parms));
     1622                rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_FORMAT_ANNOUNCE, &parms, sizeof(parms));
    16221623            }
    16231624            else
     1625                rc = VERR_NOT_SUPPORTED;
     1626
     1627            /* Let the backend implementation know if the extension above didn't handle the format(s). */
     1628            if (rc == VERR_NOT_SUPPORTED)
    16241629            {
    16251630#ifdef LOG_ENABLED
     
    17831788    }
    17841789    else
     1790        rc = VERR_NOT_SUPPORTED;
     1791
     1792    /* Try reading from the backend if the extension above didn't handle the read. */
     1793    if (rc == VERR_NOT_SUPPORTED)
    17851794    {
    17861795        rc = ShClBackendReadData(&g_ShClBackend, pClient, &cmdCtx, uFormat, pvData, cbData, &cbActual);
     
    19491958        SHCLEXTPARMS parms;
    19501959        RT_ZERO(parms);
     1960
    19511961        parms.u.ReadWriteData.uFormat = uFormat;
    19521962        parms.u.ReadWriteData.pvData  = pvData;
    19531963        parms.u.ReadWriteData.cbData  = cbData;
    19541964
    1955         g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_DATA_WRITE, &parms, sizeof(parms));
    1956         rc = VINF_SUCCESS;
     1965        rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_DATA_WRITE, &parms, sizeof(parms));
    19571966    }
    19581967    else
    1959     {
    1960         /* Let the backend implementation know. */
     1968        rc = VERR_NOT_SUPPORTED;
     1969
     1970    /* Let the backend implementation know if the extension above didn't handle the write. */
     1971    if (rc == VERR_NOT_SUPPORTED)
     1972    {
    19611973        rc = ShClBackendWriteData(&g_ShClBackend, pClient, &cmdCtx, uFormat, pvData, cbData);
    19621974        if (RT_FAILURE(rc))
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