ExtPackManagerImpl.h revision 6f63267ae3ac590beee4c0e298774baf18e0fb84
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync/* $Id$ */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync/** @file
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * VirtualBox Main - interface for Extension Packs, VBoxSVC & VBoxC.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync/*
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * Copyright (C) 2010 Oracle Corporation
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync *
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * available from http://www.virtualbox.org. This file is free software;
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * you can redistribute it and/or modify it under the terms of the GNU
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * General Public License (GPL) as published by the Free Software
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync#ifndef ____H_EXTPACKMANAGERIMPL
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync#define ____H_EXTPACKMANAGERIMPL
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync#include "VirtualBoxBase.h"
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync#include <VBox/ExtPack/ExtPack.h>
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync#include <iprt/fs.h>
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync/**
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * An extension pack.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync *
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * This
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsyncclass ATL_NO_VTABLE ExtPack :
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync public VirtualBoxBase,
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync VBOX_SCRIPTABLE_IMPL(IExtPack)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync{
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsyncpublic:
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @name COM and internal init/term/mapping cruft.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * @{ */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync DECLARE_NOT_AGGREGATABLE(ExtPack)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync BEGIN_COM_MAP(ExtPack)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync COM_INTERFACE_ENTRY(ISupportErrorInfo)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync COM_INTERFACE_ENTRY(IExtPack)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync COM_INTERFACE_ENTRY(IDispatch)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync END_COM_MAP()
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync DECLARE_EMPTY_CTOR_DTOR(ExtPack)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync HRESULT FinalConstruct();
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync void FinalRelease();
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync HRESULT init(VirtualBox *a_pVirtualBox, const char *a_pszName, const char *a_pszParentDir);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync void uninit();
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @} */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @name IExtPack interfaces
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * @{ */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
8479df0918362ee801608d4f48c6d8ee8fdf505evboxsync STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
8479df0918362ee801608d4f48c6d8ee8fdf505evboxsync STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @} */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @name Internal interfaces used by ExtPackManager.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * @{ */
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync void callInstalledHook(IVirtualBox *a_pVirtualBox);
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync HRESULT callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync void callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox);
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync void callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync int callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync int callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync void callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync HRESULT refresh(bool *pfCanDelete);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @} */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsyncprotected:
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync /** @name Internal helper methods.
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync * @{ */
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync void probeAndLoad(void);
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync bool findModule(const char *a_pszName, const char *a_pszExt,
8479df0918362ee801608d4f48c6d8ee8fdf505evboxsync Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync /** @} */
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync /** @name Extension Pack Helpers
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync * @{ */
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync static DECLCALLBACK(int) hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync char *pszFound, size_t cbFound, bool *pfNative);
8479df0918362ee801608d4f48c6d8ee8fdf505evboxsync static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync static DECLCALLBACK(int) hlpRegisterVrde(PCVBOXEXTPACKHLP pHlp, const char *pszName, bool fSetDefault);
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync /** @} */
710d24589d0cbe0ea6e9ad143eda5bbd41000693vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsyncprivate:
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync struct Data;
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** Pointer to the private instance. */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync Data *m;
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync friend class ExtPackManager;
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync};
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync/**
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * Extension pack manager.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsyncclass ATL_NO_VTABLE ExtPackManager :
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync public VirtualBoxBase,
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync VBOX_SCRIPTABLE_IMPL(IExtPackManager)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync{
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @name COM and internal init/term/mapping cruft.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * @{ */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync DECLARE_NOT_AGGREGATABLE(ExtPackManager)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync DECLARE_PROTECT_FINAL_CONSTRUCT()
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync BEGIN_COM_MAP(ExtPackManager)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync COM_INTERFACE_ENTRY(ISupportErrorInfo)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync COM_INTERFACE_ENTRY(IExtPackManager)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync COM_INTERFACE_ENTRY(IDispatch)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync END_COM_MAP()
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync HRESULT FinalConstruct();
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync void FinalRelease();
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync HRESULT init(VirtualBox *a_pVirtualBox, const char *a_pszDropZonePath, bool a_fCheckDropZone);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync void uninit();
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @} */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @name IExtPack interfaces
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * @{ */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(Install)(IN_BSTR a_bstrTarball, BSTR *a_pbstrName);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval);
8479df0918362ee801608d4f48c6d8ee8fdf505evboxsync STDMETHOD(Cleanup)(void);
8479df0918362ee801608d4f48c6d8ee8fdf505evboxsync STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @} */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @name Internal interfaces used by other Main classes.
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync * @{ */
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync void processDropZone(void);
6f63267ae3ac590beee4c0e298774baf18e0fb84vboxsync void callAllVirtualBoxReadyHooks(void);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync void callAllVmCreatedHooks(IMachine *a_pMachine);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync int callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync int callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
d6835eb59b58420b98d9adf7b7f1f8f5ef6187bcvboxsync void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** @} */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
8d82d07fc2f7234b1e5a3ba544e1086a5a7a7c5fvboxsyncprivate:
8d82d07fc2f7234b1e5a3ba544e1086a5a7a7c5fvboxsync HRESULT runSetUidToRootHelper(const char *a_pszCommand, ...);
8d82d07fc2f7234b1e5a3ba544e1086a5a7a7c5fvboxsync ExtPack *findExtPack(const char *a_pszName);
8d82d07fc2f7234b1e5a3ba544e1086a5a7a7c5fvboxsync void removeExtPack(const char *a_pszName);
8d82d07fc2f7234b1e5a3ba544e1086a5a7a7c5fvboxsync HRESULT refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
8d82d07fc2f7234b1e5a3ba544e1086a5a7a7c5fvboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsyncprivate:
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync struct Data;
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync /** Pointer to the private instance. */
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync Data *m;
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync};
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync#endif
73045e3d71f04f3d399e70e89fbd6395c4402821vboxsync/* vi: set tabstop=4 shiftwidth=4 expandtab: */