VirtualBox

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

最後變更 在這個檔案從34808是 34808,由 vboxsync 提交於 14 年 前

IExtPackBase: Added two attributes: license and showLicense.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 8.9 KB
 
1/* $Id: ExtPackManagerImpl.h 34808 2010-12-07 17:21:19Z 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.alldomusa.eu.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 * An extension pack file.
27 */
28class ATL_NO_VTABLE ExtPackFile :
29 public VirtualBoxBase,
30 VBOX_SCRIPTABLE_IMPL(IExtPackFile)
31{
32public:
33 /** @name COM and internal init/term/mapping cruft.
34 * @{ */
35 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackFile, IExtPackFile)
36 DECLARE_NOT_AGGREGATABLE(ExtPackFile)
37 DECLARE_PROTECT_FINAL_CONSTRUCT()
38 BEGIN_COM_MAP(ExtPackFile)
39 COM_INTERFACE_ENTRY(ISupportErrorInfo)
40 COM_INTERFACE_ENTRY(IExtPackFile)
41 COM_INTERFACE_ENTRY(IExtPackBase)
42 COM_INTERFACE_ENTRY(IDispatch)
43 END_COM_MAP()
44 DECLARE_EMPTY_CTOR_DTOR(ExtPackFile)
45
46 HRESULT FinalConstruct();
47 void FinalRelease();
48 HRESULT initWithFile(const char *a_pszFile, class ExtPackManager *a_pExtPackMgr);
49 void uninit();
50 RTMEMEF_NEW_AND_DELETE_OPERATORS();
51 /** @} */
52
53 /** @name IExtPackBase interfaces
54 * @{ */
55 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
56 STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
57 STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
58 STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
59 STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
60 STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
61 STDMETHOD(COMGETTER(License))(BSTR *a_pbstrHtmlLicense);
62 STDMETHOD(COMGETTER(ShowLicense))(BOOL *a_pfShowIt);
63 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
64 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
65 /** @} */
66
67 /** @name IExtPackFile interfaces
68 * @{ */
69 STDMETHOD(COMGETTER(FilePath))(BSTR *a_pbstrPath);
70 STDMETHOD(Install)(void);
71 /** @} */
72
73private:
74 /** @name Misc init helpers
75 * @{ */
76 HRESULT initFailed(const char *a_pszWhyFmt, ...);
77 /** @} */
78
79private:
80 struct Data;
81 /** Pointer to the private instance. */
82 Data *m;
83
84 friend class ExtPackManager;
85};
86
87
88/**
89 * An installed extension pack.
90 */
91class ATL_NO_VTABLE ExtPack :
92 public VirtualBoxBase,
93 VBOX_SCRIPTABLE_IMPL(IExtPack)
94{
95public:
96 /** @name COM and internal init/term/mapping cruft.
97 * @{ */
98 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack)
99 DECLARE_NOT_AGGREGATABLE(ExtPack)
100 DECLARE_PROTECT_FINAL_CONSTRUCT()
101 BEGIN_COM_MAP(ExtPack)
102 COM_INTERFACE_ENTRY(ISupportErrorInfo)
103 COM_INTERFACE_ENTRY(IExtPack)
104 COM_INTERFACE_ENTRY(IExtPackBase)
105 COM_INTERFACE_ENTRY(IDispatch)
106 END_COM_MAP()
107 DECLARE_EMPTY_CTOR_DTOR(ExtPack)
108
109 HRESULT FinalConstruct();
110 void FinalRelease();
111 HRESULT initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir);
112 void uninit();
113 RTMEMEF_NEW_AND_DELETE_OPERATORS();
114 /** @} */
115
116 /** @name IExtPackBase interfaces
117 * @{ */
118 STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
119 STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
120 STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
121 STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
122 STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
123 STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
124 STDMETHOD(COMGETTER(License))(BSTR *a_pbstrHtmlLicense);
125 STDMETHOD(COMGETTER(ShowLicense))(BOOL *a_pfShowIt);
126 STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
127 STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
128 /** @} */
129
130 /** @name IExtPack interfaces
131 * @{ */
132 STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown);
133 /** @} */
134
135 /** @name Internal interfaces used by ExtPackManager.
136 * @{ */
137 bool callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
138 HRESULT callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
139 bool callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
140 bool callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock);
141 bool callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock);
142 bool callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
143 bool callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
144 bool callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock);
145 HRESULT checkVrde(void);
146 HRESULT getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
147 bool wantsToBeDefaultVrde(void) const;
148 HRESULT refresh(bool *pfCanDelete);
149 /** @} */
150
151protected:
152 /** @name Internal helper methods.
153 * @{ */
154 void probeAndLoad(void);
155 bool findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
156 Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
157 static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
158 /** @} */
159
160 /** @name Extension Pack Helpers
161 * @{ */
162 static DECLCALLBACK(int) hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
163 VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
164 static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
165 static DECLCALLBACK(VBOXEXTPACKCTX) hlpGetContext(PCVBOXEXTPACKHLP pHlp);
166 static DECLCALLBACK(int) hlpReservedN(PCVBOXEXTPACKHLP pHlp);
167 /** @} */
168
169private:
170 struct Data;
171 /** Pointer to the private instance. */
172 Data *m;
173
174 friend class ExtPackManager;
175};
176
177
178/**
179 * Extension pack manager.
180 */
181class ATL_NO_VTABLE ExtPackManager :
182 public VirtualBoxBase,
183 VBOX_SCRIPTABLE_IMPL(IExtPackManager)
184{
185 /** @name COM and internal init/term/mapping cruft.
186 * @{ */
187 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
188 DECLARE_NOT_AGGREGATABLE(ExtPackManager)
189 DECLARE_PROTECT_FINAL_CONSTRUCT()
190 BEGIN_COM_MAP(ExtPackManager)
191 COM_INTERFACE_ENTRY(ISupportErrorInfo)
192 COM_INTERFACE_ENTRY(IExtPackManager)
193 COM_INTERFACE_ENTRY(IDispatch)
194 END_COM_MAP()
195 DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
196
197 HRESULT FinalConstruct();
198 void FinalRelease();
199 HRESULT initExtPackManager(VirtualBox *a_pVirtualBox, VBOXEXTPACKCTX a_enmContext);
200 void uninit();
201 RTMEMEF_NEW_AND_DELETE_OPERATORS();
202 /** @} */
203
204 /** @name IExtPack interfaces
205 * @{ */
206 STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
207 STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
208 STDMETHOD(OpenExtPackFile)(IN_BSTR a_bstrTarball, IExtPackFile **a_ppExtPackFile);
209 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval);
210 STDMETHOD(Cleanup)(void);
211 STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
212 /** @} */
213
214 /** @name Internal interfaces used by other Main classes.
215 * @{ */
216 HRESULT doInstall(ExtPackFile *a_pExtPackFile);
217 void callAllVirtualBoxReadyHooks(void);
218 void callAllConsoleReadyHooks(IConsole *a_pConsole);
219 void callAllVmCreatedHooks(IMachine *a_pMachine);
220 int callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
221 int callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
222 void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
223 HRESULT checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
224 int getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
225 HRESULT getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
226 /** @} */
227
228private:
229 HRESULT runSetUidToRootHelper(const char *a_pszCommand, ...);
230 ExtPack *findExtPack(const char *a_pszName);
231 void removeExtPack(const char *a_pszName);
232 HRESULT refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
233
234private:
235 struct Data;
236 /** Pointer to the private instance. */
237 Data *m;
238};
239
240#endif
241/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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