VirtualBox

Changeset 33623 in vbox for trunk/include/VBox/ExtPack


Ignore:
Timestamp:
Oct 29, 2010 4:16:06 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67234
Message:

ExtPack: More code.

File:
1 edited

Legend:

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

    r33513 r33623  
    2929#include <VBox/types.h>
    3030
     31#if defined(__cplusplus)
     32class IConsole;
     33class IMachine;
     34#else
     35typedef struct IConsole IConsole;
     36typedef struct IMachine IMachine;
     37#endif
    3138
    3239
    33 #if 0
    34 /** Pointer to callbacks provided to the VBoxDriverRegister() call. */
    35 typedef struct PDMDRVREGCB *PPDMDRVREGCB;
    36 /** Pointer to const callbacks provided to the VBoxDriverRegister() call. */
    37 typedef const struct PDMDRVREGCB *PCPDMDRVREGCB;
    38 
     40/** Pointer to const helpers passed to the VBoxExtPackRegister() call. */
     41typedef const struct VBOXEXTPACKHLP *PCVBOXEXTPACKHLP;
    3942/**
    40  * Callbacks for VBoxExtPackRegister().
     43 * Extension pack helpers passed to VBoxExtPackRegister().
     44 *
     45 * This will be valid until the module is unloaded.
    4146 */
    42 typedef struct PCVBOXEXTPACKREGCB
     47typedef struct VBOXEXTPACKHLP
    4348{
    4449    /** Interface version.
    45      * This is set to VBOXEXTPACK_REG_CB_VERSION. */
     50     * This is set to VBOXEXTPACKHLP_VERSION. */
     51    uint32_t                    u32Version;
     52
     53    /** The VirtualBox full version (see VBOX_FULL_VERSION).  */
     54    uint32_t                    uVBoxFullVersion;
     55    /** The VirtualBox subversion tree revision.  */
     56    uint32_t                    uVBoxInternalRevision;
     57    /** Explicit alignment padding, must be zero. */
     58    uint32_t                    u32Padding;
     59    /** Pointer to the version string (read-only). */
     60    const char                 *pszVBoxVersion;
     61
     62    /**
     63     * Finds a module belonging to this extension pack.
     64     *
     65     * @returns VBox status code.
     66     * @param   pHlp            Pointer to this helper structure.
     67     * @param   pszName         The module base name.
     68     * @param   pszExt          The extension. If NULL the default ring-3
     69     *                          library extension will be used.
     70     * @param   pszFound        Where to return the path to the module on
     71     *                          success.
     72     * @param   cbFound         The size of the buffer @a pszFound points to.
     73     * @param   pfNative        Where to return the native/agnostic indicator.
     74     */
     75    DECLR3CALLBACKMEMBER(int, pfnFindModule,(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
     76                                             char *pszFound, size_t cbFound, bool *pfNative));
     77
     78    /** End of structure marker (VBOXEXTPACKHLP_VERSION). */
     79    uint32_t                    u32EndMarker;
     80} VBOXEXTPACKHLP;
     81/** Current version of the VBOXEXTPACKHLP structure.  */
     82#define VBOXEXTPACKHLP_VERSION          RT_MAKE_U32(1, 0)
     83
     84
     85/** Pointer to the extension pack callback table. */
     86typedef struct VBOXEXTPACKREG const *PCVBOXEXTPACKREG;
     87/**
     88 * Callback table returned by VBoxExtPackRegister.
     89 *
     90 * This must be valid until the extension pack main module is unloaded.
     91 */
     92typedef struct VBOXEXTPACKREG
     93{
     94    /** Interface version.
     95     * This is set to VBOXEXTPACKREG_VERSION. */
    4696    uint32_t                    u32Version;
    4797
    4898    /**
    49      * Registers a driver with the current VM instance.
     99     * Hook for doing setups after the extension pack was installed.
     100     *
     101     * This is called in the context of the per-user service (VBoxSVC).
    50102     *
    51103     * @returns VBox status code.
    52      * @param   pCallbacks      Pointer to the callback table.
    53      * @param   pReg            Pointer to the driver registration record.
    54      *                          This data must be permanent and readonly.
     104     * @param   pThis       Pointer to this structure.
    55105     */
    56     DECLR3CALLBACKMEMBER(int, pfnGet,(PCVBOXEXTPACKREGCB pCallbacks, PCPDMDRVREG pReg));
     106    DECLCALLBACKMEMBER(int, pfnInstalled)(PCVBOXEXTPACKREG pThis);
    57107
    58     /** End of structure marker (VBOXEXTPACK_REG_CB_VERSION). */
     108    /**
     109     * Hook for cleaning up before the extension pack is uninstalled.
     110     *
     111     * This is called in the context of the per-user service (VBoxSVC).
     112     *
     113     * @returns VBox status code.
     114     * @param   pThis       Pointer to this structure.
     115     */
     116    DECLCALLBACKMEMBER(int, pfnUninstall)(PCVBOXEXTPACKREG pThis);
     117
     118    /**
     119     * Hook for changing the default VM configuration upon creation.
     120     *
     121     * This is called in the context of the per-user service (VBoxSVC).
     122     *
     123     * @returns VBox status code.
     124     * @param   pThis       Pointer to this structure.
     125     * @param   pMachine    The machine interface.
     126     */
     127    DECLCALLBACKMEMBER(int, pfnVMCreated)(PCVBOXEXTPACKREG pThis, IMachine *pMachine);
     128
     129    /**
     130     * Hook for configuring the VMM for a VM.
     131     *
     132     * This is called in the context of the VM process (VBoxC).
     133     *
     134     * @returns VBox status code.
     135     * @param   pThis       Pointer to this structure.
     136     * @param   pVM         The VM handle.
     137     * @param   pConsole    The console interface.
     138     */
     139    DECLCALLBACKMEMBER(int, pfnVMConfigureVMM)(PCVBOXEXTPACKREG pThis, PVM pVM, IConsole *pConsole);
     140
     141    /**
     142     * Hook for doing work right before powering on the VM.
     143     *
     144     * This is called in the context of the VM process (VBoxC).
     145     *
     146     * @returns VBox status code.
     147     * @param   pThis       Pointer to this structure.
     148     * @param   pVM         The VM handle.
     149     * @param   pConsole    The console interface.
     150     */
     151    DECLCALLBACKMEMBER(int, pfnVMPowerOn)(PCVBOXEXTPACKREG pThis, PVM pVM, IConsole *pConsole);
     152
     153    /**
     154     * Hook for doing work after powering on the VM.
     155     *
     156     * This is called in the context of the VM process (VBoxC).
     157     *
     158     * @returns VBox status code.
     159     * @param   pThis       Pointer to this structure.
     160     * @param   pVM         The VM handle.  Can be NULL.
     161     * @param   pConsole    The console interface.
     162     */
     163    DECLCALLBACKMEMBER(int, pfnVMPowerOff)(PCVBOXEXTPACKREG pThis, PVM pVM, IConsole *pConsole);
     164
     165    /** End of structure marker (VBOXEXTPACKREG_VERSION). */
    59166    uint32_t                    u32EndMarker;
    60 } PCVBOXEXTPACKREGCB;
    61 
    62 /** Current version of the PDMDRVREGCB structure.  */
    63 #define VBOXEXTPACK_REG_CB_VERSION          RT_MAKE_U32(1, 0)
     167} VBOXEXTPACKREG;
     168/** Current version of the VBOXEXTPACKREG structure.  */
     169#define VBOXEXTPACKREG_VERSION        RT_MAKE_U32(1, 0)
    64170
    65171
     
    71177 *
    72178 * @returns VBox status code.
    73  * @param   pCallbacks      Pointer to the callback table.
    74  * @param   u32Version      VBox version number.
     179 * @param   pHlp            Pointer to the extension pack helper function
     180 *                          table.  This is valid until the module is unloaded.
     181 * @param   ppReg           Where to return the pointer to the registration
     182 *                          structure containing all the hooks.  This structure
     183 *                          be valid and unchanged until the module is unloaded
     184 *                          (i.e. use some static const data for it).
     185 * @param   pszErr          Error message buffer for explaining any failure.
     186 * @param   cbErr           The size of the error message buffer.
    75187 */
    76 typedef DECLCALLBACK(int) FNVBOXEXTPACKREGISTER(PCVBOXEXTPACKREGCB pCallbacks, uint32_t u32Version);
    77 #endif
     188typedef DECLCALLBACK(int) FNVBOXEXTPACKREGISTER(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, char *pszErr, size_t cbErr);
     189/** Pointer to a FNVBOXEXTPACKREGISTER. */
     190typedef FNVBOXEXTPACKREGISTER *PFNVBOXEXTPACKREGISTER;
     191
     192/** The name of the main module entry point. */
     193#define VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT   "VBoxExtPackRegister"
     194
    78195
    79196#endif
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