VBoxManageModifyVM.cpp revision 89aedeb1d8af54aba6ae46dbbd256281315c1be6
9ad572a3ac0fd3845a9abecfbf41e8db9b3a5cf0vboxsync/* $Id$ */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @file
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync * VBoxManage - Implementation of modifyvm command.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync * Copyright (C) 2006-2010 Oracle Corporation
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
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#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,
b304856b23107864c9c594a80cebca6006623f31vboxsync MODIFYVM_PAGEFUSION,
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,
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync MODIFYVM_LARGEPAGES,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VTXVPID,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CPUS,
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync MODIFYVM_CPUHOTPLUG,
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync MODIFYVM_PLUGCPU,
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync MODIFYVM_UNPLUGCPU,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_SETCPUID,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_DELCPUID,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_DELALLCPUID,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_MONITORCOUNT,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_ACCELERATE3D,
9353e321b583ed6f2b42414257a5212885575b5cvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_ACCELERATE2DVIDEO,
9353e321b583ed6f2b42414257a5212885575b5cvboxsync#endif
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,
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync MODIFYVM_NICBOOTPRIO,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NIC,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CABLECONNECTED,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BRIDGEADAPTER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_HOSTONLYADAPTER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_INTNET,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NATNET,
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#ifdef VBOX_WITH_VDE
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync MODIFYVM_VDENET,
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#endif
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATBINDIP,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATSETTINGS,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATPF,
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync MODIFYVM_NATALIASMODE,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATTFTPPREFIX,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATTFTPFILE,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATTFTPSERVER,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATDNSPASSDOMAIN,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATDNSPROXY,
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync MODIFYVM_NATDNSHOSTRESOLVER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_MACADDRESS,
19cb1f8699e352d590c4946caee33863a5157241vboxsync MODIFYVM_HIDPTR,
19cb1f8699e352d590c4946caee33863a5157241vboxsync MODIFYVM_HIDKBD,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_UARTMODE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_UART,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_GUESTMEMORYBALLOON,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_AUDIOCONTROLLER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_AUDIO,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CLIPBOARD,
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDPPORT, /* VRDE: deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDPADDRESS, /* VRDE: deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDPAUTHTYPE, /* VRDE: deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDPMULTICON, /* VRDE: deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDPREUSECON, /* VRDE: deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDPVIDEOCHANNEL, /* VRDE: deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDPVIDEOCHANNELQUALITY, /* VRDE: deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDP, /* VRDE: deprecated */
cc74f15083bf80fbc96723a89faa06c15d0dead8vboxsync MODIFYVM_VRDEPROPERTY,
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync MODIFYVM_VRDEPORT,
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync MODIFYVM_VRDEADDRESS,
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDEAUTHTYPE,
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync MODIFYVM_VRDEAUTHLIBRARY,
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDEMULTICON,
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDEREUSECON,
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDEVIDEOCHANNEL,
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDEVIDEOCHANNELQUALITY,
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync MODIFYVM_VRDE_EXTPACK,
3933885bc0c2c93436d858a14564c6179ec72872vboxsync MODIFYVM_VRDE,
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync MODIFYVM_RTCUSEUTC,
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,
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync MODIFYVM_HARDWARE_UUID,
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync MODIFYVM_HPET,
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync MODIFYVM_IOCACHE,
40dce69ff1c2949a489337922f30f1021d62d864vboxsync MODIFYVM_IOCACHESIZE,
40dce69ff1c2949a489337922f30f1021d62d864vboxsync MODIFYVM_FAULT_TOLERANCE,
40dce69ff1c2949a489337922f30f1021d62d864vboxsync MODIFYVM_FAULT_TOLERANCE_ADDRESS,
40dce69ff1c2949a489337922f30f1021d62d864vboxsync MODIFYVM_FAULT_TOLERANCE_PORT,
40dce69ff1c2949a489337922f30f1021d62d864vboxsync MODIFYVM_FAULT_TOLERANCE_PASSWORD,
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL,
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync MODIFYVM_CPU_EXECTUION_CAP,
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync MODIFYVM_CHIPSET
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 },
b304856b23107864c9c594a80cebca6006623f31vboxsync { "--pagefusion", MODIFYVM_PAGEFUSION, RTGETOPT_REQ_BOOL_ONOFF },
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 },
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync { "--largepages", MODIFYVM_LARGEPAGES, 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 },
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync { "--cpuhotplug", MODIFYVM_CPUHOTPLUG, RTGETOPT_REQ_BOOL_ONOFF },
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync { "--plugcpu", MODIFYVM_PLUGCPU, RTGETOPT_REQ_UINT32 },
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync { "--unplugcpu", MODIFYVM_UNPLUGCPU, RTGETOPT_REQ_UINT32 },
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync { "--cpuexecutioncap", MODIFYVM_CPU_EXECTUION_CAP, RTGETOPT_REQ_UINT32 },
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync { "--rtcuseutc", MODIFYVM_RTCUSEUTC, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
9353e321b583ed6f2b42414257a5212885575b5cvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
9353e321b583ed6f2b42414257a5212885575b5cvboxsync#endif
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
fc5f879e9508f333e20b37c63db9189a33059308vboxsync { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
1c6ec9a3a329da6f61978a372e509cd233f0d9f9vboxsync { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_INT64 },
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 },
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync { "--nicbootprio", MODIFYVM_NICBOOTPRIO, 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 },
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#ifdef VBOX_WITH_VDE
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync { "--vdenet", MODIFYVM_VDENET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#endif
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--natbindip", MODIFYVM_NATBINDIP, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
95cb8e789c1eed6f2bb3195d0b996feee11d548evboxsync { "--natsettings", MODIFYVM_NATSETTINGS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--natpf", MODIFYVM_NATPF, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync { "--nataliasmode", MODIFYVM_NATALIASMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--nattftpprefix", MODIFYVM_NATTFTPPREFIX, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--nattftpfile", MODIFYVM_NATTFTPFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--nattftpserver", MODIFYVM_NATTFTPSERVER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--natdnspassdomain", MODIFYVM_NATDNSPASSDOMAIN, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--natdnsproxy", MODIFYVM_NATDNSPROXY, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync { "--natdnshostresolver", MODIFYVM_NATDNSHOSTRESOLVER, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
19cb1f8699e352d590c4946caee33863a5157241vboxsync { "--mouse", MODIFYVM_HIDPTR, RTGETOPT_REQ_STRING },
19cb1f8699e352d590c4946caee33863a5157241vboxsync { "--keyboard", MODIFYVM_HIDKBD, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
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 },
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING }, /* deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING }, /* deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING }, /* deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdpvideochannel", MODIFYVM_VRDPVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
060f7ec6ae5c99df18341ef2e1f3e91f4b0c89f1vboxsync { "--vrdpvideochannelquality", MODIFYVM_VRDPVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING }, /* deprecated */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
cc74f15083bf80fbc96723a89faa06c15d0dead8vboxsync { "--vrdeproperty", MODIFYVM_VRDEPROPERTY, RTGETOPT_REQ_STRING },
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync { "--vrdeport", MODIFYVM_VRDEPORT, RTGETOPT_REQ_STRING },
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync { "--vrdeaddress", MODIFYVM_VRDEADDRESS, RTGETOPT_REQ_STRING },
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdeauthtype", MODIFYVM_VRDEAUTHTYPE, RTGETOPT_REQ_STRING },
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync { "--vrdeauthlibrary", MODIFYVM_VRDEAUTHLIBRARY, RTGETOPT_REQ_STRING },
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdemulticon", MODIFYVM_VRDEMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdereusecon", MODIFYVM_VRDEREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrdevideochannel", MODIFYVM_VRDEVIDEOCHANNEL, RTGETOPT_REQ_BOOL_ONOFF },
060f7ec6ae5c99df18341ef2e1f3e91f4b0c89f1vboxsync { "--vrdevideochannelquality", MODIFYVM_VRDEVIDEOCHANNELQUALITY, RTGETOPT_REQ_STRING },
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync { "--vrdeextpack", MODIFYVM_VRDE_EXTPACK, RTGETOPT_REQ_STRING },
3933885bc0c2c93436d858a14564c6179ec72872vboxsync { "--vrde", MODIFYVM_VRDE, 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 },
f106b549ead77cab51ff1e2c116060aaabb90d5evboxsync { "--teleporter", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
f106b549ead77cab51ff1e2c116060aaabb90d5evboxsync { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
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 },
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync { "--hpet", MODIFYVM_HPET, RTGETOPT_REQ_BOOL_ONOFF },
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync { "--iocache", MODIFYVM_IOCACHE, RTGETOPT_REQ_BOOL_ONOFF },
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync { "--iocachesize", MODIFYVM_IOCACHESIZE, RTGETOPT_REQ_UINT32 },
40dce69ff1c2949a489337922f30f1021d62d864vboxsync { "--faulttolerance", MODIFYVM_FAULT_TOLERANCE, RTGETOPT_REQ_STRING },
40dce69ff1c2949a489337922f30f1021d62d864vboxsync { "--faulttoleranceaddress", MODIFYVM_FAULT_TOLERANCE_ADDRESS, RTGETOPT_REQ_STRING },
40dce69ff1c2949a489337922f30f1021d62d864vboxsync { "--faulttoleranceport", MODIFYVM_FAULT_TOLERANCE_PORT, RTGETOPT_REQ_UINT32 },
40dce69ff1c2949a489337922f30f1021d62d864vboxsync { "--faulttolerancepassword", MODIFYVM_FAULT_TOLERANCE_PASSWORD, RTGETOPT_REQ_STRING },
40dce69ff1c2949a489337922f30f1021d62d864vboxsync { "--faulttolerancesyncinterval", MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL, RTGETOPT_REQ_UINT32 },
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync { "--chipset", MODIFYVM_CHIPSET, RTGETOPT_REQ_STRING },
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync};
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsyncstatic void vrdeWarningDeprecatedOption(const char *pszOption)
3933885bc0c2c93436d858a14564c6179ec72872vboxsync{
3933885bc0c2c93436d858a14564c6179ec72872vboxsync RTStrmPrintf(g_pStdErr, "Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n", pszOption, pszOption);
3933885bc0c2c93436d858a14564c6179ec72872vboxsync}
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncint handleModifyVM(HandlerArg *a)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync{
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync int c;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync HRESULT rc;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync Bstr name;
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 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 */
508452243fd3328f7b9e0405d39fb9dc004e31b8vboxsync CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
508452243fd3328f7b9e0405d39fb9dc004e31b8vboxsync machine.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
89aedeb1d8af54aba6ae46dbbd256281315c1be6vboxsync
89aedeb1d8af54aba6ae46dbbd256281315c1be6vboxsync /* Get the number of network adapters */
89aedeb1d8af54aba6ae46dbbd256281315c1be6vboxsync ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, machine);
89aedeb1d8af54aba6ae46dbbd256281315c1be6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open a session for the VM */
f409459bdd4c15cdb8d7fb6c6d54338cce9ac814vboxsync CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 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,
fb1975a6972d89de9e515bed0248db93f04ec9d8vboxsync RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync while ( SUCCEEDED (rc)
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync && (c = RTGetOpt(&GetOptState, &ValueUnion)))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync switch (c)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NAME:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_OSTYPE:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync ComPtr<IGuestOSType> guestOSType;
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz).raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync guestOSType.asOutParam()));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (SUCCEEDED(rc) && guestOSType)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
e48239695d41f806ff02d8a60b97dc20d4822d7avboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).c_str());
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
b304856b23107864c9c594a80cebca6006623f31vboxsync case MODIFYVM_PAGEFUSION:
b304856b23107864c9c594a80cebca6006623f31vboxsync {
b304856b23107864c9c594a80cebca6006623f31vboxsync CHECK_ERROR(machine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
b304856b23107864c9c594a80cebca6006623f31vboxsync break;
b304856b23107864c9c594a80cebca6006623f31vboxsync }
b304856b23107864c9c594a80cebca6006623f31vboxsync
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 {
f31ac84c1c57e23801423b5bd184fadabe6456f3vboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_SYNTHCPU:
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync {
f31ac84c1c57e23801423b5bd184fadabe6456f3vboxsync 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 }
f31ac84c1c57e23801423b5bd184fadabe6456f3vboxsync CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
121568d0a1e932e6f6acd49376827a0e593815favboxsync break;
121568d0a1e932e6f6acd49376827a0e593815favboxsync }
121568d0a1e932e6f6acd49376827a0e593815favboxsync
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync case MODIFYVM_DELCPUID:
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync {
f31ac84c1c57e23801423b5bd184fadabe6456f3vboxsync CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync break;
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync }
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync case MODIFYVM_DELALLCPUID:
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync {
f31ac84c1c57e23801423b5bd184fadabe6456f3vboxsync CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync break;
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync }
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NESTEDPAGING:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync case MODIFYVM_LARGEPAGES:
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync {
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync break;
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync }
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync
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
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync case MODIFYVM_RTCUSEUTC:
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync {
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync break;
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync }
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync case MODIFYVM_CPUHOTPLUG:
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync {
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync break;
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync }
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync case MODIFYVM_PLUGCPU:
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync {
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync break;
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync }
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync case MODIFYVM_UNPLUGCPU:
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync {
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync break;
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync }
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync case MODIFYVM_CPU_EXECTUION_CAP:
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync {
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync CHECK_ERROR(machine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
d6f9950e2cf4ba7fd217c083400d9812ff745374vboxsync break;
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync }
657b2c9f6d33f08001e5fa6f6e0572dcf0391013vboxsync
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 {
fc5f879e9508f333e20b37c63db9189a33059308vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u32));
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync break;
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_BIOSLOGOIMAGEPATH:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz).raw()));
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 {
1c6ec9a3a329da6f61978a372e509cd233f0d9f9vboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.i64));
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 (!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 break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_HDA: // deprecated
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_HDB: // deprecated
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync case MODIFYVM_HDD: // deprecated
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync case MODIFYVM_SATAPORT: // deprecated
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
7922c4cd397713a387c9e854e74c31a0d5065365vboxsync uint32_t u1 = 0, u2 = 0;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync Bstr bstrController = L"IDE Controller";
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync switch (c)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync case MODIFYVM_HDA: // deprecated
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync u1 = 0;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync break;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync case MODIFYVM_HDB: // deprecated
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync u1 = 0;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync u2 = 1;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync break;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync case MODIFYVM_HDD: // deprecated
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync u1 = 1;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync u2 = 1;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync break;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync case MODIFYVM_SATAPORT: // deprecated
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync u1 = GetOptState.uIndex;
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync bstrController = L"SATA";
4a0e2f51aaf27c0bca61ff0f1adb91106264f0dbvboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync machine->DetachDevice(bstrController.raw(), u1, u2);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync hardDisk, NULL);
67e7d53d62514401efcd0e7a34f5faf772a3fe04vboxsync if (FAILED(rc))
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (hardDisk)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, AttachDevice(bstrController.raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync u1, u2,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync DeviceType_HardDisk,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync hardDisk));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_IDECONTROLLER: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> storageController;
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
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;
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync SataCtl.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (SUCCEEDED(rc))
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SATAPORTCOUNT: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> SataCtl;
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync SataCtl.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SATA: // deprecated
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IStorageController> ctl;
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, AddStorageController(Bstr("SATA").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync StorageBus_SATA,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync ctl.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA").raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_SCSIPORT: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = machine->DetachDevice(Bstr("LsiLogic").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync GetOptState.uIndex, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync GetOptState.uIndex, 0));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_HardDisk,
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync hardDisk, NULL);
67e7d53d62514401efcd0e7a34f5faf772a3fe04vboxsync if (FAILED(rc))
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = machine->AttachDevice(Bstr("LsiLogic").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync GetOptState.uIndex, 0,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync DeviceType_HardDisk,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync hardDisk);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync AttachDevice(Bstr("BusLogic").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync GetOptState.uIndex, 0,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync DeviceType_HardDisk,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync hardDisk));
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 {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync AddStorageController(Bstr("LsiLogic").raw(),
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 {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = machine->RemoveStorageController(Bstr("LsiLogic").raw());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic").raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync AddStorageController(Bstr("BusLogic").raw(),
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
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync StorageBus_SCSI,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 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 {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (FAILED(rc))
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_DVDPASSTHROUGH: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 1, 0,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync !strcmp(ValueUnion.psz, "on")));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_DVD: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> dvdMedium;
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()));
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5).raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 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 }
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = host->FindHostDVDDrive(Bstr(szPathReal).raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 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 {
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_DVD,
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync dvdMedium, NULL);
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync if (FAILED(rc))
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!dvdMedium)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller").raw(),
d107911787df36a78788a841b73d24da896d02f6vboxsync 1, 0,
d107911787df36a78788a841b73d24da896d02f6vboxsync dvdMedium,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync FALSE /* aForce */));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_FLOPPY: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> floppyMedium;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMediumAttachment> floppyAttachment;
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync machine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 0, 0, floppyAttachment.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "disabled"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* disable the controller */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (floppyAttachment)
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 0, 0));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* enable the controller */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!floppyAttachment)
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller").raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 0, 0,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 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()));
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5).raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync 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 {
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync rc = findOrOpenMedium(a, ValueUnion.psz, DeviceType_Floppy,
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync floppyMedium, NULL);
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync if (FAILED(rc))
b7a8ce033b32a429def2feb142bc1bdd1b5dffa2vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync if (!floppyMedium)
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller").raw(),
d107911787df36a78788a841b73d24da896d02f6vboxsync 0, 0,
d107911787df36a78788a841b73d24da896d02f6vboxsync floppyMedium,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync FALSE /* aForce */));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICTRACEFILE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICTRACE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
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
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 {
6c1f3eb64096421b9ba7272f297bac6ff3d29fe7vboxsync errorArgument("Invalid NIC type '%s' specified for NIC %u", ValueUnion.psz, GetOptState.uIndex);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICSPEED:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
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
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync case MODIFYVM_NICBOOTPRIO:
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync {
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync ComPtr<INetworkAdapter> nic;
f8df398d066204e2bf0ba209ea3554fc113fb484vboxsync
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync ASSERT(nic);
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync * 0 for the default lowest priority).
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync */
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync if (ValueUnion.u32 > 4)
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync {
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync errorArgument("Invalid boot priority '%u' specfied for NIC %u", ValueUnion.u32, GetOptState.uIndex);
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync rc = E_FAIL;
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync }
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync else
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync {
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync CHECK_ERROR(nic, COMSETTER(BootPriority)(ValueUnion.u32));
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync }
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync break;
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync }
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NIC:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
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 }
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#endif
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#ifdef VBOX_WITH_VDE
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync else if (!strcmp(ValueUnion.psz, "vde"))
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync CHECK_ERROR(nic, AttachToVDE());
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6c1f3eb64096421b9ba7272f297bac6ff3d29fe7vboxsync errorArgument("Invalid type '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_CABLECONNECTED:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
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
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync /** @todo NULL string deprecated */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(HostInterface)(NULL));
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz).raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_INTNET:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync /** @todo NULL string deprecated */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(NULL));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz).raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#ifdef VBOX_WITH_VDE
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync case MODIFYVM_VDENET:
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync ComPtr<INetworkAdapter> nic;
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync ASSERT(nic);
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync /** @todo NULL string deprecated */
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync /* remove it? */
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync if (!strcmp(ValueUnion.psz, "default"))
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync CHECK_ERROR(nic, COMSETTER(VDENetwork)(NULL));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync else
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(nic, COMSETTER(VDENetwork)(Bstr(ValueUnion.psz).raw()));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync break;
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync#endif
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NATNET:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync const char *psz = ValueUnion.psz;
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync if (!strcmp("default", psz))
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync psz = "";
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(driver, COMSETTER(Network)(Bstr(psz).raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATBINDIP:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(driver, COMSETTER(HostIP)(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync#define ITERATE_TO_NEXT_TERM(ch) \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync do { \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync while (*ch != ',') \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync { \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync if (*ch == 0) \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync { \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync return errorSyntax(USAGE_MODIFYVM, \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync "Missing or Invalid argument to '%s'", \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync GetOptState.pDef->pszLong); \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync } \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync ch++; \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync } \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync *ch = '\0'; \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync ch++; \
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync } while(0)
fa80a38f04b00afbb167e46c385cf24df0e223ddvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATSETTINGS:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strMtu;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strSockSnd;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strSockRcv;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strTcpSnd;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strTcpRcv;
468c2bcb36eb9a032f5dd0fcb34db10bd58e9996vboxsync char *strRaw = RTStrDup(ValueUnion.psz);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *ch = strRaw;
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strMtu = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strSockSnd = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strSockRcv = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strTcpSnd = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strTcpRcv = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(driver, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync RTStrToUInt32(strTcpSnd), RTStrToUInt32(strTcpRcv)));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATPF:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync /* format name:proto:hostip:hostport:guestip:guestport*/
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync if (RTStrCmp(ValueUnion.psz, "delete") != 0)
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strName;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strProto;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strHostIp;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strHostPort;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strGuestIp;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *strGuestPort;
468c2bcb36eb9a032f5dd0fcb34db10bd58e9996vboxsync char *strRaw = RTStrDup(ValueUnion.psz);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync char *ch = strRaw;
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strName = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strProto = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strHostIp = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strHostPort = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strGuestIp = RTStrStrip(ch);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ITERATE_TO_NEXT_TERM(ch);
cb2880968807a37c9efe6d5d32d56f2def91d908vboxsync strGuestPort = RTStrStrip(ch);
1407e1d0e3666d810460e291ecfc3c0b5f6feab3vboxsync NATProtocol_T proto;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync if (RTStrICmp(strProto, "udp") == 0)
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync proto = NATProtocol_UDP;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync else if (RTStrICmp(strProto, "tcp") == 0)
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync proto = NATProtocol_TCP;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync else
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync errorArgument("Invalid proto '%s' specfied for NIC %u", ValueUnion.psz, GetOptState.uIndex);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync rc = E_FAIL;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(driver, AddRedirect(Bstr(strName).raw(), proto,
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync Bstr(strHostIp).raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync RTStrToUInt16(strHostPort),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync Bstr(strGuestIp).raw(),
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync RTStrToUInt16(strGuestPort)));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync else
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync /* delete NAT Rule operation */
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync int vrc;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync if (RT_FAILURE(vrc))
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(driver, RemoveRedirect(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync #undef ITERATE_TO_NEXT_TERM
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync case MODIFYVM_NATALIASMODE:
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync {
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync ComPtr<INetworkAdapter> nic;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync ComPtr<INATEngine> driver;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync uint32_t aliasMode = 0;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync ASSERT(nic);
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync if (RTStrCmp(ValueUnion.psz,"default") == 0)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync {
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync aliasMode = 0;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync }
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync else
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync {
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync char *token = (char *)ValueUnion.psz;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync while(token)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync {
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync if (RTStrNCmp(token, "log", 3) == 0)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync aliasMode |= 0x1;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync else if (RTStrNCmp(token, "proxyonly", 9) == 0)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync aliasMode |= 0x2;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync else if (RTStrNCmp(token, "sameports", 9) == 0)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync aliasMode |= 0x4;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync token = RTStrStr(token, ",");
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync if (token == NULL)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync break;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync token++;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync }
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync }
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync CHECK_ERROR(driver, COMSETTER(AliasMode)(aliasMode));
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync break;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync }
468c2bcb36eb9a032f5dd0fcb34db10bd58e9996vboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATTFTPPREFIX:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(driver, COMSETTER(TftpPrefix)(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATTFTPFILE:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(driver, COMSETTER(TftpBootFile)(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATTFTPSERVER:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(driver, COMSETTER(TftpNextServer)(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATDNSPASSDOMAIN:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(driver, COMSETTER(DnsPassDomain)(ValueUnion.f));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATDNSPROXY:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(driver, COMSETTER(DnsProxy)(ValueUnion.f));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATDNSHOSTRESOLVER:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ComPtr<INATEngine> driver;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(nic, COMGETTER(NatDriver)(driver.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR(driver, COMSETTER(DnsUseHostResolver)(ValueUnion.f));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_MACADDRESS:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<INetworkAdapter> nic;
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 {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz).raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
19cb1f8699e352d590c4946caee33863a5157241vboxsync case MODIFYVM_HIDPTR:
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync bool fEnableUsb = false;
19cb1f8699e352d590c4946caee33863a5157241vboxsync if (!strcmp(ValueUnion.psz, "ps2"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
19cb1f8699e352d590c4946caee33863a5157241vboxsync CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_PS2Mouse));
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync else if (!strcmp(ValueUnion.psz, "usb"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
19cb1f8699e352d590c4946caee33863a5157241vboxsync CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBMouse));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (SUCCEEDED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync fEnableUsb = true;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync else if (!strcmp(ValueUnion.psz, "usbtablet"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
19cb1f8699e352d590c4946caee33863a5157241vboxsync CHECK_ERROR(machine, COMSETTER(PointingHidType)(PointingHidType_USBTablet));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (SUCCEEDED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync fEnableUsb = true;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync else
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
19cb1f8699e352d590c4946caee33863a5157241vboxsync errorArgument("Invalid type '%s' specfied for pointing device", ValueUnion.psz);
19cb1f8699e352d590c4946caee33863a5157241vboxsync rc = E_FAIL;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (fEnableUsb)
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync {
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync /* Make sure the OHCI controller is enabled. */
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync ComPtr<IUSBController> UsbCtl;
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (SUCCEEDED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync {
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync BOOL fEnabled;
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (FAILED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync fEnabled = false;
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (!fEnabled)
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync }
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync break;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync
19cb1f8699e352d590c4946caee33863a5157241vboxsync case MODIFYVM_HIDKBD:
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync bool fEnableUsb = false;
19cb1f8699e352d590c4946caee33863a5157241vboxsync if (!strcmp(ValueUnion.psz, "ps2"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
19cb1f8699e352d590c4946caee33863a5157241vboxsync CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_PS2Keyboard));
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync else if (!strcmp(ValueUnion.psz, "usb"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
19cb1f8699e352d590c4946caee33863a5157241vboxsync CHECK_ERROR(machine, COMSETTER(KeyboardHidType)(KeyboardHidType_USBKeyboard));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (SUCCEEDED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync fEnableUsb = true;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync else
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
19cb1f8699e352d590c4946caee33863a5157241vboxsync errorArgument("Invalid type '%s' specfied for keyboard", ValueUnion.psz);
19cb1f8699e352d590c4946caee33863a5157241vboxsync rc = E_FAIL;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (fEnableUsb)
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync {
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync /* Make sure the OHCI controller is enabled. */
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync ComPtr<IUSBController> UsbCtl;
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync rc = machine->COMGETTER(USBController)(UsbCtl.asOutParam());
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (SUCCEEDED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync {
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync BOOL fEnabled;
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync rc = UsbCtl->COMGETTER(Enabled)(&fEnabled);
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (FAILED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync fEnabled = false;
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (!fEnabled)
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(true));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync }
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync break;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_UARTMODE:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<ISerialPort> uart;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync char *pszIRQ = NULL;
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
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
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 {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_UART:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<ISerialPort> uart;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
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_GUESTMEMORYBALLOON:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
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));
7ffa227f187f4ff5561da9916c2b7bc949723018vboxsync else if (!strcmp(ValueUnion.psz, "hda"))
7ffa227f187f4ff5561da9916c2b7bc949723018vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_HDA));
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 */
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync#ifdef RT_OS_FREEBSD
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync else if (!strcmp(ValueUnion.psz, "oss"))
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync {
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync }
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync# ifdef VBOX_WITH_PULSE
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync else if (!strcmp(ValueUnion.psz, "pulse"))
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync {
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync }
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync# endif
a0644dbbd30adb9bd2937110d6f016e56c4cc52bvboxsync#endif /* !RT_OS_FREEBSD */
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
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync case MODIFYVM_VRDE_EXTPACK:
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync {
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync ComPtr<IVRDEServer> vrdeServer;
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync ASSERT(vrdeServer);
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync if (vrdeServer)
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync {
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync if (strcmp(ValueUnion.psz, "default") != 0)
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync {
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync Bstr bstr(ValueUnion.psz);
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(bstr.raw()));
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync }
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync else
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(NULL));
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync }
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync break;
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync }
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync
cc74f15083bf80fbc96723a89faa06c15d0dead8vboxsync case MODIFYVM_VRDEPROPERTY:
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsync if (vrdeServer)
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync /* Parse 'name=value' */
3933885bc0c2c93436d858a14564c6179ec72872vboxsync char *pszProperty = RTStrDup(ValueUnion.psz);
3933885bc0c2c93436d858a14564c6179ec72872vboxsync if (pszProperty)
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync char *pDelimiter = strchr(pszProperty, '=');
3933885bc0c2c93436d858a14564c6179ec72872vboxsync if (pDelimiter)
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync *pDelimiter = '\0';
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsync Bstr bstrName = pszProperty;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync Bstr bstrValue = &pDelimiter[1];
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, SetVRDEProperty(bstrName.raw(), bstrValue.raw()));
3933885bc0c2c93436d858a14564c6179ec72872vboxsync }
3933885bc0c2c93436d858a14564c6179ec72872vboxsync else
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync RTStrFree(pszProperty);
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
cc74f15083bf80fbc96723a89faa06c15d0dead8vboxsync errorArgument("Invalid --vrdeproperty argument '%s'", ValueUnion.psz);
3933885bc0c2c93436d858a14564c6179ec72872vboxsync rc = E_FAIL;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync break;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync }
3933885bc0c2c93436d858a14564c6179ec72872vboxsync RTStrFree(pszProperty);
3933885bc0c2c93436d858a14564c6179ec72872vboxsync }
3933885bc0c2c93436d858a14564c6179ec72872vboxsync else
3933885bc0c2c93436d858a14564c6179ec72872vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for VRDE property '%s'\n", ValueUnion.psz);
3933885bc0c2c93436d858a14564c6179ec72872vboxsync rc = E_FAIL;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync }
3933885bc0c2c93436d858a14564c6179ec72872vboxsync }
3933885bc0c2c93436d858a14564c6179ec72872vboxsync break;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync }
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPPORT:
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync vrdeWarningDeprecatedOption("port");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync case MODIFYVM_VRDEPORT:
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "default"))
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr("0").raw()));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr(ValueUnion.psz).raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPADDRESS:
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync vrdeWarningDeprecatedOption("address");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync case MODIFYVM_VRDEADDRESS:
a72b5355eb89aafe6bfcc8912cf02645d7cccceavboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Address").raw(), Bstr(ValueUnion.psz).raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPAUTHTYPE:
3933885bc0c2c93436d858a14564c6179ec72872vboxsync vrdeWarningDeprecatedOption("authtype");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync case MODIFYVM_VRDEAUTHTYPE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (!strcmp(ValueUnion.psz, "null"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Null));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "external"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_External));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "guest"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Guest));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
b8908d384db2324f04a2f68a13e67ea32ebf609avboxsync errorArgument("Invalid --vrdeauthtype argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync case MODIFYVM_VRDEAUTHLIBRARY:
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync {
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync ComPtr<IVRDEServer> vrdeServer;
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync ASSERT(vrdeServer);
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync if (vrdeServer)
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync {
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync if (strcmp(ValueUnion.psz, "default") != 0)
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync {
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync Bstr bstr(ValueUnion.psz);
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(bstr.raw()));
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync }
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync else
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(NULL));
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync }
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync break;
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync }
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPMULTICON:
3933885bc0c2c93436d858a14564c6179ec72872vboxsync vrdeWarningDeprecatedOption("multicon");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync case MODIFYVM_VRDEMULTICON:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDPREUSECON:
3933885bc0c2c93436d858a14564c6179ec72872vboxsync vrdeWarningDeprecatedOption("reusecon");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync case MODIFYVM_VRDEREUSECON:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync case MODIFYVM_VRDPVIDEOCHANNEL:
3933885bc0c2c93436d858a14564c6179ec72872vboxsync vrdeWarningDeprecatedOption("videochannel");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync case MODIFYVM_VRDEVIDEOCHANNEL:
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync
060f7ec6ae5c99df18341ef2e1f3e91f4b0c89f1vboxsync CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
060f7ec6ae5c99df18341ef2e1f3e91f4b0c89f1vboxsync ValueUnion.f? Bstr("true").raw(): Bstr("false").raw()));
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync break;
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync }
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync case MODIFYVM_VRDPVIDEOCHANNELQUALITY:
3933885bc0c2c93436d858a14564c6179ec72872vboxsync vrdeWarningDeprecatedOption("videochannelquality");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync case MODIFYVM_VRDEVIDEOCHANNELQUALITY:
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync
060f7ec6ae5c99df18341ef2e1f3e91f4b0c89f1vboxsync CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
060f7ec6ae5c99df18341ef2e1f3e91f4b0c89f1vboxsync Bstr(ValueUnion.psz).raw()));
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync break;
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync }
b8462d2d5e78448e277a4214655ce1cd6c7e9249vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_VRDP:
3933885bc0c2c93436d858a14564c6179ec72872vboxsync vrdeWarningDeprecatedOption("");
3933885bc0c2c93436d858a14564c6179ec72872vboxsync case MODIFYVM_VRDE:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ComPtr<IVRDEServer> vrdeServer;
3933885bc0c2c93436d858a14564c6179ec72872vboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
3933885bc0c2c93436d858a14564c6179ec72872vboxsync ASSERT(vrdeServer);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(Enabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
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
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw()));
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 {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw()));
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync break;
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync }
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_TELEPORTER_PASSWORD:
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync
40dce69ff1c2949a489337922f30f1021d62d864vboxsync case MODIFYVM_FAULT_TOLERANCE:
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
40dce69ff1c2949a489337922f30f1021d62d864vboxsync if (!strcmp(ValueUnion.psz, "master"))
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
40dce69ff1c2949a489337922f30f1021d62d864vboxsync CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Master)));
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync else
40dce69ff1c2949a489337922f30f1021d62d864vboxsync if (!strcmp(ValueUnion.psz, "standby"))
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
40dce69ff1c2949a489337922f30f1021d62d864vboxsync CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Standby)));
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync else
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
40dce69ff1c2949a489337922f30f1021d62d864vboxsync errorArgument("Invalid --faulttolerance argument '%s'", ValueUnion.psz);
40dce69ff1c2949a489337922f30f1021d62d864vboxsync rc = E_FAIL;
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync break;
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync
40dce69ff1c2949a489337922f30f1021d62d864vboxsync case MODIFYVM_FAULT_TOLERANCE_ADDRESS:
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz).raw()));
40dce69ff1c2949a489337922f30f1021d62d864vboxsync break;
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync
40dce69ff1c2949a489337922f30f1021d62d864vboxsync case MODIFYVM_FAULT_TOLERANCE_PORT:
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
40dce69ff1c2949a489337922f30f1021d62d864vboxsync CHECK_ERROR(machine, COMSETTER(FaultTolerancePort)(ValueUnion.u32));
40dce69ff1c2949a489337922f30f1021d62d864vboxsync break;
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync
40dce69ff1c2949a489337922f30f1021d62d864vboxsync case MODIFYVM_FAULT_TOLERANCE_PASSWORD:
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz).raw()));
40dce69ff1c2949a489337922f30f1021d62d864vboxsync break;
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync
40dce69ff1c2949a489337922f30f1021d62d864vboxsync case MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL:
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
40dce69ff1c2949a489337922f30f1021d62d864vboxsync CHECK_ERROR(machine, COMSETTER(FaultToleranceSyncInterval)(ValueUnion.u32));
40dce69ff1c2949a489337922f30f1021d62d864vboxsync break;
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync case MODIFYVM_HARDWARE_UUID:
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw()));
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync break;
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync }
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync case MODIFYVM_HPET:
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync {
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync CHECK_ERROR(machine, COMSETTER(HpetEnabled)(ValueUnion.f));
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync break;
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync }
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync case MODIFYVM_IOCACHE:
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync {
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync CHECK_ERROR(machine, COMSETTER(IoCacheEnabled)(ValueUnion.f));
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync break;
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync }
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync case MODIFYVM_IOCACHESIZE:
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync {
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync CHECK_ERROR(machine, COMSETTER(IoCacheSize)(ValueUnion.u32));
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync break;
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync }
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync case MODIFYVM_CHIPSET:
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync {
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync if (!strcmp(ValueUnion.psz, "piix3"))
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync {
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync }
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync else if (!strcmp(ValueUnion.psz, "ich9"))
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync {
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_ICH9));
e4efe3adcccfda0bcbd5a1f7f9644ce6c323c6f4vboxsync BOOL fIoApic = FALSE;
e4efe3adcccfda0bcbd5a1f7f9644ce6c323c6f4vboxsync CHECK_ERROR(biosSettings, COMGETTER(IOAPICEnabled)(&fIoApic));
e4efe3adcccfda0bcbd5a1f7f9644ce6c323c6f4vboxsync if (!fIoApic)
e4efe3adcccfda0bcbd5a1f7f9644ce6c323c6f4vboxsync {
e4efe3adcccfda0bcbd5a1f7f9644ce6c323c6f4vboxsync RTStrmPrintf(g_pStdErr, "*** I/O APIC must be enabled for ICH9, enabling. ***\n");
e4efe3adcccfda0bcbd5a1f7f9644ce6c323c6f4vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(TRUE));
e4efe3adcccfda0bcbd5a1f7f9644ce6c323c6f4vboxsync }
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync }
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync else
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync {
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync errorArgument("Invalid --chipset argument '%s' (valid: piix3,ich9)", ValueUnion.psz);
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync rc = E_FAIL;
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync }
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync break;
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync }
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync
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 */
825c2485cf84eec495985ffd605a1c9cddee8c32vboxsync a->session->UnlockMachine();
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return SUCCEEDED(rc) ? 0 : 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync}
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */