MachineImpl.cpp revision a5d293b897a78df8a9bfb091399b8df2b47bea48
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * VirtualBox COM class implementation
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * Copyright (C) 2006 InnoTek Systemberatung GmbH
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * available from http://www.virtualbox.org. This file is free software;
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * General Public License as published by the Free Software Foundation,
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * If you received this file as part of a commercial VirtualBox
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * distribution, then only the terms of your commercial VirtualBox
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * license agreement apply instead of the previous paragraph.
8599686860198730ae53d5895386d1b57dbc060evboxsync#else /* !__WIN__ */
8599686860198730ae53d5895386d1b57dbc060evboxsync#endif /* !__WIN__ */
8599686860198730ae53d5895386d1b57dbc060evboxsync// defines / prototypes
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync * Local mutability check macro for Machine implementation only.
8599686860198730ae53d5895386d1b57dbc060evboxsync return setError (E_ACCESSDENIED, tr ("The machine is not mutable"));
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync * @note The template is NOT completely valid according to VBOX_XML_SCHEMA
8599686860198730ae53d5895386d1b57dbc060evboxsync * (when loading a newly created settings file, validation will be turned off)
8599686860198730ae53d5895386d1b57dbc060evboxsyncstatic const char DefaultMachineConfig[] =
8599686860198730ae53d5895386d1b57dbc060evboxsync "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" RTFILE_LINEFEED
8599686860198730ae53d5895386d1b57dbc060evboxsync "<!-- InnoTek VirtualBox Machine Configuration -->" RTFILE_LINEFEED
8599686860198730ae53d5895386d1b57dbc060evboxsync "version=\"" VBOX_XML_VERSION "-" VBOX_XML_PLATFORM "\">" RTFILE_LINEFEED
8599686860198730ae53d5895386d1b57dbc060evboxsync * Progress callback handler for lengthy operations
8599686860198730ae53d5895386d1b57dbc060evboxsync * (corresponds to the FNRTPROGRESS typedef).
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param uPercentage Completetion precentage (0-100).
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param pvUser Pointer to the Progress instance.
8599686860198730ae53d5895386d1b57dbc060evboxsyncstatic DECLCALLBACK(int) progressCallback (unsigned uPercentage, void *pvUser)
8599686860198730ae53d5895386d1b57dbc060evboxsync Progress *progress = static_cast <Progress *> (pvUser);
8599686860198730ae53d5895386d1b57dbc060evboxsync /* update the progress object */
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync// Machine::Data structure
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync /* mUuid is initialized in Machine::init() */
8599686860198730ae53d5895386d1b57dbc060evboxsync mLastStateChange = RTTimeSpecGetMilli (RTTimeNow (&time));
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync// Machine::UserData structure
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync /* default values for a newly created machine */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* mName, mOSType, mSnapshotFolder, mSnapshotFolderFull are initialized in
8599686860198730ae53d5895386d1b57dbc060evboxsync * Machine::init() */
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync// Machine::HWData structure
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync /* default values for a newly created machine */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* default boot order: floppy - DVD - HDD */
8599686860198730ae53d5895386d1b57dbc060evboxsyncbool Machine::HWData::operator== (const HWData &that) const
8599686860198730ae53d5895386d1b57dbc060evboxsync if (this == &that)
8599686860198730ae53d5895386d1b57dbc060evboxsync return true;
8599686860198730ae53d5895386d1b57dbc060evboxsync return false;
8599686860198730ae53d5895386d1b57dbc060evboxsync for (size_t i = 0; i < ELEMENTS (mBootOrder); ++ i)
8599686860198730ae53d5895386d1b57dbc060evboxsync return false;
8599686860198730ae53d5895386d1b57dbc060evboxsync if (mSharedFolders.size() != that.mSharedFolders.size())
8599686860198730ae53d5895386d1b57dbc060evboxsync return false;
8599686860198730ae53d5895386d1b57dbc060evboxsync return true;
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Make copies to speed up comparison */
8599686860198730ae53d5895386d1b57dbc060evboxsync SharedFolderList thatFolders = that.mSharedFolders;
8599686860198730ae53d5895386d1b57dbc060evboxsync bool found = false;
8599686860198730ae53d5895386d1b57dbc060evboxsync SharedFolderList::iterator thatIt = thatFolders.begin();
8599686860198730ae53d5895386d1b57dbc060evboxsync return false;
8599686860198730ae53d5895386d1b57dbc060evboxsync Assert (folders.size() == 0 && thatFolders.size() == 0);
8599686860198730ae53d5895386d1b57dbc060evboxsync return true;
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync// Machine::HDData structure
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync /* default values for a newly created machine */
8599686860198730ae53d5895386d1b57dbc060evboxsyncbool Machine::HDData::operator== (const HDData &that) const
8599686860198730ae53d5895386d1b57dbc060evboxsync if (this == &that)
8599686860198730ae53d5895386d1b57dbc060evboxsync return true;
8599686860198730ae53d5895386d1b57dbc060evboxsync if (mHDAttachments.size() != that.mHDAttachments.size())
8599686860198730ae53d5895386d1b57dbc060evboxsync return false;
8599686860198730ae53d5895386d1b57dbc060evboxsync return true;
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Make copies to speed up comparison */
8599686860198730ae53d5895386d1b57dbc060evboxsync bool found = false;
8599686860198730ae53d5895386d1b57dbc060evboxsync HDAttachmentList::iterator thatIt = thatAtts.begin();
8599686860198730ae53d5895386d1b57dbc060evboxsync if ((*it)->deviceNumber() == (*thatIt)->deviceNumber() &&
8599686860198730ae53d5895386d1b57dbc060evboxsync (*it)->hardDisk().equalsTo ((*thatIt)->hardDisk()))
8599686860198730ae53d5895386d1b57dbc060evboxsync return false;
8599686860198730ae53d5895386d1b57dbc060evboxsync return true;
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync// Machine class
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync// constructor / destructor
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsync * Initializes the instance.
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param aParent Associated parent object
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param aConfigFile Local file system path to the VM settings file (can
8599686860198730ae53d5895386d1b57dbc060evboxsync * be relative to the VirtualBox config directory).
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param aMode Init_New, Init_Existing or Init_Registered
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param aName name for the machine when aMode is Init_New
8599686860198730ae53d5895386d1b57dbc060evboxsync * (ignored otherwise)
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param aNameSync |TRUE| to authomatically sync settings dir and file
8599686860198730ae53d5895386d1b57dbc060evboxsync * name with the machine name. |FALSE| is used for legacy
8599686860198730ae53d5895386d1b57dbc060evboxsync * machines where the file name is specified by the
8599686860198730ae53d5895386d1b57dbc060evboxsync * user and should never change. Used only in Init_New
8599686860198730ae53d5895386d1b57dbc060evboxsync * mode (ignored otherwise).
8599686860198730ae53d5895386d1b57dbc060evboxsync * @param aId UUID of the machine (used only for consistency
8599686860198730ae53d5895386d1b57dbc060evboxsync * check when aMode is Init_Registered; must match UUID
8599686860198730ae53d5895386d1b57dbc060evboxsync * stored in the settings file).
8599686860198730ae53d5895386d1b57dbc060evboxsync * @return Success indicator. if not S_OK, the machine object is invalid
8599686860198730ae53d5895386d1b57dbc060evboxsyncHRESULT Machine::init (VirtualBox *aParent, const BSTR aConfigFile,
8599686860198730ae53d5895386d1b57dbc060evboxsync LogFlowThisFunc (("aConfigFile='%ls', aMode=%d\n", aConfigFile, aMode));
8599686860198730ae53d5895386d1b57dbc060evboxsync AssertReturn (aMode != Init_New || (aName != NULL && *aName != '\0'),
8599686860198730ae53d5895386d1b57dbc060evboxsync AssertReturn (aMode != Init_Registered || aId != NULL, E_FAIL);
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Enclose the state transition NotReady->InInit->Ready */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* share the parent weakly */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* register with parent early, since uninit() will unconditionally
8599686860198730ae53d5895386d1b57dbc060evboxsync * unregister on failure */
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsync /* create machine data structures */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* memorize the config file name (as provided) */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* get the full file name */
8599686860198730ae53d5895386d1b57dbc060evboxsync int vrc = RTPathAbsEx (mParent->homeDir(), Utf8Str (aConfigFile),
8599686860198730ae53d5895386d1b57dbc060evboxsync /* lock the settings file */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* If the machine is registered, then, instead of returning a
8599686860198730ae53d5895386d1b57dbc060evboxsync * failure, we mark it as inaccessible and set the result to
8599686860198730ae53d5895386d1b57dbc060evboxsync * success to give it a try later */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* fetch the current error info */
8599686860198730ae53d5895386d1b57dbc060evboxsync LogWarning (("Machine {%Vuuid} is inaccessible! [%ls]\n",
8599686860198730ae53d5895386d1b57dbc060evboxsync /* check for the file existence */
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync int vrc = RTFileOpen (&f, configFileFull, RTFILE_O_READ);
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync if (VBOX_SUCCESS (vrc) || vrc == VERR_SHARING_VIOLATION)
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync tr ("Settings file '%s' already exists"), configFileFull);
8599686860198730ae53d5895386d1b57dbc060evboxsync if (vrc != VERR_FILE_NOT_FOUND && vrc != VERR_PATH_NOT_FOUND)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* initialize mOSType */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* create associated BIOS settings object */
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync /* create an associated VRDPServer object (default is disabled) */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* create an associated DVD drive object */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* create an associated floppy drive object */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* create the audio adapter object (always present, default is disabled) */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* create the USB controller object (always present, default is disabled) */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* create associated network adapter objects */
8599686860198730ae53d5895386d1b57dbc060evboxsync for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* store the supplied UUID (will be used to check for UUID consistency
8599686860198730ae53d5895386d1b57dbc060evboxsync * in loadSettings() */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* try to load settings only if the settings file is accessible */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* create the machine UUID */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* memorize the provided new machine's name */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* initialize the default snapshots folder
8599686860198730ae53d5895386d1b57dbc060evboxsync * (note: depends on the name value set above!) */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* commit all changes made during the initialization */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Confirm a successful initialization when it's the case */
8599686860198730ae53d5895386d1b57dbc060evboxsync LogFlowThisFunc (("mName='%ls', mRegistered=%RTbool, mAccessible=%RTbool "
8599686860198730ae53d5895386d1b57dbc060evboxsync "rc=%08X\n",
8599686860198730ae53d5895386d1b57dbc060evboxsync * Initializes the registered machine by loading the settings file.
8599686860198730ae53d5895386d1b57dbc060evboxsync * This method is separated from #init() in order to make it possible to
8599686860198730ae53d5895386d1b57dbc060evboxsync * retry the operation after VirtualBox startup instead of refusing to
8599686860198730ae53d5895386d1b57dbc060evboxsync * startup the whole VirtualBox server in case if the settings file of some
8599686860198730ae53d5895386d1b57dbc060evboxsync * registered VM is invalid or inaccessible.
8599686860198730ae53d5895386d1b57dbc060evboxsync * @note Must be always called from this object's write lock
8599686860198730ae53d5895386d1b57dbc060evboxsync * (unless called from #init() that doesn't need any locking).
8599686860198730ae53d5895386d1b57dbc060evboxsync * @note Locks the mUSBController method for writing.
8599686860198730ae53d5895386d1b57dbc060evboxsync * @note Subclasses must not call this method.
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Temporarily reset the registered flag in order to let setters potentially
8599686860198730ae53d5895386d1b57dbc060evboxsync * called from loadSettings() succeed (isMutable() used in all setters
8599686860198730ae53d5895386d1b57dbc060evboxsync * will return FALSE for a Machine instance if mRegistered is TRUE). */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* commit all changes made during loading the settings file */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* VirtualBox will not call trySetRegistered(), so
8599686860198730ae53d5895386d1b57dbc060evboxsync * inform the USB proxy about all attached USB filters */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* If the machine is registered, then, instead of returning a
8599686860198730ae53d5895386d1b57dbc060evboxsync * failure, we mark it as inaccessible and set the result to
8599686860198730ae53d5895386d1b57dbc060evboxsync * success to give it a try later */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* fetch the current error info */
8599686860198730ae53d5895386d1b57dbc060evboxsync LogWarning (("Machine {%Vuuid} is inaccessible! [%ls]\n",
8599686860198730ae53d5895386d1b57dbc060evboxsync /* rollback all changes */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Restore the registered flag (even on failure) */
8599686860198730ae53d5895386d1b57dbc060evboxsync * Uninitializes the instance.
8599686860198730ae53d5895386d1b57dbc060evboxsync * Called either from FinalRelease() or by the parent when it gets destroyed.
8599686860198730ae53d5895386d1b57dbc060evboxsync * @note The caller of this method must make sure that this object
8599686860198730ae53d5895386d1b57dbc060evboxsync * a) doesn't have active callers on the current thread and b) is not locked
8599686860198730ae53d5895386d1b57dbc060evboxsync * by the current thread; otherwise uninit() will hang either a) due to
8599686860198730ae53d5895386d1b57dbc060evboxsync * AutoUninitSpan waiting for a number of calls to drop to zero or b) due to
8599686860198730ae53d5895386d1b57dbc060evboxsync * a dead-lock caused by this thread waiting for all callers on the other
8599686860198730ae53d5895386d1b57dbc060evboxsync * threads are are done but preventing them from doing so by holding a lock.
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Enclose the state transition Ready->InUninit->NotReady */
8599686860198730ae53d5895386d1b57dbc060evboxsync Assert (!!mData && !!mUserData && !!mHWData && !!mHDData && !!mSSData);
8599686860198730ae53d5895386d1b57dbc060evboxsync LogFlowThisFunc (("initFailed()=%d\n", autoUninitSpan.initFailed()));
8599686860198730ae53d5895386d1b57dbc060evboxsync LogFlowThisFunc (("mRegistered=%d\n", mData->mRegistered));
8599686860198730ae53d5895386d1b57dbc060evboxsync * Enter this object's lock because there may be a SessionMachine instance
8599686860198730ae53d5895386d1b57dbc060evboxsync * somewhere around, that shares our data and lock but doesn't use our
8599686860198730ae53d5895386d1b57dbc060evboxsync * addCaller()/removeCaller(), and it may be also accessing the same
8599686860198730ae53d5895386d1b57dbc060evboxsync * data members. mParent lock is necessary as well because of
8599686860198730ae53d5895386d1b57dbc060evboxsync * SessionMachine::uninit(), etc.
8599686860198730ae53d5895386d1b57dbc060evboxsync AutoMultiLock <2> alock (mParent->wlock(), this->wlock());
8599686860198730ae53d5895386d1b57dbc060evboxsync * Theoretically, this can only happen if the VirtualBox server has
8599686860198730ae53d5895386d1b57dbc060evboxsync * been terminated while there were clients running that owned open
8599686860198730ae53d5895386d1b57dbc060evboxsync * direct sessions. Since in this case we are definitely called by
8599686860198730ae53d5895386d1b57dbc060evboxsync * VirtualBox::uninit(), we may be sure that SessionMachine::uninit()
8599686860198730ae53d5895386d1b57dbc060evboxsync * won't happen on the client watcher thread (because it does
8599686860198730ae53d5895386d1b57dbc060evboxsync * VirtualBox::addCaller() for the duration of the
8599686860198730ae53d5895386d1b57dbc060evboxsync * SessionMachine::checkForDeath() call, so that VirtualBox::uninit()
8599686860198730ae53d5895386d1b57dbc060evboxsync * cannot happen until the VirtualBox caller is released). This is
8599686860198730ae53d5895386d1b57dbc060evboxsync * important, because SessionMachine::uninit() cannot correctly operate
8599686860198730ae53d5895386d1b57dbc060evboxsync * after we return from this method (it expects the Machine instance
8599686860198730ae53d5895386d1b57dbc060evboxsync * is still valid). We'll call it ourselves below.
8599686860198730ae53d5895386d1b57dbc060evboxsync LogWarningThisFunc (("Session machine is not NULL (%p), "
8599686860198730ae53d5895386d1b57dbc060evboxsync "the direct session is still open!\n",
8599686860198730ae53d5895386d1b57dbc060evboxsync LogWarningThisFunc (("Setting state to Aborted!\n"));
8599686860198730ae53d5895386d1b57dbc060evboxsync /* set machine state using SessionMachine reimplementation */
8599686860198730ae53d5895386d1b57dbc060evboxsync * Uninitialize SessionMachine using public uninit() to indicate
8599686860198730ae53d5895386d1b57dbc060evboxsync * an unexpected uninitialization.
8599686860198730ae53d5895386d1b57dbc060evboxsync /* SessionMachine::uninit() must set mSession.mMachine to null */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* the lock is no more necessary (SessionMachine is uninitialized) */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* make sure the configuration is unlocked */
8599686860198730ae53d5895386d1b57dbc060evboxsync LogWarningThisFunc (("Discarding unsaved settings changes!\n"));
8599686860198730ae53d5895386d1b57dbc060evboxsync// IMachine properties
8599686860198730ae53d5895386d1b57dbc060evboxsync/////////////////////////////////////////////////////////////////////////////
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(Parent) (IVirtualBox **aParent)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* mParent is constant during life time, no need to lock */
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(Accessible) (BOOL *aAccessible)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* try to initialize the VM once more if not accessible */
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(AccessError) (IVirtualBoxErrorInfo **aAccessError)
8599686860198730ae53d5895386d1b57dbc060evboxsync if (mData->mAccessible || !mData->mAccessError.isBasicAvailable())
8599686860198730ae53d5895386d1b57dbc060evboxsync /* return shortly */
8599686860198730ae53d5895386d1b57dbc060evboxsync errorInfo->init (mData->mAccessError.getResultCode(),
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMSETTER(Name) (INPTR BSTR aName)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(Description) (BSTR *aDescription)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMSETTER(Description) (INPTR BSTR aDescription)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(Id) (GUIDPARAMOUT aId)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(OSType) (IGuestOSType **aOSType)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMSETTER(OSType) (IGuestOSType *aOSType)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(MemorySize) (ULONG *memorySize)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMSETTER(MemorySize) (ULONG memorySize)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* check RAM limits */
8599686860198730ae53d5895386d1b57dbc060evboxsync tr ("Invalid RAM size: %lu MB (must be in range [%lu, %lu] MB)"),
8599686860198730ae53d5895386d1b57dbc060evboxsync memorySize, SchemaDefs::MinGuestRAM, SchemaDefs::MaxGuestRAM);
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(VRAMSize) (ULONG *memorySize)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMSETTER(VRAMSize) (ULONG memorySize)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* check VRAM limits */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("Invalid VRAM size: %lu MB (must be in range [%lu, %lu] MB)"),
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync memorySize, SchemaDefs::MinGuestVRAM, SchemaDefs::MaxGuestVRAM);
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(MonitorCount) (ULONG *monitorCount)
8fa1e8a8a8702ee38195fbe7ad5959bf971eb93bvboxsyncSTDMETHODIMP Machine::COMSETTER(MonitorCount) (ULONG monitorCount)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* make sure monitor count is a sensible number */
8599686860198730ae53d5895386d1b57dbc060evboxsync if (monitorCount < 1 || monitorCount > SchemaDefs::MaxGuestMonitors)
8599686860198730ae53d5895386d1b57dbc060evboxsync tr ("Invalid monitor count: %lu (must be in range [%lu, %lu])"),
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(BIOSSettings)(IBIOSSettings **biosSettings)
8599686860198730ae53d5895386d1b57dbc060evboxsync /* mBIOSSettings is constant during life time, no need to lock */
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(HWVirtExEnabled)(TriStateBool_T *enabled)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMSETTER(HWVirtExEnabled)(TriStateBool_T enable)
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync /** @todo check validity! */
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(SnapshotFolder) (BSTR *aSnapshotFolder)
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync mUserData->mSnapshotFolderFull.cloneTo (aSnapshotFolder);
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMSETTER(SnapshotFolder) (INPTR BSTR aSnapshotFolder)
8599686860198730ae53d5895386d1b57dbc060evboxsync /// @todo (r=dmik):
8599686860198730ae53d5895386d1b57dbc060evboxsync // 1. Allow to change the name of the snapshot folder containing snapshots
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync // 2. Rename the folder on disk instead of just changing the property
8599686860198730ae53d5895386d1b57dbc060evboxsync // value (to be smart and not to leave garbage). Note that it cannot be
8599686860198730ae53d5895386d1b57dbc060evboxsync // done here because the change may be rolled back. Thus, the right
8599686860198730ae53d5895386d1b57dbc060evboxsync // place is #saveSettings().
8599686860198730ae53d5895386d1b57dbc060evboxsync tr ("The snapshot folder of a machine with snapshots cannot "
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync "be changed (please discard all snapshots first)"));
8599686860198730ae53d5895386d1b57dbc060evboxsync /* the default snapshots folder is 'Snapshots' in the machine dir */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* the default snapshots folder is {UUID}, for backwards
8599686860198730ae53d5895386d1b57dbc060evboxsync * compatibility and to resolve conflicts */
8599686860198730ae53d5895386d1b57dbc060evboxsync snapshotFolder = Utf8StrFmt ("{%Vuuid}", mData->mUuid.raw());
8599686860198730ae53d5895386d1b57dbc060evboxsync int vrc = calculateFullPath (snapshotFolder, snapshotFolder);
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsyncSTDMETHODIMP Machine::COMGETTER(HardDiskAttachments) (IHardDiskAttachmentCollection **attachments)
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsync ComObjPtr <HardDiskAttachmentCollection> collection;
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsyncSTDMETHODIMP Machine::COMGETTER(VRDPServer)(IVRDPServer **vrdpServer)
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsyncSTDMETHODIMP Machine::COMGETTER(DVDDrive) (IDVDDrive **dvdDrive)
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsyncSTDMETHODIMP Machine::COMGETTER(FloppyDrive) (IFloppyDrive **floppyDrive)
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsyncSTDMETHODIMP Machine::COMGETTER(AudioAdapter)(IAudioAdapter **audioAdapter)
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsyncSTDMETHODIMP Machine::COMGETTER(USBController)(IUSBController * *a_ppUSBController)
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync HRESULT rc = mParent->host()->checkUSBProxyService();
8599686860198730ae53d5895386d1b57dbc060evboxsync mUSBController.queryInterfaceTo (a_ppUSBController);
8599686860198730ae53d5895386d1b57dbc060evboxsync /* Note: The GUI depends on this method returning E_NOTIMPL with no
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync * extended error info to indicate that USB is simply not available
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsync * (w/o treting it as a failure), for example, as in OSE */
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(SettingsFilePath) (BSTR *filePath)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(SettingsModified) (BOOL *modified)
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsync * if we're ready and isConfigLocked() is FALSE then it means
b9609c7ffe24b4438bca69c315a3d280decd83d1vboxsync * that no config file exists yet, so always return TRUE
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsyncSTDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T *aSessionState)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(SessionType) (BSTR *aSessionType)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(SessionPid) (ULONG *aSessionPid)
2cae8ff5782536dc236e1161d351356ba2ac5e0fvboxsyncSTDMETHODIMP Machine::COMGETTER(State) (MachineState_T *machineState)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncSTDMETHODIMP Machine::COMGETTER(LastStateChange) (LONG64 *aLastStateChange)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(StateFilePath) (BSTR *aStateFilePath)
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(CurrentSnapshot) (ISnapshot **aCurrentSnapshot)
8599686860198730ae53d5895386d1b57dbc060evboxsync mData->mCurrentSnapshot.queryInterfaceTo (aCurrentSnapshot);
8599686860198730ae53d5895386d1b57dbc060evboxsyncSTDMETHODIMP Machine::COMGETTER(SnapshotCount) (ULONG *aSnapshotCount)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync mData->mFirstSnapshot->descendantCount() + 1 /* self */;
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncSTDMETHODIMP Machine::COMGETTER(CurrentStateModified) (BOOL *aCurrentStateModified)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * Note: for machines with no snapshots, we always return FALSE
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * (mData->mCurrentStateModified will be TRUE in this case, for historical
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * reasons :)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync *aCurrentStateModified = !mData->mFirstSnapshot ? FALSE :
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncMachine::COMGETTER(SharedFolders) (ISharedFolderCollection **aSharedFolders)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncMachine::COMGETTER(ClipboardMode) (ClipboardMode_T *aClipboardMode)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncMachine::COMSETTER(ClipboardMode) (ClipboardMode_T aClipboardMode)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync// IMachine methods
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync/////////////////////////////////////////////////////////////////////////////
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncSTDMETHODIMP Machine::SetBootOrder (ULONG aPosition, DeviceType_T aDevice)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("Invalid boot position: %lu (must be in range [1, %lu])"),
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("Booting from USB devices is not currently supported"));
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncSTDMETHODIMP Machine::GetBootOrder (ULONG aPosition, DeviceType_T *aDevice)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("Invalid boot position: %lu (must be in range [1, %lu])"),
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncSTDMETHODIMP Machine::AttachHardDisk (INPTR GUIDPARAM aId,
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("Cannot attach hard disks to an unregistered machine"));
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync AssertReturn (mData->mMachineState != MachineState_Saved, E_FAIL);
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("Invalid machine state: %d"), mData->mMachineState);
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync /* see if the device on the controller is already busy */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync for (HDData::HDAttachmentList::const_iterator it = mHDData->mHDAttachments.begin();
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync if (hda->controller() == aCtl && hda->deviceNumber() == aDev)
8599686860198730ae53d5895386d1b57dbc060evboxsync tr ("Hard disk '%ls' is already attached to device slot %d "
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync "on controller %d"),
8599686860198730ae53d5895386d1b57dbc060evboxsync /* find a hard disk by UUID */
8599686860198730ae53d5895386d1b57dbc060evboxsync tr ("Cannot attach the differencing hard disk '%ls'"),
8599686860198730ae53d5895386d1b57dbc060evboxsync bool dirty = false;
7748b9362d6a39df9045d5d05ccb57871145a649vboxsync * increase readers to protect from unregistration
7748b9362d6a39df9045d5d05ccb57871145a649vboxsync * until rollback()/commit() is done
7748b9362d6a39df9045d5d05ccb57871145a649vboxsync Log3 (("A: %ls proteced\n", hd->toString().raw()));
8599686860198730ae53d5895386d1b57dbc060evboxsync /* fall through */
8599686860198730ae53d5895386d1b57dbc060evboxsync /* attach directly */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync /* determine what the hard disk is already attached to */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync /* attached to some VM in its current state */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * attached to us, either in the backed up list of the
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * attachments or in the current one; the former is ok
d4162288035439690deb3175bc2ca74a015e325bvboxsync * (reattachment takes place within the same
d4162288035439690deb3175bc2ca74a015e325bvboxsync * "transaction") the latter is an error so check for it
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync "currently attached to device slot %d "
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync "on controller %d of this machine"),
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * dirty = false to indicate we didn't set machineId
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * and prevent it from being reset in DetachHardDisk()
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync Log3 (("A: %ls found in old\n", hd->toString().raw()));
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync /* attached to other VM */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync "currently attached to a machine with "
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync "UUID {%Vuuid}"),
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * here we go when the HardDiskType_NormalHardDisk
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * is attached to some VM (probably to this one, too)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * at some particular snapshot, so we can create a diff
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * based on it
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * increase readers to protect from unregistration
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * until rollback()/commit() is done
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync Log3 (("A: %ls proteced\n", hd->toString().raw()));
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync Log3 (("A: %ls attached\n", hd->toString().raw()));
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync /* note: diff images are actually created only in commit() */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncSTDMETHODIMP Machine::GetHardDisk (DiskControllerType_T aCtl,
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync if (aCtl == DiskControllerType_InvalidController ||
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync for (HDData::HDAttachmentList::const_iterator it = mHDData->mHDAttachments.begin();
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync if (hda->controller() == aCtl && hda->deviceNumber() == aDev)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("No hard disk attached to device slot %d on controller %d"),
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsyncSTDMETHODIMP Machine::DetachHardDisk (DiskControllerType_T aCtl, LONG aDev)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync if (aCtl == DiskControllerType_InvalidController ||
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync AssertReturn (mData->mMachineState != MachineState_Saved, E_FAIL);
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("Invalid machine state: %d"), mData->mMachineState);
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync for (HDData::HDAttachmentList::iterator it = mHDData->mHDAttachments.begin();
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync if (hda->controller() == aCtl && hda->deviceNumber() == aDev)
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync /* decrease readers increased in AttachHardDisk() */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync Log3 (("D: %ls released\n", hd->toString().raw()));
7748b9362d6a39df9045d5d05ccb57871145a649vboxsync /* deassociate from this machine */
7748b9362d6a39df9045d5d05ccb57871145a649vboxsync Log3 (("D: %ls deassociated\n", hd->toString().raw()));
7748b9362d6a39df9045d5d05ccb57871145a649vboxsync /* deassociate from this machine */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync Log3 (("D: %ls deassociated\n", hd->toString().raw()));
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync /* decrease readers increased in AttachHardDisk() */
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * we cannot use erase (it) below because backup() above will create
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * a copy of the list and make this copy active, but the iterator
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * still refers to the original and is not valid for a copy
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync Log3 (("D: %ls detached\n", hd->toString().raw()));
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * note: Non-dirty hard disks are actually deassociated
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync * and diff images are deleted only in commit()
7bf0220c3332700233120b513c9b4ba20a0caa9bvboxsync tr ("No hard disk attached to device slot %d on controller %d"),
if (!adapter)
return E_POINTER;
return S_OK;
if (!nextKey)
return E_POINTER;
if (!isConfigLocked())
return S_OK;
return E_FAIL;
bool found = false;
unsigned count;
if (nextValue)
found = true;
found = true;
if (nextValue)
found = true;
if (!found)
return rc;
if (!key)
return E_INVALIDARG;
if (!value)
return E_POINTER;
if (!isConfigLocked())
return S_OK;
return E_FAIL;
bool found = false;
unsigned count;
found = true;
return rc;
if (!key)
return E_INVALIDARG;
CHECK_SETTER();
bool changed = false;
if (!isConfigLocked())
return rc;
return rc;
if (extraDataNode)
unsigned count;
for (unsigned i = 0; i < count; i++)
extraDataItemNode = 0;
if (changed)
if (value)
if (!extraDataItemNode)
extraDataItemNode = 0;
if (extraDataItemNode)
return rc;
CHECK_SETTER();
return saveSettings();
CHECK_SETTER();
return S_OK;
CHECK_SETTER();
if (isConfigLocked())
unlockConfig();
return S_OK;
if (!aSnapshot)
return E_POINTER;
return rc;
if (!aName)
return E_INVALIDARG;
if (!aSnapshot)
return E_POINTER;
return rc;
return E_INVALIDARG;
CHECK_SETTER();
return rc;
return rc;
if (!accessible)
return S_OK;
if (!aName)
return E_INVALIDARG;
CHECK_SETTER();
return rc;
return S_OK;
return sm;
return sm;
return vrc;
* Machine/SessionMachine methods. Leaving the lock here is quite safe
return rc;
#ifdef VBOX_VRDP
#ifdef __WIN__
#ifdef __WIN__
return S_OK;
return S_OK;
uninit();
return S_OK;
if (aRegistered)
if (snapshotCount)
return S_OK;
if (mUSBController)
if (mAudioAdapter)
if (mFloppyDrive)
if (mDVDDrive)
#ifdef VBOX_VRDP
if (mVRDPServer)
if (mBIOSSettings)
return S_OK;
bool found = false;
++ it)
if (found)
return rc;
&loaderError);
if (loaderError)
return rc;
bool nameSync = true;
if (descNode)
if (stateFilePath)
if (lastStateChange == 0)
bool aborted = false;
bool val = true;
if (snapshotNode)
if (aborted)
if (machineNode)
return rc;
if (stateFilePath)
return rc;
if (descNode)
return rc;
if (snapshotsNode)
unsigned cbDisks = 0;
return rc;
if (cpuNode)
if (hwVirtExNode)
unsigned cOrder;
for (unsigned i = 0; i < cOrder; i++)
-- position;
return rc;
#ifdef VBOX_VRDP
if (remoteDisplayNode)
bool enabled;
if (ioapicNode)
bool enabled;
if (logoNode)
bool enabled = false;
if (bootMenuNode)
return rc;
bool fPassthrough;
if (typeNode)
if (typeNode)
if (typeNode)
return rc;
if (typeNode)
if (typeNode)
if (typeNode)
return rc;
return rc;
unsigned cAdapters = 0;
for (unsigned i = 0; i < cAdapters; i++)
bool enabled = false;
bool cableConnected;
bool traceEnabled;
#ifdef __WIN__
if (attachmentNode)
return rc;
bool enabled = false;
#ifdef __WIN__
#ifdef VBOX_WITH_WINMM
#ifdef __LINUX__
#ifdef VBOX_WITH_ALSA
#ifdef __DARWIN__
if (!sharedFoldersNode)
unsigned cFolders = 0;
for (unsigned i = 0; i < cFolders; i++)
return rc;
if (clipNode)
return S_OK;
unsigned cbDisks = 0;
dev = 0;
return rc;
NULL);
return S_OK;
if (aSaveBeforeClose)
if (loaderError)
return rc;
if (aSnapshotsNode)
*aSnapshotsNode = 0;
*aSnapshotNode = 0;
while (parent)
++ it)
if (snapshotNode)
snapshotsNode = 0;
snapshotNode = 0;
unsigned count = 0, i = 0;
for (; i < count; ++ i)
snapshotNode = 0;
snapshotNode = 0;
if (i == count)
AssertFailed();
snapshotsNode = 0;
if (aSnapshotsNode)
return S_OK;
if (aSetError)
return E_FAIL;
if (!aSnapshot)
if (aSetError)
return E_FAIL;
return S_OK;
if (aSetError)
return E_FAIL;
if (!aSnapshot)
if (aSetError)
return E_FAIL;
return S_OK;
++ it)
return S_OK;
return E_FAIL;
aRenamed = false;
aRenamed = true;
if (!aNew)
bool dirRenamed = false;
bool fileRenamed = false;
if (!aNew)
dirRenamed = true;
if (!aNew)
fileRenamed = true;
if (fileRenamed)
if (dirRenamed)
if (!aNew)
if (aNew)
(void *) DefaultMachineConfig,
return rc;
bool wasModified;
bool isRenamed = false;
bool isNew = false;
return rc;
if (descNode)
if (hwNode)
hwNode = 0;
if (hdasNode)
hdasNode = 0;
if (updateAllSnapshots)
if (machineNode)
return rc;
return rc;
return rc;
E_FAIL);
bool recreateWholeTree = false;
if (snapshotNode)
recreateWholeTree = true;
if (parent)
if (parentNode)
if (hdasNode)
if (parentNode)
if (!recreateWholeTree)
if (!snapshotsNode)
if (snapshotNode)
snapshotNode = 0;
return rc;
if (!aAttrsOnly)
if (descNode)
if (aAttrsOnly)
return S_OK;
return rc;
return rc;
++ it)
return rc;
return S_OK;
case TriStateBool_False:
case TriStateBool_True:
case DeviceType_NoDevice:
return rc;
#ifdef VBOX_VRDP
if (remoteDisplayNode)
if (logoPath)
switch (bootMenuMode)
case DriveState_ImageMounted:
case DriveState_NotMounted:
return rc;
case DriveState_ImageMounted:
case DriveState_NotMounted:
return rc;
return rc;
#ifdef __WIN__
if (attachmentNode)
return rc;
#ifdef __WIN__
#ifdef VBOX_WITH_WINMM
#ifdef __LINUX__
#ifdef VBOX_WITH_ALSA
#ifdef __DARWIN__
return rc;
++ it)
return rc;
++ it)
return rc;
if (aFlags == 0)
return S_OK;
return rc;
if (machineNode)
return rc;
++ it)
return S_OK;
return S_OK;
if (aCommit)
++ it)
* there to prevent it from being deassociated/deleted
bool needDiff = false;
bool searchAmongSnapshots = false;
needDiff = true;
needDiff = true;
searchAmongSnapshots = true;
if (!needDiff)
bool createDiff = false;
++ it)
bool canReuse = true;
++ it2)
canReuse = false;
if (canReuse)
createDiff = true;
if (!createDiff)
if (searchAmongSnapshots)
while (snap)
return rc;
return rc;
++ it)
return S_OK;
bool aOnline)
if (!aOnline)
++ it)
++ it)
if (aOnline)
if (!aOnline)
if (aOnline)
if (aOnline)
++ it)
return rc;
return S_OK;
++ it)
return rc;
if (!isConfigLocked())
return rc;
if (isConfigLocked())
return rc;
if (aSettingsDir)
#ifdef VBOX_VRDP
//mHDData.hasActualChanges() ||
#ifdef VBOX_VRDP
usbChanged = false;
if (mBIOSSettings)
#ifdef VBOX_VRDP
if (mVRDPServer)
if (mDVDDrive)
if (mFloppyDrive)
if (mAudioAdapter)
if (mUSBController)
if (aNotify)
if (vrdpChanged)
if (dvdChanged)
if (floppyChanged)
if (usbChanged)
#ifdef VBOX_VRDP
return rc;
++ it)
#ifdef VBOX_VRDP
virtual void handler() = 0;
: Task (m, p)
, snapshot (s) {}
, snapshot (s) {}
bool discardCurSnapshot)
const bool discardCurrentSnapshot;
#if defined(__WIN__)
return S_OK;
#if defined(__WIN__)
E_FAIL);
E_FAIL);
E_FAIL);
#ifdef VBOX_VRDP
return S_OK;
* mData->mSession.mMachine.setNull() below (which can release the last
#if defined(__WIN__)
if (mIPCSem)
if (mIPCSem >= 0)
if (isModified())
++ it;
#if defined(__WIN__)
if (mIPCSem)
if (mIPCSem >= 0)
#if defined(__WIN__)
return S_OK;
return S_OK;
return S_FAIL;
return S_OK;
if (!aUSBDevice)
return E_INVALIDARG;
if (!aMatched)
return E_POINTER;
return S_OK;
if (!aHostDevice)
return E_POINTER;
++it;
return S_OK;
E_FAIL);
return S_OK;
E_FAIL);
if (aSuccess)
E_FAIL);
++ it)
if (stateFilePath)
opCount ++;
if (takingSnapshotOnline)
if (takingSnapshotOnline)
(void *) task,
delete task;
if (takingSnapshotOnline)
return S_OK;
E_FAIL);
if (isModified())
(void *) task,
delete task;
return S_OK;
++ opCount;
(void *) task,
delete task;
return S_OK;
if (prevSnapshot)
++ opCount;
++ opCount;
(void *) task,
delete task;
return S_OK;
bool doUninit = false;
bool rc = false;
#if defined(__WIN__)
doUninit = true;
rc = true;
if (val > 0)
doUninit = true;
if (doUninit)
return rc;
if (!directControl)
return S_OK;
if (!directControl)
return S_OK;
if (!directControl)
return S_OK;
if (!directControl)
return S_OK;
if (!directControl)
return S_OK;
if (!directControl)
return S_OK;
if (!directControl)
return S_OK;
if (aSuccess)
return rc;
if (aSuccess)
return rc;
* When aTask.subTask is true, the associated progress object is left
++ it)
++ it)
if (parent)
if (!cs)
!parentSnapshot ||
if (stateFilePath)
if (isModified())
bool errorInSubtask = false;
bool stateRestored = false;
errorInSubtask = true;
* note: old VDIs will be deassociated/deleted on #commit() called
bool informCallbacks = false;
errorInSubtask = true;
informCallbacks = true;
stateRestored = true;
if (errorInSubtask)
if (!stateRestored)
saveSettings();
if (!errorInSubtask)
int stsFlags = 0;
bool deleteSavedState = false;
++ it)
++ it)
deleteSavedState = true;
deleteSavedState = true;
if (deleteSavedState == true)
return rc;
return S_OK;
delete task;
return S_OK;
uninit();
++ it)
#ifdef VBOX_VRDP
return S_OK;
#ifdef VBOX_VRDP
commit();
return rc;
return S_OK;