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