VirtualBox

Changeset 22296 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 17, 2009 1:13:05 PM (15 years ago)
Author:
vboxsync
Message:

Main: fix boot order XML (position indices were wrong), set correct defaults

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r22287 r22296  
    2626
    2727#include "VirtualBoxXMLUtil.h"
     28
     29// generated header
     30#include "SchemaDefs.h"
    2831
    2932using namespace com;
     
    927930
    928931/**
     932 * Hardware struct constructor.
     933 */
     934Hardware::Hardware()
     935        : strVersion("2"),
     936          fHardwareVirt(true),
     937          fNestedPaging(false),
     938          fVPID(false),
     939          fPAE(false),
     940          cCPUs(1),
     941          ulMemorySizeMB((uint32_t)-1),
     942          ulVRAMSizeMB(8),
     943          cMonitors(1),
     944          fAccelerate3D(false),
     945          fAccelerate2DVideo(false),
     946          clipboardMode(ClipboardMode_Bidirectional),
     947          ulMemoryBalloonSize(0),
     948          ulStatisticsUpdateInterval(0)
     949{
     950    mapBootOrder[0] = DeviceType_Floppy;
     951    mapBootOrder[1] = DeviceType_DVD;
     952    mapBootOrder[2] = DeviceType_HardDisk;
     953}
     954
     955
     956/**
    929957 * Called from MachineConfigFile::readHardware() to network information.
    930958 * @param elmNetwork
     
    11651193        else if (pelmHwChild->nameEquals("Boot"))
    11661194        {
     1195            hw.mapBootOrder.clear();
     1196
    11671197            xml::NodesLoop nl2(*pelmHwChild, "Order");
    11681198            const xml::ElementNode *pelmOrder;
     
    11721202                Utf8Str strDevice;
    11731203                if (!pelmOrder->getAttributeValue("position", ulPos))
    1174                     throw ConfigFileError(this, N_("Required Order/@position attribute is missing"));
     1204                    throw ConfigFileError(this, N_("Required Boot/Order/@position attribute is missing"));
     1205
     1206                if (    ulPos < 1
     1207                     || ulPos >= SchemaDefs::MaxBootPosition
     1208                   )
     1209                    throw ConfigFileError(this,
     1210                                          N_("Invalid value '%RU32' in Boot/Order/@position: must be between 0 and %RU32"),
     1211                                          ulPos,
     1212                                          SchemaDefs::MaxBootPosition + 1);
     1213                // XML is 1-based but internal data is 0-based
     1214                --ulPos;
     1215
     1216                if (hw.mapBootOrder.find(ulPos) != hw.mapBootOrder.end())
     1217                    throw ConfigFileError(this, N_("Invalid value '%RU32' in Boot/Order/@position: value is not unique"), ulPos);
     1218
    11751219                if (!pelmOrder->getAttributeValue("device", strDevice))
    1176                     throw ConfigFileError(this, N_("Required Order/@device attribute is missing"));
    1177                 if (hw.mapBootOrder.find(ulPos) != hw.mapBootOrder.end())
    1178                     throw ConfigFileError(this, N_("Order/@attribute value %d is not unique"), ulPos);
     1220                    throw ConfigFileError(this, N_("Required Boot/Order/@device attribute is missing"));
    11791221
    11801222                DeviceType_T type;
     
    17981840
    17991841        xml::ElementNode *pelmOrder = pelmBoot->createChild("Order");
    1800         pelmOrder->setAttribute("position", i);
     1842        pelmOrder->setAttribute("position",
     1843                                i + 1);   // XML is 1-based but internal data is 0-based
    18011844        pelmOrder->setAttribute("device", pcszDevice);
    18021845    }
Note: See TracChangeset for help on using the changeset viewer.

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