VirtualBox

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

Last change on this file since 34086 was 34086, checked in by vboxsync, 14 years ago

Main: Pass more IVirtualBox pointers to the extension pack. VRDE registration hook, VirtualBoxReady hook.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/* $Id: ExtPackManagerImpl.h 34086 2010-11-15 17:45:50Z 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(VirtualBox *a_pVirtualBox, 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(IVirtualBox *a_pVirtualBox);
69 HRESULT callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
70 void callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox);
71 void callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine);
72 int callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM);
73 int callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM);
74 void callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM);
75 HRESULT refresh(bool *pfCanDelete);
76 /** @} */
77
78protected:
79 /** @name Internal helper methods.
80 * @{ */
81 void probeAndLoad(void);
82 bool findModule(const char *a_pszName, const char *a_pszExt,
83 Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
84 static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
85 /** @} */
86
87 /** @name Extension Pack Helpers
88 * @{ */
89 static DECLCALLBACK(int) hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
90 char *pszFound, size_t cbFound, bool *pfNative);
91 static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
92 static DECLCALLBACK(int) hlpRegisterVrde(PCVBOXEXTPACKHLP pHlp, const char *pszName, bool fSetDefault);
93 /** @} */
94
95private:
96 struct Data;
97 /** Pointer to the private instance. */
98 Data *m;
99
100 friend class ExtPackManager;
101};
102
103
104/**
105 * Extension pack manager.
106 */
107class ATL_NO_VTABLE ExtPackManager :
108 public VirtualBoxBase,
109 VBOX_SCRIPTABLE_IMPL(IExtPackManager)
110{
111 /** @name COM and internal init/term/mapping cruft.
112 * @{ */
113 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
114 DECLARE_NOT_AGGREGATABLE(ExtPackManager)
115 DECLARE_PROTECT_FINAL_CONSTRUCT()
116 BEGIN_COM_MAP(ExtPackManager)
117 COM_INTERFACE_ENTRY(ISupportErrorInfo)
118 COM_INTERFACE_ENTRY(IExtPackManager)
119 COM_INTERFACE_ENTRY(IDispatch)
120 END_COM_MAP()
121 DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
122
123 HRESULT FinalConstruct();
124 void FinalRelease();
125 HRESULT init(VirtualBox *a_pVirtualBox, const char *a_pszDropZonePath, bool a_fCheckDropZone);
126 void uninit();
127 /** @} */
128
129 /** @name IExtPack interfaces
130 * @{ */
131 STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
132 STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
133 STDMETHOD(Install)(IN_BSTR a_bstrTarball, BSTR *a_pbstrName);
134 STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval);
135 STDMETHOD(Cleanup)(void);
136 STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
137 /** @} */
138
139 /** @name Internal interfaces used by other Main classes.
140 * @{ */
141 void processDropZone(void);
142 void callAllVirtualBoxReadyHooks(void);
143 void callAllVmCreatedHooks(IMachine *a_pMachine);
144 int callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
145 int callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
146 void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
147 /** @} */
148
149private:
150 HRESULT runSetUidToRootHelper(const char *a_pszCommand, ...);
151 ExtPack *findExtPack(const char *a_pszName);
152 void removeExtPack(const char *a_pszName);
153 HRESULT refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
154
155private:
156 struct Data;
157 /** Pointer to the private instance. */
158 Data *m;
159};
160
161#endif
162/* 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