VBoxManage.cpp revision 0220076bc8def0ee99c7c43471290b2224756225
/** @file
*
* VBox frontends: VBoxManage (command-line interface)
*
* VBoxManage is VirtualBox's command-line interface. This is its rather
* long source.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <stdlib.h>
#include <stdarg.h>
#include <vector>
#include <list>
#include "VBoxManage.h"
using namespace com;
/* missing XPCOM <-> COM wrappers */
#ifndef STDMETHOD_
#endif
#ifndef NS_GET_IID
# define NS_GET_IID(I) IID_##I
#endif
#ifndef RT_OS_WINDOWS
#define IUnknown nsISupports
#endif
/** command handler type */
typedef DECLCALLBACK(int) FNHANDLER(int argc, char *argv[], ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession);
typedef FNHANDLER *PFNHANDLER;
/**
* Quick IUSBDevice implementation for detaching / attaching
* devices to the USB Controller.
*/
class MyUSBDevice : public IUSBDevice
{
public:
// public initializer/uninitializer for internal purposes only
MyUSBDevice(uint16_t a_u16VendorId, uint16_t a_u16ProductId, uint16_t a_bcdRevision, uint64_t a_u64SerialHash, const char *a_pszComment)
m_cRefs(0)
{
}
{
return ASMAtomicIncU32(&m_cRefs);
}
{
if (!cRefs)
delete this;
return cRefs;
}
{
*ppvObject = (IUSBDevice *)this;
else
return E_NOINTERFACE;
AddRef();
return S_OK;
}
STDMETHOD(COMGETTER(VendorId))(USHORT *a_pusVendorId) { *a_pusVendorId = m_usVendorId; return S_OK; }
STDMETHOD(COMGETTER(ProductId))(USHORT *a_pusProductId) { *a_pusProductId = m_usProductId; return S_OK; }
STDMETHOD(COMGETTER(Revision))(USHORT *a_pusRevision) { *a_pusRevision = m_bcdRevision; return S_OK; }
STDMETHOD(COMGETTER(SerialHash))(ULONG64 *a_pullSerialHash) { *a_pullSerialHash = m_u64SerialHash; return S_OK; }
private:
/** The vendor id of this USB device. */
/** The product id of this USB device. */
/** The product revision number of this USB device.
* (high byte = integer; low byte = decimal) */
/** The USB serial hash of the device. */
/** The user comment string. */
/** Reference counter. */
};
// types
///////////////////////////////////////////////////////////////////////////////
template <typename T>
class Nullable
{
public:
operator const T&() const { return mValue; }
{
mIsNull = false;
return *this;
}
private:
bool mIsNull;
T mValue;
};
/** helper structure to encapsulate USB filter manipulation commands */
struct USBFilterCmd
{
struct USBFilter
{
USBFilter ()
{}
};
/** flag whether the command target is a global filter */
bool mGlobal;
/** machine this command is targeted at (null for global filters) */
};
// funcs
///////////////////////////////////////////////////////////////////////////////
static void showLogo(void)
{
static bool fShown; /* show only once */
if (!fShown)
{
RTPrintf("VirtualBox Command Line Management Interface Version "
VBOX_VERSION_STRING "\n"
"(C) 2005-2008 innotek GmbH\n"
"All rights reserved.\n"
"\n");
fShown = true;
}
}
{
#ifdef RT_OS_LINUX
bool fLinux = true;
#else
bool fLinux = false;
#endif
#ifdef RT_OS_WINDOWS
bool fWin = true;
#else
bool fWin = false;
#endif
#ifdef RT_OS_SOLARIS
bool fSolaris = true;
#else
bool fSolaris = false;
#endif
#ifdef RT_OS_DARWIN
bool fDarwin = true;
#else
bool fDarwin = false;
#endif
#ifdef VBOX_VRDP
bool fVRDP = true;
#else
bool fVRDP = false;
#endif
if (u64Cmd == USAGE_DUMPOPTS)
{
fLinux = true;
fWin = true;
fVRDP = true;
}
RTPrintf("Usage:\n"
"\n");
{
RTPrintf("VBoxManage [-v|-version] print version number and exit\n"
"VBoxManage -nologo ... suppress the logo\n"
"\n"
"VBoxManage -convertSettings ... allow to auto-convert settings files\n"
"VBoxManage -convertSettingsBackup ... allow to auto-convert settings files\n"
" but create backup copies before\n"
"VBoxManage -convertSettingsIgnore ... allow to auto-convert settings files\n"
" but don't explicitly save the results\n"
"\n");
}
if (u64Cmd & USAGE_LIST)
{
RTPrintf("VBoxManage list vms|runningvms|ostypes|hostdvds|hostfloppies|\n");
if (fWin)
RTPrintf( "hostifs|");
RTPrintf(" hdds|dvds|floppies|usbhost|usbfilters|\n"
" systemproperties\n"
"\n");
}
if (u64Cmd & USAGE_SHOWVMINFO)
{
RTPrintf("VBoxManage showvminfo <uuid>|<name>\n"
" [-details]\n"
" [-statistics]\n"
" [-machinereadable]\n"
"\n");
}
if (u64Cmd & USAGE_REGISTERVM)
{
RTPrintf("VBoxManage registervm <filename>\n"
"\n");
}
if (u64Cmd & USAGE_UNREGISTERVM)
{
RTPrintf("VBoxManage unregistervm <uuid>|<name>\n"
" [-delete]\n"
"\n");
}
if (u64Cmd & USAGE_CREATEVM)
{
RTPrintf("VBoxManage createvm -name <name>\n"
" [-register]\n"
" [-basefolder <path> | -settingsfile <path>]\n"
" [-uuid <uuid>]\n"
" \n"
"\n");
}
if (u64Cmd & USAGE_MODIFYVM)
{
RTPrintf("VBoxManage modifyvm <uuid|name>\n"
" [-name <name>]\n"
" [-ostype <ostype>]\n"
" [-memory <memorysize>]\n"
" [-vram <vramsize>]\n"
" [-acpi on|off]\n"
" [-ioapic on|off]\n"
" [-pae on|off]\n"
" [-hwvirtex on|off|default]\n"
" [-monitorcount <number>]\n"
" [-bioslogofadein on|off]\n"
" [-bioslogofadeout on|off]\n"
" [-bioslogodisplaytime <msec>]\n"
" [-bioslogoimagepath <imagepath>]\n"
" [-biosbootmenu disabled|menuonly|messageandmenu]\n"
" [-biossystemtimeoffset <msec>]\n"
" [-biospxedebug on|off]\n"
" [-boot<1-4> none|floppy|dvd|disk|net>]\n"
" [-hd<a|b|d> none|<uuid>|<filename>]\n"
#ifdef VBOX_WITH_AHCI
" [-sata on|off]\n"
" [-sataportcount <1-30>]\n"
" [-sataport<1-30> none|<uuid>|<filename>]\n"
" [-sataideemulation hda|hdb|hdc|hdd <1-30>]\n"
#endif
" [-dvd none|<uuid>|<filename>|host:<drive>]\n"
" [-dvdpassthrough on|off]\n"
" [-floppy disabled|empty|<uuid>|\n"
" <filename>|host:<drive>]\n"
" [-nic<1-N> none|null|nat|hostif|intnet]\n"
" [-nictype<1-N> Am79C970A|Am79C973"
#ifdef VBOX_WITH_E1000
"|82540EM"
#endif
"]\n"
" [-cableconnected<1-N> on|off]\n"
" [-nictrace<1-N> on|off]\n"
" [-nictracefile<1-N> <filename>]\n"
" [-nicspeed<1-N> <kbps>]\n"
" [-hostifdev<1-N> none|<devicename>]\n"
" [-intnet<1-N> <network>]\n"
" [-macaddress<1-N> auto|<mac>]\n"
" [-uart<1-N> off|<I/O base> <IRQ>]\n"
" [-uartmode<1-N> disconnected|\n"
" server <pipe>|\n"
" client <pipe>|\n"
" <devicename>]\n"
#ifdef VBOX_WITH_MEM_BALLOONING
" [-guestmemoryballoon <balloonsize>]\n"
#endif
" [-gueststatisticsinterval <seconds>]\n"
);
if (fLinux)
{
RTPrintf(" [-tapsetup<1-N> none|<application>]\n"
" [-tapterminate<1-N> none|<application>]\n");
}
RTPrintf(" [-audio none|null");
if (fWin)
{
#ifdef VBOX_WITH_WINMM
RTPrintf( "|winmm|dsound");
#else
RTPrintf( "|dsound");
#endif
}
if (fSolaris)
{
RTPrintf( "|solaudio");
}
if (fLinux)
{
RTPrintf( "|oss"
#ifdef VBOX_WITH_ALSA
"|alsa"
#endif
#ifdef VBOX_WITH_PULSE
"|pulse"
#endif
);
}
if (fDarwin)
{
RTPrintf( "|coreaudio");
}
RTPrintf( "]\n");
RTPrintf(" [-audiocontroller ac97|sb16]\n"
" [-clipboard disabled|hosttoguest|guesttohost|\n"
" bidirectional]\n");
if (fVRDP)
{
RTPrintf(" [-vrdp on|off]\n"
" [-vrdpport default|<port>]\n"
" [-vrdpaddress <host>]\n"
" [-vrdpauthtype null|external|guest]\n"
" [-vrdpmulticon on|off]\n");
}
RTPrintf(" [-usb on|off]\n"
" [-usbehci on|off]\n"
" [-snapshotfolder default|<path>]\n");
RTPrintf("\n");
}
if (u64Cmd & USAGE_STARTVM)
{
RTPrintf("VBoxManage startvm <uuid>|<name>\n");
if (fVRDP)
RTPrintf(" [-type gui|vrdp]\n");
RTPrintf("\n");
}
if (u64Cmd & USAGE_CONTROLVM)
{
RTPrintf("VBoxManage controlvm <uuid>|<name>\n"
" pause|resume|reset|poweroff|savestate|\n"
" acpipowerbutton|acpisleepbutton|\n"
" setlinkstate<1-4> on|off |\n"
" usbattach <uuid>|<address> |\n"
" usbdetach <uuid>|<address> |\n"
" dvdattach none|<uuid>|<filename>|host:<drive> |\n"
" floppyattach none|<uuid>|<filename>|host:<drive> |\n"
" setvideomodehint <xres> <yres> <bpp> [display]|\n"
" setcredentials <username> <password> <domain>\n"
" [-allowlocallogon <yes|no>]\n"
"\n");
}
if (u64Cmd & USAGE_DISCARDSTATE)
{
RTPrintf("VBoxManage discardstate <uuid>|<name>\n"
"\n");
}
if (u64Cmd & USAGE_ADOPTSTATE)
{
RTPrintf("VBoxManage adoptstate <uuid>|<name> <state_file>\n"
"\n");
}
if (u64Cmd & USAGE_SNAPSHOT)
{
RTPrintf("VBoxManage snapshot <uuid>|<name>\n"
" take <name> [-desc <desc>] |\n"
" discard <uuid>|<name> |\n"
" discardcurrent -state|-all |\n"
" edit <uuid>|<name>|-current\n"
" [-newname <name>]\n"
" [-newdesc <desc>] |\n"
" showvminfo <uuid>|<name>\n"
"\n");
}
if (u64Cmd & USAGE_REGISTERIMAGE)
{
RTPrintf("VBoxManage registerimage disk|dvd|floppy <filename>\n"
" [-type normal|immutable|writethrough] (disk only)\n"
"\n");
}
if (u64Cmd & USAGE_UNREGISTERIMAGE)
{
RTPrintf("VBoxManage unregisterimage disk|dvd|floppy <uuid>|<filename>\n"
"\n");
}
if (u64Cmd & USAGE_SHOWVDIINFO)
{
RTPrintf("VBoxManage showvdiinfo <uuid>|<filename>\n"
"\n");
}
if (u64Cmd & USAGE_CREATEVDI)
{
RTPrintf("VBoxManage createvdi -filename <filename>\n"
" -size <megabytes>\n"
" [-static]\n"
" [-comment <comment>]\n"
" [-register]\n"
" [-type normal|writethrough] (default: normal)\n"
"\n");
}
if (u64Cmd & USAGE_MODIFYVDI)
{
RTPrintf("VBoxManage modifyvdi <uuid>|<filename>\n"
#if 0 /* doesn't currently work */
" settype normal|writethrough|immutable |\n"
#endif
" compact\n"
"\n");
}
if (u64Cmd & USAGE_CLONEVDI)
{
RTPrintf("VBoxManage clonevdi <uuid>|<filename> <outputfile>\n"
"\n");
}
if (u64Cmd & USAGE_CONVERTDD)
{
RTPrintf("VBoxManage convertdd <filename> <outputfile>\n"
"VBoxManage convertdd stdin <outputfile> <bytes>\n"
"\n");
}
if (u64Cmd & USAGE_ADDISCSIDISK)
{
RTPrintf("VBoxManage addiscsidisk -server <name>|<ip>\n"
" -target <target>\n"
" [-port <port>]\n"
" [-lun <lun>]\n"
" [-encodedlun <lun>]\n"
" [-username <username>]\n"
" [-password <password>]\n"
" [-comment <comment>]\n"
"\n");
}
{
RTPrintf("VBoxManage createhostif <name>\n"
"\n");
}
{
RTPrintf("VBoxManage removehostif <uuid>|<name>\n"
"\n");
}
if (u64Cmd & USAGE_GETEXTRADATA)
{
RTPrintf("VBoxManage getextradata global|<uuid>|<name>\n"
" <key>|enumerate\n"
"\n");
}
if (u64Cmd & USAGE_SETEXTRADATA)
{
RTPrintf("VBoxManage setextradata global|<uuid>|<name>\n"
" <key>\n"
" [<value>] (no value deletes key)\n"
"\n");
}
if (u64Cmd & USAGE_SETPROPERTY)
{
RTPrintf("VBoxManage setproperty vdifolder default|<folder> |\n"
" machinefolder default|<folder> |\n"
" vrdpauthlibrary default|<library> |\n"
" websrvauthlibrary default|null|<library> |\n"
" hwvirtexenabled yes|no\n"
" loghistorycount <value>\n"
"\n");
}
if (u64Cmd & USAGE_USBFILTER_ADD)
{
RTPrintf("VBoxManage usbfilter add <index,0-N>\n"
" -target <uuid>|<name>|global\n"
" -name <string>\n"
" -action ignore|hold (global filters only)\n"
" [-active yes|no] (yes)\n"
" [-vendorid <XXXX>] (null)\n"
" [-productid <XXXX>] (null)\n"
" [-revision <IIFF>] (null)\n"
" [-manufacturer <string>] (null)\n"
" [-product <string>] (null)\n"
" [-remote yes|no] (null, VM filters only)\n"
" [-serialnumber <string>] (null)\n"
" [-maskedinterfaces <XXXXXXXX>]\n"
"\n");
}
if (u64Cmd & USAGE_USBFILTER_MODIFY)
{
RTPrintf("VBoxManage usbfilter modify <index,0-N>\n"
" -target <uuid>|<name>|global\n"
" [-name <string>]\n"
" [-action ignore|hold] (global filters only)\n"
" [-active yes|no]\n"
" [-vendorid <XXXX>|\"\"]\n"
" [-productid <XXXX>|\"\"]\n"
" [-revision <IIFF>|\"\"]\n"
" [-manufacturer <string>|\"\"]\n"
" [-product <string>|\"\"]\n"
" [-remote yes|no] (null, VM filters only)\n"
" [-serialnumber <string>|\"\"]\n"
" [-maskedinterfaces <XXXXXXXX>]\n"
"\n");
}
if (u64Cmd & USAGE_USBFILTER_REMOVE)
{
RTPrintf("VBoxManage usbfilter remove <index,0-N>\n"
" -target <uuid>|<name>|global\n"
"\n");
}
if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
{
RTPrintf("VBoxManage sharedfolder add <vmname>|<uuid>\n"
" -name <name> -hostpath <hostpath>\n"
" [-transient] [-readonly]\n"
"\n");
}
if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
{
RTPrintf("VBoxManage sharedfolder remove <vmname>|<uuid>\n"
" -name <name> [-transient]\n"
"\n");
}
if (u64Cmd & USAGE_VM_STATISTICS)
{
RTPrintf("VBoxManage vmstatistics <vmname>|<uuid> [-reset]\n"
" [-pattern <pattern>] [-descriptions]\n"
"\n");
}
}
/**
* Print a usage synopsis and the syntax error message.
*/
{
showLogo(); // show logo even if suppressed
if (g_fInternalMode)
else
RTPrintf("\n"
return 1;
}
/**
* Print an error message without the syntax stuff.
*/
int errorArgument(const char *pszFormat, ...)
{
return 1;
}
/**
* Print out progress on the console
*/
{
LONG lastPercent = 0;
RTPrintf("0%%...");
{
/* did we cross a 10% mark? */
{
/* make sure to also print out missed steps */
for (LONG curVal = (lastPercent / 10) * 10 + 10; curVal <= (currentPercent / 10) * 10; curVal += 10)
{
if (curVal < 100)
{
}
}
}
if (fCompleted)
break;
/* make sure the loop is not too tight */
}
/* complete the line. */
{
RTPrintf("100%%\n");
else
RTPrintf("FAILED\n");
}
else
RTPrintf("\n");
}
static void showSnapshots(ComPtr<ISnapshot> rootSnapshot, VMINFO_DETAILS details, const Bstr &prefix = "", int level = 0)
{
/* start with the root */
if (details == VMINFO_MACHINEREADABLE)
{
/* print with hierarchical numbering */
}
else
{
/* print with indentation */
}
/* get the children */
if (coll)
{
{
if (snapshot)
{
if (details == VMINFO_MACHINEREADABLE)
else
/* recursive call */
}
index++;
}
}
}
{
RTTIME t;
RTTimeExplode (&t, &ts);
}
{
/*
* The rules for output in -argdump format:
* 1) the key part (the [0-9a-zA-Z_]+ string before the '=' delimiter)
* is all lowercase for "VBoxManage modifyvm" parameters. Any
* other values printed are in CamelCase.
* 2) strings (anything non-decimal) are printed surrounded by
* double quotes '"'. If the strings themselves contain double
* quotes, these characters are escaped by '\'. Any '\' character
* in the original string is also escaped by '\'.
* 3) numbers (containing just [0-9\-]) are written out unchanged.
*/
/** @todo the quoting is not yet implemented! */
if (!accessible)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("name=\"<inaccessible>\"\n");
else
RTPrintf ("Name: <inaccessible!>\n");
if (details == VMINFO_MACHINEREADABLE)
else
if (details != VMINFO_MACHINEREADABLE)
{
RTPrintf ("Access error details:\n");
RTPrintf ("\n");
}
return S_OK;
}
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
const char *pszBootMenu = NULL;
switch (bootMenuMode)
{
pszBootMenu = "disabled";
break;
if (details == VMINFO_MACHINEREADABLE)
pszBootMenu = "menuonly";
else
pszBootMenu = "menu only";
break;
default:
if (details == VMINFO_MACHINEREADABLE)
pszBootMenu = "messageandmenu";
else
pszBootMenu = "message and menu";
}
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (hwVirtExEnabled == TSBool_Default)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("hwvirtex=\"default\"\n");
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
else
}
switch (machineState)
{
case MachineState_PoweredOff:
if (details == VMINFO_MACHINEREADABLE)
pszState = "poweroff";
else
pszState = "powered off";
break;
case MachineState_Saved:
pszState = "saved";
break;
case MachineState_Aborted:
pszState = "aborted";
break;
case MachineState_Running:
pszState = "running";
break;
case MachineState_Paused:
pszState = "paused";
break;
case MachineState_Starting:
pszState = "starting";
break;
case MachineState_Stopping:
pszState = "stopping";
break;
case MachineState_Saving:
pszState = "saving";
break;
case MachineState_Restoring:
pszState = "restoring";
break;
default:
pszState = "unknown";
break;
}
char pszTime[30] = {0};
if (details == VMINFO_MACHINEREADABLE)
{
}
else
if (details == VMINFO_MACHINEREADABLE)
else
{
if (fFloppyEnabled)
{
switch (floppyState)
{
case DriveState_ImageMounted:
{
{
if (details == VMINFO_MACHINEREADABLE)
{
}
else
}
break;
}
{
{
if (details == VMINFO_MACHINEREADABLE)
else
}
break;
}
case DriveState_NotMounted:
{
pszFloppy = "empty";
break;
}
}
}
else
{
pszFloppy = "disabled";
}
if (details == VMINFO_MACHINEREADABLE)
else
}
/*
* SATA.
*/
{
fEnabled = false;
if (details == VMINFO_MACHINEREADABLE)
else
}
/*
* Hard disks
*/
{
/// @todo (dmik) we temporarily use the location property to
// determine the image file name. This is subject to change
// when iSCSI disks are here (we should either query a
// storage-specific interface from IHardDisk, or "standardize"
// the location property)
if (details == VMINFO_MACHINEREADABLE)
{
}
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("hda=\"none\"\n");
}
{
/// @todo (dmik) we temporarily use the location property to
// determine the image file name. This is subject to change
// when iSCSI disks are here (we should either query a
// storage-specific interface from IHardDisk, or "standardize"
// the location property)
if (details == VMINFO_MACHINEREADABLE)
{
}
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("hdb=\"none\"\n");
}
{
/// @todo (dmik) we temporarily use the location property to
// determine the image file name. This is subject to change
// when iSCSI disks are here (we should either query a
// storage-specific interface from IHardDisk, or "standardize"
// the location property)
if (details == VMINFO_MACHINEREADABLE)
{
}
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("hdd=\"none\"\n");
}
{
{
{
if (details == VMINFO_MACHINEREADABLE)
{
}
else
}
}
else
{
{
if (details == VMINFO_MACHINEREADABLE)
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("dvd=\"none\"\n");
else
RTPrintf("DVD: empty");
}
if (details == VMINFO_MACHINEREADABLE)
{
}
else
{
if (fPassthrough)
RTPrintf(" (passthrough enabled)");
RTPrintf("\n");
}
}
}
/* get the maximum amount of NICS */
{
{
if (!fEnabled)
{
if (details == VMINFO_MACHINEREADABLE)
else
}
else
{
switch (attachment)
{
if (details == VMINFO_MACHINEREADABLE)
strAttachment = "null";
else
strAttachment = "none";
break;
if (details == VMINFO_MACHINEREADABLE)
strAttachment = "nat";
else
strAttachment = "NAT";
break;
{
if (details == VMINFO_MACHINEREADABLE)
{
strAttachment = "hostif";
}
else
break;
}
{
if (details == VMINFO_MACHINEREADABLE)
{
strAttachment = "intnet";
}
else
break;
}
default:
strAttachment = "unknown";
break;
}
/* cable connected */
/* trace stuff */
/* NIC type */
switch (NICType) {
strNICType = "Am79C970A";
break;
strNICType = "Am79C973";
break;
#ifdef VBOX_WITH_E1000
strNICType = "82540EM";
break;
#endif
default:
strNICType = "unknown";
break;
}
/* reported line speed */
if (details == VMINFO_MACHINEREADABLE)
{
}
else
RTPrintf("NIC %d: MAC: %lS, Attachment: %s, Cable connected: %s, Trace: %s (file: %lS), Type: %s, Reported speed: %d Mbps\n",
strNICType.raw(),
ulLineSpeed / 1000);
}
}
}
/* get the maximum amount of UARTs */
{
{
if (!fEnabled)
{
if (details == VMINFO_MACHINEREADABLE)
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf("UART %d: I/O base: 0x%04x, IRQ: %d",
switch (HostMode)
{
default:
case PortMode_Disconnected:
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf(", disconnected\n");
break;
case PortMode_HostPipe:
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf(", attached to pipe (%s) '%lS'\n",
break;
case PortMode_HostDevice:
if (details == VMINFO_MACHINEREADABLE)
else
break;
}
}
}
}
{
const char *pszDrv = "Unknown";
const char *pszCtrl = "Unknown";
{
switch (enmDrvType)
{
case AudioDriverType_Null:
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "null";
else
pszDrv = "Null";
break;
case AudioDriverType_WinMM:
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "winmm";
else
pszDrv = "WINMM";
break;
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "dsound";
else
pszDrv = "DSOUND";
break;
case AudioDriverType_OSS:
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "oss";
else
pszDrv = "OSS";
break;
case AudioDriverType_ALSA:
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "alsa";
else
pszDrv = "ALSA";
break;
case AudioDriverType_Pulse:
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "pulse";
else
pszDrv = "PulseAudio";
break;
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "coreaudio";
else
pszDrv = "CoreAudio";
break;
case AudioDriverType_SolAudio:
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "solaudio";
else
pszDrv = "SolAudio";
break;
default:
if (details == VMINFO_MACHINEREADABLE)
pszDrv = "unknown";
break;
}
switch (enmCtrlType)
{
case AudioControllerType_AC97:
if (details == VMINFO_MACHINEREADABLE)
pszCtrl = "ac97";
else
pszCtrl = "AC97";
break;
case AudioControllerType_SB16:
if (details == VMINFO_MACHINEREADABLE)
pszCtrl = "sb16";
else
pszCtrl = "SB16";
break;
}
}
else
if (details == VMINFO_MACHINEREADABLE)
{
if (fEnabled)
else
RTPrintf("audio=\"none\"\n");
}
else
RTPrintf("Audio: %s (Driver: %s, Controller: %s)\n",
}
/* Shared clipboard */
{
const char *psz = "Unknown";
switch (enmMode)
{
case ClipboardMode_Disabled:
if (details == VMINFO_MACHINEREADABLE)
psz = "disabled";
else
psz = "disabled";
break;
if (details == VMINFO_MACHINEREADABLE)
psz = "hosttoguest";
else
psz = "HostToGuest";
break;
if (details == VMINFO_MACHINEREADABLE)
psz = "guesttohost";
else
psz = "GuestToHost";
break;
if (details == VMINFO_MACHINEREADABLE)
psz = "bidirectional";
else
psz = "Bidirectional";
break;
default:
if (details == VMINFO_MACHINEREADABLE)
psz = "unknown";
break;
}
if (details == VMINFO_MACHINEREADABLE)
else
}
if (console)
{
if (details == VMINFO_MACHINEREADABLE)
else
}
/*
* VRDP
*/
{
if (fEnabled)
{
const char *strAuthType;
switch (vrdpAuthType)
{
case VRDPAuthType_Null:
strAuthType = "null";
break;
case VRDPAuthType_External:
strAuthType = "external";
break;
case VRDPAuthType_Guest:
strAuthType = "guest";
break;
default:
strAuthType = "unknown";
break;
}
if (details == VMINFO_MACHINEREADABLE)
{
RTPrintf("vrdp=\"on\"\n");
}
else
{
address = "0.0.0.0";
RTPrintf("VRDP: enabled (Address %lS, Port %d, MultiConn: %s, Authentication type: %s)\n", address.raw(), port, fMultiCon ? "on" : "off", strAuthType);
}
}
else
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("vrdp=\"off\"\n");
else
RTPrintf("VRDP: disabled\n");
}
}
/*
* USB.
*/
{
fEnabled = false;
if (details == VMINFO_MACHINEREADABLE)
else
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\nUSB Device Filters:\n\n");
if (!fMore)
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("<none>\n\n");
}
else
while (fMore)
{
/* Query info. */
if (details != VMINFO_MACHINEREADABLE)
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details != VMINFO_MACHINEREADABLE)
{
if (fMaskedIfs)
RTPrintf("\n");
}
index ++;
}
if (console)
{
index = 0;
/* scope */
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Available remote USB devices:\n\n");
if (!more)
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("<none>\n\n");
}
else
while (more)
{
/* Query info. */
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("USBRemoteUUID%d=\"%S\"\n"
"USBRemoteVendorId%d=\"%#06x\"\n"
"USBRemoteProductId%d=\"%#06x\"\n"
"USBRemoteRevision%d=\"%#04x%02x\"\n",
else
RTPrintf("UUID: %S\n"
"VendorId: 0x%04x (%04X)\n"
"ProductId: 0x%04x (%04X)\n"
"Revision: %u.%u (%02u%02u)\n",
/* optional stuff. */
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
index ++;
}
}
index = 0;
/* scope */
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf ("Currently Attached USB Devices:\n\n");
if (!more)
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("<none>\n\n");
}
else
while (more)
{
/* Query info. */
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("USBAttachedUUID%d=\"%S\"\n"
"USBAttachedVendorId%d=\"%#06x\"\n"
"USBAttachedProductId%d=\"%#06x\"\n"
"USBAttachedRevision%d=\"%#04x%02x\"\n",
else
RTPrintf("UUID: %S\n"
"VendorId: 0x%04x (%04X)\n"
"ProductId: 0x%04x (%04X)\n"
"Revision: %u.%u (%02u%02u)\n",
/* optional stuff. */
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
index ++;
}
}
}
} /* USB */
/*
* Shared folders
*/
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Shared folders: ");
uint32_t numSharedFolders = 0;
#if 0 // not yet implemented
/* globally shared folders first */
{
while (fMore)
{
}
}
#endif
/* now VM mappings */
{
while (fMore)
{
RTPrintf("\n\n");
if (details == VMINFO_MACHINEREADABLE)
{
}
else
RTPrintf("Name: '%lS', Host path: '%lS' (machine mapping), %s\n",
}
}
/* transient mappings */
if (console)
{
while (fMore)
{
RTPrintf("\n\n");
if (details == VMINFO_MACHINEREADABLE)
{
}
else
}
}
RTPrintf("<none>\n");
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
if (console)
{
/*
* Live VRDP info.
*/
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (NumberOfClients > 0)
{
char timestr[128];
if (Active)
{
if (details == VMINFO_MACHINEREADABLE)
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
}
if (details == VMINFO_MACHINEREADABLE)
{
}
else
{
}
if (Active)
{
if (details == VMINFO_MACHINEREADABLE)
{
}
else
{
}
}
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
}
if ( details == VMINFO_STANDARD
|| details == VMINFO_FULL
|| details == VMINFO_MACHINEREADABLE)
{
if (!description.isEmpty())
{
if (details == VMINFO_MACHINEREADABLE)
else
}
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Guest:\n\n");
#ifdef VBOX_WITH_MEM_BALLOONING
{
if (details == VMINFO_MACHINEREADABLE)
else
}
#endif
{
if (details == VMINFO_MACHINEREADABLE)
else
{
if (guestVal == 0)
RTPrintf("Statistics update: disabled\n");
else
}
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
if ( console
&& ( details == VMINFO_STATISTICS
|| details == VMINFO_FULL
|| details == VMINFO_MACHINEREADABLE))
{
{
if (details == VMINFO_MACHINEREADABLE)
else
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
#ifdef VBOX_WITH_MEM_BALLOONING
{
if (details == VMINFO_MACHINEREADABLE)
else
}
#endif
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
{
if (details == VMINFO_MACHINEREADABLE)
else
}
RTPrintf("\n");
}
else
{
if (details != VMINFO_MACHINEREADABLE)
{
}
}
}
/*
* snapshots
*/
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Snapshots:\n\n");
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
return S_OK;
}
{
/* at least one option: the UUID or name of the VM */
if (argc < 1)
{
}
/* try to find the given machine */
{
}
else
{
}
return 1;
/* 2nd option can be -details, -statistics or -argdump */
bool fDetails = false;
bool fStatistics = false;
bool fMachinereadable = false;
for (int i=1;i<argc;i++)
{
fDetails = true;
else
fStatistics = true;
fMachinereadable = true;
}
if (fMachinereadable)
else
if (fDetails && fStatistics)
else
if (fDetails)
else
if (fStatistics)
/* open an existing session for the VM */
/* get the session machine */
/* get the session console */
if (console)
}
{
/* exactly one option: the object */
if (argc != 1)
{
}
/* which object? */
{
/*
* Get the list of all registered VMs
*/
{
/*
* Iterate through the collection
*/
{
{
}
}
}
}
else
{
/*
* Get the list of all _running_ VMs
*/
{
/*
* Iterate through the collection
*/
{
{
{
switch (machineState)
{
case MachineState_Running:
case MachineState_Paused:
{
break;
}
}
}
}
}
}
}
else
{
{
{
}
}
}
else
{
{
{
}
}
}
else
{
{
{
}
}
}
#ifdef RT_OS_WINDOWS
else
{
{
{
}
}
}
#endif /* RT_OS_WINDOWS */
else
{
{
const char *storageTypeString = "unknown";
switch (storageType)
{
storageTypeString = "Virtual Disk Image";
break;
storageTypeString = "iSCSI hard disk";
break;
}
/// @todo (dmik) we temporarily use the location property to
// determine the image file name. This is subject to change
// when iSCSI disks are here (we should either query a
// storage-specific interface from IHardDisk, or "standardize"
// the location property)
if (!machineUUID.isEmpty())
{
}
RTPrintf("\n");
}
}
else
{
{
/** @todo usage */
RTPrintf("\n");
}
}
else
{
{
/** @todo usage */
RTPrintf("\n");
}
}
else
{
RTPrintf("Host USB Devices:\n\n");
if (!fMore)
{
RTPrintf("<none>\n\n");
}
else
while (fMore)
{
/* Query info. */
RTPrintf("UUID: %S\n"
"VendorId: 0x%04x (%04X)\n"
"ProductId: 0x%04x (%04X)\n"
"Revision: %u.%u (%02u%02u)\n",
/* optional stuff. */
/* current state */
const char *pszState = "?";
switch (state)
{
pszState = "Not supported"; break;
pszState = "Unavailable"; break;
case USBDeviceState_Busy:
pszState = "Busy"; break;
case USBDeviceState_Available:
pszState = "Available"; break;
case USBDeviceState_Held:
pszState = "Held"; break;
case USBDeviceState_Captured:
pszState = "Captured"; break;
default:
ASSERT (false);
break;
}
}
}
else
{
RTPrintf("Global USB Device Filters:\n\n");
if (!more)
{
RTPrintf("<none>\n\n");
}
else
while (more)
{
/* Query info. */
const char *pszAction = "<invalid>";
switch (action)
{
pszAction = "Ignore";
break;
pszAction = "Hold";
break;
default:
break;
}
index ++;
}
}
{
}
else
{
}
}
{
if (argc != 1)
{
}
{
}
}
{
{
}
/* assume it's a UUID */
{
/* must be a name */
}
if (machine)
{
{
/* are we supposed to delete the config file? */
{
}
}
}
}
{
bool fStatic = false;
bool fRegister = false;
const char *type = "normal";
/* let's have a closer look at the arguments */
for (int i = 0; i < argc; i++)
{
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
fStatic = true;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
fRegister = true;
}
{
if (argc <= i + 1)
{
}
i++;
}
else
{
}
}
/* check the outcome */
{
}
{
}
CHECK_ERROR(virtualBox, CreateHardDisk(HardDiskStorageType_VirtualDiskImage, hardDisk.asOutParam()));
{
if (fStatic)
{
}
else
{
}
{
if (fStatic)
else
{
{
if (info.isBasicAvailable())
{
}
else
{
RTPrintf("Error: failed to create disk image. No error message available!\n");
}
}
else
{
{
/* nothing required, default */
}
{
}
}
}
}
{
}
}
}
{
{
RTPrintf(".");
}
return VINF_SUCCESS;
}
{
if (argc < 2)
{
}
/* first guess is that it's a UUID */
/* no? then it must be a filename */
if (!hardDisk)
{
}
else
{
}
/* let's find out which command */
// doesn't currently work if (strcmp(argv[1], "settype") == 0)
if (0)
{
/* hard disk must be registered */
{
if (argc <= 2)
{
return errorArgument("Missing argument to for settype");
}
{
if (hddType != HardDiskType_Normal)
}
{
if (hddType != HardDiskType_Writethrough)
}
{
if (hddType != HardDiskType_Immutable)
}
else
{
}
}
else
{
return errorArgument("Hard disk image not registered");
}
}
{
/* the hard disk image might not be registered */
if (!hardDisk)
{
if (!vdi)
{
return errorArgument("Hard disk image not found");
}
}
else
if (!vdi)
return errorArgument("Invalid hard disk type. The command only works on VDI files\n");
/* close the file */
unsigned uProcent;
if (VBOX_FAILURE(vrc))
{
}
}
else
{
}
}
{
/* source VDI and target path */
if (argc != 2)
{
}
/* first guess is that it's a UUID */
if (!hardDisk)
{
/* not successful? Then it must be a filename */
}
if (hardDisk)
{
{
{
if (info.isBasicAvailable())
{
}
else
{
RTPrintf("Error: failed to clone disk image. No error message available!\n");
}
}
}
}
}
{
#ifdef RT_OS_LINUX
#else
const bool fReadFromStdIn = false;
#endif
RTPrintf("Converting VDI: from DD image file=\"%s\" to file=\"%s\"...\n",
/* open raw image file. */
int rc = VINF_SUCCESS;
if (fReadFromStdIn)
File = 0;
else
if (VBOX_FAILURE(rc))
{
return rc;
}
/* get image size. */
if (fReadFromStdIn)
else
if (VBOX_SUCCESS(rc))
{
RTPrintf("Creating fixed image with size %RU64 bytes (%RU64MB)...\n", cbFile, (cbFile + _1M - 1) / _1M);
char pszComment[256];
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
/* alloc work buffer. */
if (pvBuf)
{
{
break;
if (VBOX_FAILURE(rc))
break;
}
}
else
rc = VERR_NO_MEMORY;
}
if (VBOX_FAILURE(rc))
{
/* delete image on error */
}
}
else
}
return rc;
}
{
/* at least server and target */
if (argc < 4)
{
}
/* let's have a closer look at the arguments */
for (int i = 0; i < argc; i++)
{
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
/** @todo move the LUN encoding algorithm into IISCSIHardDisk, add decoding */
if (argc <= i + 1)
{
}
i++;
char *pszNext;
if (lun <= 255)
{
/* Assume bus identifier = 0. */
}
else
{
/* Check above already limited the LUN to 14 bits. */
}
}
{
if (argc <= i + 1)
{
}
i++;
char *pszNext;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
else
{
}
}
/* check for required options */
{
}
{
if (port != UINT16_MAX)
if (lun != UINT64_MAX)
{
}
{
}
}
}
{
bool fRegister = false;
RTUuidClear(&id);
for (int i = 0; i < argc; i++)
{
{
if (argc <= i + 1)
{
}
i++;
baseFolder = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
settingsFile = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
{
}
}
{
fRegister = true;
}
else
{
}
}
if (!name)
{
}
if (!!baseFolder && !!settingsFile)
{
}
do
{
if (!settingsFile)
else
if (fRegister)
{
}
RTPrintf("Virtual machine '%ls' is created%s.\n"
"UUID: %s\n"
"Settings file: '%ls'\n",
}
while (0);
}
/**
* Parses a number.
*
* @returns Valid number on success.
* @returns 0 if invalid number. All necesary bitching has been done.
* @param psz Pointer to the nic number.
*/
{
char *pszNext;
if ( VBOX_SUCCESS(rc)
&& *pszNext == '\0'
&& u32 >= 1
return (unsigned)u32;
return 0;
}
{
ULONG memorySize = 0;
int monitorcount = -1;
char *bioslogofadein = NULL;
char *bioslogofadeout = NULL;
uint32_t bioslogodisplaytime = ~0;
char *bioslogoimagepath = NULL;
char *biosbootmenumode = NULL;
char *biossystemtimeoffset = NULL;
char *biospxedebug = NULL;
int bootDeviceChanged[4] = { false };
char *hdds[34] = {0};
char *dvdpassthrough = NULL;
char *audiocontroller = NULL;
#ifdef VBOX_VRDP
char *vrdpaddress = NULL;
char *vrdpauthtype = NULL;
char *vrdpmulticon = NULL;
#endif
int fUsbEnabled = -1;
int fUsbEhciEnabled = -1;
char *snapshotFolder = NULL;
int fSataEnabled = -1;
int sataPortCount = -1;
/* VM ID + at least one parameter. Parameter arguments are checked
* individually. */
if (argc < 2)
/* Get the number of network adapters */
ULONG NetworkAdapterCount = 0;
{
}
ULONG SerialPortCount = 0;
{
}
#ifdef RT_OS_LINUX
#endif
for (int i = 1; i < argc; i++)
{
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
bioslogofadein = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
bioslogofadeout = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
bioslogoimagepath = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
biosbootmenumode = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
biossystemtimeoffset = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
biospxedebug = argv[i];
}
{
ULONG n = 0;
if (!argv[i][5])
{
}
{
}
if (argc <= i + 1)
{
}
i++;
{
}
{
}
{
}
{
}
{
}
else
{
}
bootDeviceChanged[n - 1] = true;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
dvdpassthrough = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
audiocontroller = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
/* watch for the right order of these -nic* comparisons! */
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
#ifdef RT_OS_LINUX
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
#endif /* RT_OS_LINUX */
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
#ifdef VBOX_VRDP
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
vrdpport = 0;
else
}
{
if (argc <= i + 1)
{
}
i++;
vrdpaddress = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
vrdpauthtype = argv[i];
}
{
if (argc <= i + 1)
{
}
i++;
vrdpmulticon = argv[i];
}
#endif /* VBOX_VRDP */
{
if (argc <= i + 1)
{
}
i++;
fUsbEnabled = 1;
fUsbEnabled = 0;
else
}
{
if (argc <= i + 1)
{
}
i++;
fUsbEhciEnabled = 1;
fUsbEhciEnabled = 0;
else
}
{
if (argc <= i + 1)
{
}
i++;
snapshotFolder = argv[i];
}
{
if (!n)
return 1;
i++;
{
}
else
{
{
i++;
#ifdef RT_OS_WINDOWS
return errorArgument("Uart pipe must start with \\\\.\\pipe\\");
#endif
}
else
{
}
if (argc <= i)
{
return errorArgument("Missing argument to -uartmode");
}
}
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
{
}
else
{
if (argc <= i + 1)
{
}
int vrc;
i++;
if (vrc != VINF_SUCCESS)
}
}
#ifdef VBOX_WITH_MEM_BALLOONING
{
if (argc <= i + 1)
i++;
int vrc;
if (vrc != VINF_SUCCESS)
}
#endif
{
if (argc <= i + 1)
i++;
int vrc;
if (vrc != VINF_SUCCESS)
}
{
if (argc <= i + 1)
{
}
i++;
fSataEnabled = 1;
fSataEnabled = 0;
else
}
{
unsigned n;
if (argc <= i + 1)
{
}
i++;
if (!n)
return 1;
sataPortCount = n;
}
{
if (!n)
return 1;
if (argc <= i + 1)
{
}
i++;
}
{
unsigned bootDevicePos = 0;
unsigned n;
if (argc <= i + 2)
{
}
i++;
bootDevicePos = 0;
bootDevicePos = 1;
bootDevicePos = 2;
bootDevicePos = 3;
else
i++;
if (!n)
return 1;
sataBootDevices[bootDevicePos] = n;
}
else
{
}
}
/* try to find the given machine */
{
}
else
{
}
return 1;
/* open a session for the VM */
do
{
/* get the mutable session machine */
if (name)
if (ostype)
{
{
}
else
{
break;
}
}
if (memorySize > 0)
if (vramSize > 0)
if (acpi)
{
{
}
{
}
else
{
break;
}
}
if (ioapic)
{
{
}
{
}
else
{
break;
}
}
if (hwvirtex)
{
{
}
{
}
{
}
else
{
break;
}
}
if (pae)
{
{
}
{
}
else
{
break;
}
}
if (monitorcount != -1)
{
}
if (bioslogofadein)
{
{
}
{
}
else
{
break;
}
}
if (bioslogofadeout)
{
{
}
{
}
else
{
break;
}
}
if (bioslogodisplaytime != ~0U)
{
}
if (bioslogoimagepath)
{
}
if (biosbootmenumode)
{
else
{
break;
}
}
if (biossystemtimeoffset)
{
}
if (biospxedebug)
{
{
}
{
}
else
{
break;
}
}
{
if (bootDeviceChanged[curBootDev])
}
if (hdds[0])
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* first check if it's already registered */
else
{
/* it has to be registered */
break;
}
}
}
if (hardDisk)
{
}
else
break;
}
}
if (hdds[1])
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* first check if it's already registered */
else
{
/* it has to be registered */
break;
}
}
}
if (hardDisk)
{
}
else
break;
}
}
if (hdds[2])
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* first check if it's already registered */
else
{
/* it has to be registered */
break;
}
}
}
if (hardDisk)
{
}
else
break;
}
}
if (dvd)
{
/* unmount? */
{
}
/* host drive? */
{
if (!hostDVDDrive)
{
/* 2nd try: try with the real name, important on Linux+libhal */
char szPathReal[RTPATH_MAX];
{
errorArgument("Invalid host DVD drive name");
break;
}
if (!hostDVDDrive)
{
errorArgument("Invalid host DVD drive name");
break;
}
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename, check if it's in the collection */
/* not registered, do that on the fly */
if (!dvdImage)
{
{
/* time to register the image */
}
}
}
if (!dvdImage)
{
break;
}
}
}
if (dvdpassthrough)
{
}
if (floppy)
{
/* disable? */
{
/* disable the controller */
}
else
{
/* enable the controller */
/* unmount? */
{
}
/* host drive? */
{
if (!hostFloppyDrive)
{
errorArgument("Invalid host floppy drive name");
break;
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename */
{
/** @todo first iterate through the collection and try to find the image */
/* time to register the image */
}
}
if (!floppyImage)
{
break;
}
}
}
}
if (audio || audiocontroller)
{
if (audio)
{
/* disable? */
{
}
{
}
#ifdef RT_OS_WINDOWS
#ifdef VBOX_WITH_WINMM
{
}
#endif
{
}
#endif /* RT_OS_WINDOWS */
#ifdef RT_OS_LINUX
{
}
# ifdef VBOX_WITH_ALSA
{
}
# endif
# ifdef VBOX_WITH_PULSE
{
}
# endif
#endif /* !RT_OS_LINUX */
#ifdef RT_OS_SOLARIS
{
}
#endif /* !RT_OS_SOLARIS */
#ifdef RT_OS_DARWIN
{
}
#endif /* !RT_OS_DARWIN */
else
{
break;
}
}
if (audiocontroller)
{
else
{
break;
}
}
}
/* Shared clipboard state */
if (clipboard)
{
/* ComPtr<IClipboardMode> clipboardMode;
machine->COMGETTER(ClipboardMode)(clipboardMode.asOutParam());
ASSERT(clipboardMode);
*/
{
}
{
}
{
}
{
}
else
{
break;
}
}
/* iterate through all possible NICs */
for (ULONG n = 0; n < NetworkAdapterCount; n ++)
{
/* something about the NIC? */
if (nics[n])
{
{
}
{
}
{
}
{
}
{
}
else
{
break;
}
}
/* something about the NIC type? */
if (nictype[n])
{
{
}
{
}
#ifdef VBOX_WITH_E1000
{
}
#endif
else
{
break;
}
}
/* something about the MAC address? */
if (macs[n])
{
/* generate one? */
{
}
else
{
}
}
/* something about the reported link speed? */
if (nicspeed[n])
{
{
break;
}
}
/* the link status flag? */
if (cableconnected[n])
{
{
}
{
}
else
{
break;
}
}
/* the trace flag? */
if (nictrace[n])
{
{
}
{
}
else
{
break;
}
}
/* the tracefile flag? */
if (nictracefile[n])
{
}
/* the host interface device? */
if (hostifdev[n])
{
/* remove it? */
{
}
else
{
}
}
/* the internal network name? */
if (intnet[n])
{
/* remove it? */
{
}
else
{
}
}
#ifdef RT_OS_LINUX
/* the TAP setup application? */
if (tapsetup[n])
{
/* remove it? */
{
}
else
{
}
}
/* the TAP terminate application? */
if (tapterm[n])
{
/* remove it? */
{
}
else
{
}
}
#endif /* RT_OS_LINUX */
}
break;
/* iterate through all possible serial ports */
for (ULONG n = 0; n < SerialPortCount; n ++)
{
if (uarts_base[n])
{
{
}
else
{
}
}
if (uarts_mode[n])
{
{
}
else
{
{
}
{
}
else
{
}
}
}
}
break;
#ifdef VBOX_VRDP
{
if (vrdpServer)
{
if (vrdp)
{
{
}
{
}
else
{
break;
}
}
if (vrdpport != UINT16_MAX)
{
}
if (vrdpaddress)
{
}
if (vrdpauthtype)
{
{
}
{
}
{
}
else
{
break;
}
}
if (vrdpmulticon)
{
{
}
{
}
else
{
break;
}
}
}
}
#endif /* VBOX_VRDP */
/*
*/
if (fUsbEnabled != -1)
{
{
}
}
/*
*/
if (fUsbEhciEnabled != -1)
{
{
}
}
if (snapshotFolder)
{
{
}
else
{
}
}
/*
*/
if (fSataEnabled != -1)
{
{
}
}
{
if (hdds[i])
{
{
}
else
{
/* first guess is that it's a UUID */
/* not successful? Then it must be a filename */
if (!hardDisk)
{
{
/* first check if it's already registered */
else
{
/* it has to be registered */
break;
}
}
}
if (hardDisk)
{
}
else
break;
}
}
}
for (uint32_t i = 0; i < 4; i++)
{
if (sataBootDevices[i] != -1)
{
{
}
}
}
if (sataPortCount != -1)
{
{
}
}
/* commit changes */
}
while (0);
/* it's important to always close sessions */
}
{
if (argc < 1)
{
}
/* assume it's a UUID */
{
/* must be a name */
}
if (machine)
{
/* default to GUI session type */
/* has a session type been specified? */
{
{
sessionType = "gui";
}
{
sessionType = "vrdp";
}
{
sessionType = "capture";
}
else
{
}
}
#ifdef RT_OS_LINUX
/* make sure the VM process will start on the same display as VBoxManage */
{
if (display)
}
#endif
RTPrintf("Waiting for the remote session to open...\n");
if (FAILED(resultCode))
{
}
else
{
RTPrintf("Remote session has been successfully opened.\n");
}
}
/* it's important to always close sessions */
}
{
if (argc < 2)
{
}
/* try to find the given machine */
{
}
else
{
}
return 1;
/* open a session for the VM */
do
{
/* get the associated console */
/* ... and session machine */
/* which command? */
{
}
{
}
{
}
{
}
{
{
if (info.isBasicAvailable())
{
}
else
{
RTPrintf("Error: failed to save machine state. No error message available!\n");
}
}
}
{
}
{
}
{
/* Get the number of network adapters */
ULONG NetworkAdapterCount = 0;
if (!n)
{
break;
}
{
break;
}
/* get the corresponding network adapter */
if (adapter)
{
{
}
{
}
else
{
break;
}
}
}
{
if (argc < 3)
{
break;
}
{
// assume address
if (attach)
{
}
else
{
}
}
if (attach)
else
{
}
}
{
{
break;
}
uint32_t displayIdx = 0;
if (argc == 6)
}
{
bool fAllowLocalLogon = true;
if (argc == 7)
{
{
break;
}
fAllowLocalLogon = false;
}
else if (argc != 5)
{
break;
}
CHECK_ERROR_BREAK(guest, SetCredentials(Bstr(argv[2]), Bstr(argv[3]), Bstr(argv[4]), fAllowLocalLogon));
}
{
if (argc != 3)
{
break;
}
/* unmount? */
{
}
/* host drive? */
{
if (!hostDVDDrive)
{
errorArgument("Invalid host DVD drive name");
break;
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename, check if it's in the collection */
/* not registered, do that on the fly */
if (!dvdImage)
{
{
/* time to register the image */
}
}
}
if (!dvdImage)
{
break;
}
}
}
{
if (argc != 3)
{
break;
}
/* unmount? */
{
}
/* host drive? */
{
if (!hostFloppyDrive)
{
errorArgument("Invalid host floppy drive name");
break;
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename, check if it's in the collection */
/* not registered, do that on the fly */
if (!floppyImage)
{
{
/* time to register the image */
}
}
}
if (!floppyImage)
{
break;
}
}
}
#ifdef VBOX_WITH_MEM_BALLOONING
{
if (argc != 3)
{
break;
}
int vrc;
if (vrc != VINF_SUCCESS)
{
break;
}
/* guest is running; update IGuest */
}
#endif
{
if (argc != 3)
{
break;
}
int vrc;
if (vrc != VINF_SUCCESS)
{
break;
}
/* guest is running; update IGuest */
}
else
{
}
}
while (0);
}
{
if (argc != 1)
{
}
/* assume it's a UUID */
{
/* must be a name */
}
if (machine)
{
do
{
/* we have to open a session for this task */
do
{
}
while (0);
}
while (0);
}
}
{
if (argc != 2)
{
}
/* assume it's a UUID */
{
/* must be a name */
}
if (machine)
{
do
{
/* we have to open a session for this task */
do
{
}
while (0);
}
while (0);
}
}
{
/* we need at least a VM and a command */
if (argc < 2)
{
}
/* the first argument must be the VM */
/* assume it's a UUID */
{
/* must be a name */
}
if (!machine)
return 1;
do
{
/* we have to open a session for this task. First try an existing session */
/* switch based on the command */
{
/* there must be a name */
if (argc < 3)
{
break;
}
{
break;
}
if (argc == 5)
{
if (info.isBasicAvailable())
{
}
else
{
RTPrintf("Error: failed to take snapshot. No error message available!\n");
}
}
}
{
/* exactly one parameter: snapshot name */
if (argc != 3)
{
break;
}
/* assume it's a UUID */
{
}
else
{
/* then it must be a name */
}
{
if (info.isBasicAvailable())
{
}
else
{
RTPrintf("Error: failed to discard snapshot. No error message available!\n");
}
}
}
{
if ( (argc != 3)
{
break;
}
bool fAll = false;
fAll = true;
if (fAll)
{
}
else
{
}
{
if (info.isBasicAvailable())
{
}
else
{
RTPrintf("Error: failed to discard. No error message available!\n");
}
}
}
{
if (argc < 3)
{
break;
}
{
}
else
{
/* assume it's a UUID */
{
}
else
{
/* then it must be a name */
}
}
/* parse options */
for (int i = 3; i < argc; i++)
{
{
if (argc <= i + 1)
{
break;
}
i++;
}
{
if (argc <= i + 1)
{
break;
}
i++;
}
else
{
break;
}
}
}
{
/* exactly one parameter: snapshot name */
if (argc != 3)
{
break;
}
/* assume it's a UUID */
{
}
else
{
/* then it must be a name */
}
/* get the machine of the given snapshot */
}
else
{
}
} while (0);
}
{
if (argc != 1)
{
}
bool registered = true;
/* first guess is that it's a UUID */
/* no? then it must be a filename */
{
/* no? well, then it's an unregistered image */
{
registered = false;
}
}
{
/* query a VDI object (will remain null if it's not VDI) */
/* check for accessibility */
if (!accessible)
{
}
if (description)
{
}
const char *typeStr = "unknown";
switch (type)
{
case HardDiskType_Normal:
typeStr = "standard";
break;
case HardDiskType_Immutable:
typeStr = "immutable";
break;
typeStr = "writethrough";
break;
}
const char *storageTypeStr = "unknown";
switch (storageType)
{
storageTypeStr = "Virtual Disk Image (VDI)";
break;
storageTypeStr = "VMDK Image";
break;
storageTypeStr = "iSCSI target";
break;
storageTypeStr = "VHD Image";
break;
}
if (registered)
{
}
if (vdi)
{
/* VDI specific information */
}
else
{
/* Generic location information */
}
}
}
{
if (argc < 2)
{
}
{
/* there can be a type parameter */
{
}
if (argc == 4)
{
{
}
{
}
}
{
/* change the type if requested */
if (type)
{
}
}
}
{
{
}
}
{
{
}
}
else
{
}
}
{
if (argc != 2)
{
}
/* first guess is that it's a UUID */
{
/* not a UUID or not registered? Then it must be a filename */
if (!hardDisk)
{
}
{
}
}
else
{
/* not a UUID or not registered? Then it must be a filename */
if (!dvdImage)
{
}
{
}
}
else
{
/* not a UUID or not registered? Then it must be a filename */
if (!floppyImage)
{
}
{
}
}
else
{
}
}
#ifdef RT_OS_WINDOWS
{
if (argc != 1)
{
}
do
{
hostif.asOutParam(),
progress.asOutParam()));
{
}
}
while (0);
}
{
if (argc != 1)
{
}
do
{
/* first guess is that it's a UUID */
{
/* not a valid UUID, search for it */
}
hostif.asOutParam(),
progress.asOutParam()));
{
}
}
while (0);
}
#endif /* RT_OS_WINDOWS */
{
if (argc != 2)
{
}
/* global data? */
{
/* enumeration? */
{
do
{
{
}
} while (extraDataKey);
}
else
{
if (value)
else
RTPrintf("No value set!\n");
}
}
else
{
/* assume it's a UUID */
{
/* must be a name */
}
if (machine)
{
/* enumeration? */
{
do
{
{
}
} while (extraDataKey);
}
else
{
if (value)
else
RTPrintf("No value set!\n");
}
}
}
}
{
if (argc < 2)
{
}
/* global data? */
{
if (argc < 3)
else if (argc == 3)
else
}
else
{
/* assume it's a UUID */
{
/* must be a name */
}
if (machine)
{
if (argc < 3)
else if (argc == 3)
else
}
}
}
{
/* there must be two arguments: property name and value */
if (argc != 2)
{
}
{
/* reset to default? */
else
}
{
/* reset to default? */
else
}
{
/* reset to default? */
else
}
{
/* reset to default? */
else
}
{
else
}
{
int vrc;
if (vrc != VINF_SUCCESS)
}
else
}
{
/* at least: 0: command, 1: index, 2: -target, 3: <target value> */
if (argc < 4)
{
}
/* which command? */
{
}
/* which index? */
{
}
{
case USBFilterCmd::Add:
case USBFilterCmd::Modify:
{
/* at least: 0: command, 1: index, 2: -target, 3: <target value>, 4: -name, 5: <name value> */
if (argc < 6)
{
{
}
}
// set Active to true by default
// (assuming that the user sets up all necessary attributes
// at once and wants the filter to be active immediately)
for (int i = 2; i < argc; i++)
{
{
{
}
i++;
else
{
/* assume it's a UUID of a machine */
{
/* must be a name */
}
}
}
{
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
else
{
}
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
}
{
if (argc <= i + 1)
{
}
i++;
if (RT_FAILURE(rc))
{
return errorArgument("Failed to convert the -maskedinterfaces value '%s' to a number, rc=%Rrc", argv[i], rc);
}
}
{
if (argc <= i + 1)
{
}
i++;
else
{
}
}
else
{
"Unknown option '%s'", argv[i]);
}
}
{
||
)
)
{
}
}
break;
}
case USBFilterCmd::Remove:
{
/* at least: 0: command, 1: index, 2: -target, 3: <target value> */
if (argc < 4)
{
}
for (int i = 2; i < argc; i++)
{
{
{
}
i++;
else
{
/* assume it's a UUID of a machine */
{
/* must be a name */
}
}
}
}
// mandatory options
{
}
break;
}
default: break;
}
else
{
/* open a session for the VM */
/* get the mutable session machine */
/* and get the USB controller */
}
{
case USBFilterCmd::Add:
{
{
if (!f.mProductId.isNull())
if (!f.mManufacturer.isNull())
if (!f.mSerialNumber.isNull())
if (!f.mMaskedInterfaces.isNull())
if (f.mAction != USBDeviceFilterAction_Null)
}
else
{
if (!f.mProductId.isNull())
if (!f.mManufacturer.isNull())
if (!f.mSerialNumber.isNull())
if (!f.mMaskedInterfaces.isNull())
}
break;
}
case USBFilterCmd::Modify:
{
{
if (!f.mProductId.isNull())
if (!f.mManufacturer.isNull())
if (!f.mSerialNumber.isNull())
if (!f.mMaskedInterfaces.isNull())
if (f.mAction != USBDeviceFilterAction_Null)
}
else
{
if (!f.mProductId.isNull())
if (!f.mManufacturer.isNull())
if (!f.mSerialNumber.isNull())
if (!f.mMaskedInterfaces.isNull())
}
break;
}
case USBFilterCmd::Remove:
{
{
}
else
{
}
break;
}
default:
break;
}
{
/* commit and close the session */
}
}
{
/* we need at least a command and target */
if (argc < 2)
{
}
/* assume it's a UUID */
{
/* must be a name */
}
if (!machine)
return 1;
{
/* we need at least four more parameters */
if (argc < 5)
{
}
bool fTransient = false;
bool fWritable = true;
for (int i = 2; i < argc; i++)
{
{
{
}
i++;
}
{
{
}
i++;
}
{
fWritable = false;
}
{
fTransient = true;
}
else
{
}
}
/* required arguments */
{
}
if (fTransient)
{
/* open an existing session for the VM */
/* get the session machine */
/* get the session console */
if (console)
}
else
{
/* open a session for the VM */
/* get the mutable session machine */
}
}
{
/* we need at least two more parameters */
if (argc < 3)
{
}
bool fTransient = false;
for (int i = 2; i < argc; i++)
{
{
{
}
i++;
}
{
fTransient = true;
}
else
{
}
}
/* required arguments */
if (!name)
{
}
if (fTransient)
{
/* open an existing session for the VM */
/* get the session machine */
/* get the session console */
if (console)
}
else
{
/* open a session for the VM */
/* get the mutable session machine */
/* commit and close the session */
}
}
else
{
}
return 0;
}
{
/* at least one option: the UUID or name of the VM */
if (argc < 1)
/* try to find the given machine */
else
{
}
return 1;
/* parse arguments. */
bool fReset = false;
bool fWithDescriptions = false;
for (int i = 1; i < argc; i++)
{
{
if (pszPattern)
if (i + 1 >= argc)
pszPattern = argv[++i];
}
fWithDescriptions = true;
/* add: -file <filename> and -formatted */
fReset = true;
else
}
if (fReset && fWithDescriptions)
/* open an existing session for the VM. */
{
/* get the session console. */
{
/* get the machine debugger. */
{
if (fReset)
else
{
{
/* if (fFormatted)
{ big mess }
else
*/
}
}
}
}
}
}
enum ConvertSettings
{
ConvertSettings_No = 0,
ConvertSettings_Yes = 1,
};
/**
* Checks if any of the settings files were auto-converted and informs the
* user if so.
*
* @return @false if the program should terminate and @true otherwise.
*/
{
/* return early if nothing to do */
return true;
do
{
bool isGlobalConverted = false;
{
CHECK_RC_BREAK (machines [i]->
if (!accessible)
continue;
CHECK_RC_BREAK (machines [i]->
if (version != formatVersion)
{
CHECK_RC_BREAK (machines [i]->
}
}
CHECK_RC_BREAK (rc);
if (version != formatVersion)
{
isGlobalConverted = true;
}
{
switch (fConvertSettings)
{
case ConvertSettings_No:
{
RTPrintf (
"WARNING! The following VirtualBox settings files have been automatically\n"
"converted to the new settings file format version '%ls':\n"
"\n",
formatVersion.raw());
RTPrintf (
"\n"
"The current command was aborted to prevent overwriting the above settings\n"
"files with the results of the auto-conversion without your permission.\n"
"Please put one of the following command line switches to the beginning of\n"
"the VBoxManage command line and repeat the command:\n"
"\n"
" -convertSettings - to save all auto-converted files (it will not\n"
" be possible to use these settings files with an\n"
" older version of VirtualBox in the future);\n"
" -convertSettingsBackup - to create backup copies of the settings files in\n"
" the old format before saving them in the new format;\n"
" -convertSettingsIgnore - to not save the auto-converted settings files.\n"
"\n"
"Note that if you use -convertSettingsIgnore, the auto-converted settings files\n"
"will be implicitly saved in the new format anyway once you change a setting or\n"
"start a virtual machine, but NO backup copies will be created in this case.\n");
return false;
}
case ConvertSettings_Yes:
case ConvertSettings_Backup:
{
break;
}
default:
AssertFailedReturn (false);
}
m != cvtMachines.end(); ++ m)
{
/* open a session for the VM */
else
CHECK_RC_BREAK (rc);
}
CHECK_RC_BREAK (rc);
if (isGlobalConverted)
{
else
}
CHECK_RC_BREAK (rc);
}
}
while (0);
}
// main
///////////////////////////////////////////////////////////////////////////////
{
/*
* Before we do anything, init the runtime without loading
* the support driver.
*/
RTR3Init(false);
bool fShowLogo = true;
int iCmd = 1;
int iCmdArg;
/* global options */
{
{
showLogo();
return 0;
}
{
/* Print version number, and do nothing else. */
exit(0);
}
{
/* Special option to dump really all commands,
* even the ones not understood on this platform. */
return 0;
}
{
/* suppress the logo */
fShowLogo = false;
iCmd++;
}
{
iCmd++;
}
{
iCmd++;
}
{
iCmd++;
}
else
{
break;
}
}
if (fShowLogo)
showLogo();
/*
* The input is in the host OS'es codepage (NT guarantees ACP).
* For VBox we use UTF-8 and convert to UCS-2 when calling (XP)COM APIs.
* For simplicity, just convert the argv[] array here.
*/
{
char *converted;
}
do
{
// scopes all the stuff till shutdown
////////////////////////////////////////////////////////////////////////////
/* convertdd: does not need a VirtualBox instantiation) */
{
break;
}
{
RTPrintf ("[!] Failed to create the VirtualBox object!\n");
RTPrintf ("[!] Most likely, the VirtualBox COM server is not running "
"or failed to start.\n");
else
break;
}
/* create the event queue
* after the session is closed) */
break;
/*
* All registered command handlers
*/
struct
{
const char *command;
} commandHandlers[] =
{
{ "internalcommands", handleInternalCommands },
{ "list", handleList },
{ "showvminfo", handleShowVMInfo },
{ "registervm", handleRegisterVM },
{ "unregistervm", handleUnregisterVM },
{ "createvdi", handleCreateVDI },
{ "modifyvdi", handleModifyVDI },
{ "addiscsidisk", handleAddiSCSIDisk },
{ "createvm", handleCreateVM },
{ "modifyvm", handleModifyVM },
{ "clonevdi", handleCloneVDI },
{ "startvm", handleStartVM },
{ "controlvm", handleControlVM },
{ "discardstate", handleDiscardState },
{ "adoptstate", handleAdoptdState },
{ "snapshot", handleSnapshot },
{ "registerimage", handleRegisterImage },
{ "unregisterimage", handleUnregisterImage },
{ "showvdiinfo", handleShowVDIInfo },
#ifdef RT_OS_WINDOWS
{ "createhostif", handleCreateHostIF },
{ "removehostif", handleRemoveHostIF },
#endif
{ "getextradata", handleGetExtraData },
{ "setextradata", handleSetExtraData },
{ "setproperty", handleSetProperty },
{ "usbfilter", handleUSBFilter },
{ "sharedfolder", handleSharedFolder },
{ "vmstatistics", handleVMStatistics },
};
int commandIndex;
{
{
break;
}
}
{
}
/* Although all handlers should always close the session if they open it,
* we do it here just in case if some of the handlers contains a bug --
* leaving the direct session not closed will turn the machine state to
* Aborted which may have unwanted side effects like killing the saved
* state file (if the machine was in the Saved state before). */
// end "all-stuff" scope
////////////////////////////////////////////////////////////////////////////
}
while (0);
/*
* Free converted argument vector
*/
return rc;
}