VBoxManageInfo.cpp revision 9601ea695ea96905d6f5d484facd272732365c40
/* $Id$ */
/** @file
* VBoxManage - The 'showvminfo' command and helper routines.
*/
/*
* Copyright (C) 2006-2013 Oracle Corporation
*
* 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.
*/
#ifndef VBOX_ONLY_DOCS
/*******************************************************************************
* Header Files *
*******************************************************************************/
#ifdef VBOX_WITH_PCI_PASSTHROUGH
#endif
#include "VBoxManage.h"
using namespace com;
// funcs
///////////////////////////////////////////////////////////////////////////////
int level /*= 0*/)
{
/* start with the root */
if (details == VMINFO_MACHINEREADABLE)
{
/* print with hierarchical numbering */
if (!description.isEmpty())
if (fCurrent)
{
}
}
else
{
/* print with indentation */
RTPrintf(" %sName: %ls (UUID: %s)%s\n",
if (!description.isEmpty())
}
/* get the children */
{
{
if (snapshot)
{
if (details == VMINFO_MACHINEREADABLE)
else
{
}
/* recursive call */
}
}
}
return hrc;
}
{
RTTIME t;
RTTimeExplode(&t, &ts);
}
{
switch (machineState)
{
case MachineState_PoweredOff:
case MachineState_Saved:
return "saved";
case MachineState_Aborted:
return "aborted";
case MachineState_Teleported:
return "teleported";
case MachineState_Running:
return "running";
case MachineState_Paused:
return "paused";
case MachineState_Stuck:
case MachineState_Teleporting:
return "teleporting";
case MachineState_Starting:
return "starting";
case MachineState_Stopping:
return "stopping";
case MachineState_Saving:
return "saving";
case MachineState_Restoring:
return "restoring";
case MachineState_SettingUp:
default:
break;
}
return "unknown";
}
{
switch (faStatus)
{
return "paused";
return "terminating";
return "terminated";
return "failed";
default:
break;
}
return "unknown";
}
/**
* This takes care of escaping double quotes and slashes that the string might
* contain.
*
* @param pszName The variable name.
* @param pbstrValue The value.
*/
{
else
{
/* The value needs escaping. */
for (;;)
{
if (!pszNext)
{
break;
}
}
RTPrintf("\"\n");
}
}
/**
* Converts bandwidth group type to a string.
* @returns String representation.
* @param enmType Bandwidth control group type.
*/
{
switch (enmType)
{
case BandwidthGroupType_Disk: return "Disk";
case BandwidthGroupType_Network: return "Network";
}
return "unknown";
}
{
RTPrintf("\n\n");
{
if (details == VMINFO_MACHINEREADABLE)
else
{
const char *pszUnits = "";
if (cBytes == 0)
{
continue;
}
{
pszUnits = "G";
}
{
pszUnits = "M";
}
{
pszUnits = "K";
}
const char *pszNetUnits = NULL;
if (enmType == BandwidthGroupType_Network)
{
/*
* We want to report network rate limit in bits/s, not bytes.
* Only if it cannot be express it in kilobits we will fall
* back to reporting it in bytes.
*/
if (!(cBits % 125))
{
cBits /= 125;
pszNetUnits = "k";
if (!(cBits % 1000000))
{
cBits /= 1000000;
pszNetUnits = "g";
}
else if (!(cBits % 1000))
{
cBits /= 1000;
pszNetUnits = "m";
}
RTPrintf("Name: '%ls', Type: %s, Limit: %lld %sbits/sec (%lld %sbytes/sec)\n", strName.raw(), pszType, cBits, pszNetUnits, cBytes, pszUnits);
}
}
if (!pszNetUnits)
RTPrintf("Name: '%ls', Type: %s, Limit: %lld %sbytes/sec\n", strName.raw(), pszType, cBytes, pszUnits);
}
}
if (details != VMINFO_MACHINEREADABLE)
return rc;
}
/* Disable global optimizations for MSC 8.0/64 to make it compile in reasonable
time. MSC 7.1/32 doesn't have quite as much trouble with it, but still
sufficient to qualify for this hack as well since this code isn't performance
critical and probably won't gain much from the extra optimizing in real life. */
#if defined(_MSC_VER)
#endif
{
do \
{ \
BOOL f; \
if (details == VMINFO_MACHINEREADABLE) \
else \
} while (0)
do \
{ \
BOOL f; \
if (details == VMINFO_MACHINEREADABLE) \
else \
} while (0)
do \
{ \
if (details == VMINFO_MACHINEREADABLE) \
else \
} while (0)
do \
{ \
{ \
if (i != 0) \
} \
if (details == VMINFO_MACHINEREADABLE) \
else \
} while (0)
do \
{ \
if (details == VMINFO_MACHINEREADABLE) \
else \
} while (0)
do \
{ \
if (details == VMINFO_MACHINEREADABLE) \
else \
} while (0)
/*
* 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.
*/
if (!fAccessible)
{
if (details == VMINFO_COMPACT)
else
{
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_COMPACT)
{
return S_OK;
}
const char *pszChipsetType;
switch (chipsetType)
{
}
if (details == VMINFO_MACHINEREADABLE)
else
const char *pszFirmwareType;
switch (firmwareType)
{
}
if (details == VMINFO_MACHINEREADABLE)
else
SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_LongMode, &f), "longmode", "Long Mode");
SHOW_BOOLEAN_METHOD( machine, GetCPUProperty(CPUPropertyType_Synthetic, &f), "synthcpu", "Synthetic CPU");
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("CPUID overrides: ");
static uint32_t const s_auCpuIdRanges[] =
{
};
{
{
if (details == VMINFO_MACHINEREADABLE)
else
{
if (!cFound)
RTPrintf("Leaf no. EAX EBX ECX EDX\n");
}
cFound++;
}
}
RTPrintf("None\n");
const char *pszBootMenu;
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
ULONG maxBootPosition = 0;
{
if (bootOrder == DeviceType_Floppy)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("boot%d=\"floppy\"\n", i);
else
RTPrintf("Boot Device (%d): Floppy\n", i);
}
else if (bootOrder == DeviceType_DVD)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("boot%d=\"dvd\"\n", i);
else
RTPrintf("Boot Device (%d): DVD\n", i);
}
else if (bootOrder == DeviceType_HardDisk)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("boot%d=\"disk\"\n", i);
else
RTPrintf("Boot Device (%d): HardDisk\n", i);
}
else if (bootOrder == DeviceType_Network)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("boot%d=\"net\"\n", i);
else
RTPrintf("Boot Device (%d): Network\n", i);
}
else if (bootOrder == DeviceType_USB)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("boot%d=\"usb\"\n", i);
else
RTPrintf("Boot Device (%d): USB\n", i);
}
else if (bootOrder == DeviceType_SharedFolder)
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("boot%d=\"sharedfolder\"\n", i);
else
RTPrintf("Boot Device (%d): Shared Folder\n", i);
}
else
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("boot%d=\"none\"\n", i);
else
RTPrintf("Boot Device (%d): Not Assigned\n", i);
}
}
SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &f), "hwvirtex", "Hardw. virt.ext");
SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &f),"nestedpaging", "Nested Paging");
SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &f), "largepages", "Large Pages");
SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_VPID, &f), "vtxvpid", "VT-x VPID");
SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &f), "vtxux", "VT-x unr. exec.");
const char *pszState = machineStateToName(machineState, details == VMINFO_MACHINEREADABLE /*=fShort*/);
char pszTime[30] = {0};
if (details == VMINFO_MACHINEREADABLE)
{
}
else
#ifdef VBOX_WITH_VIDEOHWACCEL
SHOW_BOOLEAN_PROP( machine, Accelerate2DVideoEnabled, "accelerate2dvideo", "2D Video Acceleration");
#endif
SHOW_BOOLEAN_PROP( machine, AllowTracingToAccessVM, "tracing-allow-vm-access", "Allow Tracing to Access VM");
/** @todo Convert the remainder of the function to SHOW_XXX macros and add error
* checking where missing. */
/*
* Storage Controllers and their attached Mediums.
*/
{
if (details == VMINFO_MACHINEREADABLE)
else
switch (enmCtlType)
{
pszCtl = "LsiLogic";
break;
pszCtl = "LsiLogicSas";
break;
pszCtl = "BusLogic";
break;
pszCtl = "IntelAhci";
break;
pszCtl = "PIIX3";
break;
pszCtl = "PIIX4";
break;
pszCtl = "ICH6";
break;
pszCtl = "I82078";
break;
pszCtl = "USB";
break;
default:
pszCtl = "unknown";
}
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
}
{
{
{
i, k,
if (mediumAttach)
{
}
medium.asOutParam());
{
if (mediumAttach)
if (details == VMINFO_MACHINEREADABLE)
{
RTPrintf("\"%ls-ImageUUID-%d-%d\"=\"%s\"\n",
if (fPassthrough)
if (devType == DeviceType_DVD)
{
}
}
else
{
RTPrintf("%ls (%d, %d): %ls (UUID: %s)",
if (fPassthrough)
RTPrintf(" (passthrough enabled)");
if (fTempEject)
RTPrintf(" (temp eject)");
if (fIsEjected)
RTPrintf(" (ejected)");
RTPrintf("\n");
}
}
{
if (details == VMINFO_MACHINEREADABLE)
{
if (devType == DeviceType_DVD)
}
else
{
if (fTempEject)
RTPrintf(" (temp eject)");
if (fIsEjected)
RTPrintf(" (ejected)");
RTPrintf("\n");
}
}
else
{
if (details == VMINFO_MACHINEREADABLE)
}
}
}
}
/* 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;
{
strNatForwardings = "";
{
bool fSkip = false;
BSTR r = forwardings[i];
do { \
{ \
fSkip = true; \
} \
} while (0)
if (fSkip) continue;
if (fSkip) continue;
if (fSkip) continue;
if (fSkip) continue;
if (fSkip) continue;
{
case NATProtocol_TCP:
strProto = "tcp";
break;
case NATProtocol_UDP:
strProto = "udp";
break;
default:
strProto = "unk";
break;
}
if (details == VMINFO_MACHINEREADABLE)
{
}
else
{
" host ip = %s, host port = %s, guest ip = %s, guest port = %s\n",
}
}
if (details == VMINFO_MACHINEREADABLE)
{
RTPrintf("natnet%d=\"%ls\"\n", currentNIC + 1, strNetwork.length() ? strNetwork.raw(): Bstr("nat").raw());
strAttachment = "nat";
strNatSettings = Utf8StrFmt("mtu=\"%d\"\nsockSnd=\"%d\"\nsockRcv=\"%d\"\ntcpWndSnd=\"%d\"\ntcpWndRcv=\"%d\"\n",
}
else
{
strAttachment = "NAT";
strNatSettings = Utf8StrFmt("NIC %d Settings: MTU: %d, Socket (send: %d, receive: %d), TCP Window (send:%d, receive: %d)\n",
currentNIC + 1, mtu, sockSnd ? sockSnd : 64, sockRcv ? sockRcv : 64, tcpSnd ? tcpSnd : 64, tcpRcv ? tcpRcv : 64);
}
break;
}
{
if (details == VMINFO_MACHINEREADABLE)
{
strAttachment = "bridged";
}
else
break;
}
{
if (details == VMINFO_MACHINEREADABLE)
{
strAttachment = "intnet";
}
else
break;
}
{
if (details == VMINFO_MACHINEREADABLE)
{
strAttachment = "hostonly";
}
else
break;
}
{
if (details == VMINFO_MACHINEREADABLE)
{
strAttachment = "Generic";
}
else
{
// show the generic properties
{
strAttachment += " { ";
for (unsigned i = 0; i < aProperties.size(); ++i)
aProperties[i], aValues[i]);
strAttachment += " }";
}
}
break;
}
{
if (details == VMINFO_MACHINEREADABLE)
{
strAttachment = "natnetwork";
}
else
break;
}
default:
strAttachment = "unknown";
break;
}
/* cable connected */
/* promisc policy */
const char *pszPromiscuousGuestPolicy;
switch (enmPromiscModePolicy)
{
default: AssertFailedReturn(E_INVALIDARG);
}
/* trace stuff */
/* NIC type */
const char *pszNICType;
switch (NICType)
{
#ifdef VBOX_WITH_E1000
#endif
#ifdef VBOX_WITH_VIRTIO
#endif
}
/* reported line speed */
/* boot priority of the adapter */
/* bandwidth group */
if (details == VMINFO_MACHINEREADABLE)
{
}
else
RTPrintf("NIC %u: MAC: %ls, Attachment: %s, Cable connected: %s, Trace: %s (file: %ls), Type: %s, Reported speed: %d Mbps, Boot priority: %d, Promisc Policy: %s, Bandwidth group: %ls\n",
ulLineSpeed / 1000,
(int)ulBootPriority,
if (strNatSettings.length())
if (strNatForwardings.length())
}
}
}
/* Pointing device information */
const char *pszHID = "Unknown";
const char *pszMrHID = "unknown";
switch (aPointingHID)
{
case PointingHIDType_None:
pszHID = "None";
pszMrHID = "none";
break;
case PointingHIDType_PS2Mouse:
pszHID = "PS/2 Mouse";
pszMrHID = "ps2mouse";
break;
case PointingHIDType_USBMouse:
pszHID = "USB Mouse";
pszMrHID = "usbmouse";
break;
pszHID = "USB Tablet";
pszMrHID = "usbtablet";
break;
pszHID = "USB Tablet and PS/2 Mouse";
pszMrHID = "combomouse";
break;
pszHID = "USB Multi-Touch";
pszMrHID = "usbmultitouch";
break;
default:
break;
}
if (details == VMINFO_MACHINEREADABLE)
else
/* Keyboard device information */
pszHID = "Unknown";
pszMrHID = "unknown";
switch (aKeyboardHID)
{
case KeyboardHIDType_None:
pszHID = "None";
pszMrHID = "none";
break;
pszHID = "PS/2 Keyboard";
pszMrHID = "ps2kbd";
break;
pszHID = "USB Keyboard";
pszMrHID = "usbkbd";
break;
pszHID = "USB and PS/2 Keyboard";
pszMrHID = "combokbd";
break;
default:
break;
}
if (details == VMINFO_MACHINEREADABLE)
else
/* get the maximum amount of UARTs */
{
{
/* show the config of this UART */
if (!fEnabled)
{
if (details == VMINFO_MACHINEREADABLE)
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf("UART %d: I/O base: %#06x, IRQ: %d",
switch (HostMode)
{
default:
case PortMode_Disconnected:
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf(", disconnected\n");
break;
case PortMode_RawFile:
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf(", attached to raw file '%ls'\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;
}
}
}
}
/* get the maximum amount of LPTs */
{
{
/* show the config of this LPT */
if (!fEnabled)
{
if (details == VMINFO_MACHINEREADABLE)
else
}
else
{
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf("LPT %d: I/O base: %#06x, IRQ: %d",
if (details == VMINFO_MACHINEREADABLE)
else
}
}
}
{
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;
case AudioControllerType_HDA:
if (details == VMINFO_MACHINEREADABLE)
pszCtrl = "hda";
else
pszCtrl = "HDA";
break;
}
}
else
if (details == VMINFO_MACHINEREADABLE)
{
if (fEnabled)
else
RTPrintf("audio=\"none\"\n");
}
else
{
RTPrintf("Audio: %s",
if (fEnabled)
RTPrintf(" (Driver: %s, Controller: %s)",
RTPrintf("\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
}
/* Drag'n'drop */
{
const char *psz = "Unknown";
switch (enmMode)
{
case DragAndDropMode_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 (details == VMINFO_MACHINEREADABLE)
else
}
}
}
if (console)
{
do
{
break; /* VM not powered up */
{
com::GlueHandleComError(console, "COMGETTER(Display)(display.asOutParam())", rc, __FILE__, __LINE__);
return rc;
}
if (rc == E_ACCESSDENIED)
break; /* VM not powered up */
{
return rc;
}
if (details == VMINFO_MACHINEREADABLE)
else
}
while (0);
}
/*
* Remote Desktop
*/
{
if (fEnabled)
{
|| (videoChannel == "1");
const char *strAuthType;
switch (authType)
{
case AuthType_Null:
strAuthType = "null";
break;
case AuthType_External:
strAuthType = "external";
break;
case AuthType_Guest:
strAuthType = "guest";
break;
default:
strAuthType = "unknown";
break;
}
if (console)
{
if (!vrdeServerInfo.isNull())
{
if (rc == E_ACCESSDENIED)
{
}
{
return rc;
}
}
}
if (details == VMINFO_MACHINEREADABLE)
{
RTPrintf("vrde=\"on\"\n");
if (fVideoChannel)
}
else
{
address = "0.0.0.0";
RTPrintf("VRDE: enabled (Address %ls, Ports %ls, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n", address.raw(), ports.raw(), fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
if (fVideoChannel)
else
RTPrintf("Video redirection: disabled\n");
}
{
unsigned i;
for (i = 0; i < aProperties.size(); ++i)
{
if (details == VMINFO_MACHINEREADABLE)
{
else
}
else
{
else
}
}
}
}
else
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("vrde=\"off\"\n");
else
RTPrintf("VRDE: disabled\n");
}
}
/*
* USB.
*/
{
bool fOhciEnabled = false;
bool fEhciEnabled = false;
bool fXhciEnabled = false;
for (unsigned i = 0; i < USBCtlColl.size(); i++)
{
{
switch (enmType)
{
case USBControllerType_OHCI:
fOhciEnabled = true;
break;
case USBControllerType_EHCI:
fEhciEnabled = true;
break;
case USBControllerType_XHCI:
fXhciEnabled = true;
break;
default:
break;
}
}
}
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
if (details == VMINFO_MACHINEREADABLE)
else
}
{
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\nUSB Device Filters:\n\n");
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("<none>\n\n");
}
else
{
{
/* 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");
}
}
}
}
if (console)
{
/* scope */
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Available remote USB devices:\n\n");
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("<none>\n\n");
}
else
{
{
/* Query info. */
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("USBRemoteUUID%zu=\"%s\"\n"
"USBRemoteVendorId%zu=\"%#06x\"\n"
"USBRemoteProductId%zu=\"%#06x\"\n"
"USBRemoteRevision%zu=\"%#04x%02x\"\n",
else
RTPrintf("UUID: %s\n"
"VendorId: %#06x (%04X)\n"
"ProductId: %#06x (%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");
}
}
}
/* scope */
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Currently Attached USB Devices:\n\n");
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("<none>\n\n");
}
else
{
{
/* Query info. */
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("USBAttachedUUID%zu=\"%s\"\n"
"USBAttachedVendorId%zu=\"%#06x\"\n"
"USBAttachedProductId%zu=\"%#06x\"\n"
"USBAttachedRevision%zu=\"%#04x%02x\"\n",
else
RTPrintf("UUID: %s\n"
"VendorId: %#06x (%04X)\n"
"ProductId: %#06x (%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");
}
}
}
}
} /* USB */
#ifdef VBOX_WITH_PCI_PASSTHROUGH
/* Host PCI passthrough devices */
{
{
{
RTPrintf("\nAttached physical PCI devices:\n\n");
}
{
if (details == VMINFO_MACHINEREADABLE)
else
RTPrintf(" Host device %ls at %s attached as %s\n", DevName.raw(), szHostPCIAddress, szGuestPCIAddress);
}
{
RTPrintf("\n");
}
}
}
/* Host PCI passthrough devices */
#endif
/*
* Bandwidth groups
*/
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Bandwidth groups: ");
{
}
/*
* Shared folders
*/
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Shared folders: ");
uint32_t numSharedFolders = 0;
#if 0 // not yet implemented
/* globally shared folders first */
{
{
}
}
#endif
/* now VM mappings */
{
{
RTPrintf("\n\n");
if (details == VMINFO_MACHINEREADABLE)
{
}
else
RTPrintf("Name: '%ls', Host path: '%ls' (machine mapping), %s\n",
}
}
/* transient mappings */
if (console)
{
{
RTPrintf("\n\n");
if (details == VMINFO_MACHINEREADABLE)
{
}
else
}
}
RTPrintf("<none>\n");
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
if (console)
{
/*
* Live VRDE info.
*/
ULONG NumberOfClients = 0;
LONG64 BytesSentTotal = 0;
LONG64 BytesReceived = 0;
LONG64 BytesReceivedTotal = 0;
ULONG ClientVersion = 0;
ULONG EncryptionStyle = 0;
if (!vrdeServerInfo.isNull())
{
}
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
}
int64_t ThroughputSend = 0;
int64_t ThroughputReceive = 0;
{
}
if (details == VMINFO_MACHINEREADABLE)
{
}
else
{
}
if (Active)
{
if (details == VMINFO_MACHINEREADABLE)
{
}
else
{
}
}
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
}
{
/* Video capture */
if (details == VMINFO_MACHINEREADABLE)
{
RTPrintf("vcpscreens=");
bool fComma = false;
if (screens[i])
{
fComma = true;
}
RTPrintf("\n");
}
else
{
RTPrintf("Capture screens: ");
bool fComma = false;
if (screens[i])
{
fComma = true;
}
RTPrintf("\n");
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");
{
if (details == VMINFO_MACHINEREADABLE)
else
}
if (console)
{
{
&& !guestString.isEmpty())
{
if (details == VMINFO_MACHINEREADABLE)
else
}
AdditionsRunLevelType_T guestRunLevel; /** @todo Add a runlevel-to-string (e.g. 0 = "None") method? */
{
if (details == VMINFO_MACHINEREADABLE)
else
}
&& !guestString.isEmpty())
{
uRevision = 0;
if (details == VMINFO_MACHINEREADABLE)
else
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\nGuest Facilities:\n\n");
/* Print information about known Guest Additions facilities: */
char szLastUpdated[32];
{
if (fac)
{
if (!guestString.isEmpty())
{
if (details == VMINFO_MACHINEREADABLE)
RTPrintf("GuestAdditionsFacility_%ls=%u,%lld\n",
else
{
RTPrintf("Facility \"%ls\": %s (last update: %s)\n",
}
}
else
AssertMsgFailed(("Facility with undefined name retrieved!\n"));
}
else
AssertMsgFailed(("Invalid facility returned!\n"));
}
RTPrintf("No active facilities.\n");
}
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
/*
* snapshots
*/
{
{
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("Snapshots:\n\n");
}
}
if (details != VMINFO_MACHINEREADABLE)
RTPrintf("\n");
return S_OK;
}
#if defined(_MSC_VER)
#endif
static const RTGETOPTDEF g_aShowVMInfoOptions[] =
{
};
int handleShowVMInfo(HandlerArg *a)
{
const char *VMNameOrUuid = NULL;
bool fLog = false;
bool fDetails = false;
bool fMachinereadable = false;
int c;
// start at 0 because main() has hacked both the argc and argv given to us
{
switch (c)
{
case 'D': // --details
fDetails = true;
break;
case 'M': // --machinereadable
fMachinereadable = true;
break;
case 'l': // --log
fLog = true;
break;
case VINF_GETOPT_NOT_OPTION:
if (!VMNameOrUuid)
else
break;
default:
if (c > 0)
{
if (RT_C_IS_PRINT(c))
else
}
else if (c == VERR_GETOPT_UNKNOWN_OPTION)
else if (ValueUnion.pDef)
else
}
}
/* check for required options */
if (!VMNameOrUuid)
/* try to find the given machine */
machine.asOutParam()));
return 1;
/* Printing the log is exclusive. */
if (fLog)
{
while (true)
{
/* Reset the array */
/* Fetch a chunk of the log file */
if (cbLogData == 0)
break;
/* aLogData has a platform dependent line ending, standardize on
s++, d++)
{
if (*s == '\r')
{
/* skip over CR, adjust destination */
d--;
}
else if (s != d)
*d = *s;
}
}
}
else
{
/* 2nd option can be -details or -argdump */
if (fMachinereadable)
else if (fDetails)
else
/* open an existing session for the VM */
/* get the session machine */
/* get the session console */
if (console)
a->session->UnlockMachine();
}
}
#endif /* !VBOX_ONLY_DOCS */
/* vi: set tabstop=4 shiftwidth=4 expandtab: */