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