VBoxManageControlVM.cpp revision e64031e20c39650a7bc902a3e1aba613b9415dee
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * VBoxManage - VirtualBox's command-line interface.
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2006-2009 Oracle Corporation
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * available from http://www.virtualbox.org. This file is free software;
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * you can redistribute it and/or modify it under the terms of the GNU
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * General Public License (GPL) as published by the Free Software
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync/*******************************************************************************
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync* Header Files *
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync*******************************************************************************/
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * Parses a number.
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * @returns Valid number on success.
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * @returns 0 if invalid number. All necesary bitching has been done.
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * @param psz Pointer to the nic number.
4328e87247f4a96449677e199c7e99ef516fc1cevboxsyncstatic unsigned parseNum(const char *psz, unsigned cMaxNum, const char *name)
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync return (unsigned)u32;
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid %s number '%s'", name, psz);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync using namespace com;
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync return errorSyntax(USAGE_CONTROLVM, "Not enough parameters");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* try to find the given machine */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(a->virtualBox, GetMachine(machineuuid, machine.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(a->virtualBox, FindMachine(machineuuid, machine.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* open a session for the VM */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(a->virtualBox, OpenExistingSession(a->session, machineuuid), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the associated console */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* ... and session machine */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* which command? */
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync errorArgument("Missing argument to '%s'. Expected CPU number.", a->argv[1]);
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync CHECK_ERROR_BREAK(sessionMachine, HotUnplugCPU(n));
6e12ccc60ac657fb87e27b7a2b26e0a63bebe024vboxsync errorArgument("Missing argument to '%s'. Expected CPU number.", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, PowerDown(progress.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: failed to power off machine. Error message: %lS\n", info.getText().raw());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: failed to power off machine. No error message available!\n");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, SaveState(progress.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: failed to save machine state. Error message: %lS\n", info.getText().raw());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: failed to save machine state. No error message available!\n");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the machine debugger. */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, COMGETTER(Debugger)(debugger.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync else if (!strcmp(a->argv[1], "keyboardputscancode"))
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, COMGETTER(Keyboard)(keyboard.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'. Expected IBM PC AT set 2 keyboard scancode(s) as hex byte(s).", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* Arbitrary restrict the length of a sequence of scancodes to 1024. */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* Process the command line. */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync for (i = 1 + 1; i < a->argc && cScancodes < (int)RT_ELEMENTS(alScancodes); i++, cScancodes++)
42aef05f4b27fb393967e581be04be455064c80avboxsync int irc = RTStrToUInt8Ex(a->argv[i], NULL, 16, &u8Scancode);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: converting '%s' returned %Rrc!\n", a->argv[i], rc);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: '%s' is not a hex byte!\n", a->argv[i]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: too many scancodes, maximum %d allowed!\n", RT_ELEMENTS(alScancodes));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* Send scancodes to the VM.
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * Note: 'PutScancodes' did not work here. Only the first scancode was transmitted.
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync for (i = 0; i < cScancodes; i++)
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(keyboard, PutScancode(alScancodes[i]));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Scancode[%d]: 0x%02X\n", i, alScancodes[i]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* Get the number of network adapters */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the corresponding network adapter */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(adapter, COMSETTER(CableConnected)(TRUE));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(adapter, COMSETTER(CableConnected)(FALSE));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid link state '%s'", Utf8Str(a->argv[2]).raw());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* here the order in which strncmp is called is important
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * cause nictracefile can be very well compared with
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * nictrace and nic and thus everything will always fail
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * if the order is changed
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* Get the number of network adapters */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the corresponding network adapter */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(TraceFile)(Bstr(a->argv[2])), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid filename or filename not specified for NIC %lu", n);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* Get the number of network adapters */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync unsigned n = parseNum(&a->argv[1][8], NetworkAdapterCount, "NIC");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the corresponding network adapter */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(TraceEnabled)(TRUE), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(TraceEnabled)(FALSE), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid nictrace%lu argument '%s'", n, Utf8Str(a->argv[2]).raw());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* Get the number of network adapters */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync unsigned n = parseNum(&a->argv[1][3], NetworkAdapterCount, "NIC");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the corresponding network adapter */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(NATNetwork)(Bstr(a->argv[3])), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync || !strcmp(a->argv[2], "hostif")) /* backward compatibility */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[2]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(HostInterface)(Bstr(a->argv[3])), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, AttachToBridgedInterface(), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[2]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(InternalNetwork)(Bstr(a->argv[3])), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, AttachToInternalNetwork(), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[2]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(Enabled)(TRUE), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, COMSETTER(HostInterface)(Bstr(a->argv[3])), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_RET(adapter, AttachToHostOnlyInterface(), 1);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid type '%s' specfied for NIC %lu", Utf8Str(a->argv[2]).raw(), n);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("The NIC %d is currently disabled and thus can't change its attachment type\n", n);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync#endif /* VBOX_DYNAMIC_NET_ATTACH */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the corresponding VRDP server */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync sessionMachine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Enabled)(TRUE));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Enabled)(FALSE));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid vrdp server state '%s'", Utf8Str(a->argv[2]).raw());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Missing argument to '%s'", a->argv[1]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* get the corresponding VRDP server */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync sessionMachine->COMGETTER(VRDPServer)(vrdpServer.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Ports)(vrdpports));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync#endif /* VBOX_WITH_VRDP */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorSyntax(USAGE_CONTROLVM, "Not enough parameters");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync // assume address
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(host, FindUSBDeviceByAddress(Bstr(a->argv [2]), dev.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(dev, COMGETTER(Id)(usbId.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, FindUSBDeviceByAddress(Bstr(a->argv [2]),
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(dev, COMGETTER(Id)(usbId.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, AttachUSBDevice(usbId));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, DetachUSBDevice(usbId, dev.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, COMGETTER(Display)(display.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(display, SetVideoModeHint(xres, yres, bpp, displayIdx));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid parameter '%s'", a->argv[5]);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, COMGETTER(Guest)(guest.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(guest, SetCredentials(Bstr(a->argv[2]), Bstr(a->argv[3]), Bstr(a->argv[4]), fAllowLocalLogon));
c9e3f6ad81ea9a279ffb537720699e552882c40avboxsync#if 0 /* TODO: review & remove */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* unmount? */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* nothing to do, NULL object will cause unmount */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* host drive? */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync rc = host->FindHostDVDDrive(Bstr(a->argv[2] + 5), dvdMedium.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid host DVD drive name \"%s\"",
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* first assume it's a UUID */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync rc = a->virtualBox->GetDVDImage(uuid, dvdMedium.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* must be a filename, check if it's in the collection */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync rc = a->virtualBox->FindDVDImage(Bstr(a->argv[2]), dvdMedium.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* not registered, do that on the fly */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(a->virtualBox, OpenDVDImage(Bstr(a->argv[2]), emptyUUID, dvdMedium.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /** @todo generalize this, allow arbitrary number of DVD drives
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * and as a consequence multiple attachments and different
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync * storage controllers. */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller"), 1, 0, uuid, FALSE /* aForce */));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* unmount? */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* nothing to do, NULL object will cause unmount */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* host drive? */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync host->FindHostFloppyDrive(Bstr(a->argv[2] + 5), floppyMedium.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Invalid host floppy drive name \"%s\"",
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* first assume it's a UUID */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync rc = a->virtualBox->GetFloppyImage(uuid, floppyMedium.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* must be a filename, check if it's in the collection */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync rc = a->virtualBox->FindFloppyImage(Bstr(a->argv[2]), floppyMedium.asOutParam());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync /* not registered, do that on the fly */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(a->virtualBox, OpenFloppyImage(Bstr(a->argv[2]), emptyUUID, floppyMedium.asOutParam()));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller"), 0, 0, uuid, FALSE /* aForce */));
c9e3f6ad81ea9a279ffb537720699e552882c40avboxsync#endif /* obsolete dvdattach/floppyattach */
21ed14a0d745501ffc9a68be81c0abadc777b628vboxsync else if (!strcmp(a->argv[1], "guestmemoryballoon"))
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorArgument("Error parsing guest memory balloon size '%s'", a->argv[2]);
629169500a4e1696f37dd3118a791d68278f71davboxsync /* guest is running; update IGuest */
629169500a4e1696f37dd3118a791d68278f71davboxsync rc = console->COMGETTER(Guest)(guest.asOutParam());
629169500a4e1696f37dd3118a791d68278f71davboxsync CHECK_ERROR(guest, COMSETTER(MemoryBalloonSize)(uVal));
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync { "--host", 'h', RTGETOPT_REQ_STRING }, /** @todo RTGETOPT_FLAG_MANDATORY */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync { "--hostname", 'h', RTGETOPT_REQ_STRING }, /** @todo remove this */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync { "--port", 'p', RTGETOPT_REQ_UINT32 }, /** @todo RTGETOPT_FLAG_MANDATORY */
fb1975a6972d89de9e515bed0248db93f04ec9d8vboxsync RTGetOptInit(&GetOptState, a->argc, a->argv, s_aTeleportOptions, RT_ELEMENTS(s_aTeleportOptions), 2, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync CHECK_ERROR_BREAK(console, Teleport(bstrHostname, uPort, bstrPassword, uMaxDowntime, progress.asOutParam()));
b2c92fb03e119c7de54f86a32fae9c1d59bc479evboxsync if (FAILED(rc) && rc != VBOX_E_INVALID_OBJECT_STATE)
b2c92fb03e119c7de54f86a32fae9c1d59bc479evboxsync CHECK_ERROR_BREAK(progress, COMSETTER(Timeout)(cMsTimeout)); /* lazyness */
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: teleportation failed. Error message: %lS\n", info.getText().raw());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync RTPrintf("Error: teleportation failed. No error message available!\n");
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync errorSyntax(USAGE_CONTROLVM, "Invalid parameter '%s'", Utf8Str(a->argv[1]).raw());
4328e87247f4a96449677e199c7e99ef516fc1cevboxsync } while (0);