VBoxManageModifyVM.cpp revision 9055ac3d8c552334b0ef35f0f10783e6d49b41d4
9ad572a3ac0fd3845a9abecfbf41e8db9b3a5cf0vboxsync/* $Id$ */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @file
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync * VBoxManage - Implementation of modifyvm command.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * available from http://www.virtualbox.org. This file is free software;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * you can redistribute it and/or modify it under the terms of the GNU
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * General Public License (GPL) as published by the Free Software
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * additional information or have any questions.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*******************************************************************************
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync* Header Files *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync*******************************************************************************/
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifndef VBOX_ONLY_DOCS
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/com.h>
70bb61ea2f96e80150e807529ce5df435607706bvboxsync#include <VBox/com/array.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/ErrorInfo.h>
23179f1443b03947d85eccc81cbc6b5153a4abf3vboxsync#include <VBox/com/errorprint.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/EventQueue.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/VirtualBox.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <vector>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <list>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/cidr.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/param.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/path.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/stream.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/string.h>
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#include <iprt/getopt.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/log.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "VBoxManage.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifndef VBOX_ONLY_DOCS
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncusing namespace com;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#if defined(_MSC_VER)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# pragma optimize("g", off)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsyncenum
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync{
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NAME = 1000,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_OSTYPE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_MEMORY,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRAM,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_FIRMWARE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_ACPI,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_IOAPIC,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_PAE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_SYNTHCPU,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_HWVIRTEX,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_HWVIRTEXEXCLUSIVE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NESTEDPAGING,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VTXVPID,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CPUS,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_SETCPUID,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_DELCPUID,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_DELALLCPUID,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_MONITORCOUNT,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_ACCELERATE3D,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_ACCELERATE2DVIDEO,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BIOSLOGOFADEIN,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BIOSLOGOFADEOUT,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BIOSLOGODISPLAYTIME,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BIOSLOGOIMAGEPATH,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BIOSBOOTMENU,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BIOSSYSTEMTIMEOFFSET,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BIOSPXEDEBUG,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BOOT,
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_HDA, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_HDB, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_HDD, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_IDECONTROLLER, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_SATAIDEEMULATION, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_SATAPORTCOUNT, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_SATAPORT, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_SATA, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_SCSIPORT, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_SCSITYPE, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_SCSI, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_DVDPASSTHROUGH, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_DVD, // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync MODIFYVM_FLOPPY, // deprecated
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NICTRACEFILE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NICTRACE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NICTYPE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NICSPEED,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NIC,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CABLECONNECTED,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BRIDGEADAPTER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_HOSTONLYADAPTER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_INTNET,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NATNET,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_MACADDRESS,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_UARTMODE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_UART,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_GUESTSTATISTICSINTERVAL,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_GUESTMEMORYBALLOON,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_AUDIOCONTROLLER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_AUDIO,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CLIPBOARD,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRDPPORT,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRDPADDRESS,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRDPAUTHTYPE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRDPMULTICON,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRDPREUSECON,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRDP,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_USBEHCI,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_USB,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_SNAPSHOTFOLDER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_TELEPORTER_ENABLED,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_TELEPORTER_PORT,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_TELEPORTER_ADDRESS,
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync MODIFYVM_TELEPORTER_PASSWORD,
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync MODIFYVM_HARDWARE_UUID
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync};
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsyncstatic const RTGETOPTDEF g_aModifyVMOptions[] =
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync{
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--vram", MODIFYVM_VRAM, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--cpus", MODIFYVM_CPUS, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT64 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_UINT64 },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--hda", MODIFYVM_HDA, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--hdb", MODIFYVM_HDB, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--hdd", MODIFYVM_HDD, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--sataideemulation", MODIFYVM_SATAIDEEMULATION, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--sata", MODIFYVM_SATA, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--scsi", MODIFYVM_SCSI, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--dvd", MODIFYVM_DVD, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--gueststatisticsinterval", MODIFYVM_GUESTSTATISTICSINTERVAL, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync};
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncint handleModifyVM(HandlerArg *a)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync{
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync int c;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync HRESULT rc;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync Bstr name;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync Bstr machineuuid (a->argv[0]);
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync RTGETOPTUNION ValueUnion;
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync RTGETOPTSTATE GetOptState;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr <IMachine> machine;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr <IBIOSSettings> biosSettings;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* VM ID + at least one parameter. Parameter arguments are checked
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * individually. */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc < 2)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* Get the number of network adapters */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ULONG NetworkAdapterCount = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr <ISystemProperties> info;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ULONG SerialPortCount = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr <ISystemProperties> info;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(info, COMGETTER(SerialPortCount)(&SerialPortCount), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* try to find the given machine */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!Guid(machineuuid).isEmpty())
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid, machine.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()), 1);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->COMGETTER(Id)(machineuuid.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open a session for the VM */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, OpenSession(a->session, machineuuid), 1);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* get the mutable session machine */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync a->session->COMGETTER(Machine)(machine.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync RT_ELEMENTS(g_aModifyVMOptions), 1, 0 /* fFlags */);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync while ( SUCCEEDED (rc)
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync && (c = RTGetOpt(&GetOptState, &ValueUnion)))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync switch (c)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NAME:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_OSTYPE:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IGuestOSType> guestOSType;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz), guestOSType.asOutParam()));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (SUCCEEDED(rc) && guestOSType)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz)));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).raw());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_MEMORY:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRAM:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_FIRMWARE:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync if (!strcmp(ValueUnion.psz, "efi"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync else if (!strcmp(ValueUnion.psz, "efi32"))
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync {
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync }
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync else if (!strcmp(ValueUnion.psz, "efi64"))
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync {
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync }
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync else if (!strcmp(ValueUnion.psz, "efidual"))
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync {
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "bios"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_ACPI:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_IOAPIC:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_PAE:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetCpuProperty(CpuPropertyType_PAE, ValueUnion.f));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_SYNTHCPU:
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetCpuProperty(CpuPropertyType_Synthetic, ValueUnion.f));
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync break;
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync }
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_HWVIRTEX:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
ab2292e9c32bd271ec91123ef38699a0284b72cbvboxsync break;
ab2292e9c32bd271ec91123ef38699a0284b72cbvboxsync }
ab2292e9c32bd271ec91123ef38699a0284b72cbvboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_HWVIRTEXEXCLUSIVE:
ab2292e9c32bd271ec91123ef38699a0284b72cbvboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync case MODIFYVM_SETCPUID:
121568d0a1e932e6f6acd49376827a0e593815favboxsync {
121568d0a1e932e6f6acd49376827a0e593815favboxsync uint32_t id = ValueUnion.u32;
121568d0a1e932e6f6acd49376827a0e593815favboxsync uint32_t aValue[4];
121568d0a1e932e6f6acd49376827a0e593815favboxsync
121568d0a1e932e6f6acd49376827a0e593815favboxsync for (unsigned i = 0 ; i < 4 ; i++)
121568d0a1e932e6f6acd49376827a0e593815favboxsync {
121568d0a1e932e6f6acd49376827a0e593815favboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
121568d0a1e932e6f6acd49376827a0e593815favboxsync if (RT_FAILURE(vrc))
121568d0a1e932e6f6acd49376827a0e593815favboxsync return errorSyntax(USAGE_MODIFYVM,
121568d0a1e932e6f6acd49376827a0e593815favboxsync "Missing or Invalid argument to '%s'",
121568d0a1e932e6f6acd49376827a0e593815favboxsync GetOptState.pDef->pszLong);
121568d0a1e932e6f6acd49376827a0e593815favboxsync aValue[i] = ValueUnion.u32;
121568d0a1e932e6f6acd49376827a0e593815favboxsync }
121568d0a1e932e6f6acd49376827a0e593815favboxsync CHECK_ERROR(machine, SetCpuIdLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
121568d0a1e932e6f6acd49376827a0e593815favboxsync break;
121568d0a1e932e6f6acd49376827a0e593815favboxsync }
121568d0a1e932e6f6acd49376827a0e593815favboxsync
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync case MODIFYVM_DELCPUID:
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync {
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync CHECK_ERROR(machine, RemoveCpuIdLeaf(ValueUnion.u32));
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync break;
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync }
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync case MODIFYVM_DELALLCPUID:
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync {
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync CHECK_ERROR(machine, RemoveAllCpuIdLeafs());
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync break;
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync }
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NESTEDPAGING:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VTXVPID:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_CPUS:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_MONITORCOUNT:
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_ACCELERATE3D:
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_ACCELERATE2DVIDEO:
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync break;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync#endif
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSLOGOFADEIN:
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSLOGOFADEOUT:
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSLOGODISPLAYTIME:
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u64));
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync break;
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSLOGOIMAGEPATH:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSBOOTMENU:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "disabled"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "menuonly"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "messageandmenu"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSSYSTEMTIMEOFFSET:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.u64));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSPXEDEBUG:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BOOT:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid boot slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "floppy"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "dvd"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "disk"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "net"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_HDA: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->DetachDevice(Bstr("IDE Controller"), 0, 0);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync Bstr uuid(ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync OpenHardDisk(Bstr(ValueUnion.psz),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync AccessMode_ReadWrite, false, Bstr(""),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync false, Bstr(""), hardDisk.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 0, DeviceType_HardDisk, uuid));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_HDB: // deprecated
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->DetachDevice(Bstr("IDE Controller"), 0, 1);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync Bstr uuid(ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync OpenHardDisk(Bstr(ValueUnion.psz),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync AccessMode_ReadWrite, false, Bstr(""),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync false, Bstr(""), hardDisk.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 1, DeviceType_HardDisk, uuid));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_HDD: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->DetachDevice(Bstr("IDE Controller"), 1, 1);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync Bstr uuid(ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync OpenHardDisk(Bstr(ValueUnion.psz),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync AccessMode_ReadWrite, false, Bstr(""),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync false, Bstr(""), hardDisk.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 1, 1, DeviceType_HardDisk, uuid));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_IDECONTROLLER: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> storageController;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller"),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync storageController.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!RTStrICmp(ValueUnion.psz, "PIIX4"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!RTStrICmp(ValueUnion.psz, "ICH6"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SATAIDEEMULATION: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> SataCtl;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SATA boot slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((ValueUnion.u32 < 1) && (ValueUnion.u32 > 30))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SATA port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (SUCCEEDED(rc))
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SATAPORTCOUNT: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> SataCtl;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SATAPORT: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 30))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SATA port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync machine->DetachDevice(Bstr("SATA"), GetOptState.uIndex, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync Bstr uuid(ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync OpenHardDisk(Bstr(ValueUnion.psz), AccessMode_ReadWrite,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync false, Bstr(""), false,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync Bstr(""), hardDisk.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync AttachDevice(Bstr("SATA"), GetOptState.uIndex,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync 0, DeviceType_HardDisk, uuid));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SATA: // deprecated
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> ctl;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("SATA"), StorageBus_SATA, ctl.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA")));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SCSIPORT: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 16))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SCSI port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = machine->DetachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), GetOptState.uIndex, 0));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync Bstr uuid(ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync OpenHardDisk(Bstr(ValueUnion.psz),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync AccessMode_ReadWrite, false, Bstr(""),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync false, Bstr(""), hardDisk.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = machine->AttachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0, DeviceType_HardDisk, uuid);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync AttachDevice(Bstr("BusLogic"),
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.uIndex, 0,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync DeviceType_HardDisk, uuid));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SCSITYPE: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> ctl;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = machine->RemoveStorageController(Bstr("BusLogic"));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync AddStorageController(Bstr("LsiLogic"),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync StorageBus_SCSI,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ctl.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (SUCCEEDED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = machine->RemoveStorageController(Bstr("LsiLogic"));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic")));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync AddStorageController(Bstr("BusLogic"),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync StorageBus_SCSI,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ctl.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (SUCCEEDED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SCSI: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> ctl;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic"), StorageBus_SCSI, ctl.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (SUCCEEDED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = machine->RemoveStorageController(Bstr("BusLogic"));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_DVDPASSTHROUGH: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller"), 1, 0, !strcmp(ValueUnion.psz, "on")));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_DVD: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> dvdMedium;
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync Bstr uuid(ValueUnion.psz);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* unmount? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
fc148a6b23d25a87561beaffe0ba06c3ba93bf5avboxsync /* nothing to do, NULL object will cause unmount */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* host drive? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strncmp(ValueUnion.psz, "host:", 5))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IHost> host;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5), dvdMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!dvdMedium)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* 2nd try: try with the real name, important on Linux+libhal */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync char szPathReal[RTPATH_MAX];
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = host->FindHostDVDDrive(Bstr(szPathReal), dvdMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!dvdMedium)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first assume it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetDVDImage(uuid, dvdMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc) || !dvdMedium)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* must be a filename, check if it's in the collection */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindDVDImage(Bstr(ValueUnion.psz), dvdMedium.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not registered, do that on the fly */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!dvdMedium)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr emptyUUID;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox, OpenDVDImage(Bstr(ValueUnion.psz),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync emptyUUID, dvdMedium.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!dvdMedium)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /** @todo generalize this, allow arbitrary number of DVD drives
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync * and as a consequence multiple attachments and different
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync * storage controllers. */
32750ad95d5e2fe4bb368e751875b33094cfa973vboxsync if (dvdMedium)
32750ad95d5e2fe4bb368e751875b33094cfa973vboxsync dvdMedium->COMGETTER(Id)(uuid.asOutParam());
96788c1af55ead9aaa2d17035c3777f2ea73023cvboxsync CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller"), 1, 0, uuid, FALSE /* aForce */));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_FLOPPY: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync Bstr uuid(ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> floppyMedium;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMediumAttachment> floppyAttachment;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->GetMediumAttachment(Bstr("Floppy Controller"), 0, 0, floppyAttachment.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "disabled"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* disable the controller */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (floppyAttachment)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller"), 0, 0));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* enable the controller */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!floppyAttachment)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller"), 0, 0, DeviceType_Floppy, NULL));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* unmount? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ( !strcmp(ValueUnion.psz, "none")
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync || !strcmp(ValueUnion.psz, "empty")) // deprecated
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* nothing to do, NULL object will cause unmount */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* host drive? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strncmp(ValueUnion.psz, "host:", 5))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IHost> host;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5), floppyMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!floppyMedium)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first assume it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetFloppyImage(uuid, floppyMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc) || !floppyMedium)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* must be a filename, check if it's in the collection */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindFloppyImage(Bstr(ValueUnion.psz), floppyMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not registered, do that on the fly */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!floppyMedium)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync Bstr emptyUUID;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync OpenFloppyImage(Bstr(ValueUnion.psz),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync emptyUUID,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync floppyMedium.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!floppyMedium)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync floppyMedium->COMGETTER(Id)(uuid.asOutParam());
96788c1af55ead9aaa2d17035c3777f2ea73023cvboxsync CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller"), 0, 0, uuid, FALSE /* aForce */));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICTRACEFILE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICTRACE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICTYPE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "Am79C970A"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "Am79C973"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef VBOX_WITH_E1000
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "82540EM"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "82543GC"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "82545EM"))
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef VBOX_WITH_VIRTIO
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "virtio"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* VBOX_WITH_VIRTIO */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid NIC type '%s' specified for NIC %lu", ValueUnion.psz, GetOptState.uIndex);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICSPEED:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((ValueUnion.u32 < 1000) && (ValueUnion.u32 > 4000000))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid --nicspeed%lu argument '%u'", GetOptState.uIndex, ValueUnion.u32);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NIC:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "null"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, Detach());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "nat"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, AttachToNAT());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if ( !strcmp(ValueUnion.psz, "bridged")
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, AttachToBridgedInterface());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "intnet"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, AttachToInternalNetwork());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync#if defined(VBOX_WITH_NETFLT)
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "hostonly"))
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync {
04c6e2bf4c47aa33be5ee50ac468b1b86b7125b4vboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, AttachToHostOnlyInterface());
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync }
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid type '%s' specfied for NIC %lu", ValueUnion.psz, GetOptState.uIndex);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_CABLECONNECTED:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BRIDGEADAPTER:
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_HOSTONLYADAPTER:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(HostInterface)(NULL));
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_INTNET:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(NULL));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NATNET:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_MACADDRESS:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* generate one? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "auto"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(MACAddress)(NULL));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_UARTMODE:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<ISerialPort> uart;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync char *pszIRQ = NULL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid Serial Port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(uart);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "disconnected"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if ( !strcmp(ValueUnion.psz, "server")
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync || !strcmp(ValueUnion.psz, "client")
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync || !strcmp(ValueUnion.psz, "file"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync const char *pszMode = ValueUnion.psz;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (RT_FAILURE(vrc))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid argument to '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(pszMode, "server"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(pszMode, "client"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(pszMode, "file"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_UART:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<ISerialPort> uart;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid Serial Port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(uart);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Enabled)(FALSE));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync const char *pszIOBase = ValueUnion.psz;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync uint32_t uVal = 0;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (RT_FAILURE(vrc))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync return errorSyntax(USAGE_MODIFYVM,
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid argument to '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync GetOptState.pDef->pszLong);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(IRQ)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (vrc != VINF_SUCCESS || uVal == 0)
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(IOBase)(uVal));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Enabled)(TRUE));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_GUESTSTATISTICSINTERVAL:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(StatisticsUpdateInterval)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef VBOX_WITH_MEM_BALLOONING
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_GUESTMEMORYBALLOON:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_AUDIOCONTROLLER:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IAudioAdapter> audioAdapter;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(audioAdapter);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "sb16"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "ac97"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_AUDIO:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IAudioAdapter> audioAdapter;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(audioAdapter);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync /* disable? */
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "none"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "null"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef RT_OS_WINDOWS
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef VBOX_WITH_WINMM
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "winmm"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "dsound"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* RT_OS_WINDOWS */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef RT_OS_LINUX
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync# ifdef VBOX_WITH_ALSA
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "alsa"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync# endif
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync# ifdef VBOX_WITH_PULSE
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "pulse"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync# endif
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* !RT_OS_LINUX */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef RT_OS_SOLARIS
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "solaudio"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* !RT_OS_SOLARIS */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef RT_OS_DARWIN
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "coreaudio"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* !RT_OS_DARWIN */
9055ac3d8c552334b0ef35f0f10783e6d49b41d4vboxsync# if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(VBOX_WITH_SOLARIS_OSS)
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync else if (!strcmp(ValueUnion.psz, "oss"))
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync {
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync }
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync# endif
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_CLIPBOARD:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "disabled"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "hosttoguest"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "guesttohost"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "bidirectional"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef VBOX_WITH_VRDP
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPPORT:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IVRDPServer> vrdpServer;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(vrdpServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "default"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr("0")));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPADDRESS:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IVRDPServer> vrdpServer;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(vrdpServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPAUTHTYPE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IVRDPServer> vrdpServer;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(vrdpServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "null"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "external"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "guest"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --vrdpauthtype argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPMULTICON:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IVRDPServer> vrdpServer;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(vrdpServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPREUSECON:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IVRDPServer> vrdpServer;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(vrdpServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDP:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IVRDPServer> vrdpServer;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ASSERT(vrdpServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Enabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* VBOX_WITH_VRDP */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_USBEHCI:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IUSBController> UsbCtl;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (SUCCEEDED(rc))
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_USB:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IUSBController> UsbCtl;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (SUCCEEDED(rc))
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_SNAPSHOTFOLDER:
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "default"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_TELEPORTER_ENABLED:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_TELEPORTER_PORT:
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_TELEPORTER_ADDRESS:
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz)));
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync break;
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync }
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_TELEPORTER_PASSWORD:
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync case MODIFYVM_HARDWARE_UUID:
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync {
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz)));
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync break;
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync }
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync default:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* commit changes */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (SUCCEEDED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SaveSettings());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* it's important to always close sessions */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync a->session->Close();
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return SUCCEEDED(rc) ? 0 : 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync}
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */