1 | /* $Id: VirtualBoxImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_VirtualBoxImpl_h
|
---|
29 | #define MAIN_INCLUDED_VirtualBoxImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <VBox/VBoxCryptoIf.h>
|
---|
35 |
|
---|
36 | #include "VirtualBoxBase.h"
|
---|
37 | #include "objectslist.h"
|
---|
38 | #include "VirtualBoxWrap.h"
|
---|
39 |
|
---|
40 | #ifdef RT_OS_WINDOWS
|
---|
41 | # include "win/resource.h"
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | //#ifdef DEBUG_bird
|
---|
45 | //# define VBOXSVC_WITH_CLIENT_WATCHER
|
---|
46 | //#endif
|
---|
47 |
|
---|
48 | namespace com
|
---|
49 | {
|
---|
50 | class Event;
|
---|
51 | class EventQueue;
|
---|
52 | }
|
---|
53 |
|
---|
54 | class SessionMachine;
|
---|
55 | class GuestOSType;
|
---|
56 | class Progress;
|
---|
57 | class Host;
|
---|
58 | class SystemProperties;
|
---|
59 | class DHCPServer;
|
---|
60 | class PerformanceCollector;
|
---|
61 | class CloudProviderManager;
|
---|
62 | #ifdef VBOX_WITH_EXTPACK
|
---|
63 | class ExtPackManager;
|
---|
64 | #endif
|
---|
65 | class AutostartDb;
|
---|
66 | class NATNetwork;
|
---|
67 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
68 | class CloudNetwork;
|
---|
69 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
70 |
|
---|
71 |
|
---|
72 | typedef std::list<ComObjPtr<SessionMachine> > SessionMachinesList;
|
---|
73 |
|
---|
74 | #ifdef RT_OS_WINDOWS
|
---|
75 | class SVCHlpClient;
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | namespace settings
|
---|
79 | {
|
---|
80 | class MainConfigFile;
|
---|
81 | struct MediaRegistry;
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 | #if defined(VBOX_WITH_SDS) && !defined(VBOX_WITH_XPCOM)
|
---|
86 | class VirtualBoxClassFactory; /* See ../src-server/win/svcmain.cpp */
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | class ATL_NO_VTABLE VirtualBox :
|
---|
90 | public VirtualBoxWrap
|
---|
91 | #ifdef RT_OS_WINDOWS
|
---|
92 | , public ATL::CComCoClass<VirtualBox, &CLSID_VirtualBox>
|
---|
93 | #endif
|
---|
94 | {
|
---|
95 |
|
---|
96 | public:
|
---|
97 |
|
---|
98 | typedef std::list<ComPtr<IInternalSessionControl> > InternalControlList;
|
---|
99 | typedef ObjectsList<Machine> MachinesOList;
|
---|
100 |
|
---|
101 | #if 0 /* obsoleted by AsyncEvent */
|
---|
102 | class CallbackEvent;
|
---|
103 | friend class CallbackEvent;
|
---|
104 | #endif
|
---|
105 | class AsyncEvent;
|
---|
106 | friend class AsyncEvent;
|
---|
107 |
|
---|
108 | #ifndef VBOX_WITH_XPCOM
|
---|
109 | # ifdef VBOX_WITH_SDS
|
---|
110 | DECLARE_CLASSFACTORY_EX(VirtualBoxClassFactory)
|
---|
111 | # else
|
---|
112 | DECLARE_CLASSFACTORY_SINGLETON(VirtualBox)
|
---|
113 | # endif
|
---|
114 | #endif
|
---|
115 |
|
---|
116 | // Do not use any ATL registry support.
|
---|
117 | //DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
|
---|
118 |
|
---|
119 | // Kind of redundant (VirtualBoxWrap declares itself not aggregatable and
|
---|
120 | // CComCoClass<VirtualBox, &CLSID_VirtualBox> as aggregatable, the former
|
---|
121 | // is the first inheritance), but the C++ multiple inheritance rules and
|
---|
122 | // the class factory in svcmain.cpp needs this to disambiguate.
|
---|
123 | DECLARE_NOT_AGGREGATABLE(VirtualBox)
|
---|
124 |
|
---|
125 | // to postpone generation of the default ctor/dtor
|
---|
126 | DECLARE_COMMON_CLASS_METHODS(VirtualBox)
|
---|
127 |
|
---|
128 | HRESULT FinalConstruct();
|
---|
129 | void FinalRelease();
|
---|
130 |
|
---|
131 | // public initializer/uninitializer for internal purposes only
|
---|
132 | HRESULT init();
|
---|
133 | HRESULT initMachines();
|
---|
134 | HRESULT initMedia(const Guid &uuidMachineRegistry,
|
---|
135 | const settings::MediaRegistry &mediaRegistry,
|
---|
136 | const Utf8Str &strMachineFolder);
|
---|
137 | void uninit();
|
---|
138 |
|
---|
139 | // public methods only for internal purposes
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * Override of the default locking class to be used for validating lock
|
---|
143 | * order with the standard member lock handle.
|
---|
144 | */
|
---|
145 | virtual VBoxLockingClass getLockingClass() const
|
---|
146 | {
|
---|
147 | return LOCKCLASS_VIRTUALBOXOBJECT;
|
---|
148 | }
|
---|
149 |
|
---|
150 | #ifdef DEBUG
|
---|
151 | void i_dumpAllBackRefs();
|
---|
152 | #endif
|
---|
153 |
|
---|
154 | HRESULT i_postEvent(Event *event);
|
---|
155 |
|
---|
156 | HRESULT i_addProgress(IProgress *aProgress);
|
---|
157 | HRESULT i_removeProgress(IN_GUID aId);
|
---|
158 |
|
---|
159 | #ifdef RT_OS_WINDOWS
|
---|
160 | typedef HRESULT (*PFN_SVC_HELPER_CLIENT_T)(SVCHlpClient *aClient, Progress *aProgress, void *aUser, int *aVrc);
|
---|
161 | HRESULT i_startSVCHelperClient(bool aPrivileged,
|
---|
162 | PFN_SVC_HELPER_CLIENT_T aFunc,
|
---|
163 | void *aUser, Progress *aProgress);
|
---|
164 | #endif
|
---|
165 |
|
---|
166 | void i_addProcessToReap(RTPROCESS pid);
|
---|
167 | void i_updateClientWatcher();
|
---|
168 |
|
---|
169 | int i_loadVDPlugin(const char *pszPluginLibrary);
|
---|
170 | int i_unloadVDPlugin(const char *pszPluginLibrary);
|
---|
171 |
|
---|
172 | void i_onMediumRegistered(const Guid &aMediumId, const DeviceType_T aDevType, BOOL aRegistered);
|
---|
173 | void i_onMediumConfigChanged(IMedium *aMedium);
|
---|
174 | void i_onMediumChanged(IMediumAttachment* aMediumAttachment);
|
---|
175 | void i_onStorageControllerChanged(const Guid &aMachineId, const com::Utf8Str &aControllerName);
|
---|
176 | void i_onStorageDeviceChanged(IMediumAttachment* aStorageDevice, BOOL fRemoved, BOOL fSilent);
|
---|
177 | void i_onMachineStateChanged(const Guid &aId, MachineState_T aState);
|
---|
178 | void i_onMachineDataChanged(const Guid &aId, BOOL aTemporary = FALSE);
|
---|
179 | void i_onMachineGroupsChanged(const Guid &aId);
|
---|
180 | BOOL i_onExtraDataCanChange(const Guid &aId, const Utf8Str &aKey, const Utf8Str &aValue, Bstr &aError);
|
---|
181 | void i_onExtraDataChanged(const Guid &aId, const Utf8Str &aKey, const Utf8Str &aValue);
|
---|
182 | void i_onMachineRegistered(const Guid &aId, BOOL aRegistered);
|
---|
183 | void i_onSessionStateChanged(const Guid &aId, SessionState_T aState);
|
---|
184 |
|
---|
185 | void i_onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId);
|
---|
186 | void i_onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId);
|
---|
187 | void i_onSnapshotRestored(const Guid &aMachineId, const Guid &aSnapshotId);
|
---|
188 | void i_onSnapshotChanged(const Guid &aMachineId, const Guid &aSnapshotId);
|
---|
189 |
|
---|
190 | void i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags,
|
---|
191 | const BOOL fWasDeleted);
|
---|
192 | void i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, const Utf8Str &aName,
|
---|
193 | NATProtocol_T aProto, const Utf8Str &aHostIp, uint16_t aHostPort,
|
---|
194 | const Utf8Str &aGuestIp, uint16_t aGuestPort);
|
---|
195 | void i_onNATNetworkChanged(const Utf8Str &aNetworkName);
|
---|
196 | void i_onNATNetworkStartStop(const Utf8Str &aNetworkName, BOOL aStart);
|
---|
197 | void i_onNATNetworkSetting(const Utf8Str &aNetworkName, BOOL aEnabled, const Utf8Str &aNetwork,
|
---|
198 | const Utf8Str &aGateway, BOOL aAdvertiseDefaultIpv6RouteEnabled,
|
---|
199 | BOOL fNeedDhcpServer);
|
---|
200 | void i_onNATNetworkPortForward(const Utf8Str &aNetworkName, BOOL create, BOOL fIpv6,
|
---|
201 | const Utf8Str &aRuleName, NATProtocol_T proto,
|
---|
202 | const Utf8Str &aHostIp, LONG aHostPort,
|
---|
203 | const Utf8Str &aGuestIp, LONG aGuestPort);
|
---|
204 | void i_onHostNameResolutionConfigurationChange();
|
---|
205 |
|
---|
206 | int i_natNetworkRefInc(const Utf8Str &aNetworkName);
|
---|
207 | int i_natNetworkRefDec(const Utf8Str &aNetworkName);
|
---|
208 |
|
---|
209 | RWLockHandle *i_getNatNetLock() const;
|
---|
210 | bool i_isNatNetStarted(const Utf8Str &aNetworkName) const;
|
---|
211 |
|
---|
212 | void i_onCloudProviderListChanged(BOOL aRegistered);
|
---|
213 | void i_onCloudProviderRegistered(const Utf8Str &aProviderId, BOOL aRegistered);
|
---|
214 | void i_onCloudProviderUninstall(const Utf8Str &aProviderId);
|
---|
215 |
|
---|
216 | void i_onProgressCreated(const Guid &aId, BOOL aCreated);
|
---|
217 |
|
---|
218 | void i_onLanguageChanged(const Utf8Str &aLanguageId);
|
---|
219 |
|
---|
220 | #ifdef VBOX_WITH_UPDATE_AGENT
|
---|
221 | void i_onUpdateAgentAvailable(IUpdateAgent *aAgent,
|
---|
222 | const Utf8Str &aVer, UpdateChannel_T aChannel, UpdateSeverity_T aSev,
|
---|
223 | const Utf8Str &aDownloadURL, const Utf8Str &aWebURL, const Utf8Str &aReleaseNotes);
|
---|
224 | void i_onUpdateAgentError(IUpdateAgent *aAgent, const Utf8Str &aErrMsg, LONG aRc);
|
---|
225 | void i_onUpdateAgentStateChanged(IUpdateAgent *aAgent, UpdateState_T aState);
|
---|
226 | void i_onUpdateAgentSettingsChanged(IUpdateAgent *aAgent, const Utf8Str &aAttributeHint);
|
---|
227 | #endif /* VBOX_WITH_UPDATE_AGENT */
|
---|
228 |
|
---|
229 | #ifdef VBOX_WITH_EXTPACK
|
---|
230 | void i_onExtPackInstalled(const Utf8Str &aExtPackName);
|
---|
231 | void i_onExtPackUninstalled(const Utf8Str &aExtPackName);
|
---|
232 | #endif
|
---|
233 |
|
---|
234 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
235 | HRESULT i_findCloudNetworkByName(const com::Utf8Str &aNetworkName,
|
---|
236 | ComObjPtr<CloudNetwork> *aNetwork = NULL);
|
---|
237 | HRESULT i_getEventSource(ComPtr<IEventSource>& aSource);
|
---|
238 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
239 |
|
---|
240 | ComObjPtr<GuestOSType> i_getUnknownOSType();
|
---|
241 |
|
---|
242 | void i_getOpenedMachines(SessionMachinesList &aMachines,
|
---|
243 | InternalControlList *aControls = NULL);
|
---|
244 | MachinesOList &i_getMachinesList();
|
---|
245 |
|
---|
246 | HRESULT i_findMachine(const Guid &aId,
|
---|
247 | bool fPermitInaccessible,
|
---|
248 | bool aSetError,
|
---|
249 | ComObjPtr<Machine> *aMachine = NULL);
|
---|
250 |
|
---|
251 | HRESULT i_findMachineByName(const Utf8Str &aName,
|
---|
252 | bool aSetError,
|
---|
253 | ComObjPtr<Machine> *aMachine = NULL);
|
---|
254 |
|
---|
255 | HRESULT i_validateMachineGroup(const com::Utf8Str &aGroup, bool fPrimary);
|
---|
256 | HRESULT i_convertMachineGroups(const std::vector<com::Utf8Str> aMachineGroups, StringsList *pllMachineGroups);
|
---|
257 |
|
---|
258 | HRESULT i_findHardDiskById(const Guid &id,
|
---|
259 | bool aSetError,
|
---|
260 | ComObjPtr<Medium> *aHardDisk = NULL);
|
---|
261 | HRESULT i_findHardDiskByLocation(const Utf8Str &strLocation,
|
---|
262 | bool aSetError,
|
---|
263 | ComObjPtr<Medium> *aHardDisk = NULL);
|
---|
264 | HRESULT i_findDVDOrFloppyImage(DeviceType_T mediumType,
|
---|
265 | const Guid *aId,
|
---|
266 | const Utf8Str &aLocation,
|
---|
267 | bool aSetError,
|
---|
268 | ComObjPtr<Medium> *aImage = NULL);
|
---|
269 | HRESULT i_findRemoveableMedium(DeviceType_T mediumType,
|
---|
270 | const Guid &uuid,
|
---|
271 | bool fRefresh,
|
---|
272 | bool aSetError,
|
---|
273 | ComObjPtr<Medium> &pMedium);
|
---|
274 |
|
---|
275 | HRESULT i_findGuestOSType(const Utf8Str &strOSType,
|
---|
276 | ComObjPtr<GuestOSType> &guestOSType);
|
---|
277 |
|
---|
278 | const Guid &i_getGlobalRegistryId() const;
|
---|
279 |
|
---|
280 | const ComObjPtr<Host> &i_host() const;
|
---|
281 | SystemProperties *i_getSystemProperties() const;
|
---|
282 | CloudProviderManager *i_getCloudProviderManager() const;
|
---|
283 | #ifdef VBOX_WITH_EXTPACK
|
---|
284 | ExtPackManager *i_getExtPackManager() const;
|
---|
285 | #endif
|
---|
286 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
287 | const ComObjPtr<PerformanceCollector> &i_performanceCollector() const;
|
---|
288 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
289 |
|
---|
290 | void i_getDefaultMachineFolder(Utf8Str &str) const;
|
---|
291 | void i_getDefaultHardDiskFormat(Utf8Str &str) const;
|
---|
292 |
|
---|
293 | /** Returns the VirtualBox home directory */
|
---|
294 | const Utf8Str &i_homeDir() const;
|
---|
295 | int i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
|
---|
296 | void i_copyPathRelativeToConfig(const Utf8Str &strSource, Utf8Str &strTarget);
|
---|
297 | HRESULT i_registerMedium(const ComObjPtr<Medium> &pMedium, ComObjPtr<Medium> *ppMedium,
|
---|
298 | AutoWriteLock &mediaTreeLock, bool fCalledFromMediumInit = false);
|
---|
299 | HRESULT i_unregisterMedium(Medium *pMedium);
|
---|
300 | HRESULT i_unregisterMachineMedia(const Guid &id);
|
---|
301 | HRESULT i_unregisterMachine(Machine *pMachine, CleanupMode_T aCleanupMode, const Guid &id);
|
---|
302 | void i_rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,
|
---|
303 | const Utf8Str &strNewConfigDir);
|
---|
304 | void i_saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
|
---|
305 | const Guid &uuidRegistry,
|
---|
306 | const Utf8Str &strMachineFolder);
|
---|
307 | HRESULT i_saveSettings();
|
---|
308 | void i_markRegistryModified(const Guid &uuid);
|
---|
309 | void i_unmarkRegistryModified(const Guid &uuid);
|
---|
310 | void i_saveModifiedRegistries();
|
---|
311 | static const com::Utf8Str &i_getVersionNormalized();
|
---|
312 | static HRESULT i_ensureFilePathExists(const Utf8Str &strFileName, bool fCreate);
|
---|
313 | const Utf8Str& i_settingsFilePath();
|
---|
314 | AutostartDb* i_getAutostartDb() const;
|
---|
315 | RWLockHandle& i_getMachinesListLockHandle();
|
---|
316 | RWLockHandle& i_getMediaTreeLockHandle();
|
---|
317 | int i_encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext);
|
---|
318 | int i_decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext);
|
---|
319 | void i_storeSettingsKey(const Utf8Str &aKey);
|
---|
320 | bool i_isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType);
|
---|
321 | HRESULT i_retainCryptoIf(PCVBOXCRYPTOIF *ppCryptoIf);
|
---|
322 | HRESULT i_releaseCryptoIf(PCVBOXCRYPTOIF pCryptoIf);
|
---|
323 | HRESULT i_unloadCryptoIfModule(void);
|
---|
324 | HRESULT i_getSupportedGuestOSTypes(std::vector<PlatformArchitecture_T> aArchitectures,
|
---|
325 | std::vector<ComPtr<IGuestOSType> > &aGuestOSTypes);
|
---|
326 |
|
---|
327 | private:
|
---|
328 | class ClientWatcher;
|
---|
329 |
|
---|
330 | // wrapped IVirtualBox properties
|
---|
331 | HRESULT getVersion(com::Utf8Str &aVersion);
|
---|
332 | HRESULT getVersionNormalized(com::Utf8Str &aVersionNormalized);
|
---|
333 | HRESULT getRevision(ULONG *aRevision);
|
---|
334 | HRESULT getPackageType(com::Utf8Str &aPackageType);
|
---|
335 | HRESULT getAPIVersion(com::Utf8Str &aAPIVersion);
|
---|
336 | HRESULT getAPIRevision(LONG64 *aAPIRevision);
|
---|
337 | HRESULT getHomeFolder(com::Utf8Str &aHomeFolder);
|
---|
338 | HRESULT getSettingsFilePath(com::Utf8Str &aSettingsFilePath);
|
---|
339 | HRESULT getHost(ComPtr<IHost> &aHost);
|
---|
340 | HRESULT getPlatformProperties(PlatformArchitecture_T platformArchitecture, ComPtr<IPlatformProperties> &aPlatformProperties);
|
---|
341 | HRESULT getSystemProperties(ComPtr<ISystemProperties> &aSystemProperties);
|
---|
342 | HRESULT getMachines(std::vector<ComPtr<IMachine> > &aMachines);
|
---|
343 | HRESULT getMachineGroups(std::vector<com::Utf8Str> &aMachineGroups);
|
---|
344 | HRESULT getHardDisks(std::vector<ComPtr<IMedium> > &aHardDisks);
|
---|
345 | HRESULT getDVDImages(std::vector<ComPtr<IMedium> > &aDVDImages);
|
---|
346 | HRESULT getFloppyImages(std::vector<ComPtr<IMedium> > &aFloppyImages);
|
---|
347 | HRESULT getProgressOperations(std::vector<ComPtr<IProgress> > &aProgressOperations);
|
---|
348 | HRESULT getGuestOSFamilies(std::vector<com::Utf8Str> &aOSFamilies);
|
---|
349 | HRESULT getGuestOSTypes(std::vector<ComPtr<IGuestOSType> > &aGuestOSTypes);
|
---|
350 | HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
|
---|
351 | HRESULT getPerformanceCollector(ComPtr<IPerformanceCollector> &aPerformanceCollector);
|
---|
352 | HRESULT getDHCPServers(std::vector<ComPtr<IDHCPServer> > &aDHCPServers);
|
---|
353 | HRESULT getNATNetworks(std::vector<ComPtr<INATNetwork> > &aNATNetworks);
|
---|
354 | HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
|
---|
355 | HRESULT getExtensionPackManager(ComPtr<IExtPackManager> &aExtensionPackManager);
|
---|
356 | HRESULT getHostOnlyNetworks(std::vector<ComPtr<IHostOnlyNetwork> > &aHostOnlyNetworks);
|
---|
357 | HRESULT getInternalNetworks(std::vector<com::Utf8Str> &aInternalNetworks);
|
---|
358 | HRESULT getGenericNetworkDrivers(std::vector<com::Utf8Str> &aGenericNetworkDrivers);
|
---|
359 | HRESULT getCloudNetworks(std::vector<ComPtr<ICloudNetwork> > &aCloudNetworks);
|
---|
360 | HRESULT getCloudProviderManager(ComPtr<ICloudProviderManager> &aCloudProviderManager);
|
---|
361 |
|
---|
362 | // wrapped IVirtualBox methods
|
---|
363 | HRESULT composeMachineFilename(const com::Utf8Str &aName,
|
---|
364 | const com::Utf8Str &aGroup,
|
---|
365 | const com::Utf8Str &aCreateFlags,
|
---|
366 | const com::Utf8Str &aBaseFolder,
|
---|
367 | com::Utf8Str &aFile);
|
---|
368 | HRESULT createMachine(const com::Utf8Str &aSettingsFile,
|
---|
369 | const com::Utf8Str &aName,
|
---|
370 | PlatformArchitecture_T aArchitecture,
|
---|
371 | const std::vector<com::Utf8Str> &aGroups,
|
---|
372 | const com::Utf8Str &aOsTypeId,
|
---|
373 | const com::Utf8Str &aFlags,
|
---|
374 | const com::Utf8Str &aCipher,
|
---|
375 | const com::Utf8Str &aPasswordId,
|
---|
376 | const com::Utf8Str &aPassword,
|
---|
377 | ComPtr<IMachine> &aMachine);
|
---|
378 | HRESULT openMachine(const com::Utf8Str &aSettingsFile,
|
---|
379 | const com::Utf8Str &aPassword,
|
---|
380 | ComPtr<IMachine> &aMachine);
|
---|
381 | HRESULT registerMachine(const ComPtr<IMachine> &aMachine);
|
---|
382 | HRESULT findMachine(const com::Utf8Str &aNameOrId,
|
---|
383 | ComPtr<IMachine> &aMachine);
|
---|
384 | HRESULT getMachinesByGroups(const std::vector<com::Utf8Str> &aGroups,
|
---|
385 | std::vector<ComPtr<IMachine> > &aMachines);
|
---|
386 | HRESULT getMachineStates(const std::vector<ComPtr<IMachine> > &aMachines,
|
---|
387 | std::vector<MachineState_T> &aStates);
|
---|
388 | HRESULT createAppliance(ComPtr<IAppliance> &aAppliance);
|
---|
389 | HRESULT createUnattendedInstaller(ComPtr<IUnattended> &aUnattended);
|
---|
390 | HRESULT createMedium(const com::Utf8Str &aFormat,
|
---|
391 | const com::Utf8Str &aLocation,
|
---|
392 | AccessMode_T aAccessMode,
|
---|
393 | DeviceType_T aDeviceType,
|
---|
394 | ComPtr<IMedium> &aMedium);
|
---|
395 | HRESULT openMedium(const com::Utf8Str &aLocation,
|
---|
396 | DeviceType_T aDeviceType,
|
---|
397 | AccessMode_T aAccessMode,
|
---|
398 | BOOL aForceNewUuid,
|
---|
399 | ComPtr<IMedium> &aMedium);
|
---|
400 | HRESULT getGuestOSType(const com::Utf8Str &aId,
|
---|
401 | ComPtr<IGuestOSType> &aType);
|
---|
402 | HRESULT getGuestOSSubtypesByFamilyId(const Utf8Str &strOSFamily,
|
---|
403 | std::vector<com::Utf8Str> &aOSSubtypes);
|
---|
404 | HRESULT getGuestOSDescsBySubtype(const Utf8Str &strOSSubtype,
|
---|
405 | std::vector<com::Utf8Str> &aGuestOSDescs);
|
---|
406 | HRESULT createSharedFolder(const com::Utf8Str &aName,
|
---|
407 | const com::Utf8Str &aHostPath,
|
---|
408 | BOOL aWritable,
|
---|
409 | BOOL aAutomount,
|
---|
410 | const com::Utf8Str &aAutoMountPoint);
|
---|
411 | HRESULT removeSharedFolder(const com::Utf8Str &aName);
|
---|
412 | HRESULT getExtraDataKeys(std::vector<com::Utf8Str> &aKeys);
|
---|
413 | HRESULT getExtraData(const com::Utf8Str &aKey,
|
---|
414 | com::Utf8Str &aValue);
|
---|
415 | HRESULT setExtraData(const com::Utf8Str &aKey,
|
---|
416 | const com::Utf8Str &aValue);
|
---|
417 | HRESULT setSettingsSecret(const com::Utf8Str &aPassword);
|
---|
418 | HRESULT createDHCPServer(const com::Utf8Str &aName,
|
---|
419 | ComPtr<IDHCPServer> &aServer);
|
---|
420 | HRESULT findDHCPServerByNetworkName(const com::Utf8Str &aName,
|
---|
421 | ComPtr<IDHCPServer> &aServer);
|
---|
422 | HRESULT removeDHCPServer(const ComPtr<IDHCPServer> &aServer);
|
---|
423 | HRESULT createNATNetwork(const com::Utf8Str &aNetworkName,
|
---|
424 | ComPtr<INATNetwork> &aNetwork);
|
---|
425 | HRESULT findNATNetworkByName(const com::Utf8Str &aNetworkName,
|
---|
426 | ComPtr<INATNetwork> &aNetwork);
|
---|
427 | HRESULT removeNATNetwork(const ComPtr<INATNetwork> &aNetwork);
|
---|
428 | HRESULT createHostOnlyNetwork(const com::Utf8Str &aNetworkName,
|
---|
429 | ComPtr<IHostOnlyNetwork> &aNetwork);
|
---|
430 | HRESULT findHostOnlyNetworkByName(const com::Utf8Str &aNetworkName,
|
---|
431 | ComPtr<IHostOnlyNetwork> &aNetwork);
|
---|
432 | HRESULT findHostOnlyNetworkById(const com::Guid &aId,
|
---|
433 | ComPtr<IHostOnlyNetwork> &aNetwork);
|
---|
434 | HRESULT removeHostOnlyNetwork(const ComPtr<IHostOnlyNetwork> &aNetwork);
|
---|
435 | HRESULT createCloudNetwork(const com::Utf8Str &aNetworkName,
|
---|
436 | ComPtr<ICloudNetwork> &aNetwork);
|
---|
437 | HRESULT findCloudNetworkByName(const com::Utf8Str &aNetworkName,
|
---|
438 | ComPtr<ICloudNetwork> &aNetwork);
|
---|
439 | HRESULT removeCloudNetwork(const ComPtr<ICloudNetwork> &aNetwork);
|
---|
440 | HRESULT checkFirmwarePresent(PlatformArchitecture_T aPlatformArchitecture,
|
---|
441 | FirmwareType_T aFirmwareType,
|
---|
442 | const com::Utf8Str &aVersion,
|
---|
443 | com::Utf8Str &aUrl,
|
---|
444 | com::Utf8Str &aFile,
|
---|
445 | BOOL *aResult);
|
---|
446 | HRESULT findProgressById(const com::Guid &aId,
|
---|
447 | ComPtr<IProgress> &aProgressObject);
|
---|
448 |
|
---|
449 | static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const char *aText, ...)
|
---|
450 | {
|
---|
451 | va_list va;
|
---|
452 | va_start (va, aText);
|
---|
453 | HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true, vrc);
|
---|
454 | va_end(va);
|
---|
455 | return hrc;
|
---|
456 | }
|
---|
457 |
|
---|
458 | HRESULT i_registerMachine(Machine *aMachine);
|
---|
459 | HRESULT i_registerDHCPServer(DHCPServer *aDHCPServer,
|
---|
460 | bool aSaveRegistry = true);
|
---|
461 | HRESULT i_unregisterDHCPServer(DHCPServer *aDHCPServer);
|
---|
462 | HRESULT i_registerNATNetwork(NATNetwork *aNATNetwork,
|
---|
463 | bool aSaveRegistry = true);
|
---|
464 | HRESULT i_unregisterNATNetwork(NATNetwork *aNATNetwork,
|
---|
465 | bool aSaveRegistry = true);
|
---|
466 | HRESULT i_checkMediaForConflicts(const Guid &aId,
|
---|
467 | const Utf8Str &aLocation,
|
---|
468 | Utf8Str &aConflictType,
|
---|
469 | ComObjPtr<Medium> *pDupMedium);
|
---|
470 | int i_decryptSettings();
|
---|
471 | int i_decryptMediumSettings(Medium *pMedium);
|
---|
472 | int i_decryptSettingBytes(uint8_t *aPlaintext,
|
---|
473 | const uint8_t *aCiphertext,
|
---|
474 | size_t aCiphertextSize) const;
|
---|
475 | int i_encryptSettingBytes(const uint8_t *aPlaintext,
|
---|
476 | uint8_t *aCiphertext,
|
---|
477 | size_t aPlaintextSize,
|
---|
478 | size_t aCiphertextSize) const;
|
---|
479 | void i_reportDriverVersions(void);
|
---|
480 |
|
---|
481 | struct Data; // opaque data structure, defined in VirtualBoxImpl.cpp
|
---|
482 |
|
---|
483 | Data *m;
|
---|
484 |
|
---|
485 | /* static variables (defined in VirtualBoxImpl.cpp) */
|
---|
486 | static com::Utf8Str sVersion;
|
---|
487 | static com::Utf8Str sVersionNormalized;
|
---|
488 | static ULONG sRevision;
|
---|
489 | static com::Utf8Str sPackageType;
|
---|
490 | static com::Utf8Str sAPIVersion;
|
---|
491 | static std::map<com::Utf8Str, int> sNatNetworkNameToRefCount;
|
---|
492 | static RWLockHandle* spMtxNatNetworkNameToRefCountLock;
|
---|
493 |
|
---|
494 | static DECLCALLBACK(int) AsyncEventHandler(RTTHREAD thread, void *pvUser);
|
---|
495 |
|
---|
496 | #ifdef RT_OS_WINDOWS
|
---|
497 | friend class StartSVCHelperClientData;
|
---|
498 | static void i_SVCHelperClientThreadTask(StartSVCHelperClientData *pTask);
|
---|
499 | #endif
|
---|
500 |
|
---|
501 | #if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER)
|
---|
502 | protected:
|
---|
503 | void i_callHook(const char *a_pszFunction) RT_OVERRIDE;
|
---|
504 | bool i_watchClientProcess(RTPROCESS a_pidClient, const char *a_pszFunction);
|
---|
505 | public:
|
---|
506 | static void i_logCaller(const char *a_pszFormat, ...);
|
---|
507 | private:
|
---|
508 |
|
---|
509 | #endif
|
---|
510 | };
|
---|
511 |
|
---|
512 | ////////////////////////////////////////////////////////////////////////////////
|
---|
513 |
|
---|
514 | #endif /* !MAIN_INCLUDED_VirtualBoxImpl_h */
|
---|