VBoxManageModifyVM.cpp revision d11484e14d7d6490965166f2a3b3ee8b53b968d3
9ad572a3ac0fd3845a9abecfbf41e8db9b3a5cf0vboxsync/* $Id$ */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @file
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync * VBoxManage - Implementation of modifyvm command.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync * Copyright (C) 2006-2014 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/VirtualBox.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/cidr.h>
edefdc20eedaf9ef5b1293e56ba9b8cca7b5c740vboxsync#include <iprt/ctype.h>
edefdc20eedaf9ef5b1293e56ba9b8cca7b5c740vboxsync#include <iprt/file.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#include "VBoxManage.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifndef VBOX_ONLY_DOCS
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncusing namespace com;
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,
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync MODIFYVM_GROUPS,
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync MODIFYVM_DESCRIPTION,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_OSTYPE,
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync MODIFYVM_ICONFILE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_MEMORY,
b304856b23107864c9c594a80cebca6006623f31vboxsync MODIFYVM_PAGEFUSION,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VRAM,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_FIRMWARE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_ACPI,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_IOAPIC,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_PAE,
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync MODIFYVM_LONGMODE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_SYNTHCPU,
5e0d1b28833a92e30446e95ced085bce4d794067vboxsync MODIFYVM_TFRESET,
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync MODIFYVM_PARAVIRTPROVIDER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_HWVIRTEX,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NESTEDPAGING,
c33fc49611f2444dade533488bf431e29eb88bcdvboxsync MODIFYVM_LARGEPAGES,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_VTXVPID,
1bf151411167b02ebdc6d6a18de8b97030341e1fvboxsync MODIFYVM_VTXUX,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CPUS,
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync MODIFYVM_CPUHOTPLUG,
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync MODIFYVM_PLUGCPU,
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync MODIFYVM_UNPLUGCPU,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_SETCPUID,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_DELCPUID,
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync MODIFYVM_DELALLCPUID,
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync MODIFYVM_GRAPHICSCONTROLLER,
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_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,
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync MODIFYVM_NICPROPERTY,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NICTYPE,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NICSPEED,
f62342e2cc901a67e27fa69c0e712ee35e9c4c68vboxsync MODIFYVM_NICBOOTPRIO,
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync MODIFYVM_NICPROMISC,
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync MODIFYVM_NICBWGROUP,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_NIC,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CABLECONNECTED,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_BRIDGEADAPTER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_HOSTONLYADAPTER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_INTNET,
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync MODIFYVM_GENERICDRV,
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync MODIFYVM_NATNETWORKNAME,
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync MODIFYVM_NATNET,
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,
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync MODIFYVM_LPTMODE,
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync MODIFYVM_LPT,
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync#endif
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_GUESTMEMORYBALLOON,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_AUDIOCONTROLLER,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_AUDIO,
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync MODIFYVM_CLIPBOARD,
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync MODIFYVM_DRAGANDDROP,
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,
9601ea695ea96905d6f5d484facd272732365c40vboxsync MODIFYVM_USBXHCI,
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,
23d9dbdaf1b83107abf9882246a4a46933f733efvboxsync MODIFYVM_TELEPORTER_PASSWORD_FILE,
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync MODIFYVM_TRACING_ENABLED,
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync MODIFYVM_TRACING_CONFIG,
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync MODIFYVM_TRACING_ALLOW_VM_ACCESS,
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,
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync MODIFYVM_AUTOSTART_ENABLED,
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync MODIFYVM_AUTOSTART_DELAY,
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync MODIFYVM_AUTOSTOP_TYPE,
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync#ifdef VBOX_WITH_PCI_PASSTHROUGH
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync MODIFYVM_ATTACH_PCI,
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync MODIFYVM_DETACH_PCI,
7708252d252a55417a6a817041e4356797e34255vboxsync#endif
7708252d252a55417a6a817041e4356797e34255vboxsync#ifdef VBOX_WITH_USB_CARDREADER
7708252d252a55417a6a817041e4356797e34255vboxsync MODIFYVM_USBCARDREADER,
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync#endif
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync#ifdef VBOX_WITH_VPX
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync MODIFYVM_VCP,
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync MODIFYVM_VCP_SCREENS,
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync MODIFYVM_VCP_FILENAME,
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync MODIFYVM_VCP_WIDTH,
f2dbf051efd73ff79892d4cec2b466139f962a40vboxsync MODIFYVM_VCP_HEIGHT,
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync MODIFYVM_VCP_RATE,
cccc6ee5f7156cfcdf13acca545cf65124d9ed44vboxsync MODIFYVM_VCP_FPS,
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync MODIFYVM_VCP_MAXTIME,
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync MODIFYVM_VCP_MAXSIZE,
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync MODIFYVM_VCP_OPTIONS,
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync#endif
904810c4c6668233349b025cc58013cb7c11c701vboxsync MODIFYVM_CHIPSET,
904810c4c6668233349b025cc58013cb7c11c701vboxsync MODIFYVM_DEFAULTFRONTEND
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync};
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsyncstatic const RTGETOPTDEF g_aModifyVMOptions[] =
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync{
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--name", MODIFYVM_NAME, RTGETOPT_REQ_STRING },
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync { "--groups", MODIFYVM_GROUPS, RTGETOPT_REQ_STRING },
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync { "--description", MODIFYVM_DESCRIPTION, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync { "--iconfile", MODIFYVM_ICONFILE, 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 },
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync { "--longmode", MODIFYVM_LONGMODE, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync { "--triplefaultreset", MODIFYVM_TFRESET, RTGETOPT_REQ_BOOL_ONOFF },
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync { "--paravirtprovider", MODIFYVM_PARAVIRTPROVIDER, RTGETOPT_REQ_STRING },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--hwvirtex", MODIFYVM_HWVIRTEX, 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 },
1bf151411167b02ebdc6d6a18de8b97030341e1fvboxsync { "--vtxux", MODIFYVM_VTXUX, 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 },
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync { "--graphicscontroller", MODIFYVM_GRAPHICSCONTROLLER, RTGETOPT_REQ_STRING },
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 { "--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 },
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync { "--nicproperty", MODIFYVM_NICPROPERTY, RTGETOPT_REQ_STRING | 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 },
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync { "--nicpromisc", MODIFYVM_NICPROMISC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync { "--nicbandwidthgroup", MODIFYVM_NICBWGROUP, RTGETOPT_REQ_STRING | 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 },
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync { "--nicgenericdrv", MODIFYVM_GENERICDRV, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync { "--nat-network", MODIFYVM_NATNETWORKNAME, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync { "--natnetwork", MODIFYVM_NATNETWORKNAME, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
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 },
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync { "--lptmode", MODIFYVM_LPTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync { "--lpt", MODIFYVM_LPT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync#endif
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 },
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync { "--draganddrop", MODIFYVM_DRAGANDDROP, 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 },
9601ea695ea96905d6f5d484facd272732365c40vboxsync { "--usbxhci", MODIFYVM_USBXHCI, 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 },
23d9dbdaf1b83107abf9882246a4a46933f733efvboxsync { "--teleporterpasswordfile", MODIFYVM_TELEPORTER_PASSWORD_FILE, RTGETOPT_REQ_STRING },
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync { "--tracing-enabled", MODIFYVM_TRACING_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync { "--tracing-config", MODIFYVM_TRACING_CONFIG, RTGETOPT_REQ_STRING },
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync { "--tracing-allow-vm-access", MODIFYVM_TRACING_ALLOW_VM_ACCESS, RTGETOPT_REQ_BOOL_ONOFF },
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 },
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync#ifdef VBOX_WITH_VPX
f57758f0bcf995d350d64a7c059ac93573144c05vboxsync { "--vcpenabled", MODIFYVM_VCP, RTGETOPT_REQ_BOOL_ONOFF },
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync { "--vcpscreens", MODIFYVM_VCP_SCREENS, RTGETOPT_REQ_STRING },
f57758f0bcf995d350d64a7c059ac93573144c05vboxsync { "--vcpfile", MODIFYVM_VCP_FILENAME, RTGETOPT_REQ_STRING },
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync { "--vcpwidth", MODIFYVM_VCP_WIDTH, RTGETOPT_REQ_UINT32 },
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync { "--vcpheight", MODIFYVM_VCP_HEIGHT, RTGETOPT_REQ_UINT32 },
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync { "--vcprate", MODIFYVM_VCP_RATE, RTGETOPT_REQ_UINT32 },
cccc6ee5f7156cfcdf13acca545cf65124d9ed44vboxsync { "--vcpfps", MODIFYVM_VCP_FPS, RTGETOPT_REQ_UINT32 },
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync { "--vcpmaxtime", MODIFYVM_VCP_MAXTIME, RTGETOPT_REQ_INT32 },
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync { "--vcpmaxsize", MODIFYVM_VCP_MAXSIZE, RTGETOPT_REQ_INT32 },
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync { "--vcpoptions", MODIFYVM_VCP_OPTIONS, RTGETOPT_REQ_STRING },
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync#endif
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync { "--autostart-enabled", MODIFYVM_AUTOSTART_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync { "--autostart-delay", MODIFYVM_AUTOSTART_DELAY, RTGETOPT_REQ_UINT32 },
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync { "--autostop-type", MODIFYVM_AUTOSTOP_TYPE, RTGETOPT_REQ_STRING },
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync#ifdef VBOX_WITH_PCI_PASSTHROUGH
505ddd00252720bfb5569fcb17bfda53dc141e3bvboxsync { "--pciattach", MODIFYVM_ATTACH_PCI, RTGETOPT_REQ_STRING },
505ddd00252720bfb5569fcb17bfda53dc141e3bvboxsync { "--pcidetach", MODIFYVM_DETACH_PCI, RTGETOPT_REQ_STRING },
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync#endif
7708252d252a55417a6a817041e4356797e34255vboxsync#ifdef VBOX_WITH_USB_CARDREADER
7708252d252a55417a6a817041e4356797e34255vboxsync { "--usbcardreader", MODIFYVM_USBCARDREADER, RTGETOPT_REQ_BOOL_ONOFF },
7708252d252a55417a6a817041e4356797e34255vboxsync#endif
904810c4c6668233349b025cc58013cb7c11c701vboxsync { "--defaultfrontend", MODIFYVM_DEFAULTFRONTEND, 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
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync/** Parse PCI address in format 01:02.03 and convert it to the numeric representation. */
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsyncstatic int32_t parsePci(const char* szPciAddr)
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync{
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync char* pszNext = (char*)szPciAddr;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync int rc;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync uint8_t aVals[3] = {0, 0, 0};
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync rc = RTStrToUInt8Ex(pszNext, &pszNext, 16, &aVals[0]);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != ':')
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync return -1;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[1]);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync if (RT_FAILURE(rc) || pszNext == NULL || *pszNext != '.')
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync return -1;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync rc = RTStrToUInt8Ex(pszNext+1, &pszNext, 16, &aVals[2]);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync if (RT_FAILURE(rc) || pszNext == NULL)
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync return -1;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync return (aVals[0] << 8) | (aVals[1] << 3) | (aVals[2] << 0);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync}
3933885bc0c2c93436d858a14564c6179ec72872vboxsync
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsyncvoid parseGroups(const char *pcszGroups, com::SafeArray<BSTR> *pGroups)
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync{
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync while (pcszGroups)
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync {
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync char *pComma = RTStrStr(pcszGroups, ",");
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync if (pComma)
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync {
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync Bstr(pcszGroups, pComma - pcszGroups).detachTo(pGroups->appendedRaw());
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync pcszGroups = pComma + 1;
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync }
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync else
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync {
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync Bstr(pcszGroups).detachTo(pGroups->appendedRaw());
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync pcszGroups = NULL;
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync }
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync }
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync}
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsyncstatic int parseScreens(const char *pcszScreens, com::SafeArray<BOOL> *pScreens)
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync{
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync while (pcszScreens && *pcszScreens)
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync {
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync char *pszNext;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync uint32_t iScreen;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync int rc = RTStrToUInt32Ex(pcszScreens, &pszNext, 0, &iScreen);
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync if (RT_FAILURE(rc))
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync return 1;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync if (iScreen >= pScreens->size())
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync return 1;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync if (pszNext && *pszNext)
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync {
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync pszNext = RTStrStripL(pszNext);
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync if (*pszNext != ',')
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync return 1;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync pszNext++;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync }
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync (*pScreens)[iScreen] = true;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync pcszScreens = pszNext;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync }
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync return 0;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync}
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsyncstatic int parseNum(uint32_t uIndex, unsigned cMaxIndex, const char *pszName)
e446ce644a0cdc723be5146be1659f1206599c24vboxsync{
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if ( uIndex >= 1
e446ce644a0cdc723be5146be1659f1206599c24vboxsync && uIndex <= cMaxIndex)
e446ce644a0cdc723be5146be1659f1206599c24vboxsync return uIndex;
e446ce644a0cdc723be5146be1659f1206599c24vboxsync errorArgument("Invalid %s number %u", pszName, uIndex);
e446ce644a0cdc723be5146be1659f1206599c24vboxsync return 0;
e446ce644a0cdc723be5146be1659f1206599c24vboxsync}
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncint handleModifyVM(HandlerArg *a)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync{
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync int c;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync HRESULT rc;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync Bstr name;
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync RTGETOPTUNION ValueUnion;
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync RTGETOPTSTATE GetOptState;
c970e7d40b648d5c8f3e2b060692e670d85997d1vboxsync ComPtr<IMachine> machine;
c970e7d40b648d5c8f3e2b060692e670d85997d1vboxsync 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 /* 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 */
f4e792b5d6ee04e9d93499b747cce21510c3cdb3vboxsync CHECK_ERROR_RET(a->session, COMGETTER(Machine)(machine.asOutParam()), 1);
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 }
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync case MODIFYVM_GROUPS:
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync {
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync com::SafeArray<BSTR> groups;
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync parseGroups(ValueUnion.psz, &groups);
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync CHECK_ERROR(machine, COMSETTER(Groups)(ComSafeArrayAsInParam(groups)));
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync break;
1147e980f6ab0b7ff1d08c13ad1c03eea30d102dvboxsync }
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync case MODIFYVM_DESCRIPTION:
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync {
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync CHECK_ERROR(machine, COMSETTER(Description)(Bstr(ValueUnion.psz).raw()));
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync break;
e59069cf1c98c1c2e90a18ec76fbc2e9907fb917vboxsync }
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 {
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync errorArgument("Invalid guest OS type '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync case MODIFYVM_ICONFILE:
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync {
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync RTFILE iconFile;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync int vrc = RTFileOpen(&iconFile, ValueUnion.psz, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync if (RT_FAILURE(vrc))
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync {
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync RTMsgError("Cannot open file \"%s\": %Rrc", ValueUnion.psz, vrc);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync rc = E_FAIL;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync break;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync }
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync uint64_t cbSize;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync vrc = RTFileGetSize(iconFile, &cbSize);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync if (RT_FAILURE(vrc))
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync {
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync RTMsgError("Cannot get size of file \"%s\": %Rrc", ValueUnion.psz, vrc);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync rc = E_FAIL;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync break;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync }
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync if (cbSize > _256K)
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync {
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync RTMsgError("File \"%s\" is bigger than 256KByte", ValueUnion.psz);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync rc = E_FAIL;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync break;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync }
cedd207acc51a49839fdf51554fc19539ac68b4dvboxsync SafeArray<BYTE> icon((size_t)cbSize);
cedd207acc51a49839fdf51554fc19539ac68b4dvboxsync rc = RTFileRead(iconFile, icon.raw(), (size_t)cbSize, NULL);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync if (RT_FAILURE(vrc))
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync {
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync RTMsgError("Cannot read contents of file \"%s\": %Rrc", ValueUnion.psz, vrc);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync rc = E_FAIL;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync break;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync }
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync RTFileClose(iconFile);
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync CHECK_ERROR(machine, COMSETTER(Icon)(ComSafeArrayAsInParam(icon)));
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync break;
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync }
361a7fb527903c8dbfd0cc7dc779f943c6e348f6vboxsync
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 {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "efi"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "efi32"))
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync {
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "efi64"))
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync {
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "efidual"))
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync {
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync case MODIFYVM_LONGMODE:
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync {
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_LongMode, ValueUnion.f));
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync break;
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync }
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_SYNTHCPU:
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync {
f31ac84c1c57e23801423b5bd184fadabe6456f3vboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync break;
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync }
36929067a9d3cba77fd78f1e8fa042ed3a8ae2d6vboxsync
5e0d1b28833a92e30446e95ced085bce4d794067vboxsync case MODIFYVM_TFRESET:
5e0d1b28833a92e30446e95ced085bce4d794067vboxsync {
5e0d1b28833a92e30446e95ced085bce4d794067vboxsync CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_TripleFaultReset, ValueUnion.f));
5e0d1b28833a92e30446e95ced085bce4d794067vboxsync break;
5e0d1b28833a92e30446e95ced085bce4d794067vboxsync }
5e0d1b28833a92e30446e95ced085bce4d794067vboxsync
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync case MODIFYVM_PARAVIRTPROVIDER:
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync {
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync if ( !RTStrICmp(ValueUnion.psz, "none")
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync || !RTStrICmp(ValueUnion.psz, "disabled"))
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_None));
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync else if (!RTStrICmp(ValueUnion.psz, "default"))
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_Default));
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync else if (!RTStrICmp(ValueUnion.psz, "legacy"))
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_Legacy));
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync else if (!RTStrICmp(ValueUnion.psz, "minimal"))
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_Minimal));
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync else if (!RTStrICmp(ValueUnion.psz, "hyperv"))
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_HyperV));
d11484e14d7d6490965166f2a3b3ee8b53b968d3vboxsync else if (!RTStrICmp(ValueUnion.psz, "kvm"))
d11484e14d7d6490965166f2a3b3ee8b53b968d3vboxsync CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_KVM));
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync else
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync {
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync errorArgument("Invalid --paravirtprovider argument '%s'", ValueUnion.psz);
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync rc = E_FAIL;
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync }
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync break;
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync }
56343f236d9d7c0e3d2b75e23f0f5575dc77f2e3vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_HWVIRTEX:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
ab2292e9c32bd271ec91123ef38699a0284b72cbvboxsync break;
ab2292e9c32bd271ec91123ef38699a0284b72cbvboxsync }
ab2292e9c32bd271ec91123ef38699a0284b72cbvboxsync
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync case MODIFYVM_SETCPUID:
121568d0a1e932e6f6acd49376827a0e593815favboxsync {
121568d0a1e932e6f6acd49376827a0e593815favboxsync uint32_t id = ValueUnion.u32;
121568d0a1e932e6f6acd49376827a0e593815favboxsync uint32_t aValue[4];
121568d0a1e932e6f6acd49376827a0e593815favboxsync
885f154412c8dc99c44809cf0d5b7f07342a455evboxsync 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
1bf151411167b02ebdc6d6a18de8b97030341e1fvboxsync case MODIFYVM_VTXUX:
1bf151411167b02ebdc6d6a18de8b97030341e1fvboxsync {
1bf151411167b02ebdc6d6a18de8b97030341e1fvboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, ValueUnion.f));
1bf151411167b02ebdc6d6a18de8b97030341e1fvboxsync break;
1bf151411167b02ebdc6d6a18de8b97030341e1fvboxsync }
8fdb854581fe3cb394d84835dc09b02e6e18d4edvboxsync
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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync case MODIFYVM_GRAPHICSCONTROLLER:
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if ( !RTStrICmp(ValueUnion.psz, "none")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "disabled"))
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync CHECK_ERROR(machine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_Null));
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if ( !RTStrICmp(ValueUnion.psz, "vboxvga")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "vbox")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "vga")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "vesa"))
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync CHECK_ERROR(machine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VBoxVGA));
ae94ad7e769e467419ab99cab5403bdb39bc544fvboxsync#ifdef VBOX_WITH_VMSVGA
ae94ad7e769e467419ab99cab5403bdb39bc544fvboxsync else if ( !RTStrICmp(ValueUnion.psz, "vmsvga")
ae94ad7e769e467419ab99cab5403bdb39bc544fvboxsync || !RTStrICmp(ValueUnion.psz, "vmware"))
ae94ad7e769e467419ab99cab5403bdb39bc544fvboxsync CHECK_ERROR(machine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VMSVGA));
ae94ad7e769e467419ab99cab5403bdb39bc544fvboxsync#endif
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync errorArgument("Invalid --graphicscontroller argument '%s'", ValueUnion.psz);
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync rc = E_FAIL;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync break;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync
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 {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "disabled"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "menuonly"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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 {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "floppy"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "dvd"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "disk"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync machine->DetachDevice(bstrController.raw(), u1, u2);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync else
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> hardDisk;
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync rc = openMedium(a, ValueUnion.psz, DeviceType_HardDisk,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync AccessMode_ReadWrite, hardDisk,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fForceNewUuidOnOpen */,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fSilent */);
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_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 {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "on") || !RTStrICmp(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 }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(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 {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(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;
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync rc = openMedium(a, ValueUnion.psz, DeviceType_HardDisk,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync AccessMode_ReadWrite, hardDisk,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fForceNewUuidOnOpen */,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fSilent */);
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 {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "on") || !RTStrICmp(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 }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(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,
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync !RTStrICmp(ValueUnion.psz, "on")));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a5e5a032e6f23f8937718e4ee4d6979188bdd19vboxsync case MODIFYVM_DVD: // deprecated
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ComPtr<IMedium> dvdMedium;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* unmount? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
fc148a6b23d25a87561beaffe0ba06c3ba93bf5avboxsync /* nothing to do, NULL object will cause unmount */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* host drive? */
794c574111980e7fb3a86847e5495156afa13134vboxsync else if (!RTStrNICmp(ValueUnion.psz, RT_STR_TUPLE("host:")))
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 {
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync rc = openMedium(a, ValueUnion.psz, DeviceType_DVD,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync AccessMode_ReadOnly, dvdMedium,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fForceNewUuidOnOpen */,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fSilent */);
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? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(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)
1871985cb4854e5bfb2ead8174ee28dbfce74df5vboxsync CHECK_ERROR(machine, AttachDeviceWithoutMedium(Bstr("Floppy Controller").raw(),
1871985cb4854e5bfb2ead8174ee28dbfce74df5vboxsync 0, 0,
1871985cb4854e5bfb2ead8174ee28dbfce74df5vboxsync DeviceType_Floppy));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* unmount? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if ( !RTStrICmp(ValueUnion.psz, "none")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "empty")) // deprecated
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* nothing to do, NULL object will cause unmount */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* host drive? */
794c574111980e7fb3a86847e5495156afa13134vboxsync else if (!RTStrNICmp(ValueUnion.psz, RT_STR_TUPLE("host:")))
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 {
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync rc = openMedium(a, ValueUnion.psz, DeviceType_Floppy,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync AccessMode_ReadWrite, floppyMedium,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fForceNewUuidOnOpen */,
a9f530691071e3496b072915b0c5ceabd4e05ea5vboxsync false /* fSilent */);
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
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
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 {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
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
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync case MODIFYVM_NICPROPERTY:
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync ASSERT(nic);
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync if (nic)
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync /* Parse 'name=value' */
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync char *pszProperty = RTStrDup(ValueUnion.psz);
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync if (pszProperty)
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync char *pDelimiter = strchr(pszProperty, '=');
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync if (pDelimiter)
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync *pDelimiter = '\0';
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync Bstr bstrName = pszProperty;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync Bstr bstrValue = &pDelimiter[1];
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, SetProperty(bstrName.raw(), bstrValue.raw()));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync else
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync errorArgument("Invalid --nicproperty%d argument '%s'", GetOptState.uIndex, ValueUnion.psz);
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync rc = E_FAIL;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync RTStrFree(pszProperty);
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync else
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync RTStrmPrintf(g_pStdErr, "Error: Failed to allocate memory for --nicproperty%d '%s'\n", GetOptState.uIndex, ValueUnion.psz);
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync rc = E_FAIL;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync break;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync }
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NICTYPE:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "Am79C970A"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "Am79C973"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef VBOX_WITH_E1000
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "82540EM"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "82543GC"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "82545EM"))
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#ifdef VBOX_WITH_VIRTIO
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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 {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
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 {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
f8df398d066204e2bf0ba209ea3554fc113fb484vboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
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
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync case MODIFYVM_NICPROMISC:
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync {
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "deny"))
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_Deny;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if ( !RTStrICmp(ValueUnion.psz, "allow-vms")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "allow-network"))
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowNetwork;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "allow-all"))
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowAll;
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync else
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync {
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync errorArgument("Unknown promiscuous mode policy '%s'", ValueUnion.psz);
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync rc = E_INVALIDARG;
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync break;
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync }
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync ComPtr<INetworkAdapter> nic;
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync ASSERT(nic);
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync CHECK_ERROR(nic, COMSETTER(PromiscModePolicy)(enmPromiscModePolicy));
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync break;
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync }
b604fbf16eda38d14b4999c245f032bfaa5aa85avboxsync
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync case MODIFYVM_NICBWGROUP:
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync ComPtr<INetworkAdapter> nic;
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync ASSERT(nic);
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync {
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync /* Just remove the bandwidth group. */
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(NULL));
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync }
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync else
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync {
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync ComPtr<IBandwidthControl> bwCtrl;
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync ComPtr<IBandwidthGroup> bwGroup;
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync CHECK_ERROR(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()));
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync if (SUCCEEDED(rc))
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync {
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync CHECK_ERROR(bwCtrl, GetBandwidthGroup(Bstr(ValueUnion.psz).raw(), bwGroup.asOutParam()));
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync if (SUCCEEDED(rc))
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync {
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync CHECK_ERROR(nic, COMSETTER(BandwidthGroup)(bwGroup));
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync }
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync }
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync }
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync break;
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync }
13d1fd6f43e9a245a4f2b4fc6845bdaa5d0f4134vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NIC:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(FALSE));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "null"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Null));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "nat"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NAT));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if ( !RTStrICmp(ValueUnion.psz, "bridged")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "hostif")) /* backward compatibility */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Bridged));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "intnet"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Internal));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "hostonly"))
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync {
04c6e2bf4c47aa33be5ee50ac468b1b86b7125b4vboxsync
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnly));
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "generic"))
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_Generic));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync else if (!RTStrICmp(ValueUnion.psz, "natnetwork"))
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync {
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync CHECK_ERROR(nic, COMSETTER(Enabled)(TRUE));
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync CHECK_ERROR(nic, COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork));
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync }
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 {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
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:
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync {
56349fc0a23f96f82208016f8f59f8377bb284b1vboxsync CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr().raw()));
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(BridgedInterface)(Bstr(ValueUnion.psz).raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync case MODIFYVM_HOSTONLYADAPTER:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
56349fc0a23f96f82208016f8f59f8377bb284b1vboxsync CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr().raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(HostOnlyInterface)(Bstr(ValueUnion.psz).raw()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync case MODIFYVM_INTNET:
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync ASSERT(nic);
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync
1207f59aa62006952dbb0bf7700decf34d8caeb2vboxsync /* remove it? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
56349fc0a23f96f82208016f8f59f8377bb284b1vboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr().raw()));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync else
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync {
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz).raw()));
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync break;
8c58249d7f93d82395aa6c8b31526443892bc375vboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync case MODIFYVM_GENERICDRV:
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync ASSERT(nic);
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync CHECK_ERROR(nic, COMSETTER(GenericDriver)(Bstr(ValueUnion.psz).raw()));
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync break;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync }
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync case MODIFYVM_NATNETWORKNAME:
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync ASSERT(nic);
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync CHECK_ERROR(nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz).raw()));
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync break;
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync }
4b9a9888c020ed3508c8ac3a5b47842d6aa3f8d2vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_NATNET:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync const char *psz = ValueUnion.psz;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp("default", psz))
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync psz = "";
4a7d8f564249fb379bc53ebea77574be0e38b131vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(Network)(Bstr(psz).raw()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATBINDIP:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, 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;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync ComPtr<INATEngine> engine;
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
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, SetNetworkSettings(RTStrToUInt32(strMtu), RTStrToUInt32(strSockSnd), RTStrToUInt32(strSockRcv),
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync RTStrToUInt32(strTcpSnd), RTStrToUInt32(strTcpRcv)));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATPF:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
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 }
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, 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");
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, RemoveRedirect(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync #undef ITERATE_TO_NEXT_TERM
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync case MODIFYVM_NATALIASMODE:
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync {
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync ComPtr<INetworkAdapter> nic;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync ComPtr<INATEngine> engine;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync uint32_t aliasMode = 0;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync ASSERT(nic);
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
904810c4c6668233349b025cc58013cb7c11c701vboxsync if (RTStrCmp(ValueUnion.psz, "default") == 0)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync aliasMode = 0;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync else
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync {
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync char *token = (char *)ValueUnion.psz;
794c574111980e7fb3a86847e5495156afa13134vboxsync while (token)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync {
794c574111980e7fb3a86847e5495156afa13134vboxsync if (RTStrNCmp(token, RT_STR_TUPLE("log")) == 0)
794c574111980e7fb3a86847e5495156afa13134vboxsync aliasMode |= NATAliasMode_AliasLog;
794c574111980e7fb3a86847e5495156afa13134vboxsync else if (RTStrNCmp(token, RT_STR_TUPLE("proxyonly")) == 0)
794c574111980e7fb3a86847e5495156afa13134vboxsync aliasMode |= NATAliasMode_AliasProxyOnly;
794c574111980e7fb3a86847e5495156afa13134vboxsync else if (RTStrNCmp(token, RT_STR_TUPLE("sameports")) == 0)
794c574111980e7fb3a86847e5495156afa13134vboxsync aliasMode |= NATAliasMode_AliasUseSamePorts;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync token = RTStrStr(token, ",");
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync if (token == NULL)
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync break;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync token++;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync }
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync }
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(AliasMode)(aliasMode));
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync break;
62a515eec8de1b7804ec6997c0f2013fef5c5a6bvboxsync }
468c2bcb36eb9a032f5dd0fcb34db10bd58e9996vboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATTFTPPREFIX:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(TFTPPrefix)(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATTFTPFILE:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(TFTPBootFile)(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATTFTPSERVER:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(TFTPNextServer)(Bstr(ValueUnion.psz).raw()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATDNSPASSDOMAIN:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(DNSPassDomain)(ValueUnion.f));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATDNSPROXY:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(DNSProxy)(ValueUnion.f));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync case MODIFYVM_NATDNSHOSTRESOLVER:
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync ASSERT(nic);
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INATEngine> engine;
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
e446ce644a0cdc723be5146be1659f1206599c24vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(engine, COMSETTER(DNSUseHostResolver)(ValueUnion.f));
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync break;
cebc93936b5bb4d867e1c086dd1b206db33c31dcvboxsync }
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_MACADDRESS:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e446ce644a0cdc723be5146be1659f1206599c24vboxsync if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
e446ce644a0cdc723be5146be1659f1206599c24vboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
e446ce644a0cdc723be5146be1659f1206599c24vboxsync ComPtr<INetworkAdapter> nic;
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync ASSERT(nic);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* generate one? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "auto"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
56349fc0a23f96f82208016f8f59f8377bb284b1vboxsync CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr().raw()));
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;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "ps2"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_PS2Mouse));
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "usb"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBMouse));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (SUCCEEDED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync fEnableUsb = true;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "usbtablet"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBTablet));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync if (SUCCEEDED(rc))
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync fEnableUsb = true;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
a85c47589af3385deccdbb1367b75108806d7cf5vboxsync else if (!RTStrICmp(ValueUnion.psz, "usbmultitouch"))
a85c47589af3385deccdbb1367b75108806d7cf5vboxsync {
a85c47589af3385deccdbb1367b75108806d7cf5vboxsync CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBMultiTouch));
a85c47589af3385deccdbb1367b75108806d7cf5vboxsync if (SUCCEEDED(rc))
a85c47589af3385deccdbb1367b75108806d7cf5vboxsync fEnableUsb = true;
a85c47589af3385deccdbb1367b75108806d7cf5vboxsync }
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. */
bdb01608062958ff140a733533f3d6574886c831vboxsync ULONG cOhciCtrls = 0;
7a7a4fb86f66f7ab919948a2ad6aae0483061e18vboxsync rc = machine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
bdb01608062958ff140a733533f3d6574886c831vboxsync if ( SUCCEEDED(rc)
bdb01608062958ff140a733533f3d6574886c831vboxsync && !cOhciCtrls)
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync ComPtr<IUSBController> UsbCtl;
bdb01608062958ff140a733533f3d6574886c831vboxsync CHECK_ERROR(machine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
bdb01608062958ff140a733533f3d6574886c831vboxsync UsbCtl.asOutParam()));
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync }
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync break;
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
19cb1f8699e352d590c4946caee33863a5157241vboxsync
19cb1f8699e352d590c4946caee33863a5157241vboxsync case MODIFYVM_HIDKBD:
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync bool fEnableUsb = false;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "ps2"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_PS2Keyboard));
19cb1f8699e352d590c4946caee33863a5157241vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "usb"))
19cb1f8699e352d590c4946caee33863a5157241vboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync 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. */
bdb01608062958ff140a733533f3d6574886c831vboxsync ULONG cOhciCtrls = 0;
7a7a4fb86f66f7ab919948a2ad6aae0483061e18vboxsync rc = machine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
bdb01608062958ff140a733533f3d6574886c831vboxsync if ( SUCCEEDED(rc)
bdb01608062958ff140a733533f3d6574886c831vboxsync && !cOhciCtrls)
45e0b20bd50b7124efbbe1cdb1c65d67eb41498avboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync ComPtr<IUSBController> UsbCtl;
bdb01608062958ff140a733533f3d6574886c831vboxsync CHECK_ERROR(machine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
bdb01608062958ff140a733533f3d6574886c831vboxsync UsbCtl.asOutParam()));
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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "disconnected"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if ( !RTStrICmp(ValueUnion.psz, "server")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(ValueUnion.psz, "client")
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync || !RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(pszMode, "server"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(pszMode, "client"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync {
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(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
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync#if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync case MODIFYVM_LPTMODE:
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync {
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync ComPtr<IParallelPort> lpt;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync char *pszIRQ = NULL;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync ASSERT(lpt);
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync CHECK_ERROR(lpt, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync break;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync }
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync case MODIFYVM_LPT:
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync {
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync ComPtr<IParallelPort> lpt;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync ASSERT(lpt);
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync CHECK_ERROR(lpt, COMSETTER(Enabled)(FALSE));
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync else
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync {
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync const char *pszIOBase = ValueUnion.psz;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync uint32_t uVal = 0;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_LPT;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync if (RT_FAILURE(vrc))
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync return errorSyntax(USAGE_MODIFYVM,
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync "Missing or Invalid argument to '%s'",
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync GetOptState.pDef->pszLong);
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync CHECK_ERROR(lpt, COMSETTER(IRQ)(ValueUnion.u32));
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync vrc = RTStrToUInt32Ex(pszIOBase, NULL, 0, &uVal);
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync if (vrc != VINF_SUCCESS || uVal == 0)
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync return errorArgument("Error parsing LPT I/O base '%s'", pszIOBase);
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync CHECK_ERROR(lpt, COMSETTER(IOBase)(uVal));
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync CHECK_ERROR(lpt, COMSETTER(Enabled)(TRUE));
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync }
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync break;
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync }
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync#endif
67ee25dd0b63a61dc35a35d0aade75ca6cd06350vboxsync
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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "sb16"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "ac97"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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? */
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "none"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "winmm"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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)
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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 {
6fe1329154975472e055284198df7fa8e64dee3avboxsync ClipboardMode_T mode;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "disabled"))
6fe1329154975472e055284198df7fa8e64dee3avboxsync mode = ClipboardMode_Disabled;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "hosttoguest"))
6fe1329154975472e055284198df7fa8e64dee3avboxsync mode = ClipboardMode_HostToGuest;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "guesttohost"))
6fe1329154975472e055284198df7fa8e64dee3avboxsync mode = ClipboardMode_GuestToHost;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "bidirectional"))
6fe1329154975472e055284198df7fa8e64dee3avboxsync mode = ClipboardMode_Bidirectional;
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
6fe1329154975472e055284198df7fa8e64dee3avboxsync if (SUCCEEDED(rc))
6fe1329154975472e055284198df7fa8e64dee3avboxsync {
6fe1329154975472e055284198df7fa8e64dee3avboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(mode));
6fe1329154975472e055284198df7fa8e64dee3avboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync case MODIFYVM_DRAGANDDROP:
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync {
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync DnDMode_T mode;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "disabled"))
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync mode = DnDMode_Disabled;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "hosttoguest"))
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync mode = DnDMode_HostToGuest;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "guesttohost"))
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync mode = DnDMode_GuestToHost;
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "bidirectional"))
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync mode = DnDMode_Bidirectional;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync else
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync {
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync errorArgument("Invalid --draganddrop argument '%s'", ValueUnion.psz);
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync rc = E_FAIL;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync }
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync if (SUCCEEDED(rc))
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync {
069b9101fbd3b049610c5511b1cc9534d01ea472vboxsync CHECK_ERROR(machine, COMSETTER(DnDMode)(mode));
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync }
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync break;
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync }
2a171646d32f8a15e9820d6fb3bf3f9b9990ca3fvboxsync
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync case MODIFYVM_VRDE_EXTPACK:
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync {
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync ComPtr<IVRDEServer> vrdeServer;
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync ASSERT(vrdeServer);
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync if (vrdeServer)
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (RTStrICmp(ValueUnion.psz, "default") != 0)
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync {
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync Bstr bstr(ValueUnion.psz);
9ca017ceee656f9d33f2cb6652e401b5f17fcfb7vboxsync CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(bstr.raw()));
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync }
fc60d7c6501c5e676e41b11c042d4358d9faa81dvboxsync else
56349fc0a23f96f82208016f8f59f8377bb284b1vboxsync CHECK_ERROR(vrdeServer, COMSETTER(VRDEExtPack)(Bstr().raw()));
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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(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
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "null"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_Null));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(ValueUnion.psz, "external"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync {
3933885bc0c2c93436d858a14564c6179ec72872vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthType)(AuthType_External));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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 {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (RTStrICmp(ValueUnion.psz, "default") != 0)
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync {
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync Bstr bstr(ValueUnion.psz);
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(bstr.raw()));
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync }
6e25221ce8ef8e656d1e15eb7ec5cf8ae758ceb2vboxsync else
56349fc0a23f96f82208016f8f59f8377bb284b1vboxsync CHECK_ERROR(vrdeServer, COMSETTER(AuthLibrary)(Bstr().raw()));
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
9601ea695ea96905d6f5d484facd272732365c40vboxsync case MODIFYVM_USBXHCI:
9601ea695ea96905d6f5d484facd272732365c40vboxsync {
9601ea695ea96905d6f5d484facd272732365c40vboxsync ULONG cXhciCtrls = 0;
9601ea695ea96905d6f5d484facd272732365c40vboxsync rc = machine->GetUSBControllerCountByType(USBControllerType_XHCI, &cXhciCtrls);
9601ea695ea96905d6f5d484facd272732365c40vboxsync if (SUCCEEDED(rc))
9601ea695ea96905d6f5d484facd272732365c40vboxsync {
9601ea695ea96905d6f5d484facd272732365c40vboxsync if (!cXhciCtrls && ValueUnion.f)
9601ea695ea96905d6f5d484facd272732365c40vboxsync {
9601ea695ea96905d6f5d484facd272732365c40vboxsync ComPtr<IUSBController> UsbCtl;
9601ea695ea96905d6f5d484facd272732365c40vboxsync CHECK_ERROR(machine, AddUSBController(Bstr("XHCI").raw(), USBControllerType_XHCI,
9601ea695ea96905d6f5d484facd272732365c40vboxsync UsbCtl.asOutParam()));
9601ea695ea96905d6f5d484facd272732365c40vboxsync }
9601ea695ea96905d6f5d484facd272732365c40vboxsync else if (cXhciCtrls && !ValueUnion.f)
9601ea695ea96905d6f5d484facd272732365c40vboxsync CHECK_ERROR(machine, RemoveUSBController(Bstr("XHCI").raw()));
9601ea695ea96905d6f5d484facd272732365c40vboxsync }
9601ea695ea96905d6f5d484facd272732365c40vboxsync break;
9601ea695ea96905d6f5d484facd272732365c40vboxsync }
9601ea695ea96905d6f5d484facd272732365c40vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_USBEHCI:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync ULONG cEhciCtrls = 0;
7a7a4fb86f66f7ab919948a2ad6aae0483061e18vboxsync rc = machine->GetUSBControllerCountByType(USBControllerType_EHCI, &cEhciCtrls);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (SUCCEEDED(rc))
bdb01608062958ff140a733533f3d6574886c831vboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync if (!cEhciCtrls && ValueUnion.f)
bdb01608062958ff140a733533f3d6574886c831vboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync ComPtr<IUSBController> UsbCtl;
bdb01608062958ff140a733533f3d6574886c831vboxsync CHECK_ERROR(machine, AddUSBController(Bstr("EHCI").raw(), USBControllerType_EHCI,
bdb01608062958ff140a733533f3d6574886c831vboxsync UsbCtl.asOutParam()));
bdb01608062958ff140a733533f3d6574886c831vboxsync }
bdb01608062958ff140a733533f3d6574886c831vboxsync else if (cEhciCtrls && !ValueUnion.f)
bdb01608062958ff140a733533f3d6574886c831vboxsync CHECK_ERROR(machine, RemoveUSBController(Bstr("EHCI").raw()));
bdb01608062958ff140a733533f3d6574886c831vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_USB:
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync ULONG cOhciCtrls = 0;
7a7a4fb86f66f7ab919948a2ad6aae0483061e18vboxsync rc = machine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync if (SUCCEEDED(rc))
bdb01608062958ff140a733533f3d6574886c831vboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync if (!cOhciCtrls && ValueUnion.f)
bdb01608062958ff140a733533f3d6574886c831vboxsync {
bdb01608062958ff140a733533f3d6574886c831vboxsync ComPtr<IUSBController> UsbCtl;
bdb01608062958ff140a733533f3d6574886c831vboxsync CHECK_ERROR(machine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
bdb01608062958ff140a733533f3d6574886c831vboxsync UsbCtl.asOutParam()));
bdb01608062958ff140a733533f3d6574886c831vboxsync }
bdb01608062958ff140a733533f3d6574886c831vboxsync else if (cOhciCtrls && !ValueUnion.f)
bdb01608062958ff140a733533f3d6574886c831vboxsync CHECK_ERROR(machine, RemoveUSBController(Bstr("OHCI").raw()));
bdb01608062958ff140a733533f3d6574886c831vboxsync }
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync case MODIFYVM_SNAPSHOTFOLDER:
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "default"))
56349fc0a23f96f82208016f8f59f8377bb284b1vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr().raw()));
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
23d9dbdaf1b83107abf9882246a4a46933f733efvboxsync case MODIFYVM_TELEPORTER_PASSWORD_FILE:
edefdc20eedaf9ef5b1293e56ba9b8cca7b5c740vboxsync {
94c4b844625733fedcd2b473c207981b31316bd9vboxsync Utf8Str password;
94c4b844625733fedcd2b473c207981b31316bd9vboxsync RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &password);
94c4b844625733fedcd2b473c207981b31316bd9vboxsync if (rcExit != RTEXITCODE_SUCCESS)
94c4b844625733fedcd2b473c207981b31316bd9vboxsync rc = E_FAIL;
edefdc20eedaf9ef5b1293e56ba9b8cca7b5c740vboxsync else
94c4b844625733fedcd2b473c207981b31316bd9vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(password).raw()));
edefdc20eedaf9ef5b1293e56ba9b8cca7b5c740vboxsync break;
edefdc20eedaf9ef5b1293e56ba9b8cca7b5c740vboxsync }
edefdc20eedaf9ef5b1293e56ba9b8cca7b5c740vboxsync
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync case MODIFYVM_TRACING_ENABLED:
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync {
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync CHECK_ERROR(machine, COMSETTER(TracingEnabled)(ValueUnion.f));
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync break;
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync }
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync case MODIFYVM_TRACING_CONFIG:
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync {
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync CHECK_ERROR(machine, COMSETTER(TracingConfig)(Bstr(ValueUnion.psz).raw()));
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync break;
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync }
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync case MODIFYVM_TRACING_ALLOW_VM_ACCESS:
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync {
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync CHECK_ERROR(machine, COMSETTER(AllowTracingToAccessVM)(ValueUnion.f));
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync break;
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync }
a9315925c69e4c3bb342bb317ca5b6d29e1ee467vboxsync
40dce69ff1c2949a489337922f30f1021d62d864vboxsync case MODIFYVM_FAULT_TOLERANCE:
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "master"))
40dce69ff1c2949a489337922f30f1021d62d864vboxsync {
40dce69ff1c2949a489337922f30f1021d62d864vboxsync CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Master)));
40dce69ff1c2949a489337922f30f1021d62d864vboxsync }
40dce69ff1c2949a489337922f30f1021d62d864vboxsync else
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(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 {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, COMSETTER(HPETEnabled)(ValueUnion.f));
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync break;
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync }
dbabc9de5bf52ce5eb77cf82b038e9a6166c5a04vboxsync
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync case MODIFYVM_IOCACHE:
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, COMSETTER(IOCacheEnabled)(ValueUnion.f));
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync break;
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync }
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync case MODIFYVM_IOCACHESIZE:
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, COMSETTER(IOCacheSize)(ValueUnion.u32));
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync break;
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync }
4090390866c02d5d0ad061151cdb298b9a173e86vboxsync
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync case MODIFYVM_CHIPSET:
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync {
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync if (!RTStrICmp(ValueUnion.psz, "piix3"))
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync {
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync }
8b36957d815c23b479eb35d93ac76c66392e9402vboxsync else if (!RTStrICmp(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 }
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync#ifdef VBOX_WITH_VPX
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync case MODIFYVM_VCP:
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync {
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureEnabled)(ValueUnion.f));
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync break;
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync }
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync case MODIFYVM_VCP_SCREENS:
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync {
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync ULONG cMonitors = 64;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync CHECK_ERROR(machine, COMGETTER(MonitorCount)(&cMonitors));
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync com::SafeArray<BOOL> screens(cMonitors);
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync if (parseScreens(ValueUnion.psz, &screens))
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync {
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync errorArgument("Invalid list of screens specified\n");
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync rc = E_FAIL;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync break;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync }
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureScreens)(ComSafeArrayAsInParam(screens)));
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync break;
48890ac9b4b339e0341e826b5c26ce6408729987vboxsync }
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync case MODIFYVM_VCP_FILENAME:
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync {
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync Bstr bstr;
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync /* empty string will fall through, leaving bstr empty */
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync if (*ValueUnion.psz)
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync {
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync char szVCFileAbs[RTPATH_MAX] = "";
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync int vrc = RTPathAbs(ValueUnion.psz, szVCFileAbs, sizeof(szVCFileAbs));
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync if (RT_FAILURE(vrc))
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync {
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync errorArgument("Cannot convert filename \"%s\" to absolute path\n", ValueUnion.psz);
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync rc = E_FAIL;
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync break;
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync }
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync bstr = szVCFileAbs;
6f1ce0274d766b4a37d6bede42ed83d42edbbe92vboxsync }
f57758f0bcf995d350d64a7c059ac93573144c05vboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureFile)(bstr.raw()));
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync break;
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync }
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync case MODIFYVM_VCP_WIDTH:
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync {
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureWidth)(ValueUnion.u32));
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync break;
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync }
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync case MODIFYVM_VCP_HEIGHT:
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync {
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureHeight)(ValueUnion.u32));
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync break;
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync }
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync case MODIFYVM_VCP_RATE:
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync {
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureRate)(ValueUnion.u32));
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync break;
5d57bcb78f1f3f918bd3daf709b551b8c2d30485vboxsync }
cccc6ee5f7156cfcdf13acca545cf65124d9ed44vboxsync case MODIFYVM_VCP_FPS:
cccc6ee5f7156cfcdf13acca545cf65124d9ed44vboxsync {
94e6c42807255a60e08010231689ef8823733967vboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureFPS)(ValueUnion.u32));
cccc6ee5f7156cfcdf13acca545cf65124d9ed44vboxsync break;
cccc6ee5f7156cfcdf13acca545cf65124d9ed44vboxsync }
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync case MODIFYVM_VCP_MAXTIME:
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync {
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureMaxTime)(ValueUnion.u32));
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync break;
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync }
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync case MODIFYVM_VCP_MAXSIZE:
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync {
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureMaxFileSize)(ValueUnion.u32));
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync break;
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync }
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync case MODIFYVM_VCP_OPTIONS:
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync {
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync Bstr bstr(ValueUnion.psz);
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync CHECK_ERROR(machine, COMSETTER(VideoCaptureOptions)(bstr.raw()));
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync break;
c31f30607ddcca383fd7cf1493b10196007e6e64vboxsync }
3f00104a87d8a725dfa0348b69cbdac901062a4avboxsync#endif
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync case MODIFYVM_AUTOSTART_ENABLED:
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync {
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync CHECK_ERROR(machine, COMSETTER(AutostartEnabled)(ValueUnion.f));
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync break;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync }
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync case MODIFYVM_AUTOSTART_DELAY:
8c859f9b5248b011cfe07153154fe77ff69d67cevboxsync {
8c859f9b5248b011cfe07153154fe77ff69d67cevboxsync CHECK_ERROR(machine, COMSETTER(AutostartDelay)(ValueUnion.u32));
8c859f9b5248b011cfe07153154fe77ff69d67cevboxsync break;
8c859f9b5248b011cfe07153154fe77ff69d67cevboxsync }
8c859f9b5248b011cfe07153154fe77ff69d67cevboxsync
8c859f9b5248b011cfe07153154fe77ff69d67cevboxsync case MODIFYVM_AUTOSTOP_TYPE:
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync {
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync AutostopType_T enmAutostopType = AutostopType_Disabled;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync if (!RTStrICmp(ValueUnion.psz, "disabled"))
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync enmAutostopType = AutostopType_Disabled;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync else if (!RTStrICmp(ValueUnion.psz, "savestate"))
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync enmAutostopType = AutostopType_SaveState;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync else if (!RTStrICmp(ValueUnion.psz, "poweroff"))
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync enmAutostopType = AutostopType_PowerOff;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync else if (!RTStrICmp(ValueUnion.psz, "acpishutdown"))
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync enmAutostopType = AutostopType_AcpiShutdown;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync else
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync {
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync errorArgument("Invalid --autostop-type argument '%s' (valid: disabled, savestate, poweroff, acpishutdown)", ValueUnion.psz);
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync rc = E_FAIL;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync }
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync if (SUCCEEDED(rc))
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync CHECK_ERROR(machine, COMSETTER(AutostopType)(enmAutostopType));
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync break;
45a01ef53b009e9f56ce427bd8688da02ad32389vboxsync }
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync#ifdef VBOX_WITH_PCI_PASSTHROUGH
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync case MODIFYVM_ATTACH_PCI:
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync {
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync const char* pAt = strchr(ValueUnion.psz, '@');
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync int32_t iHostAddr, iGuestAddr;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync iHostAddr = parsePci(ValueUnion.psz);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync iGuestAddr = pAt != NULL ? parsePci(pAt + 1) : iHostAddr;
aa0553becec2abc2e781f839ba1d399c31c2c07fvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync if (iHostAddr == -1 || iGuestAddr == -1)
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync {
505ddd00252720bfb5569fcb17bfda53dc141e3bvboxsync errorArgument("Invalid --pciattach argument '%s' (valid: 'HB:HD.HF@GB:GD.GF' or just 'HB:HD.HF')", ValueUnion.psz);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync rc = E_FAIL;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync }
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync else
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, AttachHostPCIDevice(iHostAddr, iGuestAddr, TRUE));
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync }
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync break;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync }
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync case MODIFYVM_DETACH_PCI:
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync {
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync int32_t iHostAddr;
7a29aa5ce149ccd344a2929d2815b8e212690b92vboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync iHostAddr = parsePci(ValueUnion.psz);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync if (iHostAddr == -1)
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync {
505ddd00252720bfb5569fcb17bfda53dc141e3bvboxsync errorArgument("Invalid --pcidetach argument '%s' (valid: 'HB:HD.HF')", ValueUnion.psz);
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync rc = E_FAIL;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync }
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync else
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync {
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync CHECK_ERROR(machine, DetachHostPCIDevice(iHostAddr));
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync }
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync break;
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync }
a1b4fb3917412d2632d358ff8989f1ec971f2d5bvboxsync#endif
62ab017295981c81484e5a5f93ff8b5f85f7defbvboxsync
7708252d252a55417a6a817041e4356797e34255vboxsync#ifdef VBOX_WITH_USB_CARDREADER
7708252d252a55417a6a817041e4356797e34255vboxsync case MODIFYVM_USBCARDREADER:
7708252d252a55417a6a817041e4356797e34255vboxsync {
7708252d252a55417a6a817041e4356797e34255vboxsync CHECK_ERROR(machine, COMSETTER(EmulatedUSBCardReaderEnabled)(ValueUnion.f));
7708252d252a55417a6a817041e4356797e34255vboxsync break;
7708252d252a55417a6a817041e4356797e34255vboxsync }
7708252d252a55417a6a817041e4356797e34255vboxsync#endif /* VBOX_WITH_USB_CARDREADER */
7708252d252a55417a6a817041e4356797e34255vboxsync
904810c4c6668233349b025cc58013cb7c11c701vboxsync case MODIFYVM_DEFAULTFRONTEND:
904810c4c6668233349b025cc58013cb7c11c701vboxsync {
904810c4c6668233349b025cc58013cb7c11c701vboxsync Bstr bstr(ValueUnion.psz);
904810c4c6668233349b025cc58013cb7c11c701vboxsync if (bstr == "default")
904810c4c6668233349b025cc58013cb7c11c701vboxsync bstr = Bstr::Empty;
904810c4c6668233349b025cc58013cb7c11c701vboxsync CHECK_ERROR(machine, COMSETTER(DefaultFrontend)(bstr.raw()));
904810c4c6668233349b025cc58013cb7c11c701vboxsync break;
904810c4c6668233349b025cc58013cb7c11c701vboxsync }
904810c4c6668233349b025cc58013cb7c11c701vboxsync
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 */