1 | /* $Id: MachineImpl.h 52090 2014-07-18 06:37:32Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Implementation of IMachine in VBoxSVC - Header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2014 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 ____H_MACHINEIMPL
|
---|
19 | #define ____H_MACHINEIMPL
|
---|
20 |
|
---|
21 | #include "VirtualBoxBase.h"
|
---|
22 | #include "SnapshotImpl.h"
|
---|
23 | #include "ProgressImpl.h"
|
---|
24 | #include "VRDEServerImpl.h"
|
---|
25 | #include "MediumAttachmentImpl.h"
|
---|
26 | #include "PCIDeviceAttachmentImpl.h"
|
---|
27 | #include "MediumLock.h"
|
---|
28 | #include "NetworkAdapterImpl.h"
|
---|
29 | #include "AudioAdapterImpl.h"
|
---|
30 | #include "SerialPortImpl.h"
|
---|
31 | #include "ParallelPortImpl.h"
|
---|
32 | #include "BIOSSettingsImpl.h"
|
---|
33 | #include "StorageControllerImpl.h" // required for MachineImpl.h to compile on Windows
|
---|
34 | #include "USBControllerImpl.h" // required for MachineImpl.h to compile on Windows
|
---|
35 | #include "BandwidthControlImpl.h"
|
---|
36 | #include "BandwidthGroupImpl.h"
|
---|
37 | #include "VBox/settings.h"
|
---|
38 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
39 | #include "Performance.h"
|
---|
40 | #include "PerformanceImpl.h"
|
---|
41 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
42 |
|
---|
43 | // generated header
|
---|
44 | #include "SchemaDefs.h"
|
---|
45 |
|
---|
46 | #include "VBox/com/ErrorInfo.h"
|
---|
47 |
|
---|
48 | #include <iprt/file.h>
|
---|
49 | #include <iprt/thread.h>
|
---|
50 | #include <iprt/time.h>
|
---|
51 |
|
---|
52 | #include <list>
|
---|
53 | #include <vector>
|
---|
54 |
|
---|
55 | #include "MachineWrap.h"
|
---|
56 |
|
---|
57 | // defines
|
---|
58 | ////////////////////////////////////////////////////////////////////////////////
|
---|
59 |
|
---|
60 | // helper declarations
|
---|
61 | ////////////////////////////////////////////////////////////////////////////////
|
---|
62 |
|
---|
63 | class Progress;
|
---|
64 | class ProgressProxy;
|
---|
65 | class Keyboard;
|
---|
66 | class Mouse;
|
---|
67 | class Display;
|
---|
68 | class MachineDebugger;
|
---|
69 | class USBController;
|
---|
70 | class USBDeviceFilters;
|
---|
71 | class Snapshot;
|
---|
72 | class SharedFolder;
|
---|
73 | class HostUSBDevice;
|
---|
74 | class StorageController;
|
---|
75 |
|
---|
76 | class SessionMachine;
|
---|
77 |
|
---|
78 | namespace settings
|
---|
79 | {
|
---|
80 | class MachineConfigFile;
|
---|
81 | struct Snapshot;
|
---|
82 | struct Hardware;
|
---|
83 | struct Storage;
|
---|
84 | struct StorageController;
|
---|
85 | struct MachineRegistryEntry;
|
---|
86 | }
|
---|
87 |
|
---|
88 | // Machine class
|
---|
89 | ////////////////////////////////////////////////////////////////////////////////
|
---|
90 | //
|
---|
91 | class ATL_NO_VTABLE Machine :
|
---|
92 | public MachineWrap
|
---|
93 | {
|
---|
94 |
|
---|
95 | public:
|
---|
96 |
|
---|
97 | enum StateDependency
|
---|
98 | {
|
---|
99 | AnyStateDep = 0,
|
---|
100 | MutableStateDep,
|
---|
101 | MutableOrSavedStateDep,
|
---|
102 | OfflineStateDep
|
---|
103 | };
|
---|
104 |
|
---|
105 | /**
|
---|
106 | * Internal machine data.
|
---|
107 | *
|
---|
108 | * Only one instance of this data exists per every machine -- it is shared
|
---|
109 | * by the Machine, SessionMachine and all SnapshotMachine instances
|
---|
110 | * associated with the given machine using the util::Shareable template
|
---|
111 | * through the mData variable.
|
---|
112 | *
|
---|
113 | * @note |const| members are persistent during lifetime so can be
|
---|
114 | * accessed without locking.
|
---|
115 | *
|
---|
116 | * @note There is no need to lock anything inside init() or uninit()
|
---|
117 | * methods, because they are always serialized (see AutoCaller).
|
---|
118 | */
|
---|
119 | struct Data
|
---|
120 | {
|
---|
121 | /**
|
---|
122 | * Data structure to hold information about sessions opened for the
|
---|
123 | * given machine.
|
---|
124 | */
|
---|
125 | struct Session
|
---|
126 | {
|
---|
127 | /** Control of the direct session opened by lockMachine() */
|
---|
128 | ComPtr<IInternalSessionControl> mDirectControl;
|
---|
129 |
|
---|
130 | typedef std::list<ComPtr<IInternalSessionControl> > RemoteControlList;
|
---|
131 |
|
---|
132 | /** list of controls of all opened remote sessions */
|
---|
133 | RemoteControlList mRemoteControls;
|
---|
134 |
|
---|
135 | /** launchVMProcess() and OnSessionEnd() progress indicator */
|
---|
136 | ComObjPtr<ProgressProxy> mProgress;
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * PID of the session object that must be passed to openSession()
|
---|
140 | * to finalize the launchVMProcess() request (i.e., PID of the
|
---|
141 | * process created by launchVMProcess())
|
---|
142 | */
|
---|
143 | RTPROCESS mPID;
|
---|
144 |
|
---|
145 | /** Current session state */
|
---|
146 | SessionState_T mState;
|
---|
147 |
|
---|
148 | /** Session type string (for indirect sessions) */
|
---|
149 | Bstr mType;
|
---|
150 |
|
---|
151 | /** Session machine object */
|
---|
152 | ComObjPtr<SessionMachine> mMachine;
|
---|
153 |
|
---|
154 | /** Medium object lock collection. */
|
---|
155 | MediumLockListMap mLockedMedia;
|
---|
156 | };
|
---|
157 |
|
---|
158 | Data();
|
---|
159 | ~Data();
|
---|
160 |
|
---|
161 | const Guid mUuid;
|
---|
162 | BOOL mRegistered;
|
---|
163 |
|
---|
164 | Utf8Str m_strConfigFile;
|
---|
165 | Utf8Str m_strConfigFileFull;
|
---|
166 |
|
---|
167 | // machine settings XML file
|
---|
168 | settings::MachineConfigFile *pMachineConfigFile;
|
---|
169 | uint32_t flModifications;
|
---|
170 | bool m_fAllowStateModification;
|
---|
171 |
|
---|
172 | BOOL mAccessible;
|
---|
173 | com::ErrorInfo mAccessError;
|
---|
174 |
|
---|
175 | MachineState_T mMachineState;
|
---|
176 | RTTIMESPEC mLastStateChange;
|
---|
177 |
|
---|
178 | /* Note: These are guarded by VirtualBoxBase::stateLockHandle() */
|
---|
179 | uint32_t mMachineStateDeps;
|
---|
180 | RTSEMEVENTMULTI mMachineStateDepsSem;
|
---|
181 | uint32_t mMachineStateChangePending;
|
---|
182 |
|
---|
183 | BOOL mCurrentStateModified;
|
---|
184 | /** Guest properties have been modified and need saving since the
|
---|
185 | * machine was started, or there are transient properties which need
|
---|
186 | * deleting and the machine is being shut down. */
|
---|
187 | BOOL mGuestPropertiesModified;
|
---|
188 |
|
---|
189 | Session mSession;
|
---|
190 |
|
---|
191 | ComObjPtr<Snapshot> mFirstSnapshot;
|
---|
192 | ComObjPtr<Snapshot> mCurrentSnapshot;
|
---|
193 |
|
---|
194 | // list of files to delete in Delete(); this list is filled by Unregister()
|
---|
195 | std::list<Utf8Str> llFilesToDelete;
|
---|
196 | };
|
---|
197 |
|
---|
198 | /**
|
---|
199 | * Saved state data.
|
---|
200 | *
|
---|
201 | * It's actually only the state file path string, but it needs to be
|
---|
202 | * separate from Data, because Machine and SessionMachine instances
|
---|
203 | * share it, while SnapshotMachine does not.
|
---|
204 | *
|
---|
205 | * The data variable is |mSSData|.
|
---|
206 | */
|
---|
207 | struct SSData
|
---|
208 | {
|
---|
209 | Utf8Str strStateFilePath;
|
---|
210 | };
|
---|
211 |
|
---|
212 | /**
|
---|
213 | * User changeable machine data.
|
---|
214 | *
|
---|
215 | * This data is common for all machine snapshots, i.e. it is shared
|
---|
216 | * by all SnapshotMachine instances associated with the given machine
|
---|
217 | * using the util::Backupable template through the |mUserData| variable.
|
---|
218 | *
|
---|
219 | * SessionMachine instances can alter this data and discard changes.
|
---|
220 | *
|
---|
221 | * @note There is no need to lock anything inside init() or uninit()
|
---|
222 | * methods, because they are always serialized (see AutoCaller).
|
---|
223 | */
|
---|
224 | struct UserData
|
---|
225 | {
|
---|
226 | settings::MachineUserData s;
|
---|
227 | typedef std::vector<uint8_t> IconBlob;
|
---|
228 | IconBlob mIcon;
|
---|
229 | };
|
---|
230 |
|
---|
231 | /**
|
---|
232 | * Hardware data.
|
---|
233 | *
|
---|
234 | * This data is unique for a machine and for every machine snapshot.
|
---|
235 | * Stored using the util::Backupable template in the |mHWData| variable.
|
---|
236 | *
|
---|
237 | * SessionMachine instances can alter this data and discard changes.
|
---|
238 | */
|
---|
239 | struct HWData
|
---|
240 | {
|
---|
241 | /**
|
---|
242 | * Data structure to hold information about a guest property.
|
---|
243 | */
|
---|
244 | struct GuestProperty {
|
---|
245 | /** Property value */
|
---|
246 | Utf8Str strValue;
|
---|
247 | /** Property timestamp */
|
---|
248 | LONG64 mTimestamp;
|
---|
249 | /** Property flags */
|
---|
250 | ULONG mFlags;
|
---|
251 | };
|
---|
252 |
|
---|
253 | HWData();
|
---|
254 | ~HWData();
|
---|
255 |
|
---|
256 | Bstr mHWVersion;
|
---|
257 | Guid mHardwareUUID; /**< If Null, use mData.mUuid. */
|
---|
258 | ULONG mMemorySize;
|
---|
259 | ULONG mMemoryBalloonSize;
|
---|
260 | BOOL mPageFusionEnabled;
|
---|
261 | GraphicsControllerType_T mGraphicsControllerType;
|
---|
262 | ULONG mVRAMSize;
|
---|
263 | ULONG mVideoCaptureWidth;
|
---|
264 | ULONG mVideoCaptureHeight;
|
---|
265 | ULONG mVideoCaptureRate;
|
---|
266 | ULONG mVideoCaptureFPS;
|
---|
267 | Utf8Str mVideoCaptureFile;
|
---|
268 | BOOL mVideoCaptureEnabled;
|
---|
269 | BOOL maVideoCaptureScreens[SchemaDefs::MaxGuestMonitors];
|
---|
270 | ULONG mMonitorCount;
|
---|
271 | BOOL mHWVirtExEnabled;
|
---|
272 | BOOL mHWVirtExNestedPagingEnabled;
|
---|
273 | BOOL mHWVirtExLargePagesEnabled;
|
---|
274 | BOOL mHWVirtExVPIDEnabled;
|
---|
275 | BOOL mHWVirtExUXEnabled;
|
---|
276 | BOOL mHWVirtExForceEnabled;
|
---|
277 | BOOL mAccelerate2DVideoEnabled;
|
---|
278 | BOOL mPAEEnabled;
|
---|
279 | settings::Hardware::LongModeType mLongMode;
|
---|
280 | BOOL mSyntheticCpu;
|
---|
281 | BOOL mTripleFaultReset;
|
---|
282 | ULONG mCPUCount;
|
---|
283 | BOOL mCPUHotPlugEnabled;
|
---|
284 | ULONG mCpuExecutionCap;
|
---|
285 | BOOL mAccelerate3DEnabled;
|
---|
286 | BOOL mHPETEnabled;
|
---|
287 |
|
---|
288 | BOOL mCPUAttached[SchemaDefs::MaxCPUCount];
|
---|
289 |
|
---|
290 | settings::CpuIdLeaf mCpuIdStdLeafs[11];
|
---|
291 | settings::CpuIdLeaf mCpuIdExtLeafs[11];
|
---|
292 |
|
---|
293 | DeviceType_T mBootOrder[SchemaDefs::MaxBootPosition];
|
---|
294 |
|
---|
295 | typedef std::list<ComObjPtr<SharedFolder> > SharedFolderList;
|
---|
296 | SharedFolderList mSharedFolders;
|
---|
297 |
|
---|
298 | ClipboardMode_T mClipboardMode;
|
---|
299 | DnDMode_T mDnDMode;
|
---|
300 |
|
---|
301 | typedef std::map<Utf8Str, GuestProperty> GuestPropertyMap;
|
---|
302 | GuestPropertyMap mGuestProperties;
|
---|
303 | Utf8Str mGuestPropertyNotificationPatterns;
|
---|
304 |
|
---|
305 | FirmwareType_T mFirmwareType;
|
---|
306 | KeyboardHIDType_T mKeyboardHIDType;
|
---|
307 | PointingHIDType_T mPointingHIDType;
|
---|
308 | ChipsetType_T mChipsetType;
|
---|
309 | ParavirtProvider_T mParavirtProvider;
|
---|
310 | BOOL mEmulatedUSBCardReaderEnabled;
|
---|
311 |
|
---|
312 | BOOL mIOCacheEnabled;
|
---|
313 | ULONG mIOCacheSize;
|
---|
314 |
|
---|
315 | typedef std::list<ComObjPtr<PCIDeviceAttachment> > PCIDeviceAssignmentList;
|
---|
316 | PCIDeviceAssignmentList mPCIDeviceAssignments;
|
---|
317 |
|
---|
318 | settings::Debugging mDebugging;
|
---|
319 | settings::Autostart mAutostart;
|
---|
320 |
|
---|
321 | Utf8Str mDefaultFrontend;
|
---|
322 | };
|
---|
323 |
|
---|
324 | /**
|
---|
325 | * Hard disk and other media data.
|
---|
326 | *
|
---|
327 | * The usage policy is the same as for HWData, but a separate structure
|
---|
328 | * is necessary because hard disk data requires different procedures when
|
---|
329 | * taking or deleting snapshots, etc.
|
---|
330 | *
|
---|
331 | * The data variable is |mMediaData|.
|
---|
332 | */
|
---|
333 | struct MediaData
|
---|
334 | {
|
---|
335 | MediaData();
|
---|
336 | ~MediaData();
|
---|
337 |
|
---|
338 | typedef std::list<ComObjPtr<MediumAttachment> > AttachmentList;
|
---|
339 | AttachmentList mAttachments;
|
---|
340 | };
|
---|
341 |
|
---|
342 | DECLARE_EMPTY_CTOR_DTOR(Machine)
|
---|
343 |
|
---|
344 | HRESULT FinalConstruct();
|
---|
345 | void FinalRelease();
|
---|
346 |
|
---|
347 | // public initializer/uninitializer for internal purposes only:
|
---|
348 |
|
---|
349 | // initializer for creating a new, empty machine
|
---|
350 | HRESULT init(VirtualBox *aParent,
|
---|
351 | const Utf8Str &strConfigFile,
|
---|
352 | const Utf8Str &strName,
|
---|
353 | const StringsList &llGroups,
|
---|
354 | GuestOSType *aOsType,
|
---|
355 | const Guid &aId,
|
---|
356 | bool fForceOverwrite,
|
---|
357 | bool fDirectoryIncludesUUID);
|
---|
358 |
|
---|
359 | // initializer for loading existing machine XML (either registered or not)
|
---|
360 | HRESULT initFromSettings(VirtualBox *aParent,
|
---|
361 | const Utf8Str &strConfigFile,
|
---|
362 | const Guid *aId);
|
---|
363 |
|
---|
364 | // initializer for machine config in memory (OVF import)
|
---|
365 | HRESULT init(VirtualBox *aParent,
|
---|
366 | const Utf8Str &strName,
|
---|
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 | };
|
---|
487 |
|
---|
488 | /**
|
---|
489 | * Returns various information about this machine.
|
---|
490 | *
|
---|
491 | * @note This method doesn't lock this object or check its readiness.
|
---|
492 | * Intended to be used only after doing addCaller() manually and locking it
|
---|
493 | * for reading.
|
---|
494 | */
|
---|
495 | ChipsetType_T i_getChipsetType() const { return mHWData->mChipsetType; }
|
---|
496 | ParavirtProvider_T i_getParavirtProvider() const { return mHWData->mParavirtProvider; }
|
---|
497 |
|
---|
498 | void i_setModified(uint32_t fl, bool fAllowStateModification = true);
|
---|
499 | void i_setModifiedLock(uint32_t fl, bool fAllowStateModification = true);
|
---|
500 |
|
---|
501 | bool i_isStateModificationAllowed() const { return mData->m_fAllowStateModification; }
|
---|
502 | void i_allowStateModification() { mData->m_fAllowStateModification = true; }
|
---|
503 | void i_disallowStateModification() { mData->m_fAllowStateModification = false; }
|
---|
504 |
|
---|
505 | const StringsList &i_getGroups() const { return mUserData->s.llGroups; }
|
---|
506 |
|
---|
507 | // callback handlers
|
---|
508 | virtual HRESULT i_onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; }
|
---|
509 | virtual HRESULT i_onNATRedirectRuleChange(ULONG /* slot */, BOOL /* fRemove */ , IN_BSTR /* name */,
|
---|
510 | NATProtocol_T /* protocol */, IN_BSTR /* host ip */, LONG /* host port */,
|
---|
511 | IN_BSTR /* guest port */, LONG /* guest port */ ) { return S_OK; }
|
---|
512 | virtual HRESULT i_onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; }
|
---|
513 | virtual HRESULT i_onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; }
|
---|
514 | virtual HRESULT i_onVRDEServerChange(BOOL /* aRestart */) { return S_OK; }
|
---|
515 | virtual HRESULT i_onUSBControllerChange() { return S_OK; }
|
---|
516 | virtual HRESULT i_onStorageControllerChange() { return S_OK; }
|
---|
517 | virtual HRESULT i_onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
|
---|
518 | virtual HRESULT i_onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; }
|
---|
519 | virtual HRESULT i_onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
|
---|
520 | virtual HRESULT i_onSharedFolderChange() { return S_OK; }
|
---|
521 | virtual HRESULT i_onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; }
|
---|
522 | virtual HRESULT i_onDnDModeChange(DnDMode_T /* aDnDMode */) { return S_OK; }
|
---|
523 | virtual HRESULT i_onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
|
---|
524 | virtual HRESULT i_onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */,
|
---|
525 | BOOL /* silent */) { return S_OK; }
|
---|
526 | virtual HRESULT i_onVideoCaptureChange() { return S_OK; }
|
---|
527 |
|
---|
528 | HRESULT i_saveRegistryEntry(settings::MachineRegistryEntry &data);
|
---|
529 |
|
---|
530 | int i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
|
---|
531 | void i_copyPathRelativeToMachine(const Utf8Str &strSource, Utf8Str &strTarget);
|
---|
532 |
|
---|
533 | void i_getLogFolder(Utf8Str &aLogFolder);
|
---|
534 | Utf8Str i_queryLogFilename(ULONG idx);
|
---|
535 |
|
---|
536 | void i_composeSavedStateFilename(Utf8Str &strStateFilePath);
|
---|
537 |
|
---|
538 | void i_getDefaultVideoCaptureFile(Utf8Str &strFile);
|
---|
539 |
|
---|
540 | bool i_isUSBControllerPresent();
|
---|
541 |
|
---|
542 | HRESULT i_launchVMProcess(IInternalSessionControl *aControl,
|
---|
543 | const Utf8Str &strType,
|
---|
544 | const Utf8Str &strEnvironment,
|
---|
545 | ProgressProxy *aProgress);
|
---|
546 |
|
---|
547 | HRESULT i_getDirectControl(ComPtr<IInternalSessionControl> *directControl)
|
---|
548 | {
|
---|
549 | HRESULT rc;
|
---|
550 | *directControl = mData->mSession.mDirectControl;
|
---|
551 |
|
---|
552 | if (!*directControl)
|
---|
553 | rc = E_ACCESSDENIED;
|
---|
554 | else
|
---|
555 | rc = S_OK;
|
---|
556 |
|
---|
557 | return rc;
|
---|
558 | }
|
---|
559 |
|
---|
560 | bool i_isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
|
---|
561 | ComPtr<IInternalSessionControl> *aControl = NULL,
|
---|
562 | bool aAllowClosing = false);
|
---|
563 | bool i_isSessionSpawning();
|
---|
564 |
|
---|
565 | bool i_isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
|
---|
566 | ComPtr<IInternalSessionControl> *aControl = NULL)
|
---|
567 | { return i_isSessionOpen(aMachine, aControl, true /* aAllowClosing */); }
|
---|
568 |
|
---|
569 | bool i_checkForSpawnFailure();
|
---|
570 |
|
---|
571 | HRESULT i_prepareRegister();
|
---|
572 |
|
---|
573 | HRESULT i_getSharedFolder(CBSTR aName,
|
---|
574 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
575 | bool aSetError = false)
|
---|
576 | {
|
---|
577 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
578 | return i_findSharedFolder(aName, aSharedFolder, aSetError);
|
---|
579 | }
|
---|
580 |
|
---|
581 | HRESULT i_addStateDependency(StateDependency aDepType = AnyStateDep,
|
---|
582 | MachineState_T *aState = NULL,
|
---|
583 | BOOL *aRegistered = NULL);
|
---|
584 | void i_releaseStateDependency();
|
---|
585 |
|
---|
586 | HRESULT i_getBandwidthGroup(const Utf8Str &strBandwidthGroup,
|
---|
587 | ComObjPtr<BandwidthGroup> &pBandwidthGroup,
|
---|
588 | bool fSetError = false)
|
---|
589 | {
|
---|
590 | return mBandwidthControl->i_getBandwidthGroupByName(strBandwidthGroup,
|
---|
591 | pBandwidthGroup,
|
---|
592 | fSetError);
|
---|
593 | }
|
---|
594 |
|
---|
595 |
|
---|
596 |
|
---|
597 | protected:
|
---|
598 |
|
---|
599 | class ClientToken;
|
---|
600 |
|
---|
601 | HRESULT i_checkStateDependency(StateDependency aDepType);
|
---|
602 |
|
---|
603 | Machine *i_getMachine();
|
---|
604 |
|
---|
605 | void i_ensureNoStateDependencies();
|
---|
606 |
|
---|
607 | virtual HRESULT i_setMachineState(MachineState_T aMachineState);
|
---|
608 |
|
---|
609 | HRESULT i_findSharedFolder(const Utf8Str &aName,
|
---|
610 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
611 | bool aSetError = false);
|
---|
612 |
|
---|
613 | HRESULT i_loadSettings(bool aRegistered);
|
---|
614 | HRESULT i_loadMachineDataFromSettings(const settings::MachineConfigFile &config,
|
---|
615 | const Guid *puuidRegistry);
|
---|
616 | HRESULT i_loadSnapshot(const settings::Snapshot &data,
|
---|
617 | const Guid &aCurSnapshotId,
|
---|
618 | Snapshot *aParentSnapshot);
|
---|
619 | HRESULT i_loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg,
|
---|
620 | const settings::Autostart *pAutostart);
|
---|
621 | HRESULT i_loadDebugging(const settings::Debugging *pDbg);
|
---|
622 | HRESULT i_loadAutostart(const settings::Autostart *pAutostart);
|
---|
623 | HRESULT i_loadStorageControllers(const settings::Storage &data,
|
---|
624 | const Guid *puuidRegistry,
|
---|
625 | const Guid *puuidSnapshot);
|
---|
626 | HRESULT i_loadStorageDevices(StorageController *aStorageController,
|
---|
627 | const settings::StorageController &data,
|
---|
628 | const Guid *puuidRegistry,
|
---|
629 | const Guid *puuidSnapshot);
|
---|
630 |
|
---|
631 | HRESULT i_findSnapshotById(const Guid &aId,
|
---|
632 | ComObjPtr<Snapshot> &aSnapshot,
|
---|
633 | bool aSetError = false);
|
---|
634 | HRESULT i_findSnapshotByName(const Utf8Str &strName,
|
---|
635 | ComObjPtr<Snapshot> &aSnapshot,
|
---|
636 | bool aSetError = false);
|
---|
637 |
|
---|
638 | HRESULT i_getStorageControllerByName(const Utf8Str &aName,
|
---|
639 | ComObjPtr<StorageController> &aStorageController,
|
---|
640 | bool aSetError = false);
|
---|
641 |
|
---|
642 | HRESULT i_getMediumAttachmentsOfController(const Utf8Str &aName,
|
---|
643 | MediaData::AttachmentList &aAttachments);
|
---|
644 |
|
---|
645 | HRESULT i_getUSBControllerByName(const Utf8Str &aName,
|
---|
646 | ComObjPtr<USBController> &aUSBController,
|
---|
647 | bool aSetError = false);
|
---|
648 |
|
---|
649 | ULONG i_getUSBControllerCountByType(USBControllerType_T enmType);
|
---|
650 |
|
---|
651 | enum
|
---|
652 | {
|
---|
653 | /* flags for #saveSettings() */
|
---|
654 | SaveS_ResetCurStateModified = 0x01,
|
---|
655 | SaveS_InformCallbacksAnyway = 0x02,
|
---|
656 | SaveS_Force = 0x04,
|
---|
657 | /* flags for #saveStateSettings() */
|
---|
658 | SaveSTS_CurStateModified = 0x20,
|
---|
659 | SaveSTS_StateFilePath = 0x40,
|
---|
660 | SaveSTS_StateTimeStamp = 0x80
|
---|
661 | };
|
---|
662 |
|
---|
663 | HRESULT i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings);
|
---|
664 | HRESULT i_saveSettings(bool *pfNeedsGlobalSaveSettings, int aFlags = 0);
|
---|
665 |
|
---|
666 | void i_copyMachineDataToSettings(settings::MachineConfigFile &config);
|
---|
667 | HRESULT i_saveAllSnapshots(settings::MachineConfigFile &config);
|
---|
668 | HRESULT i_saveHardware(settings::Hardware &data, settings::Debugging *pDbg,
|
---|
669 | settings::Autostart *pAutostart);
|
---|
670 | HRESULT i_saveStorageControllers(settings::Storage &data);
|
---|
671 | HRESULT i_saveStorageDevices(ComObjPtr<StorageController> aStorageController,
|
---|
672 | settings::StorageController &data);
|
---|
673 | HRESULT i_saveStateSettings(int aFlags);
|
---|
674 |
|
---|
675 | void i_addMediumToRegistry(ComObjPtr<Medium> &pMedium);
|
---|
676 |
|
---|
677 | HRESULT i_createImplicitDiffs(IProgress *aProgress,
|
---|
678 | ULONG aWeight,
|
---|
679 | bool aOnline);
|
---|
680 | HRESULT i_deleteImplicitDiffs(bool aOnline);
|
---|
681 |
|
---|
682 | MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll,
|
---|
683 | IN_BSTR aControllerName,
|
---|
684 | LONG aControllerPort,
|
---|
685 | LONG aDevice);
|
---|
686 | MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll,
|
---|
687 | ComObjPtr<Medium> pMedium);
|
---|
688 | MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll,
|
---|
689 | Guid &id);
|
---|
690 |
|
---|
691 | HRESULT i_detachDevice(MediumAttachment *pAttach,
|
---|
692 | AutoWriteLock &writeLock,
|
---|
693 | Snapshot *pSnapshot);
|
---|
694 |
|
---|
695 | HRESULT i_detachAllMedia(AutoWriteLock &writeLock,
|
---|
696 | Snapshot *pSnapshot,
|
---|
697 | CleanupMode_T cleanupMode,
|
---|
698 | MediaList &llMedia);
|
---|
699 |
|
---|
700 | void i_commitMedia(bool aOnline = false);
|
---|
701 | void i_rollbackMedia();
|
---|
702 |
|
---|
703 | bool i_isInOwnDir(Utf8Str *aSettingsDir = NULL) const;
|
---|
704 |
|
---|
705 | void i_rollback(bool aNotify);
|
---|
706 | void i_commit();
|
---|
707 | void i_copyFrom(Machine *aThat);
|
---|
708 | bool i_isControllerHotplugCapable(StorageControllerType_T enmCtrlType);
|
---|
709 |
|
---|
710 | struct DeleteTask;
|
---|
711 | static DECLCALLBACK(int) deleteThread(RTTHREAD Thread, void *pvUser);
|
---|
712 | HRESULT i_deleteTaskWorker(DeleteTask &task);
|
---|
713 | Utf8Str i_getExtraData(const Utf8Str &strKey);
|
---|
714 |
|
---|
715 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
716 | HRESULT i_getGuestPropertyFromService(const com::Utf8Str &aName, com::Utf8Str &aValue,
|
---|
717 | LONG64 *aTimestamp, com::Utf8Str &aFlags) const;
|
---|
718 | HRESULT i_setGuestPropertyToService(const com::Utf8Str &aName, const com::Utf8Str &aValue,
|
---|
719 | const com::Utf8Str &aFlags);
|
---|
720 | HRESULT i_getGuestPropertyFromVM(const com::Utf8Str &aName, com::Utf8Str &aValue,
|
---|
721 | LONG64 *aTimestamp, com::Utf8Str &aFlags) const;
|
---|
722 | HRESULT i_setGuestPropertyToVM(const com::Utf8Str &aName, const com::Utf8Str &aValue,
|
---|
723 | const com::Utf8Str &aFlags);
|
---|
724 | HRESULT i_enumerateGuestPropertiesInService(const com::Utf8Str &aPatterns,
|
---|
725 | std::vector<com::Utf8Str> &aNames,
|
---|
726 | std::vector<com::Utf8Str> &aValues,
|
---|
727 | std::vector<LONG64> &aTimestamps,
|
---|
728 | std::vector<com::Utf8Str> &aFlags);
|
---|
729 | HRESULT i_enumerateGuestPropertiesOnVM(const com::Utf8Str &aPatterns,
|
---|
730 | std::vector<com::Utf8Str> &aNames,
|
---|
731 | std::vector<com::Utf8Str> &aValues,
|
---|
732 | std::vector<LONG64> &aTimestamps,
|
---|
733 | std::vector<com::Utf8Str> &aFlags);
|
---|
734 |
|
---|
735 | #endif /* VBOX_WITH_GUEST_PROPS */
|
---|
736 |
|
---|
737 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
738 | void i_getDiskList(MediaList &list);
|
---|
739 | void i_registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);
|
---|
740 |
|
---|
741 | pm::CollectorGuest *mCollectorGuest;
|
---|
742 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
743 |
|
---|
744 | Machine * const mPeer;
|
---|
745 |
|
---|
746 | VirtualBox * const mParent;
|
---|
747 |
|
---|
748 | Shareable<Data> mData;
|
---|
749 | Shareable<SSData> mSSData;
|
---|
750 |
|
---|
751 | Backupable<UserData> mUserData;
|
---|
752 | Backupable<HWData> mHWData;
|
---|
753 | Backupable<MediaData> mMediaData;
|
---|
754 |
|
---|
755 | // the following fields need special backup/rollback/commit handling,
|
---|
756 | // so they cannot be a part of HWData
|
---|
757 |
|
---|
758 | const ComObjPtr<VRDEServer> mVRDEServer;
|
---|
759 | const ComObjPtr<SerialPort> mSerialPorts[SchemaDefs::SerialPortCount];
|
---|
760 | const ComObjPtr<ParallelPort> mParallelPorts[SchemaDefs::ParallelPortCount];
|
---|
761 | const ComObjPtr<AudioAdapter> mAudioAdapter;
|
---|
762 | const ComObjPtr<USBDeviceFilters> mUSBDeviceFilters;
|
---|
763 | const ComObjPtr<BIOSSettings> mBIOSSettings;
|
---|
764 | const ComObjPtr<BandwidthControl> mBandwidthControl;
|
---|
765 |
|
---|
766 | typedef std::vector<ComObjPtr<NetworkAdapter> > NetworkAdapterVector;
|
---|
767 | NetworkAdapterVector mNetworkAdapters;
|
---|
768 |
|
---|
769 | typedef std::list<ComObjPtr<StorageController> > StorageControllerList;
|
---|
770 | Backupable<StorageControllerList> mStorageControllers;
|
---|
771 |
|
---|
772 | typedef std::list<ComObjPtr<USBController> > USBControllerList;
|
---|
773 | Backupable<USBControllerList> mUSBControllers;
|
---|
774 |
|
---|
775 | uint64_t uRegistryNeedsSaving;
|
---|
776 |
|
---|
777 | friend class SessionMachine;
|
---|
778 | friend class SnapshotMachine;
|
---|
779 | friend class Appliance;
|
---|
780 | friend class VirtualBox;
|
---|
781 |
|
---|
782 | friend class MachineCloneVM;
|
---|
783 |
|
---|
784 | private:
|
---|
785 | // wrapped IMachine properties
|
---|
786 | HRESULT getParent(ComPtr<IVirtualBox> &aParent);
|
---|
787 | HRESULT getIcon(std::vector<BYTE> &aIcon);
|
---|
788 | HRESULT setIcon(const std::vector<BYTE> &aIcon);
|
---|
789 | HRESULT getAccessible(BOOL *aAccessible);
|
---|
790 | HRESULT getAccessError(ComPtr<IVirtualBoxErrorInfo> &aAccessError);
|
---|
791 | HRESULT getName(com::Utf8Str &aName);
|
---|
792 | HRESULT setName(const com::Utf8Str &aName);
|
---|
793 | HRESULT getDescription(com::Utf8Str &aDescription);
|
---|
794 | HRESULT setDescription(const com::Utf8Str &aDescription);
|
---|
795 | HRESULT getId(com::Guid &aId);
|
---|
796 | HRESULT getGroups(std::vector<com::Utf8Str> &aGroups);
|
---|
797 | HRESULT setGroups(const std::vector<com::Utf8Str> &aGroups);
|
---|
798 | HRESULT getOSTypeId(com::Utf8Str &aOSTypeId);
|
---|
799 | HRESULT setOSTypeId(const com::Utf8Str &aOSTypeId);
|
---|
800 | HRESULT getHardwareVersion(com::Utf8Str &aHardwareVersion);
|
---|
801 | HRESULT setHardwareVersion(const com::Utf8Str &aHardwareVersion);
|
---|
802 | HRESULT getHardwareUUID(com::Guid &aHardwareUUID);
|
---|
803 | HRESULT setHardwareUUID(const com::Guid &aHardwareUUID);
|
---|
804 | HRESULT getCPUCount(ULONG *aCPUCount);
|
---|
805 | HRESULT setCPUCount(ULONG aCPUCount);
|
---|
806 | HRESULT getCPUHotPlugEnabled(BOOL *aCPUHotPlugEnabled);
|
---|
807 | HRESULT setCPUHotPlugEnabled(BOOL aCPUHotPlugEnabled);
|
---|
808 | HRESULT getCPUExecutionCap(ULONG *aCPUExecutionCap);
|
---|
809 | HRESULT setCPUExecutionCap(ULONG aCPUExecutionCap);
|
---|
810 | HRESULT getMemorySize(ULONG *aMemorySize);
|
---|
811 | HRESULT setMemorySize(ULONG aMemorySize);
|
---|
812 | HRESULT getMemoryBalloonSize(ULONG *aMemoryBalloonSize);
|
---|
813 | HRESULT setMemoryBalloonSize(ULONG aMemoryBalloonSize);
|
---|
814 | HRESULT getPageFusionEnabled(BOOL *aPageFusionEnabled);
|
---|
815 | HRESULT setPageFusionEnabled(BOOL aPageFusionEnabled);
|
---|
816 | HRESULT getGraphicsControllerType(GraphicsControllerType_T *aGraphicsControllerType);
|
---|
817 | HRESULT setGraphicsControllerType(GraphicsControllerType_T aGraphicsControllerType);
|
---|
818 | HRESULT getVRAMSize(ULONG *aVRAMSize);
|
---|
819 | HRESULT setVRAMSize(ULONG aVRAMSize);
|
---|
820 | HRESULT getAccelerate3DEnabled(BOOL *aAccelerate3DEnabled);
|
---|
821 | HRESULT setAccelerate3DEnabled(BOOL aAccelerate3DEnabled);
|
---|
822 | HRESULT getAccelerate2DVideoEnabled(BOOL *aAccelerate2DVideoEnabled);
|
---|
823 | HRESULT setAccelerate2DVideoEnabled(BOOL aAccelerate2DVideoEnabled);
|
---|
824 | HRESULT getMonitorCount(ULONG *aMonitorCount);
|
---|
825 | HRESULT setMonitorCount(ULONG aMonitorCount);
|
---|
826 | HRESULT getVideoCaptureEnabled(BOOL *aVideoCaptureEnabled);
|
---|
827 | HRESULT setVideoCaptureEnabled(BOOL aVideoCaptureEnabled);
|
---|
828 | HRESULT getVideoCaptureScreens(std::vector<BOOL> &aVideoCaptureScreens);
|
---|
829 | HRESULT setVideoCaptureScreens(const std::vector<BOOL> &aVideoCaptureScreens);
|
---|
830 | HRESULT getVideoCaptureFile(com::Utf8Str &aVideoCaptureFile);
|
---|
831 | HRESULT setVideoCaptureFile(const com::Utf8Str &aVideoCaptureFile);
|
---|
832 | HRESULT getVideoCaptureWidth(ULONG *aVideoCaptureWidth);
|
---|
833 | HRESULT setVideoCaptureWidth(ULONG aVideoCaptureWidth);
|
---|
834 | HRESULT getVideoCaptureHeight(ULONG *aVideoCaptureHeight);
|
---|
835 | HRESULT setVideoCaptureHeight(ULONG aVideoCaptureHeight);
|
---|
836 | HRESULT getVideoCaptureRate(ULONG *aVideoCaptureRate);
|
---|
837 | HRESULT setVideoCaptureRate(ULONG aVideoCaptureRate);
|
---|
838 | HRESULT getVideoCaptureFPS(ULONG *aVideoCaptureFPS);
|
---|
839 | HRESULT setVideoCaptureFPS(ULONG aVideoCaptureFPS);
|
---|
840 | HRESULT getBIOSSettings(ComPtr<IBIOSSettings> &aBIOSSettings);
|
---|
841 | HRESULT getFirmwareType(FirmwareType_T *aFirmwareType);
|
---|
842 | HRESULT setFirmwareType(FirmwareType_T aFirmwareType);
|
---|
843 | HRESULT getPointingHIDType(PointingHIDType_T *aPointingHIDType);
|
---|
844 | HRESULT setPointingHIDType(PointingHIDType_T aPointingHIDType);
|
---|
845 | HRESULT getKeyboardHIDType(KeyboardHIDType_T *aKeyboardHIDType);
|
---|
846 | HRESULT setKeyboardHIDType(KeyboardHIDType_T aKeyboardHIDType);
|
---|
847 | HRESULT getHPETEnabled(BOOL *aHPETEnabled);
|
---|
848 | HRESULT setHPETEnabled(BOOL aHPETEnabled);
|
---|
849 | HRESULT getChipsetType(ChipsetType_T *aChipsetType);
|
---|
850 | HRESULT setChipsetType(ChipsetType_T aChipsetType);
|
---|
851 | HRESULT getSnapshotFolder(com::Utf8Str &aSnapshotFolder);
|
---|
852 | HRESULT setSnapshotFolder(const com::Utf8Str &aSnapshotFolder);
|
---|
853 | HRESULT getVRDEServer(ComPtr<IVRDEServer> &aVRDEServer);
|
---|
854 | HRESULT getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled);
|
---|
855 | HRESULT setEmulatedUSBCardReaderEnabled(BOOL aEmulatedUSBCardReaderEnabled);
|
---|
856 | HRESULT getMediumAttachments(std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments);
|
---|
857 | HRESULT getUSBControllers(std::vector<ComPtr<IUSBController> > &aUSBControllers);
|
---|
858 | HRESULT getUSBDeviceFilters(ComPtr<IUSBDeviceFilters> &aUSBDeviceFilters);
|
---|
859 | HRESULT getAudioAdapter(ComPtr<IAudioAdapter> &aAudioAdapter);
|
---|
860 | HRESULT getStorageControllers(std::vector<ComPtr<IStorageController> > &aStorageControllers);
|
---|
861 | HRESULT getSettingsFilePath(com::Utf8Str &aSettingsFilePath);
|
---|
862 | HRESULT getSettingsModified(BOOL *aSettingsModified);
|
---|
863 | HRESULT getSessionState(SessionState_T *aSessionState);
|
---|
864 | HRESULT getSessionType(com::Utf8Str &aSessionType);
|
---|
865 | HRESULT getSessionPID(ULONG *aSessionPID);
|
---|
866 | HRESULT getState(MachineState_T *aState);
|
---|
867 | HRESULT getLastStateChange(LONG64 *aLastStateChange);
|
---|
868 | HRESULT getStateFilePath(com::Utf8Str &aStateFilePath);
|
---|
869 | HRESULT getLogFolder(com::Utf8Str &aLogFolder);
|
---|
870 | HRESULT getCurrentSnapshot(ComPtr<ISnapshot> &aCurrentSnapshot);
|
---|
871 | HRESULT getSnapshotCount(ULONG *aSnapshotCount);
|
---|
872 | HRESULT getCurrentStateModified(BOOL *aCurrentStateModified);
|
---|
873 | HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
|
---|
874 | HRESULT getClipboardMode(ClipboardMode_T *aClipboardMode);
|
---|
875 | HRESULT setClipboardMode(ClipboardMode_T aClipboardMode);
|
---|
876 | HRESULT getDnDMode(DnDMode_T *aDnDMode);
|
---|
877 | HRESULT setDnDMode(DnDMode_T aDnDMode);
|
---|
878 | HRESULT getGuestPropertyNotificationPatterns(com::Utf8Str &aGuestPropertyNotificationPatterns);
|
---|
879 | HRESULT setGuestPropertyNotificationPatterns(const com::Utf8Str &aGuestPropertyNotificationPatterns);
|
---|
880 | HRESULT getTeleporterEnabled(BOOL *aTeleporterEnabled);
|
---|
881 | HRESULT setTeleporterEnabled(BOOL aTeleporterEnabled);
|
---|
882 | HRESULT getTeleporterPort(ULONG *aTeleporterPort);
|
---|
883 | HRESULT setTeleporterPort(ULONG aTeleporterPort);
|
---|
884 | HRESULT getTeleporterAddress(com::Utf8Str &aTeleporterAddress);
|
---|
885 | HRESULT setTeleporterAddress(const com::Utf8Str &aTeleporterAddress);
|
---|
886 | HRESULT getTeleporterPassword(com::Utf8Str &aTeleporterPassword);
|
---|
887 | HRESULT setTeleporterPassword(const com::Utf8Str &aTeleporterPassword);
|
---|
888 | HRESULT getParavirtProvider(ParavirtProvider_T *aParavirtProvider);
|
---|
889 | HRESULT setParavirtProvider(ParavirtProvider_T aParavirtProvider);
|
---|
890 | HRESULT getFaultToleranceState(FaultToleranceState_T *aFaultToleranceState);
|
---|
891 | HRESULT setFaultToleranceState(FaultToleranceState_T aFaultToleranceState);
|
---|
892 | HRESULT getFaultTolerancePort(ULONG *aFaultTolerancePort);
|
---|
893 | HRESULT setFaultTolerancePort(ULONG aFaultTolerancePort);
|
---|
894 | HRESULT getFaultToleranceAddress(com::Utf8Str &aFaultToleranceAddress);
|
---|
895 | HRESULT setFaultToleranceAddress(const com::Utf8Str &aFaultToleranceAddress);
|
---|
896 | HRESULT getFaultTolerancePassword(com::Utf8Str &aFaultTolerancePassword);
|
---|
897 | HRESULT setFaultTolerancePassword(const com::Utf8Str &aFaultTolerancePassword);
|
---|
898 | HRESULT getFaultToleranceSyncInterval(ULONG *aFaultToleranceSyncInterval);
|
---|
899 | HRESULT setFaultToleranceSyncInterval(ULONG aFaultToleranceSyncInterval);
|
---|
900 | HRESULT getRTCUseUTC(BOOL *aRTCUseUTC);
|
---|
901 | HRESULT setRTCUseUTC(BOOL aRTCUseUTC);
|
---|
902 | HRESULT getIOCacheEnabled(BOOL *aIOCacheEnabled);
|
---|
903 | HRESULT setIOCacheEnabled(BOOL aIOCacheEnabled);
|
---|
904 | HRESULT getIOCacheSize(ULONG *aIOCacheSize);
|
---|
905 | HRESULT setIOCacheSize(ULONG aIOCacheSize);
|
---|
906 | HRESULT getPCIDeviceAssignments(std::vector<ComPtr<IPCIDeviceAttachment> > &aPCIDeviceAssignments);
|
---|
907 | HRESULT getBandwidthControl(ComPtr<IBandwidthControl> &aBandwidthControl);
|
---|
908 | HRESULT getTracingEnabled(BOOL *aTracingEnabled);
|
---|
909 | HRESULT setTracingEnabled(BOOL aTracingEnabled);
|
---|
910 | HRESULT getTracingConfig(com::Utf8Str &aTracingConfig);
|
---|
911 | HRESULT setTracingConfig(const com::Utf8Str &aTracingConfig);
|
---|
912 | HRESULT getAllowTracingToAccessVM(BOOL *aAllowTracingToAccessVM);
|
---|
913 | HRESULT setAllowTracingToAccessVM(BOOL aAllowTracingToAccessVM);
|
---|
914 | HRESULT getAutostartEnabled(BOOL *aAutostartEnabled);
|
---|
915 | HRESULT setAutostartEnabled(BOOL aAutostartEnabled);
|
---|
916 | HRESULT getAutostartDelay(ULONG *aAutostartDelay);
|
---|
917 | HRESULT setAutostartDelay(ULONG aAutostartDelay);
|
---|
918 | HRESULT getAutostopType(AutostopType_T *aAutostopType);
|
---|
919 | HRESULT setAutostopType(AutostopType_T aAutostopType);
|
---|
920 | HRESULT getDefaultFrontend(com::Utf8Str &aDefaultFrontend);
|
---|
921 | HRESULT setDefaultFrontend(const com::Utf8Str &aDefaultFrontend);
|
---|
922 | HRESULT getUSBProxyAvailable(BOOL *aUSBProxyAvailable);
|
---|
923 |
|
---|
924 | // wrapped IMachine methods
|
---|
925 | HRESULT lockMachine(const ComPtr<ISession> &aSession,
|
---|
926 | LockType_T aLockType);
|
---|
927 | HRESULT launchVMProcess(const ComPtr<ISession> &aSession,
|
---|
928 | const com::Utf8Str &aType,
|
---|
929 | const com::Utf8Str &aEnvironment,
|
---|
930 | ComPtr<IProgress> &aProgress);
|
---|
931 | HRESULT setBootOrder(ULONG aPosition,
|
---|
932 | DeviceType_T aDevice);
|
---|
933 | HRESULT getBootOrder(ULONG aPosition,
|
---|
934 | DeviceType_T *aDevice);
|
---|
935 | HRESULT attachDevice(const com::Utf8Str &aName,
|
---|
936 | LONG aControllerPort,
|
---|
937 | LONG aDevice,
|
---|
938 | DeviceType_T aType,
|
---|
939 | const ComPtr<IMedium> &aMedium);
|
---|
940 | HRESULT attachDeviceWithoutMedium(const com::Utf8Str &aName,
|
---|
941 | LONG aControllerPort,
|
---|
942 | LONG aDevice,
|
---|
943 | DeviceType_T aType);
|
---|
944 | HRESULT detachDevice(const com::Utf8Str &aName,
|
---|
945 | LONG aControllerPort,
|
---|
946 | LONG aDevice);
|
---|
947 | HRESULT passthroughDevice(const com::Utf8Str &aName,
|
---|
948 | LONG aControllerPort,
|
---|
949 | LONG aDevice,
|
---|
950 | BOOL aPassthrough);
|
---|
951 | HRESULT temporaryEjectDevice(const com::Utf8Str &aName,
|
---|
952 | LONG aControllerPort,
|
---|
953 | LONG aDevice,
|
---|
954 | BOOL aTemporaryEject);
|
---|
955 | HRESULT nonRotationalDevice(const com::Utf8Str &aName,
|
---|
956 | LONG aControllerPort,
|
---|
957 | LONG aDevice,
|
---|
958 | BOOL aNonRotational);
|
---|
959 | HRESULT setAutoDiscardForDevice(const com::Utf8Str &aName,
|
---|
960 | LONG aControllerPort,
|
---|
961 | LONG aDevice,
|
---|
962 | BOOL aDiscard);
|
---|
963 | HRESULT setHotPluggableForDevice(const com::Utf8Str &aName,
|
---|
964 | LONG aControllerPort,
|
---|
965 | LONG aDevice,
|
---|
966 | BOOL aHotPluggable);
|
---|
967 | HRESULT setBandwidthGroupForDevice(const com::Utf8Str &aName,
|
---|
968 | LONG aControllerPort,
|
---|
969 | LONG aDevice,
|
---|
970 | const ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
971 | HRESULT setNoBandwidthGroupForDevice(const com::Utf8Str &aName,
|
---|
972 | LONG aControllerPort,
|
---|
973 | LONG aDevice);
|
---|
974 | HRESULT unmountMedium(const com::Utf8Str &aName,
|
---|
975 | LONG aControllerPort,
|
---|
976 | LONG aDevice,
|
---|
977 | BOOL aForce);
|
---|
978 | HRESULT mountMedium(const com::Utf8Str &aName,
|
---|
979 | LONG aControllerPort,
|
---|
980 | LONG aDevice,
|
---|
981 | const ComPtr<IMedium> &aMedium,
|
---|
982 | BOOL aForce);
|
---|
983 | HRESULT getMedium(const com::Utf8Str &aName,
|
---|
984 | LONG aControllerPort,
|
---|
985 | LONG aDevice,
|
---|
986 | ComPtr<IMedium> &aMedium);
|
---|
987 | HRESULT getMediumAttachmentsOfController(const com::Utf8Str &aName,
|
---|
988 | std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments);
|
---|
989 | HRESULT getMediumAttachment(const com::Utf8Str &aName,
|
---|
990 | LONG aControllerPort,
|
---|
991 | LONG aDevice,
|
---|
992 | ComPtr<IMediumAttachment> &aAttachment);
|
---|
993 | HRESULT attachHostPCIDevice(LONG aHostAddress,
|
---|
994 | LONG aDesiredGuestAddress,
|
---|
995 | BOOL aTryToUnbind);
|
---|
996 | HRESULT detachHostPCIDevice(LONG aHostAddress);
|
---|
997 | HRESULT getNetworkAdapter(ULONG aSlot,
|
---|
998 | ComPtr<INetworkAdapter> &aAdapter);
|
---|
999 | HRESULT addStorageController(const com::Utf8Str &aName,
|
---|
1000 | StorageBus_T aConnectionType,
|
---|
1001 | ComPtr<IStorageController> &aController);
|
---|
1002 | HRESULT getStorageControllerByName(const com::Utf8Str &aName,
|
---|
1003 | ComPtr<IStorageController> &aStorageController);
|
---|
1004 | HRESULT getStorageControllerByInstance(ULONG aInstance,
|
---|
1005 | ComPtr<IStorageController> &aStorageController);
|
---|
1006 | HRESULT removeStorageController(const com::Utf8Str &aName);
|
---|
1007 | HRESULT setStorageControllerBootable(const com::Utf8Str &aName,
|
---|
1008 | BOOL aBootable);
|
---|
1009 | HRESULT addUSBController(const com::Utf8Str &aName,
|
---|
1010 | USBControllerType_T aType,
|
---|
1011 | ComPtr<IUSBController> &aController);
|
---|
1012 | HRESULT removeUSBController(const com::Utf8Str &aName);
|
---|
1013 | HRESULT getUSBControllerByName(const com::Utf8Str &aName,
|
---|
1014 | ComPtr<IUSBController> &aController);
|
---|
1015 | HRESULT getUSBControllerCountByType(USBControllerType_T aType,
|
---|
1016 | ULONG *aControllers);
|
---|
1017 | HRESULT getSerialPort(ULONG aSlot,
|
---|
1018 | ComPtr<ISerialPort> &aPort);
|
---|
1019 | HRESULT getParallelPort(ULONG aSlot,
|
---|
1020 | ComPtr<IParallelPort> &aPort);
|
---|
1021 | HRESULT getExtraDataKeys(std::vector<com::Utf8Str> &aKeys);
|
---|
1022 | HRESULT getExtraData(const com::Utf8Str &aKey,
|
---|
1023 | com::Utf8Str &aValue);
|
---|
1024 | HRESULT setExtraData(const com::Utf8Str &aKey,
|
---|
1025 | const com::Utf8Str &aValue);
|
---|
1026 | HRESULT getCPUProperty(CPUPropertyType_T aProperty,
|
---|
1027 | BOOL *aValue);
|
---|
1028 | HRESULT setCPUProperty(CPUPropertyType_T aProperty,
|
---|
1029 | BOOL aValue);
|
---|
1030 | HRESULT getCPUIDLeaf(ULONG aId,
|
---|
1031 | ULONG *aValEax,
|
---|
1032 | ULONG *aValEbx,
|
---|
1033 | ULONG *aValEcx,
|
---|
1034 | ULONG *aValEdx);
|
---|
1035 | HRESULT setCPUIDLeaf(ULONG aId,
|
---|
1036 | ULONG aValEax,
|
---|
1037 | ULONG aValEbx,
|
---|
1038 | ULONG aValEcx,
|
---|
1039 | ULONG aValEdx);
|
---|
1040 | HRESULT removeCPUIDLeaf(ULONG aId);
|
---|
1041 | HRESULT removeAllCPUIDLeaves();
|
---|
1042 | HRESULT getHWVirtExProperty(HWVirtExPropertyType_T aProperty,
|
---|
1043 | BOOL *aValue);
|
---|
1044 | HRESULT setHWVirtExProperty(HWVirtExPropertyType_T aProperty,
|
---|
1045 | BOOL aValue);
|
---|
1046 | HRESULT setSettingsFilePath(const com::Utf8Str &aSettingsFilePath,
|
---|
1047 | ComPtr<IProgress> &aProgress);
|
---|
1048 | HRESULT saveSettings();
|
---|
1049 | HRESULT discardSettings();
|
---|
1050 | HRESULT unregister(CleanupMode_T aCleanupMode,
|
---|
1051 | std::vector<ComPtr<IMedium> > &aMedia);
|
---|
1052 | HRESULT deleteConfig(const std::vector<ComPtr<IMedium> > &aMedia,
|
---|
1053 | ComPtr<IProgress> &aProgress);
|
---|
1054 | HRESULT exportTo(const ComPtr<IAppliance> &aAppliance,
|
---|
1055 | const com::Utf8Str &aLocation,
|
---|
1056 | ComPtr<IVirtualSystemDescription> &aDescription);
|
---|
1057 | HRESULT findSnapshot(const com::Utf8Str &aNameOrId,
|
---|
1058 | ComPtr<ISnapshot> &aSnapshot);
|
---|
1059 | HRESULT createSharedFolder(const com::Utf8Str &aName,
|
---|
1060 | const com::Utf8Str &aHostPath,
|
---|
1061 | BOOL aWritable,
|
---|
1062 | BOOL aAutomount);
|
---|
1063 | HRESULT removeSharedFolder(const com::Utf8Str &aName);
|
---|
1064 | HRESULT canShowConsoleWindow(BOOL *aCanShow);
|
---|
1065 | HRESULT showConsoleWindow(LONG64 *aWinId);
|
---|
1066 | HRESULT getGuestProperty(const com::Utf8Str &aName,
|
---|
1067 | com::Utf8Str &aValue,
|
---|
1068 | LONG64 *aTimestamp,
|
---|
1069 | com::Utf8Str &aFlags);
|
---|
1070 | HRESULT getGuestPropertyValue(const com::Utf8Str &aProperty,
|
---|
1071 | com::Utf8Str &aValue);
|
---|
1072 | HRESULT getGuestPropertyTimestamp(const com::Utf8Str &aProperty,
|
---|
1073 | LONG64 *aValue);
|
---|
1074 | HRESULT setGuestProperty(const com::Utf8Str &aProperty,
|
---|
1075 | const com::Utf8Str &aValue,
|
---|
1076 | const com::Utf8Str &aFlags);
|
---|
1077 | HRESULT setGuestPropertyValue(const com::Utf8Str &aProperty,
|
---|
1078 | const com::Utf8Str &aValue);
|
---|
1079 | HRESULT deleteGuestProperty(const com::Utf8Str &aName);
|
---|
1080 | HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns,
|
---|
1081 | std::vector<com::Utf8Str> &aNames,
|
---|
1082 | std::vector<com::Utf8Str> &aValues,
|
---|
1083 | std::vector<LONG64> &aTimestamps,
|
---|
1084 | std::vector<com::Utf8Str> &aFlags);
|
---|
1085 | HRESULT querySavedGuestScreenInfo(ULONG aScreenId,
|
---|
1086 | ULONG *aOriginX,
|
---|
1087 | ULONG *aOriginY,
|
---|
1088 | ULONG *aWidth,
|
---|
1089 | ULONG *aHeight,
|
---|
1090 | BOOL *aEnabled);
|
---|
1091 | HRESULT querySavedThumbnailSize(ULONG aScreenId,
|
---|
1092 | ULONG *aSize,
|
---|
1093 | ULONG *aWidth,
|
---|
1094 | ULONG *aHeight);
|
---|
1095 | HRESULT readSavedThumbnailToArray(ULONG aScreenId,
|
---|
1096 | BOOL aBGR,
|
---|
1097 | ULONG *aWidth,
|
---|
1098 | ULONG *aHeight,
|
---|
1099 | std::vector<BYTE> &aData);
|
---|
1100 | HRESULT readSavedThumbnailPNGToArray(ULONG aScreenId,
|
---|
1101 | ULONG *aWidth,
|
---|
1102 | ULONG *aHeight,
|
---|
1103 | std::vector<BYTE> &aData);
|
---|
1104 | HRESULT querySavedScreenshotPNGSize(ULONG aScreenId,
|
---|
1105 | ULONG *aSize,
|
---|
1106 | ULONG *aWidth,
|
---|
1107 | ULONG *aHeight);
|
---|
1108 | HRESULT readSavedScreenshotPNGToArray(ULONG aScreenId,
|
---|
1109 | ULONG *aWidth,
|
---|
1110 | ULONG *aHeight,
|
---|
1111 | std::vector<BYTE> &aData);
|
---|
1112 | HRESULT hotPlugCPU(ULONG aCpu);
|
---|
1113 | HRESULT hotUnplugCPU(ULONG aCpu);
|
---|
1114 | HRESULT getCPUStatus(ULONG aCpu,
|
---|
1115 | BOOL *aAttached);
|
---|
1116 | HRESULT getEffectiveParavirtProvider(ParavirtProvider_T *aParavirtProvider);
|
---|
1117 | HRESULT queryLogFilename(ULONG aIdx,
|
---|
1118 | com::Utf8Str &aFilename);
|
---|
1119 | HRESULT readLog(ULONG aIdx,
|
---|
1120 | LONG64 aOffset,
|
---|
1121 | LONG64 aSize,
|
---|
1122 | std::vector<BYTE> &aData);
|
---|
1123 | HRESULT cloneTo(const ComPtr<IMachine> &aTarget,
|
---|
1124 | CloneMode_T aMode,
|
---|
1125 | const std::vector<CloneOptions_T> &aOptions,
|
---|
1126 | ComPtr<IProgress> &aProgress);
|
---|
1127 |
|
---|
1128 | // wrapped IInternalMachineControl properties
|
---|
1129 |
|
---|
1130 | // wrapped IInternalMachineControl methods
|
---|
1131 | HRESULT setRemoveSavedStateFile(BOOL aRemove);
|
---|
1132 | HRESULT updateState(MachineState_T aState);
|
---|
1133 | HRESULT beginPowerUp(const ComPtr<IProgress> &aProgress);
|
---|
1134 | HRESULT endPowerUp(LONG aResult);
|
---|
1135 | HRESULT beginPoweringDown(ComPtr<IProgress> &aProgress);
|
---|
1136 | HRESULT endPoweringDown(LONG aResult,
|
---|
1137 | const com::Utf8Str &aErrMsg);
|
---|
1138 | HRESULT runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice,
|
---|
1139 | BOOL *aMatched,
|
---|
1140 | ULONG *aMaskedInterfaces);
|
---|
1141 | HRESULT captureUSBDevice(const com::Guid &aId);
|
---|
1142 | HRESULT detachUSBDevice(const com::Guid &aId,
|
---|
1143 | BOOL aDone);
|
---|
1144 | HRESULT autoCaptureUSBDevices();
|
---|
1145 | HRESULT detachAllUSBDevices(BOOL aDone);
|
---|
1146 | HRESULT onSessionEnd(const ComPtr<ISession> &aSession,
|
---|
1147 | ComPtr<IProgress> &aProgress);
|
---|
1148 | HRESULT beginSavingState(ComPtr<IProgress> &aProgress,
|
---|
1149 | com::Utf8Str &aStateFilePath);
|
---|
1150 | HRESULT endSavingState(LONG aResult,
|
---|
1151 | const com::Utf8Str &aErrMsg);
|
---|
1152 | HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile);
|
---|
1153 | HRESULT beginTakingSnapshot(const ComPtr<IConsole> &aInitiator,
|
---|
1154 | const com::Utf8Str &aName,
|
---|
1155 | const com::Utf8Str &aDescription,
|
---|
1156 | const ComPtr<IProgress> &aConsoleProgress,
|
---|
1157 | BOOL aFTakingSnapshotOnline,
|
---|
1158 | com::Utf8Str &aStateFilePath);
|
---|
1159 | HRESULT endTakingSnapshot(BOOL aSuccess);
|
---|
1160 | HRESULT deleteSnapshot(const ComPtr<IConsole> &aInitiator,
|
---|
1161 | const com::Guid &aStartId,
|
---|
1162 | const com::Guid &aEndId,
|
---|
1163 | BOOL aDeleteAllChildren,
|
---|
1164 | MachineState_T *aMachineState,
|
---|
1165 | ComPtr<IProgress> &aProgress);
|
---|
1166 | HRESULT finishOnlineMergeMedium();
|
---|
1167 | HRESULT restoreSnapshot(const ComPtr<IConsole> &aInitiator,
|
---|
1168 | const ComPtr<ISnapshot> &aSnapshot,
|
---|
1169 | MachineState_T *aMachineState,
|
---|
1170 | ComPtr<IProgress> &aProgress);
|
---|
1171 | HRESULT pullGuestProperties(std::vector<com::Utf8Str> &aNames,
|
---|
1172 | std::vector<com::Utf8Str> &aValues,
|
---|
1173 | std::vector<LONG64> &aTimestamps,
|
---|
1174 | std::vector<com::Utf8Str> &aFlags);
|
---|
1175 | HRESULT pushGuestProperty(const com::Utf8Str &aName,
|
---|
1176 | const com::Utf8Str &aValue,
|
---|
1177 | LONG64 aTimestamp,
|
---|
1178 | const com::Utf8Str &aFlags);
|
---|
1179 | HRESULT lockMedia();
|
---|
1180 | HRESULT unlockMedia();
|
---|
1181 | HRESULT ejectMedium(const ComPtr<IMediumAttachment> &aAttachment,
|
---|
1182 | ComPtr<IMediumAttachment> &aNewAttachment);
|
---|
1183 | HRESULT reportVmStatistics(ULONG aValidStats,
|
---|
1184 | ULONG aCpuUser,
|
---|
1185 | ULONG aCpuKernel,
|
---|
1186 | ULONG aCpuIdle,
|
---|
1187 | ULONG aMemTotal,
|
---|
1188 | ULONG aMemFree,
|
---|
1189 | ULONG aMemBalloon,
|
---|
1190 | ULONG aMemShared,
|
---|
1191 | ULONG aMemCache,
|
---|
1192 | ULONG aPagedTotal,
|
---|
1193 | ULONG aMemAllocTotal,
|
---|
1194 | ULONG aMemFreeTotal,
|
---|
1195 | ULONG aMemBalloonTotal,
|
---|
1196 | ULONG aMemSharedTotal,
|
---|
1197 | ULONG aVmNetRx,
|
---|
1198 | ULONG aVmNetTx);
|
---|
1199 |
|
---|
1200 |
|
---|
1201 |
|
---|
1202 |
|
---|
1203 | };
|
---|
1204 |
|
---|
1205 | // SessionMachine class
|
---|
1206 | ////////////////////////////////////////////////////////////////////////////////
|
---|
1207 |
|
---|
1208 | /**
|
---|
1209 | * @note Notes on locking objects of this class:
|
---|
1210 | * SessionMachine shares some data with the primary Machine instance (pointed
|
---|
1211 | * to by the |mPeer| member). In order to provide data consistency it also
|
---|
1212 | * shares its lock handle. This means that whenever you lock a SessionMachine
|
---|
1213 | * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
|
---|
1214 | * instance is also locked in the same lock mode. Keep it in mind.
|
---|
1215 | */
|
---|
1216 | class ATL_NO_VTABLE SessionMachine :
|
---|
1217 | public Machine
|
---|
1218 | {
|
---|
1219 | public:
|
---|
1220 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SessionMachine, IMachine)
|
---|
1221 |
|
---|
1222 | DECLARE_NOT_AGGREGATABLE(SessionMachine)
|
---|
1223 |
|
---|
1224 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
1225 |
|
---|
1226 | BEGIN_COM_MAP(SessionMachine)
|
---|
1227 | VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
|
---|
1228 | COM_INTERFACE_ENTRY(IInternalMachineControl)
|
---|
1229 | END_COM_MAP()
|
---|
1230 |
|
---|
1231 | DECLARE_EMPTY_CTOR_DTOR(SessionMachine)
|
---|
1232 |
|
---|
1233 | HRESULT FinalConstruct();
|
---|
1234 | void FinalRelease();
|
---|
1235 |
|
---|
1236 | struct Uninit
|
---|
1237 | {
|
---|
1238 | enum Reason { Unexpected, Abnormal, Normal };
|
---|
1239 | };
|
---|
1240 |
|
---|
1241 | // public initializer/uninitializer for internal purposes only
|
---|
1242 | HRESULT init(Machine *aMachine);
|
---|
1243 | void uninit() { uninit(Uninit::Unexpected); }
|
---|
1244 | void uninit(Uninit::Reason aReason);
|
---|
1245 |
|
---|
1246 |
|
---|
1247 | // util::Lockable interface
|
---|
1248 | RWLockHandle *lockHandle() const;
|
---|
1249 |
|
---|
1250 | // IInternalMachineControl methods
|
---|
1251 | STDMETHOD(SetRemoveSavedStateFile)(BOOL aRemove);
|
---|
1252 | STDMETHOD(UpdateState)(MachineState_T machineState);
|
---|
1253 | STDMETHOD(BeginPowerUp)(IProgress *aProgress);
|
---|
1254 | STDMETHOD(EndPowerUp)(LONG iResult);
|
---|
1255 | STDMETHOD(BeginPoweringDown)(IProgress **aProgress);
|
---|
1256 | STDMETHOD(EndPoweringDown)(LONG aResult, IN_BSTR aErrMsg);
|
---|
1257 | STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
|
---|
1258 | STDMETHOD(CaptureUSBDevice)(IN_BSTR aId);
|
---|
1259 | STDMETHOD(DetachUSBDevice)(IN_BSTR aId, BOOL aDone);
|
---|
1260 | STDMETHOD(AutoCaptureUSBDevices)();
|
---|
1261 | STDMETHOD(DetachAllUSBDevices)(BOOL aDone);
|
---|
1262 | STDMETHOD(OnSessionEnd)(ISession *aSession, IProgress **aProgress);
|
---|
1263 | STDMETHOD(BeginSavingState)(IProgress **aProgress, BSTR *aStateFilePath);
|
---|
1264 | STDMETHOD(EndSavingState)(LONG aResult, IN_BSTR aErrMsg);
|
---|
1265 | STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile);
|
---|
1266 | STDMETHOD(BeginTakingSnapshot)(IConsole *aInitiator,
|
---|
1267 | IN_BSTR aName,
|
---|
1268 | IN_BSTR aDescription,
|
---|
1269 | IProgress *aConsoleProgress,
|
---|
1270 | BOOL fTakingSnapshotOnline,
|
---|
1271 | BSTR *aStateFilePath);
|
---|
1272 | STDMETHOD(EndTakingSnapshot)(BOOL aSuccess);
|
---|
1273 | STDMETHOD(DeleteSnapshot)(IConsole *aInitiator, IN_BSTR aStartId,
|
---|
1274 | IN_BSTR aEndID, BOOL fDeleteAllChildren,
|
---|
1275 | MachineState_T *aMachineState, IProgress **aProgress);
|
---|
1276 | STDMETHOD(FinishOnlineMergeMedium)();
|
---|
1277 | STDMETHOD(RestoreSnapshot)(IConsole *aInitiator,
|
---|
1278 | ISnapshot *aSnapshot,
|
---|
1279 | MachineState_T *aMachineState,
|
---|
1280 | IProgress **aProgress);
|
---|
1281 | STDMETHOD(PullGuestProperties)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues),
|
---|
1282 | ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
|
---|
1283 | STDMETHOD(PushGuestProperty)(IN_BSTR aName, IN_BSTR aValue,
|
---|
1284 | LONG64 aTimestamp, IN_BSTR aFlags);
|
---|
1285 | STDMETHOD(LockMedia)();
|
---|
1286 | STDMETHOD(UnlockMedia)();
|
---|
1287 | STDMETHOD(EjectMedium)(IMediumAttachment *aAttachment,
|
---|
1288 | IMediumAttachment **aNewAttachment);
|
---|
1289 | STDMETHOD(ReportVmStatistics)(ULONG aValidStats, ULONG aCpuUser,
|
---|
1290 | ULONG aCpuKernel, ULONG aCpuIdle,
|
---|
1291 | ULONG aMemTotal, ULONG aMemFree,
|
---|
1292 | ULONG aMemBalloon, ULONG aMemShared,
|
---|
1293 | ULONG aMemCache, ULONG aPageTotal,
|
---|
1294 | ULONG aAllocVMM, ULONG aFreeVMM,
|
---|
1295 | ULONG aBalloonedVMM, ULONG aSharedVMM,
|
---|
1296 | ULONG aVmNetRx, ULONG aVmNetTx);
|
---|
1297 |
|
---|
1298 | // public methods only for internal purposes
|
---|
1299 |
|
---|
1300 | virtual bool i_isSessionMachine() const
|
---|
1301 | {
|
---|
1302 | return true;
|
---|
1303 | }
|
---|
1304 |
|
---|
1305 | #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
|
---|
1306 | bool i_checkForDeath();
|
---|
1307 |
|
---|
1308 | void i_getTokenId(Utf8Str &strTokenId);
|
---|
1309 | #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
|
---|
1310 | IToken *i_getToken();
|
---|
1311 | #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
|
---|
1312 | // getClientToken must be only used by callers who can guarantee that
|
---|
1313 | // the object cannot be deleted in the mean time, i.e. have a caller/lock.
|
---|
1314 | ClientToken *i_getClientToken();
|
---|
1315 |
|
---|
1316 | HRESULT i_onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
|
---|
1317 | HRESULT i_onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
|
---|
1318 | NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort,
|
---|
1319 | IN_BSTR aGuestIp, LONG aGuestPort);
|
---|
1320 | HRESULT i_onStorageControllerChange();
|
---|
1321 | HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
|
---|
1322 | HRESULT i_onSerialPortChange(ISerialPort *serialPort);
|
---|
1323 | HRESULT i_onParallelPortChange(IParallelPort *parallelPort);
|
---|
1324 | HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
|
---|
1325 | HRESULT i_onVRDEServerChange(BOOL aRestart);
|
---|
1326 | HRESULT i_onVideoCaptureChange();
|
---|
1327 | HRESULT i_onUSBControllerChange();
|
---|
1328 | HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice,
|
---|
1329 | IVirtualBoxErrorInfo *aError,
|
---|
1330 | ULONG aMaskedIfs);
|
---|
1331 | HRESULT i_onUSBDeviceDetach(IN_BSTR aId,
|
---|
1332 | IVirtualBoxErrorInfo *aError);
|
---|
1333 | HRESULT i_onSharedFolderChange();
|
---|
1334 | HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode);
|
---|
1335 | HRESULT i_onDnDModeChange(DnDMode_T aDnDMode);
|
---|
1336 | HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
|
---|
1337 | HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
|
---|
1338 | HRESULT i_onCPUExecutionCapChange(ULONG aCpuExecutionCap);
|
---|
1339 |
|
---|
1340 | bool i_hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
1341 |
|
---|
1342 | HRESULT lockMedia();
|
---|
1343 | HRESULT unlockMedia();
|
---|
1344 |
|
---|
1345 | private:
|
---|
1346 |
|
---|
1347 | struct ConsoleTaskData
|
---|
1348 | {
|
---|
1349 | ConsoleTaskData()
|
---|
1350 | : mLastState(MachineState_Null), mDeleteSnapshotInfo(NULL)
|
---|
1351 | { }
|
---|
1352 |
|
---|
1353 | MachineState_T mLastState;
|
---|
1354 | ComObjPtr<Progress> mProgress;
|
---|
1355 |
|
---|
1356 | // used when taking snapshot
|
---|
1357 | ComObjPtr<Snapshot> mSnapshot;
|
---|
1358 |
|
---|
1359 | // used when deleting online snapshot
|
---|
1360 | void *mDeleteSnapshotInfo;
|
---|
1361 |
|
---|
1362 | // used when saving state (either as part of a snapshot or separate)
|
---|
1363 | Utf8Str strStateFilePath;
|
---|
1364 | };
|
---|
1365 |
|
---|
1366 | struct SnapshotTask;
|
---|
1367 | struct DeleteSnapshotTask;
|
---|
1368 | struct RestoreSnapshotTask;
|
---|
1369 |
|
---|
1370 | friend struct DeleteSnapshotTask;
|
---|
1371 | friend struct RestoreSnapshotTask;
|
---|
1372 |
|
---|
1373 | HRESULT endSavingState(HRESULT aRC, const Utf8Str &aErrMsg);
|
---|
1374 | void i_releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore);
|
---|
1375 |
|
---|
1376 | void i_deleteSnapshotHandler(DeleteSnapshotTask &aTask);
|
---|
1377 | void i_restoreSnapshotHandler(RestoreSnapshotTask &aTask);
|
---|
1378 |
|
---|
1379 | HRESULT i_prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
|
---|
1380 | const Guid &machineId,
|
---|
1381 | const Guid &snapshotId,
|
---|
1382 | bool fOnlineMergePossible,
|
---|
1383 | MediumLockList *aVMMALockList,
|
---|
1384 | ComObjPtr<Medium> &aSource,
|
---|
1385 | ComObjPtr<Medium> &aTarget,
|
---|
1386 | bool &fMergeForward,
|
---|
1387 | ComObjPtr<Medium> &pParentForTarget,
|
---|
1388 | MediumLockList * &aChildrenToReparent,
|
---|
1389 | bool &fNeedOnlineMerge,
|
---|
1390 | MediumLockList * &aMediumLockList,
|
---|
1391 | ComPtr<IToken> &aHDLockToken);
|
---|
1392 | void i_cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
|
---|
1393 | const ComObjPtr<Medium> &aSource,
|
---|
1394 | MediumLockList *aChildrenToReparent,
|
---|
1395 | bool fNeedsOnlineMerge,
|
---|
1396 | MediumLockList *aMediumLockList,
|
---|
1397 | const ComPtr<IToken> &aHDLockToken,
|
---|
1398 | const Guid &aMediumId,
|
---|
1399 | const Guid &aSnapshotId);
|
---|
1400 | HRESULT i_onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
|
---|
1401 | const ComObjPtr<Medium> &aSource,
|
---|
1402 | const ComObjPtr<Medium> &aTarget,
|
---|
1403 | bool fMergeForward,
|
---|
1404 | const ComObjPtr<Medium> &pParentForTarget,
|
---|
1405 | MediumLockList *aChildrenToReparent,
|
---|
1406 | MediumLockList *aMediumLockList,
|
---|
1407 | ComObjPtr<Progress> &aProgress,
|
---|
1408 | bool *pfNeedsMachineSaveSettings);
|
---|
1409 |
|
---|
1410 | HRESULT i_setMachineState(MachineState_T aMachineState);
|
---|
1411 | HRESULT i_updateMachineStateOnClient();
|
---|
1412 |
|
---|
1413 | HRESULT mRemoveSavedState;
|
---|
1414 |
|
---|
1415 | ConsoleTaskData mConsoleTaskData;
|
---|
1416 |
|
---|
1417 | /** client token for this machine */
|
---|
1418 | ClientToken *mClientToken;
|
---|
1419 |
|
---|
1420 | int miNATNetworksStarted;
|
---|
1421 |
|
---|
1422 | static DECLCALLBACK(int) taskHandler(RTTHREAD thread, void *pvUser);
|
---|
1423 | };
|
---|
1424 |
|
---|
1425 | // SnapshotMachine class
|
---|
1426 | ////////////////////////////////////////////////////////////////////////////////
|
---|
1427 |
|
---|
1428 | /**
|
---|
1429 | * @note Notes on locking objects of this class:
|
---|
1430 | * SnapshotMachine shares some data with the primary Machine instance (pointed
|
---|
1431 | * to by the |mPeer| member). In order to provide data consistency it also
|
---|
1432 | * shares its lock handle. This means that whenever you lock a SessionMachine
|
---|
1433 | * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
|
---|
1434 | * instance is also locked in the same lock mode. Keep it in mind.
|
---|
1435 | */
|
---|
1436 | class ATL_NO_VTABLE SnapshotMachine :
|
---|
1437 | public Machine
|
---|
1438 | {
|
---|
1439 | public:
|
---|
1440 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SnapshotMachine, IMachine)
|
---|
1441 |
|
---|
1442 | DECLARE_NOT_AGGREGATABLE(SnapshotMachine)
|
---|
1443 |
|
---|
1444 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
1445 |
|
---|
1446 | BEGIN_COM_MAP(SnapshotMachine)
|
---|
1447 | VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
|
---|
1448 | END_COM_MAP()
|
---|
1449 |
|
---|
1450 | DECLARE_EMPTY_CTOR_DTOR(SnapshotMachine)
|
---|
1451 |
|
---|
1452 | HRESULT FinalConstruct();
|
---|
1453 | void FinalRelease();
|
---|
1454 |
|
---|
1455 | // public initializer/uninitializer for internal purposes only
|
---|
1456 | HRESULT init(SessionMachine *aSessionMachine,
|
---|
1457 | IN_GUID aSnapshotId,
|
---|
1458 | const Utf8Str &aStateFilePath);
|
---|
1459 | HRESULT initFromSettings(Machine *aMachine,
|
---|
1460 | const settings::Hardware &hardware,
|
---|
1461 | const settings::Debugging *pDbg,
|
---|
1462 | const settings::Autostart *pAutostart,
|
---|
1463 | const settings::Storage &storage,
|
---|
1464 | IN_GUID aSnapshotId,
|
---|
1465 | const Utf8Str &aStateFilePath);
|
---|
1466 | void uninit();
|
---|
1467 |
|
---|
1468 | // util::Lockable interface
|
---|
1469 | RWLockHandle *lockHandle() const;
|
---|
1470 |
|
---|
1471 | // public methods only for internal purposes
|
---|
1472 |
|
---|
1473 | virtual bool i_isSnapshotMachine() const
|
---|
1474 | {
|
---|
1475 | return true;
|
---|
1476 | }
|
---|
1477 |
|
---|
1478 | HRESULT i_onSnapshotChange(Snapshot *aSnapshot);
|
---|
1479 |
|
---|
1480 | // unsafe inline public methods for internal purposes only (ensure there is
|
---|
1481 | // a caller and a read lock before calling them!)
|
---|
1482 |
|
---|
1483 | const Guid& i_getSnapshotId() const { return mSnapshotId; }
|
---|
1484 |
|
---|
1485 | private:
|
---|
1486 |
|
---|
1487 | Guid mSnapshotId;
|
---|
1488 | /** This field replaces mPeer for SessionMachine instances, as having
|
---|
1489 | * a peer reference is plain meaningless and causes many subtle problems
|
---|
1490 | * with saving settings and the like. */
|
---|
1491 | Machine * const mMachine;
|
---|
1492 |
|
---|
1493 | friend class Snapshot;
|
---|
1494 | };
|
---|
1495 |
|
---|
1496 | // third party methods that depend on SnapshotMachine definition
|
---|
1497 |
|
---|
1498 | inline const Guid &Machine::i_getSnapshotId() const
|
---|
1499 | {
|
---|
1500 | return (i_isSnapshotMachine())
|
---|
1501 | ? static_cast<const SnapshotMachine*>(this)->i_getSnapshotId()
|
---|
1502 | : Guid::Empty;
|
---|
1503 | }
|
---|
1504 |
|
---|
1505 |
|
---|
1506 | #endif // ____H_MACHINEIMPL
|
---|
1507 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|