1
/* $Id: ExtPackManagerImpl.h 35523 2011-01-13 13:12:03Z vboxsync $ */
3
* VirtualBox Main - interface for Extension Packs, VBoxSVC & VBoxC.
7
* Copyright (C) 2010 Oracle Corporation
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.
18
#ifndef ____H_EXTPACKMANAGERIMPL
19
#define ____H_EXTPACKMANAGERIMPL
21
#include "VirtualBoxBase.h"
22
#include <VBox/ExtPack/ExtPack.h>
26
* An extension pack file.
28
class ATL_NO_VTABLE ExtPackFile :
29
public VirtualBoxBase,
30
VBOX_SCRIPTABLE_IMPL(IExtPackFile)
33
/** @name COM and internal init/term/mapping cruft.
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)
44
DECLARE_EMPTY_CTOR_DTOR(ExtPackFile)
46
HRESULT FinalConstruct();
48
HRESULT initWithFile(const char *a_pszFile, class ExtPackManager *a_pExtPackMgr, VirtualBox *a_pVirtualBox);
50
RTMEMEF_NEW_AND_DELETE_OPERATORS();
53
/** @name IExtPackBase interfaces
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(Usable))(BOOL *a_pfUsable);
62
STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
63
STDMETHOD(COMGETTER(ShowLicense))(BOOL *a_pfShowIt);
64
STDMETHOD(COMGETTER(License))(BSTR *a_pbstrHtmlLicense);
65
STDMETHOD(QueryLicense)(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage,
66
IN_BSTR a_bstrFormat, BSTR *a_pbstrLicense);
69
/** @name IExtPackFile interfaces
71
STDMETHOD(COMGETTER(FilePath))(BSTR *a_pbstrPath);
72
STDMETHOD(Install)(BOOL a_fReplace, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress);
76
/** @name Misc init helpers
78
HRESULT initFailed(const char *a_pszWhyFmt, ...);
83
/** Pointer to the private instance. */
86
friend class ExtPackManager;
91
* An installed extension pack.
93
class ATL_NO_VTABLE ExtPack :
94
public VirtualBoxBase,
95
VBOX_SCRIPTABLE_IMPL(IExtPack)
98
/** @name COM and internal init/term/mapping cruft.
100
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack)
101
DECLARE_NOT_AGGREGATABLE(ExtPack)
102
DECLARE_PROTECT_FINAL_CONSTRUCT()
103
BEGIN_COM_MAP(ExtPack)
104
COM_INTERFACE_ENTRY(ISupportErrorInfo)
105
COM_INTERFACE_ENTRY(IExtPack)
106
COM_INTERFACE_ENTRY(IExtPackBase)
107
COM_INTERFACE_ENTRY(IDispatch)
109
DECLARE_EMPTY_CTOR_DTOR(ExtPack)
111
HRESULT FinalConstruct();
113
HRESULT initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir);
115
RTMEMEF_NEW_AND_DELETE_OPERATORS();
118
/** @name IExtPackBase interfaces
120
STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
121
STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
122
STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
123
STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
124
STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
125
STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
126
STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
127
STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
128
STDMETHOD(COMGETTER(ShowLicense))(BOOL *a_pfShowIt);
129
STDMETHOD(COMGETTER(License))(BSTR *a_pbstrHtmlLicense);
130
STDMETHOD(QueryLicense)(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage,
131
IN_BSTR a_bstrFormat, BSTR *a_pbstrLicense);
134
/** @name IExtPack interfaces
136
STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown);
139
/** @name Internal interfaces used by ExtPackManager.
141
bool callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo);
142
HRESULT callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
143
bool callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
144
bool callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock);
145
bool callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock);
146
bool callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
147
bool callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
148
bool callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock);
149
HRESULT checkVrde(void);
150
HRESULT getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
151
bool wantsToBeDefaultVrde(void) const;
152
HRESULT refresh(bool *pfCanDelete);
156
/** @name Internal helper methods.
158
void probeAndLoad(void);
159
bool findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
160
Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
161
static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
164
/** @name Extension Pack Helpers
166
static DECLCALLBACK(int) hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
167
VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
168
static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
169
static DECLCALLBACK(VBOXEXTPACKCTX) hlpGetContext(PCVBOXEXTPACKHLP pHlp);
170
static DECLCALLBACK(int) hlpReservedN(PCVBOXEXTPACKHLP pHlp);
175
/** Pointer to the private instance. */
178
friend class ExtPackManager;
183
* Extension pack manager.
185
class ATL_NO_VTABLE ExtPackManager :
186
public VirtualBoxBase,
187
VBOX_SCRIPTABLE_IMPL(IExtPackManager)
189
/** @name COM and internal init/term/mapping cruft.
191
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
192
DECLARE_NOT_AGGREGATABLE(ExtPackManager)
193
DECLARE_PROTECT_FINAL_CONSTRUCT()
194
BEGIN_COM_MAP(ExtPackManager)
195
COM_INTERFACE_ENTRY(ISupportErrorInfo)
196
COM_INTERFACE_ENTRY(IExtPackManager)
197
COM_INTERFACE_ENTRY(IDispatch)
199
DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
201
HRESULT FinalConstruct();
203
HRESULT initExtPackManager(VirtualBox *a_pVirtualBox, VBOXEXTPACKCTX a_enmContext);
205
RTMEMEF_NEW_AND_DELETE_OPERATORS();
208
/** @name IExtPack interfaces
210
STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
211
STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
212
STDMETHOD(OpenExtPackFile)(IN_BSTR a_bstrTarball, IExtPackFile **a_ppExtPackFile);
213
STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress);
214
STDMETHOD(Cleanup)(void);
215
STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
216
STDMETHOD(IsExtPackUsable(IN_BSTR a_bstrExtPack, BOOL *aUsable));
219
/** @name Internal interfaces used by other Main classes.
221
static DECLCALLBACK(int) doInstallThreadProc(RTTHREAD hThread, void *pvJob);
222
HRESULT doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo);
223
static DECLCALLBACK(int) doUninstallThreadProc(RTTHREAD hThread, void *pvJob);
224
HRESULT doUninstall(const Utf8Str *a_pstrName, bool a_fForcedRemoval, const Utf8Str *a_pstrDisplayInfo);
225
void callAllVirtualBoxReadyHooks(void);
226
void callAllConsoleReadyHooks(IConsole *a_pConsole);
227
void callAllVmCreatedHooks(IMachine *a_pMachine);
228
int callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
229
int callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
230
void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
231
HRESULT checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
232
int getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
233
HRESULT getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
234
bool isExtPackUsable(const char *a_pszExtPack);
238
HRESULT runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...);
239
ExtPack *findExtPack(const char *a_pszName);
240
void removeExtPack(const char *a_pszName);
241
HRESULT refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
245
/** Pointer to the private instance. */
250
/* vi: set tabstop=4 shiftwidth=4 expandtab: */