1 | /* $Id: MachineImpl.h 47376 2013-07-24 15:13:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Implementation of IMachine in VBoxSVC - Header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 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 "BandwidthControlImpl.h"
|
---|
35 | #include "BandwidthGroupImpl.h"
|
---|
36 | #include "VBox/settings.h"
|
---|
37 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
38 | #include "Performance.h"
|
---|
39 | #include "PerformanceImpl.h"
|
---|
40 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
41 |
|
---|
42 | // generated header
|
---|
43 | #include "SchemaDefs.h"
|
---|
44 |
|
---|
45 | #include "VBox/com/ErrorInfo.h"
|
---|
46 |
|
---|
47 | #include <iprt/file.h>
|
---|
48 | #include <iprt/thread.h>
|
---|
49 | #include <iprt/time.h>
|
---|
50 |
|
---|
51 | #include <list>
|
---|
52 | #include <vector>
|
---|
53 |
|
---|
54 | // defines
|
---|
55 | ////////////////////////////////////////////////////////////////////////////////
|
---|
56 |
|
---|
57 | // helper declarations
|
---|
58 | ////////////////////////////////////////////////////////////////////////////////
|
---|
59 |
|
---|
60 | class Progress;
|
---|
61 | class ProgressProxy;
|
---|
62 | class Keyboard;
|
---|
63 | class Mouse;
|
---|
64 | class Display;
|
---|
65 | class MachineDebugger;
|
---|
66 | class USBController;
|
---|
67 | class USBDeviceFilters;
|
---|
68 | class Snapshot;
|
---|
69 | class SharedFolder;
|
---|
70 | class HostUSBDevice;
|
---|
71 | class StorageController;
|
---|
72 |
|
---|
73 | class SessionMachine;
|
---|
74 |
|
---|
75 | namespace settings
|
---|
76 | {
|
---|
77 | class MachineConfigFile;
|
---|
78 | struct Snapshot;
|
---|
79 | struct Hardware;
|
---|
80 | struct Storage;
|
---|
81 | struct StorageController;
|
---|
82 | struct MachineRegistryEntry;
|
---|
83 | }
|
---|
84 |
|
---|
85 | // Machine class
|
---|
86 | ////////////////////////////////////////////////////////////////////////////////
|
---|
87 |
|
---|
88 | class ATL_NO_VTABLE Machine :
|
---|
89 | public VirtualBoxBase,
|
---|
90 | VBOX_SCRIPTABLE_IMPL(IMachine)
|
---|
91 | {
|
---|
92 | Q_OBJECT
|
---|
93 |
|
---|
94 | public:
|
---|
95 |
|
---|
96 | enum StateDependency
|
---|
97 | {
|
---|
98 | AnyStateDep = 0,
|
---|
99 | MutableStateDep,
|
---|
100 | MutableOrSavedStateDep,
|
---|
101 | OfflineStateDep
|
---|
102 | };
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Internal machine data.
|
---|
106 | *
|
---|
107 | * Only one instance of this data exists per every machine -- it is shared
|
---|
108 | * by the Machine, SessionMachine and all SnapshotMachine instances
|
---|
109 | * associated with the given machine using the util::Shareable template
|
---|
110 | * through the mData variable.
|
---|
111 | *
|
---|
112 | * @note |const| members are persistent during lifetime so can be
|
---|
113 | * accessed without locking.
|
---|
114 | *
|
---|
115 | * @note There is no need to lock anything inside init() or uninit()
|
---|
116 | * methods, because they are always serialized (see AutoCaller).
|
---|
117 | */
|
---|
118 | struct Data
|
---|
119 | {
|
---|
120 | /**
|
---|
121 | * Data structure to hold information about sessions opened for the
|
---|
122 | * given machine.
|
---|
123 | */
|
---|
124 | struct Session
|
---|
125 | {
|
---|
126 | /** Control of the direct session opened by lockMachine() */
|
---|
127 | ComPtr<IInternalSessionControl> mDirectControl;
|
---|
128 |
|
---|
129 | typedef std::list<ComPtr<IInternalSessionControl> > RemoteControlList;
|
---|
130 |
|
---|
131 | /** list of controls of all opened remote sessions */
|
---|
132 | RemoteControlList mRemoteControls;
|
---|
133 |
|
---|
134 | /** launchVMProcess() and OnSessionEnd() progress indicator */
|
---|
135 | ComObjPtr<ProgressProxy> mProgress;
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * PID of the session object that must be passed to openSession()
|
---|
139 | * to finalize the launchVMProcess() request (i.e., PID of the
|
---|
140 | * process created by launchVMProcess())
|
---|
141 | */
|
---|
142 | RTPROCESS mPID;
|
---|
143 |
|
---|
144 | /** Current session state */
|
---|
145 | SessionState_T mState;
|
---|
146 |
|
---|
147 | /** Session type string (for indirect sessions) */
|
---|
148 | Bstr mType;
|
---|
149 |
|
---|
150 | /** Session machine object */
|
---|
151 | ComObjPtr<SessionMachine> mMachine;
|
---|
152 |
|
---|
153 | /** Medium object lock collection. */
|
---|
154 | MediumLockListMap mLockedMedia;
|
---|
155 | };
|
---|
156 |
|
---|
157 | Data();
|
---|
158 | ~Data();
|
---|
159 |
|
---|
160 | const Guid mUuid;
|
---|
161 | BOOL mRegistered;
|
---|
162 |
|
---|
163 | Utf8Str m_strConfigFile;
|
---|
164 | Utf8Str m_strConfigFileFull;
|
---|
165 |
|
---|
166 | // machine settings XML file
|
---|
167 | settings::MachineConfigFile *pMachineConfigFile;
|
---|
168 | uint32_t flModifications;
|
---|
169 | bool m_fAllowStateModification;
|
---|
170 |
|
---|
171 | BOOL mAccessible;
|
---|
172 | com::ErrorInfo mAccessError;
|
---|
173 |
|
---|
174 | MachineState_T mMachineState;
|
---|
175 | RTTIMESPEC mLastStateChange;
|
---|
176 |
|
---|
177 | /* Note: These are guarded by VirtualBoxBase::stateLockHandle() */
|
---|
178 | uint32_t mMachineStateDeps;
|
---|
179 | RTSEMEVENTMULTI mMachineStateDepsSem;
|
---|
180 | uint32_t mMachineStateChangePending;
|
---|
181 |
|
---|
182 | BOOL mCurrentStateModified;
|
---|
183 | /** Guest properties have been modified and need saving since the
|
---|
184 | * machine was started, or there are transient properties which need
|
---|
185 | * deleting and the machine is being shut down. */
|
---|
186 | BOOL mGuestPropertiesModified;
|
---|
187 |
|
---|
188 | Session mSession;
|
---|
189 |
|
---|
190 | ComObjPtr<Snapshot> mFirstSnapshot;
|
---|
191 | ComObjPtr<Snapshot> mCurrentSnapshot;
|
---|
192 |
|
---|
193 | // list of files to delete in Delete(); this list is filled by Unregister()
|
---|
194 | std::list<Utf8Str> llFilesToDelete;
|
---|
195 | };
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * Saved state data.
|
---|
199 | *
|
---|
200 | * It's actually only the state file path string, but it needs to be
|
---|
201 | * separate from Data, because Machine and SessionMachine instances
|
---|
202 | * share it, while SnapshotMachine does not.
|
---|
203 | *
|
---|
204 | * The data variable is |mSSData|.
|
---|
205 | */
|
---|
206 | struct SSData
|
---|
207 | {
|
---|
208 | Utf8Str strStateFilePath;
|
---|
209 | };
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * User changeable machine data.
|
---|
213 | *
|
---|
214 | * This data is common for all machine snapshots, i.e. it is shared
|
---|
215 | * by all SnapshotMachine instances associated with the given machine
|
---|
216 | * using the util::Backupable template through the |mUserData| variable.
|
---|
217 | *
|
---|
218 | * SessionMachine instances can alter this data and discard changes.
|
---|
219 | *
|
---|
220 | * @note There is no need to lock anything inside init() or uninit()
|
---|
221 | * methods, because they are always serialized (see AutoCaller).
|
---|
222 | */
|
---|
223 | struct UserData
|
---|
224 | {
|
---|
225 | settings::MachineUserData s;
|
---|
226 | typedef std::vector<uint8_t> IconBlob;
|
---|
227 | IconBlob mIcon;
|
---|
228 | };
|
---|
229 |
|
---|
230 | /**
|
---|
231 | * Hardware data.
|
---|
232 | *
|
---|
233 | * This data is unique for a machine and for every machine snapshot.
|
---|
234 | * Stored using the util::Backupable template in the |mHWData| variable.
|
---|
235 | *
|
---|
236 | * SessionMachine instances can alter this data and discard changes.
|
---|
237 | */
|
---|
238 | struct HWData
|
---|
239 | {
|
---|
240 | /**
|
---|
241 | * Data structure to hold information about a guest property.
|
---|
242 | */
|
---|
243 | struct GuestProperty {
|
---|
244 | /** Property value */
|
---|
245 | Utf8Str strValue;
|
---|
246 | /** Property timestamp */
|
---|
247 | LONG64 mTimestamp;
|
---|
248 | /** Property flags */
|
---|
249 | ULONG mFlags;
|
---|
250 | };
|
---|
251 |
|
---|
252 | HWData();
|
---|
253 | ~HWData();
|
---|
254 |
|
---|
255 | Bstr mHWVersion;
|
---|
256 | Guid mHardwareUUID; /**< If Null, use mData.mUuid. */
|
---|
257 | ULONG mMemorySize;
|
---|
258 | ULONG mMemoryBalloonSize;
|
---|
259 | BOOL mPageFusionEnabled;
|
---|
260 | GraphicsControllerType_T mGraphicsControllerType;
|
---|
261 | ULONG mVRAMSize;
|
---|
262 | ULONG mVideoCaptureWidth;
|
---|
263 | ULONG mVideoCaptureHeight;
|
---|
264 | ULONG mVideoCaptureRate;
|
---|
265 | ULONG mVideoCaptureFPS;
|
---|
266 | Utf8Str mVideoCaptureFile;
|
---|
267 | BOOL mVideoCaptureEnabled;
|
---|
268 | BOOL maVideoCaptureScreens[SchemaDefs::MaxGuestMonitors];
|
---|
269 | ULONG mMonitorCount;
|
---|
270 | BOOL mHWVirtExEnabled;
|
---|
271 | BOOL mHWVirtExExclusive;
|
---|
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 | ULONG mCPUCount;
|
---|
282 | BOOL mCPUHotPlugEnabled;
|
---|
283 | ULONG mCpuExecutionCap;
|
---|
284 | BOOL mAccelerate3DEnabled;
|
---|
285 | BOOL mHPETEnabled;
|
---|
286 |
|
---|
287 | BOOL mCPUAttached[SchemaDefs::MaxCPUCount];
|
---|
288 |
|
---|
289 | settings::CpuIdLeaf mCpuIdStdLeafs[11];
|
---|
290 | settings::CpuIdLeaf mCpuIdExtLeafs[11];
|
---|
291 |
|
---|
292 | DeviceType_T mBootOrder[SchemaDefs::MaxBootPosition];
|
---|
293 |
|
---|
294 | typedef std::list<ComObjPtr<SharedFolder> > SharedFolderList;
|
---|
295 | SharedFolderList mSharedFolders;
|
---|
296 |
|
---|
297 | ClipboardMode_T mClipboardMode;
|
---|
298 | DragAndDropMode_T mDragAndDropMode;
|
---|
299 |
|
---|
300 | typedef std::map<Utf8Str, GuestProperty> GuestPropertyMap;
|
---|
301 | GuestPropertyMap mGuestProperties;
|
---|
302 | Utf8Str mGuestPropertyNotificationPatterns;
|
---|
303 |
|
---|
304 | FirmwareType_T mFirmwareType;
|
---|
305 | KeyboardHIDType_T mKeyboardHIDType;
|
---|
306 | PointingHIDType_T mPointingHIDType;
|
---|
307 | ChipsetType_T mChipsetType;
|
---|
308 | BOOL mEmulatedUSBWebcamEnabled;
|
---|
309 | BOOL mEmulatedUSBCardReaderEnabled;
|
---|
310 |
|
---|
311 | BOOL mIOCacheEnabled;
|
---|
312 | ULONG mIOCacheSize;
|
---|
313 |
|
---|
314 | typedef std::list<ComObjPtr<PCIDeviceAttachment> > PCIDeviceAssignmentList;
|
---|
315 | PCIDeviceAssignmentList mPCIDeviceAssignments;
|
---|
316 |
|
---|
317 | settings::Debugging mDebugging;
|
---|
318 | settings::Autostart mAutostart;
|
---|
319 |
|
---|
320 | Utf8Str mDefaultFrontend;
|
---|
321 | };
|
---|
322 |
|
---|
323 | /**
|
---|
324 | * Hard disk and other media data.
|
---|
325 | *
|
---|
326 | * The usage policy is the same as for HWData, but a separate structure
|
---|
327 | * is necessary because hard disk data requires different procedures when
|
---|
328 | * taking or deleting snapshots, etc.
|
---|
329 | *
|
---|
330 | * The data variable is |mMediaData|.
|
---|
331 | */
|
---|
332 | struct MediaData
|
---|
333 | {
|
---|
334 | MediaData();
|
---|
335 | ~MediaData();
|
---|
336 |
|
---|
337 | typedef std::list<ComObjPtr<MediumAttachment> > AttachmentList;
|
---|
338 | AttachmentList mAttachments;
|
---|
339 | };
|
---|
340 |
|
---|
341 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Machine, IMachine)
|
---|
342 |
|
---|
343 | DECLARE_NOT_AGGREGATABLE(Machine)
|
---|
344 |
|
---|
345 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
346 |
|
---|
347 | BEGIN_COM_MAP(Machine)
|
---|
348 | VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
|
---|
349 | END_COM_MAP()
|
---|
350 |
|
---|
351 | DECLARE_EMPTY_CTOR_DTOR(Machine)
|
---|
352 |
|
---|
353 | HRESULT FinalConstruct();
|
---|
354 | void FinalRelease();
|
---|
355 |
|
---|
356 | // public initializer/uninitializer for internal purposes only:
|
---|
357 |
|
---|
358 | // initializer for creating a new, empty machine
|
---|
359 | HRESULT init(VirtualBox *aParent,
|
---|
360 | const Utf8Str &strConfigFile,
|
---|
361 | const Utf8Str &strName,
|
---|
362 | const StringsList &llGroups,
|
---|
363 | GuestOSType *aOsType,
|
---|
364 | const Guid &aId,
|
---|
365 | bool fForceOverwrite,
|
---|
366 | bool fDirectoryIncludesUUID);
|
---|
367 |
|
---|
368 | // initializer for loading existing machine XML (either registered or not)
|
---|
369 | HRESULT initFromSettings(VirtualBox *aParent,
|
---|
370 | const Utf8Str &strConfigFile,
|
---|
371 | const Guid *aId);
|
---|
372 |
|
---|
373 | // initializer for machine config in memory (OVF import)
|
---|
374 | HRESULT init(VirtualBox *aParent,
|
---|
375 | const Utf8Str &strName,
|
---|
376 | const settings::MachineConfigFile &config);
|
---|
377 |
|
---|
378 | void uninit();
|
---|
379 |
|
---|
380 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
381 | // Needed from VirtualBox, for the delayed metrics cleanup.
|
---|
382 | void unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine);
|
---|
383 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
384 |
|
---|
385 | protected:
|
---|
386 | HRESULT initImpl(VirtualBox *aParent,
|
---|
387 | const Utf8Str &strConfigFile);
|
---|
388 | HRESULT initDataAndChildObjects();
|
---|
389 | HRESULT registeredInit();
|
---|
390 | HRESULT tryCreateMachineConfigFile(bool fForceOverwrite);
|
---|
391 | void uninitDataAndChildObjects();
|
---|
392 |
|
---|
393 | public:
|
---|
394 | // IMachine properties
|
---|
395 | STDMETHOD(COMGETTER(Parent))(IVirtualBox **aParent);
|
---|
396 | STDMETHOD(COMGETTER(Accessible))(BOOL *aAccessible);
|
---|
397 | STDMETHOD(COMGETTER(AccessError))(IVirtualBoxErrorInfo **aAccessError);
|
---|
398 | STDMETHOD(COMGETTER(Name))(BSTR *aName);
|
---|
399 | STDMETHOD(COMSETTER(Name))(IN_BSTR aName);
|
---|
400 | STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
|
---|
401 | STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
|
---|
402 | STDMETHOD(COMGETTER(Id))(BSTR *aId);
|
---|
403 | STDMETHOD(COMGETTER(Groups))(ComSafeArrayOut(BSTR, aGroups));
|
---|
404 | STDMETHOD(COMSETTER(Groups))(ComSafeArrayIn(IN_BSTR, aGroups));
|
---|
405 | STDMETHOD(COMGETTER(OSTypeId))(BSTR *aOSTypeId);
|
---|
406 | STDMETHOD(COMSETTER(OSTypeId))(IN_BSTR aOSTypeId);
|
---|
407 | STDMETHOD(COMGETTER(HardwareVersion))(BSTR *aVersion);
|
---|
408 | STDMETHOD(COMSETTER(HardwareVersion))(IN_BSTR aVersion);
|
---|
409 | STDMETHOD(COMGETTER(HardwareUUID))(BSTR *aUUID);
|
---|
410 | STDMETHOD(COMSETTER(HardwareUUID))(IN_BSTR aUUID);
|
---|
411 | STDMETHOD(COMGETTER(MemorySize))(ULONG *memorySize);
|
---|
412 | STDMETHOD(COMSETTER(MemorySize))(ULONG memorySize);
|
---|
413 | STDMETHOD(COMGETTER(CPUCount))(ULONG *cpuCount);
|
---|
414 | STDMETHOD(COMSETTER(CPUCount))(ULONG cpuCount);
|
---|
415 | STDMETHOD(COMGETTER(CPUHotPlugEnabled))(BOOL *enabled);
|
---|
416 | STDMETHOD(COMSETTER(CPUHotPlugEnabled))(BOOL enabled);
|
---|
417 | STDMETHOD(COMGETTER(CPUExecutionCap))(ULONG *aExecutionCap);
|
---|
418 | STDMETHOD(COMSETTER(CPUExecutionCap))(ULONG aExecutionCap);
|
---|
419 | STDMETHOD(COMGETTER(EmulatedUSBCardReaderEnabled))(BOOL *aEnabled);
|
---|
420 | STDMETHOD(COMSETTER(EmulatedUSBCardReaderEnabled))(BOOL aEnabled);
|
---|
421 | STDMETHOD(COMGETTER(EmulatedUSBWebcameraEnabled))(BOOL *aEnabled);
|
---|
422 | STDMETHOD(COMSETTER(EmulatedUSBWebcameraEnabled))(BOOL aEnabled);
|
---|
423 | STDMETHOD(COMGETTER(HPETEnabled))(BOOL *enabled);
|
---|
424 | STDMETHOD(COMSETTER(HPETEnabled))(BOOL enabled);
|
---|
425 | STDMETHOD(COMGETTER(MemoryBalloonSize))(ULONG *memoryBalloonSize);
|
---|
426 | STDMETHOD(COMSETTER(MemoryBalloonSize))(ULONG memoryBalloonSize);
|
---|
427 | STDMETHOD(COMGETTER(PageFusionEnabled))(BOOL *enabled);
|
---|
428 | STDMETHOD(COMSETTER(PageFusionEnabled))(BOOL enabled);
|
---|
429 | STDMETHOD(COMGETTER(GraphicsControllerType))(GraphicsControllerType_T *aGraphicsController);
|
---|
430 | STDMETHOD(COMSETTER(GraphicsControllerType))(GraphicsControllerType_T aGraphicsController);
|
---|
431 | STDMETHOD(COMGETTER(VRAMSize))(ULONG *memorySize);
|
---|
432 | STDMETHOD(COMSETTER(VRAMSize))(ULONG memorySize);
|
---|
433 | STDMETHOD(COMGETTER(Accelerate3DEnabled))(BOOL *aEnabled);
|
---|
434 | STDMETHOD(COMSETTER(Accelerate3DEnabled))(BOOL aEnabled);
|
---|
435 | STDMETHOD(COMGETTER(Accelerate2DVideoEnabled))(BOOL *aEnabled);
|
---|
436 | STDMETHOD(COMSETTER(Accelerate2DVideoEnabled))(BOOL aEnabled);
|
---|
437 | STDMETHOD(COMGETTER(MonitorCount))(ULONG *monitorCount);
|
---|
438 | STDMETHOD(COMSETTER(MonitorCount))(ULONG monitorCount);
|
---|
439 | STDMETHOD(COMGETTER(VideoCaptureEnabled))(BOOL *u8VideoRecEnabled);
|
---|
440 | STDMETHOD(COMSETTER(VideoCaptureEnabled))(BOOL u8VideoRecEnabled);
|
---|
441 | STDMETHOD(COMGETTER(VideoCaptureScreens))(ComSafeArrayOut(BOOL, aScreens));
|
---|
442 | STDMETHOD(COMSETTER(VideoCaptureScreens))(ComSafeArrayIn(BOOL, aScreens));
|
---|
443 | STDMETHOD(COMGETTER(VideoCaptureFile))(BSTR * ppChVideoRecFilename);
|
---|
444 | STDMETHOD(COMSETTER(VideoCaptureFile))(IN_BSTR pChVideoRecFilename);
|
---|
445 | STDMETHOD(COMGETTER(VideoCaptureWidth))(ULONG *aHorzRes);
|
---|
446 | STDMETHOD(COMSETTER(VideoCaptureWidth))(ULONG aorzRes);
|
---|
447 | STDMETHOD(COMGETTER(VideoCaptureHeight))(ULONG *aVertRes);
|
---|
448 | STDMETHOD(COMSETTER(VideoCaptureHeight))(ULONG aVertRes);
|
---|
449 | STDMETHOD(COMGETTER(VideoCaptureRate))(ULONG *aRate);
|
---|
450 | STDMETHOD(COMSETTER(VideoCaptureRate))(ULONG aRate);
|
---|
451 | STDMETHOD(COMGETTER(VideoCaptureFPS))(ULONG *aFPS);
|
---|
452 | STDMETHOD(COMSETTER(VideoCaptureFPS))(ULONG aFPS);
|
---|
453 | STDMETHOD(COMGETTER(BIOSSettings))(IBIOSSettings **biosSettings);
|
---|
454 | STDMETHOD(COMGETTER(SnapshotFolder))(BSTR *aSavedStateFolder);
|
---|
455 | STDMETHOD(COMSETTER(SnapshotFolder))(IN_BSTR aSavedStateFolder);
|
---|
456 | STDMETHOD(COMGETTER(MediumAttachments))(ComSafeArrayOut(IMediumAttachment *, aAttachments));
|
---|
457 | STDMETHOD(COMGETTER(VRDEServer))(IVRDEServer **vrdeServer);
|
---|
458 | STDMETHOD(COMGETTER(AudioAdapter))(IAudioAdapter **audioAdapter);
|
---|
459 | STDMETHOD(COMGETTER(USBController))(IUSBController * *aUSBController);
|
---|
460 | STDMETHOD(COMGETTER(USBDeviceFilters))(IUSBDeviceFilters * *aUSBDeviceFilters);
|
---|
461 | STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aFilePath);
|
---|
462 | STDMETHOD(COMGETTER(SettingsModified))(BOOL *aModified);
|
---|
463 | STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState);
|
---|
464 | STDMETHOD(COMGETTER(SessionType))(BSTR *aSessionType);
|
---|
465 | STDMETHOD(COMGETTER(SessionPID))(ULONG *aSessionPID);
|
---|
466 | STDMETHOD(COMGETTER(State))(MachineState_T *machineState);
|
---|
467 | STDMETHOD(COMGETTER(LastStateChange))(LONG64 *aLastStateChange);
|
---|
468 | STDMETHOD(COMGETTER(StateFilePath))(BSTR *aStateFilePath);
|
---|
469 | STDMETHOD(COMGETTER(LogFolder))(BSTR *aLogFolder);
|
---|
470 | STDMETHOD(COMGETTER(CurrentSnapshot))(ISnapshot **aCurrentSnapshot);
|
---|
471 | STDMETHOD(COMGETTER(SnapshotCount))(ULONG *aSnapshotCount);
|
---|
472 | STDMETHOD(COMGETTER(CurrentStateModified))(BOOL *aCurrentStateModified);
|
---|
473 | STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
|
---|
474 | STDMETHOD(COMGETTER(ClipboardMode))(ClipboardMode_T *aClipboardMode);
|
---|
475 | STDMETHOD(COMSETTER(ClipboardMode))(ClipboardMode_T aClipboardMode);
|
---|
476 | STDMETHOD(COMGETTER(DragAndDropMode))(DragAndDropMode_T *aDragAndDropMode);
|
---|
477 | STDMETHOD(COMSETTER(DragAndDropMode))(DragAndDropMode_T aDragAndDropMode);
|
---|
478 | STDMETHOD(COMGETTER(GuestPropertyNotificationPatterns))(BSTR *aPattern);
|
---|
479 | STDMETHOD(COMSETTER(GuestPropertyNotificationPatterns))(IN_BSTR aPattern);
|
---|
480 | STDMETHOD(COMGETTER(StorageControllers))(ComSafeArrayOut(IStorageController *, aStorageControllers));
|
---|
481 | STDMETHOD(COMGETTER(TeleporterEnabled))(BOOL *aEnabled);
|
---|
482 | STDMETHOD(COMSETTER(TeleporterEnabled))(BOOL aEnabled);
|
---|
483 | STDMETHOD(COMGETTER(TeleporterPort))(ULONG *aPort);
|
---|
484 | STDMETHOD(COMSETTER(TeleporterPort))(ULONG aPort);
|
---|
485 | STDMETHOD(COMGETTER(TeleporterAddress))(BSTR *aAddress);
|
---|
486 | STDMETHOD(COMSETTER(TeleporterAddress))(IN_BSTR aAddress);
|
---|
487 | STDMETHOD(COMGETTER(TeleporterPassword))(BSTR *aPassword);
|
---|
488 | STDMETHOD(COMSETTER(TeleporterPassword))(IN_BSTR aPassword);
|
---|
489 | STDMETHOD(COMGETTER(FaultToleranceState))(FaultToleranceState_T *aEnabled);
|
---|
490 | STDMETHOD(COMSETTER(FaultToleranceState))(FaultToleranceState_T aEnabled);
|
---|
491 | STDMETHOD(COMGETTER(FaultToleranceAddress))(BSTR *aAddress);
|
---|
492 | STDMETHOD(COMSETTER(FaultToleranceAddress))(IN_BSTR aAddress);
|
---|
493 | STDMETHOD(COMGETTER(FaultTolerancePort))(ULONG *aPort);
|
---|
494 | STDMETHOD(COMSETTER(FaultTolerancePort))(ULONG aPort);
|
---|
495 | STDMETHOD(COMGETTER(FaultTolerancePassword))(BSTR *aPassword);
|
---|
496 | STDMETHOD(COMSETTER(FaultTolerancePassword))(IN_BSTR aPassword);
|
---|
497 | STDMETHOD(COMGETTER(FaultToleranceSyncInterval))(ULONG *aInterval);
|
---|
498 | STDMETHOD(COMSETTER(FaultToleranceSyncInterval))(ULONG aInterval);
|
---|
499 | STDMETHOD(COMGETTER(RTCUseUTC))(BOOL *aEnabled);
|
---|
500 | STDMETHOD(COMSETTER(RTCUseUTC))(BOOL aEnabled);
|
---|
501 | STDMETHOD(COMGETTER(FirmwareType))(FirmwareType_T *aFirmware);
|
---|
502 | STDMETHOD(COMSETTER(FirmwareType))(FirmwareType_T aFirmware);
|
---|
503 | STDMETHOD(COMGETTER(KeyboardHIDType))(KeyboardHIDType_T *aKeyboardHIDType);
|
---|
504 | STDMETHOD(COMSETTER(KeyboardHIDType))(KeyboardHIDType_T aKeyboardHIDType);
|
---|
505 | STDMETHOD(COMGETTER(PointingHIDType))(PointingHIDType_T *aPointingHIDType);
|
---|
506 | STDMETHOD(COMSETTER(PointingHIDType))(PointingHIDType_T aPointingHIDType);
|
---|
507 | STDMETHOD(COMGETTER(ChipsetType))(ChipsetType_T *aChipsetType);
|
---|
508 | STDMETHOD(COMSETTER(ChipsetType))(ChipsetType_T aChipsetType);
|
---|
509 | STDMETHOD(COMGETTER(IOCacheEnabled))(BOOL *aEnabled);
|
---|
510 | STDMETHOD(COMSETTER(IOCacheEnabled))(BOOL aEnabled);
|
---|
511 | STDMETHOD(COMGETTER(IOCacheSize))(ULONG *aIOCacheSize);
|
---|
512 | STDMETHOD(COMSETTER(IOCacheSize))(ULONG aIOCacheSize);
|
---|
513 | STDMETHOD(COMGETTER(PCIDeviceAssignments))(ComSafeArrayOut(IPCIDeviceAttachment *, aAssignments));
|
---|
514 | STDMETHOD(COMGETTER(BandwidthControl))(IBandwidthControl **aBandwidthControl);
|
---|
515 | STDMETHOD(COMGETTER(TracingEnabled))(BOOL *pfEnabled);
|
---|
516 | STDMETHOD(COMSETTER(TracingEnabled))(BOOL fEnabled);
|
---|
517 | STDMETHOD(COMGETTER(TracingConfig))(BSTR *pbstrConfig);
|
---|
518 | STDMETHOD(COMSETTER(TracingConfig))(IN_BSTR bstrConfig);
|
---|
519 | STDMETHOD(COMGETTER(AllowTracingToAccessVM))(BOOL *pfAllow);
|
---|
520 | STDMETHOD(COMSETTER(AllowTracingToAccessVM))(BOOL fAllow);
|
---|
521 | STDMETHOD(COMGETTER(AutostartEnabled))(BOOL *pfEnabled);
|
---|
522 | STDMETHOD(COMSETTER(AutostartEnabled))(BOOL fEnabled);
|
---|
523 | STDMETHOD(COMGETTER(AutostartDelay))(ULONG *puDelay);
|
---|
524 | STDMETHOD(COMSETTER(AutostartDelay))(ULONG uDelay);
|
---|
525 | STDMETHOD(COMGETTER(AutostopType))(AutostopType_T *penmAutostopType);
|
---|
526 | STDMETHOD(COMSETTER(AutostopType))(AutostopType_T enmAutostopType);
|
---|
527 | STDMETHOD(COMGETTER(DefaultFrontend))(BSTR *aDefaultFrontend);
|
---|
528 | STDMETHOD(COMSETTER(DefaultFrontend))(IN_BSTR aDefaultFrontend);
|
---|
529 | STDMETHOD(COMGETTER(Icon))(ComSafeArrayOut(BYTE, aIcon));
|
---|
530 | STDMETHOD(COMSETTER(Icon))(ComSafeArrayIn(BYTE, aIcon));
|
---|
531 |
|
---|
532 | // IMachine methods
|
---|
533 | STDMETHOD(LockMachine)(ISession *aSession, LockType_T lockType);
|
---|
534 | STDMETHOD(LaunchVMProcess)(ISession *aSession, IN_BSTR aType, IN_BSTR aEnvironment, IProgress **aProgress);
|
---|
535 |
|
---|
536 | STDMETHOD(SetBootOrder)(ULONG aPosition, DeviceType_T aDevice);
|
---|
537 | STDMETHOD(GetBootOrder)(ULONG aPosition, DeviceType_T *aDevice);
|
---|
538 | STDMETHOD(AttachDeviceWithoutMedium)(IN_BSTR aControllerName, LONG aControllerPort,
|
---|
539 | LONG aDevice, DeviceType_T aType);
|
---|
540 | STDMETHOD(AttachDevice)(IN_BSTR aControllerName, LONG aControllerPort,
|
---|
541 | LONG aDevice, DeviceType_T aType, IMedium *aMedium);
|
---|
542 | STDMETHOD(DetachDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice);
|
---|
543 | STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough);
|
---|
544 | STDMETHOD(TemporaryEjectDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aTempEject);
|
---|
545 | STDMETHOD(NonRotationalDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aNonRotational);
|
---|
546 | STDMETHOD(SetAutoDiscardForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aDiscard);
|
---|
547 | STDMETHOD(SetNoBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort,
|
---|
548 | LONG aDevice);
|
---|
549 | STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort,
|
---|
550 | LONG aDevice, IBandwidthGroup *aBandwidthGroup);
|
---|
551 | STDMETHOD(MountMedium)(IN_BSTR aControllerName, LONG aControllerPort,
|
---|
552 | LONG aDevice, IMedium *aMedium, BOOL aForce);
|
---|
553 | STDMETHOD(UnmountMedium)(IN_BSTR aControllerName, LONG aControllerPort,
|
---|
554 | LONG aDevice, BOOL aForce);
|
---|
555 | STDMETHOD(GetMedium)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice,
|
---|
556 | IMedium **aMedium);
|
---|
557 | STDMETHOD(GetSerialPort)(ULONG slot, ISerialPort **port);
|
---|
558 | STDMETHOD(GetParallelPort)(ULONG slot, IParallelPort **port);
|
---|
559 | STDMETHOD(GetNetworkAdapter)(ULONG slot, INetworkAdapter **adapter);
|
---|
560 | STDMETHOD(GetExtraDataKeys)(ComSafeArrayOut(BSTR, aKeys));
|
---|
561 | STDMETHOD(GetExtraData)(IN_BSTR aKey, BSTR *aValue);
|
---|
562 | STDMETHOD(SetExtraData)(IN_BSTR aKey, IN_BSTR aValue);
|
---|
563 | STDMETHOD(GetCPUProperty)(CPUPropertyType_T property, BOOL *aVal);
|
---|
564 | STDMETHOD(SetCPUProperty)(CPUPropertyType_T property, BOOL aVal);
|
---|
565 | STDMETHOD(GetCPUIDLeaf)(ULONG id, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx);
|
---|
566 | STDMETHOD(SetCPUIDLeaf)(ULONG id, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx);
|
---|
567 | STDMETHOD(RemoveCPUIDLeaf)(ULONG id);
|
---|
568 | STDMETHOD(RemoveAllCPUIDLeaves)();
|
---|
569 | STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal);
|
---|
570 | STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal);
|
---|
571 | STDMETHOD(SaveSettings)();
|
---|
572 | STDMETHOD(DiscardSettings)();
|
---|
573 | STDMETHOD(Unregister)(CleanupMode_T cleanupMode, ComSafeArrayOut(IMedium*, aMedia));
|
---|
574 | STDMETHOD(DeleteConfig)(ComSafeArrayIn(IMedium*, aMedia), IProgress **aProgress);
|
---|
575 | STDMETHOD(ExportTo)(IAppliance *aAppliance, IN_BSTR location, IVirtualSystemDescription **aDescription);
|
---|
576 | STDMETHOD(FindSnapshot)(IN_BSTR aNameOrId, ISnapshot **aSnapshot);
|
---|
577 | STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
|
---|
578 | STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
|
---|
579 | STDMETHOD(CanShowConsoleWindow)(BOOL *aCanShow);
|
---|
580 | STDMETHOD(ShowConsoleWindow)(LONG64 *aWinId);
|
---|
581 | STDMETHOD(GetGuestProperty)(IN_BSTR aName, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
|
---|
582 | STDMETHOD(GetGuestPropertyValue)(IN_BSTR aName, BSTR *aValue);
|
---|
583 | STDMETHOD(GetGuestPropertyTimestamp)(IN_BSTR aName, LONG64 *aTimestamp);
|
---|
584 | STDMETHOD(SetGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags);
|
---|
585 | STDMETHOD(SetGuestPropertyValue)(IN_BSTR aName, IN_BSTR aValue);
|
---|
586 | STDMETHOD(DeleteGuestProperty)(IN_BSTR aName);
|
---|
587 | STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPattern, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
|
---|
588 | STDMETHOD(GetMediumAttachmentsOfController)(IN_BSTR aName, ComSafeArrayOut(IMediumAttachment *, aAttachments));
|
---|
589 | STDMETHOD(GetMediumAttachment)(IN_BSTR aConstrollerName, LONG aControllerPort, LONG aDevice, IMediumAttachment **aAttachment);
|
---|
590 | STDMETHOD(AddStorageController)(IN_BSTR aName, StorageBus_T aConnectionType, IStorageController **controller);
|
---|
591 | STDMETHOD(RemoveStorageController(IN_BSTR aName));
|
---|
592 | STDMETHOD(GetStorageControllerByName(IN_BSTR aName, IStorageController **storageController));
|
---|
593 | STDMETHOD(GetStorageControllerByInstance(ULONG aInstance, IStorageController **storageController));
|
---|
594 | STDMETHOD(SetStorageControllerBootable)(IN_BSTR aName, BOOL fBootable);
|
---|
595 | STDMETHOD(QuerySavedGuestScreenInfo)(ULONG uScreenId, ULONG *puOriginX, ULONG *puOriginY, ULONG *puWidth, ULONG *puHeight, BOOL *pfEnabled);
|
---|
596 | STDMETHOD(QuerySavedThumbnailSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
|
---|
597 | STDMETHOD(ReadSavedThumbnailToArray)(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
|
---|
598 | STDMETHOD(ReadSavedThumbnailPNGToArray)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
|
---|
599 | STDMETHOD(QuerySavedScreenshotPNGSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
|
---|
600 | STDMETHOD(ReadSavedScreenshotPNGToArray)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
|
---|
601 | STDMETHOD(HotPlugCPU(ULONG aCpu));
|
---|
602 | STDMETHOD(HotUnplugCPU(ULONG aCpu));
|
---|
603 | STDMETHOD(GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached));
|
---|
604 | STDMETHOD(QueryLogFilename(ULONG aIdx, BSTR *aName));
|
---|
605 | STDMETHOD(ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeArrayOut(BYTE, aData)));
|
---|
606 | STDMETHOD(AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAddress, BOOL tryToUnbind));
|
---|
607 | STDMETHOD(DetachHostPCIDevice(LONG hostAddress));
|
---|
608 | STDMETHOD(CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayIn(CloneOptions_T, options), IProgress **pProgress));
|
---|
609 | // public methods only for internal purposes
|
---|
610 |
|
---|
611 | virtual bool isSnapshotMachine() const
|
---|
612 | {
|
---|
613 | return false;
|
---|
614 | }
|
---|
615 |
|
---|
616 | virtual bool isSessionMachine() const
|
---|
617 | {
|
---|
618 | return false;
|
---|
619 | }
|
---|
620 |
|
---|
621 | /**
|
---|
622 | * Override of the default locking class to be used for validating lock
|
---|
623 | * order with the standard member lock handle.
|
---|
624 | */
|
---|
625 | virtual VBoxLockingClass getLockingClass() const
|
---|
626 | {
|
---|
627 | return LOCKCLASS_MACHINEOBJECT;
|
---|
628 | }
|
---|
629 |
|
---|
630 | /// @todo (dmik) add lock and make non-inlined after revising classes
|
---|
631 | // that use it. Note: they should enter Machine lock to keep the returned
|
---|
632 | // information valid!
|
---|
633 | bool isRegistered() { return !!mData->mRegistered; }
|
---|
634 |
|
---|
635 | // unsafe inline public methods for internal purposes only (ensure there is
|
---|
636 | // a caller and a read lock before calling them!)
|
---|
637 |
|
---|
638 | /**
|
---|
639 | * Returns the VirtualBox object this machine belongs to.
|
---|
640 | *
|
---|
641 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
642 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
643 | * one) or after doing addCaller() manually.
|
---|
644 | */
|
---|
645 | VirtualBox* getVirtualBox() const { return mParent; }
|
---|
646 |
|
---|
647 | /**
|
---|
648 | * Checks if this machine is accessible, without attempting to load the
|
---|
649 | * config file.
|
---|
650 | *
|
---|
651 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
652 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
653 | * one) or after doing addCaller() manually.
|
---|
654 | */
|
---|
655 | bool isAccessible() const { return !!mData->mAccessible; }
|
---|
656 |
|
---|
657 | /**
|
---|
658 | * Returns this machine ID.
|
---|
659 | *
|
---|
660 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
661 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
662 | * one) or after adding a caller manually.
|
---|
663 | */
|
---|
664 | const Guid& getId() const { return mData->mUuid; }
|
---|
665 |
|
---|
666 | /**
|
---|
667 | * Returns the snapshot ID this machine represents or an empty UUID if this
|
---|
668 | * instance is not SnapshotMachine.
|
---|
669 | *
|
---|
670 | * @note This method doesn't check this object's readiness. Intended to be
|
---|
671 | * used by ready Machine children (whose readiness is bound to the parent's
|
---|
672 | * one) or after adding a caller manually.
|
---|
673 | */
|
---|
674 | inline const Guid& getSnapshotId() const;
|
---|
675 |
|
---|
676 | /**
|
---|
677 | * Returns this machine's full settings file path.
|
---|
678 | *
|
---|
679 | * @note This method doesn't lock this object or check its readiness.
|
---|
680 | * Intended to be used only after doing addCaller() manually and locking it
|
---|
681 | * for reading.
|
---|
682 | */
|
---|
683 | const Utf8Str& getSettingsFileFull() const { return mData->m_strConfigFileFull; }
|
---|
684 |
|
---|
685 | /**
|
---|
686 | * Returns this machine name.
|
---|
687 | *
|
---|
688 | * @note This method doesn't lock this object or check its readiness.
|
---|
689 | * Intended to be used only after doing addCaller() manually and locking it
|
---|
690 | * for reading.
|
---|
691 | */
|
---|
692 | const Utf8Str& getName() const { return mUserData->s.strName; }
|
---|
693 |
|
---|
694 | enum
|
---|
695 | {
|
---|
696 | IsModified_MachineData = 0x0001,
|
---|
697 | IsModified_Storage = 0x0002,
|
---|
698 | IsModified_NetworkAdapters = 0x0008,
|
---|
699 | IsModified_SerialPorts = 0x0010,
|
---|
700 | IsModified_ParallelPorts = 0x0020,
|
---|
701 | IsModified_VRDEServer = 0x0040,
|
---|
702 | IsModified_AudioAdapter = 0x0080,
|
---|
703 | IsModified_USB = 0x0100,
|
---|
704 | IsModified_BIOS = 0x0200,
|
---|
705 | IsModified_SharedFolders = 0x0400,
|
---|
706 | IsModified_Snapshots = 0x0800,
|
---|
707 | IsModified_BandwidthControl = 0x1000
|
---|
708 | };
|
---|
709 |
|
---|
710 | /**
|
---|
711 | * Returns various information about this machine.
|
---|
712 | *
|
---|
713 | * @note This method doesn't lock this object or check its readiness.
|
---|
714 | * Intended to be used only after doing addCaller() manually and locking it
|
---|
715 | * for reading.
|
---|
716 | */
|
---|
717 | ChipsetType_T getChipsetType() const { return mHWData->mChipsetType; }
|
---|
718 |
|
---|
719 | void setModified(uint32_t fl, bool fAllowStateModification = true);
|
---|
720 | void setModifiedLock(uint32_t fl, bool fAllowStateModification = true);
|
---|
721 |
|
---|
722 | bool isStateModificationAllowed() const { return mData->m_fAllowStateModification; }
|
---|
723 | void allowStateModification() { mData->m_fAllowStateModification = true; }
|
---|
724 | void disallowStateModification() { mData->m_fAllowStateModification = false; }
|
---|
725 |
|
---|
726 | const StringsList &getGroups() const { return mUserData->s.llGroups; }
|
---|
727 |
|
---|
728 | // callback handlers
|
---|
729 | virtual HRESULT onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; }
|
---|
730 | virtual HRESULT onNATRedirectRuleChange(ULONG /* slot */, BOOL /* fRemove */ , IN_BSTR /* name */,
|
---|
731 | NATProtocol_T /* protocol */, IN_BSTR /* host ip */, LONG /* host port */, IN_BSTR /* guest port */, LONG /* guest port */ ) { return S_OK; }
|
---|
732 | virtual HRESULT onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; }
|
---|
733 | virtual HRESULT onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; }
|
---|
734 | virtual HRESULT onVRDEServerChange(BOOL /* aRestart */) { return S_OK; }
|
---|
735 | virtual HRESULT onUSBControllerChange() { return S_OK; }
|
---|
736 | virtual HRESULT onStorageControllerChange() { return S_OK; }
|
---|
737 | virtual HRESULT onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
|
---|
738 | virtual HRESULT onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; }
|
---|
739 | virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
|
---|
740 | virtual HRESULT onSharedFolderChange() { return S_OK; }
|
---|
741 | virtual HRESULT onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; }
|
---|
742 | virtual HRESULT onDragAndDropModeChange(DragAndDropMode_T /* aDragAndDropMode */) { return S_OK; }
|
---|
743 | virtual HRESULT onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
|
---|
744 | virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */, BOOL /* silent */) { return S_OK; }
|
---|
745 | virtual HRESULT onVideoCaptureChange() { return S_OK; }
|
---|
746 |
|
---|
747 | HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data);
|
---|
748 |
|
---|
749 | int calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
|
---|
750 | void copyPathRelativeToMachine(const Utf8Str &strSource, Utf8Str &strTarget);
|
---|
751 |
|
---|
752 | void getLogFolder(Utf8Str &aLogFolder);
|
---|
753 | Utf8Str queryLogFilename(ULONG idx);
|
---|
754 |
|
---|
755 | void composeSavedStateFilename(Utf8Str &strStateFilePath);
|
---|
756 |
|
---|
757 | void getDefaultVideoCaptureFile(Utf8Str &strFile);
|
---|
758 |
|
---|
759 | bool isUSBControllerPresent();
|
---|
760 |
|
---|
761 | HRESULT launchVMProcess(IInternalSessionControl *aControl,
|
---|
762 | const Utf8Str &strType,
|
---|
763 | const Utf8Str &strEnvironment,
|
---|
764 | ProgressProxy *aProgress);
|
---|
765 |
|
---|
766 | HRESULT getDirectControl(ComPtr<IInternalSessionControl> *directControl)
|
---|
767 | {
|
---|
768 | HRESULT rc;
|
---|
769 | *directControl = mData->mSession.mDirectControl;
|
---|
770 |
|
---|
771 | if (!*directControl)
|
---|
772 | rc = E_ACCESSDENIED;
|
---|
773 | else
|
---|
774 | rc = S_OK;
|
---|
775 |
|
---|
776 | return rc;
|
---|
777 | }
|
---|
778 |
|
---|
779 | #if defined(RT_OS_WINDOWS)
|
---|
780 |
|
---|
781 | bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
|
---|
782 | ComPtr<IInternalSessionControl> *aControl = NULL,
|
---|
783 | HANDLE *aIPCSem = NULL, bool aAllowClosing = false);
|
---|
784 | bool isSessionSpawning(RTPROCESS *aPID = NULL);
|
---|
785 |
|
---|
786 | bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
|
---|
787 | ComPtr<IInternalSessionControl> *aControl = NULL,
|
---|
788 | HANDLE *aIPCSem = NULL)
|
---|
789 | { return isSessionOpen(aMachine, aControl, aIPCSem, true /* aAllowClosing */); }
|
---|
790 |
|
---|
791 | #elif defined(RT_OS_OS2)
|
---|
792 |
|
---|
793 | bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
|
---|
794 | ComPtr<IInternalSessionControl> *aControl = NULL,
|
---|
795 | HMTX *aIPCSem = NULL, bool aAllowClosing = false);
|
---|
796 |
|
---|
797 | bool isSessionSpawning(RTPROCESS *aPID = NULL);
|
---|
798 |
|
---|
799 | bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
|
---|
800 | ComPtr<IInternalSessionControl> *aControl = NULL,
|
---|
801 | HMTX *aIPCSem = NULL)
|
---|
802 | { return isSessionOpen(aMachine, aControl, aIPCSem, true /* aAllowClosing */); }
|
---|
803 |
|
---|
804 | #else
|
---|
805 |
|
---|
806 | bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
|
---|
807 | ComPtr<IInternalSessionControl> *aControl = NULL,
|
---|
808 | bool aAllowClosing = false);
|
---|
809 | bool isSessionSpawning();
|
---|
810 |
|
---|
811 | bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
|
---|
812 | ComPtr<IInternalSessionControl> *aControl = NULL)
|
---|
813 | { return isSessionOpen(aMachine, aControl, true /* aAllowClosing */); }
|
---|
814 |
|
---|
815 | #endif
|
---|
816 |
|
---|
817 | bool checkForSpawnFailure();
|
---|
818 |
|
---|
819 | HRESULT prepareRegister();
|
---|
820 |
|
---|
821 | HRESULT getSharedFolder(CBSTR aName,
|
---|
822 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
823 | bool aSetError = false)
|
---|
824 | {
|
---|
825 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
826 | return findSharedFolder(aName, aSharedFolder, aSetError);
|
---|
827 | }
|
---|
828 |
|
---|
829 | HRESULT addStateDependency(StateDependency aDepType = AnyStateDep,
|
---|
830 | MachineState_T *aState = NULL,
|
---|
831 | BOOL *aRegistered = NULL);
|
---|
832 | void releaseStateDependency();
|
---|
833 |
|
---|
834 | HRESULT getBandwidthGroup(const Utf8Str &strBandwidthGroup,
|
---|
835 | ComObjPtr<BandwidthGroup> &pBandwidthGroup,
|
---|
836 | bool fSetError = false)
|
---|
837 | {
|
---|
838 | return mBandwidthControl->getBandwidthGroupByName(strBandwidthGroup,
|
---|
839 | pBandwidthGroup,
|
---|
840 | fSetError);
|
---|
841 | }
|
---|
842 |
|
---|
843 | protected:
|
---|
844 |
|
---|
845 | HRESULT checkStateDependency(StateDependency aDepType);
|
---|
846 |
|
---|
847 | Machine *getMachine();
|
---|
848 |
|
---|
849 | void ensureNoStateDependencies();
|
---|
850 |
|
---|
851 | virtual HRESULT setMachineState(MachineState_T aMachineState);
|
---|
852 |
|
---|
853 | HRESULT findSharedFolder(const Utf8Str &aName,
|
---|
854 | ComObjPtr<SharedFolder> &aSharedFolder,
|
---|
855 | bool aSetError = false);
|
---|
856 |
|
---|
857 | HRESULT loadSettings(bool aRegistered);
|
---|
858 | HRESULT loadMachineDataFromSettings(const settings::MachineConfigFile &config,
|
---|
859 | const Guid *puuidRegistry);
|
---|
860 | HRESULT loadSnapshot(const settings::Snapshot &data,
|
---|
861 | const Guid &aCurSnapshotId,
|
---|
862 | Snapshot *aParentSnapshot);
|
---|
863 | HRESULT loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg,
|
---|
864 | const settings::Autostart *pAutostart);
|
---|
865 | HRESULT loadDebugging(const settings::Debugging *pDbg);
|
---|
866 | HRESULT loadAutostart(const settings::Autostart *pAutostart);
|
---|
867 | HRESULT loadStorageControllers(const settings::Storage &data,
|
---|
868 | const Guid *puuidRegistry,
|
---|
869 | const Guid *puuidSnapshot);
|
---|
870 | HRESULT loadStorageDevices(StorageController *aStorageController,
|
---|
871 | const settings::StorageController &data,
|
---|
872 | const Guid *puuidRegistry,
|
---|
873 | const Guid *puuidSnapshot);
|
---|
874 |
|
---|
875 | HRESULT findSnapshotById(const Guid &aId,
|
---|
876 | ComObjPtr<Snapshot> &aSnapshot,
|
---|
877 | bool aSetError = false);
|
---|
878 | HRESULT findSnapshotByName(const Utf8Str &strName,
|
---|
879 | ComObjPtr<Snapshot> &aSnapshot,
|
---|
880 | bool aSetError = false);
|
---|
881 |
|
---|
882 | HRESULT getStorageControllerByName(const Utf8Str &aName,
|
---|
883 | ComObjPtr<StorageController> &aStorageController,
|
---|
884 | bool aSetError = false);
|
---|
885 |
|
---|
886 | HRESULT getMediumAttachmentsOfController(CBSTR aName,
|
---|
887 | MediaData::AttachmentList &aAttachments);
|
---|
888 |
|
---|
889 | enum
|
---|
890 | {
|
---|
891 | /* flags for #saveSettings() */
|
---|
892 | SaveS_ResetCurStateModified = 0x01,
|
---|
893 | SaveS_InformCallbacksAnyway = 0x02,
|
---|
894 | SaveS_Force = 0x04,
|
---|
895 | /* flags for #saveStateSettings() */
|
---|
896 | SaveSTS_CurStateModified = 0x20,
|
---|
897 | SaveSTS_StateFilePath = 0x40,
|
---|
898 | SaveSTS_StateTimeStamp = 0x80
|
---|
899 | };
|
---|
900 |
|
---|
901 | HRESULT prepareSaveSettings(bool *pfNeedsGlobalSaveSettings);
|
---|
902 | HRESULT saveSettings(bool *pfNeedsGlobalSaveSettings, int aFlags = 0);
|
---|
903 |
|
---|
904 | void copyMachineDataToSettings(settings::MachineConfigFile &config);
|
---|
905 | HRESULT saveAllSnapshots(settings::MachineConfigFile &config);
|
---|
906 | HRESULT saveHardware(settings::Hardware &data, settings::Debugging *pDbg,
|
---|
907 | settings::Autostart *pAutostart);
|
---|
908 | HRESULT saveStorageControllers(settings::Storage &data);
|
---|
909 | HRESULT saveStorageDevices(ComObjPtr<StorageController> aStorageController,
|
---|
910 | settings::StorageController &data);
|
---|
911 | HRESULT saveStateSettings(int aFlags);
|
---|
912 |
|
---|
913 | void addMediumToRegistry(ComObjPtr<Medium> &pMedium);
|
---|
914 |
|
---|
915 | HRESULT createImplicitDiffs(IProgress *aProgress,
|
---|
916 | ULONG aWeight,
|
---|
917 | bool aOnline);
|
---|
918 | HRESULT deleteImplicitDiffs(bool aOnline);
|
---|
919 |
|
---|
920 | MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
|
---|
921 | IN_BSTR aControllerName,
|
---|
922 | LONG aControllerPort,
|
---|
923 | LONG aDevice);
|
---|
924 | MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
|
---|
925 | ComObjPtr<Medium> pMedium);
|
---|
926 | MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
|
---|
927 | Guid &id);
|
---|
928 |
|
---|
929 | HRESULT detachDevice(MediumAttachment *pAttach,
|
---|
930 | AutoWriteLock &writeLock,
|
---|
931 | Snapshot *pSnapshot);
|
---|
932 |
|
---|
933 | HRESULT detachAllMedia(AutoWriteLock &writeLock,
|
---|
934 | Snapshot *pSnapshot,
|
---|
935 | CleanupMode_T cleanupMode,
|
---|
936 | MediaList &llMedia);
|
---|
937 |
|
---|
938 | void commitMedia(bool aOnline = false);
|
---|
939 | void rollbackMedia();
|
---|
940 |
|
---|
941 | bool isInOwnDir(Utf8Str *aSettingsDir = NULL) const;
|
---|
942 |
|
---|
943 | void rollback(bool aNotify);
|
---|
944 | void commit();
|
---|
945 | void copyFrom(Machine *aThat);
|
---|
946 | bool isControllerHotplugCapable(StorageControllerType_T enmCtrlType);
|
---|
947 |
|
---|
948 | struct DeleteTask;
|
---|
949 | static DECLCALLBACK(int) deleteThread(RTTHREAD Thread, void *pvUser);
|
---|
950 | HRESULT deleteTaskWorker(DeleteTask &task);
|
---|
951 |
|
---|
952 | Utf8Str getExtraData(const Utf8Str &strKey);
|
---|
953 |
|
---|
954 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
955 | HRESULT getGuestPropertyFromService(IN_BSTR aName, BSTR *aValue,
|
---|
956 | LONG64 *aTimestamp, BSTR *aFlags) const;
|
---|
957 | HRESULT getGuestPropertyFromVM(IN_BSTR aName, BSTR *aValue,
|
---|
958 | LONG64 *aTimestamp, BSTR *aFlags) const;
|
---|
959 | HRESULT setGuestPropertyToService(IN_BSTR aName, IN_BSTR aValue,
|
---|
960 | IN_BSTR aFlags);
|
---|
961 | HRESULT setGuestPropertyToVM(IN_BSTR aName, IN_BSTR aValue,
|
---|
962 | IN_BSTR aFlags);
|
---|
963 | HRESULT enumerateGuestPropertiesInService
|
---|
964 | (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),
|
---|
965 | ComSafeArrayOut(BSTR, aValues),
|
---|
966 | ComSafeArrayOut(LONG64, aTimestamps),
|
---|
967 | ComSafeArrayOut(BSTR, aFlags));
|
---|
968 | HRESULT enumerateGuestPropertiesOnVM
|
---|
969 | (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),
|
---|
970 | ComSafeArrayOut(BSTR, aValues),
|
---|
971 | ComSafeArrayOut(LONG64, aTimestamps),
|
---|
972 | ComSafeArrayOut(BSTR, aFlags));
|
---|
973 | #endif /* VBOX_WITH_GUEST_PROPS */
|
---|
974 |
|
---|
975 | #ifdef VBOX_WITH_RESOURCE_USAGE_API
|
---|
976 | void getDiskList(MediaList &list);
|
---|
977 | void registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);
|
---|
978 |
|
---|
979 | pm::CollectorGuest *mCollectorGuest;
|
---|
980 | #endif /* VBOX_WITH_RESOURCE_USAGE_API */
|
---|
981 |
|
---|
982 | Machine * const mPeer;
|
---|
983 |
|
---|
984 | VirtualBox * const mParent;
|
---|
985 |
|
---|
986 | Shareable<Data> mData;
|
---|
987 | Shareable<SSData> mSSData;
|
---|
988 |
|
---|
989 | Backupable<UserData> mUserData;
|
---|
990 | Backupable<HWData> mHWData;
|
---|
991 | Backupable<MediaData> mMediaData;
|
---|
992 |
|
---|
993 | // the following fields need special backup/rollback/commit handling,
|
---|
994 | // so they cannot be a part of HWData
|
---|
995 |
|
---|
996 | const ComObjPtr<VRDEServer> mVRDEServer;
|
---|
997 | const ComObjPtr<SerialPort> mSerialPorts[SchemaDefs::SerialPortCount];
|
---|
998 | const ComObjPtr<ParallelPort> mParallelPorts[SchemaDefs::ParallelPortCount];
|
---|
999 | const ComObjPtr<AudioAdapter> mAudioAdapter;
|
---|
1000 | const ComObjPtr<USBController> mUSBController;
|
---|
1001 | const ComObjPtr<USBDeviceFilters> mUSBDeviceFilters;
|
---|
1002 | const ComObjPtr<BIOSSettings> mBIOSSettings;
|
---|
1003 | typedef std::vector<ComObjPtr<NetworkAdapter> > NetworkAdapterVector;
|
---|
1004 | NetworkAdapterVector mNetworkAdapters;
|
---|
1005 | const ComObjPtr<BandwidthControl> mBandwidthControl;
|
---|
1006 |
|
---|
1007 | typedef std::list<ComObjPtr<StorageController> > StorageControllerList;
|
---|
1008 | Backupable<StorageControllerList> mStorageControllers;
|
---|
1009 |
|
---|
1010 | uint64_t uRegistryNeedsSaving;
|
---|
1011 |
|
---|
1012 | friend class SessionMachine;
|
---|
1013 | friend class SnapshotMachine;
|
---|
1014 | friend class Appliance;
|
---|
1015 | friend class VirtualBox;
|
---|
1016 |
|
---|
1017 | friend class MachineCloneVM;
|
---|
1018 | };
|
---|
1019 |
|
---|
1020 | // SessionMachine class
|
---|
1021 | ////////////////////////////////////////////////////////////////////////////////
|
---|
1022 |
|
---|
1023 | /**
|
---|
1024 | * @note Notes on locking objects of this class:
|
---|
1025 | * SessionMachine shares some data with the primary Machine instance (pointed
|
---|
1026 | * to by the |mPeer| member). In order to provide data consistency it also
|
---|
1027 | * shares its lock handle. This means that whenever you lock a SessionMachine
|
---|
1028 | * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
|
---|
1029 | * instance is also locked in the same lock mode. Keep it in mind.
|
---|
1030 | */
|
---|
1031 | class ATL_NO_VTABLE SessionMachine :
|
---|
1032 | public Machine,
|
---|
1033 | VBOX_SCRIPTABLE_IMPL(IInternalMachineControl)
|
---|
1034 | {
|
---|
1035 | public:
|
---|
1036 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SessionMachine, IMachine)
|
---|
1037 |
|
---|
1038 | DECLARE_NOT_AGGREGATABLE(SessionMachine)
|
---|
1039 |
|
---|
1040 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
1041 |
|
---|
1042 | BEGIN_COM_MAP(SessionMachine)
|
---|
1043 | VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
|
---|
1044 | COM_INTERFACE_ENTRY(IInternalMachineControl)
|
---|
1045 | END_COM_MAP()
|
---|
1046 |
|
---|
1047 | DECLARE_EMPTY_CTOR_DTOR(SessionMachine)
|
---|
1048 |
|
---|
1049 | HRESULT FinalConstruct();
|
---|
1050 | void FinalRelease();
|
---|
1051 |
|
---|
1052 | // public initializer/uninitializer for internal purposes only
|
---|
1053 | HRESULT init(Machine *aMachine);
|
---|
1054 | void uninit() { uninit(Uninit::Unexpected); }
|
---|
1055 |
|
---|
1056 | // util::Lockable interface
|
---|
1057 | RWLockHandle *lockHandle() const;
|
---|
1058 |
|
---|
1059 | // IInternalMachineControl methods
|
---|
1060 | STDMETHOD(SetRemoveSavedStateFile)(BOOL aRemove);
|
---|
1061 | STDMETHOD(UpdateState)(MachineState_T machineState);
|
---|
1062 | STDMETHOD(GetIPCId)(BSTR *id);
|
---|
1063 | STDMETHOD(BeginPowerUp)(IProgress *aProgress);
|
---|
1064 | STDMETHOD(EndPowerUp)(LONG iResult);
|
---|
1065 | STDMETHOD(BeginPoweringDown)(IProgress **aProgress);
|
---|
1066 | STDMETHOD(EndPoweringDown)(LONG aResult, IN_BSTR aErrMsg);
|
---|
1067 | STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
|
---|
1068 | STDMETHOD(CaptureUSBDevice)(IN_BSTR aId);
|
---|
1069 | STDMETHOD(DetachUSBDevice)(IN_BSTR aId, BOOL aDone);
|
---|
1070 | STDMETHOD(AutoCaptureUSBDevices)();
|
---|
1071 | STDMETHOD(DetachAllUSBDevices)(BOOL aDone);
|
---|
1072 | STDMETHOD(OnSessionEnd)(ISession *aSession, IProgress **aProgress);
|
---|
1073 | STDMETHOD(BeginSavingState)(IProgress **aProgress, BSTR *aStateFilePath);
|
---|
1074 | STDMETHOD(EndSavingState)(LONG aResult, IN_BSTR aErrMsg);
|
---|
1075 | STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile);
|
---|
1076 | STDMETHOD(BeginTakingSnapshot)(IConsole *aInitiator,
|
---|
1077 | IN_BSTR aName,
|
---|
1078 | IN_BSTR aDescription,
|
---|
1079 | IProgress *aConsoleProgress,
|
---|
1080 | BOOL fTakingSnapshotOnline,
|
---|
1081 | BSTR *aStateFilePath);
|
---|
1082 | STDMETHOD(EndTakingSnapshot)(BOOL aSuccess);
|
---|
1083 | STDMETHOD(DeleteSnapshot)(IConsole *aInitiator, IN_BSTR aStartId,
|
---|
1084 | IN_BSTR aEndID, BOOL fDeleteAllChildren,
|
---|
1085 | MachineState_T *aMachineState, IProgress **aProgress);
|
---|
1086 | STDMETHOD(FinishOnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
|
---|
1087 | IMedium *aSource, IMedium *aTarget,
|
---|
1088 | BOOL fMergeForward,
|
---|
1089 | IMedium *pParentForTarget,
|
---|
1090 | ComSafeArrayIn(IMedium *, aChildrenToReparent));
|
---|
1091 | STDMETHOD(RestoreSnapshot)(IConsole *aInitiator,
|
---|
1092 | ISnapshot *aSnapshot,
|
---|
1093 | MachineState_T *aMachineState,
|
---|
1094 | IProgress **aProgress);
|
---|
1095 | STDMETHOD(PullGuestProperties)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues),
|
---|
1096 | ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
|
---|
1097 | STDMETHOD(PushGuestProperty)(IN_BSTR aName, IN_BSTR aValue,
|
---|
1098 | LONG64 aTimestamp, IN_BSTR aFlags);
|
---|
1099 | STDMETHOD(LockMedia)();
|
---|
1100 | STDMETHOD(UnlockMedia)();
|
---|
1101 | STDMETHOD(EjectMedium)(IMediumAttachment *aAttachment,
|
---|
1102 | IMediumAttachment **aNewAttachment);
|
---|
1103 | STDMETHOD(ReportVmStatistics)(ULONG aValidStats, ULONG aCpuUser,
|
---|
1104 | ULONG aCpuKernel, ULONG aCpuIdle,
|
---|
1105 | ULONG aMemTotal, ULONG aMemFree,
|
---|
1106 | ULONG aMemBalloon, ULONG aMemShared,
|
---|
1107 | ULONG aMemCache, ULONG aPageTotal,
|
---|
1108 | ULONG aAllocVMM, ULONG aFreeVMM,
|
---|
1109 | ULONG aBalloonedVMM, ULONG aSharedVMM,
|
---|
1110 | ULONG aVmNetRx, ULONG aVmNetTx);
|
---|
1111 |
|
---|
1112 | // public methods only for internal purposes
|
---|
1113 |
|
---|
1114 | virtual bool isSessionMachine() const
|
---|
1115 | {
|
---|
1116 | return true;
|
---|
1117 | }
|
---|
1118 |
|
---|
1119 | bool checkForDeath();
|
---|
1120 |
|
---|
1121 | HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
|
---|
1122 | HRESULT onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
|
---|
1123 | NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
|
---|
1124 | HRESULT onStorageControllerChange();
|
---|
1125 | HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
|
---|
1126 | HRESULT onSerialPortChange(ISerialPort *serialPort);
|
---|
1127 | HRESULT onParallelPortChange(IParallelPort *parallelPort);
|
---|
1128 | HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
|
---|
1129 | HRESULT onVRDEServerChange(BOOL aRestart);
|
---|
1130 | HRESULT onVideoCaptureChange();
|
---|
1131 | HRESULT onUSBControllerChange();
|
---|
1132 | HRESULT onUSBDeviceAttach(IUSBDevice *aDevice,
|
---|
1133 | IVirtualBoxErrorInfo *aError,
|
---|
1134 | ULONG aMaskedIfs);
|
---|
1135 | HRESULT onUSBDeviceDetach(IN_BSTR aId,
|
---|
1136 | IVirtualBoxErrorInfo *aError);
|
---|
1137 | HRESULT onSharedFolderChange();
|
---|
1138 | HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
|
---|
1139 | HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
|
---|
1140 | HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
|
---|
1141 | HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
|
---|
1142 | HRESULT onCPUExecutionCapChange(ULONG aCpuExecutionCap);
|
---|
1143 |
|
---|
1144 | bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
1145 |
|
---|
1146 | HRESULT lockMedia();
|
---|
1147 | void unlockMedia();
|
---|
1148 |
|
---|
1149 | private:
|
---|
1150 |
|
---|
1151 | struct ConsoleTaskData
|
---|
1152 | {
|
---|
1153 | ConsoleTaskData()
|
---|
1154 | : mLastState(MachineState_Null)
|
---|
1155 | { }
|
---|
1156 |
|
---|
1157 | MachineState_T mLastState;
|
---|
1158 | ComObjPtr<Progress> mProgress;
|
---|
1159 |
|
---|
1160 | // used when taking snapshot
|
---|
1161 | ComObjPtr<Snapshot> mSnapshot;
|
---|
1162 |
|
---|
1163 | // used when saving state (either as part of a snapshot or separate)
|
---|
1164 | Utf8Str strStateFilePath;
|
---|
1165 | };
|
---|
1166 |
|
---|
1167 | struct Uninit
|
---|
1168 | {
|
---|
1169 | enum Reason { Unexpected, Abnormal, Normal };
|
---|
1170 | };
|
---|
1171 |
|
---|
1172 | struct SnapshotTask;
|
---|
1173 | struct DeleteSnapshotTask;
|
---|
1174 | struct RestoreSnapshotTask;
|
---|
1175 |
|
---|
1176 | friend struct DeleteSnapshotTask;
|
---|
1177 | friend struct RestoreSnapshotTask;
|
---|
1178 |
|
---|
1179 | void uninit(Uninit::Reason aReason);
|
---|
1180 |
|
---|
1181 | HRESULT endSavingState(HRESULT aRC, const Utf8Str &aErrMsg);
|
---|
1182 | void releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore);
|
---|
1183 |
|
---|
1184 | void deleteSnapshotHandler(DeleteSnapshotTask &aTask);
|
---|
1185 | void restoreSnapshotHandler(RestoreSnapshotTask &aTask);
|
---|
1186 |
|
---|
1187 | HRESULT prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
|
---|
1188 | const Guid &machineId,
|
---|
1189 | const Guid &snapshotId,
|
---|
1190 | bool fOnlineMergePossible,
|
---|
1191 | MediumLockList *aVMMALockList,
|
---|
1192 | ComObjPtr<Medium> &aSource,
|
---|
1193 | ComObjPtr<Medium> &aTarget,
|
---|
1194 | bool &fMergeForward,
|
---|
1195 | ComObjPtr<Medium> &pParentForTarget,
|
---|
1196 | MediaList &aChildrenToReparent,
|
---|
1197 | bool &fNeedOnlineMerge,
|
---|
1198 | MediumLockList * &aMediumLockList);
|
---|
1199 | void cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
|
---|
1200 | const ComObjPtr<Medium> &aSource,
|
---|
1201 | const MediaList &aChildrenToReparent,
|
---|
1202 | bool fNeedsOnlineMerge,
|
---|
1203 | MediumLockList *aMediumLockList,
|
---|
1204 | const Guid &aMediumId,
|
---|
1205 | const Guid &aSnapshotId);
|
---|
1206 | HRESULT onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
|
---|
1207 | const ComObjPtr<Medium> &aSource,
|
---|
1208 | const ComObjPtr<Medium> &aTarget,
|
---|
1209 | bool fMergeForward,
|
---|
1210 | const ComObjPtr<Medium> &pParentForTarget,
|
---|
1211 | const MediaList &aChildrenToReparent,
|
---|
1212 | MediumLockList *aMediumLockList,
|
---|
1213 | ComObjPtr<Progress> &aProgress,
|
---|
1214 | bool *pfNeedsMachineSaveSettings);
|
---|
1215 |
|
---|
1216 | HRESULT setMachineState(MachineState_T aMachineState);
|
---|
1217 | HRESULT updateMachineStateOnClient();
|
---|
1218 |
|
---|
1219 | HRESULT mRemoveSavedState;
|
---|
1220 |
|
---|
1221 | ConsoleTaskData mConsoleTaskData;
|
---|
1222 |
|
---|
1223 | /** interprocess semaphore handle for this machine */
|
---|
1224 | #if defined(RT_OS_WINDOWS)
|
---|
1225 | HANDLE mIPCSem;
|
---|
1226 | Bstr mIPCSemName;
|
---|
1227 | friend bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
|
---|
1228 | ComPtr<IInternalSessionControl> *aControl,
|
---|
1229 | HANDLE *aIPCSem, bool aAllowClosing);
|
---|
1230 | #elif defined(RT_OS_OS2)
|
---|
1231 | HMTX mIPCSem;
|
---|
1232 | Bstr mIPCSemName;
|
---|
1233 | friend bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
|
---|
1234 | ComPtr<IInternalSessionControl> *aControl,
|
---|
1235 | HMTX *aIPCSem, bool aAllowClosing);
|
---|
1236 | #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
|
---|
1237 | int mIPCSem;
|
---|
1238 | # ifdef VBOX_WITH_NEW_SYS_V_KEYGEN
|
---|
1239 | Bstr mIPCKey;
|
---|
1240 | # endif /*VBOX_WITH_NEW_SYS_V_KEYGEN */
|
---|
1241 | #else
|
---|
1242 | # error "Port me!"
|
---|
1243 | #endif
|
---|
1244 |
|
---|
1245 | static DECLCALLBACK(int) taskHandler(RTTHREAD thread, void *pvUser);
|
---|
1246 | };
|
---|
1247 |
|
---|
1248 | // SnapshotMachine class
|
---|
1249 | ////////////////////////////////////////////////////////////////////////////////
|
---|
1250 |
|
---|
1251 | /**
|
---|
1252 | * @note Notes on locking objects of this class:
|
---|
1253 | * SnapshotMachine shares some data with the primary Machine instance (pointed
|
---|
1254 | * to by the |mPeer| member). In order to provide data consistency it also
|
---|
1255 | * shares its lock handle. This means that whenever you lock a SessionMachine
|
---|
1256 | * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
|
---|
1257 | * instance is also locked in the same lock mode. Keep it in mind.
|
---|
1258 | */
|
---|
1259 | class ATL_NO_VTABLE SnapshotMachine :
|
---|
1260 | public Machine
|
---|
1261 | {
|
---|
1262 | public:
|
---|
1263 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SnapshotMachine, IMachine)
|
---|
1264 |
|
---|
1265 | DECLARE_NOT_AGGREGATABLE(SnapshotMachine)
|
---|
1266 |
|
---|
1267 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
1268 |
|
---|
1269 | BEGIN_COM_MAP(SnapshotMachine)
|
---|
1270 | VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
|
---|
1271 | END_COM_MAP()
|
---|
1272 |
|
---|
1273 | DECLARE_EMPTY_CTOR_DTOR(SnapshotMachine)
|
---|
1274 |
|
---|
1275 | HRESULT FinalConstruct();
|
---|
1276 | void FinalRelease();
|
---|
1277 |
|
---|
1278 | // public initializer/uninitializer for internal purposes only
|
---|
1279 | HRESULT init(SessionMachine *aSessionMachine,
|
---|
1280 | IN_GUID aSnapshotId,
|
---|
1281 | const Utf8Str &aStateFilePath);
|
---|
1282 | HRESULT initFromSettings(Machine *aMachine,
|
---|
1283 | const settings::Hardware &hardware,
|
---|
1284 | const settings::Debugging *pDbg,
|
---|
1285 | const settings::Autostart *pAutostart,
|
---|
1286 | const settings::Storage &storage,
|
---|
1287 | IN_GUID aSnapshotId,
|
---|
1288 | const Utf8Str &aStateFilePath);
|
---|
1289 | void uninit();
|
---|
1290 |
|
---|
1291 | // util::Lockable interface
|
---|
1292 | RWLockHandle *lockHandle() const;
|
---|
1293 |
|
---|
1294 | // public methods only for internal purposes
|
---|
1295 |
|
---|
1296 | virtual bool isSnapshotMachine() const
|
---|
1297 | {
|
---|
1298 | return true;
|
---|
1299 | }
|
---|
1300 |
|
---|
1301 | HRESULT onSnapshotChange(Snapshot *aSnapshot);
|
---|
1302 |
|
---|
1303 | // unsafe inline public methods for internal purposes only (ensure there is
|
---|
1304 | // a caller and a read lock before calling them!)
|
---|
1305 |
|
---|
1306 | const Guid& getSnapshotId() const { return mSnapshotId; }
|
---|
1307 |
|
---|
1308 | private:
|
---|
1309 |
|
---|
1310 | Guid mSnapshotId;
|
---|
1311 | /** This field replaces mPeer for SessionMachine instances, as having
|
---|
1312 | * a peer reference is plain meaningless and causes many subtle problems
|
---|
1313 | * with saving settings and the like. */
|
---|
1314 | Machine * const mMachine;
|
---|
1315 |
|
---|
1316 | friend class Snapshot;
|
---|
1317 | };
|
---|
1318 |
|
---|
1319 | // third party methods that depend on SnapshotMachine definition
|
---|
1320 |
|
---|
1321 | inline const Guid &Machine::getSnapshotId() const
|
---|
1322 | {
|
---|
1323 | return (isSnapshotMachine())
|
---|
1324 | ? static_cast<const SnapshotMachine*>(this)->getSnapshotId()
|
---|
1325 | : Guid::Empty;
|
---|
1326 | }
|
---|
1327 |
|
---|
1328 |
|
---|
1329 | #endif // ____H_MACHINEIMPL
|
---|
1330 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|