VirtualBox

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

Last change on this file since 51498 was 50914, checked in by vboxsync, 11 years ago

6813 src-all/ExtPackManagerImpl.cpp

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.5 KB
Line 
1/* $Id: ExtPackManagerImpl.h 50914 2014-03-27 19:07:53Z vboxsync $ */
2/** @file
3 * VirtualBox Main - interface for Extension Packs, VBoxSVC & VBoxC.
4 */
5
6/*
7 * Copyright (C) 2010-2013 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 "ExtPackWrap.h"
24#include "ExtPackFileWrap.h"
25#include "ExtPackManagerWrap.h"
26#include <iprt/fs.h>
27
28#if !defined(VBOX_COM_INPROC)
29/**
30 * An extension pack file.
31 */
32class ATL_NO_VTABLE ExtPackFile :
33 public ExtPackFileWrap
34{
35public:
36 /** @name COM and internal init/term/mapping cruft.
37 * @{ */
38 DECLARE_EMPTY_CTOR_DTOR(ExtPackFile)
39
40 HRESULT FinalConstruct();
41 void FinalRelease();
42 HRESULT initWithFile(const char *a_pszFile, const char *a_pszDigest, class ExtPackManager *a_pExtPackMgr, VirtualBox *a_pVirtualBox);
43 void uninit();
44 /** @} */
45
46private:
47 /** @name Misc init helpers
48 * @{ */
49 HRESULT initFailed(const char *a_pszWhyFmt, ...);
50 /** @} */
51
52private:
53
54 // wrapped IExtPackFile properties
55 HRESULT getName(com::Utf8Str &aName);
56 HRESULT getDescription(com::Utf8Str &aDescription);
57 HRESULT getVersion(com::Utf8Str &aVersion);
58 HRESULT getRevision(ULONG *aRevision);
59 HRESULT getEdition(com::Utf8Str &aEdition);
60 HRESULT getVRDEModule(com::Utf8Str &aVRDEModule);
61 HRESULT getPlugIns(std::vector<ComPtr<IExtPackPlugIn> > &aPlugIns);
62 HRESULT getUsable(BOOL *aUsable);
63 HRESULT getWhyUnusable(com::Utf8Str &aWhyUnusable);
64 HRESULT getShowLicense(BOOL *aShowLicense);
65 HRESULT getLicense(com::Utf8Str &aLicense);
66 HRESULT getFilePath(com::Utf8Str &aFilePath);
67
68 // wrapped IExtPackFile methods
69 HRESULT queryLicense(const com::Utf8Str &aPreferredLocale,
70 const com::Utf8Str &aPreferredLanguage,
71 const com::Utf8Str &aFormat,
72 com::Utf8Str &aLicenseText);
73 HRESULT install(BOOL aReplace,
74 const com::Utf8Str &aDisplayInfo,
75 ComPtr<IProgress> &aProgess);
76
77 struct Data;
78 /** Pointer to the private instance. */
79 Data *m;
80
81 friend class ExtPackManager;
82};
83#endif
84
85
86/**
87 * An installed extension pack.
88 */
89class ATL_NO_VTABLE ExtPack :
90 public ExtPackWrap
91{
92public:
93 /** @name COM and internal init/term/mapping cruft.
94 * @{ */
95 DECLARE_EMPTY_CTOR_DTOR(ExtPack)
96
97 HRESULT FinalConstruct();
98 void FinalRelease();
99 HRESULT initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir);
100 void uninit();
101 RTMEMEF_NEW_AND_DELETE_OPERATORS();
102 /** @} */
103
104 /** @name Internal interfaces used by ExtPackManager.
105 * @{ */
106 bool i_callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo);
107 HRESULT i_callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
108 bool i_callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
109 bool i_callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock);
110 bool i_callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock);
111 bool i_callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
112 bool i_callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
113 bool i_callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock);
114 HRESULT i_checkVrde(void);
115 HRESULT i_getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
116 HRESULT i_getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibrary);
117 bool i_wantsToBeDefaultVrde(void) const;
118 HRESULT i_refresh(bool *pfCanDelete);
119 /** @} */
120
121protected:
122 /** @name Internal helper methods.
123 * @{ */
124 void i_probeAndLoad(void);
125 bool i_findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
126 Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
127 static bool i_objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
128 /** @} */
129
130 /** @name Extension Pack Helpers
131 * @{ */
132 static DECLCALLBACK(int) i_hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
133 VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
134 static DECLCALLBACK(int) i_hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
135 static DECLCALLBACK(VBOXEXTPACKCTX) i_hlpGetContext(PCVBOXEXTPACKHLP pHlp);
136 static DECLCALLBACK(int) i_hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole, const char *pszServiceLibrary, const char *pszServiceName);
137 static DECLCALLBACK(int) i_hlpReservedN(PCVBOXEXTPACKHLP pHlp);
138 /** @} */
139
140private:
141
142 // wrapped IExtPack properties
143 HRESULT getName(com::Utf8Str &aName);
144 HRESULT getDescription(com::Utf8Str &aDescription);
145 HRESULT getVersion(com::Utf8Str &aVersion);
146 HRESULT getRevision(ULONG *aRevision);
147 HRESULT getEdition(com::Utf8Str &aEdition);
148 HRESULT getVRDEModule(com::Utf8Str &aVRDEModule);
149 HRESULT getPlugIns(std::vector<ComPtr<IExtPackPlugIn> > &aPlugIns);
150 HRESULT getUsable(BOOL *aUsable);
151 HRESULT getWhyUnusable(com::Utf8Str &aWhyUnusable);
152 HRESULT getShowLicense(BOOL *aShowLicense);
153 HRESULT getLicense(com::Utf8Str &aLicense);
154
155 // wrapped IExtPack methods
156 HRESULT queryLicense(const com::Utf8Str &aPreferredLocale,
157 const com::Utf8Str &aPreferredLanguage,
158 const com::Utf8Str &aFormat,
159 com::Utf8Str &aLicenseText);
160 HRESULT queryObject(const com::Utf8Str &aObjUuid,
161 ComPtr<IUnknown> &aReturnInterface);
162
163
164 struct Data;
165 /** Pointer to the private instance. */
166 Data *m;
167
168 friend class ExtPackManager;
169};
170
171
172/**
173 * Extension pack manager.
174 */
175class ATL_NO_VTABLE ExtPackManager :
176 public ExtPackManagerWrap
177{
178public:
179 /** @name COM and internal init/term/mapping cruft.
180 * @{ */
181 DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
182
183 HRESULT FinalConstruct();
184 void FinalRelease();
185 HRESULT initExtPackManager(VirtualBox *a_pVirtualBox, VBOXEXTPACKCTX a_enmContext);
186 void uninit();
187 /** @} */
188
189 /** @name Internal interfaces used by other Main classes.
190 * @{ */
191#if !defined(VBOX_COM_INPROC)
192 static DECLCALLBACK(int) i_doInstallThreadProc(RTTHREAD hThread, void *pvJob);
193 HRESULT i_doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo);
194 static DECLCALLBACK(int) i_doUninstallThreadProc(RTTHREAD hThread, void *pvJob);
195 HRESULT i_doUninstall(const Utf8Str *a_pstrName, bool a_fForcedRemoval, const Utf8Str *a_pstrDisplayInfo);
196#endif
197 void i_callAllVirtualBoxReadyHooks(void);
198 void i_callAllConsoleReadyHooks(IConsole *a_pConsole);
199 void i_callAllVmCreatedHooks(IMachine *a_pMachine);
200 int i_callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
201 int i_callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
202 void i_callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
203 HRESULT i_checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
204 int i_getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
205 HRESULT i_getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrLibrary);
206 HRESULT i_getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
207 bool i_isExtPackUsable(const char *a_pszExtPack);
208 void i_dumpAllToReleaseLog(void);
209 /** @} */
210
211private:
212
213 // wrapped IExtPackManager properties
214 HRESULT getInstalledExtPacks(std::vector<ComPtr<IExtPack> > &aInstalledExtPacks);
215
216 // wrapped IExtPackManager methods
217 HRESULT find(const com::Utf8Str &aName,
218 ComPtr<IExtPack> &aReturnData);
219 HRESULT openExtPackFile(const com::Utf8Str &aPath,
220 ComPtr<IExtPackFile> &aFile);
221 HRESULT uninstall(const com::Utf8Str &aName,
222 BOOL aForcedRemoval,
223 const com::Utf8Str &aDisplayInfo,
224 ComPtr<IProgress> &aProgess);
225 HRESULT cleanup();
226 HRESULT queryAllPlugInsForFrontend(const com::Utf8Str &aFrontendName,
227 std::vector<com::Utf8Str> &aPlugInModules);
228 HRESULT isExtPackUsable(const com::Utf8Str &aName,
229 BOOL *aUsable);
230
231 HRESULT i_runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...);
232 ExtPack *i_findExtPack(const char *a_pszName);
233 void i_removeExtPack(const char *a_pszName);
234 HRESULT i_refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
235
236private:
237 struct Data;
238 /** Pointer to the private instance. */
239 Data *m;
240};
241
242#endif
243/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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