Settings.cpp revision bdb01608062958ff140a733533f3d6574886c831
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Settings File Manipulation API.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Two classes, MainConfigFile and MachineConfigFile, represent the VirtualBox.xml and
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * machine XML files. They share a common ancestor class, ConfigFileBase, which shares
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * functionality such as talking to the XML back-end classes and settings version management.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * The code can read all VirtualBox settings files version 1.3 and higher. That version was
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * written by VirtualBox 2.0. It can write settings version 1.7 (used by VirtualBox 2.2 and
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * 3.0) and 1.9 (used by VirtualBox 3.1) and newer ones obviously.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * The settings versions enum is defined in src/VBox/Main/idl/VirtualBox.xidl. To introduce
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * a new settings version (should be necessary at most once per VirtualBox major release,
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * if at all), add a new SettingsVersion value to that enum and grep for the previously
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * highest value to see which code in here needs adjusting.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Certainly ConfigFileBase::ConfigFileBase() will. Change VBOX_XML_VERSION below as well.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * VBOX_XML_VERSION does not have to be changed if the settings for a default VM do not
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * touch newly introduced attributes or tags. It has the benefit that older VirtualBox
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * versions do not trigger their "newer" code path.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Once a new settings version has been added, these are the rules for introducing a new
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * setting: If an XML element or attribute or value is introduced that was not present in
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * previous versions, then settings version checks need to be introduced. See the
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * SettingsVersion enumeration in src/VBox/Main/idl/VirtualBox.xidl for details about which
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * version was used when.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * The settings versions checks are necessary because since version 3.1, VirtualBox no longer
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * automatically converts XML settings files but only if necessary, that is, if settings are
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * present that the old format does not support. If we write an element or attribute to a
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * settings file of an older version, then an old VirtualBox (before 3.1) will attempt to
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * validate it with XML schema, and that will certainly fail.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * So, to introduce a new setting:
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * 1) Make sure the constructor of corresponding settings structure has a proper default.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * 2) In the settings reader method, try to read the setting; if it's there, great, if not,
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * the default value will have been set by the constructor. The rule is to be tolerant
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * 3) In MachineConfigFile::bumpSettingsVersionIfNeeded(), check if the new setting has
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * a non-default value (i.e. that differs from the constructor). If so, bump the
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * settings version to the current version so the settings writer (4) can write out
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * the non-default value properly.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * So far a corresponding method for MainConfigFile has not been necessary since there
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * have been no incompatible changes yet.
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * 4) In the settings writer method, write the setting _only_ if the current settings
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * version (stored in m->sv) is high enough. That is, for VirtualBox 4.0, write it
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * only if (m->sv >= SettingsVersion_v1_11).
80626cd34607c5dbf3f0af51b32396ce58bf493bvboxsync * Copyright (C) 2007-2013 Oracle Corporation
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * available from http://www.virtualbox.org. This file is free software;
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * you can redistribute it and/or modify it under the terms of the GNU
710a6316a22868b04400caf79719f96c18163cd3vboxsync * General Public License (GPL) as published by the Free Software
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync// generated header
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsyncusing namespace com;
fb1975a6972d89de9e515bed0248db93f04ec9d8vboxsyncusing namespace settings;
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync////////////////////////////////////////////////////////////////////////////////
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync////////////////////////////////////////////////////////////////////////////////
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync/** VirtualBox XML settings namespace */
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync#define VBOX_XML_NAMESPACE "http://www.innotek.de/VirtualBox-settings"
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync/** VirtualBox XML settings version number substring ("x.y") */
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync/** VirtualBox XML settings version platform substring */
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync/** VirtualBox XML settings full version string ("x.y-platform") */
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync#define VBOX_XML_VERSION_FULL VBOX_XML_VERSION "-" VBOX_XML_PLATFORM
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync////////////////////////////////////////////////////////////////////////////////
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync// Internal data
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync////////////////////////////////////////////////////////////////////////////////
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Opaque data structore for ConfigFileBase (only declared
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * in header, defined only here).
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync com::Utf8Str strSettingsVersionFull; // e.g. "1.7-linux"
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync SettingsVersion_T svRead; // settings version that the original file had when it was read,
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // or SettingsVersion_Null if none
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Private exception class (not in the header file) that makes
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * throwing xml::LogicError instances easier. That class is public
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync * and should be caught by client code.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsyncclass settings::ConfigFileError : public xml::LogicError
5f2909f8dd32d40a7e87f636c1a7c9de674be94bvboxsync const char *pcszFormat, ...)
2ca0ef39e90f953a6517aa2a658146c70485425dvboxsync strLine = Utf8StrFmt(" (line %RU32)", pNode->getLineNumber());
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync////////////////////////////////////////////////////////////////////////////////
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync// MediaRegistry
a771f44b96a464259788456c0c68e049e7588066vboxsync////////////////////////////////////////////////////////////////////////////////
a771f44b96a464259788456c0c68e049e7588066vboxsync && (llChildren== m.llChildren); // this is deep and recurses
a771f44b96a464259788456c0c68e049e7588066vboxsyncbool MediaRegistry::operator==(const MediaRegistry &m) const
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync////////////////////////////////////////////////////////////////////////////////
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync// ConfigFileBase
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync////////////////////////////////////////////////////////////////////////////////
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * Constructor. Allocates the XML internals, parses the XML file if
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * pstrFilename is != NULL and reads the settings version from it.
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync * @param strFilename
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsyncConfigFileBase::ConfigFileBase(const com::Utf8Str *pstrFilename)
41b3442e21c3a79f3bc61ce67e3445757a83f281vboxsync // reading existing settings file:
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync if (!m->pelmRoot || !m->pelmRoot->nameEquals("VirtualBox"))
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync throw ConfigFileError(this, NULL, N_("Root element in VirtualBox settings files must be \"VirtualBox\"."));
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync if (!(m->pelmRoot->getAttributeValue("version", m->strSettingsVersionFull)))
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync throw ConfigFileError(this, m->pelmRoot, N_("Required VirtualBox/@version attribute is missing"));
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync LogRel(("Loading settings file \"%s\" with version \"%s\"\n", m->strFilename.c_str(), m->strSettingsVersionFull.c_str()));
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync // parse settings version; allow future versions but fail if file is older than 1.6
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync const char *pcsz = m->strSettingsVersionFull.c_str();
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync while ( (c = *pcsz)
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync while ( (c = *pcsz)
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync uint32_t ulMajor = RTStrToUInt32(strMajor.c_str());
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync uint32_t ulMinor = RTStrToUInt32(strMinor.c_str());
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync Log(("Parsed settings version %d.%d to enum value %d\n", ulMajor, ulMinor, m->sv));
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync throw ConfigFileError(this, m->pelmRoot, N_("Cannot handle settings version '%s'"), m->strSettingsVersionFull.c_str());
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync // remember the settings version we read in case it gets upgraded later,
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync // so we know when to make backups
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync // creating new settings file:
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsyncConfigFileBase::ConfigFileBase(const ConfigFileBase &other)
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync * Clean up.
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync * Helper function that parses a UUID in string form into
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsync * a com::Guid item. Accepts UUIDs both with and without
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * "{}" brackets. Throws on errors.
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * @param guid
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * @param strUUID
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync throw ConfigFileError(this, NULL, N_("UUID \"%s\" has zero format"), strUUID.c_str());
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync throw ConfigFileError(this, NULL, N_("UUID \"%s\" has invalid format"), strUUID.c_str());
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync * Parses the given string in str and attempts to treat it as an ISO
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync * date/time stamp to put into timestamp. Throws on errors.
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync * @param timestamp
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync * @param str
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsyncvoid ConfigFileBase::parseTimestamp(RTTIMESPEC ×tamp,
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync // yyyy-mm-ddThh:mm:ss
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync // "2009-07-10T11:54:03Z"
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync // 01234567890123456789
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync // timezone must either be unspecified or 'Z' for UTC
ba05e6aeed3cd14961a36e0162c29a267b66d7f7vboxsync throw ConfigFileError(this, NULL, N_("Cannot handle ISO timestamp '%s': is not UTC date"), str.c_str());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if ( (RT_SUCCESS(rc = RTStrToInt32Ex(pcsz, NULL, 0, &yyyy)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // could theoretically be negative but let's assume that nobody
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // created virtual machines before the Christian era
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && (RT_SUCCESS(rc = RTStrToUInt32Ex(pcsz + 5, NULL, 0, &mm)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && (RT_SUCCESS(rc = RTStrToUInt32Ex(pcsz + 8, NULL, 0, &dd)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && (RT_SUCCESS(rc = RTStrToUInt32Ex(pcsz + 11, NULL, 0, &hh)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && (RT_SUCCESS(rc = RTStrToUInt32Ex(pcsz + 14, NULL, 0, &min)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && (RT_SUCCESS(rc = RTStrToUInt32Ex(pcsz + 17, NULL, 0, &secs)))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync throw ConfigFileError(this, NULL, N_("Cannot parse ISO timestamp '%s': runtime error, %Rra"), str.c_str(), rc);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, NULL, N_("Cannot parse ISO timestamp '%s': invalid format"), str.c_str());
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * Helper to create a string for a RTTIMESPEC for writing out ISO timestamps.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param stamp
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsynccom::Utf8Str ConfigFileBase::makeString(const RTTIMESPEC &stamp)
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, NULL, N_("Timespec %lld ms is invalid"), RTTimeSpecGetMilli(&stamp));
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync return Utf8StrFmt("%04u-%02u-%02uT%02u:%02u:%02uZ",
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * Helper method to read in an ExtraData subtree and stores its contents
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * in the given map of extradata items. Used for both main and machine
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * extradata (MainConfigFile and MachineConfigFile).
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param elmExtraData
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param map
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsyncvoid ConfigFileBase::readExtraData(const xml::ElementNode &elmExtraData,
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync while ((pelmExtraDataItem = nlLevel4.forAllNodes()))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (pelmExtraDataItem->nameEquals("ExtraDataItem"))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // <ExtraDataItem name="GUI/LastWindowPostion" value="97,88,981,858"/>
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if ( ((pelmExtraDataItem->getAttributeValue("name", strName)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && ((pelmExtraDataItem->getAttributeValue("value", strValue)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, pelmExtraDataItem, N_("Required ExtraDataItem/@name or @value attribute is missing"));
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Reads <USBDeviceFilter> entries from under the given elmDeviceFilters node and
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * stores them in the given linklist. This is in ConfigFileBase because it's used
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * from both MainConfigFile (for host filters) and MachineConfigFile (for machine
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * filters).
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param elmDeviceFilters
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param ll
6320f517ddc16e8d8dd450a47edfaab81f67942avboxsyncvoid ConfigFileBase::readUSBDeviceFilters(const xml::ElementNode &elmDeviceFilters,
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync xml::NodesLoop nl1(elmDeviceFilters, "DeviceFilter");
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync if ( (pelmLevel4Child->getAttributeValue("name", flt.strName))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && (pelmLevel4Child->getAttributeValue("active", flt.fActive))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync if (!pelmLevel4Child->getAttributeValue("vendorId", flt.strVendorId))
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync pelmLevel4Child->getAttributeValue("vendorid", flt.strVendorId); // used before 1.3
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!pelmLevel4Child->getAttributeValue("productId", flt.strProductId))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("productid", flt.strProductId); // used before 1.3
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("revision", flt.strRevision);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("manufacturer", flt.strManufacturer);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("product", flt.strProduct);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!pelmLevel4Child->getAttributeValue("serialNumber", flt.strSerialNumber))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("serialnumber", flt.strSerialNumber); // used before 1.3
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("port", flt.strPort);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // the next 2 are irrelevant for host USB objects
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("remote", flt.strRemote);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync pelmLevel4Child->getAttributeValue("maskedInterfaces", flt.ulMaskedInterfaces);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // action is only used with host USB objects
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (pelmLevel4Child->getAttributeValue("action", strAction))
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync throw ConfigFileError(this, pelmLevel4Child, N_("Invalid value '%s' in DeviceFilter/@action attribute"), strAction.c_str());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Reads a media registry entry from the main VirtualBox.xml file.
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync * Whereas the current media registry code is fairly straightforward, it was quite a mess
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * with settings format before 1.4 (VirtualBox 2.0 used settings format 1.3). The elements
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * in the media registry were much more inconsistent, and different elements were used
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * depending on the type of device and image.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param elmMedium
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param llMedia
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync const xml::ElementNode &elmMedium, // HardDisk node if root; if recursing,
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // child HardDisk node or DiffHardDisk node for pre-1.4
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync MediaList &llMedia) // list to append medium to (root disk or child list)
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // <HardDisk uuid="{5471ecdb-1ddb-4012-a801-6d98e226868b}" location="/mnt/innotek-unix/vdis/Windows XP.vdi" format="VDI" type="Normal">
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!(elmMedium.getAttributeValue("uuid", strUUID)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, &elmMedium, N_("Required %s/@uuid attribute is missing"), elmMedium.getName());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // here the system is:
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // <HardDisk uuid="{....}" type="normal">
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // <VirtualDiskImage filePath="/path/to/xxx.vdi"/>
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // </HardDisk>
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync if ((pelmImage = elmMedium.findChildElement("VirtualDiskImage")))
41b3442e21c3a79f3bc61ce67e3445757a83f281vboxsync else if ((pelmImage = elmMedium.findChildElement("VMDKImage")))
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync else if ((pelmImage = elmMedium.findChildElement("VHDImage")))
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync else if ((pelmImage = elmMedium.findChildElement("ISCSIHardDisk")))
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // location is special here: current settings specify an "iscsi://user@server:port/target/lun"
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // string for the location and also have several disk properties for these, whereas this used
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // to be hidden in several sub-elements before 1.4, so compose a location string and set up
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // the properties:
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync Utf8Str strUser, strServer, strPort, strTarget, strLun;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync if (pelmImage->getAttributeValue("userName", strUser))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync if (pelmImage->getAttributeValue("server", strServer))
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync if (pelmImage->getAttributeValue("target", strTarget))
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync med.properties["TargetAddress"] = strServerAndPort;
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (pelmImage->getAttributeValue("password", strPassword))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync else if ((pelmImage = elmMedium.findChildElement("CustomHardDisk")))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // also requires @format attribute, which will be queried below
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, &elmMedium, N_("Required %s/VirtualDiskImage element is missing"), elmMedium.getName());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!(pelmImage->getAttributeValuePath("filePath", med.strLocation)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, &elmMedium, N_("Required %s/@filePath attribute is missing"), elmMedium.getName());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (med.strFormat.isEmpty()) // not set with 1.4 format above, or 1.4 Custom format?
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!(elmMedium.getAttributeValue("format", med.strFormat)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, &elmMedium, N_("Required %s/@format attribute is missing"), elmMedium.getName());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!(elmMedium.getAttributeValue("autoReset", med.fAutoReset)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if ((elmMedium.getAttributeValue("type", strType)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // pre-1.4 used lower case, so make this case-insensitive
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute must be one of Normal, Immutable, Writethrough, Shareable, Readonly or MultiAttach"));
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // DVD and floppy images before 1.4 had "src" attribute instead of "location"
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!(elmMedium.getAttributeValue("src", med.strLocation)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, &elmMedium, N_("Required %s/@src attribute is missing"), elmMedium.getName());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!(elmMedium.getAttributeValue("format", med.strFormat)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // DVD and floppy images before 1.11 had no format attribute. assign the default.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync else if (t == FloppyImage)
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync // current files and 1.4 CustomHardDisk elements must have a location attribute
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if (!(elmMedium.getAttributeValue("location", med.strLocation)))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, &elmMedium, N_("Required %s/@location attribute is missing"), elmMedium.getName());
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync elmMedium.getAttributeValue("Description", med.strDescription); // optional
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // recurse to handle children
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // recurse with this element and push the child onto our current children list
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync if ( (pelmHDChild->getAttributeValue("name", strPropName))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync && (pelmHDChild->getAttributeValue("value", strPropValue))
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync throw ConfigFileError(this, pelmHDChild, N_("Required HardDisk/Property/@name or @value attribute is missing"));
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Reads in the entire <MediaRegistry> chunk and stores its media in the lists
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * of the given MediaRegistry structure.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * This is used in both MainConfigFile and MachineConfigFile since starting with
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * VirtualBox 4.0, we can have media registries in both.
a425b5e790c27d6a1a2cf738802e9034f0764a00vboxsync * For pre-1.4 files, this gets called with the <DiskRegistry> chunk instead.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param elmMediaRegistry
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsyncvoid ConfigFileBase::readMediaRegistry(const xml::ElementNode &elmMediaRegistry,
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync mr.llHardDisks); // list to append hard disk data to: the root list
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync else if ( t == DVDImage
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync mr.llDvdImages); // list to append dvd images to: the root list
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync else if ( t == FloppyImage
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync mr.llFloppyImages); // list to append floppy images to: the root list
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * This is common version for reading NAT port forward rule in per-_machine's_adapter_ and
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync * per-network approaches.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Note: this function doesn't in fill given list from xml::ElementNodesList, because there is conflicting
b306a397b157898e6f769f640b0dfdffbf8beec7vboxsync * declaration in ovmfreader.h.
b306a397b157898e6f769f640b0dfdffbf8beec7vboxsyncvoid ConfigFileBase::readNATForwardRuleList(const xml::ElementNode &elmParent, NATRuleList &llRules)
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync elmParent.getChildElements(plstRules, "Forwarding");
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync for (xml::ElementNodesList::iterator pf = plstRules.begin(); pf != plstRules.end(); ++pf)
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync (*pf)->getAttributeValue("proto", (uint32_t&)rule.proto);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync (*pf)->getAttributeValue("hostip", rule.strHostIP);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync (*pf)->getAttributeValue("guestip", rule.strGuestIP);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Adds a "version" attribute to the given XML element with the
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * VirtualBox settings version (e.g. "1.10-linux"). Used by
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * the XML format for the root element and by the OVF export
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync * for the vbox:Machine element.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * @param elm
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsyncvoid ConfigFileBase::setVersionAttribute(xml::ElementNode &elm)
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync switch (m->sv)
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // can be set if this code runs on XML files that were created by a future version of VBox;
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // in that case, downgrade to current version when writing since we can't write future versions...
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync // silently upgrade if this is less than 1.7 because that's the oldest we can write
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Creates a new stub xml::Document in the m->pDoc member with the
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * root "VirtualBox" element set up. This is used by both
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * MainConfigFile and MachineConfigFile at the beginning of writing
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * out their XML.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * Before calling this, it is the responsibility of the caller to
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * set the "sv" member to the required settings version that is to
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync * be written. For newly created files, the settings version will be
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * the latest (1.12); for files read in from disk earlier, it will be
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * the settings version indicated in the file. However, this method
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * will silently make sure that the settings version is always
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync * at least 1.7 and change it if necessary, since there is no write
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync * support for earlier settings versions.
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync m->pelmRoot = m->pDoc->createRootElement("VirtualBox",
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync "** DO NOT EDIT THIS FILE.\n"
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync "** If you make changes to this file while any VirtualBox related application\n"
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync "** is running, your changes will be overwritten later, without taking effect.\n"
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync "** Use VBoxManage or the VirtualBox Manager GUI to make changes.\n"
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync m->pelmRoot->setAttribute("xmlns", VBOX_XML_NAMESPACE);
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // add settings version attribute to root element
bddad5eeab93a98d4ea571ccdf016531bb4318advboxsync // since this gets called before the XML document is actually written out,
41c24e185aa1d6b5dc290edbd061c5a3c23a9e2fvboxsync // this is where we must check whether we're upgrading the settings version
// and append something like "-1.3-linux.xml"
++it)
bool fHostMode)
++it)
if (fHostMode)
const char *pcsz =
++it)
if (level == 0)
const char *pcszType =
++it)
++it)
++it)
++it)
void ConfigFileBase::buildNATForwardRuleList(xml::ElementNode &elmParent, const NATRuleList &natRuleList)
if ((*r).u16HostPort)
if ((*r).u16GuestPort)
m->cleanup();
return m->fFileExists;
m->copyFrom(*b.m);
// Structures shared between Machine XML and VirtualBox.xml
* Reads one <MachineEntry> from the main VirtualBox.xml file.
throw ConfigFileError(this, pelmChild1, N_("Required MachineEntry/@uuid or @src attribute is missing"));
*cfg);
throw ConfigFileError(this, pelmServer, N_("Required DHCPServer/@networkName, @IPAddress, @networkMask, @lowerIP, @upperIP or @enabled attribute is missing"));
throw ConfigFileError(this, pelmNet, N_("Required NATNetwork/@networkName, @gateway, @network,@advertiseDefaultIpv6Route , @needDhcp or @enabled attribute is missing"));
if (pstrFilename)
pelmGlobalChild->getAttributeValue("defaultMachineFolder", systemProperties.strDefaultMachineFolder);
pelmGlobalChild->getAttributeValue("defaultHardDiskFormat", systemProperties.strDefaultHardDiskFormat);
pelmGlobalChild->getAttributeValue("remoteDisplayAuthLibrary", systemProperties.strVRDEAuthLibrary);
pelmGlobalChild->getAttributeValue("webServiceAuthLibrary", systemProperties.strWebServiceAuthLibrary);
pelmGlobalChild->getAttributeValue("autostartDatabasePath", systemProperties.strAutostartDatabasePath);
#ifdef RT_OS_WINDOWS
* Called from the IVirtualBox interface to write out VirtualBox.xml. This
++it)
// <MachineEntry uuid="{5f102a55-a51b-48e3-b45a-b28d33469488}" src="/mnt/innotek-unix/vbox-machines/Windows 5.1 XP 1 (Office 2003)/Windows 5.1 XP 1 (Office 2003).xml"/>
++it)
&& cOpt > 0)
++itOpt)
if (!pelmOpt)
++itVmSlot)
++itOpt1)
++it)
m->fFileExists = true;
#define HWVIRTEXCLUSIVEDEFAULT false
#define HWVIRTEXCLUSIVEDEFAULT true
fHardwareVirt(true),
fNestedPaging(true),
fVPID(true),
fUnrestrictedExecution(true),
fHardwareVirtForce(false),
fSyntheticCpu(false),
fPAE(false),
fCpuHotPlug(false),
fHPETEnabled(false),
fAccelerate3D(false),
fAccelerate2DVideo(false),
fVideoCaptureEnabled(false),
fEmulatedUSBWebcam(false),
fEmulatedUSBCardReader(false),
fPageFusionEnabled(false)
* - 32 bits host -> true for Windows & Darwin (masked off if the host cpu doesn't support it anyway)
fPAE = true;
* - 64 bits host -> true, unless it's Linux (pending further prediction work due to excessively expensive large page allocations)
fLargePages = true;
fLargePages = false;
fIOCacheEnabled = true;
fCurrentStateModified(true),
fAborted(false)
if (pstrFilename)
throw ConfigFileError(this, pelmAdapter, N_("Invalid value '%s' in Adapter/@type attribute"), strTemp.c_str());
throw ConfigFileError(this, pelmAdapter, N_("Invalid number of modes ('%d') attached to Adapter attribute"), llNetworkModes.size());
void MachineConfigFile::readAttachedNetworkMode(const xml::ElementNode &elmMode, bool fEnabled, NetworkAdapter &nic)
throw ConfigFileError(this, pelmModeChild, N_("Required GenericInterface/Property/@name or @value attribute is missing"));
++it)
throw ConfigFileError(this, pelmPort, N_("Invalid value %RU32 in UART/Port/@slot attribute: value is not unique"), port.ulSlot);
throw ConfigFileError(this, pelmPort, N_("Invalid value '%s' in UART/Port/@hostMode attribute"), strPortMode.c_str());
++it)
throw ConfigFileError(this, pelmPort, N_("Invalid value %RU32 in LPT/Port/@slot attribute: value is not unique"), port.ulSlot);
throw ConfigFileError(this, &elmAudioAdapter, N_("Invalid value '%s' in AudioAdapter/@controller attribute"), strTemp.c_str());
throw ConfigFileError(this, &elmAudioAdapter, N_("Invalid value '%s' in AudioAdapter/@driver attribute"), strTemp.c_str());
void MachineConfigFile::readStorageControllerAttributes(const xml::ElementNode &elmStorageController,
bool fLongMode;
throw ConfigFileError(this,
throw ConfigFileError(this,
throw ConfigFileError(this,
throw ConfigFileError(this,
throw ConfigFileError(this,
--ulPos;
throw ConfigFileError(this, pelmOrder, N_("Invalid value '%RU32' in Boot/Order/@position: value is not unique"), ulPos);
throw ConfigFileError(this, pelmOrder, N_("Invalid value '%s' in Boot/Order/@device attribute"), strDevice.c_str());
throw ConfigFileError(this, pelmHwChild, N_("Invalid value '%s' in Display/@controller attribute"), strGraphicsControllerType.c_str());
throw ConfigFileError(this, pelmHwChild, N_("Invalid value '%s' in RemoteDisplay/@authType attribute"), strAuthType.c_str());
bool fVideoChannel = false;
throw ConfigFileError(this, pelmProperty, N_("Required VRDE Property/@name or @value attribute is missing"));
throw ConfigFileError(this, pelmBIOSChild, N_("Invalid value '%s' in BootMenu/@mode attribute"), strBootMenuMode.c_str());
// legacy BIOS/IDEController (pre 1.7)
throw ConfigFileError(this, pelmBIOSChild, N_("Invalid value '%s' for IDEController/@type attribute"), strType.c_str());
bool fEnabled = false;
if (fEnabled)
if (fEnabled)
throw ConfigFileError(this, pelmCtrl, N_("Invalid value '%s' for Controller/@type attribute"), strCtrlType.c_str());
throw ConfigFileError(this, pelmHwChild, N_("Invalid value '%s' in Clipboard/@mode attribute"), strTemp.c_str());
throw ConfigFileError(this, pelmHwChild, N_("Invalid value '%s' in DragAndDrop/@mode attribute"), strTemp.c_str());
throw ConfigFileError(this, pelmBandwidthGroup, N_("Invalid value '%s' in BandwidthGroup/@type attribute"), strTemp.c_str());
throw ConfigFileError(this, &elmHardware, N_("Required Memory/@RAMSize element/attribute is missing"));
void MachineConfigFile::readHardDiskAttachments_pre1_7(const xml::ElementNode &elmHardDiskAttachments,
++it)
pIDEController = &s;
pSATAController = &s;
throw ConfigFileError(this, pelmAttachment, N_("Required HardDiskAttachment/@hardDisk attribute is missing"));
throw ConfigFileError(this, pelmAttachment, N_("Required HardDiskAttachment/@bus attribute is missing"));
throw ConfigFileError(this, pelmAttachment, N_("Required HardDiskAttachment/@channel attribute is missing"));
throw ConfigFileError(this, pelmAttachment, N_("Required HardDiskAttachment/@device attribute is missing"));
if (!pIDEController)
throw ConfigFileError(this, pelmAttachment, N_("HardDiskAttachment/@bus is 'IDE' but cannot find IDE controller"));
if (!pSATAController)
throw ConfigFileError(this, pelmAttachment, N_("HardDiskAttachment/@bus is 'SATA' but cannot find SATA controller"));
throw ConfigFileError(this, pelmAttachment, N_("HardDiskAttachment/@bus attribute has illegal value '%s'"), strBus.c_str());
throw ConfigFileError(this, pelmController, N_("Required StorageController/@name attribute is missing"));
throw ConfigFileError(this, pelmController, N_("Required StorageController/@type attribute is missing"));
throw ConfigFileError(this, pelmController, N_("Invalid value '%s' for StorageController/@type attribute"), strType.c_str());
throw ConfigFileError(this, pelmHostDrive, N_("Required AttachedDevice/HostDrive/@src attribute is missing"));
throw ConfigFileError(this, pelmImage, N_("Required AttachedDevice/Image/@uuid attribute is missing"));
bool fFound = false;
++it)
fFound = true;
if (!fFound)
throw ConfigFileError(this, pelmHwChild, N_("Internal error: found DVD drive but IDE controller does not exist"));
// shouldn't happen because pre-1.9 settings files always had at least one IDE controller in the settings
bool fEnabled;
&& (fEnabled)
if (pelmTracing)
throw ConfigFileError(this, pElmAutostart, N_("Invalid value '%s' for Autostart/@autostop attribute"), strAutostop.c_str());
// earlier 3.1 trunk builds had a bug and added Description as an attribute, read it silently and write it back as an element
delete child;
const char *pcszOld;
const char *pcszNew;
} aConvertOSTypes[] =
fCurrentStateModified = true;
fAborted = true;
throw ConfigFileError(this, &elmMachine, N_("Required Machine/@uuid or @name attributes is missing"));
pelmCPU->createChild("LongMode")->setAttribute("enabled", hw.enmLongMode == Hardware::LongMode_Enabled);
/* Always save this setting as we have changed the default in 4.0 (on for large memory 64-bit systems). */
++it)
++it)
const char *pcszFirmware;
const char *pcszHID;
const char *pcszChipset;
++it)
const char *pcszDevice;
switch (type)
const char *pcszGraphics;
const char *pcszAuthType;
uint32_t ulVideoChannelQuality = RTStrToUInt32(str.c_str()); /* This returns 0 on invalid string which is ok. */
if (ulVideoChannelQuality == 0)
++it)
const char *pcszBootMenu;
++it)
++it2)
if (cDVDs > 0)
throw ConfigFileError(this, NULL, N_("Internal error: cannot save more than one DVD drive with old settings format"));
++cDVDs;
throw ConfigFileError(this, NULL, N_("Internal error: floppy controller cannot have more than one device attachment"));
if (cFloppiesHere)
if (cFloppies == 0)
throw ConfigFileError(this, NULL, N_("Internal error: cannot save more than one floppy drive with old settings format"));
bool fOhciEnabled = false;
bool fEhciEnabled = false;
++it)
case USBControllerType_OHCI:
fOhciEnabled = true;
case USBControllerType_EHCI:
fEhciEnabled = true;
++it)
case USBControllerType_OHCI:
case USBControllerType_EHCI:
++it)
const char *pszPolicy;
if (pszPolicy)
const char *pcszType;
++it)
const char *pcszHostMode;
case PortMode_HostPipe:
case PortMode_HostDevice:
case PortMode_RawFile:
++it)
const char *pcszController;
case AudioControllerType_SB16:
case AudioControllerType_HDA:
case AudioControllerType_AC97:
const char *pcszDriver;
++it)
const char *pcszClip;
const char *pcszDragAndDrop;
++it)
const char *pcszType;
++it)
++it)
bool fEnabled,
switch (mode)
++it)
bool fSkipRemovableMedia,
++it)
const char *pcszType;
++it2)
case DeviceType_HardDisk:
case DeviceType_DVD:
case DeviceType_Floppy:
void MachineConfigFile::buildAutostartXML(xml::ElementNode *pElmParent, const Autostart *pAutostart)
++it)
* Writes a single snapshot into the DOM tree. Initially this gets called from MachineConfigFile::write()
* for the root snapshot of a machine, if present; elmParent then points to the <Snapshots> node under the
throw ConfigFileError(this, NULL, N_("Maximum snapshot tree depth of %u exceeded"), SETTINGS_SNAPSHOT_DEPTH_MAX);
++it)
if (!fCurrentStateModified)
if (fAborted)
switch (drv)
case AudioDriverType_Null:
#ifdef RT_OS_WINDOWS
# ifdef VBOX_WITH_WINMM
case AudioDriverType_WinMM:
#ifdef RT_OS_SOLARIS
case AudioDriverType_SolAudio:
#ifdef RT_OS_LINUX
# ifdef VBOX_WITH_ALSA
case AudioDriverType_ALSA:
# ifdef VBOX_WITH_PULSE
case AudioDriverType_Pulse:
case AudioDriverType_OSS:
#ifdef RT_OS_FREEBSD
# ifdef VBOX_WITH_PULSE
case AudioDriverType_Pulse:
#ifdef RT_OS_DARWIN
#ifdef RT_OS_OS2
case AudioDriverType_MMPM:
#if defined(RT_OS_WINDOWS)
# ifdef VBOX_WITH_WINMM
return AudioDriverType_WinMM;
return AudioDriverType_DirectSound;
return AudioDriverType_SolAudio;
# if defined(VBOX_WITH_PULSE)
# if defined(VBOX_WITH_ALSA)
return s_linuxDriver;
return AudioDriverType_CoreAudio;
return AudioDriverType_MMPM;
return AudioDriverType_OSS;
return AudioDriverType_Null;
unsigned cOhciCtrls = 0;
unsigned cEhciCtrls = 0;
bool fNonStdName = false;
++it)
case USBControllerType_OHCI:
cOhciCtrls++;
fNonStdName = true;
case USBControllerType_EHCI:
cEhciCtrls++;
fNonStdName = true;
++it)
++netit)
unsigned cOldProperties = 0;
* "VideoChannel/Enabled" and "VideoChannel/Quality" then increase the version to VBox 4.0.
unsigned cOldProperties = 0;
++it)
case StorageBus_IDE:
cIde++;
case StorageBus_SATA:
cSata++;
case StorageBus_SAS:
cSas++;
case StorageBus_SCSI:
cScsiLsi++;
case StorageBus_Floppy:
cFloppy++;
++it2)
++cDVDs;
++cFloppies;
++netit)
m->fFileExists = true;