VBoxManageModifyVM.cpp revision 91f8453d16b48876deddaba298c211071d0ca3a5
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync * VBoxManage - Implementation of modifyvm command.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * additional information or have any questions.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*******************************************************************************
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync* Header Files *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync*******************************************************************************/
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncusing namespace com;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* VM ID + at least one parameter. Parameter arguments are checked
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * individually. */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* Get the number of network adapters */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (info, COMGETTER(SerialPortCount) (&SerialPortCount), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> nics (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> nictype (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> cableconnected (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> nictrace (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> nictracefile (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> nicspeed (NetworkAdapterCount, 0);
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync std::vector <char *> hostifdev (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <const char *> intnet (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <const char *> natnet (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> macs (NetworkAdapterCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> uarts_mode (SerialPortCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <ULONG> uarts_base (SerialPortCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <ULONG> uarts_irq (SerialPortCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync std::vector <char *> uarts_path (SerialPortCount, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync return errorArgument("The number of cpus cannot be 0.", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync else if ( !strcmp(a->argv[i], "--accelerate2dvideo")
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--bioslogodisplaytime")
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--bioslogoimagepath")
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--biossystemtimeoffset")
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Missing boot slot number in '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (VINF_SUCCESS != RTStrToUInt32Full(&a->argv[i][5 + (a->argv[i][1] == '-')], 10, &n))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Invalid boot slot number in '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Invalid boot device '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--cableconnected", 16)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][15 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync /* watch for the right order of these --nic* comparisons! */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--nictracefile", 14)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][13 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][8 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][4 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-hostifdev", 10)) /* backward compatibility */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][10 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--bridgeadapter", 15)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][14 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--hostonlyadapter", 17)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][16 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][7 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][7 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int rc = RTCidrStrToIPv4(a->argv[i + 1], &Network, &Netmask);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Invalid IPv4 network '%s' specified -- CIDR notation expected.\n", a->argv[i + 1]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Prefix length of the NAT network must be less than 28.\n");
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][11 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* VBOX_WITH_VRDP */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --usb argument '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --usbehci argument '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], SerialPortCount, "UART");
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "server") || !strcmp(a->argv[i], "client"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Uart pipe must start with \\\\.\\pipe\\");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Missing argument to --uartmode");
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][5 + (a->argv[i][1] == '-')], SerialPortCount, "UART");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i-1]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing UART I/O base '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing UART IRQ '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--guestmemoryballoon")
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing guest memory balloon size '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--gueststatisticsinterval")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-gueststatisticsinterval"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing guest statistics interval '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --usb argument '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unsigned n;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing arguments to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], 30, "SATA");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--sataideemulation", 18)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unsigned n;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync bootDevicePos = parseNum(&a->argv[i][17 + (a->argv[i][1] == '-')], 4, "SATA");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing arguments to '%s'", a->argv[i]);
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --scsi argument '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], 16, "SCSI");
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --scsitype argument '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Invalid parameter '%s'", Utf8Str(a->argv[i]).raw());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* try to find the given machine */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR (a->virtualBox, GetMachine (uuid, machine.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR (a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open a session for the VM */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (a->virtualBox, OpenSession(a->session, uuid), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* get the mutable session machine */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync a->session->COMGETTER(Machine)(machine.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(ostype, guestOSType.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ostype).raw());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(MemorySize)(memorySize));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(VRAMSize)(vramSize));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --acpi argument '%s'", acpi);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --ioapic argument '%s'", ioapic);
4cf22805d13f50eef86e917f2c7106fe5198a2d8vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(TRUE));
4cf22805d13f50eef86e917f2c7106fe5198a2d8vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(FALSE));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --hwvirtex argument '%s'", hwvirtex);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExNestedPagingEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExNestedPagingEnabled)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --nestedpaging argument '%s'", ioapic);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExVPIDEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExVPIDEnabled)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vtxvpid argument '%s'", ioapic);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(PAEEnabled)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --pae argument '%s'", ioapic);
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync CHECK_ERROR(machine, COMSETTER(CPUCount)(numCpus));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(MonitorCount)(monitorcount));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(false));
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync errorArgument("Invalid --accelerate3d argument '%s'", accelerate3d);
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(true));
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(false));
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync errorArgument("Invalid --accelerate2dvideo argument '%s'", accelerate2dvideo);
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_Efi));
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_Bios));
91f8453d16b48876deddaba298c211071d0ca3a5vboxsync errorArgument("Invalid --firmware argument '%s'", firmware);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --bioslogofadein argument '%s'", bioslogofadein);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --bioslogofadeout argument '%s'", bioslogofadeout);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(bioslogodisplaytime));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(bioslogoimagepath)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(biosbootmenumode, "messageandmenu"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --biosbootmenu argument '%s'", biosbootmenumode);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync LONG64 timeOffset = RTStrToInt64(biossystemtimeoffset);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(timeOffset));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --biospxedebug argument '%s'", biospxedebug);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for (int curBootDev = 0; curBootDev < 4; curBootDev++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, SetBootOrder (curBootDev + 1, bootDevice[curBootDev]));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[0]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[0]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("IDE"), 0, 0));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[1]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[1]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("IDE"), 0, 1));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[2]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[2]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("IDE"), 1, 1));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(DVDDrive)(dvdDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* unmount? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* host drive? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
70bb61ea2f96e80150e807529ce5df435607706bvboxsync rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
70bb61ea2f96e80150e807529ce5df435607706bvboxsync rc = host->FindHostDVDDrive(Bstr(dvd + 5), hostDVDDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* 2nd try: try with the real name, important on Linux+libhal */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (RT_FAILURE(RTPathReal(dvd + 5, szPathReal, sizeof(szPathReal))))
70bb61ea2f96e80150e807529ce5df435607706bvboxsync rc = host->FindHostDVDDrive(Bstr(szPathReal), hostDVDDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(dvdDrive, CaptureHostDrive(hostDVDDrive));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first assume it's a UUID */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = a->virtualBox->GetDVDImage(uuid, dvdImage.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* must be a filename, check if it's in the collection */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = a->virtualBox->FindDVDImage(Bstr(dvd), dvdImage.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not registered, do that on the fly */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, OpenDVDImage(Bstr(dvd), emptyUUID, dvdImage.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(DVDDrive)(dvdDrive.asOutParam());
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync CHECK_ERROR(dvdDrive, COMSETTER(Passthrough)(!strcmp(dvdpassthrough, "on")));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE"), storageController.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --idecontroller argument '%s'", idecontroller);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(FloppyDrive)(floppyDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable the controller */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, COMSETTER(Enabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* enable the controller */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* unmount? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* host drive? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
16489a966f88b447f36b4382ce5fff1f5cf39ff8vboxsync com::SafeIfaceArray <IHostFloppyDrive> hostFloppies;
16489a966f88b447f36b4382ce5fff1f5cf39ff8vboxsync CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(hostFloppies)));
16489a966f88b447f36b4382ce5fff1f5cf39ff8vboxsync rc = host->FindHostFloppyDrive(Bstr(floppy + 5), hostFloppyDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, CaptureHostDrive(hostFloppyDrive));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first assume it's a UUID */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = a->virtualBox->GetFloppyImage(uuid, floppyImage.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* must be a filename, check if it's in the collection */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = a->virtualBox->FindFloppyImage(Bstr(floppy), floppyImage.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not registered, do that on the fly */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, OpenFloppyImage(Bstr(floppy), emptyUUID, floppyImage.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* RT_OS_WINDOWS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !RT_OS_LINUX */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !RT_OS_SOLARIS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !RT_OS_DARWIN */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --audio argument '%s'", audio);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --audiocontroller argument '%s'", audiocontroller);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* Shared clipboard state */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/* ComPtr<IClipboardMode> clipboardMode;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(ClipboardMode)(clipboardMode.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(clipboardMode);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --clipboard argument '%s'", clipboard);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* iterate through all possible NICs */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (machine, GetNetworkAdapter (n, nic.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the NIC? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (FALSE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(nics[n], "hostif")) /* backward compatibility */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
6f6fbd24a8e2a201dd9474eebd7542b338cd511avboxsync CHECK_ERROR_RET(nic, AttachToBridgedInterface(), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, AttachToInternalNetwork(), 1);
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
6f6fbd24a8e2a201dd9474eebd7542b338cd511avboxsync CHECK_ERROR_RET(nic, AttachToHostOnlyInterface(), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid type '%s' specfied for NIC %lu", nics[n], n + 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the NIC type? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC), 1);
eecd0c10bb4e8ce1734d8b25a90e6ea61b9f862bvboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM), 1);
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio), 1);
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync#endif /* VBOX_WITH_VIRTIO */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid NIC type '%s' specified for NIC %lu", nictype[n], n + 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the MAC address? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* generate one? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(MACAddress)(NULL), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(MACAddress)(Bstr(macs[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the reported link speed? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --nicspeed%lu argument '%s'", n + 1, nicspeed[n]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(LineSpeed)(u32LineSpeed), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the link status flag? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(CableConnected)(TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(CableConnected)(FALSE), 1);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --cableconnected%lu argument '%s'", n + 1, cableconnected[n]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the trace flag? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(TraceEnabled)(TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(TraceEnabled)(FALSE), 1);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --nictrace%lu argument '%s'", n + 1, nictrace[n]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the tracefile flag? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(TraceFile)(Bstr(nictracefile[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the host interface device? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* remove it? */
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync CHECK_ERROR_RET(nic, COMSETTER(HostInterface)(NULL), 1);
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync CHECK_ERROR_RET(nic, COMSETTER(HostInterface)(Bstr(hostifdev[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the internal network name? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* remove it? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(InternalNetwork)(NULL), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(InternalNetwork)(Bstr(intnet[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the network of the NAT */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(NATNetwork)(Bstr(natnet[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* iterate through all possible serial ports */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (machine, GetSerialPort (n, uart.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Enabled) (FALSE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(IOBase) (uarts_base[n]), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(IRQ) (uarts_irq[n]), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Enabled) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_Disconnected), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Path) (Bstr(uarts_path[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipe), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Server) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipe), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Server) (FALSE), 1);
801238b286a80a5dd67ba56a1f26c0bc98a2a1eavboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_RawFile), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostDevice), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdp || (vrdpport != UINT16_MAX) || vrdpaddress || vrdpauthtype || vrdpmulticon || vrdpreusecon)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Enabled)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdp argument '%s'", vrdp);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Port)(vrdpport));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(vrdpaddress)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdpauthtype argument '%s'", vrdpauthtype);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdpmulticon argument '%s'", vrdpmulticon);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(false));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdpreusecon argument '%s'", vrdpreusecon);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* VBOX_WITH_VRDP */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(!!fUsbEnabled));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(!!fUsbEhciEnabled));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(snapshotFolder)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(guestMemBalloonSize));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(StatisticsUpdateInterval)(guestStatInterval));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * SATA controller enable/disable
89e846f396d9fede6d24f6ba65fc722cc6ab5f4cvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("SATA"), StorageBus_SATA, ctl.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA")));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[i]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("SATA"), i-4, 0));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(SataCtl, SetIDEEmulationPort(i, sataBootDevices[i]));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(SataCtl, COMSETTER(PortCount)(sataPortCount));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync * SCSI controller enable/disable
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic"), StorageBus_SCSI, ctl.asOutParam()));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync else /* LsiLogic is default */
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("LsiLogic"), StorageBus_SCSI, ctl.asOutParam()));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync rc = machine->RemoveStorageController(Bstr("LsiLogic"));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic")));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync rc = machine->DetachHardDisk(Bstr("LsiLogic"), i-34, 0);
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, DetachHardDisk(Bstr("BusLogic"), i-34, 0));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync /* first guess is that it's a UUID */
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync /* not successful? Then it must be a filename */
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[i]), hardDisk.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync rc = machine->AttachHardDisk(uuid, Bstr("LsiLogic"), i-34, 0);
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("BusLogic"), i-34, 0));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* commit changes */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* it's important to always close sessions */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */