VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp@ 94740

Last change on this file since 94740 was 94714, checked in by vboxsync, 3 years ago

Main,Settings: Integrate the extension pack cryptographic module in the ExtPack manager etc., bugref:9955

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette