VirtualBox

Changeset 31957 in vbox for trunk


Ignore:
Timestamp:
Aug 25, 2010 1:27:52 PM (14 years ago)
Author:
vboxsync
Message:

VRDP: allow to disable display output, input, USB, audio or clipboard.

Location:
trunk
Files:
2 edited

Legend:

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

    r30245 r31957  
    960960#define VRDP_QP_VIDEO_CHANNEL_SUNFLSH (7)
    961961#endif /* VBOX_WITH_VRDP_VIDEO_CHANNEL */
     962#define VRDP_QP_FEATURE           (8)
    962963
    963964#define VRDP_SP_BASE 0x1000
     
    965966
    966967#pragma pack(1)
     968/* VRDP_QP_FEATURE data. */
     969typedef struct _VRDPFEATURE
     970{
     971    uint32_t u32ClientId;
     972    char     achInfo[1]; /* UTF8 property input name and output value. */
     973} VRDPFEATURE;
     974
    967975/* A framebuffer description. */
    968976typedef struct _VRDPFRAMEBUFFERINFO
     
    11881196 * client connections until the entry point VRDPEnableConnections is called by the application.
    11891197 *
    1190  * The caller prepares the callbacks structure. The header.u64Version field
    1191  * must be initialized with the version of the insterface to use.
    1192  * The server will initialize the callbacks table to match the requested interface.
     1198 * The caller prepares the VRDPCALLBACKS_* structure. The header.u64Version field of the
     1199 * structure must be initialized with the version of the interface to use.
     1200 * The server will return pointer to VRDPENTRYPOINTS_* table in *ppEntryPoints
     1201 * to match the requested interface.
     1202 * That is if pCallbacks->header.u64Version == VRDP_INTERFACE_VERSION_1, then the server
     1203 * expects pCallbacks to point to VRDPCALLBACKS_1 and will return a pointer to VRDPENTRYPOINTS_1.
    11931204 *
    11941205 * @param pCallback     Pointer to the application callbacks which let the server to fetch
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r31747 r31957  
    754754        } break;
    755755#endif /* VBOX_WITH_VRDP_VIDEO_CHANNEL */
     756
     757        case VRDP_QP_FEATURE:
     758        {
     759            if (cbBuffer < sizeof(VRDPFEATURE))
     760            {
     761                rc = VERR_INVALID_PARAMETER;
     762                break;
     763            }
     764
     765            size_t cbInfo = cbBuffer - RT_OFFSETOF(VRDPFEATURE, achInfo);
     766
     767            VRDPFEATURE *pFeature = (VRDPFEATURE *)pvBuffer;
     768
     769            size_t cchInfo = 0;
     770            rc = RTStrNLenEx(pFeature->achInfo, cbInfo, &cchInfo);
     771
     772            if (RT_FAILURE(rc))
     773            {
     774                rc = VERR_INVALID_PARAMETER;
     775                break;
     776            }
     777
     778            /* features are mapped to "VRDP/Feature/NAME" extra data. */
     779            com::Utf8Str extraData("VRDP/Feature/");
     780            extraData += pFeature->achInfo;
     781
     782            com::Bstr bstrValue;
     783
     784            /* @todo these features should be per client. */
     785            NOREF(pFeature->u32ClientId);
     786
     787            if (   RTStrICmp(pFeature->achInfo, "Client/DisableDisplay") == 0
     788                || RTStrICmp(pFeature->achInfo, "Client/DisableInput") == 0
     789                || RTStrICmp(pFeature->achInfo, "Client/DisableAudio") == 0
     790                || RTStrICmp(pFeature->achInfo, "Client/DisableUSB") == 0
     791                || RTStrICmp(pFeature->achInfo, "Client/DisableClipboard") == 0
     792               )
     793            {
     794                HRESULT hrc = server->mConsole->machine ()->GetExtraData(com::Bstr(extraData), bstrValue.asOutParam());
     795                if (hrc == S_OK && !bstrValue.isEmpty())
     796                {
     797                    rc = VINF_SUCCESS;
     798                }
     799            }
     800            else
     801            {
     802                rc = VERR_NOT_SUPPORTED;
     803            }
     804
     805            /* Copy the value string to the callers buffer. */
     806            if (rc == VINF_SUCCESS)
     807            {
     808                com::Utf8Str value = bstrValue;
     809
     810                size_t cb = value.length() + 1;
     811
     812                if ((size_t)cbInfo >= cb)
     813                {
     814                    memcpy(pFeature->achInfo, value.c_str(), cb);
     815                }
     816                else
     817                {
     818                    rc = VINF_BUFFER_OVERFLOW;
     819                }
     820
     821                *pcbOut = (uint32_t)cb;
     822            }
     823        } break;
    756824
    757825        case VRDP_SP_NETWORK_BIND_PORT:
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