VirtualBox

source: vbox/trunk/src/VBox/Main/include/ExtPackManagerImpl.h@ 34073

Last change on this file since 34073 was 34073, checked in by vboxsync, 15 years ago

ExtPack: Fixes to IExtPack (QueryInterface can't be used for getting stuff from the ext pack, designed the plug-in interfaces). Bugfixes making 'VBoxManage list extpack' work when building with VBOX_WITH_EXTPACK_PUEL=1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/* $Id: ExtPackManagerImpl.h 34073 2010-11-15 15:38:20Z vboxsync $ */
2/** @file
3 * VirtualBox Main - interface for Extension Packs, VBoxSVC & VBoxC.
4 */
5
6/*
7 * Copyright (C) 2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_EXTPACKMANAGERIMPL
19#define ____H_EXTPACKMANAGERIMPL
20
21#include "VirtualBoxBase.h"
22#include <VBox/ExtPack/ExtPack.h>
23#include <iprt/fs.h>
24
25
26/**
27 * An extension pack.
28 *
29 * This
30 */
31class ATL_NO_VTABLE ExtPack :
32 public VirtualBoxBase,
33 VBOX_SCRIPTABLE_IMPL(IExtPack)
34{
35public:
36 /** @name COM and internal init/term/mapping cruft.
37 * @{ */
38 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack)
39 DECLARE_NOT_AGGREGATABLE(ExtPack)
40 DECLARE_PROTECT_FINAL_CONSTRUCT()
41 BEGIN_COM_MAP(ExtPack)
42 COM_INTERFACE_ENTRY(ISupportErrorInfo)
43 COM_INTERFACE_ENTRY(IExtPack)
44 COM_INTERFACE_ENTRY(IDispatch)
45 END_COM_MAP()
46 DECLARE_EMPTY_CTOR_DTOR(ExtPack)
47
48 HRESULT FinalConstruct();
49 void FinalRelease();
50 HRESULT init(const char *a_pszName, const char *a_pszParentDir);
51 void uninit();
52 /** @} */
53
54 /** @name IExtPack interfaces
55 * @{ */
56 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
57 STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
58 STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
59 STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
60 STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
61 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
62 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
63 STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown);
64 /** @} */
65
66 /** @name Internal interfaces used by ExtPackManager.
67 * @{ */
68 void callInstalledHook(void);
69 HRESULT callUninstallHookAndClose(bool a_fForcedRemoval);
70 void callVmCreatedHook(IMachine *a_pMachine);
71 int callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM);
72 int callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM);
73 void callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM);
74 HRESULT refresh(bool *pfCanDelete);
75 /** @} */
76
77protected:
78 /** @name Internal helper methods.
79 * @{ */
80 void probeAndLoad(void);
81 bool findModule(const char *a_pszName, const char *a_pszExt,
82 Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
83 static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
84 /** @} */
85
86 /** @name Extension Pack Helpers
87 * @{ */
88 static DECLCALLBACK(int) hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
89 char *pszFound, size_t cbFound, bool *pfNative);
90 static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
91 /** @} */
92
93private:
94 struct Data;
95 /** Pointer to the private instance. */
96 Data *m;
97
98 friend class ExtPackManager;
99};
100
101
102/**
103 * Extension pack manager.
104 */
105class ATL_NO_VTABLE ExtPackManager :
106 public VirtualBoxBase,
107 VBOX_SCRIPTABLE_IMPL(IExtPackManager)
108{
109 /** @name COM and internal init/term/mapping cruft.
110 * @{ */
111 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
112 DECLARE_NOT_AGGREGATABLE(ExtPackManager)
113 DECLARE_PROTECT_FINAL_CONSTRUCT()
114 BEGIN_COM_MAP(ExtPackManager)
115 COM_INTERFACE_ENTRY(ISupportErrorInfo)
116 COM_INTERFACE_ENTRY(IExtPackManager)
117 COM_INTERFACE_ENTRY(IDispatch)
118 END_COM_MAP()
119 DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
120
121 HRESULT FinalConstruct();
122 void FinalRelease();
123 HRESULT init(const char *a_pszDropZonePath, bool a_fCheckDropZone);
124 void uninit();
125 /** @} */
126
127 /** @name IExtPack interfaces
128 * @{ */
129 STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
130 STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
131 STDMETHOD(Install)(IN_BSTR a_bstrTarball, BSTR *a_pbstrName);
132 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval);
133 STDMETHOD(Cleanup)(void);
134 STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
135 /** @} */
136
137 /** @name Internal interfaces used by other Main classes.
138 * @{ */
139 void processDropZone(void);
140 void callAllVmCreatedHooks(IMachine *a_pMachine);
141 int callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
142 int callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
143 void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
144 /** @} */
145
146private:
147 HRESULT runSetUidToRootHelper(const char *a_pszCommand, ...);
148 ExtPack *findExtPack(const char *a_pszName);
149 void removeExtPack(const char *a_pszName);
150 HRESULT refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
151
152private:
153 struct Data;
154 /** Pointer to the private instance. */
155 Data *m;
156};
157
158#endif
159/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette