[12599] | 1 | /* $Id: VBoxManageList.cpp 103598 2024-02-28 17:17:55Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
[14732] | 3 | * VBoxManage - The 'list' command.
|
---|
[1] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[1] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[1] | 26 | */
|
---|
| 27 |
|
---|
[94236] | 28 |
|
---|
[57358] | 29 | /*********************************************************************************************************************************
|
---|
| 30 | * Header Files *
|
---|
| 31 | *********************************************************************************************************************************/
|
---|
[1] | 32 | #include <VBox/com/com.h>
|
---|
| 33 | #include <VBox/com/string.h>
|
---|
| 34 | #include <VBox/com/Guid.h>
|
---|
[7379] | 35 | #include <VBox/com/array.h>
|
---|
[1] | 36 | #include <VBox/com/ErrorInfo.h>
|
---|
[20928] | 37 | #include <VBox/com/errorprint.h>
|
---|
[1] | 38 |
|
---|
| 39 | #include <VBox/com/VirtualBox.h>
|
---|
| 40 |
|
---|
[14612] | 41 | #include <VBox/log.h>
|
---|
[1] | 42 | #include <iprt/stream.h>
|
---|
| 43 | #include <iprt/string.h>
|
---|
[14612] | 44 | #include <iprt/time.h>
|
---|
[17078] | 45 | #include <iprt/getopt.h>
|
---|
[18108] | 46 | #include <iprt/ctype.h>
|
---|
[1] | 47 |
|
---|
[65517] | 48 | #include <vector>
|
---|
| 49 | #include <algorithm>
|
---|
| 50 |
|
---|
[1] | 51 | #include "VBoxManage.h"
|
---|
| 52 | using namespace com;
|
---|
| 53 |
|
---|
[92372] | 54 | DECLARE_TRANSLATION_CONTEXT(List);
|
---|
| 55 |
|
---|
[15235] | 56 | #ifdef VBOX_WITH_HOSTNETIF_API
|
---|
[17322] | 57 | static const char *getHostIfMediumTypeText(HostNetworkInterfaceMediumType_T enmType)
|
---|
[15235] | 58 | {
|
---|
| 59 | switch (enmType)
|
---|
| 60 | {
|
---|
[17275] | 61 | case HostNetworkInterfaceMediumType_Ethernet: return "Ethernet";
|
---|
| 62 | case HostNetworkInterfaceMediumType_PPP: return "PPP";
|
---|
| 63 | case HostNetworkInterfaceMediumType_SLIP: return "SLIP";
|
---|
[92372] | 64 | case HostNetworkInterfaceMediumType_Unknown: return List::tr("Unknown");
|
---|
[72976] | 65 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
| 66 | case HostNetworkInterfaceMediumType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
| 67 | #endif
|
---|
[15235] | 68 | }
|
---|
[92372] | 69 | return List::tr("unknown");
|
---|
[15235] | 70 | }
|
---|
[15372] | 71 |
|
---|
| 72 | static const char *getHostIfStatusText(HostNetworkInterfaceStatus_T enmStatus)
|
---|
| 73 | {
|
---|
| 74 | switch (enmStatus)
|
---|
| 75 | {
|
---|
[92372] | 76 | case HostNetworkInterfaceStatus_Up: return List::tr("Up");
|
---|
| 77 | case HostNetworkInterfaceStatus_Down: return List::tr("Down");
|
---|
| 78 | case HostNetworkInterfaceStatus_Unknown: return List::tr("Unknown");
|
---|
[72976] | 79 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
| 80 | case HostNetworkInterfaceStatus_32BitHack: break; /* Shut up compiler warnings. */
|
---|
| 81 | #endif
|
---|
[15372] | 82 | }
|
---|
[92372] | 83 | return List::tr("unknown");
|
---|
[15372] | 84 | }
|
---|
[33759] | 85 | #endif /* VBOX_WITH_HOSTNETIF_API */
|
---|
[1] | 86 |
|
---|
[33524] | 87 | static const char*getDeviceTypeText(DeviceType_T enmType)
|
---|
| 88 | {
|
---|
| 89 | switch (enmType)
|
---|
| 90 | {
|
---|
[92372] | 91 | case DeviceType_HardDisk: return List::tr("HardDisk");
|
---|
[33524] | 92 | case DeviceType_DVD: return "DVD";
|
---|
[92372] | 93 | case DeviceType_Floppy: return List::tr("Floppy");
|
---|
[63300] | 94 | /* Make MSC happy */
|
---|
| 95 | case DeviceType_Null: return "Null";
|
---|
[92372] | 96 | case DeviceType_Network: return List::tr("Network");
|
---|
[63300] | 97 | case DeviceType_USB: return "USB";
|
---|
[92372] | 98 | case DeviceType_SharedFolder: return List::tr("SharedFolder");
|
---|
| 99 | case DeviceType_Graphics3D: return List::tr("Graphics3D");
|
---|
[98083] | 100 | case DeviceType_End: break; /* Shut up compiler warnings. */
|
---|
[72976] | 101 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
| 102 | case DeviceType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
| 103 | #endif
|
---|
[33524] | 104 | }
|
---|
[92372] | 105 | return List::tr("Unknown");
|
---|
[33524] | 106 | }
|
---|
| 107 |
|
---|
[42748] | 108 |
|
---|
| 109 | /**
|
---|
[48538] | 110 | * List internal networks.
|
---|
| 111 | *
|
---|
| 112 | * @returns See produceList.
|
---|
| 113 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 114 | */
|
---|
| 115 | static HRESULT listInternalNetworks(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
| 116 | {
|
---|
[95140] | 117 | HRESULT hrc;
|
---|
[48538] | 118 | com::SafeArray<BSTR> internalNetworks;
|
---|
| 119 | CHECK_ERROR(pVirtualBox, COMGETTER(InternalNetworks)(ComSafeArrayAsOutParam(internalNetworks)));
|
---|
| 120 | for (size_t i = 0; i < internalNetworks.size(); ++i)
|
---|
| 121 | {
|
---|
[92372] | 122 | RTPrintf(List::tr("Name: %ls\n"), internalNetworks[i]);
|
---|
[48538] | 123 | }
|
---|
[95140] | 124 | return hrc;
|
---|
[48538] | 125 | }
|
---|
| 126 |
|
---|
| 127 |
|
---|
| 128 | /**
|
---|
[42748] | 129 | * List network interfaces information (bridged/host only).
|
---|
| 130 | *
|
---|
| 131 | * @returns See produceList.
|
---|
| 132 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
[48538] | 133 | * @param fIsBridged Selects between listing host interfaces (for
|
---|
| 134 | * use with bridging) or host only interfaces.
|
---|
[42748] | 135 | */
|
---|
| 136 | static HRESULT listNetworkInterfaces(const ComPtr<IVirtualBox> pVirtualBox,
|
---|
| 137 | bool fIsBridged)
|
---|
[27916] | 138 | {
|
---|
[95140] | 139 | HRESULT hrc;
|
---|
[42748] | 140 | ComPtr<IHost> host;
|
---|
| 141 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
| 142 | com::SafeIfaceArray<IHostNetworkInterface> hostNetworkInterfaces;
|
---|
| 143 | #if defined(VBOX_WITH_NETFLT)
|
---|
| 144 | if (fIsBridged)
|
---|
| 145 | CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_Bridged,
|
---|
| 146 | ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
| 147 | else
|
---|
| 148 | CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_HostOnly,
|
---|
| 149 | ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
| 150 | #else
|
---|
[63404] | 151 | RT_NOREF(fIsBridged);
|
---|
[42748] | 152 | CHECK_ERROR(host, COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(hostNetworkInterfaces)));
|
---|
| 153 | #endif
|
---|
| 154 | for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i)
|
---|
| 155 | {
|
---|
| 156 | ComPtr<IHostNetworkInterface> networkInterface = hostNetworkInterfaces[i];
|
---|
| 157 | #ifndef VBOX_WITH_HOSTNETIF_API
|
---|
| 158 | Bstr interfaceName;
|
---|
| 159 | networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
|
---|
[92372] | 160 | RTPrintf(List::tr("Name: %ls\n"), interfaceName.raw());
|
---|
[42748] | 161 | Guid interfaceGuid;
|
---|
| 162 | networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
| 163 | RTPrintf("GUID: %ls\n\n", Bstr(interfaceGuid.toString()).raw());
|
---|
| 164 | #else /* VBOX_WITH_HOSTNETIF_API */
|
---|
| 165 | Bstr interfaceName;
|
---|
| 166 | networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
|
---|
[92372] | 167 | RTPrintf(List::tr("Name: %ls\n"), interfaceName.raw());
|
---|
[42748] | 168 | Bstr interfaceGuid;
|
---|
| 169 | networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
| 170 | RTPrintf("GUID: %ls\n", interfaceGuid.raw());
|
---|
[79748] | 171 | BOOL fDHCPEnabled = FALSE;
|
---|
| 172 | networkInterface->COMGETTER(DHCPEnabled)(&fDHCPEnabled);
|
---|
[92372] | 173 | RTPrintf("DHCP: %s\n", fDHCPEnabled ? List::tr("Enabled") : List::tr("Disabled"));
|
---|
[42748] | 174 |
|
---|
| 175 | Bstr IPAddress;
|
---|
| 176 | networkInterface->COMGETTER(IPAddress)(IPAddress.asOutParam());
|
---|
[92372] | 177 | RTPrintf(List::tr("IPAddress: %ls\n"), IPAddress.raw());
|
---|
[42748] | 178 | Bstr NetworkMask;
|
---|
| 179 | networkInterface->COMGETTER(NetworkMask)(NetworkMask.asOutParam());
|
---|
[92372] | 180 | RTPrintf(List::tr("NetworkMask: %ls\n"), NetworkMask.raw());
|
---|
[42748] | 181 | Bstr IPV6Address;
|
---|
| 182 | networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
|
---|
[92372] | 183 | RTPrintf(List::tr("IPV6Address: %ls\n"), IPV6Address.raw());
|
---|
[42748] | 184 | ULONG IPV6NetworkMaskPrefixLength;
|
---|
| 185 | networkInterface->COMGETTER(IPV6NetworkMaskPrefixLength)(&IPV6NetworkMaskPrefixLength);
|
---|
[92372] | 186 | RTPrintf(List::tr("IPV6NetworkMaskPrefixLength: %d\n"), IPV6NetworkMaskPrefixLength);
|
---|
[42748] | 187 | Bstr HardwareAddress;
|
---|
| 188 | networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam());
|
---|
[92372] | 189 | RTPrintf(List::tr("HardwareAddress: %ls\n"), HardwareAddress.raw());
|
---|
[42748] | 190 | HostNetworkInterfaceMediumType_T Type;
|
---|
| 191 | networkInterface->COMGETTER(MediumType)(&Type);
|
---|
[92372] | 192 | RTPrintf(List::tr("MediumType: %s\n"), getHostIfMediumTypeText(Type));
|
---|
[79748] | 193 | BOOL fWireless = FALSE;
|
---|
[69164] | 194 | networkInterface->COMGETTER(Wireless)(&fWireless);
|
---|
[92372] | 195 | RTPrintf(List::tr("Wireless: %s\n"), fWireless ? List::tr("Yes") : List::tr("No"));
|
---|
[42748] | 196 | HostNetworkInterfaceStatus_T Status;
|
---|
| 197 | networkInterface->COMGETTER(Status)(&Status);
|
---|
[92372] | 198 | RTPrintf(List::tr("Status: %s\n"), getHostIfStatusText(Status));
|
---|
[42748] | 199 | Bstr netName;
|
---|
| 200 | networkInterface->COMGETTER(NetworkName)(netName.asOutParam());
|
---|
[92372] | 201 | RTPrintf(List::tr("VBoxNetworkName: %ls\n\n"), netName.raw());
|
---|
[42748] | 202 | #endif
|
---|
| 203 | }
|
---|
[95140] | 204 | return hrc;
|
---|
[42748] | 205 | }
|
---|
| 206 |
|
---|
| 207 |
|
---|
[91416] | 208 | #ifdef VBOX_WITH_VMNET
|
---|
| 209 | /**
|
---|
| 210 | * List configured host-only networks.
|
---|
| 211 | *
|
---|
| 212 | * @returns See produceList.
|
---|
| 213 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 214 | * @param Reserved Placeholder!
|
---|
| 215 | */
|
---|
| 216 | static HRESULT listHostOnlyNetworks(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
| 217 | {
|
---|
[95140] | 218 | HRESULT hrc;
|
---|
[91416] | 219 | com::SafeIfaceArray<IHostOnlyNetwork> hostOnlyNetworks;
|
---|
| 220 | CHECK_ERROR(pVirtualBox, COMGETTER(HostOnlyNetworks)(ComSafeArrayAsOutParam(hostOnlyNetworks)));
|
---|
| 221 | for (size_t i = 0; i < hostOnlyNetworks.size(); ++i)
|
---|
| 222 | {
|
---|
| 223 | ComPtr<IHostOnlyNetwork> hostOnlyNetwork = hostOnlyNetworks[i];
|
---|
[95177] | 224 | Bstr bstrNetworkName;
|
---|
| 225 | CHECK_ERROR2I(hostOnlyNetwork, COMGETTER(NetworkName)(bstrNetworkName.asOutParam()));
|
---|
| 226 | RTPrintf(List::tr("Name: %ls\n"), bstrNetworkName.raw());
|
---|
[95178] | 227 |
|
---|
[95177] | 228 | Bstr bstr;
|
---|
| 229 | CHECK_ERROR(hostOnlyNetwork, COMGETTER(Id)(bstr.asOutParam()));
|
---|
| 230 | RTPrintf("GUID: %ls\n\n", bstr.raw());
|
---|
[95178] | 231 |
|
---|
[91416] | 232 | BOOL fEnabled = FALSE;
|
---|
[95177] | 233 | CHECK_ERROR2I(hostOnlyNetwork, COMGETTER(Enabled)(&fEnabled));
|
---|
[92372] | 234 | RTPrintf(List::tr("State: %s\n"), fEnabled ? List::tr("Enabled") : List::tr("Disabled"));
|
---|
[91416] | 235 |
|
---|
[95177] | 236 | CHECK_ERROR2I(hostOnlyNetwork, COMGETTER(NetworkMask)(bstr.asOutParam()));
|
---|
| 237 | RTPrintf(List::tr("NetworkMask: %ls\n"), bstr.raw());
|
---|
[95178] | 238 |
|
---|
[95177] | 239 | CHECK_ERROR2I(hostOnlyNetwork, COMGETTER(LowerIP)(bstr.asOutParam()));
|
---|
| 240 | RTPrintf(List::tr("LowerIP: %ls\n"), bstr.raw());
|
---|
[95178] | 241 |
|
---|
[95177] | 242 | CHECK_ERROR2I(hostOnlyNetwork, COMGETTER(UpperIP)(bstr.asOutParam()));
|
---|
| 243 | RTPrintf(List::tr("UpperIP: %ls\n"), bstr.raw());
|
---|
| 244 |
|
---|
| 245 | // CHECK_ERROR2I(hostOnlyNetwork, COMGETTER(Id)(bstr.asOutParam());
|
---|
| 246 | // RTPrintf("NetworkId: %ls\n", bstr.raw());
|
---|
| 247 |
|
---|
| 248 | RTPrintf(List::tr("VBoxNetworkName: hostonly-%ls\n\n"), bstrNetworkName.raw());
|
---|
[91416] | 249 | }
|
---|
[95177] | 250 | return hrc;
|
---|
[91416] | 251 | }
|
---|
| 252 | #endif /* VBOX_WITH_VMNET */
|
---|
| 253 |
|
---|
| 254 |
|
---|
[83169] | 255 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
[42748] | 256 | /**
|
---|
[83169] | 257 | * List configured cloud network attachments.
|
---|
| 258 | *
|
---|
| 259 | * @returns See produceList.
|
---|
| 260 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 261 | * @param Reserved Placeholder!
|
---|
| 262 | */
|
---|
| 263 | static HRESULT listCloudNetworks(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
| 264 | {
|
---|
| 265 | com::SafeIfaceArray<ICloudNetwork> cloudNetworks;
|
---|
[95177] | 266 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(CloudNetworks)(ComSafeArrayAsOutParam(cloudNetworks)), hrcCheck);
|
---|
[83169] | 267 | for (size_t i = 0; i < cloudNetworks.size(); ++i)
|
---|
| 268 | {
|
---|
| 269 | ComPtr<ICloudNetwork> cloudNetwork = cloudNetworks[i];
|
---|
| 270 | Bstr networkName;
|
---|
| 271 | cloudNetwork->COMGETTER(NetworkName)(networkName.asOutParam());
|
---|
[92372] | 272 | RTPrintf(List::tr("Name: %ls\n"), networkName.raw());
|
---|
[83169] | 273 | // Guid interfaceGuid;
|
---|
| 274 | // cloudNetwork->COMGETTER(Id)(interfaceGuid.asOutParam());
|
---|
| 275 | // RTPrintf("GUID: %ls\n\n", Bstr(interfaceGuid.toString()).raw());
|
---|
| 276 | BOOL fEnabled = FALSE;
|
---|
| 277 | cloudNetwork->COMGETTER(Enabled)(&fEnabled);
|
---|
[92372] | 278 | RTPrintf(List::tr("State: %s\n"), fEnabled ? List::tr("Enabled") : List::tr("Disabled"));
|
---|
[83169] | 279 |
|
---|
| 280 | Bstr Provider;
|
---|
| 281 | cloudNetwork->COMGETTER(Provider)(Provider.asOutParam());
|
---|
[92372] | 282 | RTPrintf(List::tr("CloudProvider: %ls\n"), Provider.raw());
|
---|
[83169] | 283 | Bstr Profile;
|
---|
| 284 | cloudNetwork->COMGETTER(Profile)(Profile.asOutParam());
|
---|
[92372] | 285 | RTPrintf(List::tr("CloudProfile: %ls\n"), Profile.raw());
|
---|
[83169] | 286 | Bstr NetworkId;
|
---|
| 287 | cloudNetwork->COMGETTER(NetworkId)(NetworkId.asOutParam());
|
---|
[92372] | 288 | RTPrintf(List::tr("CloudNetworkId: %ls\n"), NetworkId.raw());
|
---|
[83169] | 289 | Bstr netName = BstrFmt("cloud-%ls", networkName.raw());
|
---|
[92372] | 290 | RTPrintf(List::tr("VBoxNetworkName: %ls\n\n"), netName.raw());
|
---|
[83169] | 291 | }
|
---|
[95177] | 292 | return S_OK;
|
---|
[83169] | 293 | }
|
---|
| 294 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
| 295 |
|
---|
| 296 |
|
---|
| 297 | /**
|
---|
[42748] | 298 | * List host information.
|
---|
| 299 | *
|
---|
| 300 | * @returns See produceList.
|
---|
| 301 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 302 | */
|
---|
| 303 | static HRESULT listHostInfo(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
| 304 | {
|
---|
[60684] | 305 | static struct
|
---|
| 306 | {
|
---|
| 307 | ProcessorFeature_T feature;
|
---|
| 308 | const char *pszName;
|
---|
| 309 | } features[]
|
---|
| 310 | =
|
---|
| 311 | {
|
---|
[92372] | 312 | { ProcessorFeature_HWVirtEx, List::tr("HW virtualization") },
|
---|
[60684] | 313 | { ProcessorFeature_PAE, "PAE" },
|
---|
[92372] | 314 | { ProcessorFeature_LongMode, List::tr("long mode") },
|
---|
| 315 | { ProcessorFeature_NestedPaging, List::tr("nested paging") },
|
---|
| 316 | { ProcessorFeature_UnrestrictedGuest, List::tr("unrestricted guest") },
|
---|
| 317 | { ProcessorFeature_NestedHWVirt, List::tr("nested HW virtualization") },
|
---|
| 318 | { ProcessorFeature_VirtVmsaveVmload, List::tr("virt. vmsave/vmload") },
|
---|
[60684] | 319 | };
|
---|
[95140] | 320 | HRESULT hrc;
|
---|
[42748] | 321 | ComPtr<IHost> Host;
|
---|
| 322 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
| 323 |
|
---|
[92372] | 324 | RTPrintf(List::tr("Host Information:\n\n"));
|
---|
[42748] | 325 |
|
---|
| 326 | LONG64 u64UtcTime = 0;
|
---|
| 327 | CHECK_ERROR(Host, COMGETTER(UTCTime)(&u64UtcTime));
|
---|
| 328 | RTTIMESPEC timeSpec;
|
---|
| 329 | char szTime[32];
|
---|
[92372] | 330 | RTPrintf(List::tr("Host time: %s\n"), RTTimeSpecToString(RTTimeSpecSetMilli(&timeSpec, u64UtcTime), szTime, sizeof(szTime)));
|
---|
[42748] | 331 |
|
---|
| 332 | ULONG processorOnlineCount = 0;
|
---|
| 333 | CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCount)(&processorOnlineCount));
|
---|
[92372] | 334 | RTPrintf(List::tr("Processor online count: %lu\n"), processorOnlineCount);
|
---|
[42748] | 335 | ULONG processorCount = 0;
|
---|
| 336 | CHECK_ERROR(Host, COMGETTER(ProcessorCount)(&processorCount));
|
---|
[92372] | 337 | RTPrintf(List::tr("Processor count: %lu\n"), processorCount);
|
---|
[48765] | 338 | ULONG processorOnlineCoreCount = 0;
|
---|
| 339 | CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCoreCount)(&processorOnlineCoreCount));
|
---|
[92372] | 340 | RTPrintf(List::tr("Processor online core count: %lu\n"), processorOnlineCoreCount);
|
---|
[48765] | 341 | ULONG processorCoreCount = 0;
|
---|
| 342 | CHECK_ERROR(Host, COMGETTER(ProcessorCoreCount)(&processorCoreCount));
|
---|
[92372] | 343 | RTPrintf(List::tr("Processor core count: %lu\n"), processorCoreCount);
|
---|
[60684] | 344 | for (unsigned i = 0; i < RT_ELEMENTS(features); i++)
|
---|
| 345 | {
|
---|
| 346 | BOOL supported;
|
---|
[60685] | 347 | CHECK_ERROR(Host, GetProcessorFeature(features[i].feature, &supported));
|
---|
[92372] | 348 | RTPrintf(List::tr("Processor supports %s: %s\n"), features[i].pszName, supported ? List::tr("yes") : List::tr("no"));
|
---|
[60684] | 349 | }
|
---|
[42748] | 350 | for (ULONG i = 0; i < processorCount; i++)
|
---|
| 351 | {
|
---|
[60684] | 352 | ULONG processorSpeed = 0;
|
---|
[42748] | 353 | CHECK_ERROR(Host, GetProcessorSpeed(i, &processorSpeed));
|
---|
| 354 | if (processorSpeed)
|
---|
[92372] | 355 | RTPrintf(List::tr("Processor#%u speed: %lu MHz\n"), i, processorSpeed);
|
---|
[42748] | 356 | else
|
---|
[92372] | 357 | RTPrintf(List::tr("Processor#%u speed: unknown\n"), i);
|
---|
[60684] | 358 | Bstr processorDescription;
|
---|
[42748] | 359 | CHECK_ERROR(Host, GetProcessorDescription(i, processorDescription.asOutParam()));
|
---|
[92372] | 360 | RTPrintf(List::tr("Processor#%u description: %ls\n"), i, processorDescription.raw());
|
---|
[42748] | 361 | }
|
---|
| 362 |
|
---|
| 363 | ULONG memorySize = 0;
|
---|
| 364 | CHECK_ERROR(Host, COMGETTER(MemorySize)(&memorySize));
|
---|
[92594] | 365 | RTPrintf(List::tr("Memory size: %lu MByte\n", "", memorySize), memorySize);
|
---|
[42748] | 366 |
|
---|
| 367 | ULONG memoryAvailable = 0;
|
---|
| 368 | CHECK_ERROR(Host, COMGETTER(MemoryAvailable)(&memoryAvailable));
|
---|
[92594] | 369 | RTPrintf(List::tr("Memory available: %lu MByte\n", "", memoryAvailable), memoryAvailable);
|
---|
[42748] | 370 |
|
---|
| 371 | Bstr operatingSystem;
|
---|
| 372 | CHECK_ERROR(Host, COMGETTER(OperatingSystem)(operatingSystem.asOutParam()));
|
---|
[92372] | 373 | RTPrintf(List::tr("Operating system: %ls\n"), operatingSystem.raw());
|
---|
[42748] | 374 |
|
---|
| 375 | Bstr oSVersion;
|
---|
| 376 | CHECK_ERROR(Host, COMGETTER(OSVersion)(oSVersion.asOutParam()));
|
---|
[92372] | 377 | RTPrintf(List::tr("Operating system version: %ls\n"), oSVersion.raw());
|
---|
[95140] | 378 | return hrc;
|
---|
[42748] | 379 | }
|
---|
| 380 |
|
---|
| 381 |
|
---|
| 382 | /**
|
---|
| 383 | * List media information.
|
---|
| 384 | *
|
---|
| 385 | * @returns See produceList.
|
---|
| 386 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
[44498] | 387 | * @param aMedia Medium objects to list information for.
|
---|
| 388 | * @param pszParentUUIDStr String with the parent UUID string (or "base").
|
---|
| 389 | * @param fOptLong Long (@c true) or short list format.
|
---|
[42748] | 390 | */
|
---|
| 391 | static HRESULT listMedia(const ComPtr<IVirtualBox> pVirtualBox,
|
---|
| 392 | const com::SafeIfaceArray<IMedium> &aMedia,
|
---|
[44498] | 393 | const char *pszParentUUIDStr,
|
---|
| 394 | bool fOptLong)
|
---|
[42748] | 395 | {
|
---|
[95140] | 396 | HRESULT hrc = S_OK;
|
---|
[28249] | 397 | for (size_t i = 0; i < aMedia.size(); ++i)
|
---|
[27916] | 398 | {
|
---|
[29356] | 399 | ComPtr<IMedium> pMedium = aMedia[i];
|
---|
[27916] | 400 |
|
---|
[95140] | 401 | hrc = showMediumInfo(pVirtualBox, pMedium, pszParentUUIDStr, fOptLong);
|
---|
[27916] | 402 |
|
---|
| 403 | RTPrintf("\n");
|
---|
| 404 |
|
---|
| 405 | com::SafeIfaceArray<IMedium> children;
|
---|
[29356] | 406 | CHECK_ERROR(pMedium, COMGETTER(Children)(ComSafeArrayAsOutParam(children)));
|
---|
[27916] | 407 | if (children.size() > 0)
|
---|
| 408 | {
|
---|
[44498] | 409 | Bstr uuid;
|
---|
| 410 | pMedium->COMGETTER(Id)(uuid.asOutParam());
|
---|
| 411 |
|
---|
[27916] | 412 | // depth first listing of child media
|
---|
[95140] | 413 | hrc = listMedia(pVirtualBox, children, Utf8Str(uuid).c_str(), fOptLong);
|
---|
[27916] | 414 | }
|
---|
| 415 | }
|
---|
[42748] | 416 |
|
---|
[95140] | 417 | return hrc;
|
---|
[27916] | 418 | }
|
---|
| 419 |
|
---|
[33766] | 420 |
|
---|
[33759] | 421 | /**
|
---|
[42748] | 422 | * List virtual image backends.
|
---|
| 423 | *
|
---|
| 424 | * @returns See produceList.
|
---|
| 425 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 426 | */
|
---|
| 427 | static HRESULT listHddBackends(const ComPtr<IVirtualBox> pVirtualBox)
|
---|
| 428 | {
|
---|
[95140] | 429 | HRESULT hrc;
|
---|
[42748] | 430 | ComPtr<ISystemProperties> systemProperties;
|
---|
| 431 | CHECK_ERROR(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
|
---|
| 432 | com::SafeIfaceArray<IMediumFormat> mediumFormats;
|
---|
| 433 | CHECK_ERROR(systemProperties, COMGETTER(MediumFormats)(ComSafeArrayAsOutParam(mediumFormats)));
|
---|
| 434 |
|
---|
[92372] | 435 | RTPrintf(List::tr("Supported hard disk backends:\n\n"));
|
---|
[42748] | 436 | for (size_t i = 0; i < mediumFormats.size(); ++i)
|
---|
| 437 | {
|
---|
| 438 | /* General information */
|
---|
| 439 | Bstr id;
|
---|
| 440 | CHECK_ERROR(mediumFormats[i], COMGETTER(Id)(id.asOutParam()));
|
---|
| 441 |
|
---|
| 442 | Bstr description;
|
---|
| 443 | CHECK_ERROR(mediumFormats[i],
|
---|
[45065] | 444 | COMGETTER(Name)(description.asOutParam()));
|
---|
[42748] | 445 |
|
---|
[44503] | 446 | ULONG caps = 0;
|
---|
| 447 | com::SafeArray <MediumFormatCapabilities_T> mediumFormatCap;
|
---|
[42748] | 448 | CHECK_ERROR(mediumFormats[i],
|
---|
[44503] | 449 | COMGETTER(Capabilities)(ComSafeArrayAsOutParam(mediumFormatCap)));
|
---|
| 450 | for (ULONG j = 0; j < mediumFormatCap.size(); j++)
|
---|
| 451 | caps |= mediumFormatCap[j];
|
---|
[42748] | 452 |
|
---|
[44503] | 453 |
|
---|
[92372] | 454 | RTPrintf(List::tr("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='"),
|
---|
[42748] | 455 | i, id.raw(), description.raw(), caps);
|
---|
| 456 |
|
---|
| 457 | /* File extensions */
|
---|
[48538] | 458 | com::SafeArray<BSTR> fileExtensions;
|
---|
| 459 | com::SafeArray<DeviceType_T> deviceTypes;
|
---|
[42748] | 460 | CHECK_ERROR(mediumFormats[i],
|
---|
| 461 | DescribeFileExtensions(ComSafeArrayAsOutParam(fileExtensions), ComSafeArrayAsOutParam(deviceTypes)));
|
---|
| 462 | for (size_t j = 0; j < fileExtensions.size(); ++j)
|
---|
| 463 | {
|
---|
| 464 | RTPrintf("%ls (%s)", Bstr(fileExtensions[j]).raw(), getDeviceTypeText(deviceTypes[j]));
|
---|
| 465 | if (j != fileExtensions.size()-1)
|
---|
| 466 | RTPrintf(",");
|
---|
| 467 | }
|
---|
| 468 | RTPrintf("'");
|
---|
| 469 |
|
---|
| 470 | /* Configuration keys */
|
---|
[48538] | 471 | com::SafeArray<BSTR> propertyNames;
|
---|
| 472 | com::SafeArray<BSTR> propertyDescriptions;
|
---|
| 473 | com::SafeArray<DataType_T> propertyTypes;
|
---|
| 474 | com::SafeArray<ULONG> propertyFlags;
|
---|
| 475 | com::SafeArray<BSTR> propertyDefaults;
|
---|
[42748] | 476 | CHECK_ERROR(mediumFormats[i],
|
---|
| 477 | DescribeProperties(ComSafeArrayAsOutParam(propertyNames),
|
---|
| 478 | ComSafeArrayAsOutParam(propertyDescriptions),
|
---|
| 479 | ComSafeArrayAsOutParam(propertyTypes),
|
---|
| 480 | ComSafeArrayAsOutParam(propertyFlags),
|
---|
| 481 | ComSafeArrayAsOutParam(propertyDefaults)));
|
---|
| 482 |
|
---|
[92372] | 483 | RTPrintf(List::tr(" properties=("));
|
---|
[42748] | 484 | if (propertyNames.size() > 0)
|
---|
| 485 | {
|
---|
| 486 | for (size_t j = 0; j < propertyNames.size(); ++j)
|
---|
| 487 | {
|
---|
[92372] | 488 | RTPrintf(List::tr("\n name='%ls' desc='%ls' type="),
|
---|
[42748] | 489 | Bstr(propertyNames[j]).raw(), Bstr(propertyDescriptions[j]).raw());
|
---|
| 490 | switch (propertyTypes[j])
|
---|
| 491 | {
|
---|
[92372] | 492 | case DataType_Int32: RTPrintf(List::tr("int")); break;
|
---|
| 493 | case DataType_Int8: RTPrintf(List::tr("byte")); break;
|
---|
| 494 | case DataType_String: RTPrintf(List::tr("string")); break;
|
---|
[72976] | 495 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
| 496 | case DataType_32BitHack: break; /* Shut up compiler warnings. */
|
---|
| 497 | #endif
|
---|
[42748] | 498 | }
|
---|
[92372] | 499 | RTPrintf(List::tr(" flags=%#04x"), propertyFlags[j]);
|
---|
| 500 | RTPrintf(List::tr(" default='%ls'"), Bstr(propertyDefaults[j]).raw());
|
---|
[42748] | 501 | if (j != propertyNames.size()-1)
|
---|
| 502 | RTPrintf(", ");
|
---|
| 503 | }
|
---|
| 504 | }
|
---|
| 505 | RTPrintf(")\n");
|
---|
| 506 | }
|
---|
[95140] | 507 | return hrc;
|
---|
[42748] | 508 | }
|
---|
| 509 |
|
---|
| 510 |
|
---|
| 511 | /**
|
---|
| 512 | * List USB devices attached to the host.
|
---|
| 513 | *
|
---|
| 514 | * @returns See produceList.
|
---|
| 515 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 516 | */
|
---|
| 517 | static HRESULT listUsbHost(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
| 518 | {
|
---|
[95140] | 519 | HRESULT hrc;
|
---|
[42748] | 520 | ComPtr<IHost> Host;
|
---|
| 521 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(Host)(Host.asOutParam()), 1);
|
---|
| 522 |
|
---|
| 523 | SafeIfaceArray<IHostUSBDevice> CollPtr;
|
---|
| 524 | CHECK_ERROR_RET(Host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(CollPtr)), 1);
|
---|
| 525 |
|
---|
[92372] | 526 | RTPrintf(List::tr("Host USB Devices:\n\n"));
|
---|
[42748] | 527 |
|
---|
| 528 | if (CollPtr.size() == 0)
|
---|
| 529 | {
|
---|
[92372] | 530 | RTPrintf(List::tr("<none>\n\n"));
|
---|
[42748] | 531 | }
|
---|
| 532 | else
|
---|
| 533 | {
|
---|
| 534 | for (size_t i = 0; i < CollPtr.size(); ++i)
|
---|
| 535 | {
|
---|
[47908] | 536 | ComPtr<IHostUSBDevice> dev = CollPtr[i];
|
---|
[42748] | 537 |
|
---|
| 538 | /* Query info. */
|
---|
| 539 | Bstr id;
|
---|
| 540 | CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), 1);
|
---|
| 541 | USHORT usVendorId;
|
---|
| 542 | CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), 1);
|
---|
| 543 | USHORT usProductId;
|
---|
| 544 | CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), 1);
|
---|
| 545 | USHORT bcdRevision;
|
---|
| 546 | CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), 1);
|
---|
| 547 | USHORT usPort;
|
---|
| 548 | CHECK_ERROR_RET(dev, COMGETTER(Port)(&usPort), 1);
|
---|
| 549 | USHORT usVersion;
|
---|
| 550 | CHECK_ERROR_RET(dev, COMGETTER(Version)(&usVersion), 1);
|
---|
[53297] | 551 | USBConnectionSpeed_T enmSpeed;
|
---|
| 552 | CHECK_ERROR_RET(dev, COMGETTER(Speed)(&enmSpeed), 1);
|
---|
[42748] | 553 |
|
---|
[92372] | 554 | RTPrintf(List::tr(
|
---|
| 555 | "UUID: %s\n"
|
---|
| 556 | "VendorId: %#06x (%04X)\n"
|
---|
| 557 | "ProductId: %#06x (%04X)\n"
|
---|
| 558 | "Revision: %u.%u (%02u%02u)\n"
|
---|
| 559 | "Port: %u\n"),
|
---|
[42748] | 560 | Utf8Str(id).c_str(),
|
---|
| 561 | usVendorId, usVendorId, usProductId, usProductId,
|
---|
| 562 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
| 563 | bcdRevision >> 8, bcdRevision & 0xff,
|
---|
[53297] | 564 | usPort);
|
---|
[42748] | 565 |
|
---|
[53297] | 566 | const char *pszSpeed = "?";
|
---|
| 567 | switch (enmSpeed)
|
---|
| 568 | {
|
---|
| 569 | case USBConnectionSpeed_Low:
|
---|
[92372] | 570 | pszSpeed = List::tr("Low");
|
---|
[53297] | 571 | break;
|
---|
| 572 | case USBConnectionSpeed_Full:
|
---|
[92372] | 573 | pszSpeed = List::tr("Full");
|
---|
[53297] | 574 | break;
|
---|
| 575 | case USBConnectionSpeed_High:
|
---|
[92372] | 576 | pszSpeed = List::tr("High");
|
---|
[53297] | 577 | break;
|
---|
| 578 | case USBConnectionSpeed_Super:
|
---|
[92372] | 579 | pszSpeed = List::tr("Super");
|
---|
[53297] | 580 | break;
|
---|
| 581 | case USBConnectionSpeed_SuperPlus:
|
---|
[92372] | 582 | pszSpeed = List::tr("SuperPlus");
|
---|
[53297] | 583 | break;
|
---|
| 584 | default:
|
---|
| 585 | ASSERT(false);
|
---|
| 586 | break;
|
---|
| 587 | }
|
---|
| 588 |
|
---|
[92372] | 589 | RTPrintf(List::tr("USB version/speed: %u/%s\n"), usVersion, pszSpeed);
|
---|
[53297] | 590 |
|
---|
[42748] | 591 | /* optional stuff. */
|
---|
[59398] | 592 | SafeArray<BSTR> CollDevInfo;
|
---|
[42748] | 593 | Bstr bstr;
|
---|
[59398] | 594 | CHECK_ERROR_RET(dev, COMGETTER(DeviceInfo)(ComSafeArrayAsOutParam(CollDevInfo)), 1);
|
---|
| 595 | if (CollDevInfo.size() >= 1)
|
---|
| 596 | bstr = Bstr(CollDevInfo[0]);
|
---|
[42748] | 597 | if (!bstr.isEmpty())
|
---|
[92372] | 598 | RTPrintf(List::tr("Manufacturer: %ls\n"), bstr.raw());
|
---|
[59398] | 599 | if (CollDevInfo.size() >= 2)
|
---|
| 600 | bstr = Bstr(CollDevInfo[1]);
|
---|
[42748] | 601 | if (!bstr.isEmpty())
|
---|
[92372] | 602 | RTPrintf(List::tr("Product: %ls\n"), bstr.raw());
|
---|
[42748] | 603 | CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
| 604 | if (!bstr.isEmpty())
|
---|
[92372] | 605 | RTPrintf(List::tr("SerialNumber: %ls\n"), bstr.raw());
|
---|
[42748] | 606 | CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), 1);
|
---|
| 607 | if (!bstr.isEmpty())
|
---|
[92372] | 608 | RTPrintf(List::tr("Address: %ls\n"), bstr.raw());
|
---|
[82407] | 609 | CHECK_ERROR_RET(dev, COMGETTER(PortPath)(bstr.asOutParam()), 1);
|
---|
| 610 | if (!bstr.isEmpty())
|
---|
[92372] | 611 | RTPrintf(List::tr("Port path: %ls\n"), bstr.raw());
|
---|
[42748] | 612 |
|
---|
| 613 | /* current state */
|
---|
| 614 | USBDeviceState_T state;
|
---|
| 615 | CHECK_ERROR_RET(dev, COMGETTER(State)(&state), 1);
|
---|
| 616 | const char *pszState = "?";
|
---|
| 617 | switch (state)
|
---|
| 618 | {
|
---|
| 619 | case USBDeviceState_NotSupported:
|
---|
[92372] | 620 | pszState = List::tr("Not supported");
|
---|
[42748] | 621 | break;
|
---|
| 622 | case USBDeviceState_Unavailable:
|
---|
[92372] | 623 | pszState = List::tr("Unavailable");
|
---|
[42748] | 624 | break;
|
---|
| 625 | case USBDeviceState_Busy:
|
---|
[92372] | 626 | pszState = List::tr("Busy");
|
---|
[42748] | 627 | break;
|
---|
| 628 | case USBDeviceState_Available:
|
---|
[92372] | 629 | pszState = List::tr("Available");
|
---|
[42748] | 630 | break;
|
---|
| 631 | case USBDeviceState_Held:
|
---|
[92372] | 632 | pszState = List::tr("Held");
|
---|
[42748] | 633 | break;
|
---|
| 634 | case USBDeviceState_Captured:
|
---|
[92372] | 635 | pszState = List::tr("Captured");
|
---|
[42748] | 636 | break;
|
---|
| 637 | default:
|
---|
| 638 | ASSERT(false);
|
---|
| 639 | break;
|
---|
| 640 | }
|
---|
[92372] | 641 | RTPrintf(List::tr("Current State: %s\n\n"), pszState);
|
---|
[42748] | 642 | }
|
---|
| 643 | }
|
---|
[95140] | 644 | return hrc;
|
---|
[42748] | 645 | }
|
---|
| 646 |
|
---|
| 647 |
|
---|
| 648 | /**
|
---|
| 649 | * List USB filters.
|
---|
| 650 | *
|
---|
| 651 | * @returns See produceList.
|
---|
| 652 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 653 | */
|
---|
| 654 | static HRESULT listUsbFilters(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
| 655 | {
|
---|
[95140] | 656 | HRESULT hrc;
|
---|
[42748] | 657 |
|
---|
[92372] | 658 | RTPrintf(List::tr("Global USB Device Filters:\n\n"));
|
---|
[42748] | 659 |
|
---|
| 660 | ComPtr<IHost> host;
|
---|
| 661 | CHECK_ERROR_RET(pVirtualBox, COMGETTER(Host)(host.asOutParam()), 1);
|
---|
| 662 |
|
---|
| 663 | SafeIfaceArray<IHostUSBDeviceFilter> coll;
|
---|
| 664 | CHECK_ERROR_RET(host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll)), 1);
|
---|
| 665 |
|
---|
| 666 | if (coll.size() == 0)
|
---|
| 667 | {
|
---|
[92372] | 668 | RTPrintf(List::tr("<none>\n\n"));
|
---|
[42748] | 669 | }
|
---|
| 670 | else
|
---|
| 671 | {
|
---|
| 672 | for (size_t index = 0; index < coll.size(); ++index)
|
---|
| 673 | {
|
---|
| 674 | ComPtr<IHostUSBDeviceFilter> flt = coll[index];
|
---|
| 675 |
|
---|
| 676 | /* Query info. */
|
---|
| 677 |
|
---|
[92372] | 678 | RTPrintf(List::tr("Index: %zu\n"), index);
|
---|
[42748] | 679 |
|
---|
| 680 | BOOL active = FALSE;
|
---|
| 681 | CHECK_ERROR_RET(flt, COMGETTER(Active)(&active), 1);
|
---|
[92372] | 682 | RTPrintf(List::tr("Active: %s\n"), active ? List::tr("yes") : List::tr("no"));
|
---|
[42748] | 683 |
|
---|
| 684 | USBDeviceFilterAction_T action;
|
---|
| 685 | CHECK_ERROR_RET(flt, COMGETTER(Action)(&action), 1);
|
---|
[92372] | 686 | const char *pszAction = List::tr("<invalid>");
|
---|
[42748] | 687 | switch (action)
|
---|
| 688 | {
|
---|
| 689 | case USBDeviceFilterAction_Ignore:
|
---|
[92372] | 690 | pszAction = List::tr("Ignore");
|
---|
[42748] | 691 | break;
|
---|
| 692 | case USBDeviceFilterAction_Hold:
|
---|
[92372] | 693 | pszAction = List::tr("Hold");
|
---|
[42748] | 694 | break;
|
---|
| 695 | default:
|
---|
| 696 | break;
|
---|
| 697 | }
|
---|
[92372] | 698 | RTPrintf(List::tr("Action: %s\n"), pszAction);
|
---|
[42748] | 699 |
|
---|
| 700 | Bstr bstr;
|
---|
| 701 | CHECK_ERROR_RET(flt, COMGETTER(Name)(bstr.asOutParam()), 1);
|
---|
[92372] | 702 | RTPrintf(List::tr("Name: %ls\n"), bstr.raw());
|
---|
[42748] | 703 | CHECK_ERROR_RET(flt, COMGETTER(VendorId)(bstr.asOutParam()), 1);
|
---|
[92372] | 704 | RTPrintf(List::tr("VendorId: %ls\n"), bstr.raw());
|
---|
[42748] | 705 | CHECK_ERROR_RET(flt, COMGETTER(ProductId)(bstr.asOutParam()), 1);
|
---|
[92372] | 706 | RTPrintf(List::tr("ProductId: %ls\n"), bstr.raw());
|
---|
[42748] | 707 | CHECK_ERROR_RET(flt, COMGETTER(Revision)(bstr.asOutParam()), 1);
|
---|
[92372] | 708 | RTPrintf(List::tr("Revision: %ls\n"), bstr.raw());
|
---|
[42748] | 709 | CHECK_ERROR_RET(flt, COMGETTER(Manufacturer)(bstr.asOutParam()), 1);
|
---|
[92372] | 710 | RTPrintf(List::tr("Manufacturer: %ls\n"), bstr.raw());
|
---|
[42748] | 711 | CHECK_ERROR_RET(flt, COMGETTER(Product)(bstr.asOutParam()), 1);
|
---|
[92372] | 712 | RTPrintf(List::tr("Product: %ls\n"), bstr.raw());
|
---|
[42748] | 713 | CHECK_ERROR_RET(flt, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
|
---|
[100772] | 714 | RTPrintf(List::tr("Serial Number: %ls\n"), bstr.raw());
|
---|
| 715 | CHECK_ERROR_RET(flt, COMGETTER(Port)(bstr.asOutParam()), 1);
|
---|
| 716 | RTPrintf(List::tr("Port: %ls\n\n"), bstr.raw());
|
---|
[42748] | 717 | }
|
---|
| 718 | }
|
---|
[95140] | 719 | return hrc;
|
---|
[42748] | 720 | }
|
---|
| 721 |
|
---|
[101126] | 722 | /**
|
---|
| 723 | * Returns the chipset type as a string.
|
---|
| 724 | *
|
---|
| 725 | * @return Chipset type as a string.
|
---|
| 726 | * @param enmType Chipset type to convert.
|
---|
| 727 | */
|
---|
| 728 | static const char *chipsetTypeToStr(ChipsetType_T enmType)
|
---|
| 729 | {
|
---|
| 730 | switch (enmType)
|
---|
| 731 | {
|
---|
| 732 | case ChipsetType_PIIX3: return "PIIX3";
|
---|
| 733 | case ChipsetType_ICH9: return "ICH9";
|
---|
| 734 | case ChipsetType_ARMv8Virtual: return "ARMv8Virtual";
|
---|
| 735 | case ChipsetType_Null:
|
---|
| 736 | default:
|
---|
| 737 | break;
|
---|
| 738 | }
|
---|
[42748] | 739 |
|
---|
[101126] | 740 | return "<Unknown>";
|
---|
| 741 | }
|
---|
| 742 |
|
---|
[42748] | 743 | /**
|
---|
[101126] | 744 | * Returns a platform architecture as a string.
|
---|
| 745 | *
|
---|
| 746 | * @return Platform architecture as a string.
|
---|
| 747 | * @param enmArch Platform architecture to convert.
|
---|
| 748 | */
|
---|
| 749 | static const char *platformArchitectureToStr(PlatformArchitecture_T enmArch)
|
---|
| 750 | {
|
---|
| 751 | switch (enmArch)
|
---|
| 752 | {
|
---|
| 753 | case PlatformArchitecture_x86: return "x86";
|
---|
| 754 | case PlatformArchitecture_ARM: return "ARMv8";
|
---|
| 755 | default:
|
---|
| 756 | break;
|
---|
| 757 | }
|
---|
| 758 |
|
---|
| 759 | return "<Unknown>";
|
---|
| 760 | }
|
---|
| 761 |
|
---|
[103598] | 762 | /**
|
---|
| 763 | * Returns the platform architecture for a given string.
|
---|
| 764 | *
|
---|
| 765 | * @return Platform architecture, or PlatformArchitecture_None if not found.
|
---|
| 766 | * @param pszPlatform Platform architecture to convert.
|
---|
| 767 | */
|
---|
| 768 | static PlatformArchitecture_T platformArchitectureToStr(const char *pszPlatform)
|
---|
| 769 | {
|
---|
| 770 | if ( !RTStrICmp(pszPlatform, "x86")
|
---|
| 771 | || !RTStrICmp(pszPlatform, "x86_64")
|
---|
| 772 | || !RTStrICmp(pszPlatform, "ia32")
|
---|
| 773 | || !RTStrICmp(pszPlatform, "amd64")
|
---|
| 774 | || !RTStrICmp(pszPlatform, "intel"))
|
---|
| 775 | return PlatformArchitecture_x86;
|
---|
| 776 | else if ( !RTStrICmp(pszPlatform, "arm")
|
---|
| 777 | || !RTStrICmp(pszPlatform, "armv8"))
|
---|
| 778 | return PlatformArchitecture_ARM;
|
---|
| 779 | return PlatformArchitecture_None;
|
---|
| 780 | }
|
---|
| 781 |
|
---|
[101126] | 782 | /** @todo r=andy Make use of SHOW_ULONG_PROP and friends like in VBoxManageInfo to have a more uniform / prettier output.
|
---|
| 783 | * Use nesting (as padding / tabs). */
|
---|
| 784 |
|
---|
| 785 | /**
|
---|
| 786 | * List chipset properties.
|
---|
| 787 | *
|
---|
| 788 | * @returns See produceList.
|
---|
| 789 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 790 | */
|
---|
| 791 | static HRESULT listPlatformChipsetProperties(const ComPtr<IPlatformProperties> &pPlatformProperties, ChipsetType_T enmChipsetType)
|
---|
| 792 | {
|
---|
| 793 | const char *pszChipset = chipsetTypeToStr(enmChipsetType);
|
---|
| 794 | AssertPtrReturn(pszChipset, E_INVALIDARG);
|
---|
| 795 |
|
---|
| 796 | /* Note: Keep the chipset name within the description -- makes it easier to grep for specific chipsts manually. */
|
---|
| 797 | ULONG ulValue;
|
---|
| 798 | pPlatformProperties->GetMaxNetworkAdapters(enmChipsetType, &ulValue);
|
---|
| 799 | RTPrintf(List::tr("Maximum %s Network Adapter count: %u\n"), pszChipset, ulValue);
|
---|
| 800 | pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_IDE, &ulValue);
|
---|
| 801 | RTPrintf(List::tr("Maximum %s IDE Controllers: %u\n"), pszChipset, ulValue);
|
---|
| 802 | pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_SATA, &ulValue);
|
---|
| 803 | RTPrintf(List::tr("Maximum %s SATA Controllers: %u\n"), pszChipset, ulValue);
|
---|
| 804 | pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_SCSI, &ulValue);
|
---|
| 805 | RTPrintf(List::tr("Maximum %s SCSI Controllers: %u\n"), pszChipset, ulValue);
|
---|
| 806 | pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_SAS, &ulValue);
|
---|
| 807 | RTPrintf(List::tr("Maximum %s SAS Controllers: %u\n"), pszChipset, ulValue);
|
---|
| 808 | pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_PCIe, &ulValue);
|
---|
| 809 | RTPrintf(List::tr("Maximum %s NVMe Controllers: %u\n"), pszChipset, ulValue);
|
---|
| 810 | pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_VirtioSCSI, &ulValue);
|
---|
| 811 | RTPrintf(List::tr("Maximum %s virtio-scsi Controllers: %u\n"), pszChipset, ulValue);
|
---|
| 812 | pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_Floppy, &ulValue);
|
---|
| 813 | RTPrintf(List::tr("Maximum %s Floppy Controllers:%u\n"), pszChipset, ulValue);
|
---|
| 814 |
|
---|
| 815 | return S_OK;
|
---|
| 816 | }
|
---|
| 817 |
|
---|
[101288] | 818 | /**
|
---|
[103598] | 819 | * Shows a single guest OS type.
|
---|
[101288] | 820 | *
|
---|
| 821 | * @returns HRESULT
|
---|
[103598] | 822 | * @param ptrGuestOS Guest OS type to show.
|
---|
| 823 | * @param fLong Set to @true to show the guest OS type information in a not-so-compact mode.
|
---|
[101288] | 824 | */
|
---|
[103598] | 825 | static HRESULT showGuestOSType(ComPtr<IGuestOSType> ptrGuestOS, bool fLong)
|
---|
[101288] | 826 | {
|
---|
[103598] | 827 | PlatformArchitecture_T enmPlatformArch = (PlatformArchitecture_T)PlatformArchitecture_None;
|
---|
| 828 | ptrGuestOS->COMGETTER(PlatformArchitecture)(&enmPlatformArch);
|
---|
| 829 | Bstr guestId;
|
---|
| 830 | Bstr guestDescription;
|
---|
| 831 | ptrGuestOS->COMGETTER(Description)(guestDescription.asOutParam());
|
---|
| 832 | ptrGuestOS->COMGETTER(Id)(guestId.asOutParam());
|
---|
| 833 | Bstr familyId;
|
---|
| 834 | Bstr familyDescription;
|
---|
| 835 | ptrGuestOS->COMGETTER(FamilyId)(familyId.asOutParam());
|
---|
| 836 | ptrGuestOS->COMGETTER(FamilyDescription)(familyDescription.asOutParam());
|
---|
| 837 | Bstr guestOSSubtype;
|
---|
| 838 | ptrGuestOS->COMGETTER(Subtype)(guestOSSubtype.asOutParam());
|
---|
| 839 | BOOL fIs64Bit;
|
---|
| 840 | ptrGuestOS->COMGETTER(Is64Bit)(&fIs64Bit);
|
---|
| 841 |
|
---|
| 842 | if (fLong)
|
---|
[101288] | 843 | {
|
---|
[103598] | 844 | RTPrintf( "ID: %ls\n", guestId.raw());
|
---|
| 845 | RTPrintf(List::tr("Description: %ls\n"), guestDescription.raw());
|
---|
| 846 | RTPrintf(List::tr("Family ID: %ls\n"), familyId.raw());
|
---|
| 847 | RTPrintf(List::tr("Family Desc: %ls\n"), familyDescription.raw());
|
---|
[101593] | 848 | if (guestOSSubtype.isNotEmpty())
|
---|
[103598] | 849 | RTPrintf(List::tr("OS Subtype: %ls\n"), guestOSSubtype.raw());
|
---|
| 850 | RTPrintf(List::tr("Architecture: %s\n"), platformArchitectureToStr(enmPlatformArch));
|
---|
| 851 | RTPrintf(List::tr("64 bit: %RTbool\n"), fIs64Bit);
|
---|
[101288] | 852 | }
|
---|
[103598] | 853 | else
|
---|
| 854 | {
|
---|
| 855 | RTPrintf( "ID / Description: %ls -- %ls\n", guestId.raw(), guestDescription.raw());
|
---|
| 856 | if (guestOSSubtype.isNotEmpty())
|
---|
| 857 | RTPrintf(List::tr("Family: %ls / %ls (%ls)\n"),
|
---|
| 858 | familyId.raw(), guestOSSubtype.raw(), familyDescription.raw());
|
---|
| 859 | else
|
---|
| 860 | RTPrintf(List::tr("Family: %ls (%ls)\n"), familyId.raw(), familyDescription.raw());
|
---|
| 861 | RTPrintf(List::tr("Architecture: %s%s\n"), platformArchitectureToStr(enmPlatformArch),
|
---|
| 862 | fIs64Bit ? " (64-bit)" : "");
|
---|
| 863 | }
|
---|
| 864 | RTPrintf("\n");
|
---|
[101288] | 865 |
|
---|
| 866 | return S_OK;
|
---|
| 867 | }
|
---|
| 868 |
|
---|
[103598] | 869 | /**
|
---|
| 870 | * Lists guest OS types.
|
---|
| 871 | *
|
---|
| 872 | * @returns HRESULT
|
---|
| 873 | * @param aGuestOSTypes Reference to guest OS types to list.
|
---|
| 874 | * @param fLong Set to @true to list the OS types in a not-so-compact mode.
|
---|
| 875 | * @param fSorted Set to @true to list the OS types in a sorted manner (by guest OS type ID).
|
---|
| 876 | * @param enmFilterByPlatformArch Filters the output by the given platform architecture, or shows all supported guest OS types
|
---|
| 877 | * if PlatformArchitecture_None is specified.
|
---|
| 878 | */
|
---|
| 879 | static HRESULT listGuestOSTypes(const com::SafeIfaceArray<IGuestOSType> &aGuestOSTypes, bool fLong, bool fSorted,
|
---|
| 880 | PlatformArchitecture_T enmFilterByPlatformArch)
|
---|
| 881 | {
|
---|
| 882 | RTPrintf(List::tr("Supported guest OS types%s:\n\n"),
|
---|
| 883 | enmFilterByPlatformArch != PlatformArchitecture_None ? " (filtered)" : "");
|
---|
| 884 |
|
---|
| 885 | /** Filters the guest OS type output by skipping the current iteration. */
|
---|
| 886 | #define FILTER_OUTPUT(a_GuestOSType) \
|
---|
| 887 | PlatformArchitecture_T enmPlatformArch = (PlatformArchitecture_T)PlatformArchitecture_None; \
|
---|
| 888 | ptrGuestOS->COMGETTER(PlatformArchitecture)(&enmPlatformArch); \
|
---|
| 889 | if ( enmFilterByPlatformArch != PlatformArchitecture_None \
|
---|
| 890 | && enmFilterByPlatformArch != enmPlatformArch) \
|
---|
| 891 | continue;
|
---|
| 892 |
|
---|
| 893 | if (fSorted)
|
---|
| 894 | {
|
---|
| 895 | std::vector<std::pair<com::Bstr, IGuestOSType *> > sortedGuestOSTypes;
|
---|
| 896 | for (size_t i = 0; i < aGuestOSTypes.size(); ++i)
|
---|
| 897 | {
|
---|
| 898 | ComPtr<IGuestOSType> ptrGuestOS = aGuestOSTypes[i];
|
---|
| 899 | FILTER_OUTPUT(ptrGuestOS);
|
---|
| 900 |
|
---|
| 901 | /* We sort by guest type ID. */
|
---|
| 902 | Bstr guestId;
|
---|
| 903 | ptrGuestOS->COMGETTER(Id)(guestId.asOutParam());
|
---|
| 904 | sortedGuestOSTypes.push_back(std::pair<com::Bstr, IGuestOSType *>(guestId, ptrGuestOS));
|
---|
| 905 | }
|
---|
| 906 |
|
---|
| 907 | std::sort(sortedGuestOSTypes.begin(), sortedGuestOSTypes.end());
|
---|
| 908 | for (size_t i = 0; i < sortedGuestOSTypes.size(); ++i)
|
---|
| 909 | showGuestOSType(sortedGuestOSTypes[i].second, fLong);
|
---|
| 910 | }
|
---|
| 911 | else
|
---|
| 912 | {
|
---|
| 913 | for (size_t i = 0; i < aGuestOSTypes.size(); ++i)
|
---|
| 914 | {
|
---|
| 915 | ComPtr<IGuestOSType> ptrGuestOS = aGuestOSTypes[i];
|
---|
| 916 | FILTER_OUTPUT(ptrGuestOS);
|
---|
| 917 |
|
---|
| 918 | showGuestOSType(ptrGuestOS, fLong);
|
---|
| 919 | }
|
---|
| 920 | }
|
---|
| 921 |
|
---|
| 922 | #undef FILTER_OUTPUT
|
---|
| 923 |
|
---|
| 924 | return S_OK;
|
---|
| 925 | }
|
---|
| 926 |
|
---|
[101126] | 927 | static HRESULT listPlatformProperties(const ComPtr<IPlatformProperties> &platformProperties)
|
---|
| 928 | {
|
---|
| 929 | ULONG ulValue;
|
---|
| 930 | platformProperties->COMGETTER(SerialPortCount)(&ulValue);
|
---|
| 931 | RTPrintf(List::tr("Maximum Serial Port count: %u\n"), ulValue);
|
---|
| 932 | platformProperties->COMGETTER(ParallelPortCount)(&ulValue);
|
---|
| 933 | RTPrintf(List::tr("Maximum Parallel Port count: %u\n"), ulValue);
|
---|
| 934 | platformProperties->COMGETTER(MaxBootPosition)(&ulValue);
|
---|
| 935 | RTPrintf(List::tr("Maximum Boot Position: %u\n"), ulValue);
|
---|
| 936 | platformProperties->GetMaxPortCountForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
| 937 | RTPrintf(List::tr("Maximum Floppy Port count: %u\n"), ulValue);
|
---|
| 938 | platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_Floppy, &ulValue);
|
---|
| 939 | RTPrintf(List::tr("Maximum Floppy Devices per Port: %u\n"), ulValue);
|
---|
| 940 | platformProperties->GetMaxPortCountForStorageBus(StorageBus_VirtioSCSI, &ulValue);
|
---|
| 941 | RTPrintf(List::tr("Maximum virtio-scsi Port count: %u\n"), ulValue);
|
---|
| 942 | platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_VirtioSCSI, &ulValue);
|
---|
| 943 | RTPrintf(List::tr("Maximum virtio-scsi Devices per Port: %u\n"), ulValue);
|
---|
| 944 | platformProperties->GetMaxPortCountForStorageBus(StorageBus_IDE, &ulValue);
|
---|
| 945 | RTPrintf(List::tr("Maximum IDE Port count: %u\n"), ulValue);
|
---|
| 946 | platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_IDE, &ulValue);
|
---|
| 947 | RTPrintf(List::tr("Maximum IDE Devices per port: %u\n"), ulValue);
|
---|
| 948 | platformProperties->GetMaxPortCountForStorageBus(StorageBus_SATA, &ulValue);
|
---|
| 949 | RTPrintf(List::tr("Maximum SATA Port count: %u\n"), ulValue);
|
---|
| 950 | platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SATA, &ulValue);
|
---|
| 951 | RTPrintf(List::tr("Maximum SATA Device per port: %u\n"), ulValue);
|
---|
| 952 | platformProperties->GetMaxPortCountForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
| 953 | RTPrintf(List::tr("Maximum SCSI Port count: %u\n"), ulValue);
|
---|
| 954 | platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SCSI, &ulValue);
|
---|
| 955 | RTPrintf(List::tr("Maximum SCSI Devices per port: %u\n"), ulValue);
|
---|
| 956 | platformProperties->GetMaxPortCountForStorageBus(StorageBus_SAS, &ulValue);
|
---|
| 957 | RTPrintf(List::tr("Maximum SAS Port count: %u\n"), ulValue);
|
---|
| 958 | platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SAS, &ulValue);
|
---|
| 959 | RTPrintf(List::tr("Maximum SAS Devices per Port: %u\n"), ulValue);
|
---|
| 960 | platformProperties->GetMaxPortCountForStorageBus(StorageBus_PCIe, &ulValue);
|
---|
| 961 | RTPrintf(List::tr("Maximum NVMe Port count: %u\n"), ulValue);
|
---|
| 962 | platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_PCIe, &ulValue);
|
---|
| 963 | RTPrintf(List::tr("Maximum NVMe Devices per Port: %u\n"), ulValue);
|
---|
| 964 |
|
---|
| 965 | SafeArray <ChipsetType_T> saChipset;
|
---|
| 966 | platformProperties->COMGETTER(SupportedChipsetTypes(ComSafeArrayAsOutParam(saChipset)));
|
---|
| 967 |
|
---|
| 968 | RTPrintf(List::tr("Supported chipsets: "));
|
---|
| 969 | for (size_t i = 0; i < saChipset.size(); i++)
|
---|
| 970 | {
|
---|
| 971 | if (i > 0)
|
---|
| 972 | RTPrintf(", ");
|
---|
| 973 | RTPrintf("%s", chipsetTypeToStr(saChipset[i]));
|
---|
| 974 | }
|
---|
| 975 | RTPrintf("\n");
|
---|
| 976 |
|
---|
| 977 | for (size_t i = 0; i < saChipset.size(); i++)
|
---|
| 978 | {
|
---|
| 979 | if (i > 0)
|
---|
| 980 | RTPrintf("\n");
|
---|
| 981 | RTPrintf(List::tr("%s chipset properties:\n"), chipsetTypeToStr(saChipset[i]));
|
---|
| 982 | listPlatformChipsetProperties(platformProperties, saChipset[i]);
|
---|
| 983 | }
|
---|
| 984 |
|
---|
| 985 | return S_OK;
|
---|
| 986 | }
|
---|
| 987 |
|
---|
| 988 | /**
|
---|
[42748] | 989 | * List system properties.
|
---|
| 990 | *
|
---|
| 991 | * @returns See produceList.
|
---|
| 992 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 993 | */
|
---|
| 994 | static HRESULT listSystemProperties(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
| 995 | {
|
---|
| 996 | ComPtr<ISystemProperties> systemProperties;
|
---|
[74431] | 997 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);
|
---|
[42748] | 998 |
|
---|
[101126] | 999 | ComPtr<IPlatformProperties> hostPlatformProperties;
|
---|
| 1000 | CHECK_ERROR2I_RET(systemProperties, COMGETTER(Platform)(hostPlatformProperties.asOutParam()), hrcCheck);
|
---|
[101035] | 1001 |
|
---|
[42748] | 1002 | Bstr str;
|
---|
| 1003 | ULONG ulValue;
|
---|
| 1004 | LONG64 i64Value;
|
---|
[47991] | 1005 | BOOL fValue;
|
---|
[61577] | 1006 | const char *psz;
|
---|
[42748] | 1007 |
|
---|
| 1008 | pVirtualBox->COMGETTER(APIVersion)(str.asOutParam());
|
---|
[92372] | 1009 | RTPrintf(List::tr("API version: %ls\n"), str.raw());
|
---|
[42748] | 1010 |
|
---|
| 1011 | systemProperties->COMGETTER(MinGuestRAM)(&ulValue);
|
---|
[92594] | 1012 | RTPrintf(List::tr("Minimum guest RAM size: %u Megabytes\n", "", ulValue), ulValue);
|
---|
[42748] | 1013 | systemProperties->COMGETTER(MaxGuestRAM)(&ulValue);
|
---|
[92594] | 1014 | RTPrintf(List::tr("Maximum guest RAM size: %u Megabytes\n", "", ulValue), ulValue);
|
---|
[42748] | 1015 | systemProperties->COMGETTER(MinGuestVRAM)(&ulValue);
|
---|
[92594] | 1016 | RTPrintf(List::tr("Minimum video RAM size: %u Megabytes\n", "", ulValue), ulValue);
|
---|
[42748] | 1017 | systemProperties->COMGETTER(MaxGuestVRAM)(&ulValue);
|
---|
[92594] | 1018 | RTPrintf(List::tr("Maximum video RAM size: %u Megabytes\n", "", ulValue), ulValue);
|
---|
[46116] | 1019 | systemProperties->COMGETTER(MaxGuestMonitors)(&ulValue);
|
---|
[92372] | 1020 | RTPrintf(List::tr("Maximum guest monitor count: %u\n"), ulValue);
|
---|
[42748] | 1021 | systemProperties->COMGETTER(MinGuestCPUCount)(&ulValue);
|
---|
[92372] | 1022 | RTPrintf(List::tr("Minimum guest CPU count: %u\n"), ulValue);
|
---|
[42748] | 1023 | systemProperties->COMGETTER(MaxGuestCPUCount)(&ulValue);
|
---|
[92372] | 1024 | RTPrintf(List::tr("Maximum guest CPU count: %u\n"), ulValue);
|
---|
[42748] | 1025 | systemProperties->COMGETTER(InfoVDSize)(&i64Value);
|
---|
[92594] | 1026 | RTPrintf(List::tr("Virtual disk limit (info): %lld Bytes\n", "" , i64Value), i64Value);
|
---|
[101126] | 1027 |
|
---|
[46116] | 1028 | #if 0
|
---|
| 1029 | systemProperties->GetFreeDiskSpaceWarning(&i64Value);
|
---|
[92594] | 1030 | RTPrintf(List::tr("Free disk space warning at: %u Bytes\n", "", i64Value), i64Value);
|
---|
[46116] | 1031 | systemProperties->GetFreeDiskSpacePercentWarning(&ulValue);
|
---|
[92372] | 1032 | RTPrintf(List::tr("Free disk space warning at: %u %%\n"), ulValue);
|
---|
[46116] | 1033 | systemProperties->GetFreeDiskSpaceError(&i64Value);
|
---|
[92594] | 1034 | RTPrintf(List::tr("Free disk space error at: %u Bytes\n", "", i64Value), i64Value);
|
---|
[46116] | 1035 | systemProperties->GetFreeDiskSpacePercentError(&ulValue);
|
---|
[92372] | 1036 | RTPrintf(List::tr("Free disk space error at: %u %%\n"), ulValue);
|
---|
[46116] | 1037 | #endif
|
---|
[42748] | 1038 | systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam());
|
---|
[92372] | 1039 | RTPrintf(List::tr("Default machine folder: %ls\n"), str.raw());
|
---|
[101126] | 1040 | hostPlatformProperties->COMGETTER(RawModeSupported)(&fValue);
|
---|
[92372] | 1041 | RTPrintf(List::tr("Raw-mode Supported: %s\n"), fValue ? List::tr("yes") : List::tr("no"));
|
---|
[101126] | 1042 | hostPlatformProperties->COMGETTER(ExclusiveHwVirt)(&fValue);
|
---|
[92372] | 1043 | RTPrintf(List::tr("Exclusive HW virtualization use: %s\n"), fValue ? List::tr("on") : List::tr("off"));
|
---|
[46122] | 1044 | systemProperties->COMGETTER(DefaultHardDiskFormat)(str.asOutParam());
|
---|
[92372] | 1045 | RTPrintf(List::tr("Default hard disk format: %ls\n"), str.raw());
|
---|
[42748] | 1046 | systemProperties->COMGETTER(VRDEAuthLibrary)(str.asOutParam());
|
---|
[92372] | 1047 | RTPrintf(List::tr("VRDE auth library: %ls\n"), str.raw());
|
---|
[42748] | 1048 | systemProperties->COMGETTER(WebServiceAuthLibrary)(str.asOutParam());
|
---|
[92372] | 1049 | RTPrintf(List::tr("Webservice auth. library: %ls\n"), str.raw());
|
---|
[42748] | 1050 | systemProperties->COMGETTER(DefaultVRDEExtPack)(str.asOutParam());
|
---|
[92372] | 1051 | RTPrintf(List::tr("Remote desktop ExtPack: %ls\n"), str.raw());
|
---|
[94714] | 1052 | systemProperties->COMGETTER(DefaultCryptoExtPack)(str.asOutParam());
|
---|
| 1053 | RTPrintf(List::tr("VM encryption ExtPack: %ls\n"), str.raw());
|
---|
[42748] | 1054 | systemProperties->COMGETTER(LogHistoryCount)(&ulValue);
|
---|
[92372] | 1055 | RTPrintf(List::tr("Log history count: %u\n"), ulValue);
|
---|
[46116] | 1056 | systemProperties->COMGETTER(DefaultFrontend)(str.asOutParam());
|
---|
[92372] | 1057 | RTPrintf(List::tr("Default frontend: %ls\n"), str.raw());
|
---|
[61577] | 1058 | AudioDriverType_T enmAudio;
|
---|
| 1059 | systemProperties->COMGETTER(DefaultAudioDriver)(&enmAudio);
|
---|
| 1060 | switch (enmAudio)
|
---|
| 1061 | {
|
---|
[95364] | 1062 | case AudioDriverType_Default: psz = List::tr("Default"); break;
|
---|
| 1063 | case AudioDriverType_Null: psz = List::tr("Null"); break;
|
---|
| 1064 | case AudioDriverType_OSS: psz = "OSS"; break;
|
---|
| 1065 | case AudioDriverType_ALSA: psz = "ALSA"; break;
|
---|
| 1066 | case AudioDriverType_Pulse: psz = "PulseAudio"; break;
|
---|
| 1067 | case AudioDriverType_WinMM: psz = "WinMM"; break;
|
---|
| 1068 | case AudioDriverType_DirectSound: psz = "DirectSound"; break;
|
---|
| 1069 | case AudioDriverType_WAS: psz = "Windows Audio Session"; break;
|
---|
| 1070 | case AudioDriverType_CoreAudio: psz = "CoreAudio"; break;
|
---|
| 1071 | case AudioDriverType_SolAudio: psz = "SolAudio"; break;
|
---|
| 1072 | case AudioDriverType_MMPM: psz = "MMPM"; break;
|
---|
[92372] | 1073 | default: psz = List::tr("Unknown");
|
---|
[61577] | 1074 | }
|
---|
[92372] | 1075 | RTPrintf(List::tr("Default audio driver: %s\n"), psz);
|
---|
[42748] | 1076 | systemProperties->COMGETTER(AutostartDatabasePath)(str.asOutParam());
|
---|
[92372] | 1077 | RTPrintf(List::tr("Autostart database path: %ls\n"), str.raw());
|
---|
[42748] | 1078 | systemProperties->COMGETTER(DefaultAdditionsISO)(str.asOutParam());
|
---|
[92372] | 1079 | RTPrintf(List::tr("Default Guest Additions ISO: %ls\n"), str.raw());
|
---|
[55843] | 1080 | systemProperties->COMGETTER(LoggingLevel)(str.asOutParam());
|
---|
[92372] | 1081 | RTPrintf(List::tr("Logging Level: %ls\n"), str.raw());
|
---|
[74431] | 1082 | ProxyMode_T enmProxyMode = (ProxyMode_T)42;
|
---|
| 1083 | systemProperties->COMGETTER(ProxyMode)(&enmProxyMode);
|
---|
[92372] | 1084 | psz = List::tr("Unknown");
|
---|
[74431] | 1085 | switch (enmProxyMode)
|
---|
| 1086 | {
|
---|
[92372] | 1087 | case ProxyMode_System: psz = List::tr("System"); break;
|
---|
| 1088 | case ProxyMode_NoProxy: psz = List::tr("NoProxy"); break;
|
---|
| 1089 | case ProxyMode_Manual: psz = List::tr("Manual"); break;
|
---|
[74432] | 1090 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
| 1091 | case ProxyMode_32BitHack: break; /* Shut up compiler warnings. */
|
---|
| 1092 | #endif
|
---|
[74431] | 1093 | }
|
---|
[92372] | 1094 | RTPrintf(List::tr("Proxy Mode: %s\n"), psz);
|
---|
[74431] | 1095 | systemProperties->COMGETTER(ProxyURL)(str.asOutParam());
|
---|
[92372] | 1096 | RTPrintf(List::tr("Proxy URL: %ls\n"), str.raw());
|
---|
[94643] | 1097 | #ifdef VBOX_WITH_MAIN_NLS
|
---|
| 1098 | systemProperties->COMGETTER(LanguageId)(str.asOutParam());
|
---|
| 1099 | RTPrintf(List::tr("User language: %ls\n"), str.raw());
|
---|
| 1100 | #endif
|
---|
[101126] | 1101 |
|
---|
| 1102 | RTPrintf("Host platform properties:\n");
|
---|
| 1103 | listPlatformProperties(hostPlatformProperties);
|
---|
| 1104 |
|
---|
| 1105 | /* Separate host system / platform properties stuff from guest platform properties a bit. */
|
---|
| 1106 | RTPrintf("\n");
|
---|
| 1107 |
|
---|
| 1108 | SafeArray <PlatformArchitecture_T> saPlatformArch;
|
---|
| 1109 | systemProperties->COMGETTER(SupportedPlatformArchitectures(ComSafeArrayAsOutParam(saPlatformArch)));
|
---|
| 1110 | RTPrintf("Supported platform architectures: ");
|
---|
| 1111 | for (size_t i = 0; i < saPlatformArch.size(); ++i)
|
---|
| 1112 | {
|
---|
| 1113 | if (i > 0)
|
---|
| 1114 | RTPrintf(",");
|
---|
| 1115 | RTPrintf(platformArchitectureToStr(saPlatformArch[i]));
|
---|
| 1116 | }
|
---|
| 1117 | RTPrintf("\n\n");
|
---|
| 1118 |
|
---|
| 1119 | for (size_t i = 0; i < saPlatformArch.size(); ++i)
|
---|
| 1120 | {
|
---|
| 1121 | if (i > 0)
|
---|
| 1122 | RTPrintf("\n");
|
---|
| 1123 | ComPtr<IPlatformProperties> platformProperties;
|
---|
[101128] | 1124 | pVirtualBox->GetPlatformProperties(saPlatformArch[i], platformProperties.asOutParam());
|
---|
[101126] | 1125 | RTPrintf(List::tr("%s platform properties:\n"), platformArchitectureToStr(saPlatformArch[i]));
|
---|
| 1126 | listPlatformProperties(platformProperties);
|
---|
| 1127 | }
|
---|
| 1128 |
|
---|
[94643] | 1129 | return S_OK;
|
---|
| 1130 | }
|
---|
| 1131 |
|
---|
| 1132 | #ifdef VBOX_WITH_UPDATE_AGENT
|
---|
| 1133 | static HRESULT listUpdateAgentConfig(ComPtr<IUpdateAgent> ptrUpdateAgent)
|
---|
| 1134 | {
|
---|
| 1135 | BOOL fValue;
|
---|
| 1136 | ptrUpdateAgent->COMGETTER(Enabled)(&fValue);
|
---|
| 1137 | RTPrintf(List::tr("Enabled: %s\n"), fValue ? List::tr("yes") : List::tr("no"));
|
---|
| 1138 | ULONG ulValue;
|
---|
| 1139 | ptrUpdateAgent->COMGETTER(CheckCount)(&ulValue);
|
---|
| 1140 | RTPrintf(List::tr("Check count: %u\n"), ulValue);
|
---|
| 1141 | ptrUpdateAgent->COMGETTER(CheckFrequency)(&ulValue);
|
---|
[85683] | 1142 | if (ulValue == 0)
|
---|
[94643] | 1143 | RTPrintf(List::tr("Check frequency: never\n"));
|
---|
[85683] | 1144 | else if (ulValue == 1)
|
---|
[94643] | 1145 | RTPrintf(List::tr("Check frequency: every day\n"));
|
---|
[85683] | 1146 | else
|
---|
[94643] | 1147 | RTPrintf(List::tr("Check frequency: every %u days\n", "", ulValue), ulValue);
|
---|
| 1148 |
|
---|
| 1149 | Bstr str;
|
---|
| 1150 | const char *psz;
|
---|
| 1151 | UpdateChannel_T enmUpdateChannel;
|
---|
| 1152 | ptrUpdateAgent->COMGETTER(Channel)(&enmUpdateChannel);
|
---|
| 1153 | switch (enmUpdateChannel)
|
---|
[85683] | 1154 | {
|
---|
[94643] | 1155 | case UpdateChannel_Stable:
|
---|
| 1156 | psz = List::tr("Stable: Maintenance and minor releases within the same major release");
|
---|
[85683] | 1157 | break;
|
---|
[94643] | 1158 | case UpdateChannel_All:
|
---|
| 1159 | psz = List::tr("All releases: All stable releases, including major versions");
|
---|
[85683] | 1160 | break;
|
---|
[94643] | 1161 | case UpdateChannel_WithBetas:
|
---|
| 1162 | psz = List::tr("With Betas: All stable and major releases, including beta versions");
|
---|
[85683] | 1163 | break;
|
---|
[94643] | 1164 | case UpdateChannel_WithTesting:
|
---|
| 1165 | psz = List::tr("With Testing: All stable, major and beta releases, including testing versions");
|
---|
| 1166 | break;
|
---|
[85683] | 1167 | default:
|
---|
[92372] | 1168 | psz = List::tr("Unset");
|
---|
[85683] | 1169 | break;
|
---|
| 1170 | }
|
---|
[94643] | 1171 | RTPrintf(List::tr("Channel: %s\n"), psz);
|
---|
| 1172 | ptrUpdateAgent->COMGETTER(RepositoryURL)(str.asOutParam());
|
---|
| 1173 | RTPrintf(List::tr("Repository: %ls\n"), str.raw());
|
---|
| 1174 | ptrUpdateAgent->COMGETTER(LastCheckDate)(str.asOutParam());
|
---|
[92372] | 1175 | RTPrintf(List::tr("Last check date: %ls\n"), str.raw());
|
---|
[94643] | 1176 |
|
---|
[42748] | 1177 | return S_OK;
|
---|
| 1178 | }
|
---|
| 1179 |
|
---|
[94643] | 1180 | static HRESULT listUpdateAgents(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
| 1181 | {
|
---|
| 1182 | ComPtr<IHost> pHost;
|
---|
| 1183 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(Host)(pHost.asOutParam()), RTEXITCODE_FAILURE);
|
---|
[42748] | 1184 |
|
---|
[94643] | 1185 | ComPtr<IUpdateAgent> pUpdateHost;
|
---|
| 1186 | CHECK_ERROR2I_RET(pHost, COMGETTER(UpdateHost)(pUpdateHost.asOutParam()), RTEXITCODE_FAILURE);
|
---|
| 1187 | /** @todo Add other update agents here. */
|
---|
| 1188 |
|
---|
| 1189 | return listUpdateAgentConfig(pUpdateHost);
|
---|
| 1190 | }
|
---|
| 1191 | #endif /* VBOX_WITH_UPDATE_AGENT */
|
---|
| 1192 |
|
---|
[42748] | 1193 | /**
|
---|
[79748] | 1194 | * Helper for listDhcpServers() that shows a DHCP configuration.
|
---|
[75819] | 1195 | */
|
---|
[79748] | 1196 | static HRESULT showDhcpConfig(ComPtr<IDHCPConfig> ptrConfig)
|
---|
[75819] | 1197 | {
|
---|
[79748] | 1198 | HRESULT hrcRet = S_OK;
|
---|
[75850] | 1199 |
|
---|
[79748] | 1200 | ULONG secs = 0;
|
---|
| 1201 | CHECK_ERROR2I_STMT(ptrConfig, COMGETTER(MinLeaseTime)(&secs), hrcRet = hrcCheck);
|
---|
| 1202 | if (secs == 0)
|
---|
[92372] | 1203 | RTPrintf(List::tr(" minLeaseTime: default\n"));
|
---|
[79748] | 1204 | else
|
---|
[92372] | 1205 | RTPrintf(List::tr(" minLeaseTime: %u sec\n"), secs);
|
---|
[79748] | 1206 |
|
---|
| 1207 | secs = 0;
|
---|
| 1208 | CHECK_ERROR2I_STMT(ptrConfig, COMGETTER(DefaultLeaseTime)(&secs), hrcRet = hrcCheck);
|
---|
| 1209 | if (secs == 0)
|
---|
[92372] | 1210 | RTPrintf(List::tr(" defaultLeaseTime: default\n"));
|
---|
[79748] | 1211 | else
|
---|
[92372] | 1212 | RTPrintf(List::tr(" defaultLeaseTime: %u sec\n"), secs);
|
---|
[79748] | 1213 |
|
---|
| 1214 | secs = 0;
|
---|
| 1215 | CHECK_ERROR2I_STMT(ptrConfig, COMGETTER(MaxLeaseTime)(&secs), hrcRet = hrcCheck);
|
---|
| 1216 | if (secs == 0)
|
---|
[92372] | 1217 | RTPrintf(List::tr(" maxLeaseTime: default\n"));
|
---|
[79748] | 1218 | else
|
---|
[92372] | 1219 | RTPrintf(List::tr(" maxLeaseTime: %u sec\n"), secs);
|
---|
[79748] | 1220 |
|
---|
[79847] | 1221 | com::SafeArray<DHCPOption_T> Options;
|
---|
[79867] | 1222 | HRESULT hrc;
|
---|
| 1223 | CHECK_ERROR2_STMT(hrc, ptrConfig, COMGETTER(ForcedOptions(ComSafeArrayAsOutParam(Options))), hrcRet = hrc);
|
---|
| 1224 | if (FAILED(hrc))
|
---|
[92372] | 1225 | RTPrintf(List::tr(" Forced options: %Rhrc\n"), hrc);
|
---|
[79867] | 1226 | else if (Options.size() == 0)
|
---|
[92372] | 1227 | RTPrintf(List::tr(" Forced options: None\n"));
|
---|
[79867] | 1228 | else
|
---|
| 1229 | {
|
---|
[92372] | 1230 | RTPrintf(List::tr(" Forced options: "));
|
---|
[79867] | 1231 | for (size_t i = 0; i < Options.size(); i++)
|
---|
| 1232 | RTPrintf(i ? ", %u" : "%u", Options[i]);
|
---|
| 1233 | RTPrintf("\n");
|
---|
| 1234 | }
|
---|
| 1235 |
|
---|
| 1236 | CHECK_ERROR2_STMT(hrc, ptrConfig, COMGETTER(SuppressedOptions(ComSafeArrayAsOutParam(Options))), hrcRet = hrc);
|
---|
| 1237 | if (FAILED(hrc))
|
---|
[92372] | 1238 | RTPrintf(List::tr(" Suppressed opt.s: %Rhrc\n"), hrc);
|
---|
[79867] | 1239 | else if (Options.size() == 0)
|
---|
[92372] | 1240 | RTPrintf(List::tr(" Suppressed opts.: None\n"));
|
---|
[79867] | 1241 | else
|
---|
| 1242 | {
|
---|
[92372] | 1243 | RTPrintf(List::tr(" Suppressed opts.: "));
|
---|
[79867] | 1244 | for (size_t i = 0; i < Options.size(); i++)
|
---|
| 1245 | RTPrintf(i ? ", %u" : "%u", Options[i]);
|
---|
| 1246 | RTPrintf("\n");
|
---|
| 1247 | }
|
---|
| 1248 |
|
---|
[79748] | 1249 | com::SafeArray<DHCPOptionEncoding_T> Encodings;
|
---|
| 1250 | com::SafeArray<BSTR> Values;
|
---|
| 1251 | CHECK_ERROR2_STMT(hrc, ptrConfig, GetAllOptions(ComSafeArrayAsOutParam(Options),
|
---|
| 1252 | ComSafeArrayAsOutParam(Encodings),
|
---|
| 1253 | ComSafeArrayAsOutParam(Values)), hrcRet = hrc);
|
---|
| 1254 | if (FAILED(hrc))
|
---|
[92372] | 1255 | RTPrintf(List::tr(" DHCP options: %Rhrc\n"), hrc);
|
---|
[79748] | 1256 | else if (Options.size() != Encodings.size() || Options.size() != Values.size())
|
---|
| 1257 | {
|
---|
[92372] | 1258 | RTPrintf(List::tr(" DHCP options: Return count mismatch: %zu, %zu, %zu\n"),
|
---|
| 1259 | Options.size(), Encodings.size(), Values.size());
|
---|
[79748] | 1260 | hrcRet = E_FAIL;
|
---|
| 1261 | }
|
---|
| 1262 | else if (Options.size() == 0)
|
---|
[92372] | 1263 | RTPrintf(List::tr(" DHCP options: None\n"));
|
---|
[79748] | 1264 | else
|
---|
| 1265 | for (size_t i = 0; i < Options.size(); i++)
|
---|
| 1266 | {
|
---|
| 1267 | switch (Encodings[i])
|
---|
| 1268 | {
|
---|
[79778] | 1269 | case DHCPOptionEncoding_Normal:
|
---|
[92372] | 1270 | RTPrintf(List::tr(" %3d/legacy: %ls\n"), Options[i], Values[i]);
|
---|
[79748] | 1271 | break;
|
---|
| 1272 | case DHCPOptionEncoding_Hex:
|
---|
[92594] | 1273 | RTPrintf(" %3d/hex: %ls\n", Options[i], Values[i]);
|
---|
[79748] | 1274 | break;
|
---|
| 1275 | default:
|
---|
[92594] | 1276 | RTPrintf(" %3d/%u?: %ls\n", Options[i], Encodings[i], Values[i]);
|
---|
[79748] | 1277 | break;
|
---|
| 1278 | }
|
---|
| 1279 | }
|
---|
| 1280 |
|
---|
[75819] | 1281 | return S_OK;
|
---|
| 1282 | }
|
---|
| 1283 |
|
---|
| 1284 |
|
---|
| 1285 | /**
|
---|
| 1286 | * List DHCP servers.
|
---|
| 1287 | *
|
---|
| 1288 | * @returns See produceList.
|
---|
| 1289 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
| 1290 | */
|
---|
| 1291 | static HRESULT listDhcpServers(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
| 1292 | {
|
---|
[79748] | 1293 | HRESULT hrcRet = S_OK;
|
---|
[79771] | 1294 | com::SafeIfaceArray<IDHCPServer> DHCPServers;
|
---|
| 1295 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(DHCPServers)(ComSafeArrayAsOutParam(DHCPServers)), hrcCheck);
|
---|
| 1296 | for (size_t i = 0; i < DHCPServers.size(); ++i)
|
---|
[75819] | 1297 | {
|
---|
[79748] | 1298 | if (i > 0)
|
---|
| 1299 | RTPrintf("\n");
|
---|
| 1300 |
|
---|
[79771] | 1301 | ComPtr<IDHCPServer> ptrDHCPServer = DHCPServers[i];
|
---|
[79748] | 1302 | Bstr bstr;
|
---|
[79771] | 1303 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(NetworkName)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[92372] | 1304 | RTPrintf(List::tr("NetworkName: %ls\n"), bstr.raw());
|
---|
[79748] | 1305 |
|
---|
[79771] | 1306 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(IPAddress)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[92594] | 1307 | RTPrintf("Dhcpd IP: %ls\n", bstr.raw());
|
---|
[79748] | 1308 |
|
---|
[79771] | 1309 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(LowerIP)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[92372] | 1310 | RTPrintf(List::tr("LowerIPAddress: %ls\n"), bstr.raw());
|
---|
[79748] | 1311 |
|
---|
[79771] | 1312 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(UpperIP)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[92372] | 1313 | RTPrintf(List::tr("UpperIPAddress: %ls\n"), bstr.raw());
|
---|
[79748] | 1314 |
|
---|
[79771] | 1315 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(NetworkMask)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[92372] | 1316 | RTPrintf(List::tr("NetworkMask: %ls\n"), bstr.raw());
|
---|
[79748] | 1317 |
|
---|
| 1318 | BOOL fEnabled = FALSE;
|
---|
[79771] | 1319 | CHECK_ERROR2I_STMT(ptrDHCPServer, COMGETTER(Enabled)(&fEnabled), hrcRet = hrcCheck);
|
---|
[92372] | 1320 | RTPrintf(List::tr("Enabled: %s\n"), fEnabled ? List::tr("Yes") : List::tr("No"));
|
---|
[79748] | 1321 |
|
---|
| 1322 | /* Global configuration: */
|
---|
[92372] | 1323 | RTPrintf(List::tr("Global Configuration:\n"));
|
---|
[79748] | 1324 | HRESULT hrc;
|
---|
| 1325 | ComPtr<IDHCPGlobalConfig> ptrGlobal;
|
---|
[79771] | 1326 | CHECK_ERROR2_STMT(hrc, ptrDHCPServer, COMGETTER(GlobalConfig)(ptrGlobal.asOutParam()), hrcRet = hrc);
|
---|
[79748] | 1327 | if (SUCCEEDED(hrc))
|
---|
[75819] | 1328 | {
|
---|
[79748] | 1329 | hrc = showDhcpConfig(ptrGlobal);
|
---|
| 1330 | if (FAILED(hrc))
|
---|
| 1331 | hrcRet = hrc;
|
---|
[75819] | 1332 | }
|
---|
[79748] | 1333 |
|
---|
| 1334 | /* Group configurations: */
|
---|
| 1335 | com::SafeIfaceArray<IDHCPGroupConfig> Groups;
|
---|
[79771] | 1336 | CHECK_ERROR2_STMT(hrc, ptrDHCPServer, COMGETTER(GroupConfigs)(ComSafeArrayAsOutParam(Groups)), hrcRet = hrc);
|
---|
[79748] | 1337 | if (FAILED(hrc))
|
---|
[92372] | 1338 | RTPrintf(List::tr("Groups: %Rrc\n"), hrc);
|
---|
[79748] | 1339 | else if (Groups.size() == 0)
|
---|
[92372] | 1340 | RTPrintf(List::tr("Groups: None\n"));
|
---|
[79748] | 1341 | else
|
---|
[75819] | 1342 | {
|
---|
[79748] | 1343 | for (size_t iGrp = 0; iGrp < Groups.size(); iGrp++)
|
---|
| 1344 | {
|
---|
| 1345 | CHECK_ERROR2I_STMT(Groups[iGrp], COMGETTER(Name)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[92372] | 1346 | RTPrintf(List::tr("Group: %ls\n"), bstr.raw());
|
---|
[79748] | 1347 |
|
---|
[79771] | 1348 | com::SafeIfaceArray<IDHCPGroupCondition> Conditions;
|
---|
| 1349 | CHECK_ERROR2_STMT(hrc, Groups[iGrp], COMGETTER(Conditions)(ComSafeArrayAsOutParam(Conditions)), hrcRet = hrc);
|
---|
| 1350 | if (FAILED(hrc))
|
---|
[92372] | 1351 | RTPrintf(List::tr(" Conditions: %Rhrc\n"), hrc);
|
---|
[79771] | 1352 | else if (Conditions.size() == 0)
|
---|
[92372] | 1353 | RTPrintf(List::tr(" Conditions: None\n"));
|
---|
[79771] | 1354 | else
|
---|
| 1355 | for (size_t iCond = 0; iCond < Conditions.size(); iCond++)
|
---|
| 1356 | {
|
---|
| 1357 | BOOL fInclusive = TRUE;
|
---|
| 1358 | CHECK_ERROR2_STMT(hrc, Conditions[iCond], COMGETTER(Inclusive)(&fInclusive), hrcRet = hrc);
|
---|
| 1359 | DHCPGroupConditionType_T enmType = DHCPGroupConditionType_MAC;
|
---|
| 1360 | CHECK_ERROR2_STMT(hrc, Conditions[iCond], COMGETTER(Type)(&enmType), hrcRet = hrc);
|
---|
| 1361 | CHECK_ERROR2_STMT(hrc, Conditions[iCond], COMGETTER(Value)(bstr.asOutParam()), hrcRet = hrc);
|
---|
| 1362 |
|
---|
[92372] | 1363 | RTPrintf(List::tr(" Conditions: %s %s %ls\n"),
|
---|
| 1364 | fInclusive ? List::tr("include") : List::tr("exclude"),
|
---|
[79771] | 1365 | enmType == DHCPGroupConditionType_MAC ? "MAC "
|
---|
| 1366 | : enmType == DHCPGroupConditionType_MACWildcard ? "MAC* "
|
---|
| 1367 | : enmType == DHCPGroupConditionType_vendorClassID ? "VendorCID "
|
---|
| 1368 | : enmType == DHCPGroupConditionType_vendorClassIDWildcard ? "VendorCID*"
|
---|
| 1369 | : enmType == DHCPGroupConditionType_userClassID ? "UserCID "
|
---|
| 1370 | : enmType == DHCPGroupConditionType_userClassIDWildcard ? "UserCID* "
|
---|
| 1371 | : "!UNKNOWN! ",
|
---|
| 1372 | bstr.raw());
|
---|
| 1373 | }
|
---|
| 1374 |
|
---|
[79748] | 1375 | hrc = showDhcpConfig(Groups[iGrp]);
|
---|
| 1376 | if (FAILED(hrc))
|
---|
| 1377 | hrcRet = hrc;
|
---|
| 1378 | }
|
---|
| 1379 | Groups.setNull();
|
---|
[75819] | 1380 | }
|
---|
[79748] | 1381 |
|
---|
| 1382 | /* Individual host / NIC configurations: */
|
---|
| 1383 | com::SafeIfaceArray<IDHCPIndividualConfig> Hosts;
|
---|
[79771] | 1384 | CHECK_ERROR2_STMT(hrc, ptrDHCPServer, COMGETTER(IndividualConfigs)(ComSafeArrayAsOutParam(Hosts)), hrcRet = hrc);
|
---|
[79748] | 1385 | if (FAILED(hrc))
|
---|
[92372] | 1386 | RTPrintf(List::tr("Individual Configs: %Rrc\n"), hrc);
|
---|
[79748] | 1387 | else if (Hosts.size() == 0)
|
---|
[92372] | 1388 | RTPrintf(List::tr("Individual Configs: None\n"));
|
---|
[79748] | 1389 | else
|
---|
| 1390 | {
|
---|
| 1391 | for (size_t iHost = 0; iHost < Hosts.size(); iHost++)
|
---|
| 1392 | {
|
---|
| 1393 | DHCPConfigScope_T enmScope = DHCPConfigScope_MAC;
|
---|
| 1394 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(Scope)(&enmScope), hrcRet = hrcCheck);
|
---|
| 1395 |
|
---|
| 1396 | if (enmScope == DHCPConfigScope_MAC)
|
---|
| 1397 | {
|
---|
[79771] | 1398 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(MACAddress)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[92372] | 1399 | RTPrintf(List::tr("Individual Config: MAC %ls\n"), bstr.raw());
|
---|
[79748] | 1400 | }
|
---|
| 1401 | else
|
---|
| 1402 | {
|
---|
| 1403 | ULONG uSlot = 0;
|
---|
[79771] | 1404 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(Slot)(&uSlot), hrcRet = hrcCheck);
|
---|
| 1405 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(MachineId)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[79748] | 1406 | Bstr bstrMACAddress;
|
---|
[79771] | 1407 | hrc = Hosts[iHost]->COMGETTER(MACAddress)(bstrMACAddress.asOutParam()); /* No CHECK_ERROR2 stuff! */
|
---|
[79748] | 1408 | if (SUCCEEDED(hrc))
|
---|
[92372] | 1409 | RTPrintf(List::tr("Individual Config: VM NIC: %ls slot %u, MAC %ls\n"), bstr.raw(), uSlot,
|
---|
| 1410 | bstrMACAddress.raw());
|
---|
[79748] | 1411 | else
|
---|
[92372] | 1412 | RTPrintf(List::tr("Individual Config: VM NIC: %ls slot %u, MAC %Rhrc\n"), bstr.raw(), uSlot, hrc);
|
---|
[79748] | 1413 | }
|
---|
| 1414 |
|
---|
[79771] | 1415 | CHECK_ERROR2I_STMT(Hosts[iHost], COMGETTER(FixedAddress)(bstr.asOutParam()), hrcRet = hrcCheck);
|
---|
[79748] | 1416 | if (bstr.isNotEmpty())
|
---|
[92372] | 1417 | RTPrintf(List::tr(" Fixed Address: %ls\n"), bstr.raw());
|
---|
[79748] | 1418 | else
|
---|
[92372] | 1419 | RTPrintf(List::tr(" Fixed Address: dynamic\n"));
|
---|
[79748] | 1420 |
|
---|
[79771] | 1421 | hrc = showDhcpConfig(Hosts[iHost]);
|
---|
[79748] | 1422 | if (FAILED(hrc))
|
---|
| 1423 | hrcRet = hrc;
|
---|
| 1424 | }
|
---|
| 1425 | Hosts.setNull();
|
---|
| 1426 | }
|
---|
[75819] | 1427 | }
|
---|
| 1428 |
|
---|
[79748] | 1429 | return hrcRet;
|
---|
[75819] | 1430 | }
|
---|
| 1431 |
|
---|
| 1432 | /**
|
---|
[33766] | 1433 | * List extension packs.
|
---|
| 1434 | *
|
---|
| 1435 | * @returns See produceList.
|
---|
[42748] | 1436 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
[33766] | 1437 | */
|
---|
[42748] | 1438 | static HRESULT listExtensionPacks(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
[33766] | 1439 | {
|
---|
| 1440 | ComObjPtr<IExtPackManager> ptrExtPackMgr;
|
---|
[56118] | 1441 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(ExtensionPackManager)(ptrExtPackMgr.asOutParam()), hrcCheck);
|
---|
[33766] | 1442 |
|
---|
| 1443 | SafeIfaceArray<IExtPack> extPacks;
|
---|
[56118] | 1444 | CHECK_ERROR2I_RET(ptrExtPackMgr, COMGETTER(InstalledExtPacks)(ComSafeArrayAsOutParam(extPacks)), hrcCheck);
|
---|
[92372] | 1445 | RTPrintf(List::tr("Extension Packs: %u\n"), extPacks.size());
|
---|
[33766] | 1446 |
|
---|
| 1447 | HRESULT hrc = S_OK;
|
---|
| 1448 | for (size_t i = 0; i < extPacks.size(); i++)
|
---|
| 1449 | {
|
---|
| 1450 | /* Read all the properties. */
|
---|
[42748] | 1451 | Bstr bstrName;
|
---|
[56118] | 1452 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Name)(bstrName.asOutParam()), hrc = hrcCheck; bstrName.setNull());
|
---|
[42748] | 1453 | Bstr bstrDesc;
|
---|
[56118] | 1454 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Description)(bstrDesc.asOutParam()), hrc = hrcCheck; bstrDesc.setNull());
|
---|
[42748] | 1455 | Bstr bstrVersion;
|
---|
[56118] | 1456 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Version)(bstrVersion.asOutParam()), hrc = hrcCheck; bstrVersion.setNull());
|
---|
[42748] | 1457 | ULONG uRevision;
|
---|
[56118] | 1458 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Revision)(&uRevision), hrc = hrcCheck; uRevision = 0);
|
---|
[42748] | 1459 | Bstr bstrEdition;
|
---|
[56118] | 1460 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Edition)(bstrEdition.asOutParam()), hrc = hrcCheck; bstrEdition.setNull());
|
---|
[42748] | 1461 | Bstr bstrVrdeModule;
|
---|
[56118] | 1462 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(VRDEModule)(bstrVrdeModule.asOutParam()),hrc=hrcCheck; bstrVrdeModule.setNull());
|
---|
[94714] | 1463 | Bstr bstrCryptoModule;
|
---|
| 1464 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(CryptoModule)(bstrCryptoModule.asOutParam()),hrc=hrcCheck; bstrCryptoModule.setNull());
|
---|
[42748] | 1465 | BOOL fUsable;
|
---|
[56118] | 1466 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(Usable)(&fUsable), hrc = hrcCheck; fUsable = FALSE);
|
---|
[42748] | 1467 | Bstr bstrWhy;
|
---|
[56118] | 1468 | CHECK_ERROR2I_STMT(extPacks[i], COMGETTER(WhyUnusable)(bstrWhy.asOutParam()), hrc = hrcCheck; bstrWhy.setNull());
|
---|
[33766] | 1469 |
|
---|
| 1470 | /* Display them. */
|
---|
| 1471 | if (i)
|
---|
| 1472 | RTPrintf("\n");
|
---|
[92372] | 1473 | RTPrintf(List::tr(
|
---|
| 1474 | "Pack no.%2zu: %ls\n"
|
---|
[94714] | 1475 | "Version: %ls\n"
|
---|
| 1476 | "Revision: %u\n"
|
---|
| 1477 | "Edition: %ls\n"
|
---|
| 1478 | "Description: %ls\n"
|
---|
| 1479 | "VRDE Module: %ls\n"
|
---|
| 1480 | "Crypto Module: %ls\n"
|
---|
| 1481 | "Usable: %RTbool\n"
|
---|
| 1482 | "Why unusable: %ls\n"),
|
---|
[33766] | 1483 | i, bstrName.raw(),
|
---|
| 1484 | bstrVersion.raw(),
|
---|
| 1485 | uRevision,
|
---|
[39662] | 1486 | bstrEdition.raw(),
|
---|
[33766] | 1487 | bstrDesc.raw(),
|
---|
[34244] | 1488 | bstrVrdeModule.raw(),
|
---|
[94714] | 1489 | bstrCryptoModule.raw(),
|
---|
[33766] | 1490 | fUsable != FALSE,
|
---|
| 1491 | bstrWhy.raw());
|
---|
[34244] | 1492 |
|
---|
| 1493 | /* Query plugins and display them. */
|
---|
[33766] | 1494 | }
|
---|
| 1495 | return hrc;
|
---|
| 1496 | }
|
---|
| 1497 |
|
---|
| 1498 |
|
---|
| 1499 | /**
|
---|
[42189] | 1500 | * List machine groups.
|
---|
| 1501 | *
|
---|
| 1502 | * @returns See produceList.
|
---|
[42748] | 1503 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
[42189] | 1504 | */
|
---|
[42748] | 1505 | static HRESULT listGroups(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
[42189] | 1506 | {
|
---|
| 1507 | SafeArray<BSTR> groups;
|
---|
[56118] | 1508 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(MachineGroups)(ComSafeArrayAsOutParam(groups)), hrcCheck);
|
---|
[42189] | 1509 |
|
---|
| 1510 | for (size_t i = 0; i < groups.size(); i++)
|
---|
| 1511 | {
|
---|
| 1512 | RTPrintf("\"%ls\"\n", groups[i]);
|
---|
| 1513 | }
|
---|
| 1514 | return S_OK;
|
---|
| 1515 | }
|
---|
| 1516 |
|
---|
| 1517 |
|
---|
| 1518 | /**
|
---|
[48600] | 1519 | * List video capture devices.
|
---|
| 1520 | *
|
---|
| 1521 | * @returns See produceList.
|
---|
| 1522 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
| 1523 | */
|
---|
[85575] | 1524 | static HRESULT listVideoInputDevices(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
[48600] | 1525 | {
|
---|
[95140] | 1526 | HRESULT hrc;
|
---|
[48600] | 1527 | ComPtr<IHost> host;
|
---|
| 1528 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
[48607] | 1529 | com::SafeIfaceArray<IHostVideoInputDevice> hostVideoInputDevices;
|
---|
| 1530 | CHECK_ERROR(host, COMGETTER(VideoInputDevices)(ComSafeArrayAsOutParam(hostVideoInputDevices)));
|
---|
[92372] | 1531 | RTPrintf(List::tr("Video Input Devices: %u\n"), hostVideoInputDevices.size());
|
---|
[48607] | 1532 | for (size_t i = 0; i < hostVideoInputDevices.size(); ++i)
|
---|
[48600] | 1533 | {
|
---|
[48607] | 1534 | ComPtr<IHostVideoInputDevice> p = hostVideoInputDevices[i];
|
---|
[48600] | 1535 | Bstr name;
|
---|
| 1536 | p->COMGETTER(Name)(name.asOutParam());
|
---|
| 1537 | Bstr path;
|
---|
| 1538 | p->COMGETTER(Path)(path.asOutParam());
|
---|
| 1539 | Bstr alias;
|
---|
| 1540 | p->COMGETTER(Alias)(alias.asOutParam());
|
---|
| 1541 | RTPrintf("%ls \"%ls\"\n%ls\n", alias.raw(), name.raw(), path.raw());
|
---|
| 1542 | }
|
---|
[95140] | 1543 | return hrc;
|
---|
[48600] | 1544 | }
|
---|
| 1545 |
|
---|
[52200] | 1546 | /**
|
---|
| 1547 | * List supported screen shot formats.
|
---|
| 1548 | *
|
---|
| 1549 | * @returns See produceList.
|
---|
| 1550 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
| 1551 | */
|
---|
[85575] | 1552 | static HRESULT listScreenShotFormats(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
[52200] | 1553 | {
|
---|
[95140] | 1554 | HRESULT hrc = S_OK;
|
---|
[52200] | 1555 | ComPtr<ISystemProperties> systemProperties;
|
---|
| 1556 | CHECK_ERROR(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
|
---|
| 1557 | com::SafeArray<BitmapFormat_T> formats;
|
---|
| 1558 | CHECK_ERROR(systemProperties, COMGETTER(ScreenShotFormats)(ComSafeArrayAsOutParam(formats)));
|
---|
[48600] | 1559 |
|
---|
[92594] | 1560 | RTPrintf(List::tr("Supported %d screen shot formats:\n", "", formats.size()), formats.size());
|
---|
[52200] | 1561 | for (size_t i = 0; i < formats.size(); ++i)
|
---|
| 1562 | {
|
---|
| 1563 | uint32_t u32Format = (uint32_t)formats[i];
|
---|
| 1564 | char szFormat[5];
|
---|
| 1565 | szFormat[0] = RT_BYTE1(u32Format);
|
---|
| 1566 | szFormat[1] = RT_BYTE2(u32Format);
|
---|
| 1567 | szFormat[2] = RT_BYTE3(u32Format);
|
---|
| 1568 | szFormat[3] = RT_BYTE4(u32Format);
|
---|
| 1569 | szFormat[4] = 0;
|
---|
| 1570 | RTPrintf(" BitmapFormat_%s (0x%08X)\n", szFormat, u32Format);
|
---|
| 1571 | }
|
---|
[95140] | 1572 | return hrc;
|
---|
[52200] | 1573 | }
|
---|
| 1574 |
|
---|
[73716] | 1575 | /**
|
---|
| 1576 | * List available cloud providers.
|
---|
| 1577 | *
|
---|
| 1578 | * @returns See produceList.
|
---|
| 1579 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
| 1580 | */
|
---|
[85575] | 1581 | static HRESULT listCloudProviders(const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
[73716] | 1582 | {
|
---|
[95140] | 1583 | HRESULT hrc = S_OK;
|
---|
[73716] | 1584 | ComPtr<ICloudProviderManager> pCloudProviderManager;
|
---|
| 1585 | CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
|
---|
| 1586 | com::SafeIfaceArray<ICloudProvider> apCloudProviders;
|
---|
| 1587 | CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
|
---|
[52200] | 1588 |
|
---|
[92594] | 1589 | RTPrintf(List::tr("Supported %d cloud providers:\n", "", apCloudProviders.size()), apCloudProviders.size());
|
---|
[73716] | 1590 | for (size_t i = 0; i < apCloudProviders.size(); ++i)
|
---|
| 1591 | {
|
---|
| 1592 | ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
|
---|
| 1593 | Bstr bstrProviderName;
|
---|
| 1594 | pCloudProvider->COMGETTER(Name)(bstrProviderName.asOutParam());
|
---|
[92372] | 1595 | RTPrintf(List::tr("Name: %ls\n"), bstrProviderName.raw());
|
---|
[73716] | 1596 | pCloudProvider->COMGETTER(ShortName)(bstrProviderName.asOutParam());
|
---|
[92372] | 1597 | RTPrintf(List::tr("Short Name: %ls\n"), bstrProviderName.raw());
|
---|
[73716] | 1598 | Bstr bstrProviderID;
|
---|
| 1599 | pCloudProvider->COMGETTER(Id)(bstrProviderID.asOutParam());
|
---|
| 1600 | RTPrintf("GUID: %ls\n", bstrProviderID.raw());
|
---|
| 1601 |
|
---|
| 1602 | RTPrintf("\n");
|
---|
| 1603 | }
|
---|
[95140] | 1604 | return hrc;
|
---|
[73716] | 1605 | }
|
---|
| 1606 |
|
---|
| 1607 |
|
---|
[48600] | 1608 | /**
|
---|
[73716] | 1609 | * List all available cloud profiles (by iterating over the cloud providers).
|
---|
| 1610 | *
|
---|
| 1611 | * @returns See produceList.
|
---|
| 1612 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
| 1613 | * @param fOptLong If true, list all profile properties.
|
---|
| 1614 | */
|
---|
[85575] | 1615 | static HRESULT listCloudProfiles(const ComPtr<IVirtualBox> &pVirtualBox, bool fOptLong)
|
---|
[73716] | 1616 | {
|
---|
[95140] | 1617 | HRESULT hrc = S_OK;
|
---|
[73716] | 1618 | ComPtr<ICloudProviderManager> pCloudProviderManager;
|
---|
| 1619 | CHECK_ERROR(pVirtualBox, COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()));
|
---|
| 1620 | com::SafeIfaceArray<ICloudProvider> apCloudProviders;
|
---|
| 1621 | CHECK_ERROR(pCloudProviderManager, COMGETTER(Providers)(ComSafeArrayAsOutParam(apCloudProviders)));
|
---|
| 1622 |
|
---|
| 1623 | for (size_t i = 0; i < apCloudProviders.size(); ++i)
|
---|
| 1624 | {
|
---|
| 1625 | ComPtr<ICloudProvider> pCloudProvider = apCloudProviders[i];
|
---|
| 1626 | com::SafeIfaceArray<ICloudProfile> apCloudProfiles;
|
---|
| 1627 | CHECK_ERROR(pCloudProvider, COMGETTER(Profiles)(ComSafeArrayAsOutParam(apCloudProfiles)));
|
---|
| 1628 | for (size_t j = 0; j < apCloudProfiles.size(); ++j)
|
---|
| 1629 | {
|
---|
| 1630 | ComPtr<ICloudProfile> pCloudProfile = apCloudProfiles[j];
|
---|
| 1631 | Bstr bstrProfileName;
|
---|
| 1632 | pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam());
|
---|
[92372] | 1633 | RTPrintf(List::tr("Name: %ls\n"), bstrProfileName.raw());
|
---|
[73716] | 1634 | Bstr bstrProviderID;
|
---|
| 1635 | pCloudProfile->COMGETTER(ProviderId)(bstrProviderID.asOutParam());
|
---|
[92372] | 1636 | RTPrintf(List::tr("Provider GUID: %ls\n"), bstrProviderID.raw());
|
---|
[73716] | 1637 |
|
---|
| 1638 | if (fOptLong)
|
---|
| 1639 | {
|
---|
| 1640 | com::SafeArray<BSTR> names;
|
---|
| 1641 | com::SafeArray<BSTR> values;
|
---|
| 1642 | pCloudProfile->GetProperties(Bstr().raw(), ComSafeArrayAsOutParam(names), ComSafeArrayAsOutParam(values));
|
---|
| 1643 | size_t cNames = names.size();
|
---|
| 1644 | size_t cValues = values.size();
|
---|
| 1645 | bool fFirst = true;
|
---|
| 1646 | for (size_t k = 0; k < cNames; k++)
|
---|
| 1647 | {
|
---|
| 1648 | Bstr value;
|
---|
| 1649 | if (k < cValues)
|
---|
| 1650 | value = values[k];
|
---|
| 1651 | RTPrintf("%s%ls=%ls\n",
|
---|
[92372] | 1652 | fFirst ? List::tr("Property: ") : " ",
|
---|
[73716] | 1653 | names[k], value.raw());
|
---|
| 1654 | fFirst = false;
|
---|
| 1655 | }
|
---|
| 1656 | }
|
---|
| 1657 |
|
---|
| 1658 | RTPrintf("\n");
|
---|
| 1659 | }
|
---|
| 1660 | }
|
---|
[95140] | 1661 | return hrc;
|
---|
[73716] | 1662 | }
|
---|
| 1663 |
|
---|
[85575] | 1664 | static HRESULT displayCPUProfile(ICPUProfile *pProfile, size_t idx, int cchIdx, bool fOptLong, HRESULT hrc)
|
---|
| 1665 | {
|
---|
| 1666 | /* Retrieve the attributes needed for both long and short display. */
|
---|
| 1667 | Bstr bstrName;
|
---|
| 1668 | CHECK_ERROR2I_RET(pProfile, COMGETTER(Name)(bstrName.asOutParam()), hrcCheck);
|
---|
[73716] | 1669 |
|
---|
[85575] | 1670 | CPUArchitecture_T enmArchitecture = CPUArchitecture_Any;
|
---|
| 1671 | CHECK_ERROR2I_RET(pProfile, COMGETTER(Architecture)(&enmArchitecture), hrcCheck);
|
---|
| 1672 | const char *pszArchitecture = "???";
|
---|
| 1673 | switch (enmArchitecture)
|
---|
| 1674 | {
|
---|
[101035] | 1675 | case CPUArchitecture_x86: pszArchitecture = "x86"; break;
|
---|
| 1676 | case CPUArchitecture_AMD64: pszArchitecture = "AMD64"; break;
|
---|
| 1677 | case CPUArchitecture_ARMv8_32: pszArchitecture = "ARMv8 (32-bit only)"; break;
|
---|
| 1678 | case CPUArchitecture_ARMv8_64: pszArchitecture = "ARMv8 (64-bit)"; break;
|
---|
[85579] | 1679 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
[85575] | 1680 | case CPUArchitecture_32BitHack:
|
---|
[85579] | 1681 | #endif
|
---|
[85575] | 1682 | case CPUArchitecture_Any:
|
---|
| 1683 | break;
|
---|
| 1684 | }
|
---|
| 1685 |
|
---|
| 1686 | /* Print what we've got. */
|
---|
| 1687 | if (!fOptLong)
|
---|
| 1688 | RTPrintf("#%0*zu: %ls [%s]\n", cchIdx, idx, bstrName.raw(), pszArchitecture);
|
---|
| 1689 | else
|
---|
| 1690 | {
|
---|
[92372] | 1691 | RTPrintf(List::tr("CPU Profile #%02zu:\n"), idx);
|
---|
| 1692 | RTPrintf(List::tr(" Architecture: %s\n"), pszArchitecture);
|
---|
| 1693 | RTPrintf(List::tr(" Name: %ls\n"), bstrName.raw());
|
---|
[85575] | 1694 | CHECK_ERROR2I_RET(pProfile, COMGETTER(FullName)(bstrName.asOutParam()), hrcCheck);
|
---|
[92372] | 1695 | RTPrintf(List::tr(" Full Name: %ls\n"), bstrName.raw());
|
---|
[85575] | 1696 | }
|
---|
| 1697 | return hrc;
|
---|
| 1698 | }
|
---|
| 1699 |
|
---|
| 1700 |
|
---|
[73716] | 1701 | /**
|
---|
[85575] | 1702 | * List all CPU profiles.
|
---|
| 1703 | *
|
---|
| 1704 | * @returns See produceList.
|
---|
| 1705 | * @param ptrVirtualBox Reference to the smart IVirtualBox pointer.
|
---|
| 1706 | * @param fOptLong If true, list all profile properties.
|
---|
| 1707 | * @param fOptSorted Sort the output if true, otherwise display in
|
---|
| 1708 | * system order.
|
---|
| 1709 | */
|
---|
| 1710 | static HRESULT listCPUProfiles(const ComPtr<IVirtualBox> &ptrVirtualBox, bool fOptLong, bool fOptSorted)
|
---|
| 1711 | {
|
---|
| 1712 | ComPtr<ISystemProperties> ptrSysProps;
|
---|
| 1713 | CHECK_ERROR2I_RET(ptrVirtualBox, COMGETTER(SystemProperties)(ptrSysProps.asOutParam()), hrcCheck);
|
---|
| 1714 | com::SafeIfaceArray<ICPUProfile> aCPUProfiles;
|
---|
| 1715 | CHECK_ERROR2I_RET(ptrSysProps, GetCPUProfiles(CPUArchitecture_Any, Bstr().raw(),
|
---|
| 1716 | ComSafeArrayAsOutParam(aCPUProfiles)), hrcCheck);
|
---|
| 1717 |
|
---|
| 1718 | int const cchIdx = 1 + (aCPUProfiles.size() >= 10) + (aCPUProfiles.size() >= 100);
|
---|
| 1719 |
|
---|
| 1720 | HRESULT hrc = S_OK;
|
---|
| 1721 | if (!fOptSorted)
|
---|
| 1722 | for (size_t i = 0; i < aCPUProfiles.size(); i++)
|
---|
| 1723 | hrc = displayCPUProfile(aCPUProfiles[i], i, cchIdx, fOptLong, hrc);
|
---|
| 1724 | else
|
---|
| 1725 | {
|
---|
| 1726 | std::vector<std::pair<com::Bstr, ICPUProfile *> > vecSortedProfiles;
|
---|
| 1727 | for (size_t i = 0; i < aCPUProfiles.size(); ++i)
|
---|
| 1728 | {
|
---|
| 1729 | Bstr bstrName;
|
---|
| 1730 | CHECK_ERROR2I_RET(aCPUProfiles[i], COMGETTER(Name)(bstrName.asOutParam()), hrcCheck);
|
---|
| 1731 | try
|
---|
| 1732 | {
|
---|
| 1733 | vecSortedProfiles.push_back(std::pair<com::Bstr, ICPUProfile *>(bstrName, aCPUProfiles[i]));
|
---|
| 1734 | }
|
---|
| 1735 | catch (std::bad_alloc &)
|
---|
| 1736 | {
|
---|
| 1737 | return E_OUTOFMEMORY;
|
---|
| 1738 | }
|
---|
| 1739 | }
|
---|
| 1740 |
|
---|
| 1741 | std::sort(vecSortedProfiles.begin(), vecSortedProfiles.end());
|
---|
| 1742 |
|
---|
| 1743 | for (size_t i = 0; i < vecSortedProfiles.size(); i++)
|
---|
| 1744 | hrc = displayCPUProfile(vecSortedProfiles[i].second, i, cchIdx, fOptLong, hrc);
|
---|
| 1745 | }
|
---|
| 1746 |
|
---|
| 1747 | return hrc;
|
---|
| 1748 | }
|
---|
| 1749 |
|
---|
| 1750 |
|
---|
| 1751 | /**
|
---|
[85929] | 1752 | * Translates PartitionType_T to a string if possible.
|
---|
| 1753 | * @returns read-only string if known value, @a pszUnknown if not.
|
---|
| 1754 | */
|
---|
| 1755 | static const char *PartitionTypeToString(PartitionType_T enmType, const char *pszUnknown)
|
---|
| 1756 | {
|
---|
| 1757 | #define MY_CASE_STR(a_Type) case RT_CONCAT(PartitionType_,a_Type): return #a_Type
|
---|
| 1758 | switch (enmType)
|
---|
| 1759 | {
|
---|
| 1760 | MY_CASE_STR(Empty);
|
---|
| 1761 | MY_CASE_STR(FAT12);
|
---|
| 1762 | MY_CASE_STR(FAT16);
|
---|
| 1763 | MY_CASE_STR(FAT);
|
---|
| 1764 | MY_CASE_STR(IFS);
|
---|
| 1765 | MY_CASE_STR(FAT32CHS);
|
---|
| 1766 | MY_CASE_STR(FAT32LBA);
|
---|
| 1767 | MY_CASE_STR(FAT16B);
|
---|
| 1768 | MY_CASE_STR(Extended);
|
---|
| 1769 | MY_CASE_STR(WindowsRE);
|
---|
| 1770 | MY_CASE_STR(LinuxSwapOld);
|
---|
| 1771 | MY_CASE_STR(LinuxOld);
|
---|
| 1772 | MY_CASE_STR(DragonFlyBSDSlice);
|
---|
| 1773 | MY_CASE_STR(LinuxSwap);
|
---|
| 1774 | MY_CASE_STR(Linux);
|
---|
| 1775 | MY_CASE_STR(LinuxExtended);
|
---|
| 1776 | MY_CASE_STR(LinuxLVM);
|
---|
| 1777 | MY_CASE_STR(BSDSlice);
|
---|
| 1778 | MY_CASE_STR(AppleUFS);
|
---|
| 1779 | MY_CASE_STR(AppleHFS);
|
---|
| 1780 | MY_CASE_STR(Solaris);
|
---|
| 1781 | MY_CASE_STR(GPT);
|
---|
| 1782 | MY_CASE_STR(EFI);
|
---|
| 1783 | MY_CASE_STR(Unknown);
|
---|
| 1784 | MY_CASE_STR(MBR);
|
---|
| 1785 | MY_CASE_STR(iFFS);
|
---|
| 1786 | MY_CASE_STR(SonyBoot);
|
---|
| 1787 | MY_CASE_STR(LenovoBoot);
|
---|
| 1788 | MY_CASE_STR(WindowsMSR);
|
---|
| 1789 | MY_CASE_STR(WindowsBasicData);
|
---|
| 1790 | MY_CASE_STR(WindowsLDMMeta);
|
---|
| 1791 | MY_CASE_STR(WindowsLDMData);
|
---|
| 1792 | MY_CASE_STR(WindowsRecovery);
|
---|
| 1793 | MY_CASE_STR(WindowsStorageSpaces);
|
---|
| 1794 | MY_CASE_STR(WindowsStorageReplica);
|
---|
| 1795 | MY_CASE_STR(IBMGPFS);
|
---|
| 1796 | MY_CASE_STR(LinuxData);
|
---|
| 1797 | MY_CASE_STR(LinuxRAID);
|
---|
| 1798 | MY_CASE_STR(LinuxRootX86);
|
---|
| 1799 | MY_CASE_STR(LinuxRootAMD64);
|
---|
| 1800 | MY_CASE_STR(LinuxRootARM32);
|
---|
| 1801 | MY_CASE_STR(LinuxRootARM64);
|
---|
| 1802 | MY_CASE_STR(LinuxHome);
|
---|
| 1803 | MY_CASE_STR(LinuxSrv);
|
---|
| 1804 | MY_CASE_STR(LinuxPlainDmCrypt);
|
---|
| 1805 | MY_CASE_STR(LinuxLUKS);
|
---|
| 1806 | MY_CASE_STR(LinuxReserved);
|
---|
| 1807 | MY_CASE_STR(FreeBSDBoot);
|
---|
| 1808 | MY_CASE_STR(FreeBSDData);
|
---|
| 1809 | MY_CASE_STR(FreeBSDSwap);
|
---|
| 1810 | MY_CASE_STR(FreeBSDUFS);
|
---|
| 1811 | MY_CASE_STR(FreeBSDVinum);
|
---|
| 1812 | MY_CASE_STR(FreeBSDZFS);
|
---|
| 1813 | MY_CASE_STR(FreeBSDUnknown);
|
---|
| 1814 | MY_CASE_STR(AppleHFSPlus);
|
---|
| 1815 | MY_CASE_STR(AppleAPFS);
|
---|
| 1816 | MY_CASE_STR(AppleRAID);
|
---|
| 1817 | MY_CASE_STR(AppleRAIDOffline);
|
---|
| 1818 | MY_CASE_STR(AppleBoot);
|
---|
| 1819 | MY_CASE_STR(AppleLabel);
|
---|
| 1820 | MY_CASE_STR(AppleTvRecovery);
|
---|
| 1821 | MY_CASE_STR(AppleCoreStorage);
|
---|
| 1822 | MY_CASE_STR(SoftRAIDStatus);
|
---|
| 1823 | MY_CASE_STR(SoftRAIDScratch);
|
---|
| 1824 | MY_CASE_STR(SoftRAIDVolume);
|
---|
| 1825 | MY_CASE_STR(SoftRAIDCache);
|
---|
| 1826 | MY_CASE_STR(AppleUnknown);
|
---|
| 1827 | MY_CASE_STR(SolarisBoot);
|
---|
| 1828 | MY_CASE_STR(SolarisRoot);
|
---|
| 1829 | MY_CASE_STR(SolarisSwap);
|
---|
| 1830 | MY_CASE_STR(SolarisBackup);
|
---|
| 1831 | MY_CASE_STR(SolarisUsr);
|
---|
| 1832 | MY_CASE_STR(SolarisVar);
|
---|
| 1833 | MY_CASE_STR(SolarisHome);
|
---|
| 1834 | MY_CASE_STR(SolarisAltSector);
|
---|
| 1835 | MY_CASE_STR(SolarisReserved);
|
---|
| 1836 | MY_CASE_STR(SolarisUnknown);
|
---|
| 1837 | MY_CASE_STR(NetBSDSwap);
|
---|
| 1838 | MY_CASE_STR(NetBSDFFS);
|
---|
| 1839 | MY_CASE_STR(NetBSDLFS);
|
---|
| 1840 | MY_CASE_STR(NetBSDRAID);
|
---|
| 1841 | MY_CASE_STR(NetBSDConcatenated);
|
---|
| 1842 | MY_CASE_STR(NetBSDEncrypted);
|
---|
| 1843 | MY_CASE_STR(NetBSDUnknown);
|
---|
| 1844 | MY_CASE_STR(ChromeOSKernel);
|
---|
| 1845 | MY_CASE_STR(ChromeOSRootFS);
|
---|
| 1846 | MY_CASE_STR(ChromeOSFuture);
|
---|
| 1847 | MY_CASE_STR(ContLnxUsr);
|
---|
| 1848 | MY_CASE_STR(ContLnxRoot);
|
---|
| 1849 | MY_CASE_STR(ContLnxReserved);
|
---|
| 1850 | MY_CASE_STR(ContLnxRootRAID);
|
---|
| 1851 | MY_CASE_STR(HaikuBFS);
|
---|
| 1852 | MY_CASE_STR(MidntBSDBoot);
|
---|
| 1853 | MY_CASE_STR(MidntBSDData);
|
---|
| 1854 | MY_CASE_STR(MidntBSDSwap);
|
---|
| 1855 | MY_CASE_STR(MidntBSDUFS);
|
---|
| 1856 | MY_CASE_STR(MidntBSDVium);
|
---|
| 1857 | MY_CASE_STR(MidntBSDZFS);
|
---|
| 1858 | MY_CASE_STR(MidntBSDUnknown);
|
---|
| 1859 | MY_CASE_STR(OpenBSDData);
|
---|
| 1860 | MY_CASE_STR(QNXPowerSafeFS);
|
---|
| 1861 | MY_CASE_STR(Plan9);
|
---|
| 1862 | MY_CASE_STR(VMWareVMKCore);
|
---|
| 1863 | MY_CASE_STR(VMWareVMFS);
|
---|
| 1864 | MY_CASE_STR(VMWareReserved);
|
---|
| 1865 | MY_CASE_STR(VMWareUnknown);
|
---|
| 1866 | MY_CASE_STR(AndroidX86Bootloader);
|
---|
| 1867 | MY_CASE_STR(AndroidX86Bootloader2);
|
---|
| 1868 | MY_CASE_STR(AndroidX86Boot);
|
---|
| 1869 | MY_CASE_STR(AndroidX86Recovery);
|
---|
| 1870 | MY_CASE_STR(AndroidX86Misc);
|
---|
| 1871 | MY_CASE_STR(AndroidX86Metadata);
|
---|
| 1872 | MY_CASE_STR(AndroidX86System);
|
---|
| 1873 | MY_CASE_STR(AndroidX86Cache);
|
---|
| 1874 | MY_CASE_STR(AndroidX86Data);
|
---|
| 1875 | MY_CASE_STR(AndroidX86Persistent);
|
---|
| 1876 | MY_CASE_STR(AndroidX86Vendor);
|
---|
| 1877 | MY_CASE_STR(AndroidX86Config);
|
---|
| 1878 | MY_CASE_STR(AndroidX86Factory);
|
---|
| 1879 | MY_CASE_STR(AndroidX86FactoryAlt);
|
---|
| 1880 | MY_CASE_STR(AndroidX86Fastboot);
|
---|
| 1881 | MY_CASE_STR(AndroidX86OEM);
|
---|
| 1882 | MY_CASE_STR(AndroidARMMeta);
|
---|
| 1883 | MY_CASE_STR(AndroidARMExt);
|
---|
| 1884 | MY_CASE_STR(ONIEBoot);
|
---|
| 1885 | MY_CASE_STR(ONIEConfig);
|
---|
| 1886 | MY_CASE_STR(PowerPCPrep);
|
---|
| 1887 | MY_CASE_STR(XDGShrBootConfig);
|
---|
| 1888 | MY_CASE_STR(CephBlock);
|
---|
| 1889 | MY_CASE_STR(CephBlockDB);
|
---|
| 1890 | MY_CASE_STR(CephBlockDBDmc);
|
---|
| 1891 | MY_CASE_STR(CephBlockDBDmcLUKS);
|
---|
| 1892 | MY_CASE_STR(CephBlockDmc);
|
---|
| 1893 | MY_CASE_STR(CephBlockDmcLUKS);
|
---|
| 1894 | MY_CASE_STR(CephBlockWALog);
|
---|
| 1895 | MY_CASE_STR(CephBlockWALogDmc);
|
---|
| 1896 | MY_CASE_STR(CephBlockWALogDmcLUKS);
|
---|
| 1897 | MY_CASE_STR(CephDisk);
|
---|
| 1898 | MY_CASE_STR(CephDiskDmc);
|
---|
| 1899 | MY_CASE_STR(CephJournal);
|
---|
| 1900 | MY_CASE_STR(CephJournalDmc);
|
---|
| 1901 | MY_CASE_STR(CephJournalDmcLUKS);
|
---|
| 1902 | MY_CASE_STR(CephLockbox);
|
---|
| 1903 | MY_CASE_STR(CephMultipathBlock1);
|
---|
| 1904 | MY_CASE_STR(CephMultipathBlock2);
|
---|
| 1905 | MY_CASE_STR(CephMultipathBlockDB);
|
---|
| 1906 | MY_CASE_STR(CephMultipathBLockWALog);
|
---|
| 1907 | MY_CASE_STR(CephMultipathJournal);
|
---|
| 1908 | MY_CASE_STR(CephMultipathOSD);
|
---|
| 1909 | MY_CASE_STR(CephOSD);
|
---|
| 1910 | MY_CASE_STR(CephOSDDmc);
|
---|
| 1911 | MY_CASE_STR(CephOSDDmcLUKS);
|
---|
| 1912 | #ifdef VBOX_WITH_XPCOM_CPP_ENUM_HACK
|
---|
| 1913 | case PartitionType_32BitHack: break;
|
---|
| 1914 | #endif
|
---|
| 1915 | /* no default! */
|
---|
| 1916 | }
|
---|
| 1917 | #undef MY_CASE_STR
|
---|
| 1918 | return pszUnknown;
|
---|
| 1919 | }
|
---|
| 1920 |
|
---|
| 1921 |
|
---|
| 1922 | /**
|
---|
| 1923 | * List all available host drives with their partitions.
|
---|
| 1924 | *
|
---|
| 1925 | * @returns See produceList.
|
---|
| 1926 | * @param pVirtualBox Reference to the IVirtualBox pointer.
|
---|
| 1927 | * @param fOptLong Long listing or human readable.
|
---|
| 1928 | */
|
---|
| 1929 | static HRESULT listHostDrives(const ComPtr<IVirtualBox> pVirtualBox, bool fOptLong)
|
---|
| 1930 | {
|
---|
[95140] | 1931 | HRESULT hrc = S_OK;
|
---|
[85929] | 1932 | ComPtr<IHost> pHost;
|
---|
| 1933 | CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(Host)(pHost.asOutParam()), hrcCheck);
|
---|
| 1934 | com::SafeIfaceArray<IHostDrive> apHostDrives;
|
---|
| 1935 | CHECK_ERROR2I_RET(pHost, COMGETTER(HostDrives)(ComSafeArrayAsOutParam(apHostDrives)), hrcCheck);
|
---|
| 1936 | for (size_t i = 0; i < apHostDrives.size(); ++i)
|
---|
| 1937 | {
|
---|
| 1938 | ComPtr<IHostDrive> pHostDrive = apHostDrives[i];
|
---|
[86142] | 1939 |
|
---|
| 1940 | /* The drivePath and model attributes are accessible even when the object
|
---|
| 1941 | is in 'limited' mode. */
|
---|
[85929] | 1942 | com::Bstr bstrDrivePath;
|
---|
| 1943 | CHECK_ERROR(pHostDrive,COMGETTER(DrivePath)(bstrDrivePath.asOutParam()));
|
---|
[95140] | 1944 | if (SUCCEEDED(hrc))
|
---|
[92372] | 1945 | RTPrintf(List::tr("%sDrive: %ls\n"), i > 0 ? "\n" : "", bstrDrivePath.raw());
|
---|
[86142] | 1946 | else
|
---|
[95140] | 1947 | RTPrintf(List::tr("%sDrive: %Rhrc\n"), i > 0 ? "\n" : "", hrc);
|
---|
[85929] | 1948 |
|
---|
| 1949 | com::Bstr bstrModel;
|
---|
[86134] | 1950 | CHECK_ERROR(pHostDrive,COMGETTER(Model)(bstrModel.asOutParam()));
|
---|
[95140] | 1951 | if (FAILED(hrc))
|
---|
| 1952 | RTPrintf(List::tr("Model: %Rhrc\n"), hrc);
|
---|
[86142] | 1953 | else if (bstrModel.isNotEmpty())
|
---|
[92372] | 1954 | RTPrintf(List::tr("Model: \"%ls\"\n"), bstrModel.raw());
|
---|
[86134] | 1955 | else
|
---|
[92372] | 1956 | RTPrintf(List::tr("Model: unknown/inaccessible\n"));
|
---|
[86134] | 1957 |
|
---|
[86142] | 1958 | /* The other attributes are not accessible in limited mode and will fail
|
---|
| 1959 | with E_ACCESSDENIED. Typically means the user cannot read the drive. */
|
---|
[85929] | 1960 | com::Bstr bstrUuidDisk;
|
---|
[95140] | 1961 | hrc = pHostDrive->COMGETTER(Uuid)(bstrUuidDisk.asOutParam());
|
---|
| 1962 | if (SUCCEEDED(hrc) && !com::Guid(bstrUuidDisk).isZero())
|
---|
[86142] | 1963 | RTPrintf("UUID: %ls\n", bstrUuidDisk.raw());
|
---|
[95140] | 1964 | else if (hrc == E_ACCESSDENIED)
|
---|
[86142] | 1965 | {
|
---|
[92372] | 1966 | RTPrintf(List::tr("Further disk and partitioning information is not available for drive \"%ls\". (E_ACCESSDENIED)\n"),
|
---|
[86142] | 1967 | bstrDrivePath.raw());
|
---|
| 1968 | continue;
|
---|
| 1969 | }
|
---|
[95140] | 1970 | else if (FAILED(hrc))
|
---|
[86142] | 1971 | {
|
---|
[95140] | 1972 | RTPrintf("UUID: %Rhrc\n", hrc);
|
---|
| 1973 | com::GlueHandleComErrorNoCtx(pHostDrive, hrc);
|
---|
[86142] | 1974 | }
|
---|
| 1975 |
|
---|
[85929] | 1976 | LONG64 cbSize = 0;
|
---|
[95140] | 1977 | hrc = pHostDrive->COMGETTER(Size)(&cbSize);
|
---|
| 1978 | if (SUCCEEDED(hrc) && fOptLong)
|
---|
[92594] | 1979 | RTPrintf(List::tr("Size: %llu bytes (%Rhcb)\n", "", cbSize), cbSize, cbSize);
|
---|
[95140] | 1980 | else if (SUCCEEDED(hrc))
|
---|
[92372] | 1981 | RTPrintf(List::tr("Size: %Rhcb\n"), cbSize);
|
---|
[86142] | 1982 | else
|
---|
[85929] | 1983 | {
|
---|
[95140] | 1984 | RTPrintf(List::tr("Size: %Rhrc\n"), hrc);
|
---|
| 1985 | com::GlueHandleComErrorNoCtx(pHostDrive, hrc);
|
---|
[86142] | 1986 | }
|
---|
| 1987 |
|
---|
| 1988 | ULONG cbSectorSize = 0;
|
---|
[95140] | 1989 | hrc = pHostDrive->COMGETTER(SectorSize)(&cbSectorSize);
|
---|
| 1990 | if (SUCCEEDED(hrc))
|
---|
[92594] | 1991 | RTPrintf(List::tr("Sector Size: %u bytes\n", "", cbSectorSize), cbSectorSize);
|
---|
[86142] | 1992 | else
|
---|
| 1993 | {
|
---|
[95140] | 1994 | RTPrintf(List::tr("Sector Size: %Rhrc\n"), hrc);
|
---|
| 1995 | com::GlueHandleComErrorNoCtx(pHostDrive, hrc);
|
---|
[86142] | 1996 | }
|
---|
| 1997 |
|
---|
| 1998 | PartitioningType_T partitioningType = (PartitioningType_T)9999;
|
---|
[95140] | 1999 | hrc = pHostDrive->COMGETTER(PartitioningType)(&partitioningType);
|
---|
| 2000 | if (SUCCEEDED(hrc))
|
---|
[92372] | 2001 | RTPrintf(List::tr("Scheme: %s\n"), partitioningType == PartitioningType_MBR ? "MBR" : "GPT");
|
---|
[86142] | 2002 | else
|
---|
| 2003 | {
|
---|
[95140] | 2004 | RTPrintf(List::tr("Scheme: %Rhrc\n"), hrc);
|
---|
| 2005 | com::GlueHandleComErrorNoCtx(pHostDrive, hrc);
|
---|
[86142] | 2006 | }
|
---|
[85929] | 2007 |
|
---|
[86142] | 2008 | com::SafeIfaceArray<IHostDrivePartition> apHostDrivesPartitions;
|
---|
[95140] | 2009 | hrc = pHostDrive->COMGETTER(Partitions)(ComSafeArrayAsOutParam(apHostDrivesPartitions));
|
---|
| 2010 | if (FAILED(hrc))
|
---|
[86142] | 2011 | {
|
---|
[95140] | 2012 | RTPrintf(List::tr("Partitions: %Rhrc\n"), hrc);
|
---|
| 2013 | com::GlueHandleComErrorNoCtx(pHostDrive, hrc);
|
---|
[86142] | 2014 | }
|
---|
| 2015 | else if (apHostDrivesPartitions.size() == 0)
|
---|
[92372] | 2016 | RTPrintf(List::tr("Partitions: None (or not able to grok them).\n"));
|
---|
[86142] | 2017 | else if (partitioningType == PartitioningType_MBR)
|
---|
| 2018 | {
|
---|
| 2019 | if (fOptLong)
|
---|
[92372] | 2020 | RTPrintf(List::tr("Partitions: First Last\n"
|
---|
| 2021 | "## Type Byte Size Byte Offset Cyl/Head/Sec Cyl/Head/Sec Active\n"));
|
---|
[86142] | 2022 | else
|
---|
[92372] | 2023 | RTPrintf(List::tr("Partitions: First Last\n"
|
---|
| 2024 | "## Type Size Start Cyl/Head/Sec Cyl/Head/Sec Active\n"));
|
---|
[86142] | 2025 | for (size_t j = 0; j < apHostDrivesPartitions.size(); ++j)
|
---|
[85929] | 2026 | {
|
---|
[86142] | 2027 | ComPtr<IHostDrivePartition> pHostDrivePartition = apHostDrivesPartitions[j];
|
---|
[85929] | 2028 |
|
---|
[86142] | 2029 | ULONG idx = 0;
|
---|
| 2030 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Number)(&idx));
|
---|
| 2031 | ULONG uType = 0;
|
---|
| 2032 | CHECK_ERROR(pHostDrivePartition, COMGETTER(TypeMBR)(&uType));
|
---|
| 2033 | ULONG uStartCylinder = 0;
|
---|
| 2034 | CHECK_ERROR(pHostDrivePartition, COMGETTER(StartCylinder)(&uStartCylinder));
|
---|
| 2035 | ULONG uStartHead = 0;
|
---|
| 2036 | CHECK_ERROR(pHostDrivePartition, COMGETTER(StartHead)(&uStartHead));
|
---|
| 2037 | ULONG uStartSector = 0;
|
---|
| 2038 | CHECK_ERROR(pHostDrivePartition, COMGETTER(StartSector)(&uStartSector));
|
---|
| 2039 | ULONG uEndCylinder = 0;
|
---|
| 2040 | CHECK_ERROR(pHostDrivePartition, COMGETTER(EndCylinder)(&uEndCylinder));
|
---|
| 2041 | ULONG uEndHead = 0;
|
---|
| 2042 | CHECK_ERROR(pHostDrivePartition, COMGETTER(EndHead)(&uEndHead));
|
---|
| 2043 | ULONG uEndSector = 0;
|
---|
| 2044 | CHECK_ERROR(pHostDrivePartition, COMGETTER(EndSector)(&uEndSector));
|
---|
| 2045 | cbSize = 0;
|
---|
| 2046 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Size)(&cbSize));
|
---|
| 2047 | LONG64 offStart = 0;
|
---|
| 2048 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Start)(&offStart));
|
---|
| 2049 | BOOL fActive = 0;
|
---|
| 2050 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Active)(&fActive));
|
---|
| 2051 | PartitionType_T enmType = PartitionType_Unknown;
|
---|
| 2052 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Type)(&enmType));
|
---|
[85929] | 2053 |
|
---|
[86142] | 2054 | /* Max size & offset here is around 16TiB with 4KiB sectors. */
|
---|
| 2055 | if (fOptLong) /* cb/off: max 16TiB; idx: max 64. */
|
---|
| 2056 | RTPrintf("%2u %02x %14llu %14llu %4u/%3u/%2u %4u/%3u/%2u %s %s\n",
|
---|
| 2057 | idx, uType, cbSize, offStart,
|
---|
| 2058 | uStartCylinder, uStartHead, uStartSector, uEndCylinder, uEndHead, uEndSector,
|
---|
[92372] | 2059 | fActive ? List::tr("yes") : List::tr("no"), PartitionTypeToString(enmType, ""));
|
---|
[86142] | 2060 | else
|
---|
| 2061 | RTPrintf("%2u %02x %8Rhcb %8Rhcb %4u/%3u/%2u %4u/%3u/%2u %s %s\n",
|
---|
| 2062 | idx, uType, (uint64_t)cbSize, (uint64_t)offStart,
|
---|
| 2063 | uStartCylinder, uStartHead, uStartSector, uEndCylinder, uEndHead, uEndSector,
|
---|
[92372] | 2064 | fActive ? List::tr("yes") : List::tr("no"), PartitionTypeToString(enmType, ""));
|
---|
[85929] | 2065 | }
|
---|
[86142] | 2066 | }
|
---|
| 2067 | else /* GPT */
|
---|
| 2068 | {
|
---|
| 2069 | /* Determin the max partition type length to try reduce the table width: */
|
---|
| 2070 | size_t cchMaxType = 0;
|
---|
| 2071 | for (size_t j = 0; j < apHostDrivesPartitions.size(); ++j)
|
---|
[85929] | 2072 | {
|
---|
[86142] | 2073 | ComPtr<IHostDrivePartition> pHostDrivePartition = apHostDrivesPartitions[j];
|
---|
| 2074 | PartitionType_T enmType = PartitionType_Unknown;
|
---|
| 2075 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Type)(&enmType));
|
---|
| 2076 | size_t const cchTypeNm = strlen(PartitionTypeToString(enmType, "e530bf6d-2754-4e9d-b260-60a5d0b80457"));
|
---|
| 2077 | cchMaxType = RT_MAX(cchTypeNm, cchMaxType);
|
---|
| 2078 | }
|
---|
| 2079 | cchMaxType = RT_MIN(cchMaxType, RTUUID_STR_LENGTH);
|
---|
[85929] | 2080 |
|
---|
[86142] | 2081 | if (fOptLong)
|
---|
[92372] | 2082 | RTPrintf(List::tr(
|
---|
| 2083 | "Partitions:\n"
|
---|
| 2084 | "## %-*s Uuid Byte Size Byte Offset Active Name\n"),
|
---|
| 2085 | (int)cchMaxType, List::tr("Type"));
|
---|
[86142] | 2086 | else
|
---|
[92372] | 2087 | RTPrintf(List::tr(
|
---|
| 2088 | "Partitions:\n"
|
---|
| 2089 | "## %-*s Uuid Size Start Active Name\n"),
|
---|
| 2090 | (int)cchMaxType, List::tr("Type"));
|
---|
[85929] | 2091 |
|
---|
[86142] | 2092 | for (size_t j = 0; j < apHostDrivesPartitions.size(); ++j)
|
---|
| 2093 | {
|
---|
| 2094 | ComPtr<IHostDrivePartition> pHostDrivePartition = apHostDrivesPartitions[j];
|
---|
[85929] | 2095 |
|
---|
[86142] | 2096 | ULONG idx = 0;
|
---|
| 2097 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Number)(&idx));
|
---|
| 2098 | com::Bstr bstrUuidType;
|
---|
| 2099 | CHECK_ERROR(pHostDrivePartition, COMGETTER(TypeUuid)(bstrUuidType.asOutParam()));
|
---|
| 2100 | com::Bstr bstrUuidPartition;
|
---|
| 2101 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Uuid)(bstrUuidPartition.asOutParam()));
|
---|
| 2102 | cbSize = 0;
|
---|
| 2103 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Size)(&cbSize));
|
---|
| 2104 | LONG64 offStart = 0;
|
---|
| 2105 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Start)(&offStart));
|
---|
| 2106 | BOOL fActive = 0;
|
---|
| 2107 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Active)(&fActive));
|
---|
| 2108 | com::Bstr bstrName;
|
---|
| 2109 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Name)(bstrName.asOutParam()));
|
---|
[85929] | 2110 |
|
---|
[86142] | 2111 | PartitionType_T enmType = PartitionType_Unknown;
|
---|
| 2112 | CHECK_ERROR(pHostDrivePartition, COMGETTER(Type)(&enmType));
|
---|
[85929] | 2113 |
|
---|
[86142] | 2114 | Utf8Str strTypeConv;
|
---|
| 2115 | const char *pszTypeNm = PartitionTypeToString(enmType, NULL);
|
---|
| 2116 | if (!pszTypeNm)
|
---|
| 2117 | pszTypeNm = (strTypeConv = bstrUuidType).c_str();
|
---|
| 2118 | else if (strlen(pszTypeNm) >= RTUUID_STR_LENGTH /* includes '\0' */)
|
---|
| 2119 | pszTypeNm -= RTUUID_STR_LENGTH - 1 - strlen(pszTypeNm);
|
---|
[85929] | 2120 |
|
---|
[86142] | 2121 | if (fOptLong)
|
---|
| 2122 | RTPrintf("%2u %-*s %36ls %19llu %19llu %-3s %ls\n", idx, cchMaxType, pszTypeNm,
|
---|
[92372] | 2123 | bstrUuidPartition.raw(), cbSize, offStart, fActive ? List::tr("on") : List::tr("off"),
|
---|
| 2124 | bstrName.raw());
|
---|
[86142] | 2125 | else
|
---|
| 2126 | RTPrintf("%2u %-*s %36ls %8Rhcb %8Rhcb %-3s %ls\n", idx, cchMaxType, pszTypeNm,
|
---|
[92372] | 2127 | bstrUuidPartition.raw(), cbSize, offStart, fActive ? List::tr("on") : List::tr("off"),
|
---|
| 2128 | bstrName.raw());
|
---|
[85929] | 2129 | }
|
---|
| 2130 | }
|
---|
| 2131 | }
|
---|
[95140] | 2132 | return hrc;
|
---|
[85929] | 2133 | }
|
---|
| 2134 |
|
---|
| 2135 |
|
---|
| 2136 | /**
|
---|
[33759] | 2137 | * The type of lists we can produce.
|
---|
| 2138 | */
|
---|
[85575] | 2139 | enum ListType_T
|
---|
[17078] | 2140 | {
|
---|
[33759] | 2141 | kListNotSpecified = 1000,
|
---|
| 2142 | kListVMs,
|
---|
| 2143 | kListRunningVMs,
|
---|
| 2144 | kListOsTypes,
|
---|
[101593] | 2145 | kListOsSubtypes,
|
---|
[33759] | 2146 | kListHostDvds,
|
---|
| 2147 | kListHostFloppies,
|
---|
[48538] | 2148 | kListInternalNetworks,
|
---|
[33759] | 2149 | kListBridgedInterfaces,
|
---|
[17945] | 2150 | #if defined(VBOX_WITH_NETFLT)
|
---|
[33759] | 2151 | kListHostOnlyInterfaces,
|
---|
[17322] | 2152 | #endif
|
---|
[91416] | 2153 | #if defined(VBOX_WITH_VMNET)
|
---|
| 2154 | kListHostOnlyNetworks,
|
---|
| 2155 | #endif
|
---|
[83169] | 2156 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
| 2157 | kListCloudNetworks,
|
---|
| 2158 | #endif
|
---|
[33759] | 2159 | kListHostCpuIDs,
|
---|
| 2160 | kListHostInfo,
|
---|
| 2161 | kListHddBackends,
|
---|
| 2162 | kListHdds,
|
---|
| 2163 | kListDvds,
|
---|
| 2164 | kListFloppies,
|
---|
| 2165 | kListUsbHost,
|
---|
| 2166 | kListUsbFilters,
|
---|
| 2167 | kListSystemProperties,
|
---|
[94643] | 2168 | #if defined(VBOX_WITH_UPDATE_AGENT)
|
---|
| 2169 | kListUpdateAgents,
|
---|
| 2170 | #endif
|
---|
[33759] | 2171 | kListDhcpServers,
|
---|
[42189] | 2172 | kListExtPacks,
|
---|
[45156] | 2173 | kListGroups,
|
---|
[48600] | 2174 | kListNatNetworks,
|
---|
[52200] | 2175 | kListVideoInputDevices,
|
---|
[73716] | 2176 | kListScreenShotFormats,
|
---|
| 2177 | kListCloudProviders,
|
---|
| 2178 | kListCloudProfiles,
|
---|
[85929] | 2179 | kListCPUProfiles,
|
---|
| 2180 | kListHostDrives
|
---|
[17078] | 2181 | };
|
---|
| 2182 |
|
---|
| 2183 |
|
---|
[33759] | 2184 | /**
|
---|
| 2185 | * Produces the specified listing.
|
---|
| 2186 | *
|
---|
| 2187 | * @returns S_OK or some COM error code that has been reported in full.
|
---|
| 2188 | * @param enmList The list to produce.
|
---|
| 2189 | * @param fOptLong Long (@c true) or short list format.
|
---|
[103598] | 2190 | * @param fOptSorted Whether the output shall be sorted or not (depends on the actual command).
|
---|
| 2191 | * @param enmPlatformArch Filters the list by the given platform architecture,
|
---|
| 2192 | * or processes all platforms if PlatformArchitecture_None is specified.
|
---|
[42748] | 2193 | * @param pVirtualBox Reference to the IVirtualBox smart pointer.
|
---|
[33759] | 2194 | */
|
---|
[103598] | 2195 | static HRESULT produceList(enum ListType_T enmCommand, bool fOptLong, bool fOptSorted, PlatformArchitecture_T enmPlatformArch,
|
---|
| 2196 | const ComPtr<IVirtualBox> &pVirtualBox)
|
---|
[1] | 2197 | {
|
---|
[95140] | 2198 | HRESULT hrc = S_OK;
|
---|
[33759] | 2199 | switch (enmCommand)
|
---|
[17078] | 2200 | {
|
---|
[33759] | 2201 | case kListNotSpecified:
|
---|
| 2202 | AssertFailed();
|
---|
| 2203 | return E_FAIL;
|
---|
[17078] | 2204 |
|
---|
[33759] | 2205 | case kListVMs:
|
---|
[1] | 2206 | {
|
---|
| 2207 | /*
|
---|
[17078] | 2208 | * Get the list of all registered VMs
|
---|
[1] | 2209 | */
|
---|
[33759] | 2210 | com::SafeIfaceArray<IMachine> machines;
|
---|
[95140] | 2211 | hrc = pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
| 2212 | if (SUCCEEDED(hrc))
|
---|
[1] | 2213 | {
|
---|
[17078] | 2214 | /*
|
---|
[65517] | 2215 | * Display it.
|
---|
[17078] | 2216 | */
|
---|
[65517] | 2217 | if (!fOptSorted)
|
---|
[17078] | 2218 | {
|
---|
[65517] | 2219 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
| 2220 | if (machines[i])
|
---|
[95140] | 2221 | hrc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
[17078] | 2222 | }
|
---|
[65517] | 2223 | else
|
---|
| 2224 | {
|
---|
| 2225 | /*
|
---|
| 2226 | * Sort the list by name before displaying it.
|
---|
| 2227 | */
|
---|
[65518] | 2228 | std::vector<std::pair<com::Bstr, IMachine *> > sortedMachines;
|
---|
[65517] | 2229 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
| 2230 | {
|
---|
| 2231 | IMachine *pMachine = machines[i];
|
---|
| 2232 | if (pMachine) /* no idea why we need to do this... */
|
---|
| 2233 | {
|
---|
| 2234 | Bstr bstrName;
|
---|
| 2235 | pMachine->COMGETTER(Name)(bstrName.asOutParam());
|
---|
| 2236 | sortedMachines.push_back(std::pair<com::Bstr, IMachine *>(bstrName, pMachine));
|
---|
| 2237 | }
|
---|
| 2238 | }
|
---|
| 2239 |
|
---|
| 2240 | std::sort(sortedMachines.begin(), sortedMachines.end());
|
---|
| 2241 |
|
---|
| 2242 | for (size_t i = 0; i < sortedMachines.size(); ++i)
|
---|
[95140] | 2243 | hrc = showVMInfo(pVirtualBox, sortedMachines[i].second, NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
[65517] | 2244 | }
|
---|
[1] | 2245 | }
|
---|
[33759] | 2246 | break;
|
---|
[1] | 2247 | }
|
---|
[17078] | 2248 |
|
---|
[33759] | 2249 | case kListRunningVMs:
|
---|
[6526] | 2250 | {
|
---|
| 2251 | /*
|
---|
[17078] | 2252 | * Get the list of all _running_ VMs
|
---|
[6526] | 2253 | */
|
---|
[33759] | 2254 | com::SafeIfaceArray<IMachine> machines;
|
---|
[95140] | 2255 | hrc = pVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
|
---|
[40540] | 2256 | com::SafeArray<MachineState_T> states;
|
---|
[95140] | 2257 | if (SUCCEEDED(hrc))
|
---|
| 2258 | hrc = pVirtualBox->GetMachineStates(ComSafeArrayAsInParam(machines), ComSafeArrayAsOutParam(states));
|
---|
| 2259 | if (SUCCEEDED(hrc))
|
---|
[6526] | 2260 | {
|
---|
[17078] | 2261 | /*
|
---|
| 2262 | * Iterate through the collection
|
---|
| 2263 | */
|
---|
[28249] | 2264 | for (size_t i = 0; i < machines.size(); ++i)
|
---|
[6526] | 2265 | {
|
---|
[17737] | 2266 | if (machines[i])
|
---|
[6526] | 2267 | {
|
---|
[40540] | 2268 | MachineState_T machineState = states[i];
|
---|
| 2269 | switch (machineState)
|
---|
[6526] | 2270 | {
|
---|
[40540] | 2271 | case MachineState_Running:
|
---|
| 2272 | case MachineState_Teleporting:
|
---|
| 2273 | case MachineState_LiveSnapshotting:
|
---|
| 2274 | case MachineState_Paused:
|
---|
| 2275 | case MachineState_TeleportingPausedVM:
|
---|
[95140] | 2276 | hrc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
|
---|
[40540] | 2277 | break;
|
---|
[63300] | 2278 | default: break; /* Shut up MSC */
|
---|
[6526] | 2279 | }
|
---|
| 2280 | }
|
---|
| 2281 | }
|
---|
| 2282 | }
|
---|
[33759] | 2283 | break;
|
---|
[6526] | 2284 | }
|
---|
[17078] | 2285 |
|
---|
[33759] | 2286 | case kListOsTypes:
|
---|
[1] | 2287 | {
|
---|
[33759] | 2288 | com::SafeIfaceArray<IGuestOSType> coll;
|
---|
[95140] | 2289 | hrc = pVirtualBox->COMGETTER(GuestOSTypes)(ComSafeArrayAsOutParam(coll));
|
---|
| 2290 | if (SUCCEEDED(hrc))
|
---|
[103598] | 2291 | listGuestOSTypes(coll, fOptLong, fOptSorted, enmPlatformArch);
|
---|
[33759] | 2292 | break;
|
---|
[1] | 2293 | }
|
---|
[17078] | 2294 |
|
---|
[101593] | 2295 | case kListOsSubtypes:
|
---|
[101164] | 2296 | {
|
---|
| 2297 | com::SafeArray<BSTR> GuestOSFamilies;
|
---|
[101180] | 2298 | CHECK_ERROR(pVirtualBox, COMGETTER(GuestOSFamilies)(ComSafeArrayAsOutParam(GuestOSFamilies)));
|
---|
[101164] | 2299 | if (SUCCEEDED(hrc))
|
---|
| 2300 | {
|
---|
| 2301 | for (size_t i = 0; i < GuestOSFamilies.size(); ++i)
|
---|
| 2302 | {
|
---|
| 2303 | const Bstr bstrOSFamily = GuestOSFamilies[i];
|
---|
[101593] | 2304 | com::SafeArray<BSTR> GuestOSSubtypes;
|
---|
[101164] | 2305 | CHECK_ERROR(pVirtualBox,
|
---|
[101593] | 2306 | GetGuestOSSubtypesByFamilyId(bstrOSFamily.raw(),
|
---|
| 2307 | ComSafeArrayAsOutParam(GuestOSSubtypes)));
|
---|
[101164] | 2308 | if (SUCCEEDED(hrc))
|
---|
| 2309 | {
|
---|
| 2310 | RTPrintf("%ls\n", bstrOSFamily.raw());
|
---|
[101593] | 2311 | for (size_t j = 0; j < GuestOSSubtypes.size(); ++j)
|
---|
[101164] | 2312 | {
|
---|
[101593] | 2313 | RTPrintf("\t%ls\n", GuestOSSubtypes[j]);
|
---|
[101164] | 2314 | com::SafeArray<BSTR> GuestOSDescs;
|
---|
[101593] | 2315 | const Bstr bstrOSSubtype = GuestOSSubtypes[j];
|
---|
[101164] | 2316 | CHECK_ERROR(pVirtualBox,
|
---|
[101593] | 2317 | GetGuestOSDescsBySubtype(bstrOSSubtype.raw(),
|
---|
[101167] | 2318 | ComSafeArrayAsOutParam(GuestOSDescs)));
|
---|
[101164] | 2319 | if (SUCCEEDED(hrc))
|
---|
| 2320 | for (size_t k = 0; k < GuestOSDescs.size(); ++k)
|
---|
| 2321 | RTPrintf("\t\t%ls\n", GuestOSDescs[k]);
|
---|
| 2322 | }
|
---|
| 2323 | }
|
---|
| 2324 | }
|
---|
| 2325 | }
|
---|
| 2326 | break;
|
---|
| 2327 | }
|
---|
| 2328 |
|
---|
[33759] | 2329 | case kListHostDvds:
|
---|
[1] | 2330 | {
|
---|
[17078] | 2331 | ComPtr<IHost> host;
|
---|
[42748] | 2332 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
[33759] | 2333 | com::SafeIfaceArray<IMedium> coll;
|
---|
[17238] | 2334 | CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
[95140] | 2335 | if (SUCCEEDED(hrc))
|
---|
[1] | 2336 | {
|
---|
[28249] | 2337 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
[17078] | 2338 | {
|
---|
[23223] | 2339 | ComPtr<IMedium> dvdDrive = coll[i];
|
---|
| 2340 | Bstr uuid;
|
---|
| 2341 | dvdDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
[31539] | 2342 | RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
|
---|
[35801] | 2343 | Bstr location;
|
---|
| 2344 | dvdDrive->COMGETTER(Location)(location.asOutParam());
|
---|
[92372] | 2345 | RTPrintf(List::tr("Name: %ls\n\n"), location.raw());
|
---|
[17078] | 2346 | }
|
---|
[1] | 2347 | }
|
---|
[33759] | 2348 | break;
|
---|
[1] | 2349 | }
|
---|
[17078] | 2350 |
|
---|
[33759] | 2351 | case kListHostFloppies:
|
---|
[1] | 2352 | {
|
---|
[17078] | 2353 | ComPtr<IHost> host;
|
---|
[42748] | 2354 | CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
|
---|
[33759] | 2355 | com::SafeIfaceArray<IMedium> coll;
|
---|
[17255] | 2356 | CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(coll)));
|
---|
[95140] | 2357 | if (SUCCEEDED(hrc))
|
---|
[1] | 2358 | {
|
---|
[17255] | 2359 | for (size_t i = 0; i < coll.size(); ++i)
|
---|
[17078] | 2360 | {
|
---|
[23223] | 2361 | ComPtr<IMedium> floppyDrive = coll[i];
|
---|
| 2362 | Bstr uuid;
|
---|
| 2363 | floppyDrive->COMGETTER(Id)(uuid.asOutParam());
|
---|
[31539] | 2364 | RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
|
---|
[35801] | 2365 | Bstr location;
|
---|
| 2366 | floppyDrive->COMGETTER(Location)(location.asOutParam());
|
---|
[92372] | 2367 | RTPrintf(List::tr("Name: %ls\n\n"), location.raw());
|
---|
[17078] | 2368 | }
|
---|
[1] | 2369 | }
|
---|
[33759] | 2370 | break;
|
---|
[1] | 2371 | }
|
---|
[17078] | 2372 |
|
---|
[48538] | 2373 | case kListInternalNetworks:
|
---|
[95140] | 2374 | hrc = listInternalNetworks(pVirtualBox);
|
---|
[48538] | 2375 | break;
|
---|
| 2376 |
|
---|
[33759] | 2377 | case kListBridgedInterfaces:
|
---|
[17945] | 2378 | #if defined(VBOX_WITH_NETFLT)
|
---|
[33759] | 2379 | case kListHostOnlyInterfaces:
|
---|
[17322] | 2380 | #endif
|
---|
[95140] | 2381 | hrc = listNetworkInterfaces(pVirtualBox, enmCommand == kListBridgedInterfaces);
|
---|
[33759] | 2382 | break;
|
---|
[10412] | 2383 |
|
---|
[91416] | 2384 | #if defined(VBOX_WITH_VMNET)
|
---|
| 2385 | case kListHostOnlyNetworks:
|
---|
[95140] | 2386 | hrc = listHostOnlyNetworks(pVirtualBox);
|
---|
[91416] | 2387 | break;
|
---|
| 2388 | #endif
|
---|
| 2389 |
|
---|
[83169] | 2390 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
| 2391 | case kListCloudNetworks:
|
---|
[95140] | 2392 | hrc = listCloudNetworks(pVirtualBox);
|
---|
[83169] | 2393 | break;
|
---|
| 2394 | #endif
|
---|
[33759] | 2395 | case kListHostInfo:
|
---|
[95140] | 2396 | hrc = listHostInfo(pVirtualBox);
|
---|
[33759] | 2397 | break;
|
---|
[17078] | 2398 |
|
---|
[33759] | 2399 | case kListHostCpuIDs:
|
---|
[24404] | 2400 | {
|
---|
| 2401 | ComPtr<IHost> Host;
|
---|
[101035] | 2402 | CHECK_ERROR_BREAK(pVirtualBox, COMGETTER(Host)(Host.asOutParam()));
|
---|
| 2403 | PlatformArchitecture_T platformArch;
|
---|
| 2404 | CHECK_ERROR_BREAK(Host, COMGETTER(Architecture)(&platformArch));
|
---|
[24404] | 2405 |
|
---|
[101035] | 2406 | switch (platformArch)
|
---|
[24416] | 2407 | {
|
---|
[101035] | 2408 | case PlatformArchitecture_x86:
|
---|
[24404] | 2409 | {
|
---|
[101035] | 2410 | ComPtr<IHostX86> HostX86;
|
---|
| 2411 | CHECK_ERROR_BREAK(Host, COMGETTER(X86)(HostX86.asOutParam()));
|
---|
| 2412 |
|
---|
| 2413 | RTPrintf(List::tr("Host CPUIDs:\n\nLeaf no. EAX EBX ECX EDX\n"));
|
---|
| 2414 | ULONG uCpuNo = 0; /* ASSUMES that CPU#0 is online. */
|
---|
| 2415 | static uint32_t const s_auCpuIdRanges[] =
|
---|
| 2416 | {
|
---|
| 2417 | UINT32_C(0x00000000), UINT32_C(0x0000007f),
|
---|
| 2418 | UINT32_C(0x80000000), UINT32_C(0x8000007f),
|
---|
| 2419 | UINT32_C(0xc0000000), UINT32_C(0xc000007f)
|
---|
| 2420 | };
|
---|
| 2421 | for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
|
---|
| 2422 | {
|
---|
| 2423 | ULONG uEAX, uEBX, uECX, uEDX, cLeafs;
|
---|
| 2424 | CHECK_ERROR(HostX86, GetProcessorCPUIDLeaf(uCpuNo, s_auCpuIdRanges[i], 0, &cLeafs, &uEBX, &uECX, &uEDX));
|
---|
| 2425 | if (cLeafs < s_auCpuIdRanges[i] || cLeafs > s_auCpuIdRanges[i+1])
|
---|
| 2426 | continue;
|
---|
| 2427 | cLeafs++;
|
---|
| 2428 | for (ULONG iLeaf = s_auCpuIdRanges[i]; iLeaf <= cLeafs; iLeaf++)
|
---|
| 2429 | {
|
---|
| 2430 | CHECK_ERROR(HostX86, GetProcessorCPUIDLeaf(uCpuNo, iLeaf, 0, &uEAX, &uEBX, &uECX, &uEDX));
|
---|
| 2431 | RTPrintf("%08x %08x %08x %08x %08x\n", iLeaf, uEAX, uEBX, uECX, uEDX);
|
---|
| 2432 | }
|
---|
| 2433 | }
|
---|
| 2434 |
|
---|
| 2435 | break;
|
---|
[24404] | 2436 | }
|
---|
[101035] | 2437 |
|
---|
| 2438 | case PlatformArchitecture_ARM:
|
---|
| 2439 | {
|
---|
| 2440 | /** @todo BUGBUG Implement this for ARM! */
|
---|
| 2441 | break;
|
---|
| 2442 | }
|
---|
| 2443 |
|
---|
| 2444 | default:
|
---|
| 2445 | AssertFailed();
|
---|
| 2446 | break;
|
---|
[24416] | 2447 | }
|
---|
[33759] | 2448 | break;
|
---|
[24404] | 2449 | }
|
---|
| 2450 |
|
---|
[33759] | 2451 | case kListHddBackends:
|
---|
[95140] | 2452 | hrc = listHddBackends(pVirtualBox);
|
---|
[33759] | 2453 | break;
|
---|
[17078] | 2454 |
|
---|
[33759] | 2455 | case kListHdds:
|
---|
[1] | 2456 | {
|
---|
[23223] | 2457 | com::SafeIfaceArray<IMedium> hdds;
|
---|
[42748] | 2458 | CHECK_ERROR(pVirtualBox, COMGETTER(HardDisks)(ComSafeArrayAsOutParam(hdds)));
|
---|
[95140] | 2459 | hrc = listMedia(pVirtualBox, hdds, List::tr("base"), fOptLong);
|
---|
[33759] | 2460 | break;
|
---|
[1] | 2461 | }
|
---|
[17078] | 2462 |
|
---|
[33759] | 2463 | case kListDvds:
|
---|
[1] | 2464 | {
|
---|
[23223] | 2465 | com::SafeIfaceArray<IMedium> dvds;
|
---|
[42748] | 2466 | CHECK_ERROR(pVirtualBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(dvds)));
|
---|
[95140] | 2467 | hrc = listMedia(pVirtualBox, dvds, NULL, fOptLong);
|
---|
[33759] | 2468 | break;
|
---|
[1] | 2469 | }
|
---|
[17078] | 2470 |
|
---|
[33759] | 2471 | case kListFloppies:
|
---|
[1] | 2472 | {
|
---|
[23223] | 2473 | com::SafeIfaceArray<IMedium> floppies;
|
---|
[42748] | 2474 | CHECK_ERROR(pVirtualBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppies)));
|
---|
[95140] | 2475 | hrc = listMedia(pVirtualBox, floppies, NULL, fOptLong);
|
---|
[33759] | 2476 | break;
|
---|
[1] | 2477 | }
|
---|
| 2478 |
|
---|
[33759] | 2479 | case kListUsbHost:
|
---|
[95140] | 2480 | hrc = listUsbHost(pVirtualBox);
|
---|
[33759] | 2481 | break;
|
---|
[1] | 2482 |
|
---|
[33759] | 2483 | case kListUsbFilters:
|
---|
[95140] | 2484 | hrc = listUsbFilters(pVirtualBox);
|
---|
[33759] | 2485 | break;
|
---|
[1] | 2486 |
|
---|
[33759] | 2487 | case kListSystemProperties:
|
---|
[95140] | 2488 | hrc = listSystemProperties(pVirtualBox);
|
---|
[33759] | 2489 | break;
|
---|
[8373] | 2490 |
|
---|
[94643] | 2491 | #ifdef VBOX_WITH_UPDATE_AGENT
|
---|
| 2492 | case kListUpdateAgents:
|
---|
[95140] | 2493 | hrc = listUpdateAgents(pVirtualBox);
|
---|
[94643] | 2494 | break;
|
---|
| 2495 | #endif
|
---|
[33759] | 2496 | case kListDhcpServers:
|
---|
[95140] | 2497 | hrc = listDhcpServers(pVirtualBox);
|
---|
[33759] | 2498 | break;
|
---|
| 2499 |
|
---|
[33766] | 2500 | case kListExtPacks:
|
---|
[95140] | 2501 | hrc = listExtensionPacks(pVirtualBox);
|
---|
[33766] | 2502 | break;
|
---|
| 2503 |
|
---|
[42189] | 2504 | case kListGroups:
|
---|
[95140] | 2505 | hrc = listGroups(pVirtualBox);
|
---|
[42189] | 2506 | break;
|
---|
| 2507 |
|
---|
[45156] | 2508 | case kListNatNetworks:
|
---|
[95140] | 2509 | hrc = listNATNetworks(fOptLong, fOptSorted, pVirtualBox);
|
---|
[45156] | 2510 | break;
|
---|
| 2511 |
|
---|
[48607] | 2512 | case kListVideoInputDevices:
|
---|
[95140] | 2513 | hrc = listVideoInputDevices(pVirtualBox);
|
---|
[48600] | 2514 | break;
|
---|
| 2515 |
|
---|
[52200] | 2516 | case kListScreenShotFormats:
|
---|
[95140] | 2517 | hrc = listScreenShotFormats(pVirtualBox);
|
---|
[52200] | 2518 | break;
|
---|
| 2519 |
|
---|
[73716] | 2520 | case kListCloudProviders:
|
---|
[95140] | 2521 | hrc = listCloudProviders(pVirtualBox);
|
---|
[73716] | 2522 | break;
|
---|
| 2523 |
|
---|
| 2524 | case kListCloudProfiles:
|
---|
[95140] | 2525 | hrc = listCloudProfiles(pVirtualBox, fOptLong);
|
---|
[73716] | 2526 | break;
|
---|
| 2527 |
|
---|
[85575] | 2528 | case kListCPUProfiles:
|
---|
[95140] | 2529 | hrc = listCPUProfiles(pVirtualBox, fOptLong, fOptSorted);
|
---|
[85575] | 2530 | break;
|
---|
| 2531 |
|
---|
[85929] | 2532 | case kListHostDrives:
|
---|
[95140] | 2533 | hrc = listHostDrives(pVirtualBox, fOptLong);
|
---|
[85929] | 2534 | break;
|
---|
[33759] | 2535 | /* No default here, want gcc warnings. */
|
---|
| 2536 |
|
---|
| 2537 | } /* end switch */
|
---|
| 2538 |
|
---|
[95140] | 2539 | return hrc;
|
---|
[1] | 2540 | }
|
---|
| 2541 |
|
---|
[33759] | 2542 | /**
|
---|
| 2543 | * Handles the 'list' command.
|
---|
| 2544 | *
|
---|
| 2545 | * @returns Appropriate exit code.
|
---|
| 2546 | * @param a Handler argument.
|
---|
| 2547 | */
|
---|
[56118] | 2548 | RTEXITCODE handleList(HandlerArg *a)
|
---|
[33759] | 2549 | {
|
---|
[103598] | 2550 | bool fOptLong = false;
|
---|
| 2551 | bool fOptMultiple = false;
|
---|
| 2552 | bool fOptSorted = false;
|
---|
| 2553 | PlatformArchitecture_T enmPlatformArch = PlatformArchitecture_None;
|
---|
| 2554 | bool fFirst = true;
|
---|
| 2555 | enum ListType_T enmOptCommand = kListNotSpecified;
|
---|
| 2556 | RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
|
---|
[33759] | 2557 |
|
---|
| 2558 | static const RTGETOPTDEF s_aListOptions[] =
|
---|
| 2559 | {
|
---|
| 2560 | { "--long", 'l', RTGETOPT_REQ_NOTHING },
|
---|
| 2561 | { "--multiple", 'm', RTGETOPT_REQ_NOTHING }, /* not offical yet */
|
---|
[103598] | 2562 | { "--platform-arch", 'p', RTGETOPT_REQ_STRING },
|
---|
| 2563 | { "--platform", 'p', RTGETOPT_REQ_STRING }, /* shortcut for '--platform-arch' */
|
---|
[65517] | 2564 | { "--sorted", 's', RTGETOPT_REQ_NOTHING },
|
---|
[33759] | 2565 | { "vms", kListVMs, RTGETOPT_REQ_NOTHING },
|
---|
| 2566 | { "runningvms", kListRunningVMs, RTGETOPT_REQ_NOTHING },
|
---|
| 2567 | { "ostypes", kListOsTypes, RTGETOPT_REQ_NOTHING },
|
---|
[101593] | 2568 | { "ossubtypes", kListOsSubtypes, RTGETOPT_REQ_NOTHING },
|
---|
[33759] | 2569 | { "hostdvds", kListHostDvds, RTGETOPT_REQ_NOTHING },
|
---|
| 2570 | { "hostfloppies", kListHostFloppies, RTGETOPT_REQ_NOTHING },
|
---|
[48538] | 2571 | { "intnets", kListInternalNetworks, RTGETOPT_REQ_NOTHING },
|
---|
[33759] | 2572 | { "hostifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING }, /* backward compatibility */
|
---|
| 2573 | { "bridgedifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING },
|
---|
| 2574 | #if defined(VBOX_WITH_NETFLT)
|
---|
| 2575 | { "hostonlyifs", kListHostOnlyInterfaces, RTGETOPT_REQ_NOTHING },
|
---|
| 2576 | #endif
|
---|
[91416] | 2577 | #if defined(VBOX_WITH_VMNET)
|
---|
| 2578 | { "hostonlynets", kListHostOnlyNetworks, RTGETOPT_REQ_NOTHING },
|
---|
| 2579 | #endif
|
---|
[83169] | 2580 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
| 2581 | { "cloudnets", kListCloudNetworks, RTGETOPT_REQ_NOTHING },
|
---|
| 2582 | #endif
|
---|
[48538] | 2583 | { "natnetworks", kListNatNetworks, RTGETOPT_REQ_NOTHING },
|
---|
| 2584 | { "natnets", kListNatNetworks, RTGETOPT_REQ_NOTHING },
|
---|
[33759] | 2585 | { "hostinfo", kListHostInfo, RTGETOPT_REQ_NOTHING },
|
---|
| 2586 | { "hostcpuids", kListHostCpuIDs, RTGETOPT_REQ_NOTHING },
|
---|
| 2587 | { "hddbackends", kListHddBackends, RTGETOPT_REQ_NOTHING },
|
---|
| 2588 | { "hdds", kListHdds, RTGETOPT_REQ_NOTHING },
|
---|
| 2589 | { "dvds", kListDvds, RTGETOPT_REQ_NOTHING },
|
---|
| 2590 | { "floppies", kListFloppies, RTGETOPT_REQ_NOTHING },
|
---|
| 2591 | { "usbhost", kListUsbHost, RTGETOPT_REQ_NOTHING },
|
---|
| 2592 | { "usbfilters", kListUsbFilters, RTGETOPT_REQ_NOTHING },
|
---|
| 2593 | { "systemproperties", kListSystemProperties, RTGETOPT_REQ_NOTHING },
|
---|
[94643] | 2594 | #if defined(VBOX_WITH_UPDATE_AGENT)
|
---|
| 2595 | { "updates", kListUpdateAgents, RTGETOPT_REQ_NOTHING },
|
---|
| 2596 | #endif
|
---|
[33759] | 2597 | { "dhcpservers", kListDhcpServers, RTGETOPT_REQ_NOTHING },
|
---|
[33766] | 2598 | { "extpacks", kListExtPacks, RTGETOPT_REQ_NOTHING },
|
---|
[42189] | 2599 | { "groups", kListGroups, RTGETOPT_REQ_NOTHING },
|
---|
[48607] | 2600 | { "webcams", kListVideoInputDevices, RTGETOPT_REQ_NOTHING },
|
---|
[52200] | 2601 | { "screenshotformats", kListScreenShotFormats, RTGETOPT_REQ_NOTHING },
|
---|
[73716] | 2602 | { "cloudproviders", kListCloudProviders, RTGETOPT_REQ_NOTHING },
|
---|
| 2603 | { "cloudprofiles", kListCloudProfiles, RTGETOPT_REQ_NOTHING },
|
---|
[85575] | 2604 | { "cpu-profiles", kListCPUProfiles, RTGETOPT_REQ_NOTHING },
|
---|
[85929] | 2605 | { "hostdrives", kListHostDrives, RTGETOPT_REQ_NOTHING },
|
---|
[33759] | 2606 | };
|
---|
| 2607 |
|
---|
| 2608 | int ch;
|
---|
| 2609 | RTGETOPTUNION ValueUnion;
|
---|
| 2610 | RTGETOPTSTATE GetState;
|
---|
| 2611 | RTGetOptInit(&GetState, a->argc, a->argv, s_aListOptions, RT_ELEMENTS(s_aListOptions),
|
---|
| 2612 | 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
|
---|
| 2613 | while ((ch = RTGetOpt(&GetState, &ValueUnion)))
|
---|
| 2614 | {
|
---|
| 2615 | switch (ch)
|
---|
| 2616 | {
|
---|
| 2617 | case 'l': /* --long */
|
---|
| 2618 | fOptLong = true;
|
---|
| 2619 | break;
|
---|
| 2620 |
|
---|
| 2621 | case 'm':
|
---|
| 2622 | fOptMultiple = true;
|
---|
| 2623 | if (enmOptCommand == kListNotSpecified)
|
---|
| 2624 | break;
|
---|
| 2625 | ch = enmOptCommand;
|
---|
[69046] | 2626 | RT_FALL_THRU();
|
---|
[33759] | 2627 |
|
---|
[103598] | 2628 | case 'p': /* --platform[-arch] */
|
---|
| 2629 | enmPlatformArch = platformArchitectureToStr(ValueUnion.psz);
|
---|
| 2630 | if (enmPlatformArch == PlatformArchitecture_None)
|
---|
| 2631 | return errorSyntax(List::tr("Invalid platform architecture specified"));
|
---|
| 2632 | break;
|
---|
| 2633 |
|
---|
| 2634 | case 's':
|
---|
| 2635 | fOptSorted = true;
|
---|
| 2636 | break;
|
---|
| 2637 |
|
---|
[33759] | 2638 | case kListVMs:
|
---|
| 2639 | case kListRunningVMs:
|
---|
| 2640 | case kListOsTypes:
|
---|
[101593] | 2641 | case kListOsSubtypes:
|
---|
[33759] | 2642 | case kListHostDvds:
|
---|
| 2643 | case kListHostFloppies:
|
---|
[48538] | 2644 | case kListInternalNetworks:
|
---|
[33759] | 2645 | case kListBridgedInterfaces:
|
---|
| 2646 | #if defined(VBOX_WITH_NETFLT)
|
---|
| 2647 | case kListHostOnlyInterfaces:
|
---|
| 2648 | #endif
|
---|
[91416] | 2649 | #if defined(VBOX_WITH_VMNET)
|
---|
| 2650 | case kListHostOnlyNetworks:
|
---|
| 2651 | #endif
|
---|
[83169] | 2652 | #if defined(VBOX_WITH_CLOUD_NET)
|
---|
| 2653 | case kListCloudNetworks:
|
---|
| 2654 | #endif
|
---|
[33759] | 2655 | case kListHostInfo:
|
---|
| 2656 | case kListHostCpuIDs:
|
---|
| 2657 | case kListHddBackends:
|
---|
| 2658 | case kListHdds:
|
---|
| 2659 | case kListDvds:
|
---|
| 2660 | case kListFloppies:
|
---|
| 2661 | case kListUsbHost:
|
---|
| 2662 | case kListUsbFilters:
|
---|
| 2663 | case kListSystemProperties:
|
---|
[94643] | 2664 | #if defined(VBOX_WITH_UPDATE_AGENT)
|
---|
| 2665 | case kListUpdateAgents:
|
---|
| 2666 | #endif
|
---|
[33759] | 2667 | case kListDhcpServers:
|
---|
[33766] | 2668 | case kListExtPacks:
|
---|
[42189] | 2669 | case kListGroups:
|
---|
[45156] | 2670 | case kListNatNetworks:
|
---|
[48607] | 2671 | case kListVideoInputDevices:
|
---|
[52200] | 2672 | case kListScreenShotFormats:
|
---|
[73716] | 2673 | case kListCloudProviders:
|
---|
| 2674 | case kListCloudProfiles:
|
---|
[85575] | 2675 | case kListCPUProfiles:
|
---|
[85929] | 2676 | case kListHostDrives:
|
---|
[85575] | 2677 | enmOptCommand = (enum ListType_T)ch;
|
---|
[33759] | 2678 | if (fOptMultiple)
|
---|
| 2679 | {
|
---|
[89915] | 2680 | if (fFirst)
|
---|
| 2681 | fFirst = false;
|
---|
| 2682 | else
|
---|
| 2683 | RTPrintf("\n");
|
---|
| 2684 | RTPrintf("[%s]\n", ValueUnion.pDef->pszLong);
|
---|
[103598] | 2685 | HRESULT hrc = produceList(enmOptCommand, fOptLong, fOptSorted, enmPlatformArch, a->virtualBox);
|
---|
[33759] | 2686 | if (FAILED(hrc))
|
---|
[89915] | 2687 | rcExit = RTEXITCODE_FAILURE;
|
---|
[33759] | 2688 | }
|
---|
| 2689 | break;
|
---|
| 2690 |
|
---|
| 2691 | case VINF_GETOPT_NOT_OPTION:
|
---|
[93699] | 2692 | return errorSyntax(List::tr("Unknown subcommand \"%s\"."), ValueUnion.psz);
|
---|
[33759] | 2693 |
|
---|
| 2694 | default:
|
---|
[93699] | 2695 | return errorGetOpt(ch, &ValueUnion);
|
---|
[33759] | 2696 | }
|
---|
| 2697 | }
|
---|
| 2698 |
|
---|
| 2699 | /*
|
---|
| 2700 | * If not in multiple list mode, we have to produce the list now.
|
---|
| 2701 | */
|
---|
| 2702 | if (enmOptCommand == kListNotSpecified)
|
---|
[93699] | 2703 | return errorSyntax(List::tr("Missing subcommand for \"list\" command.\n"));
|
---|
[33759] | 2704 | if (!fOptMultiple)
|
---|
| 2705 | {
|
---|
[103598] | 2706 | HRESULT hrc = produceList(enmOptCommand, fOptLong, fOptSorted, enmPlatformArch, a->virtualBox);
|
---|
[33759] | 2707 | if (FAILED(hrc))
|
---|
[89915] | 2708 | rcExit = RTEXITCODE_FAILURE;
|
---|
[33759] | 2709 | }
|
---|
| 2710 |
|
---|
[89915] | 2711 | return rcExit;
|
---|
[33759] | 2712 | }
|
---|
| 2713 |
|
---|
[17238] | 2714 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|