1 | /* $Id: MachineImpl.h 94660 2022-04-21 08:38:34Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Implementation of IMachine in VBoxSVC - Header.
|
---|
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_MachineImpl_h
|
---|
19 | #define MAIN_INCLUDED_MachineImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "AuthLibrary.h"
|
---|
25 | #include "VirtualBoxBase.h"
|
---|
26 | #include "ProgressImpl.h"
|
---|
27 | #include "VRDEServerImpl.h"
|
---|
28 | #include "MediumAttachmentImpl.h"
|
---|
29 | #include "PCIDeviceAttachmentImpl.h"
|
---|
30 | #include "MediumLock.h"
|
---|
31 | #include "NetworkAdapterImpl.h"
|
---|
32 | #include "AudioAdapterImpl.h"
|
---|
33 | #include "SerialPortImpl.h"
|
---|
34 | #include "ParallelPortImpl.h"
|
---|
35 | #include "BIOSSettingsImpl.h"
|
---|
36 | #include "RecordingSettingsImpl.h"
|
---|
37 | #include "GraphicsAdapterImpl.h"
|
---|
38 | #include "StorageControllerImpl.h" // required for MachineImpl.h to compile on Windows
|
---|
39 | #include "USBControllerImpl.h" // required for MachineImpl.h to compile on Windows
|
---|
40 | #include "BandwidthControlImpl.h"
|
---|
41 | #include "BandwidthGroupImpl.h"
|
---|
42 | #include "TrustedPlatformModuleImpl.h"
|
---|
43 | #include "NvramStoreImpl.h"
|
---|
44 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
45 | # include "Performance.h"
|
---|
46 | # include "PerformanceImpl.h"
|
---|
47 | #endif
|
---|
48 | #include "ThreadTask.h"
|
---|
49 |
|
---|
50 | // generated header
|
---|
51 | #include "SchemaDefs.h"
|
---|
52 |
|
---|
53 | #include "VBox/com/ErrorInfo.h"
|
---|
54 |
|
---|
55 | #include <iprt/time.h>
|
---|
56 |
|
---|
57 | #include <list>
|
---|
58 | #include <vector>
|
---|
59 |
|
---|
60 | #include "MachineWrap.h"
|
---|
61 |
|
---|
62 | /** @todo r=klaus after moving the various Machine settings structs to
|
---|
63 | * MachineImpl.cpp it should be possible to eliminate this include. */
|
---|
64 | #include <VBox/settings.h>
|
---|
65 |
|
---|
66 | // defines
|
---|
67 | ////////////////////////////////////////////////////////////////////////////////
|
---|
68 |
|
---|
69 | // helper declarations
|
---|
70 | ////////////////////////////////////////////////////////////////////////////////
|
---|
71 |
|
---|
72 | class Progress;
|
---|
73 | class ProgressProxy;
|
---|
74 | class Keyboard;
|
---|
75 | class Mouse;
|
---|
76 | class Display;
|
---|
77 | class MachineDebugger;
|
---|
78 | class USBController;
|
---|
79 | class USBDeviceFilters;
|
---|
80 | class Snapshot;
|
---|
81 | class SharedFolder;
|
---|
82 | class HostUSBDevice;
|
---|
83 | class StorageController;
|
---|
84 | class SessionMachine;
|
---|
85 | #ifdef VBOX_WITH_UNATTENDED
|
---|
86 | class Unattended;
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | // Machine class
|
---|
90 | ////////////////////////////////////////////////////////////////////////////////
|
---|
91 | //
|
---|
92 | class ATL_NO_VTABLE Machine :
|
---|
93 | public MachineWrap
|
---|
94 | {
|
---|
95 |
|
---|
96 | public:
|
---|
97 |
|
---|
98 | enum StateDependency
|
---|
99 | {
|
---|
100 | AnyStateDep = 0,
|
---|
101 | MutableStateDep,
|
---|
102 | MutableOrSavedStateDep,
|
---|
103 | MutableOrRunningStateDep,
|
---|
104 | MutableOrSavedOrRunningStateDep,
|
---|
105 | };
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Internal machine data.
|
---|
109 | *
|
---|
110 | * Only one instance of this data exists per every machine -- it is shared
|
---|
111 | * by the Machine, SessionMachine and all SnapshotMachine instances
|
---|
112 | * associated with the given machine using the util::Shareable template
|
---|
113 | * through the mData variable.
|
---|
114 | *
|
---|
115 | * @note |const| members are persistent during lifetime so can be
|
---|
116 | * accessed without locking.
|
---|
117 | *
|
---|
118 | * @note There is no need to lock anything inside init() or uninit()
|
---|
119 | * methods, because they are always serialized (see AutoCaller).
|
---|
120 | */
|
---|
121 | struct Data
|
---|
122 | {
|
---|
123 | /**
|
---|
124 | * Data structure to hold information about sessions opened for the
|
---|
125 | * given machine.
|
---|
126 | */
|
---|
127 | struct Session
|
---|
128 | {
|
---|
129 | /** Type of lock which created this session */
|
---|
130 | LockType_T mLockType;
|
---|
131 |
|
---|
132 | /** Control of the direct session opened by lockMachine() */
|
---|
133 | ComPtr<IInternalSessionControl> mDirectControl;
|
---|
134 |
|
---|
135 | typedef std::list<ComPtr<IInternalSessionControl> > RemoteControlList;
|
---|
136 |
|
---|
137 | /** list of controls of all opened remote sessions */
|
---|
138 | RemoteControlList mRemoteControls;
|
---|
139 |
|
---|
140 | /** launchVMProcess() and OnSessionEnd() progress indicator */
|
---|
141 | ComObjPtr<ProgressProxy> mProgress;
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * PID of the session object that must be passed to openSession()
|
---|
145 | * to finalize the launchVMProcess() request (i.e., PID of the
|
---|
146 | * process created by launchVMProcess())
|
---|
147 | */
|
---|
148 | RTPROCESS mPID;
|
---|
149 |
|
---|
150 | /** Current session state */
|
---|
151 | SessionState_T mState;
|
---|
152 |
|
---|
153 | /** Session name string (of the primary session) */
|
---|
154 | Utf8Str mName;
|
---|
155 |
|
---|
156 | /** Session machine object */
|
---|
157 | ComObjPtr<SessionMachine> mMachine;
|
---|
158 |
|
---|
159 | /** Medium object lock collection. */
|
---|
160 | MediumLockListMap mLockedMedia;
|
---|
161 | };
|
---|
162 |
|
---|
163 | Data();
|
---|
164 | ~Data();
|
---|
165 |
|
---|
166 | const Guid mUuid;
|
---|
167 | BOOL mRegistered;
|
---|
168 |
|
---|
169 | Utf8Str m_strConfigFile;
|
---|
170 | Utf8Str m_strConfigFileFull;
|
---|
171 |
|
---|
172 | // machine settings XML file
|
---|
173 | settings::MachineConfigFile *pMachineConfigFile;
|
---|
174 | uint32_t flModifications;
|
---|
175 | bool m_fAllowStateModification;
|
---|
176 |
|
---|
177 | BOOL mAccessible;
|
---|
178 | com::ErrorInfo mAccessError;
|
---|
179 |
|
---|
180 | MachineState_T mMachineState;
|
---|
181 | RTTIMESPEC mLastStateChange;
|
---|
182 |
|
---|
183 | /* Note: These are guarded by VirtualBoxBase::stateLockHandle() */
|
---|
184 | uint32_t mMachineStateDeps;
|
---|
185 | RTSEMEVENTMULTI mMachineStateDepsSem;
|
---|
186 | uint32_t mMachineStateChangePending;
|
---|
187 |
|
---|
188 | BOOL mCurrentStateModified;
|
---|
189 | /** Guest properties have been modified and need saving since the
|
---|
190 | * machine was started, or there are transient properties which need
|
---|
191 | * deleting and the machine is being shut down. */
|
---|
192 | BOOL mGuestPropertiesModified;
|
---|
193 |
|
---|
194 | Session mSession;
|
---|
195 |
|
---|
196 | ComObjPtr<Snapshot> mFirstSnapshot;
|
---|
197 | ComObjPtr<Snapshot> mCurrentSnapshot;
|
---|
198 |
|
---|
199 | // list of files to delete in Delete(); this list is filled by Unregister()
|
---|
200 | std::list<Utf8Str> llFilesToDelete;
|
---|
201 |
|
---|
202 | #ifdef VBOX_WITH_FULL_VM_ENCRYPTION
|
---|
203 | /* Store for secret keys. */
|
---|
204 | SecretKeyStore *mpKeyStore;
|
---|
205 | BOOL fEncrypted;
|
---|
206 | /* KeyId of the password encrypting the DEK */
|
---|
207 | com::Utf8Str mstrKeyId;
|
---|
208 | /* Store containing the DEK used for encrypting the VM */
|
---|
209 | com::Utf8Str mstrKeyStore;
|
---|
210 | /* KeyId of the password encrypting the DEK for log files */
|
---|
211 | com::Utf8Str mstrLogKeyId;
|
---|
212 | /* Store containing the DEK used for encrypting the VM's log files */
|
---|
213 | com::Utf8Str mstrLogKeyStore;
|
---|
214 | #endif
|
---|
215 | };
|
---|
216 |
|
---|
217 | /**
|
---|
218 | * Saved state data.
|
---|
219 | *
|
---|
220 | * It's actually only the state file path string, but it needs to be
|
---|
221 | * separate from Data, because Machine and SessionMachine instances
|
---|
222 | * share it, while SnapshotMachine does not.
|
---|
223 | *
|
---|
224 | * The data variable is |mSSData|.
|
---|
225 | */
|
---|
226 | struct SSData
|
---|
227 | {
|
---|
228 | Utf8Str strStateFilePath;
|
---|
229 | #ifdef VBOX_WITH_FULL_VM_ENCRYPTION
|
---|
230 | /* KeyId of the password encrypting the DEK for saved state */
|
---|
231 | com::Utf8Str strStateKeyId;
|
---|
232 | /* Store containing the DEK used for encrypting saved state */
|
---|
233 | com::Utf8Str strStateKeyStore;
|
---|
234 | #endif
|
---|
235 | };
|
---|
236 |
|
---|
237 | /**
|
---|
238 | * User changeable machine data.
|
---|
239 | *
|
---|
240 | * This data is common for all machine snapshots, i.e. it is shared
|
---|
241 | * by all SnapshotMachine instances associated with the given machine
|
---|
242 | * using the util::Backupable template through the |mUserData| variable.
|
---|
243 | *
|
---|
244 | * SessionMachine instances can alter this data and discard changes.
|
---|
245 | *
|
---|
246 | * @note There is no need to lock anything inside init() or uninit()
|
---|
247 | * methods, because they are always serialized (see AutoCaller).
|
---|
248 | */
|
---|
249 | struct UserData
|
---|
250 | {
|
---|
251 | settings::MachineUserData s;
|
---|
252 | };
|
---|
253 |
|
---|
254 | /**
|
---|
255 | * Hardware data.
|
---|
256 | *
|
---|
257 | * This data is unique for a machine and for every machine snapshot.
|
---|
258 | * Stored using the util::Backupable template in the |mHWData| variable.
|
---|
259 | *
|
---|
260 | * SessionMachine instances can alter this data and discard changes.
|
---|
261 | *
|
---|
262 | * @todo r=klaus move all "pointer" objects out of this struct, as they
|
---|
263 | * need non-obvious handling when creating a new session or when taking
|
---|
264 | * a snapshot. Better do this right straight away, not relying on the
|
---|
265 | * template magic which doesn't work right in this case.
|
---|
266 | */
|
---|
267 | struct HWData
|
---|
268 | {
|
---|
269 | /**
|
---|
270 | * Data structure to hold information about a guest property.
|
---|
271 | */
|
---|
272 | struct GuestProperty {
|
---|
273 | /** Property value */
|
---|
274 | Utf8Str strValue;
|
---|
275 | /** Property timestamp */
|
---|
276 | LONG64 mTimestamp;
|
---|
277 | /** Property flags */
|
---|
278 | ULONG mFlags;
|
---|
279 | };
|
---|
280 |
|
---|
281 | HWData();
|
---|
282 | ~HWData();
|
---|
283 |
|
---|
284 | Bstr mHWVersion;
|
---|
285 | Guid mHardwareUUID; /**< If Null, use mData.mUuid. */
|
---|
286 | ULONG mMemorySize;
|
---|
287 | ULONG mMemoryBalloonSize;
|
---|
288 | BOOL mPageFusionEnabled;
|
---|
289 | settings::RecordingSettings mRecordSettings;
|
---|
290 | BOOL mHWVirtExEnabled;
|
---|
291 | BOOL mHWVirtExNestedPagingEnabled;
|
---|
292 | BOOL mHWVirtExLargePagesEnabled;
|
---|
293 | BOOL mHWVirtExVPIDEnabled;
|
---|
294 | BOOL mHWVirtExUXEnabled;
|
---|
295 | BOOL mHWVirtExForceEnabled;
|
---|
296 | BOOL mHWVirtExUseNativeApi;
|
---|
297 | BOOL mHWVirtExVirtVmsaveVmload;
|
---|
298 | BOOL mPAEEnabled;
|
---|
299 | settings::Hardware::LongModeType mLongMode;
|
---|
300 | BOOL mTripleFaultReset;
|
---|
301 | BOOL mAPIC;
|
---|
302 | BOOL mX2APIC;
|
---|
303 | BOOL mIBPBOnVMExit;
|
---|
304 | BOOL mIBPBOnVMEntry;
|
---|
305 | BOOL mSpecCtrl;
|
---|
306 | BOOL mSpecCtrlByHost;
|
---|
307 | BOOL mL1DFlushOnSched;
|
---|
308 | BOOL mL1DFlushOnVMEntry;
|
---|
309 | BOOL mMDSClearOnSched;
|
---|
310 | BOOL mMDSClearOnVMEntry;
|
---|
311 | BOOL mNestedHWVirt;
|
---|
312 | ULONG mCPUCount;
|
---|
313 | BOOL mCPUHotPlugEnabled;
|
---|
314 | ULONG mCpuExecutionCap;
|
---|
315 | uint32_t mCpuIdPortabilityLevel;
|
---|
316 | Utf8Str mCpuProfile;
|
---|
317 | BOOL mHPETEnabled;
|
---|
318 |
|
---|
319 | BOOL mCPUAttached[SchemaDefs::MaxCPUCount];
|
---|
320 |
|
---|
321 | std::list<settings::CpuIdLeaf> mCpuIdLeafList;
|
---|
322 |
|
---|
323 | DeviceType_T mBootOrder[SchemaDefs::MaxBootPosition];
|
---|
324 |
|
---|
325 | typedef std::list<ComObjPtr<SharedFolder> > SharedFolderList;
|
---|
326 | SharedFolderList mSharedFolders;
|
---|
327 |
|
---|
328 | ClipboardMode_T mClipboardMode;
|
---|
329 | BOOL mClipboardFileTransfersEnabled;
|
---|
330 |
|
---|
331 | DnDMode_T mDnDMode;
|
---|
332 |
|
---|
333 | typedef std::map<Utf8Str, GuestProperty> GuestPropertyMap;
|
---|
334 | GuestPropertyMap mGuestProperties;
|
---|
335 |
|
---|
336 | FirmwareType_T mFirmwareType;
|
---|
337 | KeyboardHIDType_T mKeyboardHIDType;
|
---|
338 | PointingHIDType_T mPointingHIDType;
|
---|
339 | ChipsetType_T mChipsetType;
|
---|
340 | IommuType_T mIommuType;
|
---|
341 | ParavirtProvider_T mParavirtProvider;
|
---|
342 | Utf8Str mParavirtDebug;
|
---|
343 | BOOL mEmulatedUSBCardReaderEnabled;
|
---|
344 |
|
---|
345 | BOOL mIOCacheEnabled;
|
---|
346 | ULONG mIOCacheSize;
|
---|
347 |
|
---|
348 | typedef std::list<ComObjPtr<PCIDeviceAttachment> > PCIDeviceAssignmentList;
|
---|
349 | PCIDeviceAssignmentList mPCIDeviceAssignments;
|
---|
350 |
|
---|
351 | settings::Debugging mDebugging;
|
---|
352 | settings::Autostart mAutostart;
|
---|
353 |
|
---|
354 | Utf8Str mDefaultFrontend;
|
---|
355 | };
|
---|
356 |
|
---|
357 | typedef std::list<ComObjPtr<MediumAttachment> > MediumAttachmentList;
|
---|
358 |
|
---|
359 | DECLARE_COMMON_CLASS_METHODS(Machine)
|
---|
360 |
|
---|
361 | HRESULT FinalConstruct();
|
---|
362 | void FinalRelease();
|
---|
363 |
|
---|
364 | // public initializer/uninitializer for internal purposes only:
|
---|
365 |
|
---|
366 | // initializer for creating a new, empty machine
|
---|
367 | HRESULT init(VirtualBox *aParent,
|
---|
368 | const Utf8Str &strConfigFile,
|
---|
369 | const Utf8Str &strName,
|
---|
370 | const StringsList &llGroups,
|
---|
371 | const Utf8Str &strOsTypeId,
|
---|
372 | GuestOSType *aOsType,
|
---|
373 | const Guid &aId,
|
---|
374 | bool fForceOverwrite,
|
---|
375 | bool fDirectoryIncludesUUID,
|
---|
376 | const com::Utf8Str &aCipher,
|
---|
377 | const com::Utf8Str &aPasswordId,
|
---|
378 | const com::Utf8Str &aPassword);
|
---|
379 |
|
---|
380 | // initializer for loading existing machine XML (either registered or not)
|
---|
381 | HRESULT initFromSettings(VirtualBox *aParent,
|
---|
382 | const Utf8Str &strConfigFile,
|
---|
383 | const Guid *aId,
|
---|
384 | const com::Utf8Str &strPassword);
|
---|
385 |
|
---|
386 | // initializer for machine config in memory (OVF import)
|
---|
387 | HRESULT init(VirtualBox *aParent,
|
---|
388 | const Utf8Str &strName,
|
---|
389 | const Utf8Str &strSettingsFilename,
|
---|
390 | const settings::MachineConfigFile &config);
|
---|
391 |
|
---|
392 | void uninit();
|
---|
393 |
|
---|
394 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
395 | // Needed from VirtualBox, for the delayed metrics cleanup.
|
---|
396 | void i_unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine);
|
---|
397 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
398 |
|
---|
399 | protected:
|
---|
400 | HRESULT initImpl(VirtualBox *aParent,
|
---|
401 | const Utf8Str &strConfigFile);
|
---|
402 | HRESULT initDataAndChildObjects();
|
---|
403 | HRESULT i_registeredInit();
|
---|
404 | HRESULT i_tryCreateMachineConfigFile(bool fForceOverwrite);
|
---|
405 | void uninitDataAndChildObjects();
|
---|
406 |
|
---|
407 | public:
|
---|
408 |
|
---|
409 |
|
---|
410 | // public methods only for internal purposes
|
---|
411 |
|
---|
412 | virtual bool i_isSnapshotMachine() const
|
---|
413 | {
|
---|
414 | return false;
|
---|
415 | }
|
---|
416 |
|
---|
417 | virtual bool i_isSessionMachine() const
|
---|
418 | {
|
---|
419 | return false;
|
---|
420 | }
|
---|
421 |
|
---|
422 | /**
|
---|
423 | * Override of the default locking class to be used for validating lock
|
---|
424 | * order with the standard member lock handle.
|
---|
425 | */
|
---|
426 | virtual VBoxLockingClass getLockingClass() const
|
---|
427 | {
|
---|
428 | return LOCKCLASS_MACHINEOBJECT;
|
---|
429 | }
|
---|
430 |
|
---|
431 | /// @todo (dmik) add lock and make non-inlined after revising classes
|
---|
432 | // that use it. Note: they should enter Machine lock to keep the returned
|
---|
433 | // information valid!
|
---|
434 | bool i_isRegistered() { return !!mData->mRegistered; }
|
---|
435 |
|
---|
436 | // unsafe inline public methods for internal purposes only (ensure there is
|
---|
437 | // a caller and a read lock before calling them!)
|
---|
438 |
|
---|
439 | /**
|
---|
440 | * Returns the VirtualBox object this machine belongs to.
|
---|
441 | *
|
---|
442 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
443 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
444 | * one) or after doing addCaller() manually.
|
---|
445 | */
|
---|
446 | VirtualBox* i_getVirtualBox() const { return mParent; }
|
---|
447 |
|
---|
448 | /**
|
---|
449 | * Checks if this machine is accessible, without attempting to load the
|
---|
450 | * config file.
|
---|
451 | *
|
---|
452 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
453 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
454 | * one) or after doing addCaller() manually.
|
---|
455 | */
|
---|
456 | bool i_isAccessible() const { return !!mData->mAccessible; }
|
---|
457 |
|
---|
458 | /**
|
---|
459 | * Returns this machine ID.
|
---|
460 | *
|
---|
461 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
462 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
463 | * one) or after adding a caller manually.
|
---|
464 | */
|
---|
465 | const Guid& i_getId() const { return mData->mUuid; }
|
---|
466 |
|
---|
467 | /**
|
---|
468 | * Returns the snapshot ID this machine represents or an empty UUID if this
|
---|
469 | * instance is not SnapshotMachine.
|
---|
470 | *
|
---|
471 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
472 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
473 | * one) or after adding a caller manually.
|
---|
474 | */
|
---|
475 | inline const Guid& i_getSnapshotId() const;
|
---|
476 |
|
---|
477 | /**
|
---|
478 | * Returns this machine's full settings file path.
|
---|
479 | *
|
---|
480 | * @note This method doesn't lock this object or check its readiness.
|
---|
481 | * Intended to be used only after doing addCaller() manually and locking it
|
---|
482 | * for reading.
|
---|
483 | */
|
---|
484 | const Utf8Str& i_getSettingsFileFull() const { return mData->m_strConfigFileFull; }
|
---|
485 |
|
---|
486 | /**
|
---|
487 | * Returns this machine name.
|
---|
488 | *
|
---|
489 | * @note This method doesn't lock this object or check its readiness.
|
---|
490 | * Intended to be used only after doing addCaller() manually and locking it
|
---|
491 | * for reading.
|
---|
492 | */
|
---|
493 | const Utf8Str& i_getName() const { return mUserData->s.strName; }
|
---|
494 |
|
---|
495 | enum
|
---|
496 | {
|
---|
497 | IsModified_MachineData = 0x000001,
|
---|
498 | IsModified_Storage = 0x000002,
|
---|
499 | IsModified_NetworkAdapters = 0x000008,
|
---|
500 | IsModified_SerialPorts = 0x000010,
|
---|
501 | IsModified_ParallelPorts = 0x000020,
|
---|
502 | IsModified_VRDEServer = 0x000040,
|
---|
503 | IsModified_AudioAdapter = 0x000080,
|
---|
504 | IsModified_USB = 0x000100,
|
---|
505 | IsModified_BIOS = 0x000200,
|
---|
506 | IsModified_SharedFolders = 0x000400,
|
---|
507 | IsModified_Snapshots = 0x000800,
|
---|
508 | IsModified_BandwidthControl = 0x001000,
|
---|
509 | IsModified_Recording = 0x002000,
|
---|
510 | IsModified_GraphicsAdapter = 0x004000,
|
---|
511 | IsModified_TrustedPlatformModule = 0x008000,
|
---|
512 | IsModified_NvramStore = 0x010000,
|
---|
513 | };
|
---|
514 |
|
---|
515 | /**
|
---|
516 | * Returns various information about this machine.
|
---|
517 | *
|
---|
518 | * @note This method doesn't lock this object or check its readiness.
|
---|
519 | * Intended to be used only after doing addCaller() manually and locking it
|
---|
520 | * for reading.
|
---|
521 | */
|
---|
522 | Utf8Str i_getOSTypeId() const { return mUserData->s.strOsType; }
|
---|
523 | ChipsetType_T i_getChipsetType() const { return mHWData->mChipsetType; }
|
---|
524 | FirmwareType_T i_getFirmwareType() const { return mHWData->mFirmwareType; }
|
---|
525 | ParavirtProvider_T i_getParavirtProvider() const { return mHWData->mParavirtProvider; }
|
---|
526 | Utf8Str i_getParavirtDebug() const { return mHWData->mParavirtDebug; }
|
---|
527 |
|
---|
528 | void i_setModified(uint32_t fl, bool fAllowStateModification = true);
|
---|
529 | void i_setModifiedLock(uint32_t fl, bool fAllowStateModification = true);
|
---|
530 |
|
---|
531 | MachineState_T i_getMachineState() const { return mData->mMachineState; }
|
---|
532 |
|
---|
533 | bool i_isStateModificationAllowed() const { return mData->m_fAllowStateModification; }
|
---|
534 | void i_allowStateModification() { mData->m_fAllowStateModification = true; }
|
---|
535 | void i_disallowStateModification() { mData->m_fAllowStateModification = false; }
|
---|
536 |
|
---|
537 | const StringsList &i_getGroups() const { return mUserData->s.llGroups; }
|
---|
538 |
|
---|
539 | // callback handlers
|
---|
540 | virtual HRESULT i_onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; }
|
---|
541 | virtual HRESULT i_onNATRedirectRuleChanged(ULONG /* slot */, BOOL /* fRemove */ , const Utf8Str & /* name */,
|
---|
542 | NATProtocol_T /* protocol */, const Utf8Str & /* host ip */, LONG /* host port */,
|
---|
543 | const Utf8Str & /* guest port */, LONG /* guest port */ ) { return S_OK; }
|
---|
544 | virtual HRESULT i_onAudioAdapterChange(IAudioAdapter * /* audioAdapter */) { return S_OK; }
|
---|
545 | virtual HRESULT i_onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; }
|
---|
546 | virtual HRESULT i_onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; }
|
---|
547 | virtual HRESULT i_onVRDEServerChange(BOOL /* aRestart */) { return S_OK; }
|
---|
548 | virtual HRESULT i_onUSBControllerChange() { return S_OK; }
|
---|
549 | virtual HRESULT i_onStorageControllerChange(const com::Guid & /* aMachineId */, const com::Utf8Str & /* aControllerName */) { return S_OK; }
|
---|
550 | virtual HRESULT i_onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
|
---|
551 | virtual HRESULT i_onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; }
|
---|
552 | virtual HRESULT i_onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
|
---|
553 | virtual HRESULT i_onSharedFolderChange() { return S_OK; }
|
---|
554 | virtual HRESULT i_onVMProcessPriorityChange(VMProcPriority_T /* aPriority */) { return S_OK; }
|
---|
555 | virtual HRESULT i_onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; }
|
---|
556 | virtual HRESULT i_onClipboardFileTransferModeChange(BOOL /* aEnable */) { return S_OK; }
|
---|
557 | virtual HRESULT i_onDnDModeChange(DnDMode_T /* aDnDMode */) { return S_OK; }
|
---|
558 | virtual HRESULT i_onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
|
---|
559 | virtual HRESULT i_onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */,
|
---|
560 | BOOL /* silent */) { return S_OK; }
|
---|
561 | virtual HRESULT i_onRecordingChange(BOOL /* aEnable */) { return S_OK; }
|
---|
562 |
|
---|
563 | HRESULT i_saveRegistryEntry(settings::MachineRegistryEntry &data);
|
---|
564 |
|
---|
565 | int i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
|
---|
566 | void i_copyPathRelativeToMachine(const Utf8Str &strSource, Utf8Str &strTarget);
|
---|
567 |
|
---|
568 | void i_getLogFolder(Utf8Str &aLogFolder);
|
---|
569 | Utf8Str i_getLogFilename(ULONG idx);
|
---|
570 | Utf8Str i_getHardeningLogFilename(void);
|
---|
571 | Utf8Str i_getDefaultNVRAMFilename();
|
---|
572 | Utf8Str i_getSnapshotNVRAMFilename();
|
---|
573 | SettingsVersion_T i_getSettingsVersion(void);
|
---|
574 |
|
---|
575 | void i_composeSavedStateFilename(Utf8Str &strStateFilePath);
|
---|
576 |
|
---|
577 | bool i_isUSBControllerPresent();
|
---|
578 |
|
---|
579 | HRESULT i_launchVMProcess(IInternalSessionControl *aControl,
|
---|
580 | const Utf8Str &strType,
|
---|
581 | const std::vector<com::Utf8Str> &aEnvironmentChanges,
|
---|
582 | ProgressProxy *aProgress);
|
---|
583 |
|
---|
584 | HRESULT i_getDirectControl(ComPtr<IInternalSessionControl> *directControl)
|
---|
585 | {
|
---|
586 | HRESULT rc;
|
---|
587 | *directControl = mData->mSession.mDirectControl;
|
---|
588 |
|
---|
589 | if (!*directControl)
|
---|
590 | rc = E_ACCESSDENIED;
|
---|
591 | else
|
---|
592 | rc = S_OK;
|
---|
593 |
|
---|
594 | return rc;
|
---|
595 | }
|
---|
596 |
|
---|
597 | bool i_isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
|
---|
598 | ComPtr<IInternalSessionControl> *aControl = NULL,
|
---|
599 | bool aRequireVM = false,
|
---|
600 | bool aAllowClosing = false);
|
---|
601 | bool i_isSessionSpawning();
|
---|
602 |
|
---|
603 | bool i_isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
|
---|
604 | ComPtr<IInternalSessionControl> *aControl = NULL)
|
---|
605 | { return i_isSessionOpen(aMachine, aControl, false /* aRequireVM */, true /* aAllowClosing */); }
|
---|
606 |
|
---|
607 | bool i_isSessionOpenVM(ComObjPtr<SessionMachine> &aMachine,
|
---|
608 | ComPtr<IInternalSessionControl> *aControl = NULL)
|
---|
609 | { return i_isSessionOpen(aMachine, aControl, true /* aRequireVM */, false /* aAllowClosing */); }
|
---|
610 |
|
---|
611 | bool i_checkForSpawnFailure();
|
---|
612 |
|
---|
613 | HRESULT i_prepareRegister();
|
---|
614 |
|
---|
615 | HRESULT i_getSharedFolder(const Utf8Str &aName,
|
---|
616 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
617 | bool aSetError = false)
|
---|
618 | {
|
---|
619 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
620 | return i_findSharedFolder(aName, aSharedFolder, aSetError);
|
---|
621 | }
|
---|
622 |
|
---|
623 | HRESULT i_addStateDependency(StateDependency aDepType = AnyStateDep,
|
---|
624 | MachineState_T *aState = NULL,
|
---|
625 | BOOL *aRegistered = NULL);
|
---|
626 | void i_releaseStateDependency();
|
---|
627 |
|
---|
628 | HRESULT i_getStorageControllerByName(const Utf8Str &aName,
|
---|
629 | ComObjPtr<StorageController> &aStorageController,
|
---|
630 | bool aSetError = false);
|
---|
631 |
|
---|
632 | HRESULT i_getMediumAttachmentsOfController(const Utf8Str &aName,
|
---|
633 | MediumAttachmentList &aAttachments);
|
---|
634 |
|
---|
635 | HRESULT i_getUSBControllerByName(const Utf8Str &aName,
|
---|
636 | ComObjPtr<USBController> &aUSBController,
|
---|
637 | bool aSetError = false);
|
---|
638 |
|
---|
639 | HRESULT i_getBandwidthGroup(const Utf8Str &strBandwidthGroup,
|
---|
640 | ComObjPtr<BandwidthGroup> &pBandwidthGroup,
|
---|
641 | bool fSetError = false)
|
---|
642 | {
|
---|
643 | return mBandwidthControl->i_getBandwidthGroupByName(strBandwidthGroup,
|
---|
644 | pBandwidthGroup,
|
---|
645 | fSetError);
|
---|
646 | }
|
---|
647 |
|
---|
648 | static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcszMsg, ...);
|
---|
649 |
|
---|
650 | protected:
|
---|
651 |
|
---|
652 | class ClientToken;
|
---|
653 |
|
---|
654 | HRESULT i_checkStateDependency(StateDependency aDepType);
|
---|
655 |
|
---|
656 | Machine *i_getMachine();
|
---|
657 |
|
---|
658 | void i_ensureNoStateDependencies(AutoWriteLock &alock);
|
---|
659 |
|
---|
660 | virtual HRESULT i_setMachineState(MachineState_T aMachineState);
|
---|
661 |
|
---|
662 | HRESULT i_findSharedFolder(const Utf8Str &aName,
|
---|
663 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
664 | bool aSetError = false);
|
---|
665 |
|
---|
666 | HRESULT i_loadSettings(bool aRegistered);
|
---|
667 | HRESULT i_loadMachineDataFromSettings(const settings::MachineConfigFile &config,
|
---|
668 | const Guid *puuidRegistry);
|
---|
669 | HRESULT i_loadSnapshot(const settings::Snapshot &data,
|
---|
670 | const Guid &aCurSnapshotId);
|
---|
671 | HRESULT i_loadHardware(const Guid *puuidRegistry,
|
---|
672 | const Guid *puuidSnapshot,
|
---|
673 | const settings::Hardware &data,
|
---|
674 | const settings::Debugging *pDbg,
|
---|
675 | const settings::Autostart *pAutostart);
|
---|
676 | HRESULT i_loadDebugging(const settings::Debugging *pDbg);
|
---|
677 | HRESULT i_loadAutostart(const settings::Autostart *pAutostart);
|
---|
678 | HRESULT i_loadStorageControllers(const settings::Storage &data,
|
---|
679 | const Guid *puuidRegistry,
|
---|
680 | const Guid *puuidSnapshot);
|
---|
681 | HRESULT i_loadStorageDevices(StorageController *aStorageController,
|
---|
682 | const settings::StorageController &data,
|
---|
683 | const Guid *puuidRegistry,
|
---|
684 | const Guid *puuidSnapshot);
|
---|
685 |
|
---|
686 | HRESULT i_findSnapshotById(const Guid &aId,
|
---|
687 | ComObjPtr<Snapshot> &aSnapshot,
|
---|
688 | bool aSetError = false);
|
---|
689 | HRESULT i_findSnapshotByName(const Utf8Str &strName,
|
---|
690 | ComObjPtr<Snapshot> &aSnapshot,
|
---|
691 | bool aSetError = false);
|
---|
692 |
|
---|
693 | ULONG i_getUSBControllerCountByType(USBControllerType_T enmType);
|
---|
694 |
|
---|
695 | enum
|
---|
696 | {
|
---|
697 | /* flags for #saveSettings() */
|
---|
698 | SaveS_ResetCurStateModified = 0x01,
|
---|
699 | SaveS_Force = 0x04,
|
---|
700 | /* flags for #saveStateSettings() */
|
---|
701 | SaveSTS_CurStateModified = 0x20,
|
---|
702 | SaveSTS_StateFilePath = 0x40,
|
---|
703 | SaveSTS_StateTimeStamp = 0x80
|
---|
704 | };
|
---|
705 |
|
---|
706 | HRESULT i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings,
|
---|
707 | bool *pfSettingsFileIsNew);
|
---|
708 | HRESULT i_saveSettings(bool *pfNeedsGlobalSaveSettings, AutoWriteLock &alock, int aFlags = 0);
|
---|
709 |
|
---|
710 | void i_copyMachineDataToSettings(settings::MachineConfigFile &config);
|
---|
711 | HRESULT i_saveAllSnapshots(settings::MachineConfigFile &config);
|
---|
712 | HRESULT i_saveHardware(settings::Hardware &data, settings::Debugging *pDbg,
|
---|
713 | settings::Autostart *pAutostart);
|
---|
714 | HRESULT i_saveStorageControllers(settings::Storage &data);
|
---|
715 | HRESULT i_saveStorageDevices(ComObjPtr<StorageController> aStorageController,
|
---|
716 | settings::StorageController &data);
|
---|
717 | HRESULT i_saveStateSettings(int aFlags);
|
---|
718 |
|
---|
719 | void i_addMediumToRegistry(ComObjPtr<Medium> &pMedium);
|
---|
720 |
|
---|
721 | HRESULT i_createImplicitDiffs(IProgress *aProgress,
|
---|
722 | ULONG aWeight,
|
---|
723 | bool aOnline);
|
---|
724 | HRESULT i_deleteImplicitDiffs(bool aOnline);
|
---|
725 |
|
---|
726 | MediumAttachment* i_findAttachment(const MediumAttachmentList &ll,
|
---|
727 | const Utf8Str &aControllerName,
|
---|
728 | LONG aControllerPort,
|
---|
729 | LONG aDevice);
|
---|
730 | MediumAttachment* i_findAttachment(const MediumAttachmentList &ll,
|
---|
731 | ComObjPtr<Medium> pMedium);
|
---|
732 | MediumAttachment* i_findAttachment(const MediumAttachmentList &ll,
|
---|
733 | Guid &id);
|
---|
734 |
|
---|
735 | HRESULT i_detachDevice(MediumAttachment *pAttach,
|
---|
736 | AutoWriteLock &writeLock,
|
---|
737 | Snapshot *pSnapshot);
|
---|
738 |
|
---|
739 | HRESULT i_detachAllMedia(AutoWriteLock &writeLock,
|
---|
740 | Snapshot *pSnapshot,
|
---|
741 | CleanupMode_T cleanupMode,
|
---|
742 | MediaList &llMedia);
|
---|
743 |
|
---|
744 | void i_commitMedia(bool aOnline = false);
|
---|
745 | void i_rollbackMedia();
|
---|
746 |
|
---|
747 | bool i_isInOwnDir(Utf8Str *aSettingsDir = NULL) const;
|
---|
748 |
|
---|
749 | void i_rollback(bool aNotify);
|
---|
750 | void i_commit();
|
---|
751 | void i_copyFrom(Machine *aThat);
|
---|
752 | bool i_isControllerHotplugCapable(StorageControllerType_T enmCtrlType);
|
---|
753 |
|
---|
754 | Utf8Str i_getExtraData(const Utf8Str &strKey);
|
---|
755 |
|
---|
756 | com::Utf8Str i_controllerNameFromBusType(StorageBus_T aBusType);
|
---|
757 |
|
---|
758 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
759 | HRESULT i_getGuestPropertyFromService(const com::Utf8Str &aName, com::Utf8Str &aValue,
|
---|
760 | LONG64 *aTimestamp, com::Utf8Str &aFlags) const;
|
---|
761 | HRESULT i_setGuestPropertyToService(const com::Utf8Str &aName, const com::Utf8Str &aValue,
|
---|
762 | const com::Utf8Str &aFlags, bool fDelete);
|
---|
763 | HRESULT i_getGuestPropertyFromVM(const com::Utf8Str &aName, com::Utf8Str &aValue,
|
---|
764 | LONG64 *aTimestamp, com::Utf8Str &aFlags) const;
|
---|
765 | HRESULT i_setGuestPropertyToVM(const com::Utf8Str &aName, const com::Utf8Str &aValue,
|
---|
766 | const com::Utf8Str &aFlags, bool fDelete);
|
---|
767 | HRESULT i_enumerateGuestPropertiesInService(const com::Utf8Str &aPatterns,
|
---|
768 | std::vector<com::Utf8Str> &aNames,
|
---|
769 | std::vector<com::Utf8Str> &aValues,
|
---|
770 | std::vector<LONG64> &aTimestamps,
|
---|
771 | std::vector<com::Utf8Str> &aFlags);
|
---|
772 | HRESULT i_enumerateGuestPropertiesOnVM(const com::Utf8Str &aPatterns,
|
---|
773 | std::vector<com::Utf8Str> &aNames,
|
---|
774 | std::vector<com::Utf8Str> &aValues,
|
---|
775 | std::vector<LONG64> &aTimestamps,
|
---|
776 | std::vector<com::Utf8Str> &aFlags);
|
---|
777 |
|
---|
778 | #endif /* VBOX_WITH_GUEST_PROPS */
|
---|
779 |
|
---|
780 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
781 | void i_getDiskList(MediaList &list);
|
---|
782 | void i_registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);
|
---|
783 |
|
---|
784 | pm::CollectorGuest *mCollectorGuest;
|
---|
785 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
786 |
|
---|
787 | Machine * const mPeer;
|
---|
788 |
|
---|
789 | VirtualBox * const mParent;
|
---|
790 |
|
---|
791 | Shareable<Data> mData;
|
---|
792 | Shareable<SSData> mSSData;
|
---|
793 |
|
---|
794 | Backupable<UserData> mUserData;
|
---|
795 | Backupable<HWData> mHWData;
|
---|
796 |
|
---|
797 | /**
|
---|
798 | * Hard disk and other media data.
|
---|
799 | *
|
---|
800 | * The usage policy is the same as for mHWData, but a separate field
|
---|
801 | * is necessary because hard disk data requires different procedures when
|
---|
802 | * taking or deleting snapshots, etc.
|
---|
803 | *
|
---|
804 | * @todo r=klaus change this to a regular list and use the normal way to
|
---|
805 | * handle the settings when creating a session or taking a snapshot.
|
---|
806 | * Same thing applies to mStorageControllers and mUSBControllers.
|
---|
807 | */
|
---|
808 | Backupable<MediumAttachmentList> mMediumAttachments;
|
---|
809 |
|
---|
810 | // the following fields need special backup/rollback/commit handling,
|
---|
811 | // so they cannot be a part of HWData
|
---|
812 |
|
---|
813 | const ComObjPtr<VRDEServer> mVRDEServer;
|
---|
814 | const ComObjPtr<SerialPort> mSerialPorts[SchemaDefs::SerialPortCount];
|
---|
815 | const ComObjPtr<ParallelPort> mParallelPorts[SchemaDefs::ParallelPortCount];
|
---|
816 | const ComObjPtr<AudioAdapter> mAudioAdapter;
|
---|
817 | const ComObjPtr<USBDeviceFilters> mUSBDeviceFilters;
|
---|
818 | const ComObjPtr<BIOSSettings> mBIOSSettings;
|
---|
819 | const ComObjPtr<RecordingSettings> mRecordingSettings;
|
---|
820 | const ComObjPtr<GraphicsAdapter> mGraphicsAdapter;
|
---|
821 | const ComObjPtr<BandwidthControl> mBandwidthControl;
|
---|
822 |
|
---|
823 | const ComObjPtr<TrustedPlatformModule> mTrustedPlatformModule;
|
---|
824 | const ComObjPtr<NvramStore> mNvramStore;
|
---|
825 |
|
---|
826 | typedef std::vector<ComObjPtr<NetworkAdapter> > NetworkAdapterVector;
|
---|
827 | NetworkAdapterVector mNetworkAdapters;
|
---|
828 |
|
---|
829 | typedef std::list<ComObjPtr<StorageController> > StorageControllerList;
|
---|
830 | Backupable<StorageControllerList> mStorageControllers;
|
---|
831 |
|
---|
832 | typedef std::list<ComObjPtr<USBController> > USBControllerList;
|
---|
833 | Backupable<USBControllerList> mUSBControllers;
|
---|
834 |
|
---|
835 | uint64_t uRegistryNeedsSaving;
|
---|
836 |
|
---|
837 | /**
|
---|
838 | * Abstract base class for all Machine or SessionMachine related
|
---|
839 | * asynchronous tasks. This is necessary since RTThreadCreate cannot call
|
---|
840 | * a (non-static) method as its thread function, so instead we have it call
|
---|
841 | * the static Machine::taskHandler, which then calls the handler() method
|
---|
842 | * in here (implemented by the subclasses).
|
---|
843 | */
|
---|
844 | class Task : public ThreadTask
|
---|
845 | {
|
---|
846 | public:
|
---|
847 | Task(Machine *m, Progress *p, const Utf8Str &t)
|
---|
848 | : ThreadTask(t),
|
---|
849 | m_pMachine(m),
|
---|
850 | m_machineCaller(m),
|
---|
851 | m_pProgress(p),
|
---|
852 | m_machineStateBackup(m->mData->mMachineState) // save the current machine state
|
---|
853 | {}
|
---|
854 | virtual ~Task(){}
|
---|
855 |
|
---|
856 | void modifyBackedUpState(MachineState_T s)
|
---|
857 | {
|
---|
858 | *const_cast<MachineState_T *>(&m_machineStateBackup) = s;
|
---|
859 | }
|
---|
860 |
|
---|
861 | ComObjPtr<Machine> m_pMachine;
|
---|
862 | AutoCaller m_machineCaller;
|
---|
863 | ComObjPtr<Progress> m_pProgress;
|
---|
864 | const MachineState_T m_machineStateBackup;
|
---|
865 | };
|
---|
866 |
|
---|
867 | class DeleteConfigTask;
|
---|
868 | void i_deleteConfigHandler(DeleteConfigTask &task);
|
---|
869 |
|
---|
870 | friend class Appliance;
|
---|
871 | friend class RecordingSettings;
|
---|
872 | friend class RecordingScreenSettings;
|
---|
873 | friend class SessionMachine;
|
---|
874 | friend class SnapshotMachine;
|
---|
875 | friend class VirtualBox;
|
---|
876 |
|
---|
877 | friend class MachineCloneVM;
|
---|
878 | friend class MachineMoveVM;
|
---|
879 | private:
|
---|
880 | // wrapped IMachine properties
|
---|
881 | HRESULT getParent(ComPtr<IVirtualBox> &aParent);
|
---|
882 | HRESULT getIcon(std::vector<BYTE> &aIcon);
|
---|
883 | HRESULT setIcon(const std::vector<BYTE> &aIcon);
|
---|
884 | HRESULT getAccessible(BOOL *aAccessible);
|
---|
885 | HRESULT getAccessError(ComPtr<IVirtualBoxErrorInfo> &aAccessError);
|
---|
886 | HRESULT getName(com::Utf8Str &aName);
|
---|
887 | HRESULT setName(const com::Utf8Str &aName);
|
---|
888 | HRESULT getDescription(com::Utf8Str &aDescription);
|
---|
889 | HRESULT setDescription(const com::Utf8Str &aDescription);
|
---|
890 | HRESULT getId(com::Guid &aId);
|
---|
891 | HRESULT getGroups(std::vector<com::Utf8Str> &aGroups);
|
---|
892 | HRESULT setGroups(const std::vector<com::Utf8Str> &aGroups);
|
---|
893 | HRESULT getOSTypeId(com::Utf8Str &aOSTypeId);
|
---|
894 | HRESULT setOSTypeId(const com::Utf8Str &aOSTypeId);
|
---|
895 | HRESULT getHardwareVersion(com::Utf8Str &aHardwareVersion);
|
---|
896 | HRESULT setHardwareVersion(const com::Utf8Str &aHardwareVersion);
|
---|
897 | HRESULT getHardwareUUID(com::Guid &aHardwareUUID);
|
---|
898 | HRESULT setHardwareUUID(const com::Guid &aHardwareUUID);
|
---|
899 | HRESULT getCPUCount(ULONG *aCPUCount);
|
---|
900 | HRESULT setCPUCount(ULONG aCPUCount);
|
---|
901 | HRESULT getCPUHotPlugEnabled(BOOL *aCPUHotPlugEnabled);
|
---|
902 | HRESULT setCPUHotPlugEnabled(BOOL aCPUHotPlugEnabled);
|
---|
903 | HRESULT getCPUExecutionCap(ULONG *aCPUExecutionCap);
|
---|
904 | HRESULT setCPUExecutionCap(ULONG aCPUExecutionCap);
|
---|
905 | HRESULT getCPUIDPortabilityLevel(ULONG *aCPUIDPortabilityLevel);
|
---|
906 | HRESULT setCPUIDPortabilityLevel(ULONG aCPUIDPortabilityLevel);
|
---|
907 | HRESULT getCPUProfile(com::Utf8Str &aCPUProfile);
|
---|
908 | HRESULT setCPUProfile(const com::Utf8Str &aCPUProfile);
|
---|
909 | HRESULT getMemorySize(ULONG *aMemorySize);
|
---|
910 | HRESULT setMemorySize(ULONG aMemorySize);
|
---|
911 | HRESULT getMemoryBalloonSize(ULONG *aMemoryBalloonSize);
|
---|
912 | HRESULT setMemoryBalloonSize(ULONG aMemoryBalloonSize);
|
---|
913 | HRESULT getPageFusionEnabled(BOOL *aPageFusionEnabled);
|
---|
914 | HRESULT setPageFusionEnabled(BOOL aPageFusionEnabled);
|
---|
915 | HRESULT getGraphicsAdapter(ComPtr<IGraphicsAdapter> &aGraphicsAdapter);
|
---|
916 | HRESULT getBIOSSettings(ComPtr<IBIOSSettings> &aBIOSSettings);
|
---|
917 | HRESULT getTrustedPlatformModule(ComPtr<ITrustedPlatformModule> &aTrustedPlatformModule);
|
---|
918 | HRESULT getNonVolatileStore(ComPtr<INvramStore> &aNvramStore);
|
---|
919 | HRESULT getRecordingSettings(ComPtr<IRecordingSettings> &aRecordingSettings);
|
---|
920 | HRESULT getFirmwareType(FirmwareType_T *aFirmwareType);
|
---|
921 | HRESULT setFirmwareType(FirmwareType_T aFirmwareType);
|
---|
922 | HRESULT getPointingHIDType(PointingHIDType_T *aPointingHIDType);
|
---|
923 | HRESULT setPointingHIDType(PointingHIDType_T aPointingHIDType);
|
---|
924 | HRESULT getKeyboardHIDType(KeyboardHIDType_T *aKeyboardHIDType);
|
---|
925 | HRESULT setKeyboardHIDType(KeyboardHIDType_T aKeyboardHIDType);
|
---|
926 | HRESULT getHPETEnabled(BOOL *aHPETEnabled);
|
---|
927 | HRESULT setHPETEnabled(BOOL aHPETEnabled);
|
---|
928 | HRESULT getChipsetType(ChipsetType_T *aChipsetType);
|
---|
929 | HRESULT setChipsetType(ChipsetType_T aChipsetType);
|
---|
930 | HRESULT getIommuType(IommuType_T *aIommuType);
|
---|
931 | HRESULT setIommuType(IommuType_T aIommuType);
|
---|
932 | HRESULT getSnapshotFolder(com::Utf8Str &aSnapshotFolder);
|
---|
933 | HRESULT setSnapshotFolder(const com::Utf8Str &aSnapshotFolder);
|
---|
934 | HRESULT getVRDEServer(ComPtr<IVRDEServer> &aVRDEServer);
|
---|
935 | HRESULT getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled);
|
---|
936 | HRESULT setEmulatedUSBCardReaderEnabled(BOOL aEmulatedUSBCardReaderEnabled);
|
---|
937 | HRESULT getMediumAttachments(std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments);
|
---|
938 | HRESULT getUSBControllers(std::vector<ComPtr<IUSBController> > &aUSBControllers);
|
---|
939 | HRESULT getUSBDeviceFilters(ComPtr<IUSBDeviceFilters> &aUSBDeviceFilters);
|
---|
940 | HRESULT getAudioAdapter(ComPtr<IAudioAdapter> &aAudioAdapter);
|
---|
941 | HRESULT getStorageControllers(std::vector<ComPtr<IStorageController> > &aStorageControllers);
|
---|
942 | HRESULT getSettingsFilePath(com::Utf8Str &aSettingsFilePath);
|
---|
943 | HRESULT getSettingsAuxFilePath(com::Utf8Str &aSettingsAuxFilePath);
|
---|
944 | HRESULT getSettingsModified(BOOL *aSettingsModified);
|
---|
945 | HRESULT getSessionState(SessionState_T *aSessionState);
|
---|
946 | HRESULT getSessionType(SessionType_T *aSessionType);
|
---|
947 | HRESULT getSessionName(com::Utf8Str &aSessionType);
|
---|
948 | HRESULT getSessionPID(ULONG *aSessionPID);
|
---|
949 | HRESULT getState(MachineState_T *aState);
|
---|
950 | HRESULT getLastStateChange(LONG64 *aLastStateChange);
|
---|
951 | HRESULT getStateFilePath(com::Utf8Str &aStateFilePath);
|
---|
952 | HRESULT getLogFolder(com::Utf8Str &aLogFolder);
|
---|
953 | HRESULT getCurrentSnapshot(ComPtr<ISnapshot> &aCurrentSnapshot);
|
---|
954 | HRESULT getSnapshotCount(ULONG *aSnapshotCount);
|
---|
955 | HRESULT getCurrentStateModified(BOOL *aCurrentStateModified);
|
---|
956 | HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
|
---|
957 | HRESULT getClipboardMode(ClipboardMode_T *aClipboardMode);
|
---|
958 | HRESULT setClipboardMode(ClipboardMode_T aClipboardMode);
|
---|
959 | HRESULT getClipboardFileTransfersEnabled(BOOL *aEnabled);
|
---|
960 | HRESULT setClipboardFileTransfersEnabled(BOOL aEnabled);
|
---|
961 | HRESULT getDnDMode(DnDMode_T *aDnDMode);
|
---|
962 | HRESULT setDnDMode(DnDMode_T aDnDMode);
|
---|
963 | HRESULT getTeleporterEnabled(BOOL *aTeleporterEnabled);
|
---|
964 | HRESULT setTeleporterEnabled(BOOL aTeleporterEnabled);
|
---|
965 | HRESULT getTeleporterPort(ULONG *aTeleporterPort);
|
---|
966 | HRESULT setTeleporterPort(ULONG aTeleporterPort);
|
---|
967 | HRESULT getTeleporterAddress(com::Utf8Str &aTeleporterAddress);
|
---|
968 | HRESULT setTeleporterAddress(const com::Utf8Str &aTeleporterAddress);
|
---|
969 | HRESULT getTeleporterPassword(com::Utf8Str &aTeleporterPassword);
|
---|
970 | HRESULT setTeleporterPassword(const com::Utf8Str &aTeleporterPassword);
|
---|
971 | HRESULT getParavirtProvider(ParavirtProvider_T *aParavirtProvider);
|
---|
972 | HRESULT setParavirtProvider(ParavirtProvider_T aParavirtProvider);
|
---|
973 | HRESULT getParavirtDebug(com::Utf8Str &aParavirtDebug);
|
---|
974 | HRESULT setParavirtDebug(const com::Utf8Str &aParavirtDebug);
|
---|
975 | HRESULT getRTCUseUTC(BOOL *aRTCUseUTC);
|
---|
976 | HRESULT setRTCUseUTC(BOOL aRTCUseUTC);
|
---|
977 | HRESULT getIOCacheEnabled(BOOL *aIOCacheEnabled);
|
---|
978 | HRESULT setIOCacheEnabled(BOOL aIOCacheEnabled);
|
---|
979 | HRESULT getIOCacheSize(ULONG *aIOCacheSize);
|
---|
980 | HRESULT setIOCacheSize(ULONG aIOCacheSize);
|
---|
981 | HRESULT getPCIDeviceAssignments(std::vector<ComPtr<IPCIDeviceAttachment> > &aPCIDeviceAssignments);
|
---|
982 | HRESULT getBandwidthControl(ComPtr<IBandwidthControl> &aBandwidthControl);
|
---|
983 | HRESULT getTracingEnabled(BOOL *aTracingEnabled);
|
---|
984 | HRESULT setTracingEnabled(BOOL aTracingEnabled);
|
---|
985 | HRESULT getTracingConfig(com::Utf8Str &aTracingConfig);
|
---|
986 | HRESULT setTracingConfig(const com::Utf8Str &aTracingConfig);
|
---|
987 | HRESULT getAllowTracingToAccessVM(BOOL *aAllowTracingToAccessVM);
|
---|
988 | HRESULT setAllowTracingToAccessVM(BOOL aAllowTracingToAccessVM);
|
---|
989 | HRESULT getAutostartEnabled(BOOL *aAutostartEnabled);
|
---|
990 | HRESULT setAutostartEnabled(BOOL aAutostartEnabled);
|
---|
991 | HRESULT getAutostartDelay(ULONG *aAutostartDelay);
|
---|
992 | HRESULT setAutostartDelay(ULONG aAutostartDelay);
|
---|
993 | HRESULT getAutostopType(AutostopType_T *aAutostopType);
|
---|
994 | HRESULT setAutostopType(AutostopType_T aAutostopType);
|
---|
995 | HRESULT getDefaultFrontend(com::Utf8Str &aDefaultFrontend);
|
---|
996 | HRESULT setDefaultFrontend(const com::Utf8Str &aDefaultFrontend);
|
---|
997 | HRESULT getUSBProxyAvailable(BOOL *aUSBProxyAvailable);
|
---|
998 | HRESULT getVMProcessPriority(VMProcPriority_T *aVMProcessPriority);
|
---|
999 | HRESULT setVMProcessPriority(VMProcPriority_T aVMProcessPriority);
|
---|
1000 | HRESULT getStateKeyId(com::Utf8Str &aKeyId);
|
---|
1001 | HRESULT getStateKeyStore(com::Utf8Str &aKeyStore);
|
---|
1002 | HRESULT getLogKeyId(com::Utf8Str &aKeyId);
|
---|
1003 | HRESULT getLogKeyStore(com::Utf8Str &aKeyStore);
|
---|
1004 |
|
---|
1005 | // wrapped IMachine methods
|
---|
1006 | HRESULT lockMachine(const ComPtr<ISession> &aSession,
|
---|
1007 | LockType_T aLockType);
|
---|
1008 | HRESULT launchVMProcess(const ComPtr<ISession> &aSession,
|
---|
1009 | const com::Utf8Str &aType,
|
---|
1010 | const std::vector<com::Utf8Str> &aEnvironmentChanges,
|
---|
1011 | ComPtr<IProgress> &aProgress);
|
---|
1012 | HRESULT setBootOrder(ULONG aPosition,
|
---|
1013 | DeviceType_T aDevice);
|
---|
1014 | HRESULT getBootOrder(ULONG aPosition,
|
---|
1015 | DeviceType_T *aDevice);
|
---|
1016 | HRESULT attachDevice(const com::Utf8Str &aName,
|
---|
1017 | LONG aControllerPort,
|
---|
1018 | LONG aDevice,
|
---|
1019 | DeviceType_T aType,
|
---|
1020 | const ComPtr<IMedium> &aMedium);
|
---|
1021 | HRESULT attachDeviceWithoutMedium(const com::Utf8Str &aName,
|
---|
1022 | LONG aControllerPort,
|
---|
1023 | LONG aDevice,
|
---|
1024 | DeviceType_T aType);
|
---|
1025 | HRESULT detachDevice(const com::Utf8Str &aName,
|
---|
1026 | LONG aControllerPort,
|
---|
1027 | LONG aDevice);
|
---|
1028 | HRESULT passthroughDevice(const com::Utf8Str &aName,
|
---|
1029 | LONG aControllerPort,
|
---|
1030 | LONG aDevice,
|
---|
1031 | BOOL aPassthrough);
|
---|
1032 | HRESULT temporaryEjectDevice(const com::Utf8Str &aName,
|
---|
1033 | LONG aControllerPort,
|
---|
1034 | LONG aDevice,
|
---|
1035 | BOOL aTemporaryEject);
|
---|
1036 | HRESULT nonRotationalDevice(const com::Utf8Str &aName,
|
---|
1037 | LONG aControllerPort,
|
---|
1038 | LONG aDevice,
|
---|
1039 | BOOL aNonRotational);
|
---|
1040 | HRESULT setAutoDiscardForDevice(const com::Utf8Str &aName,
|
---|
1041 | LONG aControllerPort,
|
---|
1042 | LONG aDevice,
|
---|
1043 | BOOL aDiscard);
|
---|
1044 | HRESULT setHotPluggableForDevice(const com::Utf8Str &aName,
|
---|
1045 | LONG aControllerPort,
|
---|
1046 | LONG aDevice,
|
---|
1047 | BOOL aHotPluggable);
|
---|
1048 | HRESULT setBandwidthGroupForDevice(const com::Utf8Str &aName,
|
---|
1049 | LONG aControllerPort,
|
---|
1050 | LONG aDevice,
|
---|
1051 | const ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
1052 | HRESULT setNoBandwidthGroupForDevice(const com::Utf8Str &aName,
|
---|
1053 | LONG aControllerPort,
|
---|
1054 | LONG aDevice);
|
---|
1055 | HRESULT unmountMedium(const com::Utf8Str &aName,
|
---|
1056 | LONG aControllerPort,
|
---|
1057 | LONG aDevice,
|
---|
1058 | BOOL aForce);
|
---|
1059 | HRESULT mountMedium(const com::Utf8Str &aName,
|
---|
1060 | LONG aControllerPort,
|
---|
1061 | LONG aDevice,
|
---|
1062 | const ComPtr<IMedium> &aMedium,
|
---|
1063 | BOOL aForce);
|
---|
1064 | HRESULT getMedium(const com::Utf8Str &aName,
|
---|
1065 | LONG aControllerPort,
|
---|
1066 | LONG aDevice,
|
---|
1067 | ComPtr<IMedium> &aMedium);
|
---|
1068 | HRESULT getMediumAttachmentsOfController(const com::Utf8Str &aName,
|
---|
1069 | std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments);
|
---|
1070 | HRESULT getMediumAttachment(const com::Utf8Str &aName,
|
---|
1071 | LONG aControllerPort,
|
---|
1072 | LONG aDevice,
|
---|
1073 | ComPtr<IMediumAttachment> &aAttachment);
|
---|
1074 | HRESULT attachHostPCIDevice(LONG aHostAddress,
|
---|
1075 | LONG aDesiredGuestAddress,
|
---|
1076 | BOOL aTryToUnbind);
|
---|
1077 | HRESULT detachHostPCIDevice(LONG aHostAddress);
|
---|
1078 | HRESULT getNetworkAdapter(ULONG aSlot,
|
---|
1079 | ComPtr<INetworkAdapter> &aAdapter);
|
---|
1080 | HRESULT addStorageController(const com::Utf8Str &aName,
|
---|
1081 | StorageBus_T aConnectionType,
|
---|
1082 | ComPtr<IStorageController> &aController);
|
---|
1083 | HRESULT getStorageControllerByName(const com::Utf8Str &aName,
|
---|
1084 | ComPtr<IStorageController> &aStorageController);
|
---|
1085 | HRESULT getStorageControllerByInstance(StorageBus_T aConnectionType,
|
---|
1086 | ULONG aInstance,
|
---|
1087 | ComPtr<IStorageController> &aStorageController);
|
---|
1088 | HRESULT removeStorageController(const com::Utf8Str &aName);
|
---|
1089 | HRESULT setStorageControllerBootable(const com::Utf8Str &aName,
|
---|
1090 | BOOL aBootable);
|
---|
1091 | HRESULT addUSBController(const com::Utf8Str &aName,
|
---|
1092 | USBControllerType_T aType,
|
---|
1093 | ComPtr<IUSBController> &aController);
|
---|
1094 | HRESULT removeUSBController(const com::Utf8Str &aName);
|
---|
1095 | HRESULT getUSBControllerByName(const com::Utf8Str &aName,
|
---|
1096 | ComPtr<IUSBController> &aController);
|
---|
1097 | HRESULT getUSBControllerCountByType(USBControllerType_T aType,
|
---|
1098 | ULONG *aControllers);
|
---|
1099 | HRESULT getSerialPort(ULONG aSlot,
|
---|
1100 | ComPtr<ISerialPort> &aPort);
|
---|
1101 | HRESULT getParallelPort(ULONG aSlot,
|
---|
1102 | ComPtr<IParallelPort> &aPort);
|
---|
1103 | HRESULT getExtraDataKeys(std::vector<com::Utf8Str> &aKeys);
|
---|
1104 | HRESULT getExtraData(const com::Utf8Str &aKey,
|
---|
1105 | com::Utf8Str &aValue);
|
---|
1106 | HRESULT setExtraData(const com::Utf8Str &aKey,
|
---|
1107 | const com::Utf8Str &aValue);
|
---|
1108 | HRESULT getCPUProperty(CPUPropertyType_T aProperty,
|
---|
1109 | BOOL *aValue);
|
---|
1110 | HRESULT setCPUProperty(CPUPropertyType_T aProperty,
|
---|
1111 | BOOL aValue);
|
---|
1112 | HRESULT getCPUIDLeafByOrdinal(ULONG aOrdinal,
|
---|
1113 | ULONG *aIdx,
|
---|
1114 | ULONG *aSubIdx,
|
---|
1115 | ULONG *aValEax,
|
---|
1116 | ULONG *aValEbx,
|
---|
1117 | ULONG *aValEcx,
|
---|
1118 | ULONG *aValEdx);
|
---|
1119 | HRESULT getCPUIDLeaf(ULONG aIdx, ULONG aSubIdx,
|
---|
1120 | ULONG *aValEax,
|
---|
1121 | ULONG *aValEbx,
|
---|
1122 | ULONG *aValEcx,
|
---|
1123 | ULONG *aValEdx);
|
---|
1124 | HRESULT setCPUIDLeaf(ULONG aIdx, ULONG aSubIdx,
|
---|
1125 | ULONG aValEax,
|
---|
1126 | ULONG aValEbx,
|
---|
1127 | ULONG aValEcx,
|
---|
1128 | ULONG aValEdx);
|
---|
1129 | HRESULT removeCPUIDLeaf(ULONG aIdx, ULONG aSubIdx);
|
---|
1130 | HRESULT removeAllCPUIDLeaves();
|
---|
1131 | HRESULT getHWVirtExProperty(HWVirtExPropertyType_T aProperty,
|
---|
1132 | BOOL *aValue);
|
---|
1133 | HRESULT setHWVirtExProperty(HWVirtExPropertyType_T aProperty,
|
---|
1134 | BOOL aValue);
|
---|
1135 | HRESULT setSettingsFilePath(const com::Utf8Str &aSettingsFilePath,
|
---|
1136 | ComPtr<IProgress> &aProgress);
|
---|
1137 | HRESULT saveSettings();
|
---|
1138 | HRESULT discardSettings();
|
---|
1139 | HRESULT unregister(AutoCaller &aAutoCaller,
|
---|
1140 | CleanupMode_T aCleanupMode,
|
---|
1141 | std::vector<ComPtr<IMedium> > &aMedia);
|
---|
1142 | HRESULT deleteConfig(const std::vector<ComPtr<IMedium> > &aMedia,
|
---|
1143 | ComPtr<IProgress> &aProgress);
|
---|
1144 | HRESULT exportTo(const ComPtr<IAppliance> &aAppliance,
|
---|
1145 | const com::Utf8Str &aLocation,
|
---|
1146 | ComPtr<IVirtualSystemDescription> &aDescription);
|
---|
1147 | HRESULT findSnapshot(const com::Utf8Str &aNameOrId,
|
---|
1148 | ComPtr<ISnapshot> &aSnapshot);
|
---|
1149 | HRESULT createSharedFolder(const com::Utf8Str &aName,
|
---|
1150 | const com::Utf8Str &aHostPath,
|
---|
1151 | BOOL aWritable,
|
---|
1152 | BOOL aAutomount,
|
---|
1153 | const com::Utf8Str &aAutoMountPoint);
|
---|
1154 | HRESULT removeSharedFolder(const com::Utf8Str &aName);
|
---|
1155 | HRESULT canShowConsoleWindow(BOOL *aCanShow);
|
---|
1156 | HRESULT showConsoleWindow(LONG64 *aWinId);
|
---|
1157 | HRESULT getGuestProperty(const com::Utf8Str &aName,
|
---|
1158 | com::Utf8Str &aValue,
|
---|
1159 | LONG64 *aTimestamp,
|
---|
1160 | com::Utf8Str &aFlags);
|
---|
1161 | HRESULT getGuestPropertyValue(const com::Utf8Str &aProperty,
|
---|
1162 | com::Utf8Str &aValue);
|
---|
1163 | HRESULT getGuestPropertyTimestamp(const com::Utf8Str &aProperty,
|
---|
1164 | LONG64 *aValue);
|
---|
1165 | HRESULT setGuestProperty(const com::Utf8Str &aProperty,
|
---|
1166 | const com::Utf8Str &aValue,
|
---|
1167 | const com::Utf8Str &aFlags);
|
---|
1168 | HRESULT setGuestPropertyValue(const com::Utf8Str &aProperty,
|
---|
1169 | const com::Utf8Str &aValue);
|
---|
1170 | HRESULT deleteGuestProperty(const com::Utf8Str &aName);
|
---|
1171 | HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns,
|
---|
1172 | std::vector<com::Utf8Str> &aNames,
|
---|
1173 | std::vector<com::Utf8Str> &aValues,
|
---|
1174 | std::vector<LONG64> &aTimestamps,
|
---|
1175 | std::vector<com::Utf8Str> &aFlags);
|
---|
1176 | HRESULT querySavedGuestScreenInfo(ULONG aScreenId,
|
---|
1177 | ULONG *aOriginX,
|
---|
1178 | ULONG *aOriginY,
|
---|
1179 | ULONG *aWidth,
|
---|
1180 | ULONG *aHeight,
|
---|
1181 | BOOL *aEnabled);
|
---|
1182 | HRESULT readSavedThumbnailToArray(ULONG aScreenId,
|
---|
1183 | BitmapFormat_T aBitmapFormat,
|
---|
1184 | ULONG *aWidth,
|
---|
1185 | ULONG *aHeight,
|
---|
1186 | std::vector<BYTE> &aData);
|
---|
1187 | HRESULT querySavedScreenshotInfo(ULONG aScreenId,
|
---|
1188 | ULONG *aWidth,
|
---|
1189 | ULONG *aHeight,
|
---|
1190 | std::vector<BitmapFormat_T> &aBitmapFormats);
|
---|
1191 | HRESULT readSavedScreenshotToArray(ULONG aScreenId,
|
---|
1192 | BitmapFormat_T aBitmapFormat,
|
---|
1193 | ULONG *aWidth,
|
---|
1194 | ULONG *aHeight,
|
---|
1195 | std::vector<BYTE> &aData);
|
---|
1196 |
|
---|
1197 | HRESULT hotPlugCPU(ULONG aCpu);
|
---|
1198 | HRESULT hotUnplugCPU(ULONG aCpu);
|
---|
1199 | HRESULT getCPUStatus(ULONG aCpu,
|
---|
1200 | BOOL *aAttached);
|
---|
1201 | HRESULT getEffectiveParavirtProvider(ParavirtProvider_T *aParavirtProvider);
|
---|
1202 | HRESULT queryLogFilename(ULONG aIdx,
|
---|
1203 | com::Utf8Str &aFilename);
|
---|
1204 | HRESULT readLog(ULONG aIdx,
|
---|
1205 | LONG64 aOffset,
|
---|
1206 | LONG64 aSize,
|
---|
1207 | std::vector<BYTE> &aData);
|
---|
1208 | HRESULT cloneTo(const ComPtr<IMachine> &aTarget,
|
---|
1209 | CloneMode_T aMode,
|
---|
1210 | const std::vector<CloneOptions_T> &aOptions,
|
---|
1211 | ComPtr<IProgress> &aProgress);
|
---|
1212 | HRESULT moveTo(const com::Utf8Str &aTargetPath,
|
---|
1213 | const com::Utf8Str &aType,
|
---|
1214 | ComPtr<IProgress> &aProgress);
|
---|
1215 | HRESULT saveState(ComPtr<IProgress> &aProgress);
|
---|
1216 | HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile);
|
---|
1217 | HRESULT discardSavedState(BOOL aFRemoveFile);
|
---|
1218 | HRESULT takeSnapshot(const com::Utf8Str &aName,
|
---|
1219 | const com::Utf8Str &aDescription,
|
---|
1220 | BOOL aPause,
|
---|
1221 | com::Guid &aId,
|
---|
1222 | ComPtr<IProgress> &aProgress);
|
---|
1223 | HRESULT deleteSnapshot(const com::Guid &aId,
|
---|
1224 | ComPtr<IProgress> &aProgress);
|
---|
1225 | HRESULT deleteSnapshotAndAllChildren(const com::Guid &aId,
|
---|
1226 | ComPtr<IProgress> &aProgress);
|
---|
1227 | HRESULT deleteSnapshotRange(const com::Guid &aStartId,
|
---|
1228 | const com::Guid &aEndId,
|
---|
1229 | ComPtr<IProgress> &aProgress);
|
---|
1230 | HRESULT restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
|
---|
1231 | ComPtr<IProgress> &aProgress);
|
---|
1232 | HRESULT applyDefaults(const com::Utf8Str &aFlags);
|
---|
1233 | HRESULT changeEncryption(const com::Utf8Str &aCurrentPassword,
|
---|
1234 | const com::Utf8Str &aCipher,
|
---|
1235 | const com::Utf8Str &aNewPassword,
|
---|
1236 | const com::Utf8Str &aNewPasswordId,
|
---|
1237 | BOOL aForce,
|
---|
1238 | ComPtr<IProgress> &aProgress);
|
---|
1239 | HRESULT getEncryptionSettings(com::Utf8Str &aCipher,
|
---|
1240 | com::Utf8Str &aPasswordId);
|
---|
1241 | HRESULT checkEncryptionPassword(const com::Utf8Str &aPassword);
|
---|
1242 | HRESULT addEncryptionPassword(const com::Utf8Str &aId,
|
---|
1243 | const com::Utf8Str &aPassword);
|
---|
1244 | HRESULT addEncryptionPasswords(const std::vector<com::Utf8Str> &aIds,
|
---|
1245 | const std::vector<com::Utf8Str> &aPasswords);
|
---|
1246 | HRESULT removeEncryptionPassword(AutoCaller &autoCaller,
|
---|
1247 | const com::Utf8Str &aId);
|
---|
1248 | HRESULT clearAllEncryptionPasswords(AutoCaller &autoCaller);
|
---|
1249 |
|
---|
1250 | // wrapped IInternalMachineControl properties
|
---|
1251 |
|
---|
1252 | // wrapped IInternalMachineControl methods
|
---|
1253 | HRESULT updateState(MachineState_T aState);
|
---|
1254 | HRESULT beginPowerUp(const ComPtr<IProgress> &aProgress);
|
---|
1255 | HRESULT endPowerUp(LONG aResult);
|
---|
1256 | HRESULT beginPoweringDown(ComPtr<IProgress> &aProgress);
|
---|
1257 | HRESULT endPoweringDown(LONG aResult,
|
---|
1258 | const com::Utf8Str &aErrMsg);
|
---|
1259 | HRESULT runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice,
|
---|
1260 | BOOL *aMatched,
|
---|
1261 | ULONG *aMaskedInterfaces);
|
---|
1262 | HRESULT captureUSBDevice(const com::Guid &aId,
|
---|
1263 | const com::Utf8Str &aCaptureFilename);
|
---|
1264 | HRESULT detachUSBDevice(const com::Guid &aId,
|
---|
1265 | BOOL aDone);
|
---|
1266 | HRESULT autoCaptureUSBDevices();
|
---|
1267 | HRESULT detachAllUSBDevices(BOOL aDone);
|
---|
1268 | HRESULT onSessionEnd(const ComPtr<ISession> &aSession,
|
---|
1269 | ComPtr<IProgress> &aProgress);
|
---|
1270 | HRESULT finishOnlineMergeMedium();
|
---|
1271 | HRESULT pullGuestProperties(std::vector<com::Utf8Str> &aNames,
|
---|
1272 | std::vector<com::Utf8Str> &aValues,
|
---|
1273 | std::vector<LONG64> &aTimestamps,
|
---|
1274 | std::vector<com::Utf8Str> &aFlags);
|
---|
1275 | HRESULT pushGuestProperty(const com::Utf8Str &aName,
|
---|
1276 | const com::Utf8Str &aValue,
|
---|
1277 | LONG64 aTimestamp,
|
---|
1278 | const com::Utf8Str &aFlags,
|
---|
1279 | BOOL fWasDeleted);
|
---|
1280 | HRESULT lockMedia();
|
---|
1281 | HRESULT unlockMedia();
|
---|
1282 | HRESULT ejectMedium(const ComPtr<IMediumAttachment> &aAttachment,
|
---|
1283 | ComPtr<IMediumAttachment> &aNewAttachment);
|
---|
1284 | HRESULT reportVmStatistics(ULONG aValidStats,
|
---|
1285 | ULONG aCpuUser,
|
---|
1286 | ULONG aCpuKernel,
|
---|
1287 | ULONG aCpuIdle,
|
---|
1288 | ULONG aMemTotal,
|
---|
1289 | ULONG aMemFree,
|
---|
1290 | ULONG aMemBalloon,
|
---|
1291 | ULONG aMemShared,
|
---|
1292 | ULONG aMemCache,
|
---|
1293 | ULONG aPagedTotal,
|
---|
1294 | ULONG aMemAllocTotal,
|
---|
1295 | ULONG aMemFreeTotal,
|
---|
1296 | ULONG aMemBalloonTotal,
|
---|
1297 | ULONG aMemSharedTotal,
|
---|
1298 | ULONG aVmNetRx,
|
---|
1299 | ULONG aVmNetTx);
|
---|
1300 | HRESULT authenticateExternal(const std::vector<com::Utf8Str> &aAuthParams,
|
---|
1301 | com::Utf8Str &aResult);
|
---|
1302 | };
|
---|
1303 |
|
---|
1304 | // SessionMachine class
|
---|
1305 | ////////////////////////////////////////////////////////////////////////////////
|
---|
1306 |
|
---|
1307 | /**
|
---|
1308 | * @note Notes on locking objects of this class:
|
---|
1309 | * SessionMachine shares some data with the primary Machine instance (pointed
|
---|
1310 | * to by the |mPeer| member). In order to provide data consistency it also
|
---|
1311 | * shares its lock handle. This means that whenever you lock a SessionMachine
|
---|
1312 | * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
|
---|
1313 | * instance is also locked in the same lock mode. Keep it in mind.
|
---|
1314 | */
|
---|
1315 | class ATL_NO_VTABLE SessionMachine :
|
---|
1316 | public Machine
|
---|
1317 | {
|
---|
1318 | public:
|
---|
1319 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SessionMachine, IMachine)
|
---|
1320 |
|
---|
1321 | DECLARE_NOT_AGGREGATABLE(SessionMachine)
|
---|
1322 |
|
---|
1323 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
1324 |
|
---|
1325 | BEGIN_COM_MAP(SessionMachine)
|
---|
1326 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
1327 | COM_INTERFACE_ENTRY(IMachine)
|
---|
1328 | COM_INTERFACE_ENTRY2(IDispatch, IMachine)
|
---|
1329 | COM_INTERFACE_ENTRY(IInternalMachineControl)
|
---|
1330 | VBOX_TWEAK_INTERFACE_ENTRY(IMachine)
|
---|
1331 | END_COM_MAP()
|
---|
1332 |
|
---|
1333 | DECLARE_COMMON_CLASS_METHODS(SessionMachine)
|
---|
1334 |
|
---|
1335 | HRESULT FinalConstruct();
|
---|
1336 | void FinalRelease();
|
---|
1337 |
|
---|
1338 | struct Uninit
|
---|
1339 | {
|
---|
1340 | enum Reason { Unexpected, Abnormal, Normal };
|
---|
1341 | };
|
---|
1342 |
|
---|
1343 | // public initializer/uninitializer for internal purposes only
|
---|
1344 | HRESULT init(Machine *aMachine);
|
---|
1345 | void uninit() { uninit(Uninit::Unexpected); }
|
---|
1346 | void uninit(Uninit::Reason aReason);
|
---|
1347 |
|
---|
1348 |
|
---|
1349 | // util::Lockable interface
|
---|
1350 | RWLockHandle *lockHandle() const;
|
---|
1351 |
|
---|
1352 | // public methods only for internal purposes
|
---|
1353 |
|
---|
1354 | virtual bool i_isSessionMachine() const
|
---|
1355 | {
|
---|
1356 | return true;
|
---|
1357 | }
|
---|
1358 |
|
---|
1359 | #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
|
---|
1360 | bool i_checkForDeath();
|
---|
1361 |
|
---|
1362 | void i_getTokenId(Utf8Str &strTokenId);
|
---|
1363 | #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
|
---|
1364 | IToken *i_getToken();
|
---|
1365 | #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
|
---|
1366 | // getClientToken must be only used by callers who can guarantee that
|
---|
1367 | // the object cannot be deleted in the mean time, i.e. have a caller/lock.
|
---|
1368 | ClientToken *i_getClientToken();
|
---|
1369 |
|
---|
1370 | HRESULT i_onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
|
---|
1371 | HRESULT i_onNATRedirectRuleChanged(ULONG ulSlot, BOOL aNatRuleRemove, const Utf8Str &aRuleName,
|
---|
1372 | NATProtocol_T aProto, const Utf8Str &aHostIp, LONG aHostPort,
|
---|
1373 | const Utf8Str &aGuestIp, LONG aGuestPort) RT_OVERRIDE;
|
---|
1374 | HRESULT i_onStorageControllerChange(const com::Guid &aMachineId, const com::Utf8Str &aControllerName);
|
---|
1375 | HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
|
---|
1376 | HRESULT i_onVMProcessPriorityChange(VMProcPriority_T aPriority);
|
---|
1377 | HRESULT i_onAudioAdapterChange(IAudioAdapter *audioAdapter);
|
---|
1378 | HRESULT i_onSerialPortChange(ISerialPort *serialPort);
|
---|
1379 | HRESULT i_onParallelPortChange(IParallelPort *parallelPort);
|
---|
1380 | HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
|
---|
1381 | HRESULT i_onVRDEServerChange(BOOL aRestart);
|
---|
1382 | HRESULT i_onRecordingChange(BOOL aEnable);
|
---|
1383 | HRESULT i_onUSBControllerChange();
|
---|
1384 | HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice,
|
---|
1385 | IVirtualBoxErrorInfo *aError,
|
---|
1386 | ULONG aMaskedIfs,
|
---|
1387 | const com::Utf8Str &aCaptureFilename);
|
---|
1388 | HRESULT i_onUSBDeviceDetach(IN_BSTR aId,
|
---|
1389 | IVirtualBoxErrorInfo *aError);
|
---|
1390 | HRESULT i_onSharedFolderChange();
|
---|
1391 | HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode);
|
---|
1392 | HRESULT i_onClipboardFileTransferModeChange(BOOL aEnable);
|
---|
1393 | HRESULT i_onDnDModeChange(DnDMode_T aDnDMode);
|
---|
1394 | HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
|
---|
1395 | HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
|
---|
1396 | HRESULT i_onCPUExecutionCapChange(ULONG aCpuExecutionCap);
|
---|
1397 |
|
---|
1398 | bool i_hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
1399 |
|
---|
1400 | HRESULT i_lockMedia();
|
---|
1401 | HRESULT i_unlockMedia();
|
---|
1402 |
|
---|
1403 | HRESULT i_saveStateWithReason(Reason_T aReason, ComPtr<IProgress> &aProgress);
|
---|
1404 |
|
---|
1405 | private:
|
---|
1406 |
|
---|
1407 | // wrapped IInternalMachineControl properties
|
---|
1408 |
|
---|
1409 | // wrapped IInternalMachineControl methods
|
---|
1410 | HRESULT setRemoveSavedStateFile(BOOL aRemove);
|
---|
1411 | HRESULT updateState(MachineState_T aState);
|
---|
1412 | HRESULT beginPowerUp(const ComPtr<IProgress> &aProgress);
|
---|
1413 | HRESULT endPowerUp(LONG aResult);
|
---|
1414 | HRESULT beginPoweringDown(ComPtr<IProgress> &aProgress);
|
---|
1415 | HRESULT endPoweringDown(LONG aResult,
|
---|
1416 | const com::Utf8Str &aErrMsg);
|
---|
1417 | HRESULT runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice,
|
---|
1418 | BOOL *aMatched,
|
---|
1419 | ULONG *aMaskedInterfaces);
|
---|
1420 | HRESULT captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename);
|
---|
1421 | HRESULT detachUSBDevice(const com::Guid &aId,
|
---|
1422 | BOOL aDone);
|
---|
1423 | HRESULT autoCaptureUSBDevices();
|
---|
1424 | HRESULT detachAllUSBDevices(BOOL aDone);
|
---|
1425 | HRESULT onSessionEnd(const ComPtr<ISession> &aSession,
|
---|
1426 | ComPtr<IProgress> &aProgress);
|
---|
1427 | HRESULT finishOnlineMergeMedium();
|
---|
1428 | HRESULT pullGuestProperties(std::vector<com::Utf8Str> &aNames,
|
---|
1429 | std::vector<com::Utf8Str> &aValues,
|
---|
1430 | std::vector<LONG64> &aTimestamps,
|
---|
1431 | std::vector<com::Utf8Str> &aFlags);
|
---|
1432 | HRESULT pushGuestProperty(const com::Utf8Str &aName,
|
---|
1433 | const com::Utf8Str &aValue,
|
---|
1434 | LONG64 aTimestamp,
|
---|
1435 | const com::Utf8Str &aFlags,
|
---|
1436 | BOOL fWasDeleted);
|
---|
1437 | HRESULT lockMedia();
|
---|
1438 | HRESULT unlockMedia();
|
---|
1439 | HRESULT ejectMedium(const ComPtr<IMediumAttachment> &aAttachment,
|
---|
1440 | ComPtr<IMediumAttachment> &aNewAttachment);
|
---|
1441 | HRESULT reportVmStatistics(ULONG aValidStats,
|
---|
1442 | ULONG aCpuUser,
|
---|
1443 | ULONG aCpuKernel,
|
---|
1444 | ULONG aCpuIdle,
|
---|
1445 | ULONG aMemTotal,
|
---|
1446 | ULONG aMemFree,
|
---|
1447 | ULONG aMemBalloon,
|
---|
1448 | ULONG aMemShared,
|
---|
1449 | ULONG aMemCache,
|
---|
1450 | ULONG aPagedTotal,
|
---|
1451 | ULONG aMemAllocTotal,
|
---|
1452 | ULONG aMemFreeTotal,
|
---|
1453 | ULONG aMemBalloonTotal,
|
---|
1454 | ULONG aMemSharedTotal,
|
---|
1455 | ULONG aVmNetRx,
|
---|
1456 | ULONG aVmNetTx);
|
---|
1457 | HRESULT authenticateExternal(const std::vector<com::Utf8Str> &aAuthParams,
|
---|
1458 | com::Utf8Str &aResult);
|
---|
1459 |
|
---|
1460 |
|
---|
1461 | struct ConsoleTaskData
|
---|
1462 | {
|
---|
1463 | ConsoleTaskData()
|
---|
1464 | : mLastState(MachineState_Null),
|
---|
1465 | mDeleteSnapshotInfo(NULL)
|
---|
1466 | { }
|
---|
1467 |
|
---|
1468 | MachineState_T mLastState;
|
---|
1469 | ComObjPtr<Progress> mProgress;
|
---|
1470 |
|
---|
1471 | // used when deleting online snaphshot
|
---|
1472 | void *mDeleteSnapshotInfo;
|
---|
1473 | };
|
---|
1474 |
|
---|
1475 | class SaveStateTask;
|
---|
1476 | class SnapshotTask;
|
---|
1477 | class TakeSnapshotTask;
|
---|
1478 | class DeleteSnapshotTask;
|
---|
1479 | class RestoreSnapshotTask;
|
---|
1480 |
|
---|
1481 | void i_saveStateHandler(SaveStateTask &aTask);
|
---|
1482 |
|
---|
1483 | // Override some functionality for SessionMachine, this is where the
|
---|
1484 | // real action happens (the Machine methods are just dummies).
|
---|
1485 | HRESULT saveState(ComPtr<IProgress> &aProgress);
|
---|
1486 | HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile);
|
---|
1487 | HRESULT discardSavedState(BOOL aFRemoveFile);
|
---|
1488 | HRESULT takeSnapshot(const com::Utf8Str &aName,
|
---|
1489 | const com::Utf8Str &aDescription,
|
---|
1490 | BOOL aPause,
|
---|
1491 | com::Guid &aId,
|
---|
1492 | ComPtr<IProgress> &aProgress);
|
---|
1493 | HRESULT deleteSnapshot(const com::Guid &aId,
|
---|
1494 | ComPtr<IProgress> &aProgress);
|
---|
1495 | HRESULT deleteSnapshotAndAllChildren(const com::Guid &aId,
|
---|
1496 | ComPtr<IProgress> &aProgress);
|
---|
1497 | HRESULT deleteSnapshotRange(const com::Guid &aStartId,
|
---|
1498 | const com::Guid &aEndId,
|
---|
1499 | ComPtr<IProgress> &aProgress);
|
---|
1500 | HRESULT restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
|
---|
1501 | ComPtr<IProgress> &aProgress);
|
---|
1502 |
|
---|
1503 | void i_releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore);
|
---|
1504 |
|
---|
1505 | void i_takeSnapshotHandler(TakeSnapshotTask &aTask);
|
---|
1506 | static void i_takeSnapshotProgressCancelCallback(void *pvUser);
|
---|
1507 | HRESULT i_finishTakingSnapshot(TakeSnapshotTask &aTask, AutoWriteLock &alock, bool aSuccess);
|
---|
1508 | HRESULT i_deleteSnapshot(const com::Guid &aStartId,
|
---|
1509 | const com::Guid &aEndId,
|
---|
1510 | BOOL aDeleteAllChildren,
|
---|
1511 | ComPtr<IProgress> &aProgress);
|
---|
1512 | void i_deleteSnapshotHandler(DeleteSnapshotTask &aTask);
|
---|
1513 | void i_restoreSnapshotHandler(RestoreSnapshotTask &aTask);
|
---|
1514 |
|
---|
1515 | HRESULT i_prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
|
---|
1516 | const Guid &machineId,
|
---|
1517 | const Guid &snapshotId,
|
---|
1518 | bool fOnlineMergePossible,
|
---|
1519 | MediumLockList *aVMMALockList,
|
---|
1520 | ComObjPtr<Medium> &aSource,
|
---|
1521 | ComObjPtr<Medium> &aTarget,
|
---|
1522 | bool &fMergeForward,
|
---|
1523 | ComObjPtr<Medium> &pParentForTarget,
|
---|
1524 | MediumLockList * &aChildrenToReparent,
|
---|
1525 | bool &fNeedOnlineMerge,
|
---|
1526 | MediumLockList * &aMediumLockList,
|
---|
1527 | ComPtr<IToken> &aHDLockToken);
|
---|
1528 | void i_cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
|
---|
1529 | const ComObjPtr<Medium> &aSource,
|
---|
1530 | MediumLockList *aChildrenToReparent,
|
---|
1531 | bool fNeedsOnlineMerge,
|
---|
1532 | MediumLockList *aMediumLockList,
|
---|
1533 | const ComPtr<IToken> &aHDLockToken,
|
---|
1534 | const Guid &aMediumId,
|
---|
1535 | const Guid &aSnapshotId);
|
---|
1536 | HRESULT i_onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
|
---|
1537 | const ComObjPtr<Medium> &aSource,
|
---|
1538 | const ComObjPtr<Medium> &aTarget,
|
---|
1539 | bool fMergeForward,
|
---|
1540 | const ComObjPtr<Medium> &pParentForTarget,
|
---|
1541 | MediumLockList *aChildrenToReparent,
|
---|
1542 | MediumLockList *aMediumLockList,
|
---|
1543 | ComObjPtr<Progress> &aProgress,
|
---|
1544 | bool *pfNeedsMachineSaveSettings);
|
---|
1545 |
|
---|
1546 | HRESULT i_setMachineState(MachineState_T aMachineState);
|
---|
1547 | HRESULT i_updateMachineStateOnClient();
|
---|
1548 |
|
---|
1549 | bool mRemoveSavedState;
|
---|
1550 |
|
---|
1551 | ConsoleTaskData mConsoleTaskData;
|
---|
1552 |
|
---|
1553 | /** client token for this machine */
|
---|
1554 | ClientToken *mClientToken;
|
---|
1555 |
|
---|
1556 | int miNATNetworksStarted;
|
---|
1557 |
|
---|
1558 | AUTHLIBRARYCONTEXT mAuthLibCtx;
|
---|
1559 | };
|
---|
1560 |
|
---|
1561 | // SnapshotMachine class
|
---|
1562 | ////////////////////////////////////////////////////////////////////////////////
|
---|
1563 |
|
---|
1564 | /**
|
---|
1565 | * @note Notes on locking objects of this class:
|
---|
1566 | * SnapshotMachine shares some data with the primary Machine instance (pointed
|
---|
1567 | * to by the |mPeer| member). In order to provide data consistency it also
|
---|
1568 | * shares its lock handle. This means that whenever you lock a SessionMachine
|
---|
1569 | * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
|
---|
1570 | * instance is also locked in the same lock mode. Keep it in mind.
|
---|
1571 | */
|
---|
1572 | class ATL_NO_VTABLE SnapshotMachine :
|
---|
1573 | public Machine
|
---|
1574 | {
|
---|
1575 | public:
|
---|
1576 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SnapshotMachine, IMachine)
|
---|
1577 |
|
---|
1578 | DECLARE_NOT_AGGREGATABLE(SnapshotMachine)
|
---|
1579 |
|
---|
1580 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
1581 |
|
---|
1582 | BEGIN_COM_MAP(SnapshotMachine)
|
---|
1583 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
1584 | COM_INTERFACE_ENTRY(IMachine)
|
---|
1585 | COM_INTERFACE_ENTRY2(IDispatch, IMachine)
|
---|
1586 | VBOX_TWEAK_INTERFACE_ENTRY(IMachine)
|
---|
1587 | END_COM_MAP()
|
---|
1588 |
|
---|
1589 | DECLARE_COMMON_CLASS_METHODS(SnapshotMachine)
|
---|
1590 |
|
---|
1591 | HRESULT FinalConstruct();
|
---|
1592 | void FinalRelease();
|
---|
1593 |
|
---|
1594 | // public initializer/uninitializer for internal purposes only
|
---|
1595 | HRESULT init(SessionMachine *aSessionMachine,
|
---|
1596 | IN_GUID aSnapshotId,
|
---|
1597 | const Utf8Str &aStateFilePath);
|
---|
1598 | HRESULT initFromSettings(Machine *aMachine,
|
---|
1599 | const settings::Hardware &hardware,
|
---|
1600 | const settings::Debugging *pDbg,
|
---|
1601 | const settings::Autostart *pAutostart,
|
---|
1602 | IN_GUID aSnapshotId,
|
---|
1603 | const Utf8Str &aStateFilePath);
|
---|
1604 | void uninit();
|
---|
1605 |
|
---|
1606 | // util::Lockable interface
|
---|
1607 | RWLockHandle *lockHandle() const;
|
---|
1608 |
|
---|
1609 | // public methods only for internal purposes
|
---|
1610 |
|
---|
1611 | virtual bool i_isSnapshotMachine() const
|
---|
1612 | {
|
---|
1613 | return true;
|
---|
1614 | }
|
---|
1615 |
|
---|
1616 | HRESULT i_onSnapshotChange(Snapshot *aSnapshot);
|
---|
1617 |
|
---|
1618 | // unsafe inline public methods for internal purposes only (ensure there is
|
---|
1619 | // a caller and a read lock before calling them!)
|
---|
1620 |
|
---|
1621 | const Guid& i_getSnapshotId() const { return mSnapshotId; }
|
---|
1622 |
|
---|
1623 | private:
|
---|
1624 |
|
---|
1625 | Guid mSnapshotId;
|
---|
1626 | /** This field replaces mPeer for SessionMachine instances, as having
|
---|
1627 | * a peer reference is plain meaningless and causes many subtle problems
|
---|
1628 | * with saving settings and the like. */
|
---|
1629 | Machine * const mMachine;
|
---|
1630 |
|
---|
1631 | friend class Snapshot;
|
---|
1632 | };
|
---|
1633 |
|
---|
1634 | // third party methods that depend on SnapshotMachine definition
|
---|
1635 |
|
---|
1636 | inline const Guid &Machine::i_getSnapshotId() const
|
---|
1637 | {
|
---|
1638 | return (i_isSnapshotMachine())
|
---|
1639 | ? static_cast<const SnapshotMachine*>(this)->i_getSnapshotId()
|
---|
1640 | : Guid::Empty;
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 |
|
---|
1644 | #endif /* !MAIN_INCLUDED_MachineImpl_h */
|
---|
1645 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|