VirtualBox

Changeset 48313 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 5, 2013 3:35:22 PM (11 years ago)
Author:
vboxsync
Message:

Main/ExtPackManager+Console: add a way to load HGCM modules from an extension pack, contributed by Jeff Westphal (partially rewritten). Thanks!

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r48297 r48313  
    221221    HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
    222222    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
     223
    223224    HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
    224225    HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
     
    231232                              ULONG aSourceIdx, ULONG aTargetIdx,
    232233                              IProgress *aProgress);
     234    int hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName);
    233235    VMMDev *getVMMDev() { return m_pVMMDev; }
    234236    AudioSniffer *getAudioSniffer() { return mAudioSniffer; }
  • trunk/src/VBox/Main/include/ExtPackManagerImpl.h

    r46823 r48313  
    55
    66/*
    7  * Copyright (C) 2010-2012 Oracle Corporation
     7 * Copyright (C) 2010-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    168168    static DECLCALLBACK(int)    hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
    169169    static DECLCALLBACK(VBOXEXTPACKCTX) hlpGetContext(PCVBOXEXTPACKHLP pHlp);
     170    static DECLCALLBACK(int)    hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole, const char *pszServiceLibrary, const char *pszServiceName);
    170171    static DECLCALLBACK(int)    hlpReservedN(PCVBOXEXTPACKHLP pHlp);
    171172    /** @}  */
  • trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp

    r46823 r48313  
    4545#include "Global.h"
    4646#include "ProgressImpl.h"
    47 #include "SystemPropertiesImpl.h"
    48 #if !defined(VBOX_COM_INPROC)
    49 #include "VirtualBoxImpl.h"
     47#if defined(VBOX_COM_INPROC)
     48# include "ConsoleImpl.h"
     49#else
     50# include "VirtualBoxImpl.h"
    5051#endif
    5152
     
    758759        /* pfnGetFilePath       = */ ExtPack::hlpGetFilePath,
    759760        /* pfnGetContext        = */ ExtPack::hlpGetContext,
     761        /* pfnLoadHGCMService   = */ ExtPack::hlpLoadHGCMService,
    760762        /* pfnReserved1         = */ ExtPack::hlpReservedN,
    761763        /* pfnReserved2         = */ ExtPack::hlpReservedN,
     
    766768        /* pfnReserved7         = */ ExtPack::hlpReservedN,
    767769        /* pfnReserved8         = */ ExtPack::hlpReservedN,
    768         /* pfnReserved9         = */ ExtPack::hlpReservedN,
    769770        /* u32EndMarker         = */ VBOXEXTPACKHLP_VERSION
    770771    };
     
    15781579
    15791580    return pThis->m->enmContext;
     1581}
     1582
     1583/*static*/ DECLCALLBACK(int)
     1584ExtPack::hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
     1585                            const char *pszServiceLibrary, const char *pszServiceName)
     1586{
     1587#ifdef VBOX_COM_INPROC
     1588    /*
     1589     * Validate the input and get our bearings.
     1590     */
     1591    AssertPtrReturn(pszServiceLibrary, VERR_INVALID_POINTER);
     1592    AssertPtrReturn(pszServiceName, VERR_INVALID_POINTER);
     1593
     1594    AssertPtrReturn(pHlp, VERR_INVALID_POINTER);
     1595    AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER);
     1596    ExtPack::Data *m = RT_FROM_CPP_MEMBER(pHlp, Data, Hlp);
     1597    AssertPtrReturn(m, VERR_INVALID_POINTER);
     1598    ExtPack *pThis = m->pThis;
     1599    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
     1600    AssertPtrReturn(pConsole, VERR_INVALID_POINTER);
     1601
     1602    Console *pCon = (Console *)pConsole;
     1603    return pCon->hgcmLoadService(pszServiceLibrary, pszServiceName);
     1604#endif
     1605    return VERR_INVALID_STATE;
    15801606}
    15811607
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r48297 r48313  
    57485748}
    57495749
     5750
     5751/**
     5752 * Load an HGCM service.
     5753 *
     5754 * Main purpose of this method is to allow extension packs to load HGCM
     5755 * service modules, which they can't, because the HGCM functionality lives
     5756 * in module VBoxC (and ConsoleImpl.cpp is part of it and thus can call it).
     5757 * Extension modules must not link directly against VBoxC, (XP)COM is
     5758 * handling this.
     5759 */
     5760int Console::hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName)
     5761{
     5762    /* Everyone seems to delegate all HGCM calls to VMMDev, so stick to this
     5763     * convention. Adds one level of indirection for no obvious reason. */
     5764    AssertPtrReturn(m_pVMMDev, VERR_INVALID_STATE);
     5765    return m_pVMMDev->hgcmLoadService(pszServiceLibrary, pszServiceName);
     5766}
    57505767
    57515768/**
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