VBoxManageModifyVM.cpp revision 8c58249d7f93d82395aa6c8b31526443892bc375
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/* $Id$ */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/** @file
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VBoxManage - Implementation of modifyvm command.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/*
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Copyright (C) 2006-2009 Oracle Corporation
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync *
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * available from http://www.virtualbox.org. This file is free software;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * General Public License (GPL) as published by the Free Software
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/*******************************************************************************
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync* Header Files *
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync*******************************************************************************/
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#ifndef VBOX_ONLY_DOCS
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <VBox/com/com.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <VBox/com/array.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <VBox/com/ErrorInfo.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <VBox/com/errorprint.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <VBox/com/EventQueue.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <VBox/com/VirtualBox.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <vector>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <list>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif /* !VBOX_ONLY_DOCS */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <iprt/cidr.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <iprt/param.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <iprt/path.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <iprt/stream.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <iprt/string.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <iprt/getopt.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include <VBox/log.h>
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#include "VBoxManage.h"
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#ifndef VBOX_ONLY_DOCS
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncusing namespace com;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
7d6ce198fd361f58bd1ebdeee7772f76b4e58966vboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
2fce40121ae472df2fd959fbe19775ed43304a0bvboxsync#if defined(_MSC_VER)
edde275acba04aca58db4172a163741e3abadfbcvboxsync# pragma optimize("g", off)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncenum
40839c441cb305d84420565f7ca25403d8177413vboxsync{
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NAME = 1000,
7d6ce198fd361f58bd1ebdeee7772f76b4e58966vboxsync MODIFYVM_OSTYPE,
7d6ce198fd361f58bd1ebdeee7772f76b4e58966vboxsync MODIFYVM_MEMORY,
7d6ce198fd361f58bd1ebdeee7772f76b4e58966vboxsync MODIFYVM_VRAM,
7d6ce198fd361f58bd1ebdeee7772f76b4e58966vboxsync MODIFYVM_FIRMWARE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_ACPI,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_IOAPIC,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_PAE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SYNTHCPU,
edde275acba04aca58db4172a163741e3abadfbcvboxsync MODIFYVM_HWVIRTEX,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HWVIRTEXEXCLUSIVE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NESTEDPAGING,
a1d9d394b49969e730c5a8e037ea2d672a48dbf6vboxsync MODIFYVM_LARGEPAGES,
edde275acba04aca58db4172a163741e3abadfbcvboxsync MODIFYVM_VTXVPID,
edde275acba04aca58db4172a163741e3abadfbcvboxsync MODIFYVM_CPUS,
edde275acba04aca58db4172a163741e3abadfbcvboxsync MODIFYVM_CPUHOTPLUG,
edde275acba04aca58db4172a163741e3abadfbcvboxsync MODIFYVM_PLUGCPU,
a1d9d394b49969e730c5a8e037ea2d672a48dbf6vboxsync MODIFYVM_UNPLUGCPU,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SETCPUID,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_DELCPUID,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_DELALLCPUID,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_MONITORCOUNT,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_ACCELERATE3D,
2fce40121ae472df2fd959fbe19775ed43304a0bvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_ACCELERATE2DVIDEO,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BIOSLOGOFADEIN,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BIOSLOGOFADEOUT,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BIOSLOGODISPLAYTIME,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BIOSLOGOIMAGEPATH,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BIOSBOOTMENU,
2fce40121ae472df2fd959fbe19775ed43304a0bvboxsync MODIFYVM_BIOSSYSTEMTIMEOFFSET,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BIOSPXEDEBUG,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BOOT,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HDA, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HDB, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HDD, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_IDECONTROLLER, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SATAIDEEMULATION, // deprecated
30f07af559efcbd967e801903746fc21f81ee533vboxsync MODIFYVM_SATAPORTCOUNT, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SATAPORT, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SATA, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SCSIPORT, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SCSITYPE, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SCSI, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_DVDPASSTHROUGH, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_DVD, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_FLOPPY, // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NICTRACEFILE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NICTRACE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NICTYPE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NICSPEED,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NICBOOTPRIO,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NIC,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_CABLECONNECTED,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_BRIDGEADAPTER,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HOSTONLYADAPTER,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_INTNET,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATNET,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#ifdef VBOX_WITH_VDE
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_VDENET,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATBINDIP,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATSETTINGS,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATPF,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATALIASMODE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATTFTPPREFIX,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATTFTPFILE,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATTFTPSERVER,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATDNSPASSDOMAIN,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATDNSPROXY,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_NATDNSHOSTRESOLVER,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_MACADDRESS,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HIDPTR,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_HIDKBD,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_UARTMODE,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_UART,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_GUESTMEMORYBALLOON,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_AUDIOCONTROLLER,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_AUDIO,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_CLIPBOARD,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#ifdef VBOX_WITH_VRDP
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_VRDPPORT,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_VRDPADDRESS,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_VRDPAUTHTYPE,
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync MODIFYVM_VRDPMULTICON,
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync MODIFYVM_VRDPREUSECON,
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync MODIFYVM_VRDPVIDEOCHANNEL,
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync MODIFYVM_VRDPVIDEOCHANNELQUALITY,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_VRDP,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_RTCUSEUTC,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_USBEHCI,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_USB,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_SNAPSHOTFOLDER,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_TELEPORTER_ENABLED,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_TELEPORTER_PORT,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_TELEPORTER_ADDRESS,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_TELEPORTER_PASSWORD,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HARDWARE_UUID,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_HPET,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync MODIFYVM_IOMGR,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_IOBACKEND,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_IOCACHE,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_IOCACHESIZE,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync MODIFYVM_IOBANDWIDTHMAX
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync};
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsyncstatic const RTGETOPTDEF g_aModifyVMOptions[] =
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync{
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32 },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--largepages", MODIFYVM_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32 },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32 },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32 },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync#endif
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT32 },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64 },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--sataideemulation", MODIFYVM_SATAIDEEMULATION, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
88d7b87c38cc3800f532139696785e8c96bfd531vboxsync { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
88d7b87c38cc3800f532139696785e8c96bfd531vboxsync { "--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
88d7b87c38cc3800f532139696785e8c96bfd531vboxsync { "--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--nicbootprio", MODIFYVM_NICBOOTPRIO, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync#ifdef VBOX_WITH_VDE
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vdenet", MODIFYVM_VDENET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync#endif
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--natpf", MODIFYVM_NATPF, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--nataliasmode", MODIFYVM_NATALIASMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--nattftpprefix", MODIFYVM_NATTFTPPREFIX, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--nattftpfile", MODIFYVM_NATTFTPFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--nattftpserver", MODIFYVM_NATTFTPSERVER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--natdnspassdomain", MODIFYVM_NATDNSPASSDOMAIN, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--natdnsproxy", MODIFYVM_NATDNSPROXY, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync#ifdef VBOX_WITH_VRDP
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--vrdpvideochannel", MODIFYVM_VRDPVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--vrdpvideochannelquality", MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_UINT32 },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#endif
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
f20463d06f9bf3f81e2c049c697dcd20a0b0c435vboxsync { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync { "--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
0c2ffca957882f38c677fc23f324cfd695b96947vboxsync { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--iomgr", MODIFYVM_IOMGR, RTGETOPT_REQ_STRING },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--iobackend", MODIFYVM_IOBACKEND, RTGETOPT_REQ_STRING },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32 },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync { "--iobandwidthmax", MODIFYVM_IOBANDWIDTHMAX, RTGETOPT_REQ_UINT32 },
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync};
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncint handleModifyVM(HandlerArg *a)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync{
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync int c;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync HRESULT rc;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Bstr name;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Bstr machineuuid (a->argv[0]);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTGETOPTUNION ValueUnion;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTGETOPTSTATE GetOptState;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ComPtr <IMachine> machine;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ComPtr <IBIOSSettings> biosSettings;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* VM ID + at least one parameter. Parameter arguments are checked
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * individually. */
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync if (a->argc < 2)
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync /* Get the number of network adapters */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ULONG NetworkAdapterCount = 0;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr <ISystemProperties> info;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync CHECK_ERROR_RET(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount), 1);
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync ULONG SerialPortCount = 0;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ComPtr <ISystemProperties> info;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR_RET(info, COMGETTER(SerialPortCount)(&SerialPortCount), 1);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync /* try to find the given machine */
9f997e760f610c92e3a365be21ead6972bc46130vboxsync if (!Guid(machineuuid).isEmpty())
9f997e760f610c92e3a365be21ead6972bc46130vboxsync {
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid, machine.asOutParam()), 1);
9f997e760f610c92e3a365be21ead6972bc46130vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()), 1);
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync machine->COMGETTER(Id)(machineuuid.asOutParam());
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync /* open a session for the VM */
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR_RET(a->virtualBox, OpenSession(a->session, machineuuid), 1);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* get the mutable session machine */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync a->session->COMGETTER(Machine)(machine.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
8302394f164acb4adb187954f6ac8ef7a9efa629vboxsync RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
8302394f164acb4adb187954f6ac8ef7a9efa629vboxsync
8302394f164acb4adb187954f6ac8ef7a9efa629vboxsync while ( SUCCEEDED (rc)
8302394f164acb4adb187954f6ac8ef7a9efa629vboxsync && (c = RTGetOpt(&GetOptState, &ValueUnion)))
8302394f164acb4adb187954f6ac8ef7a9efa629vboxsync {
8302394f164acb4adb187954f6ac8ef7a9efa629vboxsync switch (c)
8302394f164acb4adb187954f6ac8ef7a9efa629vboxsync {
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync case MODIFYVM_NAME:
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync {
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz)));
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync break;
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync }
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync case MODIFYVM_OSTYPE:
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
100b161379af7255c69e27587cc746e5f76ff050vboxsync ComPtr<IGuestOSType> guestOSType;
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz), guestOSType.asOutParam()));
100b161379af7255c69e27587cc746e5f76ff050vboxsync if (SUCCEEDED(rc) && guestOSType)
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
100b161379af7255c69e27587cc746e5f76ff050vboxsync CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz)));
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync }
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync else
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).raw());
55f0ad00baf08057a3d6087ca698d4fd86e7b4a7vboxsync rc = E_FAIL;
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync break;
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync case MODIFYVM_MEMORY:
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
100b161379af7255c69e27587cc746e5f76ff050vboxsync break;
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync }
a6c871653045073d6ef74d0589de345ae62b607dvboxsync
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync case MODIFYVM_VRAM:
55f0ad00baf08057a3d6087ca698d4fd86e7b4a7vboxsync {
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync break;
1f64240a0fda7b4c7cc9fcd4ef610f26623485b8vboxsync }
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync case MODIFYVM_FIRMWARE:
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync {
beed5fc4d17b85d6d05516ae63e6308af82ad96fvboxsync if (!strcmp(ValueUnion.psz, "efi"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!strcmp(ValueUnion.psz, "efi32"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync }
f81115e612ee8fa2bc082db9d4c8879e33babc5avboxsync else if (!strcmp(ValueUnion.psz, "efi64"))
f81115e612ee8fa2bc082db9d4c8879e33babc5avboxsync {
f81115e612ee8fa2bc082db9d4c8879e33babc5avboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!strcmp(ValueUnion.psz, "efidual"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!strcmp(ValueUnion.psz, "bios"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = E_FAIL;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_ACPI:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_IOAPIC:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_PAE:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_SYNTHCPU:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync case MODIFYVM_HWVIRTEX:
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync {
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync break;
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync }
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync case MODIFYVM_HWVIRTEXEXCLUSIVE:
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync {
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync break;
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync }
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync case MODIFYVM_SETCPUID:
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync {
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync uint32_t id = ValueUnion.u32;
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync uint32_t aValue[4];
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync for (unsigned i = 0 ; i < 4 ; i++)
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync {
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
4db69c2a1302fa56bc5dd7181377b9f47cfd875evboxsync if (RT_FAILURE(vrc))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return errorSyntax(USAGE_MODIFYVM,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync "Missing or Invalid argument to '%s'",
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync GetOptState.pDef->pszLong);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync aValue[i] = ValueUnion.u32;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_DELCPUID:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_DELALLCPUID:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_NESTEDPAGING:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_LARGEPAGES:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_VTXVPID:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
30f07af559efcbd967e801903746fc21f81ee533vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_CPUS:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_RTCUSEUTC:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_CPUHOTPLUG:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_PLUGCPU:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_UNPLUGCPU:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_MONITORCOUNT:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_ACCELERATE3D:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_ACCELERATE2DVIDEO:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#endif
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_BIOSLOGOFADEIN:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_BIOSLOGOFADEOUT:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_BIOSLOGODISPLAYTIME:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_BIOSLOGOIMAGEPATH:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz)));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_BIOSBOOTMENU:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "disabled"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "menuonly"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!strcmp(ValueUnion.psz, "messageandmenu"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_BIOSPXEDEBUG:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
efdc3bd872b77b5ec7d19d77504264de24b0582bvboxsync case MODIFYVM_BOOT:
efdc3bd872b77b5ec7d19d77504264de24b0582bvboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "none"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "floppy"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "dvd"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!strcmp(ValueUnion.psz, "disk"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!strcmp(ValueUnion.psz, "net"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_HDA: // deprecated
30f07af559efcbd967e801903746fc21f81ee533vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "none"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->DetachDevice(Bstr("IDE Controller"), 0, 0);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync /* first guess is that it's a UUID */
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync Bstr uuid(ValueUnion.psz);
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync ComPtr<IMedium> hardDisk;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* not successful? Then it must be a filename */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!hardDisk)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (FAILED(rc))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* open the new hard disk object */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(a->virtualBox,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync OpenHardDisk(Bstr(ValueUnion.psz),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync AccessMode_ReadWrite, false, Bstr(""),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync false, Bstr(""), hardDisk.asOutParam()));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (hardDisk)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 0, DeviceType_HardDisk, uuid));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_HDB: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "none"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
e17f6f8a70a7709a9a6319d9a473596fb600b552vboxsync machine->DetachDevice(Bstr("IDE Controller"), 0, 1);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* first guess is that it's a UUID */
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync Bstr uuid(ValueUnion.psz);
30f07af559efcbd967e801903746fc21f81ee533vboxsync ComPtr<IMedium> hardDisk;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* not successful? Then it must be a filename */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!hardDisk)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (FAILED(rc))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* open the new hard disk object */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(a->virtualBox,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync OpenHardDisk(Bstr(ValueUnion.psz),
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync AccessMode_ReadWrite, false, Bstr(""),
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync false, Bstr(""), hardDisk.asOutParam()));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (hardDisk)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 1, DeviceType_HardDisk, uuid));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = E_FAIL;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync case MODIFYVM_HDD: // deprecated
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!strcmp(ValueUnion.psz, "none"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync machine->DetachDevice(Bstr("IDE Controller"), 1, 1);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* first guess is that it's a UUID */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync Bstr uuid(ValueUnion.psz);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ComPtr<IMedium> hardDisk;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /* not successful? Then it must be a filename */
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (!hardDisk)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (FAILED(rc))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* open the new hard disk object */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(a->virtualBox,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync OpenHardDisk(Bstr(ValueUnion.psz),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync AccessMode_ReadWrite, false, Bstr(""),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync false, Bstr(""), hardDisk.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (hardDisk)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 1, 1, DeviceType_HardDisk, uuid));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_IDECONTROLLER: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IStorageController> storageController;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller"),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync storageController.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_SATAIDEEMULATION: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IStorageController> SataCtl;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (SUCCEEDED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_SATAPORTCOUNT: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IStorageController> SataCtl;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_SATAPORT: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "none"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->DetachDevice(Bstr("SATA"), GetOptState.uIndex, 0);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* first guess is that it's a UUID */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync Bstr uuid(ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IMedium> hardDisk;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* not successful? Then it must be a filename */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!hardDisk)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (FAILED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* open the new hard disk object */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(a->virtualBox,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync OpenHardDisk(Bstr(ValueUnion.psz), AccessMode_ReadWrite,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync false, Bstr(""), false,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync Bstr(""), hardDisk.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (hardDisk)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync AttachDevice(Bstr("SATA"), GetOptState.uIndex,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync 0, DeviceType_HardDisk, uuid));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_SATA: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IStorageController> ctl;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, AddStorageController(Bstr("SATA"), StorageBus_SATA, ctl.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA")));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_SCSIPORT: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "none"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = machine->DetachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (FAILED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), GetOptState.uIndex, 0));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* first guess is that it's a UUID */
30f07af559efcbd967e801903746fc21f81ee533vboxsync Bstr uuid(ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IMedium> hardDisk;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* not successful? Then it must be a filename */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!hardDisk)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (FAILED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* open the new hard disk object */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(a->virtualBox,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync OpenHardDisk(Bstr(ValueUnion.psz),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync AccessMode_ReadWrite, false, Bstr(""),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync false, Bstr(""), hardDisk.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (hardDisk)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = machine->AttachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0, DeviceType_HardDisk, uuid);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (FAILED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync AttachDevice(Bstr("BusLogic"),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync GetOptState.uIndex, 0,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync DeviceType_HardDisk, uuid));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_SCSITYPE: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IStorageController> ctl;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = machine->RemoveStorageController(Bstr("BusLogic"));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (FAILED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync AddStorageController(Bstr("LsiLogic"),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync StorageBus_SCSI,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ctl.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (SUCCEEDED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = machine->RemoveStorageController(Bstr("LsiLogic"));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (FAILED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic")));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync AddStorageController(Bstr("BusLogic"),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync StorageBus_SCSI,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ctl.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (SUCCEEDED(rc))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_SCSI: // deprecated
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IStorageController> ctl;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic"), StorageBus_SCSI, ctl.asOutParam()));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (SUCCEEDED(rc))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = machine->RemoveStorageController(Bstr("BusLogic"));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (FAILED(rc))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync case MODIFYVM_DVDPASSTHROUGH: // deprecated
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller"), 1, 0, !strcmp(ValueUnion.psz, "on")));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
2fce40121ae472df2fd959fbe19775ed43304a0bvboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync case MODIFYVM_DVD: // deprecated
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync ComPtr<IMedium> dvdMedium;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync Bstr uuid(ValueUnion.psz);
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
100b161379af7255c69e27587cc746e5f76ff050vboxsync /* unmount? */
100b161379af7255c69e27587cc746e5f76ff050vboxsync if (!strcmp(ValueUnion.psz, "none"))
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
100b161379af7255c69e27587cc746e5f76ff050vboxsync /* nothing to do, NULL object will cause unmount */
100b161379af7255c69e27587cc746e5f76ff050vboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync /* host drive? */
100b161379af7255c69e27587cc746e5f76ff050vboxsync else if (!strncmp(ValueUnion.psz, "host:", 5))
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
100b161379af7255c69e27587cc746e5f76ff050vboxsync ComPtr<IHost> host;
100b161379af7255c69e27587cc746e5f76ff050vboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5), dvdMedium.asOutParam());
100b161379af7255c69e27587cc746e5f76ff050vboxsync if (!dvdMedium)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* 2nd try: try with the real name, important on Linux+libhal */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync char szPathReal[RTPATH_MAX];
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = E_FAIL;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = host->FindHostDVDDrive(Bstr(szPathReal), dvdMedium.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (!dvdMedium)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = E_FAIL;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync else
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
100b161379af7255c69e27587cc746e5f76ff050vboxsync /* first assume it's a UUID */
100b161379af7255c69e27587cc746e5f76ff050vboxsync rc = a->virtualBox->GetDVDImage(uuid, dvdMedium.asOutParam());
100b161379af7255c69e27587cc746e5f76ff050vboxsync if (FAILED(rc) || !dvdMedium)
100b161379af7255c69e27587cc746e5f76ff050vboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* must be a filename, check if it's in the collection */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = a->virtualBox->FindDVDImage(Bstr(ValueUnion.psz), dvdMedium.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* not registered, do that on the fly */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!dvdMedium)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync Bstr emptyUUID;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(a->virtualBox, OpenDVDImage(Bstr(ValueUnion.psz),
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync emptyUUID, dvdMedium.asOutParam()));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (!dvdMedium)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = E_FAIL;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /** @todo generalize this, allow arbitrary number of DVD drives
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync * and as a consequence multiple attachments and different
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync * storage controllers. */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (dvdMedium)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync dvdMedium->COMGETTER(Id)(uuid.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller"), 1, 0, uuid, FALSE /* aForce */));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync case MODIFYVM_FLOPPY: // deprecated
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync Bstr uuid(ValueUnion.psz);
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync ComPtr<IMedium> floppyMedium;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync ComPtr<IMediumAttachment> floppyAttachment;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync machine->GetMediumAttachment(Bstr("Floppy Controller"), 0, 0, floppyAttachment.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* disable? */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (!strcmp(ValueUnion.psz, "disabled"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* disable the controller */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (floppyAttachment)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller"), 0, 0));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync else
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* enable the controller */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (!floppyAttachment)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller"), 0, 0, DeviceType_Floppy, NULL));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* unmount? */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if ( !strcmp(ValueUnion.psz, "none")
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync || !strcmp(ValueUnion.psz, "empty")) // deprecated
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* nothing to do, NULL object will cause unmount */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* host drive? */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync else if (!strncmp(ValueUnion.psz, "host:", 5))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync ComPtr<IHost> host;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5), floppyMedium.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (!floppyMedium)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = E_FAIL;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync else
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* first assume it's a UUID */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = a->virtualBox->GetFloppyImage(uuid, floppyMedium.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (FAILED(rc) || !floppyMedium)
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync /* must be a filename, check if it's in the collection */
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync rc = a->virtualBox->FindFloppyImage(Bstr(ValueUnion.psz), floppyMedium.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync /* not registered, do that on the fly */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!floppyMedium)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync Bstr emptyUUID;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(a->virtualBox,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync OpenFloppyImage(Bstr(ValueUnion.psz),
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync emptyUUID,
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync floppyMedium.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync }
100b161379af7255c69e27587cc746e5f76ff050vboxsync if (!floppyMedium)
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync floppyMedium->COMGETTER(Id)(uuid.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller"), 0, 0, uuid, FALSE /* aForce */));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_NICTRACEFILE:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<INetworkAdapter> nic;
30f07af559efcbd967e801903746fc21f81ee533vboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(nic);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync case MODIFYVM_NICTRACE:
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ComPtr<INetworkAdapter> nic;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ASSERT(nic);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync break;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync case MODIFYVM_NICTYPE:
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ComPtr<INetworkAdapter> nic;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ASSERT(nic);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync if (!strcmp(ValueUnion.psz, "Am79C970A"))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else if (!strcmp(ValueUnion.psz, "Am79C973"))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync#ifdef VBOX_WITH_E1000
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else if (!strcmp(ValueUnion.psz, "82540EM"))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else if (!strcmp(ValueUnion.psz, "82543GC"))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else if (!strcmp(ValueUnion.psz, "82545EM"))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync#endif
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync#ifdef VBOX_WITH_VIRTIO
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else if (!strcmp(ValueUnion.psz, "virtio"))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync#endif /* VBOX_WITH_VIRTIO */
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync errorArgument("Invalid NIC type '%s' specified for NIC %u", ValueUnion.psz, GetOptState.uIndex);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync rc = E_FAIL;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync break;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync case MODIFYVM_NICSPEED:
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ComPtr<INetworkAdapter> nic;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ASSERT(nic);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync break;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync case MODIFYVM_NICBOOTPRIO:
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ComPtr<INetworkAdapter> nic;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ASSERT(nic);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync * 0 for the default lowest priority).
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync */
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync if (ValueUnion.u32 > 4)
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync rc = E_FAIL;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync break;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync case MODIFYVM_NIC:
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ComPtr<INetworkAdapter> nic;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ASSERT(nic);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync if (!strcmp(ValueUnion.psz, "none"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else if (!strcmp(ValueUnion.psz, "null"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, Detach());
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else if (!strcmp(ValueUnion.psz, "nat"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, AttachToNAT());
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else if ( !strcmp(ValueUnion.psz, "bridged")
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, AttachToBridgedInterface());
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else if (!strcmp(ValueUnion.psz, "intnet"))
efdc3bd872b77b5ec7d19d77504264de24b0582bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, AttachToInternalNetwork());
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync#if defined(VBOX_WITH_NETFLT)
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else if (!strcmp(ValueUnion.psz, "hostonly"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, AttachToHostOnlyInterface());
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync#endif
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync#ifdef VBOX_WITH_VDE
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else if (!strcmp(ValueUnion.psz, "vde"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, AttachToVDE());
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync#endif
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync rc = E_FAIL;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync break;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync case MODIFYVM_CABLECONNECTED:
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ComPtr<INetworkAdapter> nic;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ASSERT(nic);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync break;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync case MODIFYVM_BRIDGEADAPTER:
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync case MODIFYVM_HOSTONLYADAPTER:
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ComPtr<INetworkAdapter> nic;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ASSERT(nic);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync /* remove it? */
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync if (!strcmp(ValueUnion.psz, "none"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(HostInterface)(NULL));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz)));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync break;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync case MODIFYVM_INTNET:
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ComPtr<INetworkAdapter> nic;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ASSERT(nic);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync /* remove it? */
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync if (!strcmp(ValueUnion.psz, "none"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(NULL));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync else
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz)));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync break;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync }
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync#ifdef VBOX_WITH_VDE
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync case MODIFYVM_VDENET:
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ComPtr<INetworkAdapter> nic;
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync ASSERT(nic);
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync if (!strcmp(ValueUnion.psz, "default"))
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync {
4f2b002896072b0b5a7cb566341c8bac5e69392bvboxsync CHECK_ERROR(nic, COMSETTER(VDENetwork)(NULL));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync else
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(nic, COMSETTER(VDENetwork)(Bstr(ValueUnion.psz)));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync break;
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync#endif
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATNET:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync const char *psz = ValueUnion.psz;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (!strcmp("default", psz))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync psz = "";
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(driver, COMSETTER(Network)(Bstr(psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATBINDIP:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(driver, COMSETTER(HostIP)(Bstr(ValueUnion.psz)));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync#define ITERATE_TO_NEXT_TERM(ch) \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync do { \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync while (*ch != ',') \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync { \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync if (*ch == 0) \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync { \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync return errorSyntax(USAGE_MODIFYVM, \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync "Missing or Invalid argument to '%s'", \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync GetOptState.pDef->pszLong); \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync } \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ch++; \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync } \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync *ch = '\0'; \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ch++; \
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync } while(0)
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync case MODIFYVM_NATSETTINGS:
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ComPtr<INetworkAdapter> nic;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ComPtr<INATEngine> driver;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync char *strMtu;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync char *strSockSnd;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync char *strSockRcv;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync char *strTcpSnd;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync char *strTcpRcv;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync char *strRaw = RTStrDup(ValueUnion.psz);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync char *ch = strRaw;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync strMtu = RTStrStrip(ch);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ITERATE_TO_NEXT_TERM(ch);
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync strSockSnd = RTStrStrip(ch);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ITERATE_TO_NEXT_TERM(ch);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync strSockRcv = RTStrStrip(ch);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync ITERATE_TO_NEXT_TERM(ch);
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync strTcpSnd = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ITERATE_TO_NEXT_TERM(ch);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync strTcpRcv = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync CHECK_ERROR(driver, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync RTStrToUInt32(strTcpSnd), RTStrToUInt32(strTcpRcv)));
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync break;
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync }
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync case MODIFYVM_NATPF:
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync /* format name:proto:hostip:hostport:guestip:guestport*/
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (RTStrCmp(ValueUnion.psz, "delete") != 0)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *strName;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *strProto;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *strHostIp;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *strHostPort;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *strGuestIp;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *strGuestPort;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *strRaw = RTStrDup(ValueUnion.psz);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *ch = strRaw;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync strName = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ITERATE_TO_NEXT_TERM(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync strProto = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ITERATE_TO_NEXT_TERM(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync strHostIp = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ITERATE_TO_NEXT_TERM(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync strHostPort = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ITERATE_TO_NEXT_TERM(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync strGuestIp = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ITERATE_TO_NEXT_TERM(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync strGuestPort = RTStrStrip(ch);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync NATProtocol_T proto;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (RTStrICmp(strProto, "udp") == 0)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync proto = NATProtocol_UDP;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else if (RTStrICmp(strProto, "tcp") == 0)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync proto = NATProtocol_TCP;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync errorArgument("Invalid proto '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync rc = E_FAIL;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(driver, AddRedirect(Bstr(strName), proto, Bstr(strHostIp),
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync RTStrToUInt16(strHostPort), Bstr(strGuestIp), RTStrToUInt16(strGuestPort)));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync /* delete NAT Rule operation */
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync int vrc;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (RT_FAILURE(vrc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(driver, RemoveRedirect(Bstr(ValueUnion.psz)));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync #undef ITERATE_TO_NEXT_TERM
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATALIASMODE:
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync uint32_t aliasMode = 0;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ASSERT(nic);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (RTStrCmp(ValueUnion.psz,"default") == 0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync aliasMode = 0;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *token = (char *)ValueUnion.psz;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync while(token)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (RTStrNCmp(token, "log", 3) == 0)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync aliasMode |= 0x1;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else if (RTStrNCmp(token, "proxyonly", 9) == 0)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync aliasMode |= 0x2;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else if (RTStrNCmp(token, "sameports", 9) == 0)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync aliasMode |= 0x4;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync token = RTStrStr(token, ",");
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (token == NULL)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync token++;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(driver, COMSETTER(AliasMode)(aliasMode));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATTFTPPREFIX:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(driver, COMSETTER(TftpPrefix)(Bstr(ValueUnion.psz)));
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATTFTPFILE:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(driver, COMSETTER(TftpBootFile)(Bstr(ValueUnion.psz)));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATTFTPSERVER:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(driver, COMSETTER(TftpNextServer)(Bstr(ValueUnion.psz)));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync case MODIFYVM_NATDNSPASSDOMAIN:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
9b62e122a37f42c2bbaae1312ad198f44bebea5cvboxsync ASSERT(nic);
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(driver, COMSETTER(DnsPassDomain)(ValueUnion.f));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATDNSPROXY:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INetworkAdapter> nic;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<INATEngine> driver;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(nic);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync CHECK_ERROR(driver, COMSETTER(DnsProxy)(ValueUnion.f));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_NATDNSHOSTRESOLVER:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync ComPtr<INetworkAdapter> nic;
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync ComPtr<INATEngine> driver;
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync ASSERT(nic);
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync CHECK_ERROR(driver, COMSETTER(DnsUseHostResolver)(ValueUnion.f));
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync break;
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync }
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync case MODIFYVM_MACADDRESS:
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync {
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync ComPtr<INetworkAdapter> nic;
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync ASSERT(nic);
cd2274c977e1b722b535e4f601a324e8029b5e43vboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync /* generate one? */
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (!strcmp(ValueUnion.psz, "auto"))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(nic, COMSETTER(MACAddress)(NULL));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
db87bb1112c1f2827ffa192593174cf845f8f04dvboxsync CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
cf0e96b2c5a08292c6d13e4fdcb2d9518d1983e8vboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_HIDPTR:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync bool fEnableUsb = false;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (!strcmp(ValueUnion.psz, "ps2"))
680c2aff33be2ee9340c8763a3cb5c218c352bcfvboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_PS2Mouse));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "usb"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBMouse));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (SUCCEEDED(rc))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync fEnableUsb = true;
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else if (!strcmp(ValueUnion.psz, "usbtablet"))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBTablet));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (SUCCEEDED(rc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync fEnableUsb = true;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync errorArgument("Invalid type '%s' specfied for pointing device", ValueUnion.psz);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync rc = E_FAIL;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (fEnableUsb)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync /* Make sure the OHCI controller is enabled. */
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<IUSBController> UsbCtl;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (SUCCEEDED(rc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync BOOL fEnabled;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (FAILED(rc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync fEnabled = false;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (!fEnabled)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_HIDKBD:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync bool fEnableUsb = false;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (!strcmp(ValueUnion.psz, "ps2"))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_PS2Keyboard));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else if (!strcmp(ValueUnion.psz, "usb"))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_USBKeyboard));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (SUCCEEDED(rc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync fEnableUsb = true;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync errorArgument("Invalid type '%s' specfied for keyboard", ValueUnion.psz);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync rc = E_FAIL;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (fEnableUsb)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync /* Make sure the OHCI controller is enabled. */
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync ComPtr<IUSBController> UsbCtl;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (SUCCEEDED(rc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync BOOL fEnabled;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (FAILED(rc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync fEnabled = false;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (!fEnabled)
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync break;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync case MODIFYVM_UARTMODE:
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ComPtr<ISerialPort> uart;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync char *pszIRQ = NULL;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync ASSERT(uart);
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync if (!strcmp(ValueUnion.psz, "disconnected"))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else if ( !strcmp(ValueUnion.psz, "server")
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync || !strcmp(ValueUnion.psz, "client")
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync || !strcmp(ValueUnion.psz, "file"))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync const char *pszMode = ValueUnion.psz;
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync
30f07af559efcbd967e801903746fc21f81ee533vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (RT_FAILURE(vrc))
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync return errorSyntax(USAGE_MODIFYVM,
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync "Missing or Invalid argument to '%s'",
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync GetOptState.pDef->pszLong);
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
30f07af559efcbd967e801903746fc21f81ee533vboxsync if (!strcmp(pszMode, "server"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync }
48e06e6a052c50ecf176f63f5537f80b544bf34avboxsync else if (!strcmp(pszMode, "client"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else if (!strcmp(pszMode, "file"))
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync }
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync else
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync {
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync break;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync case MODIFYVM_UART:
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync ComPtr<ISerialPort> uart;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync ASSERT(uart);
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(uart, COMSETTER(Enabled)(FALSE));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync else
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync const char *pszIOBase = ValueUnion.psz;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync uint32_t uVal = 0;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync if (RT_FAILURE(vrc))
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync return errorSyntax(USAGE_MODIFYVM,
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync "Missing or Invalid argument to '%s'",
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync GetOptState.pDef->pszLong);
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(uart, COMSETTER(IRQ)(ValueUnion.u32));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync if (vrc != VINF_SUCCESS || uVal == 0)
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(uart, COMSETTER(IOBase)(uVal));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(uart, COMSETTER(Enabled)(TRUE));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_GUESTMEMORYBALLOON:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_AUDIOCONTROLLER:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IAudioAdapter> audioAdapter;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(audioAdapter);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "sb16"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "ac97"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
30f07af559efcbd967e801903746fc21f81ee533vboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync break;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync case MODIFYVM_AUDIO:
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync {
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync ComPtr<IAudioAdapter> audioAdapter;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync ASSERT(audioAdapter);
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync /* disable? */
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync if (!strcmp(ValueUnion.psz, "none"))
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync {
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "null"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#ifdef RT_OS_WINDOWS
680c2aff33be2ee9340c8763a3cb5c218c352bcfvboxsync#ifdef VBOX_WITH_WINMM
30f07af559efcbd967e801903746fc21f81ee533vboxsync else if (!strcmp(ValueUnion.psz, "winmm"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
680c2aff33be2ee9340c8763a3cb5c218c352bcfvboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
680c2aff33be2ee9340c8763a3cb5c218c352bcfvboxsync#endif
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "dsound"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#endif /* RT_OS_WINDOWS */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#ifdef RT_OS_LINUX
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync# ifdef VBOX_WITH_ALSA
30f07af559efcbd967e801903746fc21f81ee533vboxsync else if (!strcmp(ValueUnion.psz, "alsa"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync# endif
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync# ifdef VBOX_WITH_PULSE
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "pulse"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync# endif
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#endif /* !RT_OS_LINUX */
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync#ifdef RT_OS_SOLARIS
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "solaudio"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#endif /* !RT_OS_SOLARIS */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#ifdef RT_OS_FREEBSD
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "oss"))
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync# ifdef VBOX_WITH_PULSE
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync else if (!strcmp(ValueUnion.psz, "pulse"))
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync# endif
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync#endif /* !RT_OS_FREEBSD */
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync#ifdef RT_OS_DARWIN
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync else if (!strcmp(ValueUnion.psz, "coreaudio"))
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
30f07af559efcbd967e801903746fc21f81ee533vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync#endif /* !RT_OS_DARWIN */
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync# if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(VBOX_WITH_SOLARIS_OSS)
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync else if (!strcmp(ValueUnion.psz, "oss"))
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync# endif
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync else
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync rc = E_FAIL;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync break;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_CLIPBOARD:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (!strcmp(ValueUnion.psz, "disabled"))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "hosttoguest"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "guesttohost"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else if (!strcmp(ValueUnion.psz, "bidirectional"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#ifdef VBOX_WITH_VRDP
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_VRDPPORT:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IVRDPServer> vrdpServer;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(vrdpServer);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "default"))
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr("0")));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_VRDPADDRESS:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IVRDPServer> vrdpServer;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(vrdpServer);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync case MODIFYVM_VRDPAUTHTYPE:
30f07af559efcbd967e801903746fc21f81ee533vboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IVRDPServer> vrdpServer;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(vrdpServer);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync if (!strcmp(ValueUnion.psz, "null"))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync else if (!strcmp(ValueUnion.psz, "external"))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync else if (!strcmp(ValueUnion.psz, "guest"))
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync else
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync errorArgument("Invalid --vrdpauthtype argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync break;
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync case MODIFYVM_VRDPMULTICON:
30f07af559efcbd967e801903746fc21f81ee533vboxsync {
28a2653de6f80a4b1f000cfc52e1a04492d4c151vboxsync ComPtr<IVRDPServer> vrdpServer;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(vrdpServer);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync case MODIFYVM_VRDPREUSECON:
9f997e760f610c92e3a365be21ead6972bc46130vboxsync {
9f997e760f610c92e3a365be21ead6972bc46130vboxsync ComPtr<IVRDPServer> vrdpServer;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync ASSERT(vrdpServer);
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
30f07af559efcbd967e801903746fc21f81ee533vboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync case MODIFYVM_VRDPVIDEOCHANNEL:
9f997e760f610c92e3a365be21ead6972bc46130vboxsync {
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync ComPtr<IVRDPServer> vrdpServer;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync ASSERT(vrdpServer);
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync CHECK_ERROR(vrdpServer, COMSETTER(VideoChannel)(ValueUnion.f));
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync case MODIFYVM_VRDPVIDEOCHANNELQUALITY:
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IVRDPServer> vrdpServer;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(vrdpServer);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(vrdpServer, COMSETTER(VideoChannelQuality)(ValueUnion.u32));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
817577d2c4d6dee709de7a92d3bb7d0aeedae9aevboxsync case MODIFYVM_VRDP:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ComPtr<IVRDPServer> vrdpServer;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync ASSERT(vrdpServer);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(vrdpServer, COMSETTER(Enabled)(ValueUnion.f));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync#endif /* VBOX_WITH_VRDP */
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
9f997e760f610c92e3a365be21ead6972bc46130vboxsync case MODIFYVM_USBEHCI:
9f997e760f610c92e3a365be21ead6972bc46130vboxsync {
9f997e760f610c92e3a365be21ead6972bc46130vboxsync ComPtr<IUSBController> UsbCtl;
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync if (SUCCEEDED(rc))
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(ValueUnion.f));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync break;
9f997e760f610c92e3a365be21ead6972bc46130vboxsync }
9f997e760f610c92e3a365be21ead6972bc46130vboxsync
9f997e760f610c92e3a365be21ead6972bc46130vboxsync case MODIFYVM_USB:
9f997e760f610c92e3a365be21ead6972bc46130vboxsync {
9f997e760f610c92e3a365be21ead6972bc46130vboxsync ComPtr<IUSBController> UsbCtl;
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync if (SUCCEEDED(rc))
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(ValueUnion.f));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync break;
9f997e760f610c92e3a365be21ead6972bc46130vboxsync }
9f997e760f610c92e3a365be21ead6972bc46130vboxsync
9f997e760f610c92e3a365be21ead6972bc46130vboxsync case MODIFYVM_SNAPSHOTFOLDER:
9f997e760f610c92e3a365be21ead6972bc46130vboxsync {
9f997e760f610c92e3a365be21ead6972bc46130vboxsync if (!strcmp(ValueUnion.psz, "default"))
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync else
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz)));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync break;
9f997e760f610c92e3a365be21ead6972bc46130vboxsync }
9f997e760f610c92e3a365be21ead6972bc46130vboxsync
9f997e760f610c92e3a365be21ead6972bc46130vboxsync case MODIFYVM_TELEPORTER_ENABLED:
9f997e760f610c92e3a365be21ead6972bc46130vboxsync {
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
9f997e760f610c92e3a365be21ead6972bc46130vboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_TELEPORTER_PORT:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync break;
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_TELEPORTER_ADDRESS:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz)));
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync break;
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync }
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync case MODIFYVM_TELEPORTER_PASSWORD:
eb259de2a9eac4b4dda56e89f5004671f926bd9bvboxsync {
30f07af559efcbd967e801903746fc21f81ee533vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_HARDWARE_UUID:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz)));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
30f07af559efcbd967e801903746fc21f81ee533vboxsync }
9f997e760f610c92e3a365be21ead6972bc46130vboxsync
9f997e760f610c92e3a365be21ead6972bc46130vboxsync case MODIFYVM_HPET:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
9f997e760f610c92e3a365be21ead6972bc46130vboxsync CHECK_ERROR(machine, COMSETTER(HpetEnabled)(ValueUnion.f));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_IOMGR:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
680c2aff33be2ee9340c8763a3cb5c218c352bcfvboxsync if (!strcmp(ValueUnion.psz, "simple"))
680c2aff33be2ee9340c8763a3cb5c218c352bcfvboxsync CHECK_ERROR(machine, COMSETTER(IoMgr)(IoMgrType_Simple));
680c2aff33be2ee9340c8763a3cb5c218c352bcfvboxsync else if (!strcmp(ValueUnion.psz, "async"))
30f07af559efcbd967e801903746fc21f81ee533vboxsync CHECK_ERROR(machine, COMSETTER(IoMgr)(IoMgrType_Async));
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync errorArgument("Invalid --iomgr argument '%s'", ValueUnion.psz);
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync rc = E_FAIL;
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync }
30f07af559efcbd967e801903746fc21f81ee533vboxsync break;
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync case MODIFYVM_IOBACKEND:
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync if (!strcmp(ValueUnion.psz, "buffered"))
f81115e612ee8fa2bc082db9d4c8879e33babc5avboxsync CHECK_ERROR(machine, COMSETTER(IoBackend)(IoBackendType_Buffered));
93e05ea894cefd56ca308d72372b4dd8045bd1eevboxsync else if (!strcmp(ValueUnion.psz, "unbuffered"))
90624af27b0e648b68167bd3b332d0e3b1d18ab1vboxsync CHECK_ERROR(machine, COMSETTER(IoBackend)(IoBackendType_Unbuffered));
30f07af559efcbd967e801903746fc21f81ee533vboxsync else
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync {
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync errorArgument("Invalid --iobackend argument '%s'", ValueUnion.psz);
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync rc = E_FAIL;
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync }
a60be2c64ea23bb7ce4c9998bcd541c4db879fbavboxsync break;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync case MODIFYVM_IOCACHE:
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync {
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync CHECK_ERROR(machine, COMSETTER(IoCacheEnabled)(ValueUnion.f));
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync break;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync case MODIFYVM_IOCACHESIZE:
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync {
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync CHECK_ERROR(machine, COMSETTER(IoCacheSize)(ValueUnion.u32));
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync break;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync case MODIFYVM_IOBANDWIDTHMAX:
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync {
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync CHECK_ERROR(machine, COMSETTER(IoBandwidthMax)(ValueUnion.u32));
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync break;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync default:
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync {
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion);
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync rc = E_FAIL;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync break;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync }
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync /* commit changes */
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync if (SUCCEEDED(rc))
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync CHECK_ERROR(machine, SaveSettings());
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync /* it's important to always close sessions */
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync a->session->Close();
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync return SUCCEEDED(rc) ? 0 : 1;
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync}
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync#endif /* !VBOX_ONLY_DOCS */
46b9d3cd08a855c5d0e968e4fff0e89dea3fc2dfvboxsync