VirtualBox

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

Last change on this file since 39451 was 39248, checked in by vboxsync, 14 years ago

Runtime: new guest OS type for Solaris 11
Frontends/VirtualBox: add new patterns for Solaris 11 guest OS type, reuse the icon
Frontends/VBoxManage: more details for "list ostypes"
Main/xml: make guest OS type in config file an arbitrary string (still validated/mapped in the old way in the settings code), remove hardcoded limit of 8 network adapters
Main/Global: move list of valid guest OS types into a single place, add function to get the network adapter limit for each chipset type
Main/Console+Machine+Snapshot+NetworkAdapter+Appliance+VirtualBox+Guest+SystemProperties: consistently use the appropriate network adapter limit so that ICH9 chipset can use 36 network adapters, adapt to cleaned up guest OS type handling, remove leftover rendundant guest OS mapping, whitespace
Network/NAT: release log message cosmetics, allow unlimited number of instances, fix maxconn clamping
Network/PCNet+VirtioNet+E1000: allow unlimited number of instances

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 45.2 KB
Line 
1/* $Id: VBoxManageList.cpp 39248 2011-11-09 12:29:53Z vboxsync $ */
2/** @file
3 * VBoxManage - The 'list' command.
4 */
5
6/*
7 * Copyright (C) 2006-2011 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#ifndef VBOX_ONLY_DOCS
19
20/*******************************************************************************
21* Header Files *
22*******************************************************************************/
23#include <VBox/com/com.h>
24#include <VBox/com/string.h>
25#include <VBox/com/Guid.h>
26#include <VBox/com/array.h>
27#include <VBox/com/ErrorInfo.h>
28#include <VBox/com/errorprint.h>
29
30#include <VBox/com/VirtualBox.h>
31
32#include <VBox/log.h>
33#include <iprt/stream.h>
34#include <iprt/string.h>
35#include <iprt/time.h>
36#include <iprt/getopt.h>
37#include <iprt/ctype.h>
38
39#include "VBoxManage.h"
40using namespace com;
41
42#ifdef VBOX_WITH_HOSTNETIF_API
43static const char *getHostIfMediumTypeText(HostNetworkInterfaceMediumType_T enmType)
44{
45 switch (enmType)
46 {
47 case HostNetworkInterfaceMediumType_Ethernet: return "Ethernet";
48 case HostNetworkInterfaceMediumType_PPP: return "PPP";
49 case HostNetworkInterfaceMediumType_SLIP: return "SLIP";
50 }
51 return "Unknown";
52}
53
54static const char *getHostIfStatusText(HostNetworkInterfaceStatus_T enmStatus)
55{
56 switch (enmStatus)
57 {
58 case HostNetworkInterfaceStatus_Up: return "Up";
59 case HostNetworkInterfaceStatus_Down: return "Down";
60 }
61 return "Unknown";
62}
63#endif /* VBOX_WITH_HOSTNETIF_API */
64
65static const char*getDeviceTypeText(DeviceType_T enmType)
66{
67 switch (enmType)
68 {
69 case DeviceType_HardDisk: return "HardDisk";
70 case DeviceType_DVD: return "DVD";
71 case DeviceType_Floppy: return "Floppy";
72 }
73 return "Unknown";
74}
75
76static void listMedia(const ComPtr<IVirtualBox> aVirtualBox,
77 const com::SafeIfaceArray<IMedium> &aMedia,
78 const char *pszParentUUIDStr)
79{
80 HRESULT rc;
81 for (size_t i = 0; i < aMedia.size(); ++i)
82 {
83 ComPtr<IMedium> pMedium = aMedia[i];
84 Bstr uuid;
85 pMedium->COMGETTER(Id)(uuid.asOutParam());
86 RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
87 if (pszParentUUIDStr)
88 RTPrintf("Parent UUID: %s\n", pszParentUUIDStr);
89 Bstr format;
90 pMedium->COMGETTER(Format)(format.asOutParam());
91 RTPrintf("Format: %ls\n", format.raw());
92 Bstr filepath;
93 pMedium->COMGETTER(Location)(filepath.asOutParam());
94 RTPrintf("Location: %ls\n", filepath.raw());
95
96 MediumState_T enmState;
97 pMedium->RefreshState(&enmState);
98 const char *stateStr = "unknown";
99 switch (enmState)
100 {
101 case MediumState_NotCreated:
102 stateStr = "not created";
103 break;
104 case MediumState_Created:
105 stateStr = "created";
106 break;
107 case MediumState_LockedRead:
108 stateStr = "locked read";
109 break;
110 case MediumState_LockedWrite:
111 stateStr = "locked write";
112 break;
113 case MediumState_Inaccessible:
114 stateStr = "inaccessible";
115 break;
116 case MediumState_Creating:
117 stateStr = "creating";
118 break;
119 case MediumState_Deleting:
120 stateStr = "deleting";
121 break;
122 }
123 RTPrintf("State: %s\n", stateStr);
124
125 MediumType_T type;
126 pMedium->COMGETTER(Type)(&type);
127 const char *typeStr = "unknown";
128 switch (type)
129 {
130 case MediumType_Normal:
131 typeStr = "normal";
132 break;
133 case MediumType_Immutable:
134 typeStr = "immutable";
135 break;
136 case MediumType_Writethrough:
137 typeStr = "writethrough";
138 break;
139 case MediumType_Shareable:
140 typeStr = "shareable";
141 break;
142 case MediumType_Readonly:
143 typeStr = "readonly";
144 break;
145 case MediumType_MultiAttach:
146 typeStr = "multiattach";
147 break;
148 }
149 RTPrintf("Type: %s\n", typeStr);
150
151 com::SafeArray<BSTR> machineIds;
152 pMedium->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds));
153 for (size_t j = 0; j < machineIds.size(); ++j)
154 {
155 ComPtr<IMachine> machine;
156 CHECK_ERROR(aVirtualBox, FindMachine(machineIds[j], machine.asOutParam()));
157 ASSERT(machine);
158 Bstr name;
159 machine->COMGETTER(Name)(name.asOutParam());
160 RTPrintf("%s%ls (UUID: %ls)",
161 j == 0 ? "Usage: " : " ",
162 name.raw(), machineIds[j]);
163 com::SafeArray<BSTR> snapshotIds;
164 pMedium->GetSnapshotIds(machineIds[j],
165 ComSafeArrayAsOutParam(snapshotIds));
166 for (size_t k = 0; k < snapshotIds.size(); ++k)
167 {
168 ComPtr<ISnapshot> snapshot;
169 machine->FindSnapshot(snapshotIds[k], snapshot.asOutParam());
170 if (snapshot)
171 {
172 Bstr snapshotName;
173 snapshot->COMGETTER(Name)(snapshotName.asOutParam());
174 RTPrintf(" [%ls (UUID: %ls)]", snapshotName.raw(), snapshotIds[k]);
175 }
176 }
177 RTPrintf("\n");
178 }
179 RTPrintf("\n");
180
181 com::SafeIfaceArray<IMedium> children;
182 CHECK_ERROR(pMedium, COMGETTER(Children)(ComSafeArrayAsOutParam(children)));
183 if (children.size() > 0)
184 {
185 // depth first listing of child media
186 listMedia(aVirtualBox, children, Utf8Str(uuid).c_str());
187 }
188 }
189}
190
191
192/**
193 * List extension packs.
194 *
195 * @returns See produceList.
196 * @param rptrVirtualBox Reference to the IVirtualBox smart pointer.
197 */
198static HRESULT listExtensionPacks(const ComPtr<IVirtualBox> &rptrVirtualBox)
199{
200 ComObjPtr<IExtPackManager> ptrExtPackMgr;
201 CHECK_ERROR2_RET(rptrVirtualBox, COMGETTER(ExtensionPackManager)(ptrExtPackMgr.asOutParam()), hrcCheck);
202
203 SafeIfaceArray<IExtPack> extPacks;
204 CHECK_ERROR2_RET(ptrExtPackMgr, COMGETTER(InstalledExtPacks)(ComSafeArrayAsOutParam(extPacks)), hrcCheck);
205 RTPrintf("Extension Packs: %u\n", extPacks.size());
206
207 HRESULT hrc = S_OK;
208 for (size_t i = 0; i < extPacks.size(); i++)
209 {
210 /* Read all the properties. */
211 Bstr bstrName;
212 CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Name)(bstrName.asOutParam()), hrc = hrcCheck; bstrName.setNull());
213 Bstr bstrDesc;
214 CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Description)(bstrDesc.asOutParam()), hrc = hrcCheck; bstrDesc.setNull());
215 Bstr bstrVersion;
216 CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Version)(bstrVersion.asOutParam()), hrc = hrcCheck; bstrVersion.setNull());
217 ULONG uRevision;
218 CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Revision)(&uRevision), hrc = hrcCheck; uRevision = 0);
219 Bstr bstrVrdeModule;
220 CHECK_ERROR2_STMT(extPacks[i], COMGETTER(VRDEModule)(bstrVrdeModule.asOutParam()),hrc=hrcCheck; bstrVrdeModule.setNull());
221 BOOL fUsable;
222 CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Usable)(&fUsable), hrc = hrcCheck; fUsable = FALSE);
223 Bstr bstrWhy;
224 CHECK_ERROR2_STMT(extPacks[i], COMGETTER(WhyUnusable)(bstrWhy.asOutParam()), hrc = hrcCheck; bstrWhy.setNull());
225
226 /* Display them. */
227 if (i)
228 RTPrintf("\n");
229 RTPrintf("Pack no.%2zu: %ls\n"
230 "Version: %ls\n"
231 "Revision: %u\n"
232 "Description: %ls\n"
233 "VRDE Module: %ls\n"
234 "Usable: %RTbool\n"
235 "Why unusable: %ls\n",
236 i, bstrName.raw(),
237 bstrVersion.raw(),
238 uRevision,
239 bstrDesc.raw(),
240 bstrVrdeModule.raw(),
241 fUsable != FALSE,
242 bstrWhy.raw());
243
244 /* Query plugins and display them. */
245 }
246 return hrc;
247}
248
249
250/**
251 * The type of lists we can produce.
252 */
253enum enmListType
254{
255 kListNotSpecified = 1000,
256 kListVMs,
257 kListRunningVMs,
258 kListOsTypes,
259 kListHostDvds,
260 kListHostFloppies,
261 kListBridgedInterfaces,
262#if defined(VBOX_WITH_NETFLT)
263 kListHostOnlyInterfaces,
264#endif
265 kListHostCpuIDs,
266 kListHostInfo,
267 kListHddBackends,
268 kListHdds,
269 kListDvds,
270 kListFloppies,
271 kListUsbHost,
272 kListUsbFilters,
273 kListSystemProperties,
274 kListDhcpServers,
275 kListExtPacks
276};
277
278
279/**
280 * Produces the specified listing.
281 *
282 * @returns S_OK or some COM error code that has been reported in full.
283 * @param enmList The list to produce.
284 * @param fOptLong Long (@c true) or short list format.
285 * @param rptrVirtualBox Reference to the IVirtualBox smart pointer.
286 */
287static HRESULT produceList(enum enmListType enmCommand, bool fOptLong, const ComPtr<IVirtualBox> &rptrVirtualBox)
288{
289 HRESULT rc = S_OK;
290 switch (enmCommand)
291 {
292 case kListNotSpecified:
293 AssertFailed();
294 return E_FAIL;
295
296 case kListVMs:
297 {
298 /*
299 * Get the list of all registered VMs
300 */
301 com::SafeIfaceArray<IMachine> machines;
302 rc = rptrVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
303 if (SUCCEEDED(rc))
304 {
305 /*
306 * Iterate through the collection
307 */
308 for (size_t i = 0; i < machines.size(); ++i)
309 {
310 if (machines[i])
311 rc = showVMInfo(rptrVirtualBox, machines[i], fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
312 }
313 }
314 break;
315 }
316
317 case kListRunningVMs:
318 {
319 /*
320 * Get the list of all _running_ VMs
321 */
322 com::SafeIfaceArray<IMachine> machines;
323 rc = rptrVirtualBox->COMGETTER(Machines)(ComSafeArrayAsOutParam(machines));
324 if (SUCCEEDED(rc))
325 {
326 /*
327 * Iterate through the collection
328 */
329 for (size_t i = 0; i < machines.size(); ++i)
330 {
331 if (machines[i])
332 {
333 MachineState_T machineState;
334 rc = machines[i]->COMGETTER(State)(&machineState);
335 if (SUCCEEDED(rc))
336 {
337 switch (machineState)
338 {
339 case MachineState_Running:
340 case MachineState_Teleporting:
341 case MachineState_LiveSnapshotting:
342 case MachineState_Paused:
343 case MachineState_TeleportingPausedVM:
344 rc = showVMInfo(rptrVirtualBox, machines[i], fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
345 break;
346 }
347 }
348 }
349 }
350 }
351 break;
352 }
353
354 case kListOsTypes:
355 {
356 com::SafeIfaceArray<IGuestOSType> coll;
357 rc = rptrVirtualBox->COMGETTER(GuestOSTypes)(ComSafeArrayAsOutParam(coll));
358 if (SUCCEEDED(rc))
359 {
360 /*
361 * Iterate through the collection.
362 */
363 for (size_t i = 0; i < coll.size(); ++i)
364 {
365 ComPtr<IGuestOSType> guestOS;
366 guestOS = coll[i];
367 Bstr guestId;
368 guestOS->COMGETTER(Id)(guestId.asOutParam());
369 RTPrintf("ID: %ls\n", guestId.raw());
370 Bstr guestDescription;
371 guestOS->COMGETTER(Description)(guestDescription.asOutParam());
372 RTPrintf("Description: %ls\n", guestDescription.raw());
373 Bstr familyId;
374 guestOS->COMGETTER(FamilyId)(familyId.asOutParam());
375 RTPrintf("Family ID: %ls\n", familyId.raw());
376 Bstr familyDescription;
377 guestOS->COMGETTER(FamilyDescription)(familyDescription.asOutParam());
378 RTPrintf("Family Desc: %ls\n", familyDescription.raw());
379 BOOL is64Bit;
380 guestOS->COMGETTER(Is64Bit)(&is64Bit);
381 RTPrintf("64 bit: %RTbool\n", is64Bit);
382 RTPrintf("\n");
383 }
384 }
385 break;
386 }
387
388 case kListHostDvds:
389 {
390 ComPtr<IHost> host;
391 CHECK_ERROR(rptrVirtualBox, COMGETTER(Host)(host.asOutParam()));
392 com::SafeIfaceArray<IMedium> coll;
393 CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
394 if (SUCCEEDED(rc))
395 {
396 for (size_t i = 0; i < coll.size(); ++i)
397 {
398 ComPtr<IMedium> dvdDrive = coll[i];
399 Bstr uuid;
400 dvdDrive->COMGETTER(Id)(uuid.asOutParam());
401 RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
402 Bstr location;
403 dvdDrive->COMGETTER(Location)(location.asOutParam());
404 RTPrintf("Name: %ls\n\n", location.raw());
405 }
406 }
407 break;
408 }
409
410 case kListHostFloppies:
411 {
412 ComPtr<IHost> host;
413 CHECK_ERROR(rptrVirtualBox, COMGETTER(Host)(host.asOutParam()));
414 com::SafeIfaceArray<IMedium> coll;
415 CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(coll)));
416 if (SUCCEEDED(rc))
417 {
418 for (size_t i = 0; i < coll.size(); ++i)
419 {
420 ComPtr<IMedium> floppyDrive = coll[i];
421 Bstr uuid;
422 floppyDrive->COMGETTER(Id)(uuid.asOutParam());
423 RTPrintf("UUID: %s\n", Utf8Str(uuid).c_str());
424 Bstr location;
425 floppyDrive->COMGETTER(Location)(location.asOutParam());
426 RTPrintf("Name: %ls\n\n", location.raw());
427 }
428 }
429 break;
430 }
431
432 /** @todo function. */
433 case kListBridgedInterfaces:
434#if defined(VBOX_WITH_NETFLT)
435 case kListHostOnlyInterfaces:
436#endif
437 {
438 ComPtr<IHost> host;
439 CHECK_ERROR(rptrVirtualBox, COMGETTER(Host)(host.asOutParam()));
440 com::SafeIfaceArray<IHostNetworkInterface> hostNetworkInterfaces;
441#if defined(VBOX_WITH_NETFLT)
442 if (enmCommand == kListBridgedInterfaces)
443 CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_Bridged,
444 ComSafeArrayAsOutParam(hostNetworkInterfaces)));
445 else
446 CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_HostOnly,
447 ComSafeArrayAsOutParam(hostNetworkInterfaces)));
448#else
449 CHECK_ERROR(host, COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(hostNetworkInterfaces)));
450#endif
451 for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i)
452 {
453 ComPtr<IHostNetworkInterface> networkInterface = hostNetworkInterfaces[i];
454#ifndef VBOX_WITH_HOSTNETIF_API
455 Bstr interfaceName;
456 networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
457 RTPrintf("Name: %ls\n", interfaceName.raw());
458 Guid interfaceGuid;
459 networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
460 RTPrintf("GUID: %ls\n\n", Bstr(interfaceGuid.toString()).raw());
461#else /* VBOX_WITH_HOSTNETIF_API */
462 Bstr interfaceName;
463 networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
464 RTPrintf("Name: %ls\n", interfaceName.raw());
465 Bstr interfaceGuid;
466 networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
467 RTPrintf("GUID: %ls\n", interfaceGuid.raw());
468 BOOL bDhcpEnabled;
469 networkInterface->COMGETTER(DhcpEnabled)(&bDhcpEnabled);
470 RTPrintf("Dhcp: %s\n", bDhcpEnabled ? "Enabled" : "Disabled");
471
472 Bstr IPAddress;
473 networkInterface->COMGETTER(IPAddress)(IPAddress.asOutParam());
474 RTPrintf("IPAddress: %ls\n", IPAddress.raw());
475 Bstr NetworkMask;
476 networkInterface->COMGETTER(NetworkMask)(NetworkMask.asOutParam());
477 RTPrintf("NetworkMask: %ls\n", NetworkMask.raw());
478 Bstr IPV6Address;
479 networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
480 RTPrintf("IPV6Address: %ls\n", IPV6Address.raw());
481 ULONG IPV6NetworkMaskPrefixLength;
482 networkInterface->COMGETTER(IPV6NetworkMaskPrefixLength)(&IPV6NetworkMaskPrefixLength);
483 RTPrintf("IPV6NetworkMaskPrefixLength: %d\n", IPV6NetworkMaskPrefixLength);
484 Bstr HardwareAddress;
485 networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam());
486 RTPrintf("HardwareAddress: %ls\n", HardwareAddress.raw());
487 HostNetworkInterfaceMediumType_T Type;
488 networkInterface->COMGETTER(MediumType)(&Type);
489 RTPrintf("MediumType: %s\n", getHostIfMediumTypeText(Type));
490 HostNetworkInterfaceStatus_T Status;
491 networkInterface->COMGETTER(Status)(&Status);
492 RTPrintf("Status: %s\n", getHostIfStatusText(Status));
493 Bstr netName;
494 networkInterface->COMGETTER(NetworkName)(netName.asOutParam());
495 RTPrintf("VBoxNetworkName: %ls\n\n", netName.raw());
496#endif
497 }
498 break;
499 }
500
501 /** @todo function. */
502 case kListHostInfo:
503 {
504 ComPtr<IHost> Host;
505 CHECK_ERROR(rptrVirtualBox, COMGETTER(Host)(Host.asOutParam()));
506
507 RTPrintf("Host Information:\n\n");
508
509 LONG64 u64UtcTime = 0;
510 CHECK_ERROR(Host, COMGETTER(UTCTime)(&u64UtcTime));
511 RTTIMESPEC timeSpec;
512 char szTime[32];
513 RTPrintf("Host time: %s\n", RTTimeSpecToString(RTTimeSpecSetMilli(&timeSpec, u64UtcTime), szTime, sizeof(szTime)));
514
515 ULONG processorOnlineCount = 0;
516 CHECK_ERROR(Host, COMGETTER(ProcessorOnlineCount)(&processorOnlineCount));
517 RTPrintf("Processor online count: %lu\n", processorOnlineCount);
518 ULONG processorCount = 0;
519 CHECK_ERROR(Host, COMGETTER(ProcessorCount)(&processorCount));
520 RTPrintf("Processor count: %lu\n", processorCount);
521 ULONG processorSpeed = 0;
522 Bstr processorDescription;
523 for (ULONG i = 0; i < processorCount; i++)
524 {
525 CHECK_ERROR(Host, GetProcessorSpeed(i, &processorSpeed));
526 if (processorSpeed)
527 RTPrintf("Processor#%u speed: %lu MHz\n", i, processorSpeed);
528 else
529 RTPrintf("Processor#%u speed: unknown\n", i, processorSpeed);
530 CHECK_ERROR(Host, GetProcessorDescription(i, processorDescription.asOutParam()));
531 RTPrintf("Processor#%u description: %ls\n", i, processorDescription.raw());
532 }
533
534 ULONG memorySize = 0;
535 CHECK_ERROR(Host, COMGETTER(MemorySize)(&memorySize));
536 RTPrintf("Memory size: %lu MByte\n", memorySize);
537
538 ULONG memoryAvailable = 0;
539 CHECK_ERROR(Host, COMGETTER(MemoryAvailable)(&memoryAvailable));
540 RTPrintf("Memory available: %lu MByte\n", memoryAvailable);
541
542 Bstr operatingSystem;
543 CHECK_ERROR(Host, COMGETTER(OperatingSystem)(operatingSystem.asOutParam()));
544 RTPrintf("Operating system: %ls\n", operatingSystem.raw());
545
546 Bstr oSVersion;
547 CHECK_ERROR(Host, COMGETTER(OSVersion)(oSVersion.asOutParam()));
548 RTPrintf("Operating system version: %ls\n", oSVersion.raw());
549 break;
550 }
551
552 case kListHostCpuIDs:
553 {
554 ComPtr<IHost> Host;
555 CHECK_ERROR(rptrVirtualBox, COMGETTER(Host)(Host.asOutParam()));
556
557 RTPrintf("Host CPUIDs:\n\nLeaf no. EAX EBX ECX EDX\n");
558 ULONG uCpuNo = 0; /* ASSUMES that CPU#0 is online. */
559 static uint32_t const s_auCpuIdRanges[] =
560 {
561 UINT32_C(0x00000000), UINT32_C(0x0000007f),
562 UINT32_C(0x80000000), UINT32_C(0x8000007f),
563 UINT32_C(0xc0000000), UINT32_C(0xc000007f)
564 };
565 for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
566 {
567 ULONG uEAX, uEBX, uECX, uEDX, cLeafs;
568 CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, s_auCpuIdRanges[i], 0, &cLeafs, &uEBX, &uECX, &uEDX));
569 if (cLeafs < s_auCpuIdRanges[i] || cLeafs > s_auCpuIdRanges[i+1])
570 continue;
571 cLeafs++;
572 for (ULONG iLeaf = s_auCpuIdRanges[i]; iLeaf <= cLeafs; iLeaf++)
573 {
574 CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, iLeaf, 0, &uEAX, &uEBX, &uECX, &uEDX));
575 RTPrintf("%08x %08x %08x %08x %08x\n", iLeaf, uEAX, uEBX, uECX, uEDX);
576 }
577 }
578 break;
579 }
580
581 /** @todo function. */
582 case kListHddBackends:
583 {
584 ComPtr<ISystemProperties> systemProperties;
585 CHECK_ERROR(rptrVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
586 com::SafeIfaceArray<IMediumFormat> mediumFormats;
587 CHECK_ERROR(systemProperties, COMGETTER(MediumFormats)(ComSafeArrayAsOutParam(mediumFormats)));
588
589 RTPrintf("Supported hard disk backends:\n\n");
590 for (size_t i = 0; i < mediumFormats.size(); ++i)
591 {
592 /* General information */
593 Bstr id;
594 CHECK_ERROR(mediumFormats[i], COMGETTER(Id)(id.asOutParam()));
595
596 Bstr description;
597 CHECK_ERROR(mediumFormats[i],
598 COMGETTER(Id)(description.asOutParam()));
599
600 ULONG caps;
601 CHECK_ERROR(mediumFormats[i],
602 COMGETTER(Capabilities)(&caps));
603
604 RTPrintf("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='",
605 i, id.raw(), description.raw(), caps);
606
607 /* File extensions */
608 com::SafeArray <BSTR> fileExtensions;
609 com::SafeArray <DeviceType_T> deviceTypes;
610 CHECK_ERROR(mediumFormats[i],
611 DescribeFileExtensions(ComSafeArrayAsOutParam(fileExtensions), ComSafeArrayAsOutParam(deviceTypes)));
612 for (size_t j = 0; j < fileExtensions.size(); ++j)
613 {
614 RTPrintf("%ls (%s)", Bstr(fileExtensions[j]).raw(), getDeviceTypeText(deviceTypes[j]));
615 if (j != fileExtensions.size()-1)
616 RTPrintf(",");
617 }
618 RTPrintf("'");
619
620 /* Configuration keys */
621 com::SafeArray <BSTR> propertyNames;
622 com::SafeArray <BSTR> propertyDescriptions;
623 com::SafeArray <DataType_T> propertyTypes;
624 com::SafeArray <ULONG> propertyFlags;
625 com::SafeArray <BSTR> propertyDefaults;
626 CHECK_ERROR(mediumFormats[i],
627 DescribeProperties(ComSafeArrayAsOutParam(propertyNames),
628 ComSafeArrayAsOutParam(propertyDescriptions),
629 ComSafeArrayAsOutParam(propertyTypes),
630 ComSafeArrayAsOutParam(propertyFlags),
631 ComSafeArrayAsOutParam(propertyDefaults)));
632
633 RTPrintf(" properties=(");
634 if (propertyNames.size() > 0)
635 {
636 for (size_t j = 0; j < propertyNames.size(); ++j)
637 {
638 RTPrintf("\n name='%ls' desc='%ls' type=",
639 Bstr(propertyNames[j]).raw(), Bstr(propertyDescriptions[j]).raw());
640 switch (propertyTypes[j])
641 {
642 case DataType_Int32: RTPrintf("int"); break;
643 case DataType_Int8: RTPrintf("byte"); break;
644 case DataType_String: RTPrintf("string"); break;
645 }
646 RTPrintf(" flags=%#04x", propertyFlags[j]);
647 RTPrintf(" default='%ls'", Bstr(propertyDefaults[j]).raw());
648 if (j != propertyNames.size()-1)
649 RTPrintf(", ");
650 }
651 }
652 RTPrintf(")\n");
653 }
654 break;
655 }
656
657 case kListHdds:
658 {
659 com::SafeIfaceArray<IMedium> hdds;
660 CHECK_ERROR(rptrVirtualBox, COMGETTER(HardDisks)(ComSafeArrayAsOutParam(hdds)));
661 listMedia(rptrVirtualBox, hdds, "base");
662 break;
663 }
664
665 case kListDvds:
666 {
667 com::SafeIfaceArray<IMedium> dvds;
668 CHECK_ERROR(rptrVirtualBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(dvds)));
669 listMedia(rptrVirtualBox, dvds, NULL);
670 break;
671 }
672
673 case kListFloppies:
674 {
675 com::SafeIfaceArray<IMedium> floppies;
676 CHECK_ERROR(rptrVirtualBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppies)));
677 listMedia(rptrVirtualBox, floppies, NULL);
678 break;
679 }
680
681 /** @todo function. */
682 case kListUsbHost:
683 {
684 ComPtr<IHost> Host;
685 CHECK_ERROR_RET(rptrVirtualBox, COMGETTER(Host)(Host.asOutParam()), 1);
686
687 SafeIfaceArray<IHostUSBDevice> CollPtr;
688 CHECK_ERROR_RET(Host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(CollPtr)), 1);
689
690 RTPrintf("Host USB Devices:\n\n");
691
692 if (CollPtr.size() == 0)
693 {
694 RTPrintf("<none>\n\n");
695 }
696 else
697 {
698 for (size_t i = 0; i < CollPtr.size(); ++i)
699 {
700 ComPtr <IHostUSBDevice> dev = CollPtr[i];
701
702 /* Query info. */
703 Bstr id;
704 CHECK_ERROR_RET(dev, COMGETTER(Id)(id.asOutParam()), 1);
705 USHORT usVendorId;
706 CHECK_ERROR_RET(dev, COMGETTER(VendorId)(&usVendorId), 1);
707 USHORT usProductId;
708 CHECK_ERROR_RET(dev, COMGETTER(ProductId)(&usProductId), 1);
709 USHORT bcdRevision;
710 CHECK_ERROR_RET(dev, COMGETTER(Revision)(&bcdRevision), 1);
711
712 RTPrintf("UUID: %s\n"
713 "VendorId: %#06x (%04X)\n"
714 "ProductId: %#06x (%04X)\n"
715 "Revision: %u.%u (%02u%02u)\n",
716 Utf8Str(id).c_str(),
717 usVendorId, usVendorId, usProductId, usProductId,
718 bcdRevision >> 8, bcdRevision & 0xff,
719 bcdRevision >> 8, bcdRevision & 0xff);
720
721 /* optional stuff. */
722 Bstr bstr;
723 CHECK_ERROR_RET(dev, COMGETTER(Manufacturer)(bstr.asOutParam()), 1);
724 if (!bstr.isEmpty())
725 RTPrintf("Manufacturer: %ls\n", bstr.raw());
726 CHECK_ERROR_RET(dev, COMGETTER(Product)(bstr.asOutParam()), 1);
727 if (!bstr.isEmpty())
728 RTPrintf("Product: %ls\n", bstr.raw());
729 CHECK_ERROR_RET(dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
730 if (!bstr.isEmpty())
731 RTPrintf("SerialNumber: %ls\n", bstr.raw());
732 CHECK_ERROR_RET(dev, COMGETTER(Address)(bstr.asOutParam()), 1);
733 if (!bstr.isEmpty())
734 RTPrintf("Address: %ls\n", bstr.raw());
735
736 /* current state */
737 USBDeviceState_T state;
738 CHECK_ERROR_RET(dev, COMGETTER(State)(&state), 1);
739 const char *pszState = "?";
740 switch (state)
741 {
742 case USBDeviceState_NotSupported:
743 pszState = "Not supported";
744 break;
745 case USBDeviceState_Unavailable:
746 pszState = "Unavailable";
747 break;
748 case USBDeviceState_Busy:
749 pszState = "Busy";
750 break;
751 case USBDeviceState_Available:
752 pszState = "Available";
753 break;
754 case USBDeviceState_Held:
755 pszState = "Held";
756 break;
757 case USBDeviceState_Captured:
758 pszState = "Captured";
759 break;
760 default:
761 ASSERT(false);
762 break;
763 }
764 RTPrintf("Current State: %s\n\n", pszState);
765 }
766 }
767 break;
768 }
769
770 /** @todo function. */
771 case kListUsbFilters:
772 {
773 RTPrintf("Global USB Device Filters:\n\n");
774
775 ComPtr<IHost> host;
776 CHECK_ERROR_RET(rptrVirtualBox, COMGETTER(Host)(host.asOutParam()), 1);
777
778 SafeIfaceArray<IHostUSBDeviceFilter> coll;
779 CHECK_ERROR_RET(host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll)), 1);
780
781 if (coll.size() == 0)
782 {
783 RTPrintf("<none>\n\n");
784 }
785 else
786 {
787 for (size_t index = 0; index < coll.size(); ++index)
788 {
789 ComPtr<IHostUSBDeviceFilter> flt = coll[index];
790
791 /* Query info. */
792
793 RTPrintf("Index: %zu\n", index);
794
795 BOOL active = FALSE;
796 CHECK_ERROR_RET(flt, COMGETTER(Active)(&active), 1);
797 RTPrintf("Active: %s\n", active ? "yes" : "no");
798
799 USBDeviceFilterAction_T action;
800 CHECK_ERROR_RET(flt, COMGETTER(Action)(&action), 1);
801 const char *pszAction = "<invalid>";
802 switch (action)
803 {
804 case USBDeviceFilterAction_Ignore:
805 pszAction = "Ignore";
806 break;
807 case USBDeviceFilterAction_Hold:
808 pszAction = "Hold";
809 break;
810 default:
811 break;
812 }
813 RTPrintf("Action: %s\n", pszAction);
814
815 Bstr bstr;
816 CHECK_ERROR_RET(flt, COMGETTER(Name)(bstr.asOutParam()), 1);
817 RTPrintf("Name: %ls\n", bstr.raw());
818 CHECK_ERROR_RET(flt, COMGETTER(VendorId)(bstr.asOutParam()), 1);
819 RTPrintf("VendorId: %ls\n", bstr.raw());
820 CHECK_ERROR_RET(flt, COMGETTER(ProductId)(bstr.asOutParam()), 1);
821 RTPrintf("ProductId: %ls\n", bstr.raw());
822 CHECK_ERROR_RET(flt, COMGETTER(Revision)(bstr.asOutParam()), 1);
823 RTPrintf("Revision: %ls\n", bstr.raw());
824 CHECK_ERROR_RET(flt, COMGETTER(Manufacturer)(bstr.asOutParam()), 1);
825 RTPrintf("Manufacturer: %ls\n", bstr.raw());
826 CHECK_ERROR_RET(flt, COMGETTER(Product)(bstr.asOutParam()), 1);
827 RTPrintf("Product: %ls\n", bstr.raw());
828 CHECK_ERROR_RET(flt, COMGETTER(SerialNumber)(bstr.asOutParam()), 1);
829 RTPrintf("Serial Number: %ls\n\n", bstr.raw());
830 }
831 }
832 break;
833 }
834
835 /** @todo function. */
836 case kListSystemProperties:
837 {
838 ComPtr<ISystemProperties> systemProperties;
839 rptrVirtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam());
840
841 Bstr str;
842 ULONG ulValue;
843 LONG64 i64Value;
844
845 rptrVirtualBox->COMGETTER(APIVersion)(str.asOutParam());
846 RTPrintf("API version: %ls\n", str.raw());
847
848 systemProperties->COMGETTER(MinGuestRAM)(&ulValue);
849 RTPrintf("Minimum guest RAM size: %u Megabytes\n", ulValue);
850 systemProperties->COMGETTER(MaxGuestRAM)(&ulValue);
851 RTPrintf("Maximum guest RAM size: %u Megabytes\n", ulValue);
852 systemProperties->COMGETTER(MinGuestVRAM)(&ulValue);
853 RTPrintf("Minimum video RAM size: %u Megabytes\n", ulValue);
854 systemProperties->COMGETTER(MaxGuestVRAM)(&ulValue);
855 RTPrintf("Maximum video RAM size: %u Megabytes\n", ulValue);
856 systemProperties->COMGETTER(MinGuestCPUCount)(&ulValue);
857 RTPrintf("Minimum guest CPU count: %u\n", ulValue);
858 systemProperties->COMGETTER(MaxGuestCPUCount)(&ulValue);
859 RTPrintf("Maximum guest CPU count: %u\n", ulValue);
860 systemProperties->COMGETTER(InfoVDSize)(&i64Value);
861 RTPrintf("Virtual disk limit (info): %lld Bytes\n", i64Value);
862 systemProperties->COMGETTER(SerialPortCount)(&ulValue);
863 RTPrintf("Maximum Serial Port count: %u\n", ulValue);
864 systemProperties->COMGETTER(ParallelPortCount)(&ulValue);
865 RTPrintf("Maximum Parallel Port count: %u\n", ulValue);
866 systemProperties->COMGETTER(MaxBootPosition)(&ulValue);
867 RTPrintf("Maximum Boot Position: %u\n", ulValue);
868 systemProperties->GetMaxNetworkAdapters(ChipsetType_PIIX3, &ulValue);
869 RTPrintf("Maximum PIIX3 Network Adapter count: %u\n", ulValue);
870 systemProperties->GetMaxNetworkAdapters(ChipsetType_ICH9, &ulValue);
871 RTPrintf("Maximum ICH9 Network Adapter count: %u\n", ulValue);
872 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_IDE, &ulValue);
873 RTPrintf("Maximum PIIX3 IDE Controllers: %u\n", ulValue);
874 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_IDE, &ulValue);
875 RTPrintf("Maximum ICH9 IDE Controllers: %u\n", ulValue);
876 systemProperties->GetMaxPortCountForStorageBus(StorageBus_IDE, &ulValue);
877 RTPrintf("Maximum IDE Port count: %u\n", ulValue);
878 systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_IDE, &ulValue);
879 RTPrintf("Maximum Devices per IDE Port: %u\n", ulValue);
880 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SATA, &ulValue);
881 RTPrintf("Maximum PIIX3 SATA Controllers: %u\n", ulValue);
882 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SATA, &ulValue);
883 RTPrintf("Maximum ICH9 SATA Controllers: %u\n", ulValue);
884 systemProperties->GetMaxPortCountForStorageBus(StorageBus_SATA, &ulValue);
885 RTPrintf("Maximum SATA Port count: %u\n", ulValue);
886 systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SATA, &ulValue);
887 RTPrintf("Maximum Devices per SATA Port: %u\n", ulValue);
888 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SCSI, &ulValue);
889 RTPrintf("Maximum PIIX3 SCSI Controllers: %u\n", ulValue);
890 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SCSI, &ulValue);
891 RTPrintf("Maximum ICH9 SCSI Controllers: %u\n", ulValue);
892 systemProperties->GetMaxPortCountForStorageBus(StorageBus_SCSI, &ulValue);
893 RTPrintf("Maximum SCSI Port count: %u\n", ulValue);
894 systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SCSI, &ulValue);
895 RTPrintf("Maximum Devices per SCSI Port: %u\n", ulValue);
896 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SAS, &ulValue);
897 RTPrintf("Maximum SAS PIIX3 Controllers: %u\n", ulValue);
898 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SAS, &ulValue);
899 RTPrintf("Maximum SAS ICH9 Controllers: %u\n", ulValue);
900 systemProperties->GetMaxPortCountForStorageBus(StorageBus_SAS, &ulValue);
901 RTPrintf("Maximum SAS Port count: %u\n", ulValue);
902 systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SAS, &ulValue);
903 RTPrintf("Maximum Devices per SAS Port: %u\n", ulValue);
904 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_Floppy, &ulValue);
905 RTPrintf("Maximum PIIX3 Floppy Controllers:%u\n", ulValue);
906 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_Floppy, &ulValue);
907 RTPrintf("Maximum ICH9 Floppy Controllers: %u\n", ulValue);
908 systemProperties->GetMaxPortCountForStorageBus(StorageBus_Floppy, &ulValue);
909 RTPrintf("Maximum Floppy Port count: %u\n", ulValue);
910 systemProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_Floppy, &ulValue);
911 RTPrintf("Maximum Devices per Floppy Port: %u\n", ulValue);
912 systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam());
913 RTPrintf("Default machine folder: %ls\n", str.raw());
914 systemProperties->COMGETTER(VRDEAuthLibrary)(str.asOutParam());
915 RTPrintf("VRDE auth library: %ls\n", str.raw());
916 systemProperties->COMGETTER(WebServiceAuthLibrary)(str.asOutParam());
917 RTPrintf("Webservice auth. library: %ls\n", str.raw());
918 systemProperties->COMGETTER(DefaultVRDEExtPack)(str.asOutParam());
919 RTPrintf("Remote desktop ExtPack: %ls\n", str.raw());
920 systemProperties->COMGETTER(LogHistoryCount)(&ulValue);
921 RTPrintf("Log history count: %u\n", ulValue);
922 break;
923 }
924
925 case kListDhcpServers:
926 {
927 com::SafeIfaceArray<IDHCPServer> svrs;
928 CHECK_ERROR(rptrVirtualBox, COMGETTER(DHCPServers)(ComSafeArrayAsOutParam(svrs)));
929 for (size_t i = 0; i < svrs.size(); ++i)
930 {
931 ComPtr<IDHCPServer> svr = svrs[i];
932 Bstr netName;
933 svr->COMGETTER(NetworkName)(netName.asOutParam());
934 RTPrintf("NetworkName: %ls\n", netName.raw());
935 Bstr ip;
936 svr->COMGETTER(IPAddress)(ip.asOutParam());
937 RTPrintf("IP: %ls\n", ip.raw());
938 Bstr netmask;
939 svr->COMGETTER(NetworkMask)(netmask.asOutParam());
940 RTPrintf("NetworkMask: %ls\n", netmask.raw());
941 Bstr lowerIp;
942 svr->COMGETTER(LowerIP)(lowerIp.asOutParam());
943 RTPrintf("lowerIPAddress: %ls\n", lowerIp.raw());
944 Bstr upperIp;
945 svr->COMGETTER(UpperIP)(upperIp.asOutParam());
946 RTPrintf("upperIPAddress: %ls\n", upperIp.raw());
947 BOOL fEnabled;
948 svr->COMGETTER(Enabled)(&fEnabled);
949 RTPrintf("Enabled: %s\n", fEnabled ? "Yes" : "No");
950 RTPrintf("\n");
951 }
952 break;
953 }
954
955 case kListExtPacks:
956 rc = listExtensionPacks(rptrVirtualBox);
957 break;
958
959 /* No default here, want gcc warnings. */
960
961 } /* end switch */
962
963 return rc;
964}
965
966/**
967 * Handles the 'list' command.
968 *
969 * @returns Appropriate exit code.
970 * @param a Handler argument.
971 */
972int handleList(HandlerArg *a)
973{
974 bool fOptLong = false;
975 bool fOptMultiple = false;
976 enum enmListType enmOptCommand = kListNotSpecified;
977
978 static const RTGETOPTDEF s_aListOptions[] =
979 {
980 { "--long", 'l', RTGETOPT_REQ_NOTHING },
981 { "--multiple", 'm', RTGETOPT_REQ_NOTHING }, /* not offical yet */
982 { "vms", kListVMs, RTGETOPT_REQ_NOTHING },
983 { "runningvms", kListRunningVMs, RTGETOPT_REQ_NOTHING },
984 { "ostypes", kListOsTypes, RTGETOPT_REQ_NOTHING },
985 { "hostdvds", kListHostDvds, RTGETOPT_REQ_NOTHING },
986 { "hostfloppies", kListHostFloppies, RTGETOPT_REQ_NOTHING },
987 { "hostifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING }, /* backward compatibility */
988 { "bridgedifs", kListBridgedInterfaces, RTGETOPT_REQ_NOTHING },
989#if defined(VBOX_WITH_NETFLT)
990 { "hostonlyifs", kListHostOnlyInterfaces, RTGETOPT_REQ_NOTHING },
991#endif
992 { "hostinfo", kListHostInfo, RTGETOPT_REQ_NOTHING },
993 { "hostcpuids", kListHostCpuIDs, RTGETOPT_REQ_NOTHING },
994 { "hddbackends", kListHddBackends, RTGETOPT_REQ_NOTHING },
995 { "hdds", kListHdds, RTGETOPT_REQ_NOTHING },
996 { "dvds", kListDvds, RTGETOPT_REQ_NOTHING },
997 { "floppies", kListFloppies, RTGETOPT_REQ_NOTHING },
998 { "usbhost", kListUsbHost, RTGETOPT_REQ_NOTHING },
999 { "usbfilters", kListUsbFilters, RTGETOPT_REQ_NOTHING },
1000 { "systemproperties", kListSystemProperties, RTGETOPT_REQ_NOTHING },
1001 { "dhcpservers", kListDhcpServers, RTGETOPT_REQ_NOTHING },
1002 { "extpacks", kListExtPacks, RTGETOPT_REQ_NOTHING },
1003 };
1004
1005 int ch;
1006 RTGETOPTUNION ValueUnion;
1007 RTGETOPTSTATE GetState;
1008 RTGetOptInit(&GetState, a->argc, a->argv, s_aListOptions, RT_ELEMENTS(s_aListOptions),
1009 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
1010 while ((ch = RTGetOpt(&GetState, &ValueUnion)))
1011 {
1012 switch (ch)
1013 {
1014 case 'l': /* --long */
1015 fOptLong = true;
1016 break;
1017
1018 case 'm':
1019 fOptMultiple = true;
1020 if (enmOptCommand == kListNotSpecified)
1021 break;
1022 ch = enmOptCommand;
1023 /* fall thru */
1024
1025 case kListVMs:
1026 case kListRunningVMs:
1027 case kListOsTypes:
1028 case kListHostDvds:
1029 case kListHostFloppies:
1030 case kListBridgedInterfaces:
1031#if defined(VBOX_WITH_NETFLT)
1032 case kListHostOnlyInterfaces:
1033#endif
1034 case kListHostInfo:
1035 case kListHostCpuIDs:
1036 case kListHddBackends:
1037 case kListHdds:
1038 case kListDvds:
1039 case kListFloppies:
1040 case kListUsbHost:
1041 case kListUsbFilters:
1042 case kListSystemProperties:
1043 case kListDhcpServers:
1044 case kListExtPacks:
1045 enmOptCommand = (enum enmListType)ch;
1046 if (fOptMultiple)
1047 {
1048 HRESULT hrc = produceList((enum enmListType)ch, fOptLong, a->virtualBox);
1049 if (FAILED(hrc))
1050 return 1;
1051 }
1052 break;
1053
1054 case VINF_GETOPT_NOT_OPTION:
1055 return errorSyntax(USAGE_LIST, "Unknown subcommand \"%s\".", ValueUnion.psz);
1056
1057 default:
1058 return errorGetOpt(USAGE_LIST, ch, &ValueUnion);
1059 }
1060 }
1061
1062 /*
1063 * If not in multiple list mode, we have to produce the list now.
1064 */
1065 if (enmOptCommand == kListNotSpecified)
1066 return errorSyntax(USAGE_LIST, "Missing subcommand for \"list\" command.\n");
1067 if (!fOptMultiple)
1068 {
1069 HRESULT hrc = produceList(enmOptCommand, fOptLong, a->virtualBox);
1070 if (FAILED(hrc))
1071 return 1;
1072 }
1073
1074 return 0;
1075}
1076
1077#endif /* !VBOX_ONLY_DOCS */
1078/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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