VBoxManageModifyVM.cpp revision 67ee25dd0b63a61dc35a35d0aade75ca6cd06350
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync/* $Id$ */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync/** @file
3184fc1a3e65025cd55704cdb1629f4ab1f3ccd2vboxsync * VBoxManage - Implementation of modifyvm command.
3184fc1a3e65025cd55704cdb1629f4ab1f3ccd2vboxsync */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync/*
6eb6d0439d67fd4833f1d058b63bc9a56277b0b2vboxsync * Copyright (C) 2006-2012 Oracle Corporation
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync *
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * available from http://www.virtualbox.org. This file is free software;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * you can redistribute it and/or modify it under the terms of the GNU
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * General Public License (GPL) as published by the Free Software
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync/*******************************************************************************
be6a7ee8f237a71cf075c128e8e391e6c3654687vboxsync* Header Files *
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync*******************************************************************************/
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifndef VBOX_ONLY_DOCS
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <VBox/com/com.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <VBox/com/array.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <VBox/com/ErrorInfo.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <VBox/com/errorprint.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <VBox/com/EventQueue.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <VBox/com/VirtualBox.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif /* !VBOX_ONLY_DOCS */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <iprt/cidr.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <iprt/param.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <iprt/path.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <iprt/stream.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <iprt/string.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <iprt/getopt.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include <VBox/log.h>
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#include "VBoxManage.h"
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifndef VBOX_ONLY_DOCS
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsyncusing namespace com;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#if defined(_MSC_VER)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync# pragma optimize("g", off)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsyncenum
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync{
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NAME = 1000,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_OSTYPE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_MEMORY,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_PAGEFUSION,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRAM,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_FIRMWARE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_ACPI,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_IOAPIC,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_PAE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SYNTHCPU,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HWVIRTEX,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HWVIRTEXEXCLUSIVE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NESTEDPAGING,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_LARGEPAGES,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VTXVPID,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_CPUS,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_CPUHOTPLUG,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_PLUGCPU,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_UNPLUGCPU,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SETCPUID,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_DELCPUID,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_DELALLCPUID,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_MONITORCOUNT,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_ACCELERATE3D,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_ACCELERATE2DVIDEO,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BIOSLOGOFADEIN,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BIOSLOGOFADEOUT,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BIOSLOGODISPLAYTIME,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BIOSLOGOIMAGEPATH,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BIOSBOOTMENU,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BIOSSYSTEMTIMEOFFSET,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BIOSPXEDEBUG,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BOOT,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HDA, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HDB, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HDD, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_IDECONTROLLER, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SATAIDEEMULATION, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SATAPORTCOUNT, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SATAPORT, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SATA, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SCSIPORT, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SCSITYPE, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SCSI, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_DVDPASSTHROUGH, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_DVD, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_FLOPPY, // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICTRACEFILE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICTRACE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICPROPERTY,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICTYPE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICSPEED,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICBOOTPRIO,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICPROMISC,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NICBWGROUP,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NIC,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_CABLECONNECTED,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_BRIDGEADAPTER,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HOSTONLYADAPTER,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_INTNET,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATNET,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_GENERICDRV,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATBINDIP,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATSETTINGS,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATPF,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATALIASMODE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATTFTPPREFIX,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATTFTPFILE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATTFTPSERVER,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATDNSPASSDOMAIN,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATDNSPROXY,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_NATDNSHOSTRESOLVER,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_MACADDRESS,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HIDPTR,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HIDKBD,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_UARTMODE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_UART,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_LPTMODE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_LPT,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_GUESTMEMORYBALLOON,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_AUDIOCONTROLLER,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_AUDIO,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_CLIPBOARD,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDPPORT, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDPADDRESS, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDPAUTHTYPE, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDPMULTICON, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDPREUSECON, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDPVIDEOCHANNEL, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDPVIDEOCHANNELQUALITY, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDP, /* VRDE: deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEPROPERTY,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEPORT,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEADDRESS,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEAUTHTYPE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEAUTHLIBRARY,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEMULTICON,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEREUSECON,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEVIDEOCHANNEL,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDEVIDEOCHANNELQUALITY,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDE_EXTPACK,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_VRDE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_RTCUSEUTC,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_USBEHCI,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_USB,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_SNAPSHOTFOLDER,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_TELEPORTER_ENABLED,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_TELEPORTER_PORT,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_TELEPORTER_ADDRESS,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_TELEPORTER_PASSWORD,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HARDWARE_UUID,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_HPET,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_IOCACHE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_IOCACHESIZE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_FAULT_TOLERANCE,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_FAULT_TOLERANCE_ADDRESS,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_FAULT_TOLERANCE_PORT,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_FAULT_TOLERANCE_PASSWORD,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_CPU_EXECTUION_CAP,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifdef VBOX_WITH_PCI_PASSTHROUGH
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_ATTACH_PCI,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_DETACH_PCI,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync MODIFYVM_CHIPSET
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync};
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsyncstatic const RTGETOPTDEF g_aModifyVMOptions[] =
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync{
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--pagefusion", MODIFYVM_PAGEFUSION, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--largepages", MODIFYVM_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32 },
1d5386c32e68116bca5e054dbef008b1f516bb25vboxsync { "--cpuexecutioncap", MODIFYVM_CPU_EXECTUION_CAP, RTGETOPT_REQ_UINT32 },
1d5386c32e68116bca5e054dbef008b1f516bb25vboxsync { "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF },
1d5386c32e68116bca5e054dbef008b1f516bb25vboxsync { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64 },
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--sataideemulation", MODIFYVM_SATAIDEEMULATION, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nicproperty", MODIFYVM_NICPROPERTY, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nicbootprio", MODIFYVM_NICBOOTPRIO, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--nicpromisc", MODIFYVM_NICPROMISC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nicbandwidthgroup", MODIFYVM_NICBWGROUP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nicgenericdrv", MODIFYVM_GENERICDRV, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--natpf", MODIFYVM_NATPF, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nataliasmode", MODIFYVM_NATALIASMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nattftpprefix", MODIFYVM_NATTFTPPREFIX, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nattftpfile", MODIFYVM_NATTFTPFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--nattftpserver", MODIFYVM_NATTFTPSERVER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--natdnspassdomain", MODIFYVM_NATDNSPASSDOMAIN, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--natdnsproxy", MODIFYVM_NATDNSPROXY, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--lptmode", MODIFYVM_LPTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--lpt", MODIFYVM_LPT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdpvideochannel", MODIFYVM_VRDPVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdpvideochannelquality", MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING }, /* deprecated */
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdeproperty", MODIFYVM_VRDEPROPERTY, RTGETOPT_REQ_STRING },
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--vrdeport", MODIFYVM_VRDEPORT, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdeaddress", MODIFYVM_VRDEADDRESS, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdeauthtype", MODIFYVM_VRDEAUTHTYPE, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdeauthlibrary", MODIFYVM_VRDEAUTHLIBRARY, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdemulticon", MODIFYVM_VRDEMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdereusecon", MODIFYVM_VRDEREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdevideochannel", MODIFYVM_VRDEVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdevideochannelquality", MODIFYVM_VRDEVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrdeextpack", MODIFYVM_VRDE_EXTPACK, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--vrde", MODIFYVM_VRDE, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--faulttolerance", MODIFYVM_FAULT_TOLERANCE, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--faulttoleranceaddress", MODIFYVM_FAULT_TOLERANCE_ADDRESS, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--faulttoleranceport", MODIFYVM_FAULT_TOLERANCE_PORT, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--faulttolerancepassword", MODIFYVM_FAULT_TOLERANCE_PASSWORD, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--faulttolerancesyncinterval", MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL, RTGETOPT_REQ_UINT32 },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--chipset", MODIFYVM_CHIPSET, RTGETOPT_REQ_STRING },
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync#ifdef VBOX_WITH_PCI_PASSTHROUGH
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync { "--pciattach", MODIFYVM_ATTACH_PCI, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync { "--pcidetach", MODIFYVM_DETACH_PCI, RTGETOPT_REQ_STRING },
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync};
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsyncstatic void vrdeWarningDeprecatedOption(const char *pszOption)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync{
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync RTStrmPrintf(g_pStdErr, "Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n", pszOption, pszOption);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync}
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync/** Parse PCI address in format 01:02.03 and convert it to the numeric representation. */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsyncstatic int32_t parsePci(const char* szPciAddr)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync{
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync char* pszNext = (char*)szPciAddr;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync int rc;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync uint8_t aVals[3] = {0, 0, 0};
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = RTStrToUInt8Ex(pszNext, &pszNext, 16, &aVals[0]);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != ':')
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return -1;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[1]);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != '.')
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return -1;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[2]);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (RT_FAILURE(rc) || pszNext == NULL)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return -1;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return (aVals[0] << 8) | (aVals[1] << 3) | (aVals[2] << 0);
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync}
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsyncint handleModifyVM(HandlerArg *a)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync{
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync int c;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync HRESULT rc;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync Bstr name;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync RTGETOPTUNION ValueUnion;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync RTGETOPTSTATE GetOptState;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr <IMachine> machine;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr <IBIOSSettings> biosSettings;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* VM ID + at least one parameter. Parameter arguments are checked
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * individually. */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (a->argc < 2)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* try to find the given machine */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync machine.asOutParam()), 1);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* Get the number of network adapters */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, machine);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* open a session for the VM */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 1);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* get the mutable session machine */
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync a->session->COMGETTER(Machine)(machine.asOutParam());
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync while ( SUCCEEDED (rc)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync && (c = RTGetOpt(&GetOptState, &ValueUnion)))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync switch (c)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NAME:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_OSTYPE:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IGuestOSType> guestOSType;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz).raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync guestOSType.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc) && guestOSType)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).c_str());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_MEMORY:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_PAGEFUSION:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_VRAM:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_FIRMWARE:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "efi"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "efi32"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "efi64"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "efidual"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync }
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync else if (!strcmp(ValueUnion.psz, "bios"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync else
1041613dd6ee5da259fa80b5555bb556f4dd8aafvboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_ACPI:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_IOAPIC:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
be6a7ee8f237a71cf075c128e8e391e6c3654687vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_PAE:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SYNTHCPU:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HWVIRTEX:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HWVIRTEXEXCLUSIVE:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SETCPUID:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync uint32_t id = ValueUnion.u32;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync uint32_t aValue[4];
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync for (unsigned i = 0 ; i < 4 ; i++)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (RT_FAILURE(vrc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return errorSyntax(USAGE_MODIFYVM,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync "Missing or Invalid argument to '%s'",
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync GetOptState.pDef->pszLong);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync aValue[i] = ValueUnion.u32;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_DELCPUID:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_DELALLCPUID:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NESTEDPAGING:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_LARGEPAGES:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_VTXVPID:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_CPUS:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_RTCUSEUTC:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_CPUHOTPLUG:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
be6a7ee8f237a71cf075c128e8e391e6c3654687vboxsync CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_PLUGCPU:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_UNPLUGCPU:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_CPU_EXECTUION_CAP:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_MONITORCOUNT:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_ACCELERATE3D:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_ACCELERATE2DVIDEO:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BIOSLOGOFADEIN:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BIOSLOGOFADEOUT:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BIOSLOGODISPLAYTIME:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BIOSLOGOIMAGEPATH:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz).raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BIOSBOOTMENU:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "disabled"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "menuonly"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "messageandmenu"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BIOSPXEDEBUG:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BOOT:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "none"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "floppy"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "dvd"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "disk"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "net"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HDA: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HDB: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HDD: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SATAPORT: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync uint32_t u1 = 0, u2 = 0;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync Bstr bstrController = L"IDE Controller";
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync switch (c)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HDA: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync u1 = 0;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HDB: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync u1 = 0;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync u2 = 1;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_HDD: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync u1 = 1;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync u2 = 1;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SATAPORT: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync u1 = GetOptState.uIndex;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync bstrController = L"SATA";
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "none"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync machine->DetachDevice(bstrController.raw(), u1, u2);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IMedium> hardDisk;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync hardDisk, false /* fForceNewUuidOnOpen */,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync NULL);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (hardDisk)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, AttachDevice(bstrController.raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync u1, u2,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync DeviceType_HardDisk,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync hardDisk));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_IDECONTROLLER: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IStorageController> storageController;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync storageController.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SATAIDEEMULATION: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IStorageController> SataCtl;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync SataCtl.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SATAPORTCOUNT: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IStorageController> SataCtl;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync SataCtl.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SATA: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IStorageController> ctl;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, AddStorageController(Bstr("SATA").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync StorageBus_SATA,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ctl.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA").raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SCSIPORT: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "none"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = machine->DetachDevice(Bstr("LsiLogic").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync GetOptState.uIndex, 0);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync GetOptState.uIndex, 0));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IMedium> hardDisk;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync hardDisk, false /* fForceNewUuidOnOpen */,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync NULL);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (hardDisk)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = machine->AttachDevice(Bstr("LsiLogic").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync GetOptState.uIndex, 0,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync DeviceType_HardDisk,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync hardDisk);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync AttachDevice(Bstr("BusLogic").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync GetOptState.uIndex, 0,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync DeviceType_HardDisk,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync hardDisk));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SCSITYPE: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IStorageController> ctl;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync AddStorageController(Bstr("LsiLogic").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync StorageBus_SCSI,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ctl.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = machine->RemoveStorageController(Bstr("LsiLogic").raw());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic").raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync AddStorageController(Bstr("BusLogic").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync StorageBus_SCSI,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ctl.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_SCSI: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IStorageController> ctl;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync StorageBus_SCSI,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ctl.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_DVDPASSTHROUGH: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync 1, 0,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync !strcmp(ValueUnion.psz, "on")));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_DVD: // deprecated
be6a7ee8f237a71cf075c128e8e391e6c3654687vboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IMedium> dvdMedium;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* unmount? */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "none"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* nothing to do, NULL object will cause unmount */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* host drive? */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strncmp(ValueUnion.psz, "host:", 5))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IHost> host;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5).raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync dvdMedium.asOutParam());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!dvdMedium)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* 2nd try: try with the real name, important on Linux+libhal */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync char szPathReal[RTPATH_MAX];
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = host->FindHostDVDDrive(Bstr(szPathReal).raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync dvdMedium.asOutParam());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!dvdMedium)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_DVD,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync dvdMedium, false /* fForceNewUuidOnOpen */,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync NULL);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!dvdMedium)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller").raw(),
be6a7ee8f237a71cf075c128e8e391e6c3654687vboxsync 1, 0,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync dvdMedium,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync FALSE /* aForce */));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_FLOPPY: // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IMedium> floppyMedium;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IMediumAttachment> floppyAttachment;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync machine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync 0, 0, floppyAttachment.asOutParam());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* disable? */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "disabled"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* disable the controller */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (floppyAttachment)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync 0, 0));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* enable the controller */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!floppyAttachment)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync 0, 0,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync DeviceType_Floppy, NULL));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* unmount? */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if ( !strcmp(ValueUnion.psz, "none")
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync || !strcmp(ValueUnion.psz, "empty")) // deprecated
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* nothing to do, NULL object will cause unmount */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* host drive? */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strncmp(ValueUnion.psz, "host:", 5))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IHost> host;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5).raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync floppyMedium.asOutParam());
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!floppyMedium)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_Floppy,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync floppyMedium, false /* fForceNewUuidOnOpen */,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync NULL);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (FAILED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!floppyMedium)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller").raw(),
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync 0, 0,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync floppyMedium,
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync FALSE /* aForce */));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICTRACEFILE:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICTRACE:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICPROPERTY:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (nic)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* Parse 'name=value' */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync char *pszProperty = RTStrDup(ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (pszProperty)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync char *pDelimiter = strchr(pszProperty, '=');
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (pDelimiter)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync *pDelimiter = '\0';
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync Bstr bstrName = pszProperty;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync Bstr bstrValue = &pDelimiter[1];
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, SetProperty(bstrName.raw(), bstrValue.raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid --nicproperty%d argument '%s'", GetOptState.uIndex, ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync RTStrFree(pszProperty);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for --nicproperty%d '%s'\n", GetOptState.uIndex, ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICTYPE:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "Am79C970A"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "Am79C973"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifdef VBOX_WITH_E1000
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "82540EM"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "82543GC"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "82545EM"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#ifdef VBOX_WITH_VIRTIO
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "virtio"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync#endif /* VBOX_WITH_VIRTIO */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid NIC type '%s' specified for NIC %u", ValueUnion.psz, GetOptState.uIndex);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICSPEED:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICBOOTPRIO:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync * 0 for the default lowest priority).
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (ValueUnion.u32 > 4)
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICPROMISC:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "deny"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_Deny;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if ( !strcmp(ValueUnion.psz, "allow-vms")
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync || !strcmp(ValueUnion.psz, "allow-network"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowNetwork;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "allow-all"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowAll;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Unknown promiscuous mode policy '%s'", ValueUnion.psz);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_INVALIDARG;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(PromiscModePolicy)(enmPromiscModePolicy));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NICBWGROUP:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* Just remove the bandwidth group. */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(NULL));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IBandwidthControl> bwCtrl;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<IBandwidthGroup> bwGroup;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(bwCtrl, GetBandwidthGroup(Bstr(ValueUnion.psz).raw(), bwGroup.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (SUCCEEDED(rc))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(bwGroup));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_NIC:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "none"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "null"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Null));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "nat"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NAT));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if ( !strcmp(ValueUnion.psz, "bridged")
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Bridged));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "intnet"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Internal));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "hostonly"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnly));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else if (!strcmp(ValueUnion.psz, "generic"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Generic));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync rc = E_FAIL;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_CABLECONNECTED:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync break;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync case MODIFYVM_BRIDGEADAPTER:
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ComPtr<INetworkAdapter> nic;
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync ASSERT(nic);
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync /* remove it? */
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync if (!strcmp(ValueUnion.psz, "none"))
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr().raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync else
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync {
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr(ValueUnion.psz).raw()));
18470279db8a9fdd714617adbe1aa8b63cc80aeevboxsync }
3184fc1a3e65025cd55704cdb1629f4ab1f3ccd2vboxsync break;
}
case MODIFYVM_HOSTONLYADAPTER:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
/* remove it? */
if (!strcmp(ValueUnion.psz, "none"))
{
CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr().raw()));
}
else
{
CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr(ValueUnion.psz).raw()));
}
break;
}
case MODIFYVM_INTNET:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
/* remove it? */
if (!strcmp(ValueUnion.psz, "none"))
{
CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr().raw()));
}
else
{
CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz).raw()));
}
break;
}
case MODIFYVM_GENERICDRV:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMSETTER(GenericDriver)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_NATNET:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
const char *psz = ValueUnion.psz;
if (!strcmp("default", psz))
psz = "";
CHECK_ERROR(driver, COMSETTER(Network)(Bstr(psz).raw()));
break;
}
case MODIFYVM_NATBINDIP:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, COMSETTER(HostIP)(Bstr(ValueUnion.psz).raw()));
break;
}
#define ITERATE_TO_NEXT_TERM(ch) \
do { \
while (*ch != ',') \
{ \
if (*ch == 0) \
{ \
return errorSyntax(USAGE_MODIFYVM, \
"Missing or Invalid argument to '%s'", \
GetOptState.pDef->pszLong); \
} \
ch++; \
} \
*ch = '\0'; \
ch++; \
} while(0)
case MODIFYVM_NATSETTINGS:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
char *strMtu;
char *strSockSnd;
char *strSockRcv;
char *strTcpSnd;
char *strTcpRcv;
char *strRaw = RTStrDup(ValueUnion.psz);
char *ch = strRaw;
strMtu = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strSockSnd = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strSockRcv = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strTcpSnd = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strTcpRcv = RTStrStrip(ch);
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
RTStrToUInt32(strTcpSnd), RTStrToUInt32(strTcpRcv)));
break;
}
case MODIFYVM_NATPF:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
/* format name:proto:hostip:hostport:guestip:guestport*/
if (RTStrCmp(ValueUnion.psz, "delete") != 0)
{
char *strName;
char *strProto;
char *strHostIp;
char *strHostPort;
char *strGuestIp;
char *strGuestPort;
char *strRaw = RTStrDup(ValueUnion.psz);
char *ch = strRaw;
strName = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strProto = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strHostIp = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strHostPort = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strGuestIp = RTStrStrip(ch);
ITERATE_TO_NEXT_TERM(ch);
strGuestPort = RTStrStrip(ch);
NATProtocol_T proto;
if (RTStrICmp(strProto, "udp") == 0)
proto = NATProtocol_UDP;
else if (RTStrICmp(strProto, "tcp") == 0)
proto = NATProtocol_TCP;
else
{
errorArgument("Invalid proto '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
rc = E_FAIL;
break;
}
CHECK_ERROR(driver, AddRedirect(Bstr(strName).raw(), proto,
Bstr(strHostIp).raw(),
RTStrToUInt16(strHostPort),
Bstr(strGuestIp).raw(),
RTStrToUInt16(strGuestPort)));
}
else
{
/* delete NAT Rule operation */
int vrc;
vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
if (RT_FAILURE(vrc))
return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
CHECK_ERROR(driver, RemoveRedirect(Bstr(ValueUnion.psz).raw()));
}
break;
}
#undef ITERATE_TO_NEXT_TERM
case MODIFYVM_NATALIASMODE:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
uint32_t aliasMode = 0;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
if (RTStrCmp(ValueUnion.psz,"default") == 0)
{
aliasMode = 0;
}
else
{
char *token = (char *)ValueUnion.psz;
while(token)
{
if (RTStrNCmp(token, "log", 3) == 0)
aliasMode |= 0x1;
else if (RTStrNCmp(token, "proxyonly", 9) == 0)
aliasMode |= 0x2;
else if (RTStrNCmp(token, "sameports", 9) == 0)
aliasMode |= 0x4;
token = RTStrStr(token, ",");
if (token == NULL)
break;
token++;
}
}
CHECK_ERROR(driver, COMSETTER(AliasMode)(aliasMode));
break;
}
case MODIFYVM_NATTFTPPREFIX:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, COMSETTER(TftpPrefix)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_NATTFTPFILE:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, COMSETTER(TftpBootFile)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_NATTFTPSERVER:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, COMSETTER(TftpNextServer)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_NATDNSPASSDOMAIN:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, COMSETTER(DnsPassDomain)(ValueUnion.f));
break;
}
case MODIFYVM_NATDNSPROXY:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, COMSETTER(DnsProxy)(ValueUnion.f));
break;
}
case MODIFYVM_NATDNSHOSTRESOLVER:
{
ComPtr<INetworkAdapter> nic;
ComPtr<INATEngine> driver;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
CHECK_ERROR(driver, COMSETTER(DnsUseHostResolver)(ValueUnion.f));
break;
}
case MODIFYVM_MACADDRESS:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
/* generate one? */
if (!strcmp(ValueUnion.psz, "auto"))
{
CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr().raw()));
}
else
{
CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz).raw()));
}
break;
}
case MODIFYVM_HIDPTR:
{
bool fEnableUsb = false;
if (!strcmp(ValueUnion.psz, "ps2"))
{
CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_PS2Mouse));
}
else if (!strcmp(ValueUnion.psz, "usb"))
{
CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBMouse));
if (SUCCEEDED(rc))
fEnableUsb = true;
}
else if (!strcmp(ValueUnion.psz, "usbtablet"))
{
CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBTablet));
if (SUCCEEDED(rc))
fEnableUsb = true;
}
else
{
errorArgument("Invalid type '%s' specfied for pointing device", ValueUnion.psz);
rc = E_FAIL;
}
if (fEnableUsb)
{
/* Make sure the OHCI controller is enabled. */
ComPtr<IUSBController> UsbCtl;
rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
if (SUCCEEDED(rc))
{
BOOL fEnabled;
rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
if (FAILED(rc))
fEnabled = false;
if (!fEnabled)
CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
}
}
break;
}
case MODIFYVM_HIDKBD:
{
bool fEnableUsb = false;
if (!strcmp(ValueUnion.psz, "ps2"))
{
CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_PS2Keyboard));
}
else if (!strcmp(ValueUnion.psz, "usb"))
{
CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_USBKeyboard));
if (SUCCEEDED(rc))
fEnableUsb = true;
}
else
{
errorArgument("Invalid type '%s' specfied for keyboard", ValueUnion.psz);
rc = E_FAIL;
}
if (fEnableUsb)
{
/* Make sure the OHCI controller is enabled. */
ComPtr<IUSBController> UsbCtl;
rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
if (SUCCEEDED(rc))
{
BOOL fEnabled;
rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
if (FAILED(rc))
fEnabled = false;
if (!fEnabled)
CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
}
}
break;
}
case MODIFYVM_UARTMODE:
{
ComPtr<ISerialPort> uart;
char *pszIRQ = NULL;
CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
ASSERT(uart);
if (!strcmp(ValueUnion.psz, "disconnected"))
{
CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
}
else if ( !strcmp(ValueUnion.psz, "server")
|| !strcmp(ValueUnion.psz, "client")
|| !strcmp(ValueUnion.psz, "file"))
{
const char *pszMode = ValueUnion.psz;
int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
if (RT_FAILURE(vrc))
return errorSyntax(USAGE_MODIFYVM,
"Missing or Invalid argument to '%s'",
GetOptState.pDef->pszLong);
CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
if (!strcmp(pszMode, "server"))
{
CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
}
else if (!strcmp(pszMode, "client"))
{
CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
}
else if (!strcmp(pszMode, "file"))
{
CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
}
}
else
{
CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
}
break;
}
case MODIFYVM_UART:
{
ComPtr<ISerialPort> uart;
CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
ASSERT(uart);
if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
CHECK_ERROR(uart, COMSETTER(Enabled)(FALSE));
else
{
const char *pszIOBase = ValueUnion.psz;
uint32_t uVal = 0;
int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
if (RT_FAILURE(vrc))
return errorSyntax(USAGE_MODIFYVM,
"Missing or Invalid argument to '%s'",
GetOptState.pDef->pszLong);
CHECK_ERROR(uart, COMSETTER(IRQ)(ValueUnion.u32));
vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
if (vrc != VINF_SUCCESS || uVal == 0)
return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
CHECK_ERROR(uart, COMSETTER(IOBase)(uVal));
CHECK_ERROR(uart, COMSETTER(Enabled)(TRUE));
}
break;
}
#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
case MODIFYVM_LPTMODE:
{
ComPtr<IParallelPort> lpt;
char *pszIRQ = NULL;
CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
ASSERT(lpt);
CHECK_ERROR(lpt, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_LPT:
{
ComPtr<IParallelPort> lpt;
CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
ASSERT(lpt);
if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
CHECK_ERROR(lpt, COMSETTER(Enabled)(FALSE));
else
{
const char *pszIOBase = ValueUnion.psz;
uint32_t uVal = 0;
int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_LPT;
if (RT_FAILURE(vrc))
return errorSyntax(USAGE_MODIFYVM,
"Missing or Invalid argument to '%s'",
GetOptState.pDef->pszLong);
CHECK_ERROR(lpt, COMSETTER(IRQ)(ValueUnion.u32));
vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
if (vrc != VINF_SUCCESS || uVal == 0)
return errorArgument("Error parsing LPT I/O base '%s'", pszIOBase);
CHECK_ERROR(lpt, COMSETTER(IOBase)(uVal));
CHECK_ERROR(lpt, COMSETTER(Enabled)(TRUE));
}
break;
}
#endif
case MODIFYVM_GUESTMEMORYBALLOON:
{
CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
break;
}
case MODIFYVM_AUDIOCONTROLLER:
{
ComPtr<IAudioAdapter> audioAdapter;
machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
ASSERT(audioAdapter);
if (!strcmp(ValueUnion.psz, "sb16"))
CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
else if (!strcmp(ValueUnion.psz, "ac97"))
CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
else if (!strcmp(ValueUnion.psz, "hda"))
CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_HDA));
else
{
errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
rc = E_FAIL;
}
break;
}
case MODIFYVM_AUDIO:
{
ComPtr<IAudioAdapter> audioAdapter;
machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
ASSERT(audioAdapter);
/* disable? */
if (!strcmp(ValueUnion.psz, "none"))
{
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
}
else if (!strcmp(ValueUnion.psz, "null"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
#ifdef RT_OS_WINDOWS
#ifdef VBOX_WITH_WINMM
else if (!strcmp(ValueUnion.psz, "winmm"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
#endif
else if (!strcmp(ValueUnion.psz, "dsound"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
#endif /* RT_OS_WINDOWS */
#ifdef RT_OS_LINUX
# ifdef VBOX_WITH_ALSA
else if (!strcmp(ValueUnion.psz, "alsa"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
# endif
# ifdef VBOX_WITH_PULSE
else if (!strcmp(ValueUnion.psz, "pulse"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
# endif
#endif /* !RT_OS_LINUX */
#ifdef RT_OS_SOLARIS
else if (!strcmp(ValueUnion.psz, "solaudio"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
#endif /* !RT_OS_SOLARIS */
#ifdef RT_OS_FREEBSD
else if (!strcmp(ValueUnion.psz, "oss"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
# ifdef VBOX_WITH_PULSE
else if (!strcmp(ValueUnion.psz, "pulse"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
# endif
#endif /* !RT_OS_FREEBSD */
#ifdef RT_OS_DARWIN
else if (!strcmp(ValueUnion.psz, "coreaudio"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
#endif /* !RT_OS_DARWIN */
# if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(VBOX_WITH_SOLARIS_OSS)
else if (!strcmp(ValueUnion.psz, "oss"))
{
CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
}
# endif
else
{
errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
rc = E_FAIL;
}
break;
}
case MODIFYVM_CLIPBOARD:
{
if (!strcmp(ValueUnion.psz, "disabled"))
{
CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
}
else if (!strcmp(ValueUnion.psz, "hosttoguest"))
{
CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
}
else if (!strcmp(ValueUnion.psz, "guesttohost"))
{
CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
}
else if (!strcmp(ValueUnion.psz, "bidirectional"))
{
CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
}
else
{
errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
rc = E_FAIL;
}
break;
}
case MODIFYVM_VRDE_EXTPACK:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
if (vrdeServer)
{
if (strcmp(ValueUnion.psz, "default") != 0)
{
Bstr bstr(ValueUnion.psz);
CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(bstr.raw()));
}
else
CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(Bstr().raw()));
}
break;
}
case MODIFYVM_VRDEPROPERTY:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
if (vrdeServer)
{
/* Parse 'name=value' */
char *pszProperty = RTStrDup(ValueUnion.psz);
if (pszProperty)
{
char *pDelimiter = strchr(pszProperty, '=');
if (pDelimiter)
{
*pDelimiter = '\0';
Bstr bstrName = pszProperty;
Bstr bstrValue = &pDelimiter[1];
CHECK_ERROR(vrdeServer, SetVRDEProperty(bstrName.raw(), bstrValue.raw()));
}
else
{
RTStrFree(pszProperty);
errorArgument("Invalid --vrdeproperty argument '%s'", ValueUnion.psz);
rc = E_FAIL;
break;
}
RTStrFree(pszProperty);
}
else
{
RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for VRDE property '%s'\n", ValueUnion.psz);
rc = E_FAIL;
}
}
break;
}
case MODIFYVM_VRDPPORT:
vrdeWarningDeprecatedOption("port");
case MODIFYVM_VRDEPORT:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
if (!strcmp(ValueUnion.psz, "default"))
CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr("0").raw()));
else
CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_VRDPADDRESS:
vrdeWarningDeprecatedOption("address");
case MODIFYVM_VRDEADDRESS:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Address").raw(), Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_VRDPAUTHTYPE:
vrdeWarningDeprecatedOption("authtype");
case MODIFYVM_VRDEAUTHTYPE:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
if (!strcmp(ValueUnion.psz, "null"))
{
CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Null));
}
else if (!strcmp(ValueUnion.psz, "external"))
{
CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_External));
}
else if (!strcmp(ValueUnion.psz, "guest"))
{
CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Guest));
}
else
{
errorArgument("Invalid --vrdeauthtype argument '%s'", ValueUnion.psz);
rc = E_FAIL;
}
break;
}
case MODIFYVM_VRDEAUTHLIBRARY:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
if (vrdeServer)
{
if (strcmp(ValueUnion.psz, "default") != 0)
{
Bstr bstr(ValueUnion.psz);
CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(bstr.raw()));
}
else
CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(Bstr().raw()));
}
break;
}
case MODIFYVM_VRDPMULTICON:
vrdeWarningDeprecatedOption("multicon");
case MODIFYVM_VRDEMULTICON:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
CHECK_ERROR(vrdeServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
break;
}
case MODIFYVM_VRDPREUSECON:
vrdeWarningDeprecatedOption("reusecon");
case MODIFYVM_VRDEREUSECON:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
CHECK_ERROR(vrdeServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
break;
}
case MODIFYVM_VRDPVIDEOCHANNEL:
vrdeWarningDeprecatedOption("videochannel");
case MODIFYVM_VRDEVIDEOCHANNEL:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
ValueUnion.f? Bstr("true").raw(): Bstr("false").raw()));
break;
}
case MODIFYVM_VRDPVIDEOCHANNELQUALITY:
vrdeWarningDeprecatedOption("videochannelquality");
case MODIFYVM_VRDEVIDEOCHANNELQUALITY:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_VRDP:
vrdeWarningDeprecatedOption("");
case MODIFYVM_VRDE:
{
ComPtr<IVRDEServer> vrdeServer;
machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
ASSERT(vrdeServer);
CHECK_ERROR(vrdeServer, COMSETTER(Enabled)(ValueUnion.f));
break;
}
case MODIFYVM_USBEHCI:
{
ComPtr<IUSBController> UsbCtl;
CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
if (SUCCEEDED(rc))
CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(ValueUnion.f));
break;
}
case MODIFYVM_USB:
{
ComPtr<IUSBController> UsbCtl;
CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
if (SUCCEEDED(rc))
CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(ValueUnion.f));
break;
}
case MODIFYVM_SNAPSHOTFOLDER:
{
if (!strcmp(ValueUnion.psz, "default"))
CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr().raw()));
else
CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_TELEPORTER_ENABLED:
{
CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
break;
}
case MODIFYVM_TELEPORTER_PORT:
{
CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
break;
}
case MODIFYVM_TELEPORTER_ADDRESS:
{
CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_TELEPORTER_PASSWORD:
{
CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_FAULT_TOLERANCE:
{
if (!strcmp(ValueUnion.psz, "master"))
{
CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Master)));
}
else
if (!strcmp(ValueUnion.psz, "standby"))
{
CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Standby)));
}
else
{
errorArgument("Invalid --faulttolerance argument '%s'", ValueUnion.psz);
rc = E_FAIL;
}
break;
}
case MODIFYVM_FAULT_TOLERANCE_ADDRESS:
{
CHECK_ERROR(machine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_FAULT_TOLERANCE_PORT:
{
CHECK_ERROR(machine, COMSETTER(FaultTolerancePort)(ValueUnion.u32));
break;
}
case MODIFYVM_FAULT_TOLERANCE_PASSWORD:
{
CHECK_ERROR(machine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL:
{
CHECK_ERROR(machine, COMSETTER(FaultToleranceSyncInterval)(ValueUnion.u32));
break;
}
case MODIFYVM_HARDWARE_UUID:
{
CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_HPET:
{
CHECK_ERROR(machine, COMSETTER(HpetEnabled)(ValueUnion.f));
break;
}
case MODIFYVM_IOCACHE:
{
CHECK_ERROR(machine, COMSETTER(IoCacheEnabled)(ValueUnion.f));
break;
}
case MODIFYVM_IOCACHESIZE:
{
CHECK_ERROR(machine, COMSETTER(IoCacheSize)(ValueUnion.u32));
break;
}
case MODIFYVM_CHIPSET:
{
if (!strcmp(ValueUnion.psz, "piix3"))
{
CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
}
else if (!strcmp(ValueUnion.psz, "ich9"))
{
CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_ICH9));
BOOL fIoApic = FALSE;
CHECK_ERROR(biosSettings, COMGETTER(IOAPICEnabled)(&fIoApic));
if (!fIoApic)
{
RTStrmPrintf(g_pStdErr, "*** I/O APIC must be enabled for ICH9, enabling. ***\n");
CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(TRUE));
}
}
else
{
errorArgument("Invalid --chipset argument '%s' (valid: piix3,ich9)", ValueUnion.psz);
rc = E_FAIL;
}
break;
}
#ifdef VBOX_WITH_PCI_PASSTHROUGH
case MODIFYVM_ATTACH_PCI:
{
const char* pAt = strchr(ValueUnion.psz, '@');
int32_t iHostAddr, iGuestAddr;
iHostAddr = parsePci(ValueUnion.psz);
iGuestAddr = pAt != NULL ? parsePci(pAt + 1) : iHostAddr;
if (iHostAddr == -1 || iGuestAddr == -1)
{
errorArgument("Invalid --pciattach argument '%s' (valid: 'HB:HD.HF@GB:GD.GF' or just 'HB:HD.HF')", ValueUnion.psz);
rc = E_FAIL;
}
else
{
CHECK_ERROR(machine, AttachHostPciDevice(iHostAddr, iGuestAddr, TRUE));
}
break;
}
case MODIFYVM_DETACH_PCI:
{
int32_t iHostAddr;
iHostAddr = parsePci(ValueUnion.psz);
if (iHostAddr == -1)
{
errorArgument("Invalid --pcidetach argument '%s' (valid: 'HB:HD.HF')", ValueUnion.psz);
rc = E_FAIL;
}
else
{
CHECK_ERROR(machine, DetachHostPciDevice(iHostAddr));
}
break;
}
#endif
default:
{
errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion);
rc = E_FAIL;
break;
}
}
}
/* commit changes */
if (SUCCEEDED(rc))
CHECK_ERROR(machine, SaveSettings());
/* it's important to always close sessions */
a->session->UnlockMachine();
return SUCCEEDED(rc) ? 0 : 1;
}
#endif /* !VBOX_ONLY_DOCS */