VirtualBox

source: vbox/trunk/src/VBox/Main/include/MachineImpl.h@ 27630

Last change on this file since 27630 was 27607, checked in by vboxsync, 15 years ago

Main: remove templates for 'weak' com pointers which do nothing anyway

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.8 KB
Line 
1/* $Id: MachineImpl.h 27607 2010-03-22 18:13:07Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class declaration
6 */
7
8/*
9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 * Clara, CA 95054 USA or visit http://www.sun.com if you need
21 * additional information or have any questions.
22 */
23
24#ifndef ____H_MACHINEIMPL
25#define ____H_MACHINEIMPL
26
27#include "VirtualBoxBase.h"
28#include "SnapshotImpl.h"
29#include "VRDPServerImpl.h"
30#include "MediumAttachmentImpl.h"
31#include "NetworkAdapterImpl.h"
32#include "AudioAdapterImpl.h"
33#include "SerialPortImpl.h"
34#include "ParallelPortImpl.h"
35#include "BIOSSettingsImpl.h"
36#include "StorageControllerImpl.h" // required for MachineImpl.h to compile on Windows
37#include "VBox/settings.h"
38#ifdef VBOX_WITH_RESOURCE_USAGE_API
39#include "PerformanceImpl.h"
40#endif /* VBOX_WITH_RESOURCE_USAGE_API */
41
42// generated header
43#include "SchemaDefs.h"
44
45#include <VBox/types.h>
46
47#include <iprt/file.h>
48#include <iprt/thread.h>
49#include <iprt/time.h>
50
51#include <list>
52
53// defines
54////////////////////////////////////////////////////////////////////////////////
55
56// helper declarations
57////////////////////////////////////////////////////////////////////////////////
58
59class Progress;
60class Keyboard;
61class Mouse;
62class Display;
63class MachineDebugger;
64class USBController;
65class Snapshot;
66class SharedFolder;
67class HostUSBDevice;
68class StorageController;
69
70class SessionMachine;
71
72namespace settings
73{
74 class MachineConfigFile;
75 struct Snapshot;
76 struct Hardware;
77 struct Storage;
78 struct StorageController;
79 struct MachineRegistryEntry;
80}
81
82// Machine class
83////////////////////////////////////////////////////////////////////////////////
84
85class ATL_NO_VTABLE Machine :
86 public VirtualBoxBaseWithChildrenNEXT,
87 public VirtualBoxSupportErrorInfoImpl<Machine, IMachine>,
88 public VirtualBoxSupportTranslation<Machine>,
89 VBOX_SCRIPTABLE_IMPL(IMachine)
90{
91 Q_OBJECT
92
93public:
94
95 enum InitMode { Init_New, Init_Import, Init_Registered };
96
97 enum StateDependency
98 {
99 AnyStateDep = 0, MutableStateDep, MutableOrSavedStateDep
100 };
101
102 /**
103 * Internal machine data.
104 *
105 * Only one instance of this data exists per every machine -- it is shared
106 * by the Machine, SessionMachine and all SnapshotMachine instances
107 * associated with the given machine using the util::Shareable template
108 * through the mData variable.
109 *
110 * @note |const| members are persistent during lifetime so can be
111 * accessed without locking.
112 *
113 * @note There is no need to lock anything inside init() or uninit()
114 * methods, because they are always serialized (see AutoCaller).
115 */
116 struct Data
117 {
118 /**
119 * Data structure to hold information about sessions opened for the
120 * given machine.
121 */
122 struct Session
123 {
124 /** Control of the direct session opened by openSession() */
125 ComPtr<IInternalSessionControl> mDirectControl;
126
127 typedef std::list<ComPtr<IInternalSessionControl> > RemoteControlList;
128
129 /** list of controls of all opened remote sessions */
130 RemoteControlList mRemoteControls;
131
132 /** openRemoteSession() and OnSessionEnd() progress indicator */
133 ComObjPtr<Progress> mProgress;
134
135 /**
136 * PID of the session object that must be passed to openSession() to
137 * finalize the openRemoteSession() request (i.e., PID of the
138 * process created by openRemoteSession())
139 */
140 RTPROCESS mPid;
141
142 /** Current session state */
143 SessionState_T mState;
144
145 /** Session type string (for indirect sessions) */
146 Bstr mType;
147
148 /** Session machine object */
149 ComObjPtr<SessionMachine> mMachine;
150
151 /**
152 * Successfully locked media list. The 2nd value in the pair is true
153 * if the medium is locked for writing and false if locked for
154 * reading.
155 */
156 typedef std::list<std::pair<ComPtr<IMedium>, bool > > LockedMedia;
157 LockedMedia mLockedMedia;
158 };
159
160 Data();
161 ~Data();
162
163 const Guid mUuid;
164 BOOL mRegistered;
165 InitMode mInitMode;
166
167 /** Flag indicating that the config file is read-only. */
168 BOOL mConfigFileReadonly;
169 Utf8Str m_strConfigFile;
170 Utf8Str m_strConfigFileFull;
171
172 // machine settings XML file
173 settings::MachineConfigFile *m_pMachineConfigFile;
174
175 BOOL mAccessible;
176 com::ErrorInfo mAccessError;
177
178 MachineState_T mMachineState;
179 RTTIMESPEC mLastStateChange;
180
181 /* Note: These are guarded by VirtualBoxBase::stateLockHandle() */
182 uint32_t mMachineStateDeps;
183 RTSEMEVENTMULTI mMachineStateDepsSem;
184 uint32_t mMachineStateChangePending;
185
186 BOOL mCurrentStateModified;
187
188 RTFILE mHandleCfgFile;
189
190 Session mSession;
191
192 ComObjPtr<Snapshot> mFirstSnapshot;
193 ComObjPtr<Snapshot> mCurrentSnapshot;
194 };
195
196 /**
197 * Saved state data.
198 *
199 * It's actually only the state file path string, but it needs to be
200 * separate from Data, because Machine and SessionMachine instances
201 * share it, while SnapshotMachine does not.
202 *
203 * The data variable is |mSSData|.
204 */
205 struct SSData
206 {
207 Utf8Str mStateFilePath;
208 };
209
210 /**
211 * User changeable machine data.
212 *
213 * This data is common for all machine snapshots, i.e. it is shared
214 * by all SnapshotMachine instances associated with the given machine
215 * using the util::Backupable template through the |mUserData| variable.
216 *
217 * SessionMachine instances can alter this data and discard changes.
218 *
219 * @note There is no need to lock anything inside init() or uninit()
220 * methods, because they are always serialized (see AutoCaller).
221 */
222 struct UserData
223 {
224 UserData();
225 ~UserData();
226
227 Bstr mName;
228 BOOL mNameSync;
229 Bstr mDescription;
230 Bstr mOSTypeId;
231 Bstr mSnapshotFolder;
232 Bstr mSnapshotFolderFull;
233 BOOL mTeleporterEnabled;
234 ULONG mTeleporterPort;
235 Bstr mTeleporterAddress;
236 Bstr mTeleporterPassword;
237 BOOL mRTCUseUTC;
238 };
239
240 /**
241 * Hardware data.
242 *
243 * This data is unique for a machine and for every machine snapshot.
244 * Stored using the util::Backupable template in the |mHWData| variable.
245 *
246 * SessionMachine instances can alter this data and discard changes.
247 */
248 struct HWData
249 {
250 /**
251 * Data structure to hold information about a guest property.
252 */
253 struct GuestProperty {
254 /** Property name */
255 Utf8Str strName;
256 /** Property value */
257 Utf8Str strValue;
258 /** Property timestamp */
259 ULONG64 mTimestamp;
260 /** Property flags */
261 ULONG mFlags;
262 };
263
264 HWData();
265 ~HWData();
266
267 Bstr mHWVersion;
268 Guid mHardwareUUID; /**< If Null, use mData.mUuid. */
269 ULONG mMemorySize;
270 ULONG mMemoryBalloonSize;
271 ULONG mStatisticsUpdateInterval;
272 ULONG mVRAMSize;
273 ULONG mMonitorCount;
274 BOOL mHWVirtExEnabled;
275 BOOL mHWVirtExExclusive;
276 BOOL mHWVirtExNestedPagingEnabled;
277 BOOL mHWVirtExLargePagesEnabled;
278 BOOL mHWVirtExVPIDEnabled;
279 BOOL mAccelerate2DVideoEnabled;
280 BOOL mPAEEnabled;
281 BOOL mSyntheticCpu;
282 ULONG mCPUCount;
283 BOOL mCPUHotPlugEnabled;
284 BOOL mAccelerate3DEnabled;
285 BOOL mHpetEnabled;
286
287 BOOL mCPUAttached[SchemaDefs::MaxCPUCount];
288
289 settings::CpuIdLeaf mCpuIdStdLeafs[10];
290 settings::CpuIdLeaf mCpuIdExtLeafs[10];
291
292 DeviceType_T mBootOrder[SchemaDefs::MaxBootPosition];
293
294 typedef std::list< ComObjPtr<SharedFolder> > SharedFolderList;
295 SharedFolderList mSharedFolders;
296
297 ClipboardMode_T mClipboardMode;
298
299 typedef std::list<GuestProperty> GuestPropertyList;
300 GuestPropertyList mGuestProperties;
301 BOOL mPropertyServiceActive;
302 Utf8Str mGuestPropertyNotificationPatterns;
303
304 FirmwareType_T mFirmwareType;
305 KeyboardHidType_T mKeyboardHidType;
306 PointingHidType_T mPointingHidType;
307
308 IoMgrType_T mIoMgrType;
309 IoBackendType_T mIoBackendType;
310 BOOL mIoCacheEnabled;
311 ULONG mIoCacheSize;
312 ULONG mIoBandwidthMax;
313 };
314
315 /**
316 * Hard disk and other media data.
317 *
318 * The usage policy is the same as for HWData, but a separate structure
319 * is necessary because hard disk data requires different procedures when
320 * taking or discarding snapshots, etc.
321 *
322 * The data variable is |mMediaData|.
323 */
324 struct MediaData
325 {
326 MediaData();
327 ~MediaData();
328
329 typedef std::list< ComObjPtr<MediumAttachment> > AttachmentList;
330 AttachmentList mAttachments;
331 };
332
333 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Machine)
334
335 DECLARE_NOT_AGGREGATABLE(Machine)
336
337 DECLARE_PROTECT_FINAL_CONSTRUCT()
338
339 BEGIN_COM_MAP(Machine)
340 COM_INTERFACE_ENTRY(ISupportErrorInfo)
341 COM_INTERFACE_ENTRY(IMachine)
342 COM_INTERFACE_ENTRY(IDispatch)
343 END_COM_MAP()
344
345 DECLARE_EMPTY_CTOR_DTOR(Machine)
346
347 HRESULT FinalConstruct();
348 void FinalRelease();
349
350 // public initializer/uninitializer for internal purposes only
351 HRESULT init(VirtualBox *aParent,
352 const Utf8Str &strConfigFile,
353 InitMode aMode,
354 CBSTR aName = NULL,
355 GuestOSType *aOsType = NULL,
356 BOOL aNameSync = TRUE,
357 const Guid *aId = NULL);
358 void uninit();
359
360protected:
361 HRESULT initDataAndChildObjects();
362 void uninitDataAndChildObjects();
363
364public:
365 // IMachine properties
366 STDMETHOD(COMGETTER(Parent))(IVirtualBox **aParent);
367 STDMETHOD(COMGETTER(Accessible))(BOOL *aAccessible);
368 STDMETHOD(COMGETTER(AccessError))(IVirtualBoxErrorInfo **aAccessError);
369 STDMETHOD(COMGETTER(Name))(BSTR *aName);
370 STDMETHOD(COMSETTER(Name))(IN_BSTR aName);
371 STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
372 STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
373 STDMETHOD(COMGETTER(Id))(BSTR *aId);
374 STDMETHOD(COMGETTER(OSTypeId))(BSTR *aOSTypeId);
375 STDMETHOD(COMSETTER(OSTypeId))(IN_BSTR aOSTypeId);
376 STDMETHOD(COMGETTER(HardwareVersion))(BSTR *aVersion);
377 STDMETHOD(COMSETTER(HardwareVersion))(IN_BSTR aVersion);
378 STDMETHOD(COMGETTER(HardwareUUID))(BSTR *aUUID);
379 STDMETHOD(COMSETTER(HardwareUUID))(IN_BSTR aUUID);
380 STDMETHOD(COMGETTER(MemorySize))(ULONG *memorySize);
381 STDMETHOD(COMSETTER(MemorySize))(ULONG memorySize);
382 STDMETHOD(COMGETTER(CPUCount))(ULONG *cpuCount);
383 STDMETHOD(COMSETTER(CPUCount))(ULONG cpuCount);
384 STDMETHOD(COMGETTER(CPUHotPlugEnabled))(BOOL *enabled);
385 STDMETHOD(COMSETTER(CPUHotPlugEnabled))(BOOL enabled);
386 STDMETHOD(COMGETTER(HpetEnabled))(BOOL *enabled);
387 STDMETHOD(COMSETTER(HpetEnabled))(BOOL enabled);
388 STDMETHOD(COMGETTER(MemoryBalloonSize))(ULONG *memoryBalloonSize);
389 STDMETHOD(COMSETTER(MemoryBalloonSize))(ULONG memoryBalloonSize);
390 STDMETHOD(COMGETTER(StatisticsUpdateInterval))(ULONG *statisticsUpdateInterval);
391 STDMETHOD(COMSETTER(StatisticsUpdateInterval))(ULONG statisticsUpdateInterval);
392 STDMETHOD(COMGETTER(VRAMSize))(ULONG *memorySize);
393 STDMETHOD(COMSETTER(VRAMSize))(ULONG memorySize);
394 STDMETHOD(COMGETTER(MonitorCount))(ULONG *monitorCount);
395 STDMETHOD(COMSETTER(MonitorCount))(ULONG monitorCount);
396 STDMETHOD(COMGETTER(Accelerate3DEnabled))(BOOL *enabled);
397 STDMETHOD(COMSETTER(Accelerate3DEnabled))(BOOL enabled);
398 STDMETHOD(COMGETTER(Accelerate2DVideoEnabled))(BOOL *enabled);
399 STDMETHOD(COMSETTER(Accelerate2DVideoEnabled))(BOOL enabled);
400 STDMETHOD(COMGETTER(BIOSSettings))(IBIOSSettings **biosSettings);
401 STDMETHOD(COMGETTER(SnapshotFolder))(BSTR *aSavedStateFolder);
402 STDMETHOD(COMSETTER(SnapshotFolder))(IN_BSTR aSavedStateFolder);
403 STDMETHOD(COMGETTER(MediumAttachments))(ComSafeArrayOut(IMediumAttachment *, aAttachments));
404 STDMETHOD(COMGETTER(VRDPServer))(IVRDPServer **vrdpServer);
405 STDMETHOD(COMGETTER(AudioAdapter))(IAudioAdapter **audioAdapter);
406 STDMETHOD(COMGETTER(USBController))(IUSBController * *aUSBController);
407 STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aFilePath);
408 STDMETHOD(COMGETTER(SettingsModified))(BOOL *aModified);
409 STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState);
410 STDMETHOD(COMGETTER(SessionType))(BSTR *aSessionType);
411 STDMETHOD(COMGETTER(SessionPid))(ULONG *aSessionPid);
412 STDMETHOD(COMGETTER(State))(MachineState_T *machineState);
413 STDMETHOD(COMGETTER(LastStateChange))(LONG64 *aLastStateChange);
414 STDMETHOD(COMGETTER(StateFilePath))(BSTR *aStateFilePath);
415 STDMETHOD(COMGETTER(LogFolder))(BSTR *aLogFolder);
416 STDMETHOD(COMGETTER(CurrentSnapshot))(ISnapshot **aCurrentSnapshot);
417 STDMETHOD(COMGETTER(SnapshotCount))(ULONG *aSnapshotCount);
418 STDMETHOD(COMGETTER(CurrentStateModified))(BOOL *aCurrentStateModified);
419 STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
420 STDMETHOD(COMGETTER(ClipboardMode))(ClipboardMode_T *aClipboardMode);
421 STDMETHOD(COMSETTER(ClipboardMode))(ClipboardMode_T aClipboardMode);
422 STDMETHOD(COMGETTER(GuestPropertyNotificationPatterns))(BSTR *aPattern);
423 STDMETHOD(COMSETTER(GuestPropertyNotificationPatterns))(IN_BSTR aPattern);
424 STDMETHOD(COMGETTER(StorageControllers))(ComSafeArrayOut(IStorageController *, aStorageControllers));
425 STDMETHOD(COMGETTER(TeleporterEnabled))(BOOL *aEnabled);
426 STDMETHOD(COMSETTER(TeleporterEnabled))(BOOL aEnabled);
427 STDMETHOD(COMGETTER(TeleporterPort))(ULONG *aPort);
428 STDMETHOD(COMSETTER(TeleporterPort))(ULONG aPort);
429 STDMETHOD(COMGETTER(TeleporterAddress))(BSTR *aAddress);
430 STDMETHOD(COMSETTER(TeleporterAddress))(IN_BSTR aAddress);
431 STDMETHOD(COMGETTER(TeleporterPassword))(BSTR *aPassword);
432 STDMETHOD(COMSETTER(TeleporterPassword))(IN_BSTR aPassword);
433 STDMETHOD(COMGETTER(RTCUseUTC))(BOOL *aEnabled);
434 STDMETHOD(COMSETTER(RTCUseUTC))(BOOL aEnabled);
435 STDMETHOD(COMGETTER(FirmwareType)) (FirmwareType_T *aFirmware);
436 STDMETHOD(COMSETTER(FirmwareType)) (FirmwareType_T aFirmware);
437 STDMETHOD(COMGETTER(KeyboardHidType)) (KeyboardHidType_T *aKeyboardHidType);
438 STDMETHOD(COMSETTER(KeyboardHidType)) (KeyboardHidType_T aKeyboardHidType);
439 STDMETHOD(COMGETTER(PointingHidType)) (PointingHidType_T *aPointingHidType);
440 STDMETHOD(COMSETTER(PointingHidType)) (PointingHidType_T aPointingHidType);
441 STDMETHOD(COMGETTER(IoMgr)) (IoMgrType_T *aIoMgrType);
442 STDMETHOD(COMSETTER(IoMgr)) (IoMgrType_T aIoMgrType);
443 STDMETHOD(COMGETTER(IoBackend)) (IoBackendType_T *aIoBackendType);
444 STDMETHOD(COMSETTER(IoBackend)) (IoBackendType_T aIoBackendType);
445 STDMETHOD(COMGETTER(IoCacheEnabled)) (BOOL *aEnabled);
446 STDMETHOD(COMSETTER(IoCacheEnabled)) (BOOL aEnabled);
447 STDMETHOD(COMGETTER(IoCacheSize)) (ULONG *aIoCacheSize);
448 STDMETHOD(COMSETTER(IoCacheSize)) (ULONG aIoCacheSize);
449 STDMETHOD(COMGETTER(IoBandwidthMax)) (ULONG *aIoBandwidthMax);
450 STDMETHOD(COMSETTER(IoBandwidthMax)) (ULONG aIoBandwidthMax);
451
452 // IMachine methods
453 STDMETHOD(SetBootOrder)(ULONG aPosition, DeviceType_T aDevice);
454 STDMETHOD(GetBootOrder)(ULONG aPosition, DeviceType_T *aDevice);
455 STDMETHOD(AttachDevice)(IN_BSTR aControllerName, LONG aControllerPort,
456 LONG aDevice, DeviceType_T aType, IN_BSTR aId);
457 STDMETHOD(DetachDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice);
458 STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough);
459 STDMETHOD(MountMedium)(IN_BSTR aControllerName, LONG aControllerPort,
460 LONG aDevice, IN_BSTR aId, BOOL aForce);
461 STDMETHOD(GetMedium)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice,
462 IMedium **aMedium);
463 STDMETHOD(GetSerialPort)(ULONG slot, ISerialPort **port);
464 STDMETHOD(GetParallelPort)(ULONG slot, IParallelPort **port);
465 STDMETHOD(GetNetworkAdapter)(ULONG slot, INetworkAdapter **adapter);
466 STDMETHOD(GetExtraDataKeys)(ComSafeArrayOut(BSTR, aKeys));
467 STDMETHOD(GetExtraData)(IN_BSTR aKey, BSTR *aValue);
468 STDMETHOD(SetExtraData)(IN_BSTR aKey, IN_BSTR aValue);
469 STDMETHOD(GetCPUProperty)(CPUPropertyType_T property, BOOL *aVal);
470 STDMETHOD(SetCPUProperty)(CPUPropertyType_T property, BOOL aVal);
471 STDMETHOD(GetCPUIDLeaf)(ULONG id, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx);
472 STDMETHOD(SetCPUIDLeaf)(ULONG id, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx);
473 STDMETHOD(RemoveCPUIDLeaf)(ULONG id);
474 STDMETHOD(RemoveAllCPUIDLeaves)();
475 STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal);
476 STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal);
477 STDMETHOD(SaveSettings)();
478 STDMETHOD(DiscardSettings)();
479 STDMETHOD(DeleteSettings)();
480 STDMETHOD(Export)(IAppliance *aAppliance, IVirtualSystemDescription **aDescription);
481 STDMETHOD(GetSnapshot)(IN_BSTR aId, ISnapshot **aSnapshot);
482 STDMETHOD(FindSnapshot)(IN_BSTR aName, ISnapshot **aSnapshot);
483 STDMETHOD(SetCurrentSnapshot)(IN_BSTR aId);
484 STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
485 STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
486 STDMETHOD(CanShowConsoleWindow)(BOOL *aCanShow);
487 STDMETHOD(ShowConsoleWindow)(ULONG64 *aWinId);
488 STDMETHOD(GetGuestProperty)(IN_BSTR aName, BSTR *aValue, ULONG64 *aTimestamp, BSTR *aFlags);
489 STDMETHOD(GetGuestPropertyValue)(IN_BSTR aName, BSTR *aValue);
490 STDMETHOD(GetGuestPropertyTimestamp)(IN_BSTR aName, ULONG64 *aTimestamp);
491 STDMETHOD(SetGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags);
492 STDMETHOD(SetGuestPropertyValue)(IN_BSTR aName, IN_BSTR aValue);
493 STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPattern, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
494 STDMETHOD(GetMediumAttachmentsOfController)(IN_BSTR aName, ComSafeArrayOut(IMediumAttachment *, aAttachments));
495 STDMETHOD(GetMediumAttachment)(IN_BSTR aConstrollerName, LONG aControllerPort, LONG aDevice, IMediumAttachment **aAttachment);
496 STDMETHOD(AddStorageController)(IN_BSTR aName, StorageBus_T aConnectionType, IStorageController **controller);
497 STDMETHOD(RemoveStorageController(IN_BSTR aName));
498 STDMETHOD(GetStorageControllerByName(IN_BSTR aName, IStorageController **storageController));
499 STDMETHOD(GetStorageControllerByInstance(ULONG aInstance, IStorageController **storageController));
500 STDMETHOD(QuerySavedThumbnailSize)(ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
501 STDMETHOD(ReadSavedThumbnailToArray)(BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
502 STDMETHOD(QuerySavedScreenshotPNGSize)(ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
503 STDMETHOD(ReadSavedScreenshotPNGToArray)(ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
504 STDMETHOD(HotPlugCPU(ULONG aCpu));
505 STDMETHOD(HotUnplugCPU(ULONG aCpu));
506 STDMETHOD(GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached));
507
508 // public methods only for internal purposes
509
510 /**
511 * Simple run-time type identification without having to enable C++ RTTI.
512 * The class IDs are defined in VirtualBoxBase.h.
513 * @return
514 */
515 virtual VBoxClsID getClassID() const
516 {
517 return clsidMachine;
518 }
519
520 /**
521 * Override of the default locking class to be used for validating lock
522 * order with the standard member lock handle.
523 */
524 virtual VBoxLockingClass getLockingClass() const
525 {
526 return LOCKCLASS_MACHINEOBJECT;
527 }
528
529 /// @todo (dmik) add lock and make non-inlined after revising classes
530 // that use it. Note: they should enter Machine lock to keep the returned
531 // information valid!
532 bool isRegistered() { return !!mData->mRegistered; }
533
534 // unsafe inline public methods for internal purposes only (ensure there is
535 // a caller and a read lock before calling them!)
536
537 /**
538 * Returns the VirtualBox object this machine belongs to.
539 *
540 * @note This method doesn't check this object's readiness. Intended to be
541 * used by ready Machine children (whose readiness is bound to the parent's
542 * one) or after doing addCaller() manually.
543 */
544 VirtualBox* getVirtualBox() const { return mParent; }
545
546 /**
547 * Returns this machine ID.
548 *
549 * @note This method doesn't check this object's readiness. Intended to be
550 * used by ready Machine children (whose readiness is bound to the parent's
551 * one) or after adding a caller manually.
552 */
553 const Guid& getId() const { return mData->mUuid; }
554
555 /**
556 * Returns the snapshot ID this machine represents or an empty UUID if this
557 * instance is not SnapshotMachine.
558 *
559 * @note This method doesn't check this object's readiness. Intended to be
560 * used by ready Machine children (whose readiness is bound to the parent's
561 * one) or after adding a caller manually.
562 */
563 inline const Guid& getSnapshotId() const;
564
565 /**
566 * Returns this machine's full settings file path.
567 *
568 * @note This method doesn't lock this object or check its readiness.
569 * Intended to be used only after doing addCaller() manually and locking it
570 * for reading.
571 */
572 const Utf8Str& getSettingsFileFull() const { return mData->m_strConfigFileFull; }
573
574 /**
575 * Returns this machine name.
576 *
577 * @note This method doesn't lock this object or check its readiness.
578 * Intended to be used only after doing addCaller() manually and locking it
579 * for reading.
580 */
581 const Bstr& getName() const { return mUserData->mName; }
582
583 enum
584 {
585 IsModified_MachineData = 0x0001,
586 IsModified_Storage = 0x0002,
587 IsModified_NetworkAdapters = 0x0008,
588 IsModified_SerialPorts = 0x0010,
589 IsModified_ParallelPorts = 0x0020,
590 IsModified_VRDPServer = 0x0040,
591 IsModified_AudioAdapter = 0x0080,
592 IsModified_USB = 0x0100,
593 IsModified_BIOS = 0x0200,
594 IsModified_SharedFolders = 0x0400
595 };
596
597 void setModified(uint32_t fl);
598
599 // callback handlers
600 virtual HRESULT onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; }
601 virtual HRESULT onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; }
602 virtual HRESULT onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; }
603 virtual HRESULT onVRDPServerChange() { return S_OK; }
604 virtual HRESULT onUSBControllerChange() { return S_OK; }
605 virtual HRESULT onStorageControllerChange() { return S_OK; }
606 virtual HRESULT onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
607 virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
608 virtual HRESULT onSharedFolderChange() { return S_OK; }
609
610 HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data);
611
612 int calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
613 void calculateRelativePath(const Utf8Str &strPath, Utf8Str &aResult);
614
615 void getLogFolder(Utf8Str &aLogFolder);
616
617 HRESULT openSession(IInternalSessionControl *aControl);
618 HRESULT openRemoteSession(IInternalSessionControl *aControl,
619 IN_BSTR aType, IN_BSTR aEnvironment,
620 Progress *aProgress);
621 HRESULT openExistingSession(IInternalSessionControl *aControl);
622
623#if defined(RT_OS_WINDOWS)
624
625 bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
626 ComPtr<IInternalSessionControl> *aControl = NULL,
627 HANDLE *aIPCSem = NULL, bool aAllowClosing = false);
628 bool isSessionSpawning(RTPROCESS *aPID = NULL);
629
630 bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
631 ComPtr<IInternalSessionControl> *aControl = NULL,
632 HANDLE *aIPCSem = NULL)
633 { return isSessionOpen(aMachine, aControl, aIPCSem, true /* aAllowClosing */); }
634
635#elif defined(RT_OS_OS2)
636
637 bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
638 ComPtr<IInternalSessionControl> *aControl = NULL,
639 HMTX *aIPCSem = NULL, bool aAllowClosing = false);
640
641 bool isSessionSpawning(RTPROCESS *aPID = NULL);
642
643 bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
644 ComPtr<IInternalSessionControl> *aControl = NULL,
645 HMTX *aIPCSem = NULL)
646 { return isSessionOpen(aMachine, aControl, aIPCSem, true /* aAllowClosing */); }
647
648#else
649
650 bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
651 ComPtr<IInternalSessionControl> *aControl = NULL,
652 bool aAllowClosing = false);
653 bool isSessionSpawning();
654
655 bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
656 ComPtr<IInternalSessionControl> *aControl = NULL)
657 { return isSessionOpen(aMachine, aControl, true /* aAllowClosing */); }
658
659#endif
660
661 bool checkForSpawnFailure();
662
663 HRESULT trySetRegistered(BOOL aRegistered);
664
665 HRESULT getSharedFolder(CBSTR aName,
666 ComObjPtr<SharedFolder> &aSharedFolder,
667 bool aSetError = false)
668 {
669 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
670 return findSharedFolder(aName, aSharedFolder, aSetError);
671 }
672
673 HRESULT addStateDependency(StateDependency aDepType = AnyStateDep,
674 MachineState_T *aState = NULL,
675 BOOL *aRegistered = NULL);
676 void releaseStateDependency();
677
678 // for VirtualBoxSupportErrorInfoImpl
679 static const wchar_t *getComponentName() { return L"Machine"; }
680
681protected:
682
683 HRESULT registeredInit();
684
685 HRESULT checkStateDependency(StateDependency aDepType);
686
687 Machine *getMachine();
688
689 void ensureNoStateDependencies();
690
691 virtual HRESULT setMachineState(MachineState_T aMachineState);
692
693 HRESULT findSharedFolder(CBSTR aName,
694 ComObjPtr<SharedFolder> &aSharedFolder,
695 bool aSetError = false);
696
697 HRESULT loadSettings(bool aRegistered);
698 HRESULT loadSnapshot(const settings::Snapshot &data,
699 const Guid &aCurSnapshotId,
700 Snapshot *aParentSnapshot);
701 HRESULT loadHardware(const settings::Hardware &data);
702 HRESULT loadStorageControllers(const settings::Storage &data,
703 bool aRegistered,
704 const Guid *aSnapshotId = NULL);
705 HRESULT loadStorageDevices(StorageController *aStorageController,
706 const settings::StorageController &data,
707 bool aRegistered,
708 const Guid *aSnapshotId = NULL);
709
710 HRESULT findSnapshot(const Guid &aId, ComObjPtr<Snapshot> &aSnapshot,
711 bool aSetError = false);
712 HRESULT findSnapshot(IN_BSTR aName, ComObjPtr<Snapshot> &aSnapshot,
713 bool aSetError = false);
714
715 HRESULT getStorageControllerByName(const Utf8Str &aName,
716 ComObjPtr<StorageController> &aStorageController,
717 bool aSetError = false);
718
719 HRESULT getMediumAttachmentsOfController(CBSTR aName,
720 MediaData::AttachmentList &aAttachments);
721
722 enum
723 {
724 /* flags for #saveSettings() */
725 SaveS_ResetCurStateModified = 0x01,
726 SaveS_InformCallbacksAnyway = 0x02,
727 /* flags for #saveSnapshotSettings() */
728 SaveSS_CurStateModified = 0x40,
729 SaveSS_CurrentId = 0x80,
730 /* flags for #saveStateSettings() */
731 SaveSTS_CurStateModified = 0x20,
732 SaveSTS_StateFilePath = 0x40,
733 SaveSTS_StateTimeStamp = 0x80,
734 };
735
736 HRESULT prepareSaveSettings(bool *pfNeedsGlobalSaveSettings);
737 HRESULT saveSettings(bool *pfNeedsGlobalSaveSettings, int aFlags = 0);
738
739 HRESULT saveAllSnapshots();
740
741 HRESULT saveHardware(settings::Hardware &data);
742 HRESULT saveStorageControllers(settings::Storage &data);
743 HRESULT saveStorageDevices(ComObjPtr<StorageController> aStorageController,
744 settings::StorageController &data);
745
746 HRESULT saveStateSettings(int aFlags);
747
748 HRESULT createImplicitDiffs(const Bstr &aFolder,
749 IProgress *aProgress,
750 ULONG aWeight,
751 bool aOnline,
752 bool *pfNeedsSaveSettings);
753 HRESULT deleteImplicitDiffs(bool *pfNeedsSaveSettings);
754
755 MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
756 IN_BSTR aControllerName,
757 LONG aControllerPort,
758 LONG aDevice);
759 MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
760 ComObjPtr<Medium> pMedium);
761 MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
762 Guid &id);
763
764 void commitMedia(bool aOnline = false);
765 void rollbackMedia();
766
767 bool isInOwnDir(Utf8Str *aSettingsDir = NULL);
768
769 void rollback(bool aNotify);
770 void commit();
771 void copyFrom(Machine *aThat);
772
773#ifdef VBOX_WITH_RESOURCE_USAGE_API
774 void registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);
775 void unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine);
776#endif /* VBOX_WITH_RESOURCE_USAGE_API */
777
778 Machine* const mPeer;
779
780 VirtualBox* const mParent;
781
782 uint32_t m_flModifications;
783
784 Shareable<Data> mData;
785 Shareable<SSData> mSSData;
786
787 Backupable<UserData> mUserData;
788 Backupable<HWData> mHWData;
789 Backupable<MediaData> mMediaData;
790
791 // the following fields need special backup/rollback/commit handling,
792 // so they cannot be a part of HWData
793
794 const ComObjPtr<VRDPServer> mVRDPServer;
795 const ComObjPtr<SerialPort> mSerialPorts[SchemaDefs::SerialPortCount];
796 const ComObjPtr<ParallelPort> mParallelPorts[SchemaDefs::ParallelPortCount];
797 const ComObjPtr<AudioAdapter> mAudioAdapter;
798 const ComObjPtr<USBController> mUSBController;
799 const ComObjPtr<BIOSSettings> mBIOSSettings;
800 const ComObjPtr<NetworkAdapter> mNetworkAdapters[SchemaDefs::NetworkAdapterCount];
801
802 typedef std::list< ComObjPtr<StorageController> > StorageControllerList;
803 Backupable<StorageControllerList> mStorageControllers;
804
805 friend class SessionMachine;
806 friend class SnapshotMachine;
807};
808
809// SessionMachine class
810////////////////////////////////////////////////////////////////////////////////
811
812/**
813 * @note Notes on locking objects of this class:
814 * SessionMachine shares some data with the primary Machine instance (pointed
815 * to by the |mPeer| member). In order to provide data consistency it also
816 * shares its lock handle. This means that whenever you lock a SessionMachine
817 * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
818 * instance is also locked in the same lock mode. Keep it in mind.
819 */
820class ATL_NO_VTABLE SessionMachine :
821 public VirtualBoxSupportTranslation<SessionMachine>,
822 public Machine,
823 VBOX_SCRIPTABLE_IMPL(IInternalMachineControl)
824{
825public:
826
827 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(SessionMachine)
828
829 DECLARE_NOT_AGGREGATABLE(SessionMachine)
830
831 DECLARE_PROTECT_FINAL_CONSTRUCT()
832
833 BEGIN_COM_MAP(SessionMachine)
834 COM_INTERFACE_ENTRY2(IDispatch, IMachine)
835 COM_INTERFACE_ENTRY(ISupportErrorInfo)
836 COM_INTERFACE_ENTRY(IMachine)
837 COM_INTERFACE_ENTRY(IInternalMachineControl)
838 END_COM_MAP()
839
840 DECLARE_EMPTY_CTOR_DTOR(SessionMachine)
841
842 HRESULT FinalConstruct();
843 void FinalRelease();
844
845 // public initializer/uninitializer for internal purposes only
846 HRESULT init(Machine *aMachine);
847 void uninit() { uninit(Uninit::Unexpected); }
848
849 // util::Lockable interface
850 RWLockHandle *lockHandle() const;
851
852 // IInternalMachineControl methods
853 STDMETHOD(SetRemoveSavedState)(BOOL aRemove);
854 STDMETHOD(UpdateState)(MachineState_T machineState);
855 STDMETHOD(GetIPCId)(BSTR *id);
856 STDMETHOD(SetPowerUpInfo)(IVirtualBoxErrorInfo *aError);
857 STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
858 STDMETHOD(CaptureUSBDevice)(IN_BSTR aId);
859 STDMETHOD(DetachUSBDevice)(IN_BSTR aId, BOOL aDone);
860 STDMETHOD(AutoCaptureUSBDevices)();
861 STDMETHOD(DetachAllUSBDevices)(BOOL aDone);
862 STDMETHOD(OnSessionEnd)(ISession *aSession, IProgress **aProgress);
863 STDMETHOD(BeginSavingState)(IProgress *aProgress, BSTR *aStateFilePath);
864 STDMETHOD(EndSavingState)(BOOL aSuccess);
865 STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile);
866 STDMETHOD(BeginTakingSnapshot)(IConsole *aInitiator,
867 IN_BSTR aName,
868 IN_BSTR aDescription,
869 IProgress *aConsoleProgress,
870 BOOL fTakingSnapshotOnline,
871 BSTR *aStateFilePath);
872 STDMETHOD(EndTakingSnapshot)(BOOL aSuccess);
873 STDMETHOD(DeleteSnapshot)(IConsole *aInitiator, IN_BSTR aId,
874 MachineState_T *aMachineState, IProgress **aProgress);
875 STDMETHOD(RestoreSnapshot)(IConsole *aInitiator,
876 ISnapshot *aSnapshot,
877 MachineState_T *aMachineState,
878 IProgress **aProgress);
879 STDMETHOD(PullGuestProperties)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues),
880 ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
881 STDMETHOD(PushGuestProperties)(ComSafeArrayIn(IN_BSTR, aNames), ComSafeArrayIn(IN_BSTR, aValues),
882 ComSafeArrayIn(ULONG64, aTimestamps), ComSafeArrayIn(IN_BSTR, aFlags));
883 STDMETHOD(PushGuestProperty)(IN_BSTR aName, IN_BSTR aValue,
884 ULONG64 aTimestamp, IN_BSTR aFlags);
885 STDMETHOD(LockMedia)() { return lockMedia(); }
886 STDMETHOD(UnlockMedia)() { unlockMedia(); return S_OK; }
887
888 // public methods only for internal purposes
889
890 /**
891 * Simple run-time type identification without having to enable C++ RTTI.
892 * The class IDs are defined in VirtualBoxBase.h.
893 * @return
894 */
895 virtual VBoxClsID getClassID() const
896 {
897 return clsidSessionMachine;
898 }
899
900 bool checkForDeath();
901
902 HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
903 HRESULT onStorageControllerChange();
904 HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
905 HRESULT onSerialPortChange(ISerialPort *serialPort);
906 HRESULT onParallelPortChange(IParallelPort *parallelPort);
907 HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
908 HRESULT onVRDPServerChange();
909 HRESULT onUSBControllerChange();
910 HRESULT onUSBDeviceAttach(IUSBDevice *aDevice,
911 IVirtualBoxErrorInfo *aError,
912 ULONG aMaskedIfs);
913 HRESULT onUSBDeviceDetach(IN_BSTR aId,
914 IVirtualBoxErrorInfo *aError);
915 HRESULT onSharedFolderChange();
916
917 bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
918
919private:
920
921 struct SnapshotData
922 {
923 SnapshotData() : mLastState(MachineState_Null) {}
924
925 MachineState_T mLastState;
926
927 // used when taking snapshot
928 ComObjPtr<Snapshot> mSnapshot;
929
930 // used when saving state
931 Guid mProgressId;
932 Utf8Str mStateFilePath;
933 };
934
935 struct Uninit
936 {
937 enum Reason { Unexpected, Abnormal, Normal };
938 };
939
940 struct SnapshotTask;
941 struct DeleteSnapshotTask;
942 struct RestoreSnapshotTask;
943
944 friend struct DeleteSnapshotTask;
945 friend struct RestoreSnapshotTask;
946
947 void uninit(Uninit::Reason aReason);
948
949 HRESULT endSavingState(BOOL aSuccess);
950
951 typedef std::map<ComObjPtr<Machine>, MachineState_T> AffectedMachines;
952
953 void deleteSnapshotHandler(DeleteSnapshotTask &aTask);
954 void restoreSnapshotHandler(RestoreSnapshotTask &aTask);
955
956 HRESULT lockMedia();
957 void unlockMedia();
958
959 HRESULT setMachineState(MachineState_T aMachineState);
960 HRESULT updateMachineStateOnClient();
961
962 HRESULT mRemoveSavedState;
963
964 SnapshotData mSnapshotData;
965
966 /** interprocess semaphore handle for this machine */
967#if defined(RT_OS_WINDOWS)
968 HANDLE mIPCSem;
969 Bstr mIPCSemName;
970 friend bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
971 ComPtr<IInternalSessionControl> *aControl,
972 HANDLE *aIPCSem, bool aAllowClosing);
973#elif defined(RT_OS_OS2)
974 HMTX mIPCSem;
975 Bstr mIPCSemName;
976 friend bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
977 ComPtr<IInternalSessionControl> *aControl,
978 HMTX *aIPCSem, bool aAllowClosing);
979#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
980 int mIPCSem;
981# ifdef VBOX_WITH_NEW_SYS_V_KEYGEN
982 Bstr mIPCKey;
983# endif /*VBOX_WITH_NEW_SYS_V_KEYGEN */
984#else
985# error "Port me!"
986#endif
987
988 static DECLCALLBACK(int) taskHandler(RTTHREAD thread, void *pvUser);
989};
990
991// SnapshotMachine class
992////////////////////////////////////////////////////////////////////////////////
993
994/**
995 * @note Notes on locking objects of this class:
996 * SnapshotMachine shares some data with the primary Machine instance (pointed
997 * to by the |mPeer| member). In order to provide data consistency it also
998 * shares its lock handle. This means that whenever you lock a SessionMachine
999 * instance using Auto[Reader]Lock or AutoMultiLock, the corresponding Machine
1000 * instance is also locked in the same lock mode. Keep it in mind.
1001 */
1002class ATL_NO_VTABLE SnapshotMachine :
1003 public VirtualBoxSupportTranslation<SnapshotMachine>,
1004 public Machine
1005{
1006public:
1007
1008 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(SnapshotMachine)
1009
1010 DECLARE_NOT_AGGREGATABLE(SnapshotMachine)
1011
1012 DECLARE_PROTECT_FINAL_CONSTRUCT()
1013
1014 BEGIN_COM_MAP(SnapshotMachine)
1015 COM_INTERFACE_ENTRY2(IDispatch, IMachine)
1016 COM_INTERFACE_ENTRY(ISupportErrorInfo)
1017 COM_INTERFACE_ENTRY(IMachine)
1018 END_COM_MAP()
1019
1020 DECLARE_EMPTY_CTOR_DTOR(SnapshotMachine)
1021
1022 HRESULT FinalConstruct();
1023 void FinalRelease();
1024
1025 // public initializer/uninitializer for internal purposes only
1026 HRESULT init(SessionMachine *aSessionMachine,
1027 IN_GUID aSnapshotId,
1028 const Utf8Str &aStateFilePath);
1029 HRESULT init(Machine *aMachine,
1030 const settings::Hardware &hardware,
1031 const settings::Storage &storage,
1032 IN_GUID aSnapshotId,
1033 const Utf8Str &aStateFilePath);
1034 void uninit();
1035
1036 // util::Lockable interface
1037 RWLockHandle *lockHandle() const;
1038
1039 // public methods only for internal purposes
1040
1041 /**
1042 * Simple run-time type identification without having to enable C++ RTTI.
1043 * The class IDs are defined in VirtualBoxBase.h.
1044 * @return
1045 */
1046 virtual VBoxClsID getClassID() const
1047 {
1048 return clsidSnapshotMachine;
1049 }
1050
1051 HRESULT onSnapshotChange(Snapshot *aSnapshot);
1052
1053 // unsafe inline public methods for internal purposes only (ensure there is
1054 // a caller and a read lock before calling them!)
1055
1056 const Guid& getSnapshotId() const { return mSnapshotId; }
1057
1058private:
1059
1060 Guid mSnapshotId;
1061
1062 friend class Snapshot;
1063};
1064
1065// third party methods that depend on SnapshotMachine definiton
1066
1067inline const Guid &Machine::getSnapshotId() const
1068{
1069 return getClassID() != clsidSnapshotMachine
1070 ? Guid::Empty
1071 : static_cast<const SnapshotMachine*>(this)->getSnapshotId();
1072}
1073
1074
1075#endif // ____H_MACHINEIMPL
1076/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette