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