VBoxManageModifyVM.cpp revision 9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bff
9ad572a3ac0fd3845a9abecfbf41e8db9b3a5cf0vboxsync/* $Id$ */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @file
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync * VBoxManage - Implementation of modifyvm command.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * available from http://www.virtualbox.org. This file is free software;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * you can redistribute it and/or modify it under the terms of the GNU
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * General Public License (GPL) as published by the Free Software
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * additional information or have any questions.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*******************************************************************************
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync* Header Files *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync*******************************************************************************/
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifndef VBOX_ONLY_DOCS
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/com.h>
70bb61ea2f96e80150e807529ce5df435607706bvboxsync#include <VBox/com/array.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/ErrorInfo.h>
23179f1443b03947d85eccc81cbc6b5153a4abf3vboxsync#include <VBox/com/errorprint.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/EventQueue.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/com/VirtualBox.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <vector>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <list>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/cidr.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/param.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/path.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/stream.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <iprt/string.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include <VBox/log.h>
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#include "VBoxManage.h"
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifndef VBOX_ONLY_DOCS
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncusing namespace com;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#if defined(_MSC_VER)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# pragma optimize("g", off)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncint handleModifyVM(HandlerArg *a)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync{
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync HRESULT rc;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync Bstr name;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync Bstr ostype;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t memorySize = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t vramSize = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *acpi = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *hwvirtex = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *nestedpaging = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *vtxvpid = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *pae = NULL;
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync uint32_t numCpus = UINT32_MAX;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *ioapic = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t monitorcount = ~0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *accelerate3d = NULL;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync char *accelerate2dvideo = NULL;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *bioslogofadein = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *bioslogofadeout = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t bioslogodisplaytime = ~0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *bioslogoimagepath = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *biosbootmenumode = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *biossystemtimeoffset = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *biospxedebug = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync DeviceType_T bootDevice[4];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int bootDeviceChanged[4] = { false };
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync char *hdds[50] = {0};
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *dvd = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *dvdpassthrough = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *idecontroller = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *floppy = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *audio = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *audiocontroller = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *clipboard = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef VBOX_WITH_VRDP
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *vrdp = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint16_t vrdpport = UINT16_MAX;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *vrdpaddress = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *vrdpauthtype = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *vrdpmulticon = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *vrdpreusecon = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int fUsbEnabled = -1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int fUsbEhciEnabled = -1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char *snapshotFolder = NULL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ULONG guestMemBalloonSize = (ULONG)-1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ULONG guestStatInterval = (ULONG)-1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int fSataEnabled = -1;
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync int fScsiEnabled = -1;
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync int fScsiLsiLogic = -1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int sataPortCount = -1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int sataBootDevices[4] = {-1,-1,-1,-1};
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* VM ID + at least one parameter. Parameter arguments are checked
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * individually. */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc < 2)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* Get the number of network adapters */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ULONG NetworkAdapterCount = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr <ISystemProperties> info;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ULONG SerialPortCount = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr <ISystemProperties> info;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (info, COMGETTER(SerialPortCount) (&SerialPortCount), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
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
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for (int i = 1; i < a->argc; i++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if ( !strcmp(a->argv[i], "--name")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-name"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync name = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--ostype")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-ostype"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ostype = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--memory")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-memory"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync memorySize = RTStrToUInt32(a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vram")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vram"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vramSize = RTStrToUInt32(a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--acpi")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-acpi"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync acpi = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--ioapic")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-ioapic"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ioapic = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--hwvirtex")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-hwvirtex"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hwvirtex = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--nestedpaging")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-nestedpaging"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync nestedpaging = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vtxvpid")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vtxvpid"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vtxvpid = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--pae")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-pae"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync pae = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync else if (!strcmp(a->argv[i], "--cpus"))
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync {
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync if (a->argc <= i + 1)
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync i++;
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync numCpus = RTStrToUInt32(a->argv[i]);
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync if (numCpus == UINT32_MAX)
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync return errorArgument("The number of cpus cannot be 0.", a->argv[i]);
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--monitorcount")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-monitorcount"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync monitorcount = RTStrToUInt32(a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--accelerate3d")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-accelerate3d"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync accelerate3d = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync else if ( !strcmp(a->argv[i], "--accelerate2dvideo")
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync || !strcmp(a->argv[i], "-accelerate2dvideo"))
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync if (a->argc <= i + 1)
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync i++;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync accelerate2dvideo = a->argv[i];
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync#endif
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--bioslogofadein")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-bioslogofadein"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bioslogofadein = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--bioslogofadeout")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-bioslogofadeout"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bioslogofadeout = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--bioslogodisplaytime")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-bioslogodisplaytime"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bioslogodisplaytime = RTStrToUInt32(a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--bioslogoimagepath")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-bioslogoimagepath"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bioslogoimagepath = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--biosbootmenu")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-biosbootmenu"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync biosbootmenumode = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--biossystemtimeoffset")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-biossystemtimeoffset"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync biossystemtimeoffset = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--biospxedebug")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-biospxedebug"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync biospxedebug = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--boot", 6)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-boot", 5))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t n = 0;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!a->argv[i][5 + (a->argv[i][1] == '-')])
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 if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bootDevice[n - 1] = DeviceType_Null;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "floppy"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bootDevice[n - 1] = DeviceType_Floppy;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "dvd"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bootDevice[n - 1] = DeviceType_DVD;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "disk"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bootDevice[n - 1] = DeviceType_HardDisk;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "net"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bootDevice[n - 1] = DeviceType_Network;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Invalid boot device '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bootDeviceChanged[n - 1] = true;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--hda")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-hda"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hdds[0] = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--hdb")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-hdb"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hdds[1] = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--hdd")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-hdd"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hdds[2] = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--dvd")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-dvd"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync dvd = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--dvdpassthrough")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-dvdpassthrough"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync dvdpassthrough = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--idecontroller")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-idecontroller"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync idecontroller = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--floppy")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-floppy"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync floppy = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--audio")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-audio"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync audio = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--audiocontroller")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-audiocontroller"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync audiocontroller = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--clipboard")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-clipboard"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync clipboard = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--cableconnected", 16)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-cableconnected", 15))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][15 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync cableconnected[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync /* watch for the right order of these --nic* comparisons! */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--nictracefile", 14)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-nictracefile", 13))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][13 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync nictracefile[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--nictrace", 10)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-nictrace", 9))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync nictrace[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--nictype", 9)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-nictype", 8))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][8 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync nictype[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--nicspeed", 10)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-nicspeed", 9))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync nicspeed[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--nic", 5)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-nic", 4))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][4 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync nics[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--hostifdev", 11)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-hostifdev", 10)) /* backward compatibility */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][10 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync hostifdev[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--bridgeadapter", 15)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-bridgeadapter", 14))
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][14 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync if (!n)
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync return 1;
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync if (a->argc <= i + 1)
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync hostifdev[n - 1] = a->argv[i + 1];
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync i++;
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync }
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync#if defined(VBOX_WITH_NETFLT)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--hostonlyadapter", 17)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-hostonlyadapter", 16))
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][16 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync if (!n)
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync return 1;
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync if (a->argc <= i + 1)
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync hostifdev[n - 1] = a->argv[i + 1];
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync i++;
629e8f58c569e4c51a98284c41754fd9f0b973f8vboxsync }
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync#endif
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--intnet", 8)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-intnet", 7))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][7 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync intnet[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--natnet", 8)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-natnet", 7))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][7 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!strcmp(a->argv[i + 1], "default"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync natnet[n - 1] = "";
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync RTIPV4ADDR Network;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync RTIPV4ADDR Netmask;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int rc = RTCidrStrToIPv4(a->argv[i + 1], &Network, &Netmask);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (RT_FAILURE(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Invalid IPv4 network '%s' specified -- CIDR notation expected.\n", a->argv[i + 1]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (Netmask & 0x1f)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Prefix length of the NAT network must be less than 28.\n");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync natnet[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--macaddress", 12)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-macaddress", 11))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][11 + (a->argv[i][1] == '-')], NetworkAdapterCount, "NIC");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync macs[n - 1] = a->argv[i + 1];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef VBOX_WITH_VRDP
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vrdp")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vrdp"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrdp = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vrdpport")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vrdpport"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "default"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrdpport = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrdpport = RTStrToUInt16(a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vrdpaddress")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vrdpaddress"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrdpaddress = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vrdpauthtype")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vrdpauthtype"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrdpauthtype = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vrdpmulticon")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vrdpmulticon"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrdpmulticon = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--vrdpreusecon")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-vrdpreusecon"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrdpreusecon = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* VBOX_WITH_VRDP */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--usb")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-usb"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync fUsbEnabled = 1;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync fUsbEnabled = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --usb argument '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--usbehci")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-usbehci"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync fUsbEhciEnabled = 1;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync fUsbEhciEnabled = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --usbehci argument '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--snapshotfolder")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-snapshotfolder"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync snapshotFolder = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--uartmode", 10)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-uartmode", 9))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], SerialPortCount, "UART");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "disconnected"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uarts_mode[n - 1] = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "server") || !strcmp(a->argv[i], "client"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uarts_mode[n - 1] = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef RT_OS_WINDOWS
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strncmp(a->argv[i], "\\\\.\\pipe\\", 9))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Uart pipe must start with \\\\.\\pipe\\");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
bd70c21e101567a7ea16e8c09a93ba1ce2060a40vboxsync else if (!strcmp(a->argv[i], "file"))
bd70c21e101567a7ea16e8c09a93ba1ce2060a40vboxsync {
bd70c21e101567a7ea16e8c09a93ba1ce2060a40vboxsync uarts_mode[n - 1] = a->argv[i];
bd70c21e101567a7ea16e8c09a93ba1ce2060a40vboxsync i++;
bd70c21e101567a7ea16e8c09a93ba1ce2060a40vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uarts_mode[n - 1] = (char*)"device";
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Missing argument to --uartmode");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uarts_path[n - 1] = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--uart", 6)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-uart", 5))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][5 + (a->argv[i][1] == '-')], SerialPortCount, "UART");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uarts_base[n - 1] = (ULONG)-1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i-1]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t uVal;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int vrc;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrc = RTStrToUInt32Ex(a->argv[i], NULL, 0, &uVal);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrc != VINF_SUCCESS || uVal == 0)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing UART I/O base '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uarts_base[n - 1] = uVal;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrc = RTStrToUInt32Ex(a->argv[i], NULL, 0, &uVal);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrc != VINF_SUCCESS)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing UART IRQ '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uarts_irq[n - 1] = uVal;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef VBOX_WITH_MEM_BALLOONING
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--guestmemoryballoon")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-guestmemoryballoon"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t uVal;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int vrc;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrc = RTStrToUInt32Ex(a->argv[i], NULL, 0, &uVal);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrc != VINF_SUCCESS)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing guest memory balloon size '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync guestMemBalloonSize = uVal;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--gueststatisticsinterval")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-gueststatisticsinterval"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t uVal;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync int vrc;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync vrc = RTStrToUInt32Ex(a->argv[i], NULL, 0, &uVal);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrc != VINF_SUCCESS)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Error parsing guest statistics interval '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync guestStatInterval = uVal;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--sata")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-sata"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync fSataEnabled = 1;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync fSataEnabled = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --usb argument '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--sataportcount")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-sataportcount"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unsigned n;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing arguments to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync n = parseNum(a->argv[i], 30, "SATA");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync sataPortCount = n;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--sataport", 10)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-sataport", 9))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], 30, "SATA");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hdds[n-1+4] = a->argv[i];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--sataideemulation", 18)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-sataideemulation", 17))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unsigned bootDevicePos = 0;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync unsigned n;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync bootDevicePos = parseNum(&a->argv[i][17 + (a->argv[i][1] == '-')], 4, "SATA");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!bootDevicePos)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync bootDevicePos--;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (a->argc <= i + 1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorArgument("Missing arguments to '%s'", a->argv[i]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync i++;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync n = parseNum(a->argv[i], 30, "SATA");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!n)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync sataBootDevices[bootDevicePos] = n-1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--scsi")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-scsi"))
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (a->argc <= i + 1)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(a->argv[i], "on") || !strcmp(a->argv[i], "enable"))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync fScsiEnabled = 1;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(a->argv[i], "off") || !strcmp(a->argv[i], "disable"))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync fScsiEnabled = 0;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync else
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --scsi argument '%s'", a->argv[i]);
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strncmp(a->argv[i], "--scsiport", 10)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strncmp(a->argv[i], "-scsiport", 9))
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync unsigned n = parseNum(&a->argv[i][9 + (a->argv[i][1] == '-')], 16, "SCSI");
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (!n)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync return 1;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (a->argc <= i + 1)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync i++;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync hdds[n-1+34] = a->argv[i];
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(a->argv[i], "--scsitype")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(a->argv[i], "-scsitype"))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync {
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync if (a->argc <= i + 1)
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync return errorArgument("Missing argument to '%s'", a->argv[i]);
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync i++;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!RTStrICmp(a->argv[i], "LsiLogic"))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync fScsiLsiLogic = 1;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!RTStrICmp(a->argv[i], "BusLogic"))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync fScsiLsiLogic = 0;
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync else
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync return errorArgument("Invalid --scsitype argument '%s'", a->argv[i]);
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Invalid parameter '%s'", Utf8Str(a->argv[i]).raw());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* try to find the given machine */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr <IMachine> machine;
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid (a->argv[0]);
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync if (!Guid(uuid).isEmpty())
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR (a->virtualBox, GetMachine (uuid, machine.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR (a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (SUCCEEDED (rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(Id)(uuid.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED (rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open a session for the VM */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (a->virtualBox, OpenSession(a->session, uuid), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync do
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* get the mutable session machine */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync a->session->COMGETTER(Machine)(machine.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr <IBIOSSettings> biosSettings;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (name)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(Name)(name));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (ostype)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IGuestOSType> guestOSType;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(ostype, guestOSType.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (SUCCEEDED(rc) && guestOSType)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(OSTypeId)(ostype));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ostype).raw());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (memorySize > 0)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(MemorySize)(memorySize));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vramSize > 0)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(VRAMSize)(vramSize));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (acpi)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(acpi, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(acpi, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --acpi argument '%s'", acpi);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (ioapic)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(ioapic, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(ioapic, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --ioapic argument '%s'", ioapic);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hwvirtex)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(hwvirtex, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
4cf22805d13f50eef86e917f2c7106fe5198a2d8vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(TRUE));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(hwvirtex, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
4cf22805d13f50eef86e917f2c7106fe5198a2d8vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(FALSE));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --hwvirtex argument '%s'", hwvirtex);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (nestedpaging)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(nestedpaging, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExNestedPagingEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nestedpaging, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExNestedPagingEnabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --nestedpaging argument '%s'", ioapic);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vtxvpid)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(vtxvpid, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExVPIDEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(vtxvpid, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(HWVirtExVPIDEnabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vtxvpid argument '%s'", ioapic);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (pae)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(pae, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(PAEEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(pae, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(PAEEnabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --pae argument '%s'", ioapic);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync if (numCpus != UINT32_MAX)
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync {
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync CHECK_ERROR(machine, COMSETTER(CPUCount)(numCpus));
9dfcf62b7a5a289684d46ee55f6042d49509daecvboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (monitorcount != ~0U)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(MonitorCount)(monitorcount));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (accelerate3d)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(accelerate3d, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(accelerate3d, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync errorArgument("Invalid --accelerate3d argument '%s'", accelerate3d);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync#ifdef VBOX_WITH_VIDEOHWACCEL
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync if (accelerate2dvideo)
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync if (!strcmp(accelerate2dvideo, "on"))
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(true));
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync else if (!strcmp(accelerate2dvideo, "off"))
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(false));
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync else
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync {
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync errorArgument("Invalid --accelerate2dvideo argument '%s'", accelerate2dvideo);
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync rc = E_FAIL;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync break;
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync }
49e54e2ffe0c10864d06e9d1ebe24a8eb1327a6bvboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (bioslogofadein)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(bioslogofadein, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(bioslogofadein, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --bioslogofadein argument '%s'", bioslogofadein);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (bioslogofadeout)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(bioslogofadeout, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(bioslogofadeout, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --bioslogofadeout argument '%s'", bioslogofadeout);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (bioslogodisplaytime != ~0U)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(bioslogodisplaytime));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (bioslogoimagepath)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(bioslogoimagepath)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (biosbootmenumode)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(biosbootmenumode, "disabled"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(biosbootmenumode, "menuonly"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(biosbootmenumode, "messageandmenu"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --biosbootmenu argument '%s'", biosbootmenumode);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (biossystemtimeoffset)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync LONG64 timeOffset = RTStrToInt64(biossystemtimeoffset);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(timeOffset));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (biospxedebug)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(biospxedebug, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(biospxedebug, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --biospxedebug argument '%s'", biospxedebug);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for (int curBootDev = 0; curBootDev < 4; curBootDev++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (bootDeviceChanged[curBootDev])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, SetBootOrder (curBootDev + 1, bootDevice[curBootDev]));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hdds[0])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(hdds[0], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync machine->DetachHardDisk(Bstr("IDE"), 0, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid(hdds[0]);
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync ComPtr<IHardDisk> hardDisk;
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[0]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[0]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("IDE"), 0, 0));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hdds[1])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(hdds[1], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync machine->DetachHardDisk(Bstr("IDE"), 0, 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid(hdds[1]);
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync ComPtr<IHardDisk> hardDisk;
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[1]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[1]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("IDE"), 0, 1));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hdds[2])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(hdds[2], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync machine->DetachHardDisk(Bstr("IDE"), 1, 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid(hdds[2]);
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync ComPtr<IHardDisk> hardDisk;
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[2]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[2]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("IDE"), 1, 1));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (dvd)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IDVDDrive> dvdDrive;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(DVDDrive)(dvdDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(dvdDrive);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* unmount? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(dvd, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(dvdDrive, Unmount());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* host drive? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strncmp(dvd, "host:", 5))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IHost> host;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
70bb61ea2f96e80150e807529ce5df435607706bvboxsync com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
70bb61ea2f96e80150e807529ce5df435607706bvboxsync rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
70bb61ea2f96e80150e807529ce5df435607706bvboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IHostDVDDrive> hostDVDDrive;
70bb61ea2f96e80150e807529ce5df435607706bvboxsync rc = host->FindHostDVDDrive(Bstr(dvd + 5), hostDVDDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!hostDVDDrive)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* 2nd try: try with the real name, important on Linux+libhal */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync char szPathReal[RTPATH_MAX];
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (RT_FAILURE(RTPathReal(dvd + 5, szPathReal, sizeof(szPathReal))))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid host DVD drive name");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
70bb61ea2f96e80150e807529ce5df435607706bvboxsync rc = host->FindHostDVDDrive(Bstr(szPathReal), hostDVDDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!hostDVDDrive)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid host DVD drive name");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(dvdDrive, CaptureHostDrive(hostDVDDrive));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first assume it's a UUID */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid(dvd);
1a9aff24299a7252e97aacbc1f9bd42663380155vboxsync ComPtr<IDVDImage> dvdImage;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = a->virtualBox->GetDVDImage(uuid, dvdImage.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc) || !dvdImage)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
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 if (!dvdImage)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr emptyUUID;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, OpenDVDImage(Bstr(dvd), emptyUUID, dvdImage.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!dvdImage)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync dvdImage->COMGETTER(Id)(uuid.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(dvdDrive, MountImage(uuid));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (dvdpassthrough)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IDVDDrive> dvdDrive;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(DVDDrive)(dvdDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(dvdDrive);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync CHECK_ERROR(dvdDrive, COMSETTER(Passthrough)(!strcmp(dvdpassthrough, "on")));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (idecontroller)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync ComPtr<IStorageController> storageController;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE"), storageController.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync
f1fceafb5751ab47afcb9d9c8e6e97be24c66fedvboxsync if (!RTStrICmp(idecontroller, "PIIX3"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
f1fceafb5751ab47afcb9d9c8e6e97be24c66fedvboxsync else if (!RTStrICmp(idecontroller, "PIIX4"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
f1fceafb5751ab47afcb9d9c8e6e97be24c66fedvboxsync else if (!RTStrICmp(idecontroller, "ICH6"))
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --idecontroller argument '%s'", idecontroller);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (floppy)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IFloppyDrive> floppyDrive;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(FloppyDrive)(floppyDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(floppyDrive);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(floppy, "disabled"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable the controller */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, COMSETTER(Enabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* enable the controller */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* unmount? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(floppy, "empty"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, Unmount());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* host drive? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strncmp(floppy, "host:", 5))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IHost> host;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
16489a966f88b447f36b4382ce5fff1f5cf39ff8vboxsync com::SafeIfaceArray <IHostFloppyDrive> hostFloppies;
16489a966f88b447f36b4382ce5fff1f5cf39ff8vboxsync CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(hostFloppies)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IHostFloppyDrive> hostFloppyDrive;
16489a966f88b447f36b4382ce5fff1f5cf39ff8vboxsync rc = host->FindHostFloppyDrive(Bstr(floppy + 5), hostFloppyDrive.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!hostFloppyDrive)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid host floppy drive name");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, CaptureHostDrive(hostFloppyDrive));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first assume it's a UUID */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid(floppy);
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync ComPtr<IFloppyImage> floppyImage;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = a->virtualBox->GetFloppyImage(uuid, floppyImage.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc) || !floppyImage)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
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 if (!floppyImage)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr emptyUUID;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(a->virtualBox, OpenFloppyImage(Bstr(floppy), emptyUUID, floppyImage.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!floppyImage)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync floppyImage->COMGETTER(Id)(uuid.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(floppyDrive, MountImage(uuid));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (audio || audiocontroller)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IAudioAdapter> audioAdapter;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(audioAdapter);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (audio)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(audio, "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "null"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef RT_OS_WINDOWS
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef VBOX_WITH_WINMM
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "winmm"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "dsound"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* RT_OS_WINDOWS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef RT_OS_LINUX
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "oss"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# ifdef VBOX_WITH_ALSA
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "alsa"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# ifdef VBOX_WITH_PULSE
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "pulse"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync# endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !RT_OS_LINUX */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef RT_OS_SOLARIS
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "solaudio"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync# ifdef VBOX_WITH_SOLARIS_OSS
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync else if (!strcmp(audio, "oss"))
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync {
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync }
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync# endif
5704a317c3b6bdf4b59f6a6ebe45d443296b1995vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !RT_OS_SOLARIS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef RT_OS_DARWIN
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audio, "coreaudio"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !RT_OS_DARWIN */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --audio argument '%s'", audio);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (audiocontroller)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(audiocontroller, "sb16"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(audiocontroller, "ac97"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --audiocontroller argument '%s'", audiocontroller);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* Shared clipboard state */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (clipboard)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/* ComPtr<IClipboardMode> clipboardMode;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(ClipboardMode)(clipboardMode.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(clipboardMode);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync*/
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(clipboard, "disabled"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(clipboard, "hosttoguest"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(clipboard, "guesttohost"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(clipboard, "bidirectional"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --clipboard argument '%s'", clipboard);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* iterate through all possible NICs */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for (ULONG n = 0; n < NetworkAdapterCount; n ++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<INetworkAdapter> nic;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (machine, GetNetworkAdapter (n, nic.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(nic);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the NIC? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (nics[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(nics[n], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (FALSE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nics[n], "null"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, Detach(), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nics[n], "nat"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, AttachToNAT(), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if ( !strcmp(nics[n], "bridged")
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync || !strcmp(nics[n], "hostif")) /* backward compatibility */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
6f6fbd24a8e2a201dd9474eebd7542b338cd511avboxsync CHECK_ERROR_RET(nic, AttachToBridgedInterface(), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nics[n], "intnet"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, AttachToInternalNetwork(), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync#if defined(VBOX_WITH_NETFLT)
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nics[n], "hostonly"))
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync {
04c6e2bf4c47aa33be5ee50ac468b1b86b7125b4vboxsync
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
6f6fbd24a8e2a201dd9474eebd7542b338cd511avboxsync CHECK_ERROR_RET(nic, AttachToHostOnlyInterface(), 1);
14650dbf3041b8fcb092b55cf673bd6f392390c2vboxsync }
7bf07b1592dfaab1a4fb6d497fd0ff1302fb7585vboxsync#endif
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid type '%s' specfied for NIC %lu", nics[n], n + 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the NIC type? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (nictype[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(nictype[n], "Am79C970A"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nictype[n], "Am79C973"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef VBOX_WITH_E1000
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nictype[n], "82540EM"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nictype[n], "82543GC"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nictype[n], "82545EM"))
eecd0c10bb4e8ce1734d8b25a90e6ea61b9f862bvboxsync {
eecd0c10bb4e8ce1734d8b25a90e6ea61b9f862bvboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM), 1);
eecd0c10bb4e8ce1734d8b25a90e6ea61b9f862bvboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync#ifdef VBOX_WITH_VIRTIO
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync else if (!strcmp(nictype[n], "virtio"))
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync {
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync CHECK_ERROR_RET(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio), 1);
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync }
9bb98d54790a98dad0ad6d9bdc5d319b6fdf0bffvboxsync#endif /* VBOX_WITH_VIRTIO */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync errorArgument("Invalid NIC type '%s' specified for NIC %lu", nictype[n], n + 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the MAC address? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (macs[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* generate one? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(macs[n], "auto"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(MACAddress)(NULL), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(MACAddress)(Bstr(macs[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* something about the reported link speed? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (nicspeed[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync uint32_t u32LineSpeed;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync u32LineSpeed = RTStrToUInt32(nicspeed[n]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (u32LineSpeed < 1000 || u32LineSpeed > 4000000)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --nicspeed%lu argument '%s'", n + 1, nicspeed[n]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(LineSpeed)(u32LineSpeed), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the link status flag? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (cableconnected[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(cableconnected[n], "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(CableConnected)(TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(cableconnected[n], "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(CableConnected)(FALSE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --cableconnected%lu argument '%s'", n + 1, cableconnected[n]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the trace flag? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (nictrace[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(nictrace[n], "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(TraceEnabled)(TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(nictrace[n], "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(TraceEnabled)(FALSE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --nictrace%lu argument '%s'", n + 1, nictrace[n]);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the tracefile flag? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (nictracefile[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(TraceFile)(Bstr(nictracefile[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the host interface device? */
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync if (hostifdev[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* remove it? */
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync if (!strcmp(hostifdev[n], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync CHECK_ERROR_RET(nic, COMSETTER(HostInterface)(NULL), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
4dc6f02271e124b7765cb35facd736a0a140c367vboxsync CHECK_ERROR_RET(nic, COMSETTER(HostInterface)(Bstr(hostifdev[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the internal network name? */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (intnet[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* remove it? */
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(intnet[n], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(InternalNetwork)(NULL), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(InternalNetwork)(Bstr(intnet[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* the network of the NAT */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (natnet[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(nic, COMSETTER(NATNetwork)(Bstr(natnet[n])), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* iterate through all possible serial ports */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for (ULONG n = 0; n < SerialPortCount; n ++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<ISerialPort> uart;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET (machine, GetSerialPort (n, uart.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(uart);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (uarts_base[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (uarts_base[n] == (ULONG)-1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Enabled) (FALSE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
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 }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (uarts_mode[n])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(uarts_mode[n], "disconnected"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_Disconnected), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Path) (Bstr(uarts_path[n])), 1);
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(uarts_mode[n], "server"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipe), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Server) (TRUE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(uarts_mode[n], "client"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipe), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(Server) (FALSE), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
801238b286a80a5dd67ba56a1f26c0bc98a2a1eavboxsync else if (!strcmp(uarts_mode[n], "file"))
801238b286a80a5dd67ba56a1f26c0bc98a2a1eavboxsync {
801238b286a80a5dd67ba56a1f26c0bc98a2a1eavboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_RawFile), 1);
801238b286a80a5dd67ba56a1f26c0bc98a2a1eavboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostDevice), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#ifdef VBOX_WITH_VRDP
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdp || (vrdpport != UINT16_MAX) || vrdpaddress || vrdpauthtype || vrdpmulticon || vrdpreusecon)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IVRDPServer> vrdpServer;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ASSERT(vrdpServer);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdpServer)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdp)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(vrdp, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Enabled)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(vrdp, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Enabled)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdp argument '%s'", vrdp);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdpport != UINT16_MAX)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Port)(vrdpport));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdpaddress)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(vrdpaddress)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdpauthtype)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(vrdpauthtype, "null"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(vrdpauthtype, "external"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(vrdpauthtype, "guest"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdpauthtype argument '%s'", vrdpauthtype);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdpmulticon)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(vrdpmulticon, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(vrdpmulticon, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdpmulticon argument '%s'", vrdpmulticon);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (vrdpreusecon)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(vrdpreusecon, "on"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(true));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync else if (!strcmp(vrdpreusecon, "off"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(false));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync errorArgument("Invalid --vrdpreusecon argument '%s'", vrdpreusecon);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* VBOX_WITH_VRDP */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /*
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * USB enable/disable
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (fUsbEnabled != -1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IUSBController> UsbCtl;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (SUCCEEDED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(!!fUsbEnabled));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /*
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * USB EHCI enable/disable
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (fUsbEhciEnabled != -1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync ComPtr<IUSBController> UsbCtl;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (SUCCEEDED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(!!fUsbEhciEnabled));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (snapshotFolder)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(snapshotFolder, "default"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(snapshotFolder)));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (guestMemBalloonSize != (ULONG)-1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(guestMemBalloonSize));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (guestStatInterval != (ULONG)-1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, COMSETTER(StatisticsUpdateInterval)(guestStatInterval));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /*
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * SATA controller enable/disable
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (fSataEnabled != -1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (fSataEnabled)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync ComPtr<IStorageController> ctl;
89e846f396d9fede6d24f6ba65fc722cc6ab5f4cvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("SATA"), StorageBus_SATA, ctl.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync else
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA")));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for (uint32_t i = 4; i < 34; i++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hdds[i])
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(hdds[i], "none"))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync machine->DetachHardDisk(Bstr("SATA"), i-4, 0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first guess is that it's a UUID */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid(hdds[i]);
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync ComPtr<IHardDisk> hardDisk;
c7ede00506e75acd368eeba9f264f2e09297fd21vboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not successful? Then it must be a filename */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (!hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[i]), hardDisk.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (hardDisk)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("SATA"), i-4, 0));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync else
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync rc = E_FAIL;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (FAILED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync break;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync for (uint32_t i = 0; i < 4; i++)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (sataBootDevices[i] != -1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync ComPtr<IStorageController> SataCtl;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (SUCCEEDED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(SataCtl, SetIDEEmulationPort(i, sataBootDevices[i]));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (sataPortCount != -1)
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync ComPtr<IStorageController> SataCtl;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync if (SUCCEEDED(rc))
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync {
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(SataCtl, COMSETTER(PortCount)(sataPortCount));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync /*
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync * SCSI controller enable/disable
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync */
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync if (fScsiEnabled != -1)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync if (fScsiEnabled)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync ComPtr<IStorageController> ctl;
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!fScsiLsiLogic)
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync {
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic"), StorageBus_SCSI, ctl.asOutParam()));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync }
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync else /* LsiLogic is default */
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync {
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("LsiLogic"), StorageBus_SCSI, ctl.asOutParam()));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync else
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync {
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync rc = machine->RemoveStorageController(Bstr("LsiLogic"));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync if (!SUCCEEDED(rc))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic")));
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync for (uint32_t i = 34; i < 50; i++)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (hdds[i])
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync if (!strcmp(hdds[i], "none"))
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync rc = machine->DetachHardDisk(Bstr("LsiLogic"), i-34, 0);
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync if (!SUCCEEDED(rc))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, DetachHardDisk(Bstr("BusLogic"), i-34, 0));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync else
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync /* first guess is that it's a UUID */
57b49c1557a310ee615bc0ee79dd2a2e92319a1bvboxsync Bstr uuid(hdds[i]);
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync ComPtr<IHardDisk> hardDisk;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync /* not successful? Then it must be a filename */
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (!hardDisk)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
a837292ce5d8a9aef8dca14539c5eba8597ad58bvboxsync rc = a->virtualBox->FindHardDisk(Bstr(hdds[i]), hardDisk.asOutParam());
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (FAILED(rc))
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync /* open the new hard disk object */
059d5f3885b71a585838612f08cfea528ae1c699vboxsync CHECK_ERROR(a->virtualBox, OpenHardDisk(Bstr(hdds[i]), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), hardDisk.asOutParam()));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (hardDisk)
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync {
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync hardDisk->COMGETTER(Id)(uuid.asOutParam());
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync rc = machine->AttachHardDisk(uuid, Bstr("LsiLogic"), i-34, 0);
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync if (!SUCCEEDED(rc))
a59528c40bbfdcee2e315756333f8c66f35b5accvboxsync CHECK_ERROR(machine, AttachHardDisk(uuid, Bstr("BusLogic"), i-34, 0));
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync else
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync rc = E_FAIL;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync if (FAILED(rc))
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync break;
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync }
e214bb78026c1d64078b34ca9504d3f5abbc52efvboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* commit changes */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync CHECK_ERROR(machine, SaveSettings());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync }
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync while (0);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* it's important to always close sessions */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync a->session->Close();
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return SUCCEEDED(rc) ? 0 : 1;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync}
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */