VBoxManageModifyVM.cpp revision 9055ac3d8c552334b0ef35f0f10783e6d49b41d4
adf2bcd2e5d07d5a11553b88e147c1f4b2249bffvboxsync * VBoxManage - Implementation of modifyvm command.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Copyright (C) 2006-2009 Sun Microsystems, Inc.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * available from http://www.virtualbox.org. This file is free software;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * you can redistribute it and/or modify it under the terms of the GNU
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * General Public License (GPL) as published by the Free Software
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * additional information or have any questions.
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/*******************************************************************************
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync* Header Files *
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync*******************************************************************************/
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsyncusing namespace com;
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync/** @todo refine this after HDD changes; MSC 8.0/64 has trouble with handleModifyVM. */
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--ostype", MODIFYVM_OSTYPE, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--memory", MODIFYVM_MEMORY, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--firmware", MODIFYVM_FIRMWARE, RTGETOPT_REQ_STRING },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--acpi", MODIFYVM_ACPI, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--ioapic", MODIFYVM_IOAPIC, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--pae", MODIFYVM_PAE, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--synthcpu", MODIFYVM_SYNTHCPU, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--hwvirtex", MODIFYVM_HWVIRTEX, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--hwvirtexexcl", MODIFYVM_HWVIRTEXEXCLUSIVE, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--nestedpaging", MODIFYVM_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vtxvpid", MODIFYVM_VTXVPID, RTGETOPT_REQ_BOOL_ONOFF },
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync { "--cpuidset", MODIFYVM_SETCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync { "--cpuidremove", MODIFYVM_DELCPUID, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync { "--cpuidremoveall", MODIFYVM_DELALLCPUID, RTGETOPT_REQ_NOTHING},
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--monitorcount", MODIFYVM_MONITORCOUNT, RTGETOPT_REQ_UINT32 },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--accelerate3d", MODIFYVM_ACCELERATE3D, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--accelerate2dvideo", MODIFYVM_ACCELERATE2DVIDEO, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--bioslogofadein", MODIFYVM_BIOSLOGOFADEIN, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--bioslogofadeout", MODIFYVM_BIOSLOGOFADEOUT, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--bioslogodisplaytime", MODIFYVM_BIOSLOGODISPLAYTIME, RTGETOPT_REQ_UINT64 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--bioslogoimagepath", MODIFYVM_BIOSLOGOIMAGEPATH, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--biosbootmenu", MODIFYVM_BIOSBOOTMENU, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--biossystemtimeoffset", MODIFYVM_BIOSSYSTEMTIMEOFFSET, RTGETOPT_REQ_UINT64 },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--biospxedebug", MODIFYVM_BIOSPXEDEBUG, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--boot", MODIFYVM_BOOT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--idecontroller", MODIFYVM_IDECONTROLLER, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--sataideemulation", MODIFYVM_SATAIDEEMULATION, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--sataportcount", MODIFYVM_SATAPORTCOUNT, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--sataport", MODIFYVM_SATAPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--scsiport", MODIFYVM_SCSIPORT, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--scsitype", MODIFYVM_SCSITYPE, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--dvdpassthrough", MODIFYVM_DVDPASSTHROUGH, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--floppy", MODIFYVM_FLOPPY, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nictracefile", MODIFYVM_NICTRACEFILE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--nictrace", MODIFYVM_NICTRACE, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nictype", MODIFYVM_NICTYPE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nicspeed", MODIFYVM_NICSPEED, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--nic", MODIFYVM_NIC, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--cableconnected", MODIFYVM_CABLECONNECTED, RTGETOPT_REQ_BOOL_ONOFF | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--bridgeadapter", MODIFYVM_BRIDGEADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--hostonlyadapter", MODIFYVM_HOSTONLYADAPTER, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--intnet", MODIFYVM_INTNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--natnet", MODIFYVM_NATNET, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--macaddress", MODIFYVM_MACADDRESS, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--uartmode", MODIFYVM_UARTMODE, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--uart", MODIFYVM_UART, RTGETOPT_REQ_STRING | RTGETOPT_FLAG_INDEX },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--gueststatisticsinterval", MODIFYVM_GUESTSTATISTICSINTERVAL, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--guestmemoryballoon", MODIFYVM_GUESTMEMORYBALLOON, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--audiocontroller", MODIFYVM_AUDIOCONTROLLER, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--audio", MODIFYVM_AUDIO, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--clipboard", MODIFYVM_CLIPBOARD, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--vrdpport", MODIFYVM_VRDPPORT, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--vrdpaddress", MODIFYVM_VRDPADDRESS, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--vrdpauthtype", MODIFYVM_VRDPAUTHTYPE, RTGETOPT_REQ_STRING },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vrdpmulticon", MODIFYVM_VRDPMULTICON, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vrdpreusecon", MODIFYVM_VRDPREUSECON, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--vrdp", MODIFYVM_VRDP, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--usbehci", MODIFYVM_USBEHCI, RTGETOPT_REQ_BOOL_ONOFF },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--usb", MODIFYVM_USB, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--snapshotfolder", MODIFYVM_SNAPSHOTFOLDER, RTGETOPT_REQ_STRING },
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync { "--teleporterenabled", MODIFYVM_TELEPORTER_ENABLED, RTGETOPT_REQ_BOOL_ONOFF },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--teleporterport", MODIFYVM_TELEPORTER_PORT, RTGETOPT_REQ_UINT32 },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--teleporteraddress", MODIFYVM_TELEPORTER_ADDRESS, RTGETOPT_REQ_STRING },
9e4ea89b1085fdaa5861e45a729d9c978db1a8f1vboxsync { "--teleporterpassword", MODIFYVM_TELEPORTER_PASSWORD, RTGETOPT_REQ_STRING },
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync { "--hardwareuuid", MODIFYVM_HARDWARE_UUID, RTGETOPT_REQ_STRING },
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* VM ID + at least one parameter. Parameter arguments are checked
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync * individually. */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* Get the number of network adapters */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount), 1);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(info, COMGETTER(SerialPortCount)(&SerialPortCount), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* try to find the given machine */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, GetMachine(machineuuid, machine.asOutParam()), 1);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]), machine.asOutParam()), 1);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* open a session for the VM */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_RET(a->virtualBox, OpenSession(a->session, machineuuid), 1);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* get the mutable session machine */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync a->session->COMGETTER(Machine)(machine.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync RT_ELEMENTS(g_aModifyVMOptions), 1, 0 /* fFlags */);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz)));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz), guestOSType.asOutParam()));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz)));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid guest OS type '%s'", Utf8Str(ValueUnion.psz).raw());
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
3a0bc95d0adf57baefd303e94b8f1b7b31a8f080vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
21ddd8aa21b8d7ad25b18ab341ede34c1cb4a125vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --firmware argument '%s'", ValueUnion.psz);
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(ACPIEnabled)(ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(IOAPICEnabled)(ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetCpuProperty(CpuPropertyType_PAE, ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetCpuProperty(CpuPropertyType_Synthetic, ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
121568d0a1e932e6f6acd49376827a0e593815favboxsync for (unsigned i = 0 ; i < 4 ; i++)
121568d0a1e932e6f6acd49376827a0e593815favboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
121568d0a1e932e6f6acd49376827a0e593815favboxsync "Missing or Invalid argument to '%s'",
121568d0a1e932e6f6acd49376827a0e593815favboxsync CHECK_ERROR(machine, SetCpuIdLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
db0ecde8f28fdb4525bc6d94056166c70b02ebb8vboxsync CHECK_ERROR(machine, RemoveCpuIdLeaf(ValueUnion.u32));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeIn)(ValueUnion.f));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoFadeOut)(ValueUnion.f));
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoDisplayTime)(ValueUnion.u64));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(LogoImagePath)(Bstr(ValueUnion.psz)));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_Disabled));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MenuOnly));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync else if (!strcmp(ValueUnion.psz, "messageandmenu"))
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(biosSettings, COMSETTER(BootMenuMode)(BIOSBootMenuMode_MessageAndMenu));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --biosbootmenu argument '%s'", ValueUnion.psz);
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(biosSettings, COMSETTER(TimeOffset)(ValueUnion.u64));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(biosSettings, COMSETTER(PXEDebugEnabled)(ValueUnion.f));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid boot slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->DetachDevice(Bstr("IDE Controller"), 0, 0);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 0, DeviceType_HardDisk, uuid));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->DetachDevice(Bstr("IDE Controller"), 0, 1);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 0, 1, DeviceType_HardDisk, uuid));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->DetachDevice(Bstr("IDE Controller"), 1, 1);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AttachDevice(Bstr("IDE Controller"), 1, 1, DeviceType_HardDisk, uuid));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller"),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX3));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_PIIX4));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(storageController, COMSETTER(ControllerType)(StorageControllerType_ICH6));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid --idecontroller argument '%s'", ValueUnion.psz);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 4))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SATA boot slot number in '%s'",
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SATA port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(SataCtl, SetIDEEmulationPort(GetOptState.uIndex, ValueUnion.u32));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA"), SataCtl.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(SataCtl, COMSETTER(PortCount)(ValueUnion.u32));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 30))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SATA port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync machine->DetachDevice(Bstr("SATA"), GetOptState.uIndex, 0);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync OpenHardDisk(Bstr(ValueUnion.psz), AccessMode_ReadWrite,
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("SATA"), StorageBus_SATA, ctl.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA")));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > 16))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid SCSI port number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = machine->DetachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0);
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic"), GetOptState.uIndex, 0));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first guess is that it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetHardDisk(uuid, hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not successful? Then it must be a filename */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindHardDisk(Bstr(ValueUnion.psz), hardDisk.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* open the new hard disk object */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = machine->AttachDevice(Bstr("LsiLogic"), GetOptState.uIndex, 0, DeviceType_HardDisk, uuid);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = machine->RemoveStorageController(Bstr("BusLogic"));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogic));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = machine->RemoveStorageController(Bstr("LsiLogic"));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic")));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Invalid --scsitype argument '%s'", ValueUnion.psz);
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "on") || !strcmp(ValueUnion.psz, "enable"))
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic"), StorageBus_SCSI, ctl.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_BusLogic));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync else if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = machine->RemoveStorageController(Bstr("BusLogic"));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic")));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller"), 1, 0, !strcmp(ValueUnion.psz, "on")));
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* unmount? */
fc148a6b23d25a87561beaffe0ba06c3ba93bf5avboxsync /* nothing to do, NULL object will cause unmount */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* host drive? */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = host->FindHostDVDDrive(Bstr(ValueUnion.psz + 5), dvdMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* 2nd try: try with the real name, important on Linux+libhal */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (RT_FAILURE(RTPathReal(ValueUnion.psz + 5, szPathReal, sizeof(szPathReal))))
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = host->FindHostDVDDrive(Bstr(szPathReal), dvdMedium.asOutParam());
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid host DVD drive name \"%s\"", ValueUnion.psz + 5);
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* first assume it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetDVDImage(uuid, dvdMedium.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* must be a filename, check if it's in the collection */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindDVDImage(Bstr(ValueUnion.psz), dvdMedium.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* not registered, do that on the fly */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(a->virtualBox, OpenDVDImage(Bstr(ValueUnion.psz),
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /** @todo generalize this, allow arbitrary number of DVD drives
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync * and as a consequence multiple attachments and different
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync * storage controllers. */
96788c1af55ead9aaa2d17035c3777f2ea73023cvboxsync CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller"), 1, 0, uuid, FALSE /* aForce */));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync machine->GetMediumAttachment(Bstr("Floppy Controller"), 0, 0, floppyAttachment.asOutParam());
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* disable? */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* disable the controller */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller"), 0, 0));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* enable the controller */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(machine, AttachDevice(Bstr("Floppy Controller"), 0, 0, DeviceType_Floppy, NULL));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* unmount? */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* nothing to do, NULL object will cause unmount */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* host drive? */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = host->FindHostFloppyDrive(Bstr(ValueUnion.psz + 5), floppyMedium.asOutParam());
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid host floppy drive name \"%s\"", ValueUnion.psz + 5);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* first assume it's a UUID */
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync rc = a->virtualBox->GetFloppyImage(uuid, floppyMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* must be a filename, check if it's in the collection */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync rc = a->virtualBox->FindFloppyImage(Bstr(ValueUnion.psz), floppyMedium.asOutParam());
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* not registered, do that on the fly */
96788c1af55ead9aaa2d17035c3777f2ea73023cvboxsync CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller"), 0, 0, uuid, FALSE /* aForce */));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz)));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C970A));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Am79C973));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82540EM));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82543GC));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_I82545EM));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(AdapterType)(NetworkAdapterType_Virtio));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* VBOX_WITH_VIRTIO */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid NIC type '%s' specified for NIC %lu", ValueUnion.psz, GetOptState.uIndex);
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((ValueUnion.u32 < 1000) && (ValueUnion.u32 > 4000000))
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid --nicspeed%lu argument '%u'", GetOptState.uIndex, ValueUnion.u32);
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync || !strcmp(ValueUnion.psz, "hostif")) /* backward compatibility */
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync errorArgument("Invalid type '%s' specfied for NIC %lu", ValueUnion.psz, GetOptState.uIndex);
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(HostInterface)(Bstr(ValueUnion.psz)));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* remove it? */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(NULL));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(InternalNetwork)(Bstr(ValueUnion.psz)));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz)));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > NetworkAdapterCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid NIC slot number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* generate one? */
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(nic, COMSETTER(MACAddress)(Bstr(ValueUnion.psz)));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid Serial Port number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_Disconnected));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_STRING);
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid argument to '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(Path)(Bstr(ValueUnion.psz)));
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostDevice));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if ((GetOptState.uIndex < 1) && (GetOptState.uIndex > SerialPortCount))
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid Serial Port number in '%s'",
1dc37bff2fb26897f5892d8330fe2bc0c9859aecvboxsync CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync if (!strcmp(ValueUnion.psz, "off") || !strcmp(ValueUnion.psz, "disable"))
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32) != MODIFYVM_UART;
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync "Missing or Invalid argument to '%s'",
2823fbb1428e982169f04923472d7c94e7ed8385vboxsync return errorArgument("Error parsing UART I/O base '%s'", pszIOBase);
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(StatisticsUpdateInterval)(ValueUnion.u32));
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_SB16));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioController)(AudioControllerType_AC97));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --audiocontroller argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync /* disable? */
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* RT_OS_WINDOWS */
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* !RT_OS_LINUX */
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* !RT_OS_SOLARIS */
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* !RT_OS_DARWIN */
9055ac3d8c552334b0ef35f0f10783e6d49b41d4vboxsync# if defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(VBOX_WITH_SOLARIS_OSS)
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
ccf574508b96ea0f7dc62b4048f6156c1df160cdvboxsync CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --audio argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Disabled));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_HostToGuest));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_GuestToHost));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(ClipboardMode)(ClipboardMode_Bidirectional));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --clipboard argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr("0")));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Ports)(Bstr(ValueUnion.psz)));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(NetAddress)(Bstr(ValueUnion.psz)));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Null));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_External));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AuthType)(VRDPAuthType_Guest));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync errorArgument("Invalid --vrdpauthtype argument '%s'", ValueUnion.psz);
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(vrdpServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(vrdpServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(vrdpServer, COMSETTER(Enabled)(ValueUnion.f));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync#endif /* VBOX_WITH_VRDP */
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(UsbCtl, COMSETTER(EnabledEhci)(ValueUnion.f));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMGETTER(USBController)(UsbCtl.asOutParam()));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(UsbCtl, COMSETTER(Enabled)(ValueUnion.f));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(NULL));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz)));
261b44f7fa60a1d4bb4102142d3aa44188908484vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
6efcf94383d6e48c764c6518cf1b4069ad34e210vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz)));
d29ab0cfbeef254251f0a2458163034999abb8a0vboxsync CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz)));
ad9e5a61fea617d40d07390ff1737277d6aef869vboxsync CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz)));
147e101bcd061b5e085e4a2c0cc9fc35546ff1aavboxsync /* commit changes */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync /* it's important to always close sessions */
71c8a528203c289a8585ce10ac6bafc4274058c6vboxsync#endif /* !VBOX_ONLY_DOCS */