VBoxManageModifyVM.cpp revision a9315925c69e4c3bb342bb317ca5b6d29e1ee467
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync/* $Id$ */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync/** @file
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * VBoxManage - Implementation of modifyvm command.
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync/*
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * Copyright (C) 2006-2012 Oracle Corporation
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync *
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * available from http://www.virtualbox.org. This file is free software;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * you can redistribute it and/or modify it under the terms of the GNU
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * General Public License (GPL) as published by the Free Software
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync/*******************************************************************************
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync* Header Files *
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync*******************************************************************************/
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#ifndef VBOX_ONLY_DOCS
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <VBox/com/com.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <VBox/com/array.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <VBox/com/ErrorInfo.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <VBox/com/errorprint.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <VBox/com/EventQueue.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <VBox/com/VirtualBox.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#endif /* !VBOX_ONLY_DOCS */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <iprt/cidr.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <iprt/param.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <iprt/path.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <iprt/stream.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <iprt/string.h>
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync#include <iprt/getopt.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include <VBox/log.h>
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#include "VBoxManage.h"
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#ifndef VBOX_ONLY_DOCS
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsyncusing namespace com;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync#if defined(_MSC_VER)
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync# pragma optimize("g", off)
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync#endif
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsyncenum
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync{
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_NAME = 1000,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_OSTYPE,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_MEMORY,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_PAGEFUSION,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_VRAM,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_FIRMWARE,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_ACPI,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_IOAPIC,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_PAE,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_SYNTHCPU,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_HWVIRTEX,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_HWVIRTEXEXCLUSIVE,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_NESTEDPAGING,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_LARGEPAGES,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_VTXVPID,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_CPUS,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_CPUHOTPLUG,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_PLUGCPU,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_UNPLUGCPU,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_SETCPUID,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_DELCPUID,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_DELALLCPUID,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_MONITORCOUNT,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_ACCELERATE3D,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_ACCELERATE2DVIDEO,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync#endif
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_BIOSLOGOFADEIN,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_BIOSLOGOFADEOUT,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_BIOSLOGODISPLAYTIME,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_BIOSLOGOIMAGEPATH,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_BIOSBOOTMENU,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_BIOSSYSTEMTIMEOFFSET,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_BIOSPXEDEBUG,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_BOOT,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_HDA, // deprecated
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_HDB, // deprecated
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_HDD, // deprecated
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_IDECONTROLLER, // deprecated
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_SATAIDEEMULATION, // deprecated
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_SATAPORTCOUNT, // deprecated
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_SATAPORT, // deprecated
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_SATA, // deprecated
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_SCSIPORT, // deprecated
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_SCSITYPE, // deprecated
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_SCSI, // deprecated
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_DVDPASSTHROUGH, // deprecated
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_DVD, // deprecated
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_FLOPPY, // deprecated
8077a3fb4024022d405598797d3ed75c667a912fvboxsync MODIFYVM_NICTRACEFILE,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_NICTRACE,
8077a3fb4024022d405598797d3ed75c667a912fvboxsync MODIFYVM_NICPROPERTY,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_NICTYPE,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_NICSPEED,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_NICBOOTPRIO,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_NICPROMISC,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_NICBWGROUP,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_NIC,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_CABLECONNECTED,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_BRIDGEADAPTER,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_HOSTONLYADAPTER,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_INTNET,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_NATNET,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_GENERICDRV,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_NATBINDIP,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_NATSETTINGS,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_NATPF,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_NATALIASMODE,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_NATTFTPPREFIX,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_NATTFTPFILE,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_NATTFTPSERVER,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_NATDNSPASSDOMAIN,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_NATDNSPROXY,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_NATDNSHOSTRESOLVER,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_MACADDRESS,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_HIDPTR,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_HIDKBD,
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync MODIFYVM_UARTMODE,
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync MODIFYVM_UART,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync MODIFYVM_LPTMODE,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_LPT,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync#endif
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_GUESTMEMORYBALLOON,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_AUDIOCONTROLLER,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_AUDIO,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_CLIPBOARD,
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync MODIFYVM_VRDPPORT, /* VRDE: deprecated */
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync MODIFYVM_VRDPADDRESS, /* VRDE: deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_VRDPAUTHTYPE, /* VRDE: deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_VRDPMULTICON, /* VRDE: deprecated */
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync MODIFYVM_VRDPREUSECON, /* VRDE: deprecated */
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync MODIFYVM_VRDPVIDEOCHANNEL, /* VRDE: deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_VRDPVIDEOCHANNELQUALITY, /* VRDE: deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_VRDP, /* VRDE: deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_VRDEPROPERTY,
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync MODIFYVM_VRDEPORT,
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync MODIFYVM_VRDEADDRESS,
8077a3fb4024022d405598797d3ed75c667a912fvboxsync MODIFYVM_VRDEAUTHTYPE,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_VRDEAUTHLIBRARY,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_VRDEMULTICON,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_VRDEREUSECON,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_VRDEVIDEOCHANNEL,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_VRDEVIDEOCHANNELQUALITY,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_VRDE_EXTPACK,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_VRDE,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_RTCUSEUTC,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_USBEHCI,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_USB,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_SNAPSHOTFOLDER,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_TELEPORTER_ENABLED,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_TELEPORTER_PORT,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_TELEPORTER_ADDRESS,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_TELEPORTER_PASSWORD,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_TRACING_ENABLED,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_TRACING_CONFIG,
3cd31efc45d9b3b5118748be299da2f298307cddvboxsync MODIFYVM_TRACING_ALLOW_VM_ACCESS,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_HARDWARE_UUID,
a44a181b748735a02cc0e8c192f3ec1fac1af796vboxsync MODIFYVM_HPET,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_IOCACHE,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_IOCACHESIZE,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_FAULT_TOLERANCE,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_FAULT_TOLERANCE_ADDRESS,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_FAULT_TOLERANCE_PORT,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_FAULT_TOLERANCE_PASSWORD,
a44a181b748735a02cc0e8c192f3ec1fac1af796vboxsync MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync MODIFYVM_CPU_EXECTUION_CAP,
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync#ifdef VBOX_WITH_PCI_PASSTHROUGH
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_ATTACH_PCI,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_DETACH_PCI,
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync#endif
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync MODIFYVM_CHIPSET
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync};
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsyncstatic const RTGETOPTDEF g_aModifyVMOptions[] =
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync{
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--pagefusion", MODIFYVM_PAGEFUSION, RTGETOPT_REQ_BOOL_ONOFF },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32 },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--largepages", MODIFYVM_LARGEPAGES, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
8077a3fb4024022d405598797d3ed75c667a912fvboxsync { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32 },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32 },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32 },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--cpuexecutioncap", MODIFYVM_CPU_EXECTUION_CAP, RTGETOPT_REQ_UINT32 },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync#endif
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT32 },
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64 },
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING },
fb846a5cde5068b8fc9880a7b59ab1dbc01c1680vboxsync { "--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING },
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync { "--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING },
fb846a5cde5068b8fc9880a7b59ab1dbc01c1680vboxsync { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
8077a3fb4024022d405598797d3ed75c667a912fvboxsync { "--sataideemulation", MODIFYVM_SATAIDEEMULATION, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nicproperty", MODIFYVM_NICPROPERTY, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nicbootprio", MODIFYVM_NICBOOTPRIO, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nicpromisc", MODIFYVM_NICPROMISC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nicbandwidthgroup", MODIFYVM_NICBWGROUP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--nicgenericdrv", MODIFYVM_GENERICDRV, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--natpf", MODIFYVM_NATPF, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nataliasmode", MODIFYVM_NATALIASMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nattftpprefix", MODIFYVM_NATTFTPPREFIX, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--nattftpfile", MODIFYVM_NATTFTPFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--nattftpserver", MODIFYVM_NATTFTPSERVER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--natdnspassdomain", MODIFYVM_NATDNSPASSDOMAIN, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--natdnsproxy", MODIFYVM_NATDNSPROXY, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--lptmode", MODIFYVM_LPTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--lpt", MODIFYVM_LPT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync#endif
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
cb5363b6fa48f10b080cb6195f56c0823f7c0b0fvboxsync { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING }, /* deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING }, /* deprecated */
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING }, /* deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdpvideochannel", MODIFYVM_VRDPVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdpvideochannelquality", MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING }, /* deprecated */
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
cb5363b6fa48f10b080cb6195f56c0823f7c0b0fvboxsync { "--vrdeproperty", MODIFYVM_VRDEPROPERTY, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdeport", MODIFYVM_VRDEPORT, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdeaddress", MODIFYVM_VRDEADDRESS, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdeauthtype", MODIFYVM_VRDEAUTHTYPE, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdeauthlibrary", MODIFYVM_VRDEAUTHLIBRARY, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdemulticon", MODIFYVM_VRDEMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdereusecon", MODIFYVM_VRDEREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdevideochannel", MODIFYVM_VRDEVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdevideochannelquality", MODIFYVM_VRDEVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrdeextpack", MODIFYVM_VRDE_EXTPACK, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--vrde", MODIFYVM_VRDE, RTGETOPT_REQ_BOOL_ONOFF },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--tracing-enabled", MODIFYVM_TRACING_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync { "--tracing-config", MODIFYVM_TRACING_CONFIG, RTGETOPT_REQ_STRING },
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync { "--tracing-allow-vm-access", MODIFYVM_TRACING_ALLOW_VM_ACCESS, RTGETOPT_REQ_BOOL_ONOFF },
cb5363b6fa48f10b080cb6195f56c0823f7c0b0fvboxsync { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
cb5363b6fa48f10b080cb6195f56c0823f7c0b0fvboxsync { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF },
cb5363b6fa48f10b080cb6195f56c0823f7c0b0fvboxsync { "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32 },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--faulttolerance", MODIFYVM_FAULT_TOLERANCE, RTGETOPT_REQ_STRING },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--faulttoleranceaddress", MODIFYVM_FAULT_TOLERANCE_ADDRESS, RTGETOPT_REQ_STRING },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--faulttoleranceport", MODIFYVM_FAULT_TOLERANCE_PORT, RTGETOPT_REQ_UINT32 },
8077a3fb4024022d405598797d3ed75c667a912fvboxsync { "--faulttolerancepassword", MODIFYVM_FAULT_TOLERANCE_PASSWORD, RTGETOPT_REQ_STRING },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--faulttolerancesyncinterval", MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL, RTGETOPT_REQ_UINT32 },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--chipset", MODIFYVM_CHIPSET, RTGETOPT_REQ_STRING },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync#ifdef VBOX_WITH_PCI_PASSTHROUGH
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--pciattach", MODIFYVM_ATTACH_PCI, RTGETOPT_REQ_STRING },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync { "--pcidetach", MODIFYVM_DETACH_PCI, RTGETOPT_REQ_STRING },
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync#endif
8077a3fb4024022d405598797d3ed75c667a912fvboxsync};
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsyncstatic void vrdeWarningDeprecatedOption(const char *pszOption)
8077a3fb4024022d405598797d3ed75c667a912fvboxsync{
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync RTStrmPrintf(g_pStdErr, "Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n", pszOption, pszOption);
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync}
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync/** Parse PCI address in format 01:02.03 and convert it to the numeric representation. */
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsyncstatic int32_t parsePci(const char* szPciAddr)
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync{
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync char* pszNext = (char*)szPciAddr;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync int rc;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync uint8_t aVals[3] = {0, 0, 0};
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
08870164da59f90379b1ea9b5a2476296c362217vboxsync rc = RTStrToUInt8Ex(pszNext, &pszNext, 16, &aVals[0]);
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != ':')
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync return -1;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[1]);
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != '.')
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync return -1;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[2]);
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync if (RT_FAILURE(rc) || pszNext == NULL)
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync return -1;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync return (aVals[0] << 8) | (aVals[1] << 3) | (aVals[2] << 0);
08870164da59f90379b1ea9b5a2476296c362217vboxsync}
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsyncint handleModifyVM(HandlerArg *a)
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync{
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync int c;
c68a3984216eaa85ae7144b3b0d9b168276dbcf3vboxsync HRESULT rc;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync Bstr name;
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync RTGETOPTUNION ValueUnion;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync RTGETOPTSTATE GetOptState;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync ComPtr <IMachine> machine;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync ComPtr <IBIOSSettings> biosSettings;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync /* VM ID + at least one parameter. Parameter arguments are checked
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync * individually. */
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync if (a->argc < 2)
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync /* try to find the given machine */
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync machine.asOutParam()), 1);
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync /* Get the number of network adapters */
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, machine);
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync /* open a session for the VM */
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 1);
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync /* get the mutable session machine */
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync a->session->COMGETTER(Machine)(machine.asOutParam());
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync while ( SUCCEEDED (rc)
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync && (c = RTGetOpt(&GetOptState, &ValueUnion)))
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync switch (c)
c68a3984216eaa85ae7144b3b0d9b168276dbcf3vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_NAME:
c68a3984216eaa85ae7144b3b0d9b168276dbcf3vboxsync {
c68a3984216eaa85ae7144b3b0d9b168276dbcf3vboxsync CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_OSTYPE:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
08870164da59f90379b1ea9b5a2476296c362217vboxsync ComPtr<IGuestOSType> guestOSType;
08870164da59f90379b1ea9b5a2476296c362217vboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz).raw(),
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync guestOSType.asOutParam()));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync if (SUCCEEDED(rc) && guestOSType)
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
08870164da59f90379b1ea9b5a2476296c362217vboxsync CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync else
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).c_str());
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync rc = E_FAIL;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync break;
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_MEMORY:
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync {
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_PAGEFUSION:
08870164da59f90379b1ea9b5a2476296c362217vboxsync {
08870164da59f90379b1ea9b5a2476296c362217vboxsync CHECK_ERROR(machine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
08870164da59f90379b1ea9b5a2476296c362217vboxsync case MODIFYVM_VRAM:
08870164da59f90379b1ea9b5a2476296c362217vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
08870164da59f90379b1ea9b5a2476296c362217vboxsync }
c68a3984216eaa85ae7144b3b0d9b168276dbcf3vboxsync
c68a3984216eaa85ae7144b3b0d9b168276dbcf3vboxsync case MODIFYVM_FIRMWARE:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync if (!strcmp(ValueUnion.psz, "efi"))
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync {
c68a3984216eaa85ae7144b3b0d9b168276dbcf3vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync else if (!strcmp(ValueUnion.psz, "efi32"))
08870164da59f90379b1ea9b5a2476296c362217vboxsync {
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync }
08870164da59f90379b1ea9b5a2476296c362217vboxsync else if (!strcmp(ValueUnion.psz, "efi64"))
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync else if (!strcmp(ValueUnion.psz, "efidual"))
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync else if (!strcmp(ValueUnion.psz, "bios"))
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync {
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync else
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync rc = E_FAIL;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync }
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_ACPI:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
08870164da59f90379b1ea9b5a2476296c362217vboxsync case MODIFYVM_IOAPIC:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync }
08870164da59f90379b1ea9b5a2476296c362217vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_PAE:
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync {
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync break;
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync case MODIFYVM_SYNTHCPU:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_HWVIRTEX:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_HWVIRTEXEXCLUSIVE:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_SETCPUID:
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync uint32_t id = ValueUnion.u32;
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync uint32_t aValue[4];
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync for (unsigned i = 0 ; i < 4 ; i++)
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync if (RT_FAILURE(vrc))
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync return errorSyntax(USAGE_MODIFYVM,
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync "Missing or Invalid argument to '%s'",
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync GetOptState.pDef->pszLong);
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync aValue[i] = ValueUnion.u32;
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync case MODIFYVM_DELCPUID:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync break;
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync }
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync case MODIFYVM_DELALLCPUID:
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_NESTEDPAGING:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
04e639b004793691f051abcd5b3c811c6b6b6f86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_LARGEPAGES:
4b0369e0c9bcae37f2801e0f7b92509bbbaf4becvboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync break;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync case MODIFYVM_VTXVPID:
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync {
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync case MODIFYVM_CPUS:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync case MODIFYVM_RTCUSEUTC:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
c364b6c44a252ab65b514fa8f9a665cc5e33a1cevboxsync break;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync }
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync case MODIFYVM_CPUHOTPLUG:
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync {
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync }
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_PLUGCPU:
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync {
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync }
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync case MODIFYVM_UNPLUGCPU:
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync {
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync break;
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_CPU_EXECTUION_CAP:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_MONITORCOUNT:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync case MODIFYVM_ACCELERATE3D:
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync {
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync break;
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync }
f73c807e7ef6a1a6c10ec5cd9b36ee835cfaa241vboxsync
e75313c24325ec7bec84fa349abb39e246b6cc86vboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
2f8244f574b4b9f99af99b7472984f3e60ea93d0vboxsync case MODIFYVM_ACCELERATE2DVIDEO:
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync break;
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync#endif
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync case MODIFYVM_BIOSLOGOFADEIN:
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync break;
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync case MODIFYVM_BIOSLOGOFADEOUT:
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync break;
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync case MODIFYVM_BIOSLOGODISPLAYTIME:
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync break;
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync case MODIFYVM_BIOSLOGOIMAGEPATH:
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz).raw()));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync break;
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync case MODIFYVM_BIOSBOOTMENU:
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync if (!strcmp(ValueUnion.psz, "disabled"))
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync else if (!strcmp(ValueUnion.psz, "menuonly"))
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync else if (!strcmp(ValueUnion.psz, "messageandmenu"))
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync else
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync rc = E_FAIL;
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync break;
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync }
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync {
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync break;
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync }
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync case MODIFYVM_BIOSPXEDEBUG:
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync {
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync break;
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync }
ff3996360d63d42b188c1696d4760641a7762ce9vboxsync
f0dd841cb99154da8ec0a31cae2f89044895a23fvboxsync case MODIFYVM_BOOT:
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync {
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync if (!strcmp(ValueUnion.psz, "none"))
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync {
a2b66e2b8b92cf2d0706078798036035cb9fa94dvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync }
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync else if (!strcmp(ValueUnion.psz, "floppy"))
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync {
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync }
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync else if (!strcmp(ValueUnion.psz, "dvd"))
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync {
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync }
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync else if (!strcmp(ValueUnion.psz, "disk"))
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync {
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync }
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync else if (!strcmp(ValueUnion.psz, "net"))
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync {
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync }
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync else
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync break;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync }
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync case MODIFYVM_HDA: // deprecated
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync case MODIFYVM_HDB: // deprecated
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync case MODIFYVM_HDD: // deprecated
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync case MODIFYVM_SATAPORT: // deprecated
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync {
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync uint32_t u1 = 0, u2 = 0;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync Bstr bstrController = L"IDE Controller";
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync switch (c)
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync {
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync case MODIFYVM_HDA: // deprecated
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync u1 = 0;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync break;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync case MODIFYVM_HDB: // deprecated
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync u1 = 0;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync u2 = 1;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync break;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync case MODIFYVM_HDD: // deprecated
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync u1 = 1;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync u2 = 1;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync break;
2b14f26c96a20e40e9a0c9e3c41b41315f6c6e96vboxsync
c0ae9fb031e70c0e5f4098a46ab11262097c88f9vboxsync case MODIFYVM_SATAPORT: // deprecated
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync u1 = GetOptState.uIndex;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync bstrController = L"SATA";
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync break;
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync }
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync if (!strcmp(ValueUnion.psz, "none"))
5d1fc7f6c660e826d7f81c580fbf4278dd44c6bdvboxsync {
machine->DetachDevice(bstrController.raw(), u1, u2);
}
else
{
ComPtr<IMedium> hardDisk;
rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
hardDisk, false /* fForceNewUuidOnOpen */,
NULL);
if (FAILED(rc))
break;
if (hardDisk)
{
CHECK_ERROR(machine, AttachDevice(bstrController.raw(),
u1, u2,
DeviceType_HardDisk,
hardDisk));
}
else
rc = E_FAIL;
}
break;
}
case MODIFYVM_IDECONTROLLER: // deprecated
{
ComPtr<IStorageController> storageController;
CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
storageController.asOutParam()));
if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
{
CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
}
else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
{
CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
}
else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
{
CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
}
else
{
errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
rc = E_FAIL;
}
break;
}
case MODIFYVM_SATAIDEEMULATION: // deprecated
{
ComPtr<IStorageController> SataCtl;
CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
SataCtl.asOutParam()));
if (SUCCEEDED(rc))
CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
break;
}
case MODIFYVM_SATAPORTCOUNT: // deprecated
{
ComPtr<IStorageController> SataCtl;
CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
SataCtl.asOutParam()));
if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
break;
}
case MODIFYVM_SATA: // deprecated
{
if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
{
ComPtr<IStorageController> ctl;
CHECK_ERROR(machine, AddStorageController(Bstr("SATA").raw(),
StorageBus_SATA,
ctl.asOutParam()));
CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
}
else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA").raw()));
else
return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
break;
}
case MODIFYVM_SCSIPORT: // deprecated
{
if (!strcmp(ValueUnion.psz, "none"))
{
rc = machine->DetachDevice(Bstr("LsiLogic").raw(),
GetOptState.uIndex, 0);
if (FAILED(rc))
CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic").raw(),
GetOptState.uIndex, 0));
}
else
{
ComPtr<IMedium> hardDisk;
rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
hardDisk, false /* fForceNewUuidOnOpen */,
NULL);
if (FAILED(rc))
break;
if (hardDisk)
{
rc = machine->AttachDevice(Bstr("LsiLogic").raw(),
GetOptState.uIndex, 0,
DeviceType_HardDisk,
hardDisk);
if (FAILED(rc))
CHECK_ERROR(machine,
AttachDevice(Bstr("BusLogic").raw(),
GetOptState.uIndex, 0,
DeviceType_HardDisk,
hardDisk));
}
else
rc = E_FAIL;
}
break;
}
case MODIFYVM_SCSITYPE: // deprecated
{
ComPtr<IStorageController> ctl;
if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
{
rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
if (FAILED(rc))
CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
CHECK_ERROR(machine,
AddStorageController(Bstr("LsiLogic").raw(),
StorageBus_SCSI,
ctl.asOutParam()));
if (SUCCEEDED(rc))
CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
}
else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
{
rc = machine->RemoveStorageController(Bstr("LsiLogic").raw());
if (FAILED(rc))
CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic").raw()));
CHECK_ERROR(machine,
AddStorageController(Bstr("BusLogic").raw(),
StorageBus_SCSI,
ctl.asOutParam()));
if (SUCCEEDED(rc))
CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
}
else
return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
break;
}
case MODIFYVM_SCSI: // deprecated
{
if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
{
ComPtr<IStorageController> ctl;
CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic").raw(),
StorageBus_SCSI,
ctl.asOutParam()));
if (SUCCEEDED(rc))
CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
}
else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
{
rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
if (FAILED(rc))
CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
}
break;
}
case MODIFYVM_DVDPASSTHROUGH: // deprecated
{
CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller").raw(),
1, 0,
!strcmp(ValueUnion.psz, "on")));
break;
}
case MODIFYVM_DVD: // deprecated
{
ComPtr<IMedium> dvdMedium;
/* unmount? */
if (!strcmp(ValueUnion.psz, "none"))
{
/* nothing to do, NULL object will cause unmount */
}
/* host drive? */
else if (!strncmp(ValueUnion.psz, "host:", 5))
{
ComPtr<IHost> host;
CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5).raw(),
dvdMedium.asOutParam());
if (!dvdMedium)
{
/* 2nd try: try with the real name, important on Linux+libhal */
char szPathReal[RTPATH_MAX];
if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
{
errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
rc = E_FAIL;
break;
}
rc = host->FindHostDVDDrive(Bstr(szPathReal).raw(),
dvdMedium.asOutParam());
if (!dvdMedium)
{
errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
rc = E_FAIL;
break;
}
}
}
else
{
rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_DVD,
dvdMedium, false /* fForceNewUuidOnOpen */,
NULL);
if (FAILED(rc))
break;
if (!dvdMedium)
{
rc = E_FAIL;
break;
}
}
CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller").raw(),
1, 0,
dvdMedium,
FALSE /* aForce */));
break;
}
case MODIFYVM_FLOPPY: // deprecated
{
ComPtr<IMedium> floppyMedium;
ComPtr<IMediumAttachment> floppyAttachment;
machine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
0, 0, floppyAttachment.asOutParam());
/* disable? */
if (!strcmp(ValueUnion.psz, "disabled"))
{
/* disable the controller */
if (floppyAttachment)
CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller").raw(),
0, 0));
}
else
{
/* enable the controller */
if (!floppyAttachment)
CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller").raw(),
0, 0,
DeviceType_Floppy, NULL));
/* unmount? */
if ( !strcmp(ValueUnion.psz, "none")
|| !strcmp(ValueUnion.psz, "empty")) // deprecated
{
/* nothing to do, NULL object will cause unmount */
}
/* host drive? */
else if (!strncmp(ValueUnion.psz, "host:", 5))
{
ComPtr<IHost> host;
CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5).raw(),
floppyMedium.asOutParam());
if (!floppyMedium)
{
errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
rc = E_FAIL;
break;
}
}
else
{
rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_Floppy,
floppyMedium, false /* fForceNewUuidOnOpen */,
NULL);
if (FAILED(rc))
break;
if (!floppyMedium)
{
rc = E_FAIL;
break;
}
}
CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller").raw(),
0, 0,
floppyMedium,
FALSE /* aForce */));
}
break;
}
case MODIFYVM_NICTRACEFILE:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_NICTRACE:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
break;
}
case MODIFYVM_NICPROPERTY:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
if (nic)
{
/* 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(nic, SetProperty(bstrName.raw(), bstrValue.raw()));
}
else
{
errorArgument("Invalid --nicproperty%d argument '%s'", GetOptState.uIndex, ValueUnion.psz);
rc = E_FAIL;
}
RTStrFree(pszProperty);
}
else
{
RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for --nicproperty%d '%s'\n", GetOptState.uIndex, ValueUnion.psz);
rc = E_FAIL;
}
}
break;
}
case MODIFYVM_NICTYPE:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
if (!strcmp(ValueUnion.psz, "Am79C970A"))
{
CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
}
else if (!strcmp(ValueUnion.psz, "Am79C973"))
{
CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
}
#ifdef VBOX_WITH_E1000
else if (!strcmp(ValueUnion.psz, "82540EM"))
{
CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
}
else if (!strcmp(ValueUnion.psz, "82543GC"))
{
CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
}
else if (!strcmp(ValueUnion.psz, "82545EM"))
{
CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
}
#endif
#ifdef VBOX_WITH_VIRTIO
else if (!strcmp(ValueUnion.psz, "virtio"))
{
CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
}
#endif /* VBOX_WITH_VIRTIO */
else
{
errorArgument("Invalid NIC type '%s' specified for NIC %u", ValueUnion.psz, GetOptState.uIndex);
rc = E_FAIL;
}
break;
}
case MODIFYVM_NICSPEED:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
break;
}
case MODIFYVM_NICBOOTPRIO:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
/* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
* to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
* 0 for the default lowest priority).
*/
if (ValueUnion.u32 > 4)
{
errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex);
rc = E_FAIL;
}
else
{
CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32));
}
break;
}
case MODIFYVM_NICPROMISC:
{
NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
if (!strcmp(ValueUnion.psz, "deny"))
enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_Deny;
else if ( !strcmp(ValueUnion.psz, "allow-vms")
|| !strcmp(ValueUnion.psz, "allow-network"))
enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowNetwork;
else if (!strcmp(ValueUnion.psz, "allow-all"))
enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowAll;
else
{
errorArgument("Unknown promiscuous mode policy '%s'", ValueUnion.psz);
rc = E_INVALIDARG;
break;
}
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMSETTER(PromiscModePolicy)(enmPromiscModePolicy));
break;
}
case MODIFYVM_NICBWGROUP:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
if (!RTStrICmp(ValueUnion.psz, "none"))
{
/* Just remove the bandwidth group. */
CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(NULL));
}
else
{
ComPtr<IBandwidthControl> bwCtrl;
ComPtr<IBandwidthGroup> bwGroup;
CHECK_ERROR(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()));
if (SUCCEEDED(rc))
{
CHECK_ERROR(bwCtrl, GetBandwidthGroup(Bstr(ValueUnion.psz).raw(), bwGroup.asOutParam()));
if (SUCCEEDED(rc))
{
CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(bwGroup));
}
}
}
break;
}
case MODIFYVM_NIC:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
if (!strcmp(ValueUnion.psz, "none"))
{
CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
}
else if (!strcmp(ValueUnion.psz, "null"))
{
CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Null));
}
else if (!strcmp(ValueUnion.psz, "nat"))
{
CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NAT));
}
else if ( !strcmp(ValueUnion.psz, "bridged")
|| !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
{
CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Bridged));
}
else if (!strcmp(ValueUnion.psz, "intnet"))
{
CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Internal));
}
else if (!strcmp(ValueUnion.psz, "hostonly"))
{
CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnly));
}
else if (!strcmp(ValueUnion.psz, "generic"))
{
CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Generic));
}
else
{
errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
rc = E_FAIL;
}
break;
}
case MODIFYVM_CABLECONNECTED:
{
ComPtr<INetworkAdapter> nic;
CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
ASSERT(nic);
CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
break;
}
case MODIFYVM_BRIDGEADAPTER:
{
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(BridgedInterface)(Bstr().raw()));
}
else
{
CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr(ValueUnion.psz).raw()));
}
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_TRACING_ENABLED:
{
CHECK_ERROR(machine, COMSETTER(TracingEnabled)(ValueUnion.f));
break;
}
case MODIFYVM_TRACING_CONFIG:
{
CHECK_ERROR(machine, COMSETTER(TracingConfig)(Bstr(ValueUnion.psz).raw()));
break;
}
case MODIFYVM_TRACING_ALLOW_VM_ACCESS:
{
CHECK_ERROR(machine, COMSETTER(AllowTracingToAccessVM)(ValueUnion.f));
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 */